import { l as inferObservableValue, m as Observable } from "./index-CFQnkrGZ.mjs";
//#region src/unstable-core-do-not-import/types.d.ts
/**
 * ================================
 * Useful utility types that doesn't have anything to do with tRPC in particular
 * ================================
 */
/**
 * @public
 */
type Maybe<TType> = TType | null | undefined;
/**
 * @internal
 * @see https://github.com/ianstormtaylor/superstruct/blob/7973400cd04d8ad92bbdc2b6f35acbfb3c934079/src/utils.ts#L323-L325
 */
type Simplify<TType> = TType extends any[] | Date ? TType : { [K in keyof TType]: TType[K]; };
/**
 * An object with string keys whose values may be `undefined`.
 * @public
 */
type Dict<TType> = Record<string, TType | undefined>;
/**
 * A value, or a promise of one.
 * @public
 */
type MaybePromise<TType> = Promise<TType> | TType;
type FilterKeys<TObj extends object, TFilter> = { [TKey in keyof TObj]: TObj[TKey] extends TFilter ? TKey : never; }[keyof TObj];
/**
 * @internal
 */
type Result$1<TType, TErr = unknown> = {
  ok: true;
  value: TType;
} | {
  ok: false;
  error: TErr;
};
/**
 * @internal
 */
type Filter<TObj extends object, TFilter> = Pick<TObj, FilterKeys<TObj, TFilter>>;
/**
 * Unwrap return type if the type is a function (sync or async), else use the type as is
 * @internal
 */
type Unwrap<TType> = TType extends ((...args: any[]) => infer R) ? Awaited<R> : TType;
/**
 * Makes the object recursively optional
 * @internal
 */
type DeepPartial<TObject> = TObject extends object ? { [P in keyof TObject]?: DeepPartial<TObject[P]>; } : TObject;
/**
 * Omits the key without removing a potential union
 * @internal
 */
type DistributiveOmit<TObj, TKey extends keyof any> = TObj extends any ? Omit<TObj, TKey> : never;
/**
 * See https://github.com/microsoft/TypeScript/issues/41966#issuecomment-758187996
 * Fixes issues with iterating over keys of objects with index signatures.
 * Without this, iterations over keys of objects with index signatures will lose
 * type information about the keys and only the index signature will remain.
 * @internal
 */
type WithoutIndexSignature<TObj> = { [K in keyof TObj as string extends K ? never : number extends K ? never : K]: TObj[K]; };
/**
 * @internal
 * Overwrite properties in `TType` with properties in `TWith`
 * Only overwrites properties when the type to be overwritten
 * is an object. Otherwise it will just use the type from `TWith`.
 */
type Overwrite<TType, TWith> = TWith extends any ? TType extends object ? { [K in keyof WithoutIndexSignature<TType> | keyof WithoutIndexSignature<TWith>]: K extends keyof TWith ? TWith[K] : K extends keyof TType ? TType[K] : never; } & (string extends keyof TWith ? {
  [key: string]: TWith[string];
} : number extends keyof TWith ? {
  [key: number]: TWith[number];
} : {}) : TWith : never;
/**
 * @internal
 */
type ValidateShape<TActualShape, TExpectedShape> = TActualShape extends TExpectedShape ? Exclude<keyof TActualShape, keyof TExpectedShape> extends never ? TActualShape : TExpectedShape : never;
/**
 * @internal
 */
type PickFirstDefined<TType, TPick> = undefined extends TType ? undefined extends TPick ? never : TPick : TType;
type KeyFromValue<TValue, TType extends Record<PropertyKey, PropertyKey>> = { [K in keyof TType]: TValue extends TType[K] ? K : never; }[keyof TType];
type InvertKeyValue<TType extends Record<PropertyKey, PropertyKey>> = { [TValue in TType[keyof TType]]: KeyFromValue<TValue, TType>; };
/**
 * ================================
 * tRPC specific types
 * ================================
 */
/**
 * @internal
 */
type IntersectionError<TKey extends string> = `The property '${TKey}' in your router collides with a built-in method, rename this router or procedure on your backend.`;
/**
 * @internal
 */
type ProtectedIntersection<TType, TWith> = string extends keyof TWith ? TType & TWith : keyof TType & keyof TWith extends never ? TType & TWith : IntersectionError<string & keyof TType & keyof TWith>;
/**
 * @internal
 * Returns the raw input type of a procedure
 */
type GetRawInputFn = () => Promise<unknown>;
declare const _errorSymbol: unique symbol;
type ErrorSymbol = typeof _errorSymbol;
type TypeError<TMessage extends string> = TMessage & {
  _: typeof _errorSymbol;
};
type ValueOf<TObj> = TObj[keyof TObj];
type coerceAsyncIterableToArray<TValue> = TValue extends AsyncIterable<infer $Inferred> ? $Inferred[] : TValue;
/**
 * @internal
 * Infers the type of the value yielded by an async iterable
 */
type inferAsyncIterableYield<T> = T extends AsyncIterable<infer U> ? U : T;
//#endregion
//#region src/unstable-core-do-not-import/rpc/codes.d.ts
/**
 * The JSON-RPC 2.0 error code of each tRPC error code. tRPC's own codes
 * use the range JSON-RPC leaves for servers, `-32000` to `-32099`, ending
 * in the digits of the matching HTTP status.
 * @see https://trpc.io/docs/rpc#error-codes---json-rpc-20-error-codes
 */
declare const TRPC_ERROR_CODES_BY_KEY: {
  /**
   * Invalid JSON was received by the server.
   * An error occurred on the server while parsing the JSON text.
   */
  readonly PARSE_ERROR: -32700;
  /**
   * The JSON sent is not a valid Request object.
   */
  readonly BAD_REQUEST: -32600;
  readonly INTERNAL_SERVER_ERROR: -32603;
  readonly NOT_IMPLEMENTED: -32603;
  readonly BAD_GATEWAY: -32603;
  readonly SERVICE_UNAVAILABLE: -32603;
  readonly GATEWAY_TIMEOUT: -32603;
  readonly UNAUTHORIZED: -32001;
  readonly PAYMENT_REQUIRED: -32002;
  readonly FORBIDDEN: -32003;
  readonly NOT_FOUND: -32004;
  readonly METHOD_NOT_SUPPORTED: -32005;
  readonly TIMEOUT: -32008;
  readonly CONFLICT: -32009;
  readonly PRECONDITION_FAILED: -32012;
  readonly PAYLOAD_TOO_LARGE: -32013;
  readonly UNSUPPORTED_MEDIA_TYPE: -32015;
  readonly UNPROCESSABLE_CONTENT: -32022;
  readonly PRECONDITION_REQUIRED: -32028;
  readonly TOO_MANY_REQUESTS: -32029;
  readonly CLIENT_CLOSED_REQUEST: -32099;
};
/**
 * The tRPC error code of each JSON-RPC 2.0 error code.
 * @see https://trpc.io/docs/rpc#error-codes---json-rpc-20-error-codes
 */
declare const TRPC_ERROR_CODES_BY_NUMBER: InvertKeyValue<typeof TRPC_ERROR_CODES_BY_KEY>;
/** A JSON-RPC 2.0 error code tRPC sends, such as `-32004`. */
type TRPC_ERROR_CODE_NUMBER = ValueOf<typeof TRPC_ERROR_CODES_BY_KEY>;
/**
 * A tRPC error code, such as `'NOT_FOUND'`.
 * @see https://trpc.io/docs/server/error-handling#error-codes
 */
type TRPC_ERROR_CODE_KEY = keyof typeof TRPC_ERROR_CODES_BY_KEY;
/**
 * tRPC error codes that are considered retryable
 * With out of the box SSE, the client will reconnect when these errors are encountered
 */
declare const retryableRpcCodes: TRPC_ERROR_CODE_NUMBER[];
//#endregion
//#region src/unstable-core-do-not-import/error/TRPCError.d.ts
declare function getCauseFromUnknown(cause: unknown): Error | undefined;
/**
 * Turns anything thrown into a `TRPCError`. A `TRPCError` is returned as
 * is; anything else becomes an `INTERNAL_SERVER_ERROR` with it as the
 * cause.
 */
declare function getTRPCErrorFromUnknown(cause: unknown): TRPCError;
/**
 * An error with a tRPC error code, which sets the HTTP status and the code
 * the client sees. Throw it from resolvers and middlewares.
 * @example
 * ```ts
 * throw new TRPCError({ code: 'NOT_FOUND', message: 'No such post' });
 * ```
 * @see https://trpc.io/docs/server/error-handling#throwing-errors
 */
declare class TRPCError extends Error {
  /** The error this one wraps, if any. */
  readonly cause?: Error;
  /** The tRPC error code, such as `'NOT_FOUND'`. */
  readonly code: "BAD_GATEWAY" | "BAD_REQUEST" | "CLIENT_CLOSED_REQUEST" | "CONFLICT" | "FORBIDDEN" | "GATEWAY_TIMEOUT" | "INTERNAL_SERVER_ERROR" | "METHOD_NOT_SUPPORTED" | "NOT_FOUND" | "NOT_IMPLEMENTED" | "PARSE_ERROR" | "PAYLOAD_TOO_LARGE" | "PAYMENT_REQUIRED" | "PRECONDITION_FAILED" | "PRECONDITION_REQUIRED" | "SERVICE_UNAVAILABLE" | "TIMEOUT" | "TOO_MANY_REQUESTS" | "UNAUTHORIZED" | "UNPROCESSABLE_CONTENT" | "UNSUPPORTED_MEDIA_TYPE";
  constructor(opts: {
    /** Defaults to the cause's message, or else the code. */
    message?: string;
    /** @see https://trpc.io/docs/server/error-handling#error-codes */
    code: TRPC_ERROR_CODE_KEY;
    /** The original error. Anything that isn't an `Error` is wrapped in one. */
    cause?: unknown;
  });
}
//#endregion
//#region src/vendor/standard-schema-v1/spec.d.ts
/**
 *
 * @see https://github.com/standard-schema/standard-schema/blob/main/packages/spec/src/index.ts
 */
/** The Standard Schema interface. */
interface StandardSchemaV1<Input = unknown, Output = Input> {
  /** The Standard Schema properties. */
  readonly '~standard': StandardSchemaV1.Props<Input, Output>;
}
declare namespace StandardSchemaV1 {
  /** The Standard Schema properties interface. */
  interface Props<Input = unknown, Output = Input> {
    /** The version number of the standard. */
    readonly version: 1;
    /** The vendor name of the schema library. */
    readonly vendor: string;
    /** Validates unknown input values. */
    readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
    /** Inferred types associated with the schema. */
    readonly types?: Types<Input, Output> | undefined;
  }
  /** The result interface of the validate function. */
  type Result<Output> = SuccessResult<Output> | FailureResult;
  /** The result interface if validation succeeds. */
  interface SuccessResult<Output> {
    /** The typed output value. */
    readonly value: Output;
    /** The non-existent issues. */
    readonly issues?: undefined;
  }
  /** The result interface if validation fails. */
  interface FailureResult {
    /** The issues of failed validation. */
    readonly issues: ReadonlyArray<Issue>;
  }
  /** The issue interface of the failure output. */
  interface Issue {
    /** The error message of the issue. */
    readonly message: string;
    /** The path of the issue, if any. */
    readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
  }
  /** The path segment interface of the issue. */
  interface PathSegment {
    /** The key representing a path segment. */
    readonly key: PropertyKey;
  }
  /** The Standard Schema types interface. */
  interface Types<Input = unknown, Output = Input> {
    /** The input type of the schema. */
    readonly input: Input;
    /** The output type of the schema. */
    readonly output: Output;
  }
  /** Infers the input type of a Standard Schema. */
  type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
  /** Infers the output type of a Standard Schema. */
  type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
}
//#endregion
//#region src/unstable-core-do-not-import/parser.d.ts
type ParserZodEsque<TInput, TParsedInput> = {
  _input: TInput;
  _output: TParsedInput;
};
type ParserValibotEsque<TInput, TParsedInput> = {
  schema: {
    _types?: {
      input: TInput;
      output: TParsedInput;
    };
  };
};
type ParserArkTypeEsque<TInput, TParsedInput> = {
  inferIn: TInput;
  infer: TParsedInput;
};
type ParserStandardSchemaEsque<TInput, TParsedInput> = StandardSchemaV1<TInput, TParsedInput>;
type ParserMyZodEsque<TInput> = {
  parse: (input: any) => TInput;
};
type ParserSuperstructEsque<TInput> = {
  create: (input: unknown) => TInput;
};
type ParserCustomValidatorEsque<TInput> = (input: unknown) => Promise<TInput> | TInput;
type ParserYupEsque<TInput> = {
  validateSync: (input: unknown) => TInput;
};
type ParserScaleEsque<TInput> = {
  assert(value: unknown): asserts value is TInput;
};
type ParserWithoutInput<TInput> = ParserCustomValidatorEsque<TInput> | ParserMyZodEsque<TInput> | ParserScaleEsque<TInput> | ParserSuperstructEsque<TInput> | ParserYupEsque<TInput>;
type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput> | ParserValibotEsque<TInput, TParsedInput> | ParserArkTypeEsque<TInput, TParsedInput> | ParserStandardSchemaEsque<TInput, TParsedInput>;
type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
type inferParser<TParser extends Parser> = TParser extends ParserStandardSchemaEsque<infer $TIn, infer $TOut> ? {
  in: $TIn;
  out: $TOut;
} : TParser extends ParserWithInputOutput<infer $TIn, infer $TOut> ? {
  in: $TIn;
  out: $TOut;
} : TParser extends ParserWithoutInput<infer $InOut> ? {
  in: $InOut;
  out: $InOut;
} : never;
type ParseFn<TType> = (value: unknown) => Promise<TType> | TType;
declare function getParseFn<TType>(procedureParser: Parser): ParseFn<TType>;
//#endregion
//#region src/unstable-core-do-not-import/http/pathSeparator.d.ts
/**
 * The character between a procedure path's segments in HTTP URLs, such as
 * the `~` in `/trpc/post~byId`. Procedure paths stay dotted everywhere else:
 * in middlewares, errors, `onError` and query keys.
 *
 * These are the URL "unreserved" punctuation characters (RFC 3986), which
 * are never percent-encoded or normalised and mean nothing to routers. `/`
 * would need catch-all routes in every adapter, and `,` separates batched
 * calls.
 */
