import { t as __name } from "./chunk--u3MIqq1.js";
import { C as ResolvePathOptions, S as Refs, _ as OperationSchemas, a as ReactGenerator, b as PluginOas, c as SchemaGenerator, d as SchemaMethodResult, f as OperationGenerator, g as OperationSchema, h as Include, i as Version, l as SchemaGeneratorBuildOptions, m as Exclude, n as createGenerator$1, o as createReactGenerator$1, p as OperationMethodResult, r as Generator$1, s as GetSchemaGeneratorOptions, u as SchemaGeneratorOptions, v as Options, w as Resolver, x as Ref, y as Override } from "./createGenerator-W6EtzLmf.js";
import { a as SchemaMapper, c as schemaKeywords, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema } from "./SchemaMapper-SneuY1wg.js";
import { Operation, SchemaObject } from "@kubb/oas";
import * as _kubb_core0 from "@kubb/core";
import { Config, Plugin, PluginFactoryOptions } from "@kubb/core";
import { OperationNode, SchemaNode } from "@kubb/ast/types";
import { Fabric } from "@kubb/react-fabric/types";

//#region src/createParser.d.ts
/**
 * Helper type to create a SchemaTree with a specific current schema type
 */
type SchemaTreeWithKeyword<K extends keyof SchemaKeywordMapper> = Omit<SchemaTree, 'current'> & {
  current: SchemaKeywordMapper[K];
};
/**
 * Handler context with parse method available via `this`
 */
type HandlerContext<TOutput, TOptions> = {
  parse: (tree: SchemaTree, options: TOptions) => TOutput | null | undefined;
};
/**
 * Handler function type for custom keyword processing
 * Handlers can access the parse function via `this.parse`
 * The tree.current is typed based on the keyword K
 */
type KeywordHandler<TOutput, TOptions, K extends keyof SchemaKeywordMapper = keyof SchemaKeywordMapper> = (this: HandlerContext<TOutput, TOptions>, tree: SchemaTreeWithKeyword<K>, options: TOptions) => TOutput | null | undefined;
/**
 * Configuration for createParser
 */
type CreateParserConfig<TOutput, TOptions> = {
  /**
   * The keyword mapper that maps schema keywords to output generators
   */
  mapper: SchemaMapper<TOutput>;
  /**
   * Custom handlers for specific schema keywords
   * These provide the implementation for complex types that need special processing
   *
   * Use function syntax (not arrow functions) to enable use of `this` keyword:
   * ```typescript
   * handlers: {
   *   enum(tree, options, parse) {
   *     // Implementation
   *   }
   * }
   * ```
   *
   * Common keywords that typically need handlers:
   * - union: Combine multiple schemas into a union
   * - and: Combine multiple schemas into an intersection
   * - array: Handle array types with items
   * - object: Handle object types with properties
   * - enum: Handle enum types
   * - tuple: Handle tuple types
   * - const: Handle literal/const types
   * - ref: Handle references to other schemas
   * - string/number/integer: Handle primitives with constraints (min/max)
   * - matches: Handle regex patterns
   * - default/describe/optional/nullable: Handle modifiers
   */
  handlers: Partial<{ [K in keyof SchemaKeywordMapper]: KeywordHandler<TOutput, TOptions, K> }>;
};
/**
 * Creates a parser function that converts schema trees to output using the provided mapper and handlers
 *
 * This function provides a framework for building parsers by:
 * 1. Checking for custom handlers for each keyword
 * 2. Falling back to the mapper for simple keywords
 * 3. Providing utilities for common operations (finding siblings, etc.)
 *
 * The generated parser is recursive and can handle nested schemas.
 *
 * **Type Safety**: Each handler receives a `tree` parameter where `tree.current` is automatically
 * typed as the specific schema keyword type (e.g., `SchemaKeywordMapper['ref']` for the `ref` handler).
 * This means you can access `tree.current.args` with full type safety without needing `isKeyword` checks,
 * though such checks can still be used as runtime guards if desired.
 *
 * @template TOutput - The output type (e.g., string for Zod/Faker, ts.TypeNode for TypeScript)
 * @template TOptions - The parser options type
 * @param config - Configuration object containing mapper and handlers
 * @returns A parse function that converts SchemaTree to TOutput
 *
 * @example
 * ```ts
 * // Create a simple string-based parser
 * const parse = createParser({
 *   mapper: zodKeywordMapper,
 *   handlers: {
 *     // tree.current is typed as SchemaKeywordMapper['union']
 *     union(tree, options) {
 *       const items = tree.current.args // args is correctly typed as Schema[]
 *         .map(it => this.parse({ ...tree, current: it }, options))
 *         .filter(Boolean)
 *       return `z.union([${items.join(', ')}])`
 *     },
 *     // tree.current is typed as SchemaKeywordMapper['string']
 *     string(tree, options) {
 *       const minSchema = findSchemaKeyword(tree.siblings, 'min')
 *       const maxSchema = findSchemaKeyword(tree.siblings, 'max')
 *       return zodKeywordMapper.string(false, minSchema?.args, maxSchema?.args)
 *     },
 *     // tree.current is typed as SchemaKeywordMapper['ref']
 *     ref(tree, options) {
 *       // No need for isKeyword check - tree.current.args is already properly typed
 *       return `Ref: ${tree.current.args.name}`
 *     }
 *   }
 * })
 * ```
 */
declare function createParser<TOutput, TOptions extends Record<string, any>>(config: CreateParserConfig<TOutput, TOptions>): (tree: SchemaTree, options: TOptions) => TOutput | null | undefined;
/**
 * Helper to find a schema keyword in siblings
 * Useful in handlers when you need to find related schemas (e.g., min/max for string)
 *
 * @example
 * ```ts
 * const minSchema = findSchemaKeyword(tree.siblings, 'min')
 * const maxSchema = findSchemaKeyword(tree.siblings, 'max')
 * return zodKeywordMapper.string(false, minSchema?.args, maxSchema?.args)
 * ```
 */
declare function findSchemaKeyword<K extends keyof SchemaKeywordMapper>(siblings: Schema[], keyword: K): SchemaKeywordMapper[K] | undefined;
//#endregion
//#region src/plugin.d.ts
declare const pluginOasName = "plugin-oas";
declare const pluginOas: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginOas>;
//#endregion
//#region src/utils.d.ts
type BuildOperationsBaseOptions<TOptions extends PluginFactoryOptions> = {
  config: Config;
  fabric: Fabric;
  plugin: Plugin<TOptions>;
};
type BuildOperationsV1Options<TOptions extends PluginFactoryOptions> = BuildOperationsBaseOptions<TOptions> & {
  version?: '1';
  Component: ReactGenerator<any, '1'>['Operations'];
  generator: Omit<OperationGenerator<TOptions>, 'build'>;
};
type BuildOperationsV2Options<TOptions extends PluginFactoryOptions> = BuildOperationsBaseOptions<TOptions> & {
  version: '2';
  Component: ReactGenerator<any, '2'>['Operations'];
};
declare function buildOperations<TOptions extends PluginFactoryOptions>(operations: Array<Operation>, options: BuildOperationsV1Options<TOptions>): Promise<void>;
declare function buildOperations<TOptions extends PluginFactoryOptions>(nodes: Array<OperationNode>, options: BuildOperationsV2Options<TOptions>): Promise<void>;
type BuildOperationBaseOptions<TOptions extends PluginFactoryOptions> = {
  config: Config;
  fabric: Fabric;
  plugin: Plugin<TOptions>;
};
type BuildOperationV1Options<TOptions extends PluginFactoryOptions> = BuildOperationBaseOptions<TOptions> & {
  version?: '1';
  Component: ReactGenerator<any, '1'>['Operation'];
  generator: Omit<OperationGenerator<TOptions>, 'build'>;
};
type BuildOperationV2Options<TOptions extends PluginFactoryOptions> = BuildOperationBaseOptions<TOptions> & {
  version: '2';
  Component: ReactGenerator<any, '2'>['Operation'];
};
declare function buildOperation<TOptions extends PluginFactoryOptions>(operation: Operation, options: BuildOperationV1Options<TOptions>): Promise<void>;
declare function buildOperation<TOptions extends PluginFactoryOptions>(node: OperationNode, options: BuildOperationV2Options<TOptions>): Promise<void>;
type BuildSchemaBaseOptions<TOptions extends PluginFactoryOptions> = {
  config: Config;
  fabric: Fabric;
  plugin: Plugin<TOptions>;
};
type BuildSchemaV1Options<TOptions extends PluginFactoryOptions> = BuildSchemaBaseOptions<TOptions> & {
  version?: '1';
  Component: ReactGenerator<any, '1'>['Schema'];
  generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
};
type BuildSchemaV2Options<TOptions extends PluginFactoryOptions> = BuildSchemaBaseOptions<TOptions> & {
  version: '2';
  Component: ReactGenerator<any, '2'>['Schema'];
};
declare function buildSchema<TOptions extends PluginFactoryOptions>(schema: {
  name: string;
  tree: Array<Schema>;
  value: SchemaObject;
}, options: BuildSchemaV1Options<TOptions>): Promise<void>;
declare function buildSchema<TOptions extends PluginFactoryOptions>(schema: SchemaNode, options: BuildSchemaV2Options<TOptions>): Promise<void>;
//#endregion
//#region src/index.d.ts
/**
 * @deprecated use `import { createGenerator } from '@kubb/plugin-oas/generators'`
 */
declare const createGenerator: typeof createGenerator$1;
/**
 * @deprecated use `import { createReactGenerator } from '@kubb/plugin-oas/generators'`
 */
declare const createReactGenerator: typeof createReactGenerator$1;
/**
 * @deprecated use `import { Generator } from '@kubb/plugin-oas/generators'`
 */
type Generator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = Generator$1<TOptions, TVersion>;
//#endregion
export { type CreateParserConfig, Exclude, Generator, type GetSchemaGeneratorOptions, Include, type KeywordHandler, OperationGenerator, type OperationMethodResult, OperationSchema, OperationSchemas, Options, Override, PluginOas, Ref, Refs, ResolvePathOptions, Resolver, type Schema, SchemaGenerator, type SchemaGeneratorBuildOptions, type SchemaGeneratorOptions, type SchemaKeyword, type SchemaKeywordBase, type SchemaKeywordMapper, type SchemaMapper, type SchemaMethodResult, type SchemaTree, buildOperation, buildOperations, buildSchema, createGenerator, createParser, createReactGenerator, findSchemaKeyword, isKeyword, pluginOas, pluginOasName, schemaKeywords };
//# sourceMappingURL=index.d.ts.map