type PathSeparator = '.' | '_' | '~' | '-';
/**
 * Applies the `'.'` default to a user-given `pathSeparator` option. Call it
 * once, where the option is read.
 * @internal
 */
declare function resolvePathSeparator(value: PathSeparator | undefined): PathSeparator;
/**
 * `post.byId` → `post~byId`, for building URLs.
 * @internal
 */
declare function procedurePathToURLPath(path: string, separator: PathSeparator): string;
/**
 * `post~byId` → `post.byId`, for reading URLs. Dotted paths still resolve,
 * so clients can move to the separator after the server does.
 * @internal
 */
declare function urlPathToProcedurePath(path: string, separator: PathSeparator): string;
//#endregion
//#region src/unstable-core-do-not-import/stream/jsonl.d.ts
/**
 * A subset of the standard ReadableStream properties needed by tRPC internally.
 * @see ReadableStream from lib.dom.d.ts
 */
type WebReadableStreamEsque = {
  getReader: () => ReadableStreamDefaultReader<Uint8Array>;
};
type NodeJSReadableStreamEsque = {
  on(eventName: string | symbol, listener: (...args: any[]) => void): NodeJSReadableStreamEsque;
};
declare function isPromise(value: unknown): value is Promise<unknown>;
type Serialize$2 = (value: any) => any;
type Deserialize$1 = (value: any) => any;
type PathArray = readonly (string | number)[];
type ProducerOnError = (opts: {
  error: unknown;
  path: PathArray;
}) => void;
interface JSONLProducerOptions {
  serialize?: Serialize$2;
  data: Record<string, unknown> | unknown[];
  onError?: ProducerOnError;
  formatError?: (opts: {
    error: unknown;
    path: PathArray;
  }) => unknown;
  maxDepth?: number;
  /**
   * Interval in milliseconds to send a ping to the client to keep the connection alive
   * This will be sent as a whitespace character
   * @default undefined
   */
  pingMs?: number;
}
/**
 * JSON Lines stream producer
 * @see https://jsonlines.org/
 */
declare function jsonlStreamProducer(opts: JSONLProducerOptions): ReadableStream<Uint8Array<ArrayBuffer>>;
type ConsumerOnError = (opts: {
  error: unknown;
}) => void;
/**
 * JSON Lines stream consumer
 * @see https://jsonlines.org/
 */
declare function jsonlStreamConsumer<THead>(opts: {
  from: NodeJSReadableStreamEsque | WebReadableStreamEsque;
  deserialize?: Deserialize$1;
  onError?: ConsumerOnError;
  formatError?: (opts: {
    error: unknown;
  }) => Error;
  /**
   * This `AbortController` will be triggered when there are no more listeners to the stream.
   */
  abortController: AbortController;
}): Promise<readonly [Awaited<THead>]>;
//#endregion
//#region src/unstable-core-do-not-import/stream/sse.types.d.ts
/**
 * @internal
 */
declare namespace EventSourceLike {
  export interface InitDict {
    withCredentials?: boolean;
  }
  export interface MessageEvent extends Event {
    data: any;
    lastEventId?: string;
  }
  export interface Event {}
  type EventSourceListenerLike = (event: Event) => void;
  export type AnyConstructorLike<TInit extends InitDict> = new (url: string, eventSourceInitDict?: TInit) => Instance;
  export interface Instance {
    readonly CLOSED: number;
    readonly CONNECTING: number;
    readonly OPEN: number;
    addEventListener(type: string, listener: EventSourceListenerLike): void;
    removeEventListener(type: string, listener: EventSourceListenerLike): void;
    close: () => void;
    readyState: number;
  }
  export type AnyConstructor = AnyConstructorLike<any>;
  export type ListenerOf<T extends AnyConstructor> = Parameters<InstanceType<T>['addEventListener']>[1];
  export type EventOf<T extends AnyConstructor> = Parameters<ListenerOf<T>>[0];
  export type InitDictOf<T extends AnyConstructor> = ConstructorParameters<T>[1];
  export {};
}
//#endregion
//#region src/unstable-core-do-not-import/stream/tracked.d.ts
declare const trackedSymbol: unique symbol;
type TrackedId = string & {
  __brand: 'TrackedId';
};
/** An event wrapped by `tracked()`, with its id. */
type TrackedEnvelope<TData> = [TrackedId, TData, typeof trackedSymbol];
/** A tracked event as the client gets it. */
interface TrackedData<TData> {
  /**
   * The event's id, which the client sends back as `lastEventId` when it
   * reconnects.
   */
  id: string;
  /**
   * The event's data.
   */
  data: TData;
}
/**
 * Wraps an event with an id, so a client can resume from it.
 * @deprecated Use `tracked(id, data)` instead.
 */
declare function sse<TData>(event: {
  id: string;
  data: TData;
}): TrackedEnvelope<TData>;
/** Whether a value was made by `tracked()`. */
declare function isTrackedEnvelope<TData>(value: unknown): value is TrackedEnvelope<TData>;
/**
 * Gives a subscription event an id. When the connection drops, the client
 * reconnects with the last id it got, as `input.lastEventId`, so the
 * subscription can resume from there. The id can't be empty.
 * @example
 * ```ts
 * yield tracked(post.id, post);
 * ```
 * @see https://trpc.io/docs/server/subscriptions#tracked
 */
declare function tracked<TData>(id: string, data: TData): TrackedEnvelope<TData>;
/** The type a client gets for an event, unwrapping `tracked()` events. */
type inferTrackedOutput<TData> = TData extends TrackedEnvelope<infer $Data> ? TrackedData<$Data> : TData;
//#endregion
//#region src/unstable-core-do-not-import/stream/sse.d.ts
type Serialize$1 = (value: any) => any;
type Deserialize = (value: any) => any;
/**
 * @internal
 */
interface SSEPingOptions {
  /**
   * Enable ping comments sent from the server
   * @default false
   */
  enabled: boolean;
  /**
   * Interval in milliseconds
   * @default 1000
   */
  intervalMs?: number;
}
interface SSEClientOptions {
  /**
   * Timeout and reconnect after inactivity in milliseconds
   * @default undefined
   */
  reconnectAfterInactivityMs?: number;
}
interface SSEStreamProducerOptions<TValue = unknown> {
  serialize?: Serialize$1;
  data: AsyncIterable<TValue>;
  maxDepth?: number;
  ping?: SSEPingOptions;
  /**
   * Maximum duration in milliseconds for the request before ending the stream
   * @default undefined
   */
  maxDurationMs?: number;
  /**
   * End the request immediately after data is sent
   * Only useful for serverless runtimes that do not support streaming responses
   * @default false
   */
  emitAndEndImmediately?: boolean;
  formatError?: (opts: {
    error: unknown;
  }) => unknown;
  /**
   * Client-specific options - these will be sent to the client as part of the first message
   * @default {}
   */
  client?: SSEClientOptions;
  /**
   * The last event id the client sent when (re)connecting
   * @default undefined
   */
  lastEventId?: string | null;
}
/**
 *
 * @see https://html.spec.whatwg.org/multipage/server-sent-events.html
 */
declare function sseStreamProducer<TValue = unknown>(opts: SSEStreamProducerOptions<TValue>): ReadableStream<Uint8Array<ArrayBuffer>>;
interface ConsumerStreamResultBase<TConfig extends ConsumerConfig> {
  eventSource: InstanceType<TConfig['EventSource']> | null;
}
interface ConsumerStreamResultData<TConfig extends ConsumerConfig> extends ConsumerStreamResultBase<TConfig> {
  type: 'data';
  data: inferTrackedOutput<TConfig['data']>;
}
interface ConsumerStreamResultError<TConfig extends ConsumerConfig> extends ConsumerStreamResultBase<TConfig> {
  type: 'serialized-error';
  error: TConfig['error'];
}
interface ConsumerStreamResultConnecting<TConfig extends ConsumerConfig> extends ConsumerStreamResultBase<TConfig> {
  type: 'connecting';
  event: EventSourceLike.EventOf<TConfig['EventSource']> | null;
}
interface ConsumerStreamResultTimeout<TConfig extends ConsumerConfig> extends ConsumerStreamResultBase<TConfig> {
  type: 'timeout';
  ms: number;
}
interface ConsumerStreamResultPing<TConfig extends ConsumerConfig> extends ConsumerStreamResultBase<TConfig> {
  type: 'ping';
}
interface ConsumerStreamResultConnected<TConfig extends ConsumerConfig> extends ConsumerStreamResultBase<TConfig> {
  type: 'connected';
  options: SSEClientOptions;
}
type ConsumerStreamResult<TConfig extends ConsumerConfig> = ConsumerStreamResultData<TConfig> | ConsumerStreamResultError<TConfig> | ConsumerStreamResultConnecting<TConfig> | ConsumerStreamResultTimeout<TConfig> | ConsumerStreamResultPing<TConfig> | ConsumerStreamResultConnected<TConfig>;
interface SSEStreamConsumerOptions<TConfig extends ConsumerConfig> {
  url: () => MaybePromise<string>;
  init: () => MaybePromise<EventSourceLike.InitDictOf<TConfig['EventSource']>> | undefined;
  signal: AbortSignal;
  deserialize?: Deserialize;
  EventSource: TConfig['EventSource'];
}
interface ConsumerConfig {
  data: unknown;
  error: unknown;
  EventSource: EventSourceLike.AnyConstructor;
}
/**
 * @see https://html.spec.whatwg.org/multipage/server-sent-events.html
 */
declare function sseStreamConsumer<TConfig extends ConsumerConfig>(opts: SSEStreamConsumerOptions<TConfig>): AsyncIterable<ConsumerStreamResult<TConfig>>;
declare const sseHeaders: {
  readonly 'Content-Type': 'text/event-stream';
  readonly 'Cache-Control': 'no-cache, no-transform';
  readonly 'X-Accel-Buffering': 'no';
  readonly Connection: 'keep-alive';
};
//#endregion
//#region src/unstable-core-do-not-import/rootConfig.d.ts
/**
 * The initial generics that are used in the init function
 * @internal
 */
interface RootTypes {
  ctx: object;
  meta: object;
  errorShape: DefaultErrorShape;
  transformer: boolean;
}
/**
 * Recommended content types for batch stream responses.
 *
 * `application/json` remains the default for backwards compatibility, while
 * other string values are allowed for tooling or infrastructure compatibility.
 */
type JSONLContentType = 'application/json' | 'application/jsonl' | 'application/x-ndjson' | (string & {});
interface JSONLConfig extends Pick<JSONLProducerOptions, 'pingMs'> {
  /**
   * The `content-type` header to use for batch stream responses.
   * Supports any valid content type string.
   * Defaults to `application/json` for backwards compatibility.
   * @default 'application/json'
   */
  contentType?: JSONLContentType;
}
/**
 * The default check to see if we're in a server
 */
declare const isServerDefault: boolean;
/**
 * The default check to see if we're in development
 */
declare function isDevDefault(): boolean;
/**
 * The config of a tRPC root object, with the defaults filled in.
 * @see https://trpc.io/docs/server/routers#runtime-configuration
 * @internal
 */
interface RootConfig<TTypes extends RootTypes> {
  /**
   * The types that are used in the config
   * @internal
   */
  $types: TTypes;
  /**
   * Serializes inputs and outputs, so they can carry types JSON can't.
   * @see https://trpc.io/docs/server/data-transformers
   */
  transformer: CombinedDataTransformer;
  /**
   * Shapes the errors sent to the client.
   * @see https://trpc.io/docs/server/error-formatting
   */
  errorFormatter: ErrorFormatter<TTypes['ctx'], TTypes['errorShape']>;
  /**
   * Lets `@trpc/server` run outside a server, such as in a browser. Meant
   * for tests.
   * @default false
   */
  allowOutsideOfServer: boolean;
  /**
   * Whether this is a server. Meant for tests.
   * @default typeof window === 'undefined' || 'Deno' in window || process.env.NODE_ENV === 'test'
   */
  isServer: boolean;
  /**
   * Whether this is development. Errors include stack traces when it is.
   * @default process.env.NODE_ENV !== 'production'
   */
  isDev: boolean;
  /**
   * The metadata every procedure starts with.
   * @see https://trpc.io/docs/server/metadata#default-meta-chaining-and-shallow-merging
   */
  defaultMeta?: TTypes['meta'] extends object ? TTypes['meta'] : never;
  /**
   * Options for subscriptions over server-sent events (SSE).
   * @see https://trpc.io/docs/client/links/httpSubscriptionLink#sse-options-on-the-server
   */
  sse?: {
    /**
     * Whether subscriptions can be served over SSE.
     * @default true
     */
    enabled?: boolean;
  } & Pick<SSEStreamProducerOptions, 'ping' | 'emitAndEndImmediately' | 'maxDurationMs' | 'client'>;
  /**
   * Options for streamed batch responses, which `httpBatchStreamLink`
   * reads.
   * @see https://trpc.io/docs/client/links/httpBatchStreamLink#configure-jsonl-streaming-options
   */
  jsonl?: JSONLConfig;
  /**
   * The character between a procedure path's segments in HTTP URLs, for
   * networks that block `.` in URLs. With `'~'`, `post.byId` is served at
   * `/trpc/post~byId`. Only URLs change: middlewares, errors and query keys
   * still see `post.byId`. The client's HTTP links must use the same
   * separator. Dotted URLs still work.
   * @default '.'
   * @see https://trpc.io/docs/rpc#path-separator
   */
  pathSeparator: PathSeparator;
  /** Experimental options. None right now. */
  experimental?: {};
}
/**
 * The root types: context, metadata, error shape and whether there's a
 * transformer.
 * @internal
 */
type CreateRootTypes<TGenerics extends RootTypes> = TGenerics;
/** Any root types, for use in generic constraints. */
type AnyRootTypes = CreateRootTypes<{
  ctx: any;
  meta: any;
  errorShape: any;
  transformer: any;
}>;
type PartialIf<TCondition extends boolean, TType> = TCondition extends true ? Partial<TType> : TType;
/**
 * Adds a `createContext` option to an adapter's options. It's optional
 * when the context is an empty object.
 */
type CreateContextCallback<TContext, TFunction extends (...args: any[]) => any> = PartialIf<object extends TContext ? true : false, {
  /**
   * Creates the context for each request.
   * @see https://trpc.io/docs/server/context#creating-the-context
   **/
  createContext: TFunction;
}>;
//#endregion
//#region src/unstable-core-do-not-import/router.d.ts
/**
 * The procedures and sub-routers of a router, by name.
 */
interface RouterRecord {
  [key: string]: AnyProcedure | RouterRecord;
}
type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedureInput<TProcedure>) => Promise<TProcedure['_def']['type'] extends 'subscription' ? TProcedure extends LegacyObservableSubscriptionProcedure<any> ? Observable<inferProcedureOutput<TProcedure>, TRPCError> : inferProcedureOutput<TProcedure> : inferProcedureOutput<TProcedure>>;
/**
 * A router's record with every procedure turned into a function, as a
 * caller has it.
 * @internal
 */
type DecorateRouterRecord<TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends (infer $Value) ? $Value extends AnyProcedure ? DecorateProcedure<$Value> : $Value extends RouterRecord ? DecorateRouterRecord<$Value> : never : never; };
/**
 * Called when a procedure called through a caller throws.
 * @internal
 */
type RouterCallerErrorHandler<TContext> = (opts: ErrorHandlerOptions<TContext>) => void;
/**
 * Creates a caller from a context, or from a function that returns one.
 * A function is called on each procedure call, so cache it (for example
 * with `React.cache`).
 * @internal
 */
type RouterCaller<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = (ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>), options?: {
  /** Called when a procedure throws, before the error is rethrown. */
  onError?: RouterCallerErrorHandler<TRoot['ctx']>;
  /**
   * Passed to middleware and resolvers as `signal`. It doesn't stop a
   * call by itself; the resolver has to check it.
   */
  signal?: AbortSignal;
}) => DecorateRouterRecord<TRecord>;
/** A router that `lazy()` loads on its first call. */
type Lazy<TAny> = (() => Promise<TAny>) & {};
type LazyLoader<TAny> = {
  load: () => Promise<void>;
  ref: Lazy<TAny>;
  path: readonly string[];
  key: string;
};
/**
 * Loads a router on its first call instead of at startup, which can make
 * cold starts faster. Pass a function that imports the router, or a module
 * whose only export is the router.
 * @example
 * ```ts
 * const appRouter = router({
 *   slow: lazy(() => import('./slow.js').then((m) => m.slowRouter)),
 * });
 * ```
 * @see https://trpc.io/docs/server/merging-routers#lazy-load
 */
declare function lazy<TRouter extends AnyRouter>(importRouter: () => Promise<TRouter | {
  [key: string]: TRouter;
}>): Lazy<NoInfer<TRouter>>;
/**
 * A router's definition: its config and procedures.
 * @internal
 */
interface RouterDef<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
  _config: RootConfig<TRoot>;
  router: true;
  procedure?: never;
  procedures: TRecord;
  record: TRecord;
  lazy: Record<string, LazyLoader<AnyRouter>>;
}
/**
 * A router: procedures and sub-routers under one root config.
 * @see https://trpc.io/docs/server/routers
 */
interface Router<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
  _def: RouterDef<TRoot, TRecord>;
  /**
   * Creates a caller, which calls the router's procedures directly on the
   * server, from a context.
   * @see https://trpc.io/docs/server/server-side-calls#routercreatecaller
   */
  createCaller: RouterCaller<TRoot, TRecord>;
}
/**
 * A router as `t.router()` returns it, with its procedures and sub-routers
 * as properties.
 */
type BuiltRouter<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = Router<TRoot, TRecord> & TRecord;
/**
 * The type of `t.router()`.
 * @see https://trpc.io/docs/server/routers
 */
interface RouterBuilder<TRoot extends AnyRootTypes> {
  <TIn extends CreateRouterOptions>(_: TIn): BuiltRouter<TRoot, DecorateCreateRouterOptions<TIn>>;
}
/** Any router, for use in generic constraints. */
type AnyRouter = Router<any, any>;
/** A router's root types: its context, metadata, error shape and transformer. */
type inferRouterRootTypes<TRouter extends AnyRouter> = TRouter['_def']['_config']['$types'];
/** The type of a router's context. */
type inferRouterContext<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['ctx'];
/**
 * The shape of a router's errors, as its error formatter returns them.
 * @see https://trpc.io/docs/server/error-formatting
 */
type inferRouterError<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['errorShape'];
/**
 * The type of a router's metadata.
 * @see https://trpc.io/docs/server/metadata
 */
type inferRouterMeta<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['meta'];
/**
 * What `t.router()` takes: procedures, routers, lazy routers and nested
 * objects of them, by name.
 * @internal
 */
type CreateRouterOptions = {
  [key: string]: AnyProcedure | AnyRouter | CreateRouterOptions | Lazy<AnyRouter>;
};
/**
 * The record of the router `t.router()` builds from its options.
 * @internal
 */
type DecorateCreateRouterOptions<TRouterOptions extends CreateRouterOptions> = { [K in keyof TRouterOptions]: TRouterOptions[K] extends (infer $Value) ? $Value extends AnyProcedure ? $Value : $Value extends Router<any, infer TRecord> ? TRecord : $Value extends Lazy<Router<any, infer TRecord>> ? TRecord : $Value extends CreateRouterOptions ? DecorateCreateRouterOptions<$Value> : never : never; };
/**
 * @internal
 */
declare function createRouterFactory<TRoot extends AnyRootTypes>(config: RootConfig<TRoot>): <TInput extends CreateRouterOptions>(input: TInput) => BuiltRouter<TRoot, DecorateCreateRouterOptions<TInput>>;
/**
 * @internal
 */
declare function getProcedureAtPath(router: Pick<Router<any, any>, '_def'>, path: string): Promise<AnyProcedure | null>;
/**
 * Calls the procedure at `path`, throwing `NOT_FOUND` if there's none of
 * that type.
 * @internal
 */
declare function callProcedure(opts: ProcedureCallOptions<unknown> & {
  router: AnyRouter;
  allowMethodOverride?: boolean;
}): Promise<any>;
/**
 * The type of `t.createCallerFactory()`: takes a router and returns its
 * `createCaller`.
 * @see https://trpc.io/docs/server/server-side-calls#create-caller
 */
interface RouterCallerFactory<TRoot extends AnyRootTypes> {
  <TRecord extends RouterRecord>(router: Pick<Router<TRoot, TRecord>, '_def'>): RouterCaller<TRoot, TRecord>;
}
declare function createCallerFactory<TRoot extends AnyRootTypes>(): RouterCallerFactory<TRoot>;
/**
 * The router `t.mergeRouters()` returns.
 * @internal
 */
type MergeRouters<TRouters extends AnyRouter[], TRoot extends AnyRootTypes = TRouters[0]['_def']['_config']['$types'], TRecord extends RouterRecord = {}> = TRouters extends [infer Head extends AnyRouter, ...infer Tail extends AnyRouter[]] ? MergeRouters<Tail, TRoot, Head['_def']['record'] & TRecord> : BuiltRouter<TRoot, TRecord>;
declare function mergeRouters<TRouters extends AnyRouter[]>(...routerList: [...TRouters]): MergeRouters<TRouters>;
//#endregion
//#region src/unstable-core-do-not-import/http/types.d.ts
/**
 * @deprecated Use `Headers` instead. This will be removed in v12.
 */
type HTTPHeaders = Dict<string[] | string>;
/**
 * The status and headers `responseMeta` sets on a response.
 * @see https://trpc.io/docs/server/caching#using-responsemeta-to-cache-responses
 */
interface ResponseMeta {
  /** The HTTP status. Defaults to the one tRPC picks from the results. */
  status?: number;
  /** Headers to add to the response. */
  headers?: Headers | HTTPHeaders;
}
/**
 * Sets a response's status and headers from the request and its results.
 * @see https://trpc.io/docs/server/caching#using-responsemeta-to-cache-responses
 * @internal
 */
type ResponseMetaFn<TRouter extends AnyRouter> = (opts: {
  data: TRPCResponse<unknown, inferRouterError<TRouter>>[];
  ctx?: inferRouterContext<TRouter>;
  /**
   * The paths of the procedures called.
   * @deprecated Use `info` instead. This will be removed in v12.
   **/
  paths: readonly string[] | undefined;
  /** The request, if it could be parsed. */
  info: TRPCRequestInfo | undefined;
  type: ProcedureType | 'unknown';
  /** The errors the calls threw. */
  errors: TRPCError[];
  /**
   * `true` when it's called before the results are known, as for streamed
   * responses.
   */
  eagerGeneration: boolean;
}) => ResponseMeta;
/**
 * The options every HTTP adapter takes.
 */
interface HTTPBaseHandlerOptions<TRouter extends AnyRouter, TRequest> extends BaseHandlerOptions<TRouter, TRequest> {
  /**
   * Sets the response's status and headers before it's sent, for example
   * to cache it.
   * @see https://trpc.io/docs/server/caching#using-responsemeta-to-cache-responses
   */
  responseMeta?: ResponseMetaFn<TRouter>;
}
/** The `trpc-accept` header's value for a streamed response. */
type TRPCAcceptHeader = 'application/jsonl';
/** One procedure call in a request. */
interface TRPCRequestInfoProcedureCall {
  path: string;
  /**
   * Reads the call's input as the client sent it. It's read once, however
   * often it's called.
   */
  getRawInput: () => Promise<unknown>;
  /**
   * The input if it was read already. Doesn't read the body.
   */
  result: () => unknown;
  /**
   * The procedure being called, `null` if not found
   * @internal
   */
  procedure: AnyProcedure | null;
  /**
   * The index of this call in a batch request.
   */
  batchIndex: number;
}
/**
 * What tRPC knows about a request, which `createContext` gets as `info`.
 * @see https://trpc.io/docs/server/context#creating-the-context
 * @public
 */
interface TRPCRequestInfo {
  /**
   * The `trpc-accept` header.
   */
  accept: TRPCAcceptHeader | null;
  /**
   * The type of the procedures called.
   */
  type: ProcedureType | 'unknown';
  /**
   * Whether the request is a batch.
   */
  isBatchCall: boolean;
  /**
   * The procedure calls in the request.
   */
  calls: TRPCRequestInfoProcedureCall[];
  /**
   * The connection params the client sent with `httpSubscriptionLink` or
   * `createWSClient`.
   */
  connectionParams: Dict<string> | null;
  /**
   * Aborts when the request does. Pass it on to work the request starts,
   * such as `fetch()` calls.
   */
  signal: AbortSignal;
  /**
   * The request's URL, if known.
   */
  url: URL | null;
}
/**
 * The `createContext` that `resolveResponse` takes: it gets the request's
 * `info`.
 * @internal
 */
type ResolveHTTPRequestOptionsContextFn<TRouter extends AnyRouter> = (opts: {
  info: TRPCRequestInfo;
}) => Promise<inferRouterContext<TRouter>>;
interface HTTPErrorHandlerOptions<TRouter extends AnyRouter, TRequest> extends ErrorHandlerOptions<inferRouterContext<TRouter>> {
  req: TRequest;
}
/**
 * Called with each error a procedure throws. With streamed responses the
 * response may have started already, so don't rely on setting headers.
 * @see https://trpc.io/docs/server/error-handling#handling-errors
 * @internal
 */
type HTTPErrorHandler<TRouter extends AnyRouter, TRequest> = (opts: HTTPErrorHandlerOptions<TRouter, TRequest>) => void;
/**
 * The options every adapter takes.
 * @internal
 */
interface BaseHandlerOptions<TRouter extends AnyRouter, TRequest> {
  /**
   * Called with each error a procedure throws, for example to log it.
   * @see https://trpc.io/docs/server/error-handling#handling-errors
   */
  onError?: HTTPErrorHandler<TRouter, TRequest>;
  /**
   * @deprecated Use `allowBatching` instead. This will be removed in v12.
   */
  batching?: {
    /**
     * @default true
     */
    enabled: boolean;
  };
  /** The router to serve. */
  router: TRouter;
  /**
   * Lets clients call queries and subscriptions with POST as well as GET.
   * Mutations always use POST.
   * @see https://trpc.io/docs/rpc#overriding-the-default-http-method
   * @default false
   */
  allowMethodOverride?: boolean;
  /**
   * Whether clients can batch calls into one request.
   * @see https://trpc.io/docs/client/links/httpBatchLink#disabling-request-batching
   * @default true
   */
  allowBatching?: boolean;
  /**
   * The most calls a batch can have. Larger batches get a 400 error. Set
   * the client's `maxItems` to the same or a lower number.
   * @see https://trpc.io/docs/client/links/httpBatchLink#limiting-batch-size
   * @default unlimited
   */
  maxBatchSize?: number;
}
//#endregion
//#region src/unstable-core-do-not-import/rpc/envelopes.d.ts
/**
 * The error object of an error response: a JSON-RPC code, a message and
 * any `data` the error formatter adds.
 * @see https://trpc.io/docs/rpc#error-response
 */
interface TRPCErrorShape<TData extends object = object> {
  code: TRPC_ERROR_CODE_NUMBER;
  message: string;
  /** Extra details, such as the tRPC code and HTTP status. */
  data: TData;
}
/**
 * Types for the JSON-RPC 2.0 messages tRPC's envelopes build on.
 * @see https://www.jsonrpc.org/specification
 */
declare namespace JSONRPC2 {
  type RequestId = number | string | null;
  /**
   * All requests/responses extends this shape
   */
  interface BaseEnvelope {
    id?: RequestId;
    jsonrpc?: '2.0';
  }
  interface BaseRequest<TMethod extends string = string> extends BaseEnvelope {
    method: TMethod;
  }
  interface Request<TMethod extends string = string, TParams = unknown> extends BaseRequest<TMethod> {
    params: TParams;
  }
  interface ResultResponse<TResult = unknown> extends BaseEnvelope {
    result: TResult;
  }
  interface ErrorResponse<TError extends TRPCErrorShape = TRPCErrorShape> extends BaseEnvelope {
    error: TError;
  }
}
/** A call to a procedure. */
interface TRPCRequest extends JSONRPC2.Request<ProcedureType, {
  path: string;
  input: unknown;
  /**
   * The last event id that the client received
   */
  lastEventId?: string;
}> {}
/** The `result` of a successful response. */
interface TRPCResult<TData = unknown> {
  data: TData;
  type?: 'data';
  /**
   * The id of the message to keep track of in case of a reconnect
   */
  id?: string;
}
/**
 * A successful response.
 * @see https://trpc.io/docs/rpc#successful-response
 */
interface TRPCSuccessResponse<TData> extends JSONRPC2.ResultResponse<TRPCResult<TData>> {}
/**
 * An error response.
 * @see https://trpc.io/docs/rpc#error-response
 */
interface TRPCErrorResponse<TError extends TRPCErrorShape = TRPCErrorShape> extends JSONRPC2.ErrorResponse<TError> {}
/**
 * A response to a call: a success or an error.
 * @see https://trpc.io/docs/rpc#http-response-specification
 */
type TRPCResponse<TData = unknown, TError extends TRPCErrorShape = TRPCErrorShape> = TRPCErrorResponse<TError> | TRPCSuccessResponse<TData>;
/**
 * A call to a procedure over WebSockets, with the id its responses carry.
 * @see https://trpc.io/docs/server/websockets#websockets-rpc-specification
 */
type TRPCRequestMessage = TRPCRequest & {
  id: JSONRPC2.RequestId;
};
/**
 * The client asks the server to stop a subscription.
 * @see https://trpc.io/docs/server/websockets#to-cancel-a-subscription-call-subscriptionstop
 */
interface TRPCSubscriptionStopNotification extends JSONRPC2.BaseRequest<'subscription.stop'> {
  id: null;
}
/**
 * The notifications a WebSocket client sends.
 */
type TRPCClientOutgoingRequest = TRPCSubscriptionStopNotification;
/**
 * Any message a WebSocket client sends.
 * @see https://trpc.io/docs/server/websockets#websockets-rpc-specification
 */
type TRPCClientOutgoingMessage = TRPCRequestMessage | (JSONRPC2.BaseRequest<'subscription.stop'> & {
  id: JSONRPC2.RequestId;
});
/**
 * A result sent over WebSockets: data, or a subscription's `started` or
 * `stopped` event.
 * @see https://trpc.io/docs/server/websockets#subscription-response-shape
 */
interface TRPCResultMessage<TData> extends JSONRPC2.ResultResponse<{
  type: 'started';
  data?: never;
} | {
  type: 'stopped';
  data?: never;
} | TRPCResult<TData>> {}
/**
 * A response sent over WebSockets, with the id of the call it answers.
 * @see https://trpc.io/docs/server/websockets#response
 */
type TRPCResponseMessage<TData = unknown, TError extends TRPCErrorShape = TRPCErrorShape> = {
  id: JSONRPC2.RequestId;
} & (TRPCErrorResponse<TError> | TRPCResultMessage<TData>);
/**
 * The server asks the client to reconnect, for example before a restart.
 * @see https://trpc.io/docs/server/websockets#notifications-from-server-to-client
 */
interface TRPCReconnectNotification extends JSONRPC2.BaseRequest<'reconnect'> {
  id: JSONRPC2.RequestId;
}
/**
 * The notifications a WebSocket client receives.
 */
type TRPCClientIncomingRequest = TRPCReconnectNotification;
/**
 * Any message a WebSocket client receives.
 * @see https://trpc.io/docs/server/websockets#websockets-rpc-specification
 */
type TRPCClientIncomingMessage<TResult = unknown, TError extends TRPCErrorShape = TRPCErrorShape> = TRPCClientIncomingRequest | TRPCResponseMessage<TResult, TError>;
/**
 * The connection params a WebSocket client sends as its first message.
 * @see https://trpc.io/docs/server/websockets#connection-params
 */
interface TRPCConnectionParamsMessage extends JSONRPC2.BaseRequest<'connectionParams'> {
  data: TRPCRequestInfo['connectionParams'];
}
//#endregion
//#region src/unstable-core-do-not-import/transformer.d.ts
/**
 * A transformer that serializes and deserializes data the same way in
 * both directions, such as `superjson`.
 * @see https://trpc.io/docs/server/data-transformers#datatransformer-interface
 * @public
 */
interface DataTransformer {
  serialize(object: any): any;
  deserialize(object: any): any;
}
interface InputDataTransformer extends DataTransformer {
  /**
   * This function runs **on the client** before sending the data to the server.
   */
  serialize(object: any): any;
  /**
   * This function runs **on the server** to transform the data before it is passed to the resolver
   */
  deserialize(object: any): any;
}
interface OutputDataTransformer extends DataTransformer {
  /**
   * This function runs **on the server** before sending the data to the client.
   */
  serialize(object: any): any;
  /**
   * This function runs **only on the client** to transform the data sent from the server.
   */
  deserialize(object: any): any;
}
/**
 * A transformer with one serializer for inputs and another for outputs.
 * @see https://trpc.io/docs/server/data-transformers#different-transformers-for-upload-and-download
 * @public
 */
interface CombinedDataTransformer {
  /**
   * Specify how the data sent from the client to the server should be transformed.
   */
  input: InputDataTransformer;
  /**
   * Specify how the data sent from the server to the client should be transformed.
   */
  output: OutputDataTransformer;
}
/**
 * The half of a combined transformer the client uses: serializing inputs
 * and deserializing outputs.
 * @public
 */
type CombinedDataTransformerClient = {
  input: Pick<CombinedDataTransformer['input'], 'serialize'>;
  output: Pick<CombinedDataTransformer['output'], 'deserialize'>;
};
/**
 * A transformer: one for both directions, or separate ones for inputs and
 * outputs.
 * @see https://trpc.io/docs/server/data-transformers
 * @public
 */
type DataTransformerOptions = CombinedDataTransformer | DataTransformer;
/**
 * @internal
 */
declare function getDataTransformer(transformer: DataTransformerOptions): CombinedDataTransformer;
/**
 * @internal
 */
declare const defaultTransformer: CombinedDataTransformer;
/**
 * Serializes a response, or a list of them, with the router's output
 * transformer. Meant for custom adapters.
 **/
declare function transformTRPCResponse<TResponse extends TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[]>(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse): (TRPCResponse | TRPCResponseMessage)[] | TRPCErrorResponse<TRPCErrorShape<object>> | TRPCSuccessResponse<unknown> | ({
  id: JSONRPC2.RequestId;
} & TRPCResultMessage<unknown>);
/** @internal */
declare function transformResultInner<TRouter extends AnyRouter, TOutput>(response: TRPCResponse<TOutput, inferRouterError<TRouter>> | TRPCResponseMessage<TOutput, inferRouterError<TRouter>>, transformer: DataTransformer): {
  readonly ok: false;
  readonly error: {
    readonly error: inferRouterError<TRouter>;
    readonly id?: JSONRPC2.RequestId;
    readonly jsonrpc?: '2.0';
  } | {
    readonly error: inferRouterError<TRouter>;
    readonly jsonrpc?: '2.0';
    readonly id: JSONRPC2.RequestId;
  };
  readonly result?: undefined;
} | {
  readonly error?: undefined;
  readonly ok: true;
  readonly result: TRPCResult<TOutput> | {
    type: 'started';
    data?: never;
  } | {
    type: 'stopped';
    data?: never;
  };
};
/**
 * Transforms and validates that the result is a valid TRPCResponse
 * @internal
 */
declare function transformResult<TRouter extends AnyRouter, TOutput>(response: TRPCResponse<TOutput, inferRouterError<TRouter>> | TRPCResponseMessage<TOutput, inferRouterError<TRouter>>, transformer: DataTransformer): ReturnType<typeof transformResultInner>;
//#endregion
//#region src/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts
/**
 * Checks that a message a WebSocket client sent is a valid tRPC message,
 * and deserializes its input. Throws if it isn't.
 * @public
 */
declare function parseTRPCMessage(obj: unknown, transformer: CombinedDataTransformer): TRPCClientOutgoingMessage;
//#endregion
//#region src/unstable-core-do-not-import/error/formatter.d.ts
/**
 * What an error formatter gets.
 * @see https://trpc.io/docs/server/error-formatting#all-properties-sent-to-errorformatter
 * @internal
 */
interface ErrorFormatterOptions<TContext> {
  error: TRPCError;
  type: ProcedureType | 'unknown';
  /** The procedure's path, if the error came from one. */
  path: string | undefined;
  input: unknown;
  /** The context, if it was created before the error. */
  ctx: TContext;
  /** The shape tRPC sends by default, to extend or replace. */
  shape: DefaultErrorShape;
}
/**
 * Shapes the errors a router sends to the client.
 * @see https://trpc.io/docs/server/error-formatting
 * @internal
 */
type ErrorFormatter<TContext, TShape extends TRPCErrorShape> = (opts: ErrorFormatterOptions<TContext | undefined>) => TShape;
/**
 * An error formatter for one procedure, as `.errors()` takes it. Return
 * `undefined` to leave the error to the next formatter.
 * @see https://trpc.io/docs/server/error-formatting#per-procedure-error-formatting
 * @internal
 */
type ProcedureErrorFormatter<TContext, TContextOverrides, TShape extends TRPCErrorShape | undefined | void> = (opts: ErrorFormatterOptions<Simplify<Overwrite<TContext, TContextOverrides>>>) => TShape;
/**
 * @internal
 */
type AnyProcedureErrorFormatter = ProcedureErrorFormatter<any, any, any>;
/**
 * The `data` of the default error shape.
 * @internal
 */
type DefaultErrorData = {
  code: TRPC_ERROR_CODE_KEY;
  httpStatus: number;
  /**
   * The path of the procedure that threw.
   */
  path?: string;
  /**
   * The error's stack trace, only when `isDev` is set.
   */
  stack?: string;
};
/**
 * The error shape tRPC sends when there's no error formatter.
 * @see https://trpc.io/docs/server/error-formatting
 * @internal
 */
interface DefaultErrorShape extends TRPCErrorShape<DefaultErrorData> {
  message: string;
  code: TRPC_ERROR_CODE_NUMBER;
}
declare const defaultFormatter: ErrorFormatter<any, any>;
/**
 * @internal
 */
declare function getDefaultErrorShape(opts: {
  error: TRPCError;
  path: string | undefined;
  isDev: boolean;
}): DefaultErrorShape;
declare const formattedShapeSymbol: unique symbol;
/**
 * @internal
 */
declare function setFormattedErrorShape(error: TRPCError, shape: TRPCErrorShape): asserts error is TRPCError & {
  [formattedShapeSymbol]: TRPCErrorShape;
};
/**
 * @internal
 */
declare function getFormattedErrorShape(error: TRPCError): TRPCErrorShape | undefined;
declare function isFormattedErrorShape(error: TRPCError): error is TRPCError & {
  [formattedShapeSymbol]: TRPCErrorShape;
};
//#endregion
//#region src/unstable-core-do-not-import/middleware.d.ts
/** @internal */
declare const middlewareMarker: 'middlewareMarker' & {
  __brand: 'middlewareMarker';
};
type MiddlewareMarker = typeof middlewareMarker;
interface MiddlewareResultBase {
  /**
   * All middlewares should pass through their `next()`'s output.
   * Requiring this marker makes sure that can't be forgotten at compile-time.
   */
  readonly marker: MiddlewareMarker;
}
interface MiddlewareOKResult<_TContextOverride> extends MiddlewareResultBase {
  ok: true;
  data: unknown;
}
interface MiddlewareErrorResult<_TContextOverride> extends MiddlewareResultBase {
  ok: false;
  error: TRPCError;
}
/**
 * What a middleware's `next()` returns, and what the middleware must
 * return in turn.
 * @internal
 */
type MiddlewareResult<_TContextOverride> = MiddlewareErrorResult<_TContextOverride> | MiddlewareOKResult<_TContextOverride>;
/**
 * A reusable middleware, as `t.middleware()` returns it.
 * @see https://trpc.io/docs/server/middlewares
 * @internal
 */
interface MiddlewareBuilder<TContext, TMeta, TContextOverrides, TInputOut> {
  /**
   * Returns a new middleware that runs this one, then `fn`, which sees the
   * context this one set.
   * @see https://trpc.io/docs/server/middlewares#extending-middlewares
   */
  unstable_pipe<$ContextOverridesOut>(fn: MiddlewareFunction<TContext, TMeta, TContextOverrides, $ContextOverridesOut, TInputOut> | MiddlewareBuilder<Overwrite<TContext, TContextOverrides>, TMeta, $ContextOverridesOut, TInputOut>): MiddlewareBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverridesOut>, TInputOut>;
  /**
   * The middlewares this builder runs, in order.
   */
  _middlewares: MiddlewareFunction<TContext, TMeta, TContextOverrides, object, TInputOut>[];
}
/**
 * A middleware: it gets the call's options and must return the result of
 * calling `next()`, optionally with a new `ctx` or `input`.
 * @see https://trpc.io/docs/server/middlewares
 * @internal
 */
type MiddlewareFunction<TContext, TMeta, TContextOverridesIn, $ContextOverridesOut, TInputOut> = {
  (opts: {
    ctx: Simplify<Overwrite<TContext, TContextOverridesIn>>;
    type: ProcedureType;
    /** The procedure's path, such as `post.byId`. */
    path: string;
    /** The input, as the validators that ran before this middleware left it. */
    input: TInputOut;
    /** Reads the input as the client sent it, before any validator ran. */
    getRawInput: GetRawInputFn;
    meta: TMeta | undefined;
    /** Aborts when the client cancels the request or disconnects. */
    signal: AbortSignal | undefined;
    /**
     * The index of this call in a batch request.
     */
    batchIndex: number;
    /**
     * Runs the next middleware, or the resolver. Pass `ctx` to add to the
     * context, or `input` to replace the input.
     */
    next: {
      (): Promise<MiddlewareResult<TContextOverridesIn>>;
      <$ContextOverride>(opts: {
        ctx?: $ContextOverride;
        input?: unknown;
      }): Promise<MiddlewareResult<$ContextOverride>>;
      (opts: {
        getRawInput: GetRawInputFn;
      }): Promise<MiddlewareResult<TContextOverridesIn>>;
    };
  }): Promise<MiddlewareResult<$ContextOverridesOut>>;
  _type?: string | undefined;
};
/** Any middleware function, for use in generic constraints. */
type AnyMiddlewareFunction = MiddlewareFunction<any, any, any, any, any>;
/** Any middleware builder, for use in generic constraints. */
type AnyMiddlewareBuilder = MiddlewareBuilder<any, any, any, any>;
/**
 * @internal
 */
declare function createMiddlewareFactory<TContext, TMeta, TInputOut = unknown>(): <$ContextOverrides>(fn: MiddlewareFunction<TContext, TMeta, object, $ContextOverrides, TInputOut>) => MiddlewareBuilder<TContext, TMeta, $ContextOverrides, TInputOut>;
/**
 * Creates a middleware that isn't tied to a root object, for the context,
 * metadata and input types you give it.
 * @deprecated Use `.concat()` with a procedure builder instead.
 * @see https://trpc.io/docs/server/middlewares#concat
 */
declare const experimental_standaloneMiddleware: <TCtx extends {
  ctx?: object;
  meta?: object;
  input?: unknown;
}>() => {
  create: <$ContextOverrides>(fn: MiddlewareFunction<TCtx extends {
    ctx: infer T extends object;
  } ? T : any, TCtx extends {
    meta: infer T_1 extends object;
  } ? T_1 : object, object, $ContextOverrides, TCtx extends {
    input: infer T_2;
  } ? T_2 : unknown>) => MiddlewareBuilder<TCtx extends {
    ctx: infer T extends object;
  } ? T : any, TCtx extends {
    meta: infer T_1 extends object;
  } ? T_1 : object, $ContextOverrides, TCtx extends {
    input: infer T_2;
  } ? T_2 : unknown>;
};
/**
 * @internal
 * Please note, `trpc-openapi` uses this function.
 */
declare function createInputMiddleware<TInput>(parse: ParseFn<TInput>): AnyMiddlewareFunction;
/**
 * @internal
 */
declare function createErrorFormatterMiddleware(formatter: AnyProcedureErrorFormatter, isDev: boolean): AnyMiddlewareFunction;
/**
 * @internal
 */
declare function createOutputMiddleware<TOutput>(parse: ParseFn<TOutput>): AnyMiddlewareFunction;
//#endregion
//#region src/unstable-core-do-not-import/utils.d.ts
/**
 * Marks a type a procedure builder hasn't set yet, such as its input.
 * @internal
 */
type UnsetMarker = 'unsetMarker' & {
  __brand: 'unsetMarker';
};
/**
 * Ensures there are no duplicate keys when building a procedure.
 * @internal
 */
declare function mergeWithoutOverrides<TType extends Record<string, unknown>>(obj1: TType, ...objs: Partial<TType>[]): TType;
/**
 * Check that value is object
 * @internal
 */
declare function isObject(value: unknown): value is Record<string, unknown>;
type AnyFn = ((...args: any[]) => unknown) & Record<keyof any, unknown>;
declare function isFunction(fn: unknown): fn is AnyFn;
/**
 * Create an object without inheriting anything from `Object.prototype`
 * @internal
 */
declare function emptyObject<TObj extends Record<string, unknown>>(): TObj;
declare function isAsyncIterable<TValue>(value: unknown): value is AsyncIterable<TValue>;
/**
 * Run an IIFE
 */
declare const run: <TValue>(fn: () => TValue) => TValue;
declare function noop(): void;
declare function identity<T>(it: T): T;
/**
 * Generic runtime assertion function. Throws, if the condition is not `true`.
 *
 * Can be used as a slightly less dangerous variant of type assertions. Code
 * mistakes would be revealed at runtime then (hopefully during testing).
 */
declare function assert(condition: boolean, msg?: string): asserts condition;
declare function assertNever(value: never): never;
declare function sleep(ms?: number): Promise<void>;
/**
 * Ponyfill for
 * [`AbortSignal.any`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static).
 */
declare function abortSignalsAnyPonyfill(signals: AbortSignal[]): AbortSignal;
//#endregion
//#region src/unstable-core-do-not-import/procedureBuilder.d.ts
type IntersectIfDefined<TType, TWith> = TType extends UnsetMarker ? TWith : TWith extends UnsetMarker ? TType : Simplify<TType & TWith>;
type DefaultValue<TValue, TFallback> = TValue extends UnsetMarker ? TFallback : TValue;
type FoldErrorShape<TErrorShape, $Shape> = Extract<$Shape, TRPCErrorShape> | TErrorShape;
type inferAsyncIterable<TOutput> = TOutput extends AsyncIterable<infer $Yield, infer $Return, infer $Next> ? {
  yield: $Yield;
  return: $Return;
  next: $Next;
} : never;
type inferSubscriptionOutput$1<TOutput> = TOutput extends AsyncIterable<any> ? AsyncIterable<inferTrackedOutput<inferAsyncIterable<TOutput>['yield']>, inferAsyncIterable<TOutput>['return'], inferAsyncIterable<TOutput>['next']> : TypeError<'Subscription output could not be inferred'>;
type CallerOverride<TContext> = (opts: {
  args: unknown[];
  invoke: (opts: ProcedureCallOptions<TContext>) => Promise<unknown>;
  _def: AnyProcedure['_def'];
}) => Promise<unknown>;
type ProcedureBuilderDef<TMeta> = {
  procedure: true;
  inputs: Parser[];
  output?: Parser;
  meta?: TMeta;
  resolver?: ProcedureBuilderResolver;
  middlewares: AnyMiddlewareFunction[];
  /**
   * @deprecated use `type` instead
   */
  mutation?: boolean;
  /**
   * @deprecated use `type` instead
   */
  query?: boolean;
  /**
   * @deprecated use `type` instead
   */
  subscription?: boolean;
  type?: ProcedureType;
  caller?: CallerOverride<unknown>;
  config?: RootConfig<AnyRootTypes>;
};
type AnyProcedureBuilderDef = ProcedureBuilderDef<any>;
/**
 * What a resolver passed to `.query()`, `.mutation()` or `.subscription()`
 * gets.
 * @internal
 */
interface ProcedureResolverOptions<TContext, _TMeta, TContextOverridesIn, TInputOut> {
  /** The context, after middlewares have added to or changed it. */
  ctx: Simplify<Overwrite<TContext, TContextOverridesIn>>;
  /**
   * The input, after the validators and any middleware that replaced it
   * with `next({ input })`.
   */
  input: TInputOut extends UnsetMarker ? undefined : TInputOut;
  /**
   * Aborts when the client cancels the request or disconnects.
   */
  signal: AbortSignal | undefined;
  /**
   * The procedure's path, such as `post.byId`.
   */
  path: string;
  /**
   * The call's zero-based index in its batch. A call that wasn't batched
   * gets `0`.
   */
  batchIndex?: number;
}
/**
 * A procedure resolver
 */
type ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputParserIn, $Output> = (opts: ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut>) => MaybePromise<DefaultValue<TOutputParserIn, $Output>>;
type AnyProcedureBuilder = ProcedureBuilder<any, any, any, any, any, any, any, any, any>;
/**
 * The options a resolver built from this procedure builder gets: its
 * `ctx`, `input` and so on. Use it to type helpers that resolvers call.
 * @see https://trpc.io/docs/server/procedures#inferProcedureBuilderResolverOptions
 */
type inferProcedureBuilderResolverOptions<TProcedureBuilder extends AnyProcedureBuilder> = TProcedureBuilder extends ProcedureBuilder<infer TContext, infer TMeta, infer TContextOverrides, infer _TInputIn, infer TInputOut, infer _TOutputIn, infer _TOutputOut, infer _TCaller, infer _TErrorShape> ? ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut extends UnsetMarker ? unknown : TInputOut extends object ? Simplify<TInputOut & {
  /**
   * Extra input params might have been added by a `.input()` further down the chain
   */
  [keyAddedByInputCallFurtherDown: string]: unknown;
}> : TInputOut> : never;
/**
 * Builds a procedure step by step. Each method returns a new builder, so a
 * builder can be the base of many procedures.
 * @see https://trpc.io/docs/server/procedures
 */
interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut, TCaller extends boolean,
/**
 * Defaults to `unknown` so that an annotation written without it falls back
 * to the router-wide error shape rather than pinning the procedure to the
 * default one.
 * @see inferProcedureErrorShape
 */
TErrorShape = unknown> {
  /**
   * Adds a validator for the input. Chain several to merge object inputs.
   * @see https://trpc.io/docs/server/validators#input-validators
   */
  input<$Parser extends Parser>(schema: TInputOut extends UnsetMarker ? $Parser : inferParser<$Parser>['out'] extends Record<string, unknown> | undefined ? TInputOut extends Record<string, unknown> | undefined ? undefined extends inferParser<$Parser>['out'] ? undefined extends TInputOut ? $Parser : TypeError<'Cannot chain an optional parser to a required parser'> : $Parser : TypeError<'All input parsers did not resolve to an object'> : TypeError<'All input parsers did not resolve to an object'>): ProcedureBuilder<TContext, TMeta, TContextOverrides, IntersectIfDefined<TInputIn, inferParser<$Parser>['in']>, IntersectIfDefined<TInputOut, inferParser<$Parser>['out']>, TOutputIn, TOutputOut, TCaller, TErrorShape>;
  /**
   * Adds a validator for the output, which checks what the resolver
   * returns.
   * @see https://trpc.io/docs/server/validators#output-validators
   */
  output<$Parser extends Parser>(schema: $Parser): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, IntersectIfDefined<TOutputIn, inferParser<$Parser>['in']>, IntersectIfDefined<TOutputOut, inferParser<$Parser>['out']>, TCaller, TErrorShape>;
  /**
   * Sets the procedure's metadata, which middlewares can read. It's
   * shallow-merged with any metadata set before.
   * @see https://trpc.io/docs/server/metadata
   */
  meta(meta: TMeta): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut, TCaller, TErrorShape>;
  /**
   * Adds an error formatter for this procedure. An error goes to the last
   * `.errors()` formatter first, and on to earlier ones and the root
   * `errorFormatter` until one returns a shape. A formatter only sees
   * errors from the steps after it, so put `.errors()` before `.input()`
   * to format input errors.
   * @see https://trpc.io/docs/server/error-formatting#per-procedure-error-formatting
   */
  errors<$Shape extends TRPCErrorShape | undefined | void>(formatter: ProcedureErrorFormatter<TContext, TContextOverrides, $Shape>): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut, TCaller, FoldErrorShape<TErrorShape, $Shape>>;
  /**
   * Adds a middleware, which runs before the resolver and can change the
   * context.
   * @see https://trpc.io/docs/server/middlewares
   */
  use<$ContextOverridesOut>(fn: MiddlewareBuilder<Overwrite<TContext, TContextOverrides>, TMeta, $ContextOverridesOut, TInputOut> | MiddlewareFunction<TContext, TMeta, TContextOverrides, $ContextOverridesOut, TInputOut>): ProcedureBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverridesOut>, TInputIn, TInputOut, TOutputIn, TOutputOut, TCaller, TErrorShape>;
  /**
   * @deprecated Use {@link concat} instead.
   */
  unstable_concat<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut, $ErrorShape>(builder: Overwrite<TContext, TContextOverrides> extends $Context ? TMeta extends $Meta ? ProcedureBuilder<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut, TCaller, $ErrorShape> : TypeError<'Meta mismatch'> : TypeError<'Context mismatch'>): ProcedureBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverrides>, IntersectIfDefined<TInputIn, $InputIn>, IntersectIfDefined<TInputOut, $InputOut>, IntersectIfDefined<TOutputIn, $OutputIn>, IntersectIfDefined<TOutputOut, $OutputOut>, TCaller, FoldErrorShape<TErrorShape, $ErrorShape>>;
  /**
   * Adds another procedure builder's inputs, middlewares and context to
   * this one. Useful for plugins that ship their own procedure builder.
   * @see https://trpc.io/docs/server/middlewares#concat
   */
  concat<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut, $ErrorShape>(builder: Overwrite<TContext, TContextOverrides> extends $Context ? TMeta extends $Meta ? ProcedureBuilder<$Context, $Meta, $ContextOverrides, $InputIn, $InputOut, $OutputIn, $OutputOut, TCaller, $ErrorShape> : TypeError<'Meta mismatch'> : TypeError<'Context mismatch'>): ProcedureBuilder<TContext, TMeta, Overwrite<TContextOverrides, $ContextOverrides>, IntersectIfDefined<TInputIn, $InputIn>, IntersectIfDefined<TInputOut, $InputOut>, IntersectIfDefined<TOutputIn, $OutputIn>, IntersectIfDefined<TOutputOut, $OutputOut>, TCaller, FoldErrorShape<TErrorShape, $ErrorShape>>;
  /**
   * Ends the builder with a query: a procedure that reads data.
   * @see https://trpc.io/docs/server/procedures#writing-procedures
   */
  query<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): TCaller extends true ? (input: DefaultValue<TInputIn, void>) => Promise<DefaultValue<TOutputOut, $Output>> : QueryProcedure<{
    input: DefaultValue<TInputIn, void>;
    output: DefaultValue<TOutputOut, $Output>;
    meta: TMeta;
    errorShape: TErrorShape;
  }>;
  /**
   * Ends the builder with a mutation: a procedure that changes data.
   * @see https://trpc.io/docs/server/procedures#writing-procedures
   */
  mutation<$Output>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): TCaller extends true ? (input: DefaultValue<TInputIn, void>) => Promise<DefaultValue<TOutputOut, $Output>> : MutationProcedure<{
    input: DefaultValue<TInputIn, void>;
    output: DefaultValue<TOutputOut, $Output>;
    meta: TMeta;
    errorShape: TErrorShape;
  }>;
  /**
   * Ends the builder with a subscription: a procedure that streams events
   * from an async iterable, such as an async generator.
   * @see https://trpc.io/docs/server/subscriptions
   */
  subscription<$Output extends AsyncIterable<any, void, any>>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): TCaller extends true ? TypeError<'Not implemented'> : SubscriptionProcedure<{
    input: DefaultValue<TInputIn, void>;
    output: inferSubscriptionOutput$1<DefaultValue<TOutputOut, $Output>>;
    meta: TMeta;
    errorShape: TErrorShape;
  }>;
  /**
   * Ends the builder with a subscription that returns an observable.
   * @deprecated Return an async generator instead. Observable subscriptions
   * will be removed in v12.
   * @see https://trpc.io/docs/server/subscriptions
   */
  subscription<$Output extends Observable<any, any>>(resolver: ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputIn, $Output>): TCaller extends true ? TypeError<'Not implemented'> : LegacyObservableSubscriptionProcedure<{
    input: DefaultValue<TInputIn, void>;
    output: inferObservableValue<DefaultValue<TOutputOut, $Output>>;
    meta: TMeta;
    errorShape: TErrorShape;
  }>;
  /**
   * Replaces how the procedure is called, for example to make it a server
   * action. Experimental: it may change in any release.
   * @see https://trpc.io/docs/client/nextjs/server-actions#1-define-a-base-procedure-with-experimental_caller
   */
  experimental_caller(caller: CallerOverride<TContext>): ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut, true, TErrorShape>;
  /**
   * @internal
   */
  _def: ProcedureBuilderDef<TMeta>;
}
type ProcedureBuilderResolver = (opts: ProcedureResolverOptions<any, any, any, any>) => Promise<unknown>;
declare function createBuilder<TContext, TMeta, TErrorShape = unknown>(initDef?: Partial<AnyProcedureBuilderDef>): ProcedureBuilder<TContext, TMeta, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false, TErrorShape>;
/**
 * What calling a procedure takes.
 * @internal
 */
interface ProcedureCallOptions<TContext> {
  ctx: TContext;
  getRawInput: GetRawInputFn;
  input?: unknown;
  path: string;
  type: ProcedureType;
  signal: AbortSignal | undefined;
  /**
   * The index of this call in a batch request.
   */
  batchIndex: number;
}
//#endregion
//#region src/unstable-core-do-not-import/procedure.d.ts
declare const procedureTypes: readonly ['query', 'mutation', 'subscription'];
/**
 * A procedure's kind: `'query'`, `'mutation'` or `'subscription'`.
 * @public
 */
type ProcedureType = (typeof procedureTypes)[number];
interface BuiltProcedureDef {
  meta: unknown;
  input: unknown;
  output: unknown;
  errorShape?: unknown;
}
/**
 * A built procedure, as a router holds it.
 * @internal
 */
interface Procedure<TType extends ProcedureType, TDef extends BuiltProcedureDef> {
  _def: {
    /**
     * These are just types, they can't be used at runtime
     * @internal
     */
    $types: {
      input: TDef['input'];
      output: TDef['output'];
      errorShape: TDef['errorShape'];
    };
    procedure: true;
    type: TType;
    /**
     * @internal
     * Meta is not inferrable on individual procedures, only on the router
     */
    meta: unknown;
    experimental_caller: boolean;
    /**
     * The input parsers for the procedure
     */
    inputs: Parser[];
  };
  meta: TDef['meta'];
  /**
   * @internal
   */
  (opts: ProcedureCallOptions<unknown>): Promise<TDef['output']>;
}
/** A built query procedure. */
interface QueryProcedure<TDef extends BuiltProcedureDef> extends Procedure<'query', TDef> {}
/** A built mutation procedure. */
interface MutationProcedure<TDef extends BuiltProcedureDef> extends Procedure<'mutation', TDef> {}
/** A built subscription procedure. */
interface SubscriptionProcedure<TDef extends BuiltProcedureDef> extends Procedure<'subscription', TDef> {}
/**
 * A subscription procedure that returns an observable.
 * @deprecated Return an async generator from `.subscription()` instead.
 */
interface LegacyObservableSubscriptionProcedure<TDef extends BuiltProcedureDef> extends SubscriptionProcedure<TDef> {
  _observable: true;
}
/** Any query procedure, for use in generic constraints. */
type AnyQueryProcedure = QueryProcedure<any>;
/** Any mutation procedure, for use in generic constraints. */
type AnyMutationProcedure = MutationProcedure<any>;
/** Any subscription procedure, for use in generic constraints. */
type AnySubscriptionProcedure = SubscriptionProcedure<any> | LegacyObservableSubscriptionProcedure<any>;
/** Any procedure, for use in generic constraints. */
type AnyProcedure = AnyQueryProcedure | AnyMutationProcedure | AnySubscriptionProcedure;
/**
 * The input type a procedure takes, before its validators run.
 * @see https://trpc.io/docs/client/vanilla/infer-types#inferring-individual-procedure-types
 */
type inferProcedureInput<TProcedure extends AnyProcedure> = undefined extends inferProcedureParams<TProcedure>['$types']['input'] ? void | inferProcedureParams<TProcedure>['$types']['input'] : inferProcedureParams<TProcedure>['$types']['input'];
/** @internal */
type inferProcedureParams<TProcedure> = TProcedure extends AnyProcedure ? TProcedure['_def'] : never;
/**
 * The output type a procedure returns, after its output validator runs.
 * @see https://trpc.io/docs/client/vanilla/infer-types#inferring-individual-procedure-types
 */
type inferProcedureOutput<TProcedure> = inferProcedureParams<TProcedure>['$types']['output'];
/**
 * The input type a subscription procedure takes.
 * @see https://trpc.io/docs/client/vanilla/infer-types#inferring-individual-procedure-types
 */
type inferSubscriptionInput<TProcedure extends AnySubscriptionProcedure> = inferProcedureInput<TProcedure>;
/**
 * The type of each event a subscription procedure emits.
 * @see https://trpc.io/docs/client/vanilla/infer-types#inferring-individual-procedure-types
 */
type inferSubscriptionOutput<TProcedure extends AnySubscriptionProcedure> = TProcedure extends LegacyObservableSubscriptionProcedure<any> ? inferProcedureOutput<TProcedure> : inferAsyncIterableYield<inferProcedureOutput<TProcedure>>;
/**
 * @internal
 */
interface ErrorHandlerOptions<TContext> {
  error: TRPCError;
  type: ProcedureType | 'unknown';
  path: string | undefined;
  input: unknown;
  ctx: TContext | undefined;
}
//#endregion
//#region src/unstable-core-do-not-import/clientish/inferrable.d.ts
/** The root types a client needs: the error shape and whether there's a transformer. */
type AnyClientTypes = Pick<AnyRootTypes, 'errorShape' | 'transformer'>;
/**
 * Result of `initTRPC.create()`
 */
type InitLike = {
  _config: {
    $types: AnyClientTypes;
  };
};
/**
 * Result of `initTRPC.create().router()`
 */
type RouterLike = {
  _def: InitLike;
};
/**
 * Result of `initTRPC.create()._config`
 */
type RootConfigLike = {
  $types: AnyClientTypes;
};
/**
 * Anything a client's root types can be read from: a router, a root
 * object, a root config or the types themselves.
 */
type InferrableClientTypes = RouterLike | InitLike | RootConfigLike | AnyClientTypes;
type PickTypes<T extends AnyClientTypes> = {
  transformer: T['transformer'];
  errorShape: T['errorShape'];
};
/**
 * The root types a client needs, read from a router, a root object or a
 * root config.
 */
type inferClientTypes<TInferrable extends InferrableClientTypes> = TInferrable extends AnyClientTypes ? PickTypes<TInferrable> : TInferrable extends RootConfigLike ? PickTypes<TInferrable['$types']> : TInferrable extends InitLike ? PickTypes<TInferrable['_config']['$types']> : TInferrable extends RouterLike ? PickTypes<TInferrable['_def']['_config']['$types']> : never;
//#endregion
//#region src/unstable-core-do-not-import/clientish/serialize.d.ts
/**
 * @see https://github.com/remix-run/remix/blob/2248669ed59fd716e267ea41df5d665d4781f4a9/packages/remix-server-runtime/serialize.ts
 */
type JsonPrimitive = boolean | number | string | null;
type JsonArray = JsonValue[] | readonly JsonValue[];
type JsonObject = {
  readonly [key: string | number]: JsonValue;
  [key: symbol]: never;
};
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
type IsJson<T> = T extends JsonValue ? true : false;
type NonJsonPrimitive = Function | symbol | undefined;
type IsAny<T> = 0 extends T & 1 ? true : false;
type JsonReturnable = JsonPrimitive | undefined;
type IsRecord<T extends object> = keyof WithoutIndexSignature<T> extends never ? true : false;
type Serialize<T> = IsAny<T> extends true ? any : unknown extends T ? unknown : IsJson<T> extends true ? T : T extends AsyncIterable<infer $T, infer $Return, infer $Next> ? AsyncIterable<Serialize<$T>, Serialize<$Return>, Serialize<$Next>> : T extends PromiseLike<infer $T> ? Promise<Serialize<$T>> : T extends JsonReturnable ? T : T extends Map<any, any> | Set<any> ? object : T extends NonJsonPrimitive ? never : T extends {
  toJSON(): infer U;
} ? U : T extends [] ? [] : T extends [unknown, ...unknown[]] ? SerializeTuple<T> : T extends readonly (infer U)[] ? (U extends NonJsonPrimitive ? null : Serialize<U>)[] : T extends object ? IsRecord<T> extends true ? SerializeRecord<T, keyof T> : Simplify<SerializeObject<UndefinedToOptional<T>>> : never;
/**
 * JSON serialize records. Same result as `Record<K, Serialize<T[keyof T]>>`,
 * but the value type is only resolved when it is used, so a recursive type
 * such as `Prisma.JsonValue` does not expand forever.
 * @see https://github.com/trpc/trpc/issues/6997
 * @internal
 */
type SerializeRecord<T, K extends PropertyKey> = { [P in K]: Serialize<T[keyof T]>; };
/** JSON serialize [tuples](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) */
type SerializeTuple<T extends [unknown, ...unknown[]]> = { [K in keyof T]: T[K] extends NonJsonPrimitive ? null : Serialize<T[K]>; };
type SerializeObjectKey<T extends Record<any, any>, K> = K extends symbol ? never : IsAny<T[K]> extends true ? K : unknown extends T[K] ? K : T[K] extends NonJsonPrimitive ? never : K;
/**
 * JSON serialize objects (not including arrays) and classes
 * @internal
 **/
type SerializeObject<T extends object> = { [K in keyof T as SerializeObjectKey<T, K>]: Serialize<T[K]>; };
/**
 * Extract keys from T where the value dosen't extend undefined
 * Note: Can't parse IndexSignature or Record types
 */
type FilterDefinedKeys<T extends object> = Exclude<{ [K in keyof T]: undefined extends T[K] ? never : K; }[keyof T], undefined>;
/**
 * Get value of exactOptionalPropertyTypes config
 */
type ExactOptionalPropertyTypes = {
  a?: 0 | undefined;
} extends {
  a?: 0;
} ? false : true;
/**
 * Check if T has an index signature
 */
type HasIndexSignature<T extends object> = string extends keyof T ? true : false;
/**
 * { [key: string]: number | undefined } --> { [key: string]: number }
 */
type HandleIndexSignature<T extends object> = { [K in keyof Omit<T, keyof WithoutIndexSignature<T>>]: Exclude<T[K], undefined>; };
/**
 * { a: number | undefined } --> { a?: number }
 * Note: Can't parse IndexSignature or Record types
 */
type HandleUndefined<T extends object> = { [K in keyof Omit<T, FilterDefinedKeys<T>>]?: Exclude<T[K], undefined>; };
/**
 * Handle undefined, index signature and records
 */
type UndefinedToOptional<T extends object> = Pick<WithoutIndexSignature<T>, FilterDefinedKeys<WithoutIndexSignature<T>>> & (ExactOptionalPropertyTypes extends true ? HandleIndexSignature<T> & HandleUndefined<WithoutIndexSignature<T>> : HasIndexSignature<T> extends true ? HandleIndexSignature<T> : HandleUndefined<T>);
//#endregion
//#region src/unstable-core-do-not-import/clientish/inference.d.ts
/**
 * A procedure's output as the client gets it: as is with a transformer,
 * or as it comes out of JSON without one.
 * @internal
 */
type inferTransformedProcedureOutput<TInferrable extends InferrableClientTypes, TProcedure extends AnyProcedure> = inferClientTypes<TInferrable>['transformer'] extends false ? Serialize<inferProcedureOutput<TProcedure>> : inferProcedureOutput<TProcedure>;
/**
 * The error shapes a procedure's errors can have: the router's shape, plus
 * one for each `.errors()` call.
 * @internal
 */
type inferProcedureErrorShape<TInferrable extends InferrableClientTypes, TProcedure extends AnyProcedure> = TProcedure['_def']['$types']['errorShape'] extends (infer $Shape) ? unknown extends $Shape ? inferClientTypes<TInferrable>['errorShape'] : $Shape : never;
/**
 * A subscription's events as the client gets them.
 * @internal
 */
type inferTransformedSubscriptionOutput<TInferrable extends InferrableClientTypes, TProcedure extends AnyProcedure> = inferClientTypes<TInferrable>['transformer'] extends false ? Serialize<inferObservableValue<inferProcedureOutput<TProcedure>>> : inferObservableValue<inferProcedureOutput<TProcedure>>;
/** @internal */
type GetInferenceHelpers<TType extends 'input' | 'output', TRoot extends AnyClientTypes, TRecord extends RouterRecord> = { [TKey in keyof TRecord]: TRecord[TKey] extends (infer $Value) ? $Value extends AnyProcedure ? TType extends 'input' ? inferProcedureInput<$Value> : inferTransformedProcedureOutput<TRoot, $Value> : $Value extends RouterRecord ? GetInferenceHelpers<TType, TRoot, $Value> : never : never; };
/**
 * The input types of every procedure in a router, by path.
 * @example
 * ```ts
 * type PostByIdInput = inferRouterInputs<AppRouter>['post']['byId'];
 * ```
 * @see https://trpc.io/docs/client/vanilla/infer-types#inferring-input--output-types
 */
type inferRouterInputs<TRouter extends AnyRouter> = GetInferenceHelpers<'input', TRouter['_def']['_config']['$types'], TRouter['_def']['record']>;
/**
 * The output types of every procedure in a router, by path, as the client
 * gets them.
 * @see https://trpc.io/docs/client/vanilla/infer-types#inferring-input--output-types
 */
type inferRouterOutputs<TRouter extends AnyRouter> = GetInferenceHelpers<'output', TRouter['_def']['_config']['$types'], TRouter['_def']['record']>;
//#endregion
//#region src/unstable-core-do-not-import/createProxy.d.ts
interface ProxyCallbackOptions {
  path: readonly string[];
  args: readonly unknown[];
}
type ProxyCallback = (opts: ProxyCallbackOptions) => unknown;
/**
 * Creates a proxy that records the property path it's accessed with, and
 * calls `callback` with the path and arguments when it's called.
 * @internal
 */
declare const createRecursiveProxy: <TFaux = unknown>(callback: ProxyCallback) => TFaux;
/**
 * Creates a proxy that maps each property to `callback(name)`, one level
 * deep. It's not thenable.
 * @internal
 */
declare const createFlatProxy: <TFaux>(callback: (path: keyof TFaux) => any) => TFaux;
//#endregion
//#region src/unstable-core-do-not-import/error/getErrorShape.d.ts
/**
 * The shape of an error as the client gets it: from a procedure's
 * `.errors()` formatter if one ran, or else from the root error formatter.
 * @internal
 */
declare function getErrorShape<TRoot extends AnyRootTypes>(opts: {
  config: RootConfig<TRoot>;
  error: TRPCError;
  type: ProcedureType | 'unknown';
  path: string | undefined;
  input: unknown;
  ctx: TRoot['ctx'] | undefined;
}): TRoot['errorShape'];
//#endregion
//#region src/unstable-core-do-not-import/http/contentType.d.ts
declare function getAcceptHeader(headers: Headers): TRPCAcceptHeader | null;
declare function getLastEventId(opts: {
  headers: Headers;
  searchParams: URLSearchParams;
}): string | null;
type GetRequestInfoOptions = {
  path: string;
  req: Request;
  url: URL | null;
  searchParams: URLSearchParams;
  headers: Headers;
  router: AnyRouter;
  maxBatchSize?: number;
};
declare function getRequestInfo(opts: GetRequestInfoOptions): Promise<TRPCRequestInfo>;
//#endregion
//#region src/unstable-core-do-not-import/http/contentTypeParsers.d.ts
/**
 * A validator tRPC ships for a special input type.
 * @internal
 */
type UtilityParser<TInput, TOutput> = ParserZodEsque<TInput, TOutput> & {
  parse: (input: unknown) => TOutput;
};
/**
 * A `File`. Node 18 has no `File` type, but a `File` is always a `Blob`.
 * @internal
 */
interface FileLike extends Blob {
  readonly name: string;
}
/**
 * The binary inputs a client can send with `octetInputParser`.
 * @internal
 */
type OctetInput = Blob | Uint8Array | FileLike;
/**
 * An input validator for binary data, such as a `File` or `Blob`. The
 * resolver gets the input as a `ReadableStream`.
 * @example
 * ```ts
 * t.procedure.input(octetInputParser).mutation(async ({ input }) => {
 *   const bytes = await new Response(input).arrayBuffer();
 *   return { size: bytes.byteLength };
 * });
 * ```
 * @see https://trpc.io/docs/server/non-json-content-types#file-and-other-binary-type-inputs
 */
declare const octetInputParser: UtilityParser<OctetInput, ReadableStream>;
//#endregion
//#region src/unstable-core-do-not-import/http/formDataToObject.d.ts
declare function formDataToObject(formData: FormData): Record<string, unknown>;
//#endregion
//#region src/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts
declare const JSONRPC2_TO_HTTP_CODE: Record<keyof typeof TRPC_ERROR_CODES_BY_KEY, number>;
declare const HTTP_CODE_TO_JSONRPC2: InvertKeyValue<typeof JSONRPC2_TO_HTTP_CODE>;
declare function getStatusCodeFromKey(code: keyof typeof TRPC_ERROR_CODES_BY_KEY): number;
declare function getStatusKeyFromCode(code: keyof typeof HTTP_CODE_TO_JSONRPC2): ValueOf<typeof HTTP_CODE_TO_JSONRPC2>;
/**
 * The HTTP status for a response, or for a batch of them: `207` when the
 * responses' statuses differ.
 * @see https://trpc.io/docs/rpc#error-codes---http-status
 */
declare function getHTTPStatusCode(json: TRPCResponse | TRPCResponse[], errors?: readonly (TRPCError | undefined)[]): number;
/**
 * The HTTP status of a `TRPCError`'s code.
 * @see https://trpc.io/docs/rpc#error-codes---http-status
 */
declare function getHTTPStatusCodeFromError(error: TRPCError): number;
//#endregion
//#region src/unstable-core-do-not-import/http/abortError.d.ts
declare function isAbortError(error: unknown): error is DOMException | Error | {
  name: 'AbortError';
};
declare function throwAbortError(message?: string): never;
//#endregion
//#region src/unstable-core-do-not-import/http/parseConnectionParams.d.ts
/**
 * Checks that connection params are an object of strings, or `null`.
 * Throws a `PARSE_ERROR` if they aren't.
 */
declare function parseConnectionParamsFromUnknown(parsed: unknown): TRPCRequestInfo['connectionParams'];
/**
 * Parses connection params from JSON, as `parseConnectionParamsFromUnknown`
 * checks them.
 */
declare function parseConnectionParamsFromString(str: string): TRPCRequestInfo['connectionParams'];
//#endregion
//#region src/unstable-core-do-not-import/http/resolveResponse.d.ts
interface ResolveHTTPRequestOptions<TRouter extends AnyRouter> extends HTTPBaseHandlerOptions<TRouter, Request> {
  createContext: ResolveHTTPRequestOptionsContextFn<TRouter>;
  req: Request;
  path: string;
  /**
   * If the request had an issue before reaching the handler
   */
  error: TRPCError | null;
}
/**
 * Handles a Fetch API `Request` for a router and returns its `Response`.
 * Every adapter uses it; call it to write your own.
 */
declare function resolveResponse<TRouter extends AnyRouter>(opts: ResolveHTTPRequestOptions<TRouter>): Promise<Response>;
//#endregion
//#region src/unstable-core-do-not-import/initTRPC.d.ts
type inferErrorFormatterShape<TType> = TType extends ErrorFormatter<any, infer TShape> ? TShape : DefaultErrorShape;
/**
 * The options `initTRPC.create()` takes.
 * @internal
 */
interface RuntimeConfigOptions<TContext extends object, TMeta extends object> extends Partial<Omit<RootConfig<{
  ctx: TContext;
  meta: TMeta;
  errorShape: any;
  transformer: any;
}>, '$types' | 'transformer'>> {
  /**
   * Serializes inputs and outputs, so they can carry types JSON can't, such
   * as `Date`. The client's links must use the same transformer.
   * @see https://trpc.io/docs/server/data-transformers
   */
  transformer?: DataTransformerOptions;
}
type ContextCallback = (...args: any[]) => object | Promise<object>;
/**
 * What `initTRPC.create()` returns: the builders for your procedures,
 * middlewares and routers. Create it once per backend.
 * @see https://trpc.io/docs/server/routers#initialize-trpc
 */
interface TRPCRootObject<TContext extends object, TMeta extends object, TOptions extends RuntimeConfigOptions<TContext, TMeta>, $Root extends AnyRootTypes = {
  ctx: TContext;
  meta: TMeta;
  errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
  transformer: undefined extends TOptions['transformer'] ? false : true;
}> {
  /**
   * The config the root object was created with.
   * @internal
   */
  _config: RootConfig<$Root>;
  /**
   * The base procedure builder. Add inputs, middlewares and a resolver to
   * make a query, mutation or subscription.
   * @see https://trpc.io/docs/server/procedures
   */
  procedure: ProcedureBuilder<TContext, TMeta, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker, false, $Root['errorShape']>;
  /**
   * Creates a middleware you can reuse across procedures with `.use()`.
   * @see https://trpc.io/docs/server/middlewares
   */
  middleware: <$ContextOverrides>(fn: MiddlewareFunction<TContext, TMeta, object, $ContextOverrides, unknown>) => MiddlewareBuilder<TContext, TMeta, $ContextOverrides, unknown>;
  /**
   * Creates a router from a record of procedures and sub-routers.
   * @see https://trpc.io/docs/server/routers
   */
  router: RouterBuilder<$Root>;
  /**
   * Merges routers into one, flattening their procedures into the same
   * namespace.
   * @see https://trpc.io/docs/server/merging-routers#merging-with-tmergerouters
   */
  mergeRouters: <TRouters extends AnyRouter[]>(...routerList: [...TRouters]) => MergeRouters<TRouters>;
  /**
   * Creates a factory for callers, which call a router's procedures
   * directly on the server, without HTTP.
   * @see https://trpc.io/docs/server/server-side-calls
   */
  createCallerFactory: RouterCallerFactory<$Root>;
}
/**
 * The type of `initTRPC`. Chain `.context()` and `.meta()` to set their
 * types, then call `.create()`.
 */
declare class TRPCBuilder<TContext extends object, TMeta extends object> {
  /**
   * Sets the type of the context every procedure gets. Pass the type, or
   * the type of your `createContext` function.
   * @see https://trpc.io/docs/server/context#defining-the-context-type
   */
  context<TNewContext extends object | ContextCallback>(): TRPCBuilder<TNewContext extends ContextCallback ? Unwrap<TNewContext> : TNewContext, TMeta>;
  /**
   * Sets the type of the metadata procedures can set with `.meta()`.
   * @see https://trpc.io/docs/server/metadata
   */
  meta<TNewMeta extends object>(): TRPCBuilder<TContext, TNewMeta>;
  /**
   * Creates the root object, which holds the builders for your procedures,
   * middlewares and routers.
   * @see https://trpc.io/docs/server/routers#initialize-trpc
   */
  create<TOptions extends RuntimeConfigOptions<TContext, TMeta>>(opts?: ValidateShape<TOptions, RuntimeConfigOptions<TContext, TMeta>>): TRPCRootObject<TContext, TMeta, TOptions>;
}
/**
 * The starting point of every tRPC backend. Call it once.
 * @example
 * ```ts
 * const t = initTRPC.context<Context>().create();
 * export const router = t.router;
 * export const publicProcedure = t.procedure;
 * ```
 * @see https://trpc.io/docs/server/routers#initialize-trpc
 */
declare const initTRPC: TRPCBuilder<object, object>;
//#endregion
//#region src/unstable-core-do-not-import/stream/utils/createDeferred.d.ts
declare function createDeferred<TValue = void>(): {
  promise: Promise<TValue>;
  resolve: (value: TValue) => void;
  reject: (error: unknown) => void;
};
type Deferred<TValue> = ReturnType<typeof createDeferred<TValue>>;
//#endregion
//#region src/unstable-core-do-not-import/stream/utils/disposable.d.ts
/**
 * Takes a value and a dispose function and returns a new object that implements the Disposable interface.
 * The returned object is the original value augmented with a Symbol.dispose method.
 * @param thing The value to make disposable
 * @param dispose Function to call when disposing the resource
 * @returns The original value with Symbol.dispose method added
 */
declare function makeResource<T>(thing: T, dispose: () => void): T & Disposable;
/**
 * Takes a value and an async dispose function and returns a new object that implements the AsyncDisposable interface.
 * The returned object is the original value augmented with a Symbol.asyncDispose method.
 * @param thing The value to make async disposable
 * @param dispose Async function to call when disposing the resource
 * @returns The original value with Symbol.asyncDispose method added
 */
declare function makeAsyncResource<T>(thing: T, dispose: () => Promise<void>): T & AsyncDisposable;
//#endregion
//#region src/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts
declare function iteratorResource<TYield, TReturn, TNext>(iterable: AsyncIterable<TYield, TReturn, TNext>): AsyncIterator<TYield, TReturn, TNext> & AsyncDisposable;
/**
 * Derives a new {@link AsyncGenerator} based of {@link iterable}, that yields its first
 * {@link count} values. Then, a grace period of {@link gracePeriodMs} is started in which further
 * values may still come through. After this period, the generator aborts.
 */
declare function takeWithGrace<T>(iterable: AsyncIterable<T>, opts: {
  count: number;
  gracePeriodMs: number;
}): AsyncGenerator<T>;
//#endregion
//#region src/vendor/standard-schema-v1/error.d.ts
/** A schema error with useful information. */
declare class StandardSchemaV1Error extends Error {
  /** The schema issues. */
  readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
  /**
   * Creates a schema error with useful information.
   *
   * @param issues The schema issues.
   */
  constructor(issues: ReadonlyArray<StandardSchemaV1.Issue>);
}
//#endregion
//#region src/vendor/unpromise/types.d.ts
/** TYPES */
/** A promise that exploits a single, memory-safe upstream subscription
 * to a single re-used Unpromise that persists for the VM lifetime of a
 * Promise.
 *
 * Calling unsubscribe() removes the subscription, eliminating
 * all references to the SubscribedPromise. */
interface SubscribedPromise<T> extends Promise<T> {
  unsubscribe: () => void;
}
/** Duplicate of Promise interface, except each call returns SubscribedPromise */
interface ProxyPromise<T> extends Promise<T> {
  subscribe: () => SubscribedPromise<T>;
  then: <TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null) => SubscribedPromise<TResult1 | TResult2>;
  catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null) => SubscribedPromise<T | TResult>;
  finally: (onfinally?: (() => void) | null) => SubscribedPromise<T>;
}
type PromiseExecutor<T> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
/** A standard pattern for a resolvable, rejectable Promise, based
 * on the emerging ES2023 standard. Type ported from
 * https://github.com/microsoft/TypeScript/pull/56593 */
interface PromiseWithResolvers<T> {
  promise: Promise<T>;
  resolve: (value: T | PromiseLike<T>) => void;
  reject: (reason?: any) => void;
}
/** Given an array, this is the union of its members' types. */
//#endregion
//#region src/vendor/unpromise/unpromise.d.ts
/**
 * Every `Promise<T>` can be shadowed by a single `ProxyPromise<T>`. It is
 * created once, cached and reused throughout the lifetime of the Promise. Get a
 * Promise's ProxyPromise using `Unpromise.proxy(promise)`.
 *
 * The `ProxyPromise<T>` attaches handlers to the original `Promise<T>`
 * `.then()` and `.catch()` just once. Promises derived from it use a
 * subscription- (and unsubscription-) based mechanism that monitors these
 * handlers.
 *
 * Every time you call `.subscribe()`, `.then()` `.catch()` or `.finally()` on a
 * `ProxyPromise<T>` it returns a `SubscribedPromise<T>` having an additional
 * `unsubscribe()` method. Calling `unsubscribe()` detaches reference chains
 * from the original, potentially long-lived Promise, eliminating memory leaks.
 *
 * This approach can eliminate the memory leaks that otherwise come about from
 * repeated `race()` or `any()` calls invoking `.then()` and `.catch()` multiple
 * times on the same long-lived native Promise (subscriptions which can never be
 * cleaned up).
 *
 * `Unpromise.race(promises)` is a reference implementation of `Promise.race`
 * avoiding memory leaks when using long-lived unsettled Promises.
 *
 * `Unpromise.any(promises)` is a reference implementation of `Promise.any`
 * avoiding memory leaks when using long-lived unsettled Promises.
 *
 * `Unpromise.resolve(promise)` returns an ephemeral `SubscribedPromise<T>` for
 * any given `Promise<T>` facilitating arbitrary async/await patterns. Behind
 * the scenes, `resolve` is implemented simply as
 * `Unpromise.proxy(promise).subscribe()`. Don't forget to call `.unsubscribe()`
 * to tidy up!
 *
 */
declare class Unpromise<T> implements ProxyPromise<T> {
  /** INSTANCE IMPLEMENTATION */
  /** The promise shadowed by this Unpromise<T>  */
  protected readonly promise: Promise<T> | PromiseLike<T>;
  /** Promises expecting eventual settlement (unless unsubscribed first). This list is deleted
   * after the original promise settles - no further notifications will be issued. */
  protected subscribers: ReadonlyArray<PromiseWithResolvers<T>> | null;
  /** The Promise's settlement (recorded when it fulfils or rejects). This is consulted when
   * calling .subscribe() .then() .catch() .finally() to see if an immediately-resolving Promise
   * can be returned, and therefore subscription can be bypassed. */
  protected settlement: PromiseSettledResult<T> | null;
  /** Constructor accepts a normal Promise executor function like `new
   * Unpromise((resolve, reject) => {...})` or accepts a pre-existing Promise
   * like `new Unpromise(existingPromise)`. Adds `.then()` and `.catch()`
   * handlers to the Promise. These handlers pass fulfilment and rejection
   * notifications to downstream subscribers and maintains records of value
   * or error if the Promise ever settles. */
  protected constructor(promise: Promise<T>);
  protected constructor(promise: PromiseLike<T>);
  protected constructor(executor: PromiseExecutor<T>);
  /** Create a promise that mitigates uncontrolled subscription to a long-lived
   * Promise via .then() and .catch() - otherwise a source of memory leaks.
   *
   * The returned promise has an `unsubscribe()` method which can be called when
   * the Promise is no longer being tracked by application logic, and which
   * ensures that there is no reference chain from the original promise to the
   * new one, and therefore no memory leak.
   *
   * If original promise has not yet settled, this adds a new unique promise
   * that listens to then/catch events, along with an `unsubscribe()` method to
   * detach it.
   *
   * If original promise has settled, then creates a new Promise.resolve() or
   * Promise.reject() and provided unsubscribe is a noop.
   *
   * If you call `unsubscribe()` before the returned Promise has settled, it
   * will never settle.
   */
  subscribe(): SubscribedPromise<T>;
  /** STANDARD PROMISE METHODS (but returning a SubscribedPromise) */
  then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): SubscribedPromise<TResult1 | TResult2>;
  catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): SubscribedPromise<T | TResult>;
  finally(onfinally?: (() => void) | null): SubscribedPromise<T>;
  /** TOSTRING SUPPORT */
  readonly [Symbol.toStringTag] = "Unpromise";
  /** Unpromise STATIC METHODS */
  /** Create or Retrieve the proxy Unpromise (a re-used Unpromise for the VM lifetime
   * of the provided Promise reference) */
  static proxy<T>(promise: PromiseLike<T>): ProxyPromise<T>;
  /** Create and store an Unpromise keyed by an original Promise. */
  protected static createSubscribablePromise<T>(promise: PromiseLike<T>): Unpromise<T>;
  /** Retrieve a previously-created Unpromise keyed by an original Promise. */
  protected static getSubscribablePromise<T>(promise: PromiseLike<T>): ProxyPromise<T> | undefined;
  /** Promise STATIC METHODS */
  /** Lookup the Unpromise for this promise, and derive a SubscribedPromise from
   * it (that can be later unsubscribed to eliminate Memory leaks) */
  static resolve<T>(value: T | PromiseLike<T>): SubscribedPromise<Awaited<T>>;
  /** Perform Promise.any() via SubscribedPromises, then unsubscribe them.
   * Equivalent to Promise.any but eliminates memory leaks from long-lived
   * promises accumulating .then() and .catch() subscribers. */
  static any<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
  /** Perform Promise.race via SubscribedPromises, then unsubscribe them.
   * Equivalent to Promise.race but eliminates memory leaks from long-lived
   * promises accumulating .then() and .catch() subscribers. */
  static race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
  /** Create a race of SubscribedPromises that will fulfil to a single winning
   * Promise (in a 1-Tuple). Eliminates memory leaks from long-lived promises
   * accumulating .then() and .catch() subscribers. Allows simple logic to
   * consume the result, like...
   * ```ts
   * const [ winner ] = await Unpromise.race([ promiseA, promiseB ]);
   * if(winner === promiseB){
   *   const result = await promiseB;
   *   // do the thing
   * }
   * ```
   * */
  static raceReferences<TPromise extends Promise<unknown>>(promises: readonly TPromise[]): Promise<readonly [TPromise]>;
}
//#endregion
//#region src/adapters/wsEncoder.d.ts
/**
 * Encodes the messages a WebSocket server sends and decodes the ones it
 * gets. The client's `experimental_encoder` must match.
 *
 * @example
 * ```ts
 * const customEncoder: Encoder = {
 *   encode: (data) => myFormat.stringify(data),
 *   decode: (data) => myFormat.parse(data),
 * };
 * ```
 */
interface Encoder {
  /** Encodes a message to send. */
  encode(data: unknown): string | Uint8Array<ArrayBuffer>;
  /** Decodes a received message. */
  decode(data: string | ArrayBuffer | Uint8Array): unknown;
}
/**
 * The default encoder: JSON in text frames.
 */
declare const jsonEncoder: Encoder;
//#endregion
export { AnyMutationProcedure as $, callProcedure as $n, ParserWithInputOutput as $r, defaultFormatter as $t, formDataToObject as A, Simplify as Ai, BaseHandlerOptions as An, tracked as Ar, isFunction as At, createRecursiveProxy as B, BuiltRouter as Bn, PathSeparator as Br, MiddlewareResult as Bt, throwAbortError as C, KeyFromValue as Ci, TRPCRequestMessage as Cn, sseStreamConsumer as Cr, UnsetMarker as Ct, getHTTPStatusCodeFromError as D, PickFirstDefined as Di, TRPCResultMessage as Dn, inferTrackedOutput as Dr, emptyObject as Dt, getHTTPStatusCode as E, Overwrite as Ei, TRPCResult as En, TrackedEnvelope as Er, assertNever as Et, getAcceptHeader as F, WithoutIndexSignature as Fi, ResponseMetaFn as Fn, ProducerOnError as Fr, sleep as Ft, inferTransformedProcedureOutput as G, MergeRouters as Gn, Parser as Gr, experimental_standaloneMiddleware as Gt, inferProcedureErrorShape as H, DecorateCreateRouterOptions as Hn, resolvePathSeparator as Hr, createInputMiddleware as Ht, getLastEventId as I, coerceAsyncIterableToArray as Ii, TRPCAcceptHeader as In, WebReadableStreamEsque as Ir, AnyMiddlewareBuilder as It, SerializeObject as J, RouterCaller as Jn, ParserMyZodEsque as Jr, DefaultErrorData as Jt, inferTransformedSubscriptionOutput as K, Router as Kn, ParserArkTypeEsque as Kr, middlewareMarker as Kt, getRequestInfo as L, inferAsyncIterableYield as Li, TRPCRequestInfo as Ln, isPromise as Lr, AnyMiddlewareFunction as Lt, OctetInput as M, Unwrap as Mi, HTTPErrorHandler as Mn, ConsumerOnError as Mr, mergeWithoutOverrides as Mt, UtilityParser as N, ValidateShape as Ni, ResolveHTTPRequestOptionsContextFn as Nn, JSONLProducerOptions as Nr, noop as Nt, getStatusCodeFromKey as O, ProtectedIntersection as Oi, TRPCSubscriptionStopNotification as On, isTrackedEnvelope as Or, identity as Ot, octetInputParser as P, ValueOf as Pi, ResponseMeta as Pn, NodeJSReadableStreamEsque as Pr, run as Pt, inferClientTypes as Q, RouterRecord as Qn, ParserValibotEsque as Qr, ProcedureErrorFormatter as Qt, getErrorShape as R, TRPCRequestInfoProcedureCall as Rn, jsonlStreamConsumer as Rr, MiddlewareBuilder as Rt, isAbortError as S, InvertKeyValue as Si, TRPCRequest as Sn, sseHeaders as Sr, inferProcedureBuilderResolverOptions as St, JSONRPC2_TO_HTTP_CODE as T, MaybePromise as Ti, TRPCResponseMessage as Tn, TrackedData as Tr, assert as Tt, inferRouterInputs as U, DecorateRouterRecord as Un, urlPathToProcedurePath as Ur, createMiddlewareFactory as Ut, GetInferenceHelpers as V, CreateRouterOptions as Vn, procedurePathToURLPath as Vr, createErrorFormatterMiddleware as Vt, inferRouterOutputs as W, Lazy as Wn, ParseFn as Wr, createOutputMiddleware as Wt, AnyClientTypes as X, RouterCallerFactory as Xn, ParserStandardSchemaEsque as Xr, ErrorFormatter as Xt, SerializeRecord as Y, RouterCallerErrorHandler as Yn, ParserScaleEsque as Yr, DefaultErrorShape as Yt, InferrableClientTypes as Z, RouterDef as Zn, ParserSuperstructEsque as Zr, ErrorFormatterOptions as Zt, TRPCRootObject as _, ErrorSymbol as _i, TRPCClientOutgoingRequest as _n, isServerDefault as _r, CallerOverride as _t, PromiseWithResolvers as a, StandardSchemaV1 as ai, CombinedDataTransformer as an, inferRouterMeta as ar, MutationProcedure as at, parseConnectionParamsFromString as b, GetRawInputFn as bi, TRPCErrorShape as bn, SSEStreamConsumerOptions as br, ProcedureResolverOptions as bt, StandardSchemaV1Error as c, getTRPCErrorFromUnknown as ci, DataTransformerOptions as cn, mergeRouters as cr, QueryProcedure as ct, makeAsyncResource as d, TRPC_ERROR_CODE_KEY as di, transformResult as dn, CreateRootTypes as dr, inferProcedureOutput as dt, ParserWithoutInput as ei, getDefaultErrorShape as en, createCallerFactory as er, AnyProcedure as et, makeResource as f, TRPC_ERROR_CODE_NUMBER as fi, transformTRPCResponse as fn, JSONLConfig as fr, inferProcedureParams as ft, TRPCBuilder as g, DistributiveOmit as gi, TRPCClientOutgoingMessage as gn, isDevDefault as gr, AnyProcedureBuilder as gt, RuntimeConfigOptions as h, Dict as hi, TRPCClientIncomingRequest as hn, RootTypes as hr, procedureTypes as ht, PromiseExecutor as i, inferParser as ii, parseTRPCMessage as in, inferRouterError as ir, LegacyObservableSubscriptionProcedure as it, FileLike as j, TypeError as ji, HTTPBaseHandlerOptions as jn, EventSourceLike as jr, isObject as jt, getStatusKeyFromCode as k, Result$1 as ki, TRPCSuccessResponse as kn, sse as kr, isAsyncIterable as kt, iteratorResource as l, TRPC_ERROR_CODES_BY_KEY as li, defaultTransformer as ln, AnyRootTypes as lr, SubscriptionProcedure as lt, createDeferred as m, DeepPartial as mi, TRPCClientIncomingMessage as mn, RootConfig as mr, inferSubscriptionOutput as mt, jsonEncoder as n, ParserZodEsque as ni, isFormattedErrorShape as nn, getProcedureAtPath as nr, AnySubscriptionProcedure as nt, ProxyPromise as o, TRPCError as oi, CombinedDataTransformerClient as on, inferRouterRootTypes as or, Procedure as ot, Deferred as p, retryableRpcCodes as pi, JSONRPC2 as pn, JSONLContentType as pr, inferSubscriptionInput as pt, Serialize as q, RouterBuilder as qn, ParserCustomValidatorEsque as qr, AnyProcedureErrorFormatter as qt, Unpromise as r, getParseFn as ri, setFormattedErrorShape as rn, inferRouterContext as rr, ErrorHandlerOptions as rt, SubscribedPromise as s, getCauseFromUnknown as si, DataTransformer as sn, lazy as sr, ProcedureType as st, Encoder as t, ParserYupEsque as ti, getFormattedErrorShape as tn, createRouterFactory as tr, AnyQueryProcedure as tt, takeWithGrace as u, TRPC_ERROR_CODES_BY_NUMBER as ui, getDataTransformer as un, CreateContextCallback as ur, inferProcedureInput as ut, initTRPC as v, Filter as vi, TRPCConnectionParamsMessage as vn, SSEClientOptions as vr, ProcedureBuilder as vt, HTTP_CODE_TO_JSONRPC2 as w, Maybe as wi, TRPCResponse as wn, sseStreamProducer as wr, abortSignalsAnyPonyfill as wt, parseConnectionParamsFromUnknown as x, IntersectionError as xi, TRPCReconnectNotification as xn, SSEStreamProducerOptions as xr, createBuilder as xt, resolveResponse as y, FilterKeys as yi, TRPCErrorResponse as yn, SSEPingOptions as yr, ProcedureCallOptions as yt, createFlatProxy as z, AnyRouter as zn, jsonlStreamProducer as zr, MiddlewareFunction as zt };
import './unstable-core-do-not-import.mjs';
//# sourceMappingURL=unstable-core-do-not-import-CzDUc5m2.d.mts.map