{"version":3,"file":"index.cjs","names":["ts","isNonNullable","syncSchemaRef","factory.createEnumDeclaration","File","parserTs","syncSchemaRef","ast","ast","File","ast","ast","factory","ast","factory.createTypeReferenceNode","factory.createUrlTemplateType","factory.dateOrStringNode","factory.constToTypeNode","factory.createUnionDeclaration","isStringType","factory.createIntersectionDeclaration","factory.createTypeLiteralNode","factory.buildMemberNodes","factory.createArrayDeclaration","factory.buildTupleNode","factory.buildPropertyType","syncSchemaRef","factory.createPropertySignature","factory.appendJSDocToNode","factory.buildIndexSignatures","parserTs","factory.createOmitDeclaration","factory.createTypeDeclaration","defineGenerator","jsxRenderer","ast","File","createResolver","definePlugin","Resolver"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/strings.ts","../../../internals/utils/src/fs.ts","../src/constants.ts","../src/factory.ts","../src/components/Enum.tsx","../src/utils.ts","../src/components/Type.tsx","../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../../../internals/shared/src/refs.ts","../../../internals/shared/src/group.ts","../../../internals/shared/src/schemaTraversal.ts","../src/printers/printerTs.ts","../src/generators/typeGenerator.tsx","../src/resolvers/resolverTs.ts","../src/plugin.ts","../src/printers/functionParams.ts","../src/printers/functionPrinter.ts","../src/printers/operationParams.ts"],"sourcesContent":["type Options = {\n  /**\n   * Text prepended before casing is applied.\n   */\n  prefix?: string\n  /**\n   * Text appended before casing is applied.\n   */\n  suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n  return text\n    .trim()\n    .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n    .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n    .replace(/(\\d)([a-z])/g, '$1 $2')\n    .split(/[\\s\\-_./\\\\:]+/)\n    .filter(Boolean)\n    .map((word, i) => {\n      if (word.length > 1 && word === word.toUpperCase()) return word\n      const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n      return head + word.slice(1)\n    })\n    .join('')\n    .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Uppercases only the first character of `text`, leaving the rest untouched.\n * Unlike {@link pascalCase} it never re-splits word boundaries or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n  return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n  const processed = `${prefix} ${text} ${suffix}`.trim()\n  return processed\n    .replace(/([a-z])([A-Z])/g, '$1_$2')\n    .replace(/[\\s\\-.]+/g, '_')\n    .replace(/[^a-zA-Z0-9_]/g, '')\n    .toLowerCase()\n    .split('_')\n    .filter(Boolean)\n    .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n  return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n  'abstract',\n  'arguments',\n  'boolean',\n  'break',\n  'byte',\n  'case',\n  'catch',\n  'char',\n  'class',\n  'const',\n  'continue',\n  'debugger',\n  'default',\n  'delete',\n  'do',\n  'double',\n  'else',\n  'enum',\n  'eval',\n  'export',\n  'extends',\n  'false',\n  'final',\n  'finally',\n  'float',\n  'for',\n  'function',\n  'goto',\n  'if',\n  'implements',\n  'import',\n  'in',\n  'instanceof',\n  'int',\n  'interface',\n  'let',\n  'long',\n  'native',\n  'new',\n  'null',\n  'package',\n  'private',\n  'protected',\n  'public',\n  'return',\n  'short',\n  'static',\n  'super',\n  'switch',\n  'synchronized',\n  'this',\n  'throw',\n  'throws',\n  'transient',\n  'true',\n  'try',\n  'typeof',\n  'var',\n  'void',\n  'volatile',\n  'while',\n  'with',\n  'yield',\n  'Array',\n  'Date',\n  'hasOwnProperty',\n  'Infinity',\n  'isFinite',\n  'isNaN',\n  'isPrototypeOf',\n  'length',\n  'Math',\n  'name',\n  'NaN',\n  'Number',\n  'Object',\n  'prototype',\n  'String',\n  'toString',\n  'undefined',\n  'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status')  // true\n * isValidVarName('class')   // false (reserved word)\n * isValidVarName('42foo')   // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n  if (!name || reservedWords.has(name as 'valueOf')) {\n    return false\n  }\n  return isIdentifier(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409')             // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet')              // 'Pet'\n * ensureValidVarName('class')            // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n  if (!name || isValidVarName(name)) {\n    return name\n  }\n  return `_${name}`\n}\n\n/**\n * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.\n *\n * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys\n * even though they are not valid variable names, so use this (not {@link isValidVarName}) when\n * deciding whether an object key needs quoting.\n *\n * @example\n * ```ts\n * isIdentifier('name')   // true\n * isIdentifier('x-total')// false\n * ```\n */\nexport function isIdentifier(name: string): boolean {\n  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","/**\n * Wraps a value in single quotes for emitting a single-quoted JavaScript string literal, escaping\n * any backslash or single quote in the content.\n *\n * @example\n * ```ts\n * singleQuote('foo')      // \"'foo'\"\n * singleQuote(\"o'clock\")  // \"'o\\\\'clock'\"\n * ```\n */\nexport function singleQuote(value: string | number | boolean | undefined | null): string {\n  if (value === undefined || value === null) return \"''\"\n  const escaped = String(value).replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\")\n\n  return `'${escaped}'`\n}\n\n/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * ```ts\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello')   // 'hello'\n * ```\n */\nexport function trimQuotes(text: string): string {\n  if (text.length >= 2) {\n    const first = text[0]\n    const last = text[text.length - 1]\n    if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n      return text.slice(1, -1)\n    }\n  }\n  return text\n}\n\n/**\n * Serializes a primitive to a single-quoted string literal, stripping any surrounding quotes first.\n *\n * Escaping runs through `JSON.stringify`, then the result switches to single quotes so the generated\n * code matches the repo style without a formatter.\n *\n * @example\n * ```ts\n * stringify('hello')   // \"'hello'\"\n * stringify('\"hello\"') // \"'hello'\"\n * ```\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n  if (value === undefined || value === null) return \"''\"\n  const json = JSON.stringify(trimQuotes(value.toString()))\n  const inner = json.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/'/g, \"\\\\'\")\n  return `'${inner}'`\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals, covering quotes, backslashes,\n * and the Unicode line terminators U+2028 and U+2029.\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n  return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n    switch (character) {\n      case '\"':\n      case \"'\":\n      case '\\\\':\n        return `\\\\${character}`\n      case '\\n':\n        return '\\\\n'\n      case '\\r':\n        return '\\\\r'\n      case '\\u2028':\n        return '\\\\u2028'\n      case '\\u2029':\n        return '\\\\u2029'\n      default:\n        return ''\n    }\n  })\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo')       // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n  const raw = trimQuotes(text)\n\n  const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n  const replacementTarget = match?.[1] ?? ''\n  const matchedFlags = match?.[2]\n  const cleaned = raw\n    .replace(/^\\\\?\\//, '')\n    .replace(/\\\\?\\/$/, '')\n    .replace(replacementTarget, '')\n\n  const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n  if (func === null) return `/${source}/${flags}`\n\n  return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a plain object as multi-line `key: value` source for embedding in generated code. Nested\n * objects recurse with fixed indentation, so the result drops straight into an object literal\n * without re-parsing.\n *\n * @example\n * ```ts\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n        a: 1\\n      }'\n * ```\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n  const items = Object.entries(value)\n    .map(([key, val]) => {\n      if (val !== null && typeof val === 'object') {\n        return `${key}: {\\n        ${stringifyObject(val as Record<string, unknown>)}\\n      }`\n      }\n      return `${key}: ${val}`\n    })\n    .filter(Boolean)\n  return items.join(',\\n')\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n  const parts = Array.isArray(param) ? param : param.split('.')\n  if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n  return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { posix } from 'node:path'\nimport { camelCase } from './casing.ts'\n\nfunction toSlash(p: string): string {\n  if (p.startsWith('\\\\\\\\?\\\\')) return p\n  return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts')      // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null): string {\n  if (!rootDir || !filePath) {\n    throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n  }\n\n  const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n  return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = camelCase): string {\n  const parts = name.split(/\\.(?=[a-zA-Z])/)\n  return parts\n    .map((part, i) => (i === parts.length - 1 ? caseLast(part) : camelCase(part)))\n    .filter(Boolean)\n    .join('/')\n}\n","import type { PluginTs } from './types.ts'\n\ntype OptionalType = PluginTs['resolvedOptions']['optionalType']\ntype EnumType = PluginTs['resolvedOptions']['enum']['type']\n\n/**\n * `optionalType` values that cause a property's type to include `| undefined`.\n */\nexport const OPTIONAL_ADDS_UNDEFINED = new Set<OptionalType>(['undefined', 'questionTokenAndUndefined'] as const)\n\n/**\n * `optionalType` values that render the property key with a `?` token.\n */\nexport const OPTIONAL_ADDS_QUESTION_TOKEN = new Set<OptionalType>(['questionToken', 'questionTokenAndUndefined'] as const)\n\n/**\n * `enum.type` values that append a `typeSuffix` to the generated enum type alias.\n */\nexport const ENUM_TYPES_WITH_KEY_SUFFIX = new Set<EnumType>(['asConst'] as const)\n\n/**\n * `enum.type` values that require a runtime value declaration (object, enum, or literal).\n */\nexport const ENUM_TYPES_WITH_RUNTIME_VALUE = new Set<EnumType | undefined>(['enum', 'asConst', 'constEnum', 'literal', undefined] as const)\n\n/**\n * `enum.type` values whose type declaration is type-only (no runtime value emitted for the type alias).\n */\nexport const ENUM_TYPES_WITH_TYPE_ONLY = new Set<EnumType | undefined>(['asConst', 'literal', undefined] as const)\n\n/**\n * Ordering priority for function parameters: lower = sorted earlier.\n */\nexport const PARAM_RANK = {\n  required: 0,\n  optional: 1,\n  withDefault: 2,\n  rest: 3,\n} as const\n","import { camelCase, pascalCase, screamingSnakeCase, snakeCase } from '@internals/utils'\nimport { syncSchemaRef } from 'kubb/kit'\nimport type { ast } from 'kubb/kit'\nimport ts from 'typescript'\nimport { OPTIONAL_ADDS_UNDEFINED } from './constants.ts'\n\nconst { SyntaxKind, factory } = ts\n\n/**\n * Compares two strings by UTF-16 code unit, keeping sorted output identical across platforms\n * regardless of locale.\n */\nfunction compareStrings(a: string, b: string): number {\n  if (a < b) return -1\n  if (a > b) return 1\n  return 0\n}\n\nfunction isNumber(value: unknown): value is number {\n  return typeof value === 'number' && !Number.isNaN(value)\n}\n\n// https://ts-ast-viewer.com/\n\n/**\n * TypeScript AST modifiers for common keywords (async, export, const, static).\n */\nexport const modifiers = {\n  async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n  export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n  const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n  static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\n/**\n * TypeScript syntax kind constants for union, literal, and string types.\n */\nexport const syntaxKind = {\n  union: SyntaxKind.UnionType as 192,\n  literalType: SyntaxKind.LiteralType,\n  stringLiteral: SyntaxKind.StringLiteral,\n} as const\n\nexport function isNonNullable<T>(value: T | null | undefined): value is T {\n  return value !== null && value !== undefined\n}\n\nfunction isValidIdentifier(str: string): boolean {\n  if (!str.length || str.trim() !== str) {\n    return false\n  }\n\n  // Mirrors `ts.isIdentifierText`, which is not in the public type declarations.\n  // Walking by code point with `isIdentifierStart`/`isIdentifierPart` rejects\n  // invalid names such as private identifiers (`#FOO`), forcing `propertyName`\n  // to quote them.\n  let ch = str.codePointAt(0)!\n  if (!ts.isIdentifierStart(ch, ts.ScriptTarget.Latest)) {\n    return false\n  }\n  for (let i = ch > 0xffff ? 2 : 1; i < str.length; i += ch > 0xffff ? 2 : 1) {\n    ch = str.codePointAt(i)!\n    if (!ts.isIdentifierPart(ch, ts.ScriptTarget.Latest)) {\n      return false\n    }\n  }\n  return true\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n  if (typeof name === 'string') {\n    const isValid = isValidIdentifier(name)\n    return isValid ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n  }\n  return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\n/**\n * Creates a question token for optional type annotations.\n * Pass `true` to use the cached token, or provide a pre-created token.\n */\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n  if (!token) {\n    return undefined\n  }\n  if (token === true) {\n    return questionToken\n  }\n  return token\n}\n\n/**\n * Creates a TypeScript intersection type node from multiple type nodes.\n * Returns the single node if only one is provided, or wraps in parentheses if requested.\n */\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n  if (!nodes.length) {\n    return null\n  }\n\n  if (nodes.length === 1) {\n    return nodes[0] || null\n  }\n\n  const node = factory.createIntersectionTypeNode(nodes)\n\n  if (withParentheses) {\n    return factory.createParenthesizedType(node)\n  }\n\n  return node\n}\n\n/**\n * Creates a TypeScript array type node.\n * Use `arrayType: 'array'` for bracket syntax (`T[]`), or `'generic'` for `Array<T>`.\n *\n * @example Array bracket syntax\n * `createArrayDeclaration({ nodes: [stringType], arrayType: 'array' }) // → string[]`\n *\n * @example Generic Array syntax\n * `createArrayDeclaration({ nodes: [stringType], arrayType: 'generic' }) // → Array<string>`\n */\nexport function createArrayDeclaration({ nodes, arrayType = 'array' }: { nodes: Array<ts.TypeNode>; arrayType?: 'array' | 'generic' }): ts.TypeNode | null {\n  if (!nodes.length) {\n    return factory.createTupleTypeNode([])\n  }\n\n  if (nodes.length === 1) {\n    const node = nodes[0]\n    if (!node) {\n      return null\n    }\n    if (arrayType === 'generic') {\n      return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [node])\n    }\n    return factory.createArrayTypeNode(node)\n  }\n\n  // For union types (multiple nodes), respect arrayType preference\n  const unionType = factory.createUnionTypeNode(nodes)\n  if (arrayType === 'generic') {\n    return factory.createTypeReferenceNode(factory.createIdentifier('Array'), [unionType])\n  }\n  // For array syntax with unions, we need parentheses: (string | number)[]\n  return factory.createArrayTypeNode(factory.createParenthesizedType(unionType))\n}\n\n/**\n * Minimum nodes length of 2\n * @example Union type example\n * `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n  if (!nodes.length) {\n    return keywordTypeNodes.any\n  }\n\n  if (nodes.length === 1) {\n    return nodes[0] as ts.TypeNode\n  }\n\n  const node = factory.createUnionTypeNode(nodes)\n\n  if (withParentheses) {\n    return factory.createParenthesizedType(node)\n  }\n\n  return node\n}\n\n/**\n * Creates a TypeScript property signature for object/interface members.\n * Supports optional markers, readonly modifiers, and type annotations.\n */\nexport function createPropertySignature({\n  readOnly,\n  modifiers = [],\n  name,\n  questionToken,\n  type,\n}: {\n  readOnly?: boolean\n  modifiers?: Array<ts.Modifier>\n  name: ts.PropertyName | string\n  questionToken?: ts.QuestionToken | boolean\n  type?: ts.TypeNode\n}) {\n  return factory.createPropertySignature(\n    [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(\n      (modifier): modifier is ts.Modifier => modifier !== undefined,\n    ),\n    propertyName(name),\n    createQuestionToken(questionToken),\n    type,\n  )\n}\n\n/**\n * Creates a function parameter declaration with optional markers, rest parameters, and type annotations.\n */\nexport function createParameterSignature(\n  name: string | ts.BindingName,\n  {\n    modifiers,\n    dotDotDotToken,\n    questionToken,\n    type,\n    initializer,\n  }: {\n    decorators?: Array<ts.Decorator>\n    modifiers?: Array<ts.Modifier>\n    dotDotDotToken?: ts.DotDotDotToken\n    questionToken?: ts.QuestionToken | boolean\n    type?: ts.TypeNode\n    initializer?: ts.Expression\n  },\n): ts.ParameterDeclaration {\n  return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\n/**\n * Creates a JSDoc comment node from an array of comment strings.\n * Returns null if no comments are provided.\n */\nexport function createJSDoc({ comments }: { comments: Array<string> }) {\n  if (!comments.length) {\n    return null\n  }\n  return factory.createJSDocComment(\n    factory.createNodeArray(\n      comments.map((comment, i) => {\n        if (i === comments.length - 1) {\n          return factory.createJSDocText(comment)\n        }\n\n        return factory.createJSDocText(`${comment}\\n`)\n      }),\n    ),\n  )\n}\n\n/**\n * Attaches JSDoc comments to an AST node as synthetic leading comments.\n * Filters out undefined comments before attaching.\n *\n * @see https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n  const filteredComments = comments.filter(Boolean)\n\n  if (!filteredComments.length) {\n    return node\n  }\n\n  const text = filteredComments.reduce((acc = '', comment = '') => {\n    return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n  }, '*')\n\n  // Use the node directly instead of spreading to avoid creating Unknown nodes\n  // TypeScript's addSyntheticLeadingComment accepts the node as-is\n  return ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\n/**\n * Creates a TypeScript index signature for dynamic property access.\n * Defines the key type (default: `string`) and value type on an object.\n */\nfunction createIndexSignature(\n  type: ts.TypeNode,\n  {\n    modifiers,\n    indexName = 'key',\n    indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n  }: {\n    indexName?: string\n    indexType?: ts.TypeNode\n    decorators?: Array<ts.Decorator>\n    modifiers?: Array<ts.Modifier>\n  } = {},\n) {\n  return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\n/**\n * Creates a TypeScript type alias declaration with optional modifiers and type parameters.\n */\nfunction createTypeAliasDeclaration({\n  modifiers,\n  name,\n  typeParameters,\n  type,\n}: {\n  modifiers?: Array<ts.Modifier>\n  name: string | ts.Identifier\n  typeParameters?: Array<ts.TypeParameterDeclaration>\n  type: ts.TypeNode\n}) {\n  return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\n/**\n * Creates a TypeScript interface declaration with optional modifiers, type parameters, and members.\n */\nfunction createInterfaceDeclaration({\n  modifiers,\n  name,\n  typeParameters,\n  members,\n}: {\n  modifiers?: Array<ts.Modifier>\n  name: string | ts.Identifier\n  typeParameters?: Array<ts.TypeParameterDeclaration>\n  members: Array<ts.TypeElement>\n}) {\n  return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\n/**\n * Creates a TypeScript type declaration as either a type alias or interface.\n * Intelligently selects the syntax based on the type structure and attaches JSDoc comments.\n */\nexport function createTypeDeclaration({\n  syntax,\n  isExportable,\n  comments,\n  name,\n  type,\n}: {\n  syntax: 'type' | 'interface'\n  comments: Array<string | undefined>\n  isExportable?: boolean\n  name: string | ts.Identifier\n  type: ts.TypeNode\n}) {\n  if (syntax === 'interface' && ts.isTypeLiteralNode(type)) {\n    const node = createInterfaceDeclaration({\n      members: [...type.members],\n      modifiers: isExportable ? [modifiers.export] : [],\n      name,\n      typeParameters: undefined,\n    })\n\n    return appendJSDocToNode({\n      node,\n      comments,\n    })\n  }\n\n  const node = createTypeAliasDeclaration({\n    type,\n    modifiers: isExportable ? [modifiers.export] : [],\n    name,\n    typeParameters: undefined,\n  })\n\n  return appendJSDocToNode({\n    node,\n    comments,\n  })\n}\n\n/**\n * Creates an import declaration with support for default imports, named imports, namespace imports, and type-only imports.\n * Optionally rename imported members with `propertyName` and `name` pairs.\n *\n * @example Default import\n * `import Pet from './Pet'`\n *\n * @example Named imports with rename\n * `import { Pet as Cat } from './Pet'`\n *\n * @example Namespace import\n * `import * as Pet from './Pet'`\n */\nexport function createImportDeclaration({\n  name,\n  path,\n  isTypeOnly = false,\n  isNameSpace = false,\n}: {\n  name: string | Array<string | { propertyName: string; name?: string }>\n  path: string\n  isTypeOnly?: boolean\n  isNameSpace?: boolean\n}) {\n  if (!Array.isArray(name)) {\n    const importPropertyName = isNameSpace ? undefined : factory.createIdentifier(name)\n    const importName = isNameSpace ? factory.createNamespaceImport(factory.createIdentifier(name)) : undefined\n\n    return factory.createImportDeclaration(\n      undefined,\n      factory.createImportClause(isTypeOnly, importPropertyName, importName),\n      factory.createStringLiteral(path),\n      undefined,\n    )\n  }\n\n  // Sort the imports alphabetically for consistent output across platforms\n  const sortedName = name.toSorted((a, b) => compareStrings(typeof a === 'object' ? a.propertyName : a, typeof b === 'object' ? b.propertyName : b))\n\n  return factory.createImportDeclaration(\n    undefined,\n    factory.createImportClause(\n      isTypeOnly,\n      undefined,\n      factory.createNamedImports(\n        sortedName.map((item) => {\n          if (typeof item === 'object') {\n            const obj = item as { propertyName: string; name?: string }\n            if (obj.name) {\n              return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n            }\n\n            return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n          }\n\n          return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n        }),\n      ),\n    ),\n    factory.createStringLiteral(path),\n    undefined,\n  )\n}\n\n/**\n * Creates an export declaration with support for named exports, namespace exports, and type-only exports.\n * Sorts export names alphabetically for consistent output across platforms.\n */\nexport function createExportDeclaration({\n  path,\n  asAlias,\n  isTypeOnly = false,\n  name,\n}: {\n  path: string\n  asAlias?: boolean\n  isTypeOnly?: boolean\n  name?: string | Array<ts.Identifier | string>\n}) {\n  if (name && !Array.isArray(name) && !asAlias) {\n    console.warn(`When using name as string, asAlias should be true ${name}`)\n  }\n\n  if (!Array.isArray(name)) {\n    const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n    return factory.createExportDeclaration(\n      undefined,\n      isTypeOnly,\n      asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n      factory.createStringLiteral(path),\n      undefined,\n    )\n  }\n\n  // Sort the exports alphabetically for consistent output across platforms\n  const sortedName = name.toSorted((a, b) => compareStrings(typeof a === 'string' ? a : a.text, typeof b === 'string' ? b : b.text))\n\n  return factory.createExportDeclaration(\n    undefined,\n    isTypeOnly,\n    factory.createNamedExports(\n      sortedName.map((propertyName) => {\n        return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n      }),\n    ),\n    factory.createStringLiteral(path),\n    undefined,\n  )\n}\n\n/**\n * Apply casing transformation to enum keys\n */\nfunction applyEnumKeyCasing(key: string, casing: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none' = 'none'): string {\n  if (casing === 'none') {\n    return key\n  }\n  if (casing === 'screamingSnakeCase') {\n    return screamingSnakeCase(key)\n  }\n  if (casing === 'snakeCase') {\n    return snakeCase(key)\n  }\n  if (casing === 'pascalCase') {\n    return pascalCase(key)\n  }\n  if (casing === 'camelCase') {\n    return camelCase(key)\n  }\n  return key\n}\n\n/**\n * Creates a TypeScript enum declaration or equivalent construct in various formats.\n * Returns a tuple of [name node, type node] - name node may be undefined for certain types.\n *\n * @example\n * ```ts\n * const [name, type] = createEnumDeclaration({\n *   type: 'enum',\n *   name: 'petType',\n *   typeName: 'PetType',\n *   enums: [['cat', 'cat', 'A cat'], ['dog', 'dog']],\n * })\n * ```\n */\nexport function createEnumDeclaration({\n  type = 'enum',\n  name,\n  typeName,\n  enums,\n  enumKeyCasing = 'none',\n}: {\n  /**\n   * Choose to use `enum`, `asConst`, `constEnum`, or `literal` for enums.\n   * - `enum`: TypeScript enum\n   * - `asConst`: const object asserted with `as const` (the caller decides the const name casing)\n   * - `constEnum`: const enum\n   * - `literal`: literal union type\n   * @default `'enum'`\n   */\n  type?: 'enum' | 'asConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n  /**\n   * Enum name in camelCase.\n   */\n  name: string\n  /**\n   * Enum name in PascalCase.\n   */\n  typeName: string\n  enums: Array<[key: string | number, value: string | number | boolean, description?: string]>\n  /**\n   * Choose the casing for enum key names.\n   * @default 'none'\n   */\n  enumKeyCasing?: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none'\n}): [name: ts.Node | undefined, type: ts.Node] {\n  if (type === 'literal' || type === 'inlineLiteral') {\n    return [\n      undefined,\n      factory.createTypeAliasDeclaration(\n        [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n        factory.createIdentifier(typeName),\n        undefined,\n        factory.createUnionTypeNode(\n          enums\n            .map(([_key, value]) => {\n              if (isNumber(value)) {\n                if (value < 0) {\n                  return factory.createLiteralTypeNode(\n                    factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value))),\n                  )\n                }\n                return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n              }\n\n              if (typeof value === 'boolean') {\n                return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n              }\n              if (value !== null && value !== undefined) {\n                return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n              }\n\n              return undefined\n            })\n            .filter((node): node is ts.LiteralTypeNode => node !== undefined),\n        ),\n      ),\n    ]\n  }\n\n  if (type === 'enum' || type === 'constEnum') {\n    return [\n      undefined,\n      factory.createEnumDeclaration(\n        [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(\n          (modifier): modifier is ts.ModifierToken<ts.SyntaxKind.ExportKeyword> | ts.ModifierToken<ts.SyntaxKind.ConstKeyword> => modifier !== undefined,\n        ),\n        factory.createIdentifier(typeName),\n        enums\n          .map(([key, value, description]) => {\n            let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n            const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n            if (isExactNumber && isNumber(value)) {\n              if (value < 0) {\n                initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n              } else {\n                initializer = factory.createNumericLiteral(value)\n              }\n            }\n\n            if (typeof value === 'boolean') {\n              initializer = value ? factory.createTrue() : factory.createFalse()\n            }\n\n            if (isNumber(Number.parseInt(key.toString(), 10))) {\n              const casingKey = applyEnumKeyCasing(`${typeName}_${key}`, enumKeyCasing)\n              return appendJSDocToNode({ node: factory.createEnumMember(propertyName(casingKey), initializer), comments: [description] })\n            }\n\n            if (key !== null && key !== undefined) {\n              const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n              return appendJSDocToNode({ node: factory.createEnumMember(propertyName(casingKey), initializer), comments: [description] })\n            }\n\n            return undefined\n          })\n          .filter((member): member is ts.EnumMember => member !== undefined),\n      ),\n    ]\n  }\n\n  // used when using `as const` instead of an TypeScript enum.\n  // name is already cased by the caller (camelCase or pascalCase, driven by enum.constCasing).\n  // typeName carries the typeSuffix for the type alias, so we use name for the const identifier.\n  const identifierName = name\n\n  // When there are no enum items (empty or all-null enum), don't generate a runtime const.\n  // Return undefined for nameNode so the barrel won't try to export a non-existent symbol.\n  // Use `never` as the type alias to keep references valid without creating a broken const.\n  if (enums.length === 0) {\n    return [\n      undefined,\n      factory.createTypeAliasDeclaration(\n        [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n        factory.createIdentifier(typeName),\n        undefined,\n        factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword),\n      ),\n    ]\n  }\n\n  return [\n    factory.createVariableStatement(\n      [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n      factory.createVariableDeclarationList(\n        [\n          factory.createVariableDeclaration(\n            factory.createIdentifier(identifierName),\n            undefined,\n            undefined,\n            factory.createAsExpression(\n              factory.createObjectLiteralExpression(\n                enums\n                  .map(([key, value, description]) => {\n                    let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n                    if (isNumber(value)) {\n                      // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n                      // The method createNumericLiteral only accepts positive numbers\n                      // or those combined with createPrefixUnaryExpression.\n                      // Therefore, we need to ensure that the number is not negative.\n                      if (value < 0) {\n                        initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n                      } else {\n                        initializer = factory.createNumericLiteral(value)\n                      }\n                    }\n\n                    if (typeof value === 'boolean') {\n                      initializer = value ? factory.createTrue() : factory.createFalse()\n                    }\n\n                    if (key !== null && key !== undefined) {\n                      const casingKey = applyEnumKeyCasing(key.toString(), enumKeyCasing)\n                      return appendJSDocToNode({ node: factory.createPropertyAssignment(propertyName(casingKey), initializer), comments: [description] })\n                    }\n\n                    return undefined\n                  })\n                  .filter((property): property is ts.PropertyAssignment => property !== undefined),\n                true,\n              ),\n              factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n            ),\n          ),\n        ],\n        ts.NodeFlags.Const,\n      ),\n    ),\n    factory.createTypeAliasDeclaration(\n      [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n      factory.createIdentifier(typeName),\n      undefined,\n      factory.createIndexedAccessTypeNode(\n        factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n        factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n      ),\n    ),\n  ]\n}\n\n/**\n * Creates a TypeScript `Omit<T, Keys>` type reference node.\n * Optionally wraps the type in `NonNullable<T>` if `nonNullable` is true.\n */\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n  const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n  if (Array.isArray(keys)) {\n    return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n      node,\n      factory.createUnionTypeNode(\n        keys.map((key) => {\n          return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n        }),\n      ),\n    ])\n  }\n\n  return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\n/**\n * Pre-built TypeScript keyword type nodes for common primitive types.\n * Use these to avoid repeatedly creating the same type nodes.\n */\nexport const keywordTypeNodes = {\n  any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n  unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n  void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n  number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n  integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n  bigint: factory.createKeywordTypeNode(ts.SyntaxKind.BigIntKeyword),\n  object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n  string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n  boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n  undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n  null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n  never: factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword),\n} as const\n\n/**\n * Converts a path like '/pet/{petId}/uploadImage' to a template literal type\n * like `/pet/${string}/uploadImage`\n */\n/**\n * Converts an OAS-style path (e.g. `/pets/{petId}`) or an Express-style path\n * (e.g. `/pets/:petId`) to a TypeScript template literal type\n * like `` `/pets/${string}` ``.\n */\nexport function createUrlTemplateType(path: string): ts.TypeNode {\n  // normalized Express `:param` → OAS `{param}` so a single regex handles both.\n  const normalized = path.replace(/:([^/]+)/g, '{$1}')\n\n  if (!normalized.includes('{')) {\n    return factory.createLiteralTypeNode(factory.createStringLiteral(normalized))\n  }\n\n  const segments = normalized.split(/(\\{[^}]+\\})/)\n  const parts: Array<string> = []\n  const parameterIndices: Array<number> = []\n\n  segments.forEach((segment) => {\n    if (segment.startsWith('{') && segment.endsWith('}')) {\n      parameterIndices.push(parts.length)\n      parts.push(segment)\n    } else if (segment) {\n      parts.push(segment)\n    }\n  })\n\n  const head = ts.factory.createTemplateHead(parts[0] || '')\n  const templateSpans: Array<ts.TemplateLiteralTypeSpan> = []\n\n  parameterIndices.forEach((paramIndex, i) => {\n    const isLast = i === parameterIndices.length - 1\n    const nextPart = parts[paramIndex + 1] || ''\n    const literal = isLast ? ts.factory.createTemplateTail(nextPart) : ts.factory.createTemplateMiddle(nextPart)\n    templateSpans.push(ts.factory.createTemplateLiteralTypeSpan(keywordTypeNodes.string, literal))\n  })\n\n  return ts.factory.createTemplateLiteralType(head, templateSpans)\n}\n\n/**\n * Creates a TypeScript type literal node (anonymous object type).\n */\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\n/**\n * Creates a TypeScript type reference node (e.g., `Array<string>`, `Record<K, V>`).\n */\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\n\n/**\n * Creates a numeric literal type node.\n */\nconst createNumericLiteral = factory.createNumericLiteral\n\n/**\n * Creates a string literal type node.\n */\nconst createStringLiteral = factory.createStringLiteral\n\n/**\n * Creates an array type node (e.g., `T[]`).\n */\nconst createArrayTypeNode = factory.createArrayTypeNode\n\n/**\n * Creates a literal type node (e.g., `'hello'`, `42`, `true`).\n */\nconst createLiteralTypeNode = factory.createLiteralTypeNode\n\n/**\n * Creates an identifier node.\n */\nconst createIdentifier = factory.createIdentifier\n\n/**\n * Creates an optional type node (e.g., `T | undefined`).\n */\nconst createOptionalTypeNode = factory.createOptionalTypeNode\n\n/**\n * Creates a tuple type node (e.g., `[string, number]`).\n */\nconst createTupleTypeNode = factory.createTupleTypeNode\n\n/**\n * Creates a rest type node for variadic tuple elements (e.g., `...T[]`).\n */\nconst createRestTypeNode = factory.createRestTypeNode\n\n/**\n * Creates a boolean true literal type node.\n */\nconst createTrue = factory.createTrue\n\n/**\n * Creates a boolean false literal type node.\n */\nconst createFalse = factory.createFalse\n\n/**\n * Creates a prefix unary expression (e.g., negative numbers, logical not).\n */\nconst createPrefixUnaryExpression = factory.createPrefixUnaryExpression\n\n// ─── Printer helpers ──────────────────────────────────────────────────────────\n\n/**\n * Converts a primitive const value to a TypeScript literal type node.\n * Handles negative numbers via a prefix unary expression.\n */\nexport function constToTypeNode(value: string | number | boolean, format: 'string' | 'number' | 'boolean'): ts.TypeNode | undefined {\n  if (format === 'boolean') {\n    return createLiteralTypeNode(value === true ? createTrue() : createFalse())\n  }\n  if (format === 'number' && typeof value === 'number') {\n    if (value < 0) {\n      return createLiteralTypeNode(createPrefixUnaryExpression(SyntaxKind.MinusToken, createNumericLiteral(Math.abs(value))))\n    }\n    return createLiteralTypeNode(createNumericLiteral(value))\n  }\n  return createLiteralTypeNode(createStringLiteral(String(value)))\n}\n\n/**\n * Returns a `Date` reference type node when `representation` is `'date'`, otherwise falls back to `string`.\n */\nexport function dateOrStringNode(node: { representation?: string }): ts.TypeNode {\n  return node.representation === 'date' ? createTypeReferenceNode(createIdentifier('Date')) : keywordTypeNodes.string\n}\n\n/**\n * Maps an array of `SchemaNode`s through the printer, filtering out `null` and `undefined` results.\n */\nexport function buildMemberNodes(\n  members: Array<ast.SchemaNode> | undefined,\n  print: (node: ast.SchemaNode) => ts.TypeNode | null | undefined,\n): Array<ts.TypeNode> {\n  return (members ?? []).map(print).filter(isNonNullable)\n}\n\n/**\n * Builds a TypeScript tuple type node from an array schema's `items`,\n * applying min/max slice and optional/rest element rules.\n */\nexport function buildTupleNode(node: ast.ArraySchemaNode, print: (node: ast.SchemaNode) => ts.TypeNode | null | undefined): ts.TypeNode | undefined {\n  let items = (node.items ?? []).map(print).filter(isNonNullable)\n\n  const restNode = node.rest ? (print(node.rest) ?? undefined) : undefined\n  const { min, max } = node\n\n  if (max !== undefined) {\n    items = items.slice(0, max)\n    if (items.length < max && restNode) {\n      items = [...items, ...Array(max - items.length).fill(restNode)]\n    }\n  }\n\n  if (min !== undefined) {\n    items = items.map((item, i) => (i >= min ? createOptionalTypeNode(item) : item))\n  }\n\n  if (max === undefined && restNode) {\n    items.push(createRestTypeNode(createArrayTypeNode(restNode)))\n  }\n\n  return createTupleTypeNode(items)\n}\n\n/**\n * Applies `nullable` and optional/nullish `| undefined` union modifiers to a property's resolved base type.\n */\nexport function buildPropertyType(\n  schema: ast.SchemaNode,\n  baseType: ts.TypeNode,\n  optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined',\n  optional?: boolean,\n): ts.TypeNode {\n  const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(optionalType)\n  const meta = syncSchemaRef(schema)\n\n  let type = baseType\n\n  if (meta.nullable) {\n    type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] })\n  }\n\n  if ((optional || meta.nullish || meta.optional) && addsUndefined) {\n    type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] })\n  }\n\n  return type\n}\n\nconst indexSignaturePrinter = ts.createPrinter()\nconst indexSignatureSource = ts.createSourceFile('', '', ts.ScriptTarget.Latest)\n\n/**\n * Creates a TypeScript index signature for `additionalProperties` and `patternProperties` on an\n * object schema node. TypeScript allows only one string index signature and its value must be\n * assignable from every named property, so both keywords collapse into a single signature: the\n * union of all value types (deduplicated), or `unknown` when the object also has fixed properties.\n * The key regex of `patternProperties` cannot be expressed by an index signature and is dropped.\n */\nexport function buildIndexSignatures(\n  node: { additionalProperties?: ast.SchemaNode | boolean; patternProperties?: Record<string, ast.SchemaNode> },\n  propertyCount: number,\n  print: (node: ast.SchemaNode) => ts.TypeNode | null | undefined,\n): Array<ts.TypeElement> {\n  const valueTypes: Array<ts.TypeNode> = []\n\n  if (node.additionalProperties && node.additionalProperties !== true) {\n    valueTypes.push(print(node.additionalProperties) ?? keywordTypeNodes.unknown)\n  } else if (node.additionalProperties === true) {\n    valueTypes.push(keywordTypeNodes.unknown)\n  }\n\n  for (const schema of Object.values(node.patternProperties ?? {})) {\n    const patternType = print(schema) ?? keywordTypeNodes.unknown\n    valueTypes.push(schema.nullable ? createUnionDeclaration({ nodes: [patternType, keywordTypeNodes.null] }) : patternType)\n  }\n\n  if (valueTypes.length === 0) return []\n\n  const seen = new Set<string>()\n  const distinct = valueTypes.filter((type) => {\n    const key = indexSignaturePrinter.printNode(ts.EmitHint.Unspecified, type, indexSignatureSource)\n    return seen.has(key) ? false : (seen.add(key), true)\n  })\n\n  return [createIndexSignature(propertyCount > 0 ? keywordTypeNodes.unknown : createUnionDeclaration({ nodes: distinct }))]\n}\n","import { camelCase, trimQuotes } from '@internals/utils'\nimport type { ast } from 'kubb/kit'\nimport { parserTs } from '@kubb/parser-ts'\nimport { File } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX, ENUM_TYPES_WITH_RUNTIME_VALUE, ENUM_TYPES_WITH_TYPE_ONLY } from '../constants.ts'\nimport * as factory from '../factory.ts'\nimport type { PluginTs, ResolverTs } from '../types.ts'\n\ntype EnumOptions = PluginTs['resolvedOptions']['enum']\n\n/**\n * Widens a `namedEnumValues` entry with the optional per-member `description` that the\n * `x-enumDescriptions` / `x-enum-descriptions` vendor extensions provide. The intersection\n * keeps the field readable against published `@kubb/ast` versions that predate it.\n */\ntype NamedEnumValue = NonNullable<ast.EnumSchemaNode['namedEnumValues']>[number] & { description?: string }\n\ntype Props = {\n  node: ast.EnumSchemaNode\n  enum: EnumOptions\n  resolver: ResolverTs\n  key?: string | number | null\n}\n\n/**\n * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.\n *\n * The raw `node.name` may be a YAML key such as `\"enumNames.Type\"` which is not a\n * valid TypeScript identifier. The resolver normalizes it. For inline enum properties the adapter\n * already emits a PascalCase+suffix name, so resolution is typically a no-op.\n *\n * When `constCasing` is `'pascalCase'` and `typeSuffix` is empty, the const and the type\n * resolve to the same name, which TypeScript merges into a single value+type declaration.\n */\nexport function getEnumNames({ node, enum: enumOptions, resolver }: { node: ast.EnumSchemaNode; enum: EnumOptions; resolver: ResolverTs }): {\n  enumName: string\n  typeName: string\n} {\n  const resolved = resolver.name(node.name!)\n  const enumName = enumOptions.constCasing === 'pascalCase' ? resolved : camelCase(node.name!)\n  const typeName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumOptions.type) ? resolver.enum.keyName(node, enumOptions.typeSuffix) : resolved\n\n  return { enumName, typeName }\n}\n\n/**\n * Renders the enum declaration(s) for a single named `EnumSchemaNode`.\n *\n * Depending on `enum.type` this may emit:\n * - A runtime object (`asConst`) plus a `typeof` type alias\n * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)\n * - A union literal type alias (`literal`)\n *\n * The emitted `File.Source` nodes carry the resolved names so that the barrel\n * index picks up the correct export identifiers.\n */\nexport function Enum({ node, enum: enumOptions, resolver }: Props): KubbReactNode {\n  const { enumName, typeName } = getEnumNames({ node, enum: enumOptions, resolver })\n\n  const [nameNode, typeNode] = factory.createEnumDeclaration({\n    name: enumName,\n    typeName,\n    enums: ((node.namedEnumValues as Array<NamedEnumValue> | undefined)?.map((v) => [trimQuotes(v.name.toString()), v.value, v.description]) ??\n      node.enumValues?.filter((v): v is NonNullable<typeof v> => v !== null && v !== undefined).map((v) => [trimQuotes(v.toString()), v]) ??\n      []) as Array<[string | number, string | number | boolean, string?]>,\n    type: enumOptions.type,\n    enumKeyCasing: enumOptions.keyCasing,\n  })\n\n  // When the const and the type share a name (pascalCase const + empty typeSuffix) they merge into\n  // one declaration. The const carries the barrel export, so keep the type alias in the file but out\n  // of the barrel to avoid re-exporting the name a second time as `export type { … }`.\n  const namesMerge = !!nameNode && enumName === typeName\n\n  return (\n    <>\n      {nameNode && (\n        <File.Source name={enumName} isExportable isIndexable isTypeOnly={false}>\n          {parserTs().print(nameNode)}\n        </File.Source>\n      )}\n      <File.Source\n        name={typeName}\n        isIndexable={!namesMerge}\n        isExportable={!namesMerge && ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumOptions.type)}\n        isTypeOnly={ENUM_TYPES_WITH_TYPE_ONLY.has(enumOptions.type)}\n      >\n        {parserTs().print(typeNode)}\n      </File.Source>\n    </>\n  )\n}\n","import { jsStringEscape, stringify } from '@internals/utils'\nimport { ast, syncSchemaRef } from 'kubb/kit'\nimport type { ResolverTs } from './types.ts'\n\n/**\n * Tells whether a `const` (single-value enum) should render as a bare literal type (`'active'`)\n * rather than a named enum reference or a runtime enum declaration.\n *\n * The parser folds `const` into a single-value enum node. The adapter decides which schemas are\n * named enums and lists them in `enumSchemaNames`, and references to those names get suffixed (for\n * example `StatusKey`). A const renders as a literal only when the adapter has not registered it as\n * a named enum, which keeps the declaration and its references in sync across adapter versions.\n */\nexport function isInlineConstEnum(node: ast.EnumSchemaNode, enumSchemaNames?: ReadonlySet<string>): boolean {\n  const isConst = (node.namedEnumValues ?? node.enumValues ?? []).length === 1\n  return isConst && !(node.name && enumSchemaNames?.has(node.name))\n}\n\n/**\n * Collects JSDoc annotation strings for a schema node.\n *\n * Only uses official JSDoc tags from https://jsdoc.app/: `@description`, `@deprecated`, `@default`, `@example`, `@type`.\n * Constraint metadata (min/max length, pattern, multipleOf, min/maxProperties) is emitted as plain-text lines.\n\n */\nfunction isSchemaOptional(schema: ast.SchemaNode): boolean {\n  return Boolean(('optional' in schema && schema.optional) || ('nullish' in schema && schema.nullish))\n}\n\nfunction formatExample(value: unknown): string {\n  if (value === null || typeof value !== 'object') {\n    return String(value)\n  }\n\n  const rendered = JSON.stringify(value) ?? String(value)\n  return rendered.replaceAll('*/', '*\\\\/')\n}\n\nexport function buildPropertyJSDocComments(schema: ast.SchemaNode, optional?: boolean): Array<string | undefined> {\n  const meta = syncSchemaRef(schema)\n\n  const isArray = meta?.primitive === 'array'\n\n  const hasDescription = meta && 'description' in meta && meta.description\n\n  const formatComment =\n    meta && 'format' in meta && meta.format\n      ? hasDescription\n        ? // Empty line between description and format\n          [' ', `Format: \\`${meta.format}\\``]\n        : ['@description', `Format: \\`${meta.format}\\``]\n      : []\n\n  // OAS 3.1 carries schema examples as an `examples` array, one `@example` line each.\n  const exampleValues = meta?.examples ?? []\n\n  const comments = [\n    hasDescription ? `@description ${jsStringEscape(meta.description)}` : null,\n    ...formatComment,\n    meta && 'deprecated' in meta && meta.deprecated ? '@deprecated' : null,\n    // minItems/maxItems on arrays should not be emitted as @minLength/@maxLength\n    !isArray && meta && 'min' in meta && meta.min !== undefined ? `@minLength ${meta.min}` : null,\n    !isArray && meta && 'max' in meta && meta.max !== undefined ? `@maxLength ${meta.max}` : null,\n    meta && 'pattern' in meta && meta.pattern ? `@pattern ${meta.pattern}` : null,\n    meta && 'default' in meta && meta.default !== undefined\n      ? `@default ${'primitive' in meta && meta.primitive === 'string' && typeof meta.default === 'string' ? stringify(meta.default) : meta.default}`\n      : null,\n    ...exampleValues.map((example) => `@example ${formatExample(example)}`),\n  ].filter(Boolean)\n\n  // `@type` merely repeats the TypeScript type already sitting next to the property, so it only\n  // earns its place inside a comment block that exists for another reason. Bare, it would just\n  // add bytes with no information a reader can't already see in the signature.\n  const typeTag =\n    comments.length && meta && 'primitive' in meta && meta.primitive\n      ? [`@type ${meta.primitive}`, (optional ?? isSchemaOptional(schema)) ? ' | undefined' : null].filter(Boolean).join('')\n      : null\n\n  return [...comments, typeTag].filter(Boolean)\n}\n\ntype BuildParamsSchemaOptions = {\n  params: Array<ast.ParameterNode>\n}\n\ntype BuildOperationSchemaOptions = {\n  resolver: ResolverTs\n}\n\n/**\n * Builds the object schema for a group of parameters sharing one `in` location (path, query, or\n * header), embedding each param's own schema (and JSDoc) directly rather than referencing a\n * separate per-param type — the group itself is the only type these params get exported as.\n */\nexport function buildParams({ params }: BuildParamsSchemaOptions): ast.SchemaNode {\n  return ast.factory.createSchema({\n    type: 'object',\n    properties: params.map((param) =>\n      ast.factory.createProperty({\n        name: param.name,\n        required: param.required,\n        schema: ast.factory.createSchema({ ...param.schema, optional: !param.required }),\n      }),\n    ),\n  })\n}\n\nexport function buildResponseUnion(node: ast.OperationNode, { resolver }: BuildOperationSchemaOptions): ast.SchemaNode | null {\n  const responsesWithSchema = node.responses.filter((res) => res.content?.some((entry) => entry.schema))\n\n  if (responsesWithSchema.length === 0) {\n    return null\n  }\n\n  return ast.factory.createSchema({\n    type: 'union',\n    members: responsesWithSchema.map((res) => ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, res.statusCode) })),\n  })\n}\n","import { ast } from 'kubb/kit'\nimport { File } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\nimport type { PrinterTsFactory } from '../printers/printerTs.ts'\nimport type { PluginTs, ResolverTs } from '../types.ts'\nimport { isInlineConstEnum } from '../utils.ts'\nimport { Enum, getEnumNames } from './Enum.tsx'\n\ntype Props = {\n  name: string\n  node: ast.SchemaNode\n  /**\n   * Pre-configured printer instance created by the generator.\n   * Created with `printerTs({ ..., nodes: options.printer?.nodes })`.\n   */\n  printer: ast.Printer<PrinterTsFactory>\n  enum: PluginTs['resolvedOptions']['enum']\n  resolver: ResolverTs\n}\n\nexport function Type({ name, node, printer, enum: enumOptions, resolver }: Props): KubbReactNode {\n  const enumSchemaNodes = ast.collectSync<ast.EnumSchemaNode>(node, {\n    schema(n): ast.EnumSchemaNode | undefined {\n      const enumNode = ast.narrowSchema(n, ast.schemaTypes.enum)\n      // Skip an inline `const` (single-value enum the adapter did not register): it renders as a\n      // literal, so it gets no runtime enum declaration.\n      if (enumNode?.name && !isInlineConstEnum(enumNode, printer.options.enumSchemaNames)) return enumNode\n    },\n  })\n\n  const output = printer.print(node)\n\n  if (!output) {\n    return\n  }\n\n  const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node) => {\n    return {\n      node,\n      ...getEnumNames({ node, enum: enumOptions, resolver }),\n    }\n  })\n\n  // Skip enum exports when using inlineLiteral\n  const shouldExportEnums = enumOptions.type !== 'inlineLiteral'\n  const shouldExportType = enumOptions.type === 'inlineLiteral' || enums.every((item) => item.typeName !== name)\n\n  return (\n    <>\n      {shouldExportEnums && enums.map(({ node }) => <Enum key={node.name} node={node} enum={enumOptions} resolver={resolver} />)}\n      {shouldExportType && (\n        <File.Source name={name} isTypeOnly isExportable isIndexable>\n          {output}\n        </File.Source>\n      )}\n    </>\n  )\n}\n","import type { ast } from 'kubb/kit'\n\n/**\n * Drops parameters that share the same name, keeping the first.\n *\n * A malformed spec can declare the same parameter name twice within one `in` location. Both would\n * resolve to the same output property, so emitting both would yield an object type with a duplicate\n * member, which TypeScript rejects. This is a defensive guard against that case, not a casing guard:\n * parameter names flow through unchanged, so no two distinct names ever collide here anymore.\n */\nexport function dedupeParams(params: Array<ast.ParameterNode>): Array<ast.ParameterNode> {\n  const seen = new Set<string>()\n\n  return params.filter((param) => {\n    if (seen.has(param.name)) return false\n    seen.add(param.name)\n    return true\n  })\n}\n","import { ast, type Group, type NodeCache, type Output, type Resolver, type ResolverFileParams, Url } from 'kubb/kit'\nimport { dedupeParams } from './params.ts'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n  return {\n    name,\n    extname,\n    tag: node.tags[0] ?? 'default',\n    path: node.path,\n  }\n}\n\n/**\n * Resolves a dependency plugin's generated file for `node.operationId`, cached in `cache` (the\n * current node's `ctx.cache`) under the resolver's own plugin name. Several dependents reading the\n * same dependency for the same operation in one pass (a query plugin's several hook generators, the\n * MCP handler, ...) share one computed name and path instead of each calling `resolver.file` again.\n *\n * @example Cache `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveDependencyOperationFile({ cache: ctx.cache, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveDependencyOperationFile(options: {\n  cache: NodeCache\n  node: ast.OperationNode\n  resolver: Pick<Resolver, 'file' | 'pluginName'>\n  root: string\n  output: Output\n  group?: Group | null\n}): ast.FileNode {\n  const { cache, node, resolver, root, output, group } = options\n\n  return cache.ensureItem(`${resolver.pluginName}:operationFile`, () =>\n    resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n  )\n}\n\nexport type ContentTypeInfo = {\n  contentTypes: string[]\n  isMultipleContentTypes: boolean\n  contentTypeUnion: string\n  defaultContentType: string\n  hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n  response: {\n    body(node: ast.OperationNode): string\n  }\n}\n\nexport type ResponseStatusNameResolver = {\n  response: {\n    status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n  }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n  response: {\n    response(node: ast.OperationNode): string\n  }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n  ResponseNameResolver & {\n    param: {\n      path(node: ast.OperationNode, param: ast.ParameterNode): string\n      query(node: ast.OperationNode, param: ast.ParameterNode): string\n      headers(node: ast.OperationNode, param: ast.ParameterNode): string\n    }\n  }\n\n/**\n * Resolver interface for building operation parameters.\n *\n * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.\n */\nexport type OperationParamsResolver = {\n  /**\n   * Naming for an operation's parameters, grouped by location.\n   */\n  param: {\n    /**\n     * Resolves the type name for an individual parameter.\n     *\n     * @example Individual path parameter name\n     * `resolver.param.name(node, param) // → 'DeletePetPathPetId'`\n     */\n    name(node: ast.OperationNode, param: ast.ParameterNode): string\n    /**\n     * Resolves the grouped path parameters type name.\n     * When the return value equals `resolver.param.name`, no indexed access is emitted.\n     *\n     * @example Grouped path params type name\n     * `resolver.param.path(node, param) // → 'DeletePetPath'`\n     */\n    path(node: ast.OperationNode, param: ast.ParameterNode): string\n    /**\n     * Resolves the grouped query parameters type name.\n     * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n     *\n     * @example Grouped query params type name\n     * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'`\n     */\n    query(node: ast.OperationNode, param: ast.ParameterNode): string\n    /**\n     * Resolves the grouped header parameters type name.\n     * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n     *\n     * @example Grouped header params type name\n     * `resolver.param.headers(node, param) // → 'DeletePetHeaders'`\n     */\n    headers(node: ast.OperationNode, param: ast.ParameterNode): string\n  }\n  /**\n   * Naming for an operation's request and response types.\n   */\n  response: {\n    /**\n     * Resolves the request body type name.\n     *\n     * @example Request body type name\n     * `resolver.response.body(node) // → 'CreatePetBody'`\n     */\n    body(node: ast.OperationNode): string\n  }\n}\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n  link?: OperationCommentLink\n  linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n  splitLines?: boolean\n}\n\ntype ResponseLike = {\n  statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n  responseStatusNames?: boolean | 'error'\n  exclude?: ReadonlyArray<string | undefined>\n  order?: 'params-first' | 'body-response-first'\n  /**\n   * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n   * that reference the grouped `Options` type instead of the per-group types.\n   */\n  includeParams?: boolean\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n  if (!link) {\n    return null\n  }\n\n  if (typeof link === 'function') {\n    return link(node) ?? null\n  }\n\n  return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n  const isMultipleContentTypes = contentTypes.length > 1\n\n  return {\n    contentTypes,\n    isMultipleContentTypes,\n    contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n    defaultContentType: contentTypes[0] ?? 'application/json',\n    hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n  }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n  return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n  return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Reads the single base content type of an operation's primary success response, lowercased and\n * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or\n * more than one content type, since neither case has a single type to act on.\n */\nfunction getPrimarySuccessContentType(node: ast.OperationNode): string | undefined {\n  const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n  if (contentTypes.length !== 1) return undefined\n  return contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n}\n\n/**\n * Whether an operation streams its primary success response as Server-Sent Events\n * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a\n * one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n  return getPrimarySuccessContentType(node) === 'text/event-stream'\n}\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type. `text/event-stream`\n * and other binary types (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`,\n * `video/*`) map to a stream or `'blob'`, and other `text/*` maps to `'text'`. Otherwise `undefined`,\n * leaving the runtime client's `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n  const baseType = getPrimarySuccessContentType(node)\n  if (!baseType) return undefined\n\n  if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n  if (baseType === 'text/event-stream') return 'stream'\n  if (baseType.startsWith('text/')) return 'text'\n  if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n  return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n  const baseType = contentType.split(';')[0]!.trim()\n  if (baseType === 'application/json') return 'Json'\n  if (baseType === 'multipart/form-data') return 'FormData'\n  if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n  const subtype = baseType.split('/').pop() ?? baseType\n  const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n  if (parts.length === 0) return 'Unknown'\n  return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n  if (baseName.endsWith('Data')) {\n    return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n  }\n  return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n  const usedNames = new Set<string>()\n  return entries\n    .filter((entry) => entry.schema)\n    .map((entry) => {\n      const baseSuffix = getContentTypeSuffix(entry.contentType)\n      let suffix = baseSuffix\n      let name = getPerContentTypeName(baseName, suffix)\n      let counter = 2\n      while (usedNames.has(name)) {\n        suffix = `${baseSuffix}${counter++}`\n        name = getPerContentTypeName(baseName, suffix)\n      }\n      usedNames.add(name)\n      return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n    })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n  const request = getContentTypeInfo(node)\n  const response = getResponseContentTypeInfo(node)\n  // The request groups come from the grouped params, so `config` drops the data-shape keys to stay\n  // assignable to `Options`, which omits them from `RequestConfig`.\n  const configType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n\n  // Only the ambiguous side is offered: a single-type side has nothing to pick, so it stays baked in\n  // the generated call.\n  const members = [\n    request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n    response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n  ].filter(Boolean)\n\n  return members.length ? `${configType} & { contentType?: { ${members.join('; ')} } }` : configType\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...). Unlike {@link buildRequestConfigType}, it never adds a\n * `contentType?:` member: query hooks wrap GET operations, which carry no request body to select a\n * content type for.\n */\nexport function buildClientOptionType(): string {\n  return `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n}\n\nexport type RequestGroups = {\n  path: boolean\n  query: boolean\n  body: boolean\n  headers: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n  const { path, query, header } = getOperationParameters(node)\n  return {\n    path: path.length > 0,\n    query: query.length > 0,\n    body: Boolean(node.requestBody?.content?.[0]?.schema),\n    headers: header.length > 0,\n  }\n}\n\nexport type RequestGroupOptionality = {\n  groups: RequestGroups\n  hasRequiredPath: boolean\n  hasRequiredQuery: boolean\n  hasRequiredHeader: boolean\n  /**\n   * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n   * required member, so every member is safe to omit.\n   */\n  isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n  const groups = getRequestGroups(node)\n  const { path, query, header } = getOperationParameters(node)\n  const hasRequiredPath = path.some((param) => param.required)\n  const hasRequiredQuery = query.some((param) => param.required)\n  const hasRequiredHeader = header.some((param) => param.required)\n\n  return {\n    groups,\n    hasRequiredPath,\n    hasRequiredQuery,\n    hasRequiredHeader,\n    isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body,\n  }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n  response: {\n    options(node: ast.OperationNode): string\n  }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n  node: ast.OperationNode,\n  resolver: RequestOptionsNameResolver,\n  options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups } {\n  const { isConfigurable = true } = options\n  const { groups, isOptional } = getRequestGroupOptionality(node)\n\n  const names = (['path', 'query', 'body', 'headers'] as const).filter((key) => groups[key])\n\n  const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${resolver.response.options(node)}${isOptional ? ' = {}' : ''}` : null\n  const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n  return {\n    signature: [firstParam, configParam].filter(Boolean).join(', '),\n    groups,\n  }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n  const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n  const linkComment = getOperationLink(node, link)\n  const comments =\n    linkPosition === 'beforeDeprecated'\n      ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n      : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n  const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n  if (!splitLines) {\n    return filteredComments\n  }\n\n  return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nconst operationParameterGroupsByNode = new WeakMap<ast.OperationNode, OperationParameterGroups>()\n\n/**\n * Groups an operation's parameters by location (`path`/`query`/`header`/`cookie`), deduping each\n * group by name. Every plugin generator visiting the same `OperationNode` shares one AST instance\n * (see `KubbDriver`), so the result is cached per node to avoid re-filtering and re-deduping the\n * same parameters once per plugin.\n */\nexport function getOperationParameters(node: ast.OperationNode): OperationParameterGroups {\n  const cached = operationParameterGroupsByNode.get(node)\n  if (cached) return cached\n\n  const groups: OperationParameterGroups = {\n    path: dedupeParams(node.parameters.filter((param) => param.in === 'path')),\n    query: dedupeParams(node.parameters.filter((param) => param.in === 'query')),\n    header: dedupeParams(node.parameters.filter((param) => param.in === 'header')),\n    cookie: dedupeParams(node.parameters.filter((param) => param.in === 'cookie')),\n  }\n\n  operationParameterGroupsByNode.set(node, groups)\n  return groups\n}\n\n/**\n * Builds the combined `{ body, path, query, headers }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same\n * shape from the same inputs. `primitive: 'object'` is a no-op for the TS printer and tells the Zod\n * printer to emit `z.object(…)` rather than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver): ast.SchemaNode {\n  const { path, query, header } = getOperationParameters(node)\n  const hasBody = Boolean(node.requestBody?.content?.[0]?.schema)\n  const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n  const groups = [\n    { name: 'path', params: path, resolve: resolver.param.path },\n    { name: 'query', params: query, resolve: resolver.param.query },\n    { name: 'headers', params: header, resolve: resolver.param.headers },\n  ] as const\n\n  // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n  // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n  // type matches the runtime client. Drop this note once v5 leaves beta.\n  return ast.factory.createSchema({\n    type: 'object',\n    primitive: 'object',\n    deprecated: node.deprecated,\n    properties: [\n      ast.factory.createProperty({\n        name: 'body',\n        required: hasBody,\n        schema: hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever(),\n      }),\n      ...groups.map(({ name, params, resolve }) => {\n        const required = params.some((param) => param.required)\n\n        return ast.factory.createProperty({\n          name,\n          required,\n          schema:\n            params.length > 0\n              ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n              : createNever(),\n        })\n      }),\n    ],\n  })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use.\n */\nfunction buildResponseRecordEntry(node: ast.OperationNode, res: ast.ResponseNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n  const statusName = resolver.response.status(node, res.statusCode)\n  const variants = (res.content ?? []).filter((entry) => entry.schema)\n  if (variants.length <= 1) {\n    return ast.factory.createSchema({ type: 'ref', name: statusName })\n  }\n\n  return ast.factory.createSchema({\n    type: 'union',\n    members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n      ast.factory.createSchema({\n        type: 'object',\n        primitive: 'object',\n        properties: [\n          ast.factory.createProperty({\n            name: 'contentType',\n            required: true,\n            schema: ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] }),\n          }),\n          ast.factory.createProperty({\n            name: 'data',\n            required: true,\n            schema: ast.factory.createSchema({ type: 'ref', name: variant.name }),\n          }),\n        ],\n      }),\n    ),\n  })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n */\nexport function buildResponses(node: ast.OperationNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n  return ast.factory.createSchema({\n    type: 'object',\n    primitive: 'object',\n    properties: node.responses.map((res) =>\n      ast.factory.createProperty({\n        name: String(res.statusCode),\n        required: true,\n        schema: buildResponseRecordEntry(node, res, resolver),\n      }),\n    ),\n  })\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n  const code = Number(statusCode)\n\n  return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n  const code = getStatusCodeNumber(statusCode)\n\n  return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n  const code = getStatusCodeNumber(statusCode)\n\n  return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n  return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n  return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n  return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n  return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n  return node.responses.filter((response) => isSuccessStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n  return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n  node: ast.OperationNode,\n  resolver: OperationTypeNameResolver,\n  options: ResolveOperationTypeNameOptions = {},\n): string[] {\n  const cacheKey = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n  let byResolver = typeNamesByResolver.get(resolver)\n  if (byResolver) {\n    const cached = byResolver.get(cacheKey)\n    if (cached) return cached\n  } else {\n    byResolver = new Map()\n    typeNamesByResolver.set(resolver, byResolver)\n  }\n\n  const { path, query, header } = getOperationParameters(node)\n  const responseStatusNames =\n    options.responseStatusNames === 'error'\n      ? resolveErrorNames(node, resolver)\n      : options.responseStatusNames === false\n        ? []\n        : resolveStatusCodeNames(node, resolver)\n  const exclude = new Set(options.exclude ?? [])\n  const paramNames =\n    options.includeParams === false\n      ? []\n      : [\n          ...path.map((param) => resolver.param.path(node, param)),\n          ...query.map((param) => resolver.param.query(node, param)),\n          ...header.map((param) => resolver.param.headers(node, param)),\n        ]\n  const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)]\n  const names =\n    options.order === 'body-response-first'\n      ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n      : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n  const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n  byResolver.set(cacheKey, result)\n  return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n  const types: Array<[number | 'default', string]> = []\n\n  for (const response of node.responses) {\n    if (response.statusCode === 'default') {\n      types.push(['default', resolver.response.response(node)])\n      continue\n    }\n\n    const code = getStatusCodeNumber(response.statusCode)\n    if (code === null) {\n      continue\n    }\n\n    types.push([code, isSuccessStatusCode(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n  }\n\n  return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n  for (const response of responses) {\n    if (isSuccessStatusCode(response.statusCode)) {\n      return response.statusCode as ast.StatusCode\n    }\n  }\n\n  return null\n}\n","import { toFilePath } from '@internals/utils'\nimport type { ast, Resolver, ResolverFile } from 'kubb/kit'\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n  name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n  path(this: Resolver, node: ast.OperationNode): string\n  query(this: Resolver, node: ast.OperationNode): string\n  headers(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n  status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n  body(this: Resolver, node: ast.OperationNode): string\n  responses(this: Resolver, node: ast.OperationNode): string\n  response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Resolves a single operation parameter name with the\n * `<operationId> <in> <name>` template.\n *\n * @example\n * `operationParamName.call(resolver, node, param) // → 'DeletePetPathPetId'`\n */\nexport function operationParamName(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string {\n  return this.name(`${node.operationId} ${param.in} ${param.name}`)\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n  return {\n    name: operationParamName,\n    path(node) {\n      return this.name(`${node.operationId} Path`)\n    },\n    query(node) {\n      return this.name(`${node.operationId} Query`)\n    },\n    headers(node) {\n      return this.name(`${node.operationId} Headers`)\n    },\n  }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n  return {\n    status(node, statusCode) {\n      return this.name(`${node.operationId} Status ${statusCode}`)\n    },\n    body(node) {\n      return this.name(`${node.operationId} Body`)\n    },\n    responses(node) {\n      return this.name(`${node.operationId} Responses`)\n    },\n    response(node) {\n      return this.name(`${node.operationId} Response`)\n    },\n  }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n  return {\n    baseName({ name, extname }) {\n      return `${toFilePath(name, caseLast)}${extname}`\n    },\n  }\n}\n","import { ast } from 'kubb/kit'\n\n/**\n * Collects the resolved target name of every pointer-carrying ref in a schema tree, in\n * first-occurrence order. Use this for name-only checks (e.g. redeclaration detection) where\n * `resolver.imports` would resolve file paths that are then discarded.\n */\nexport function collectRefNames(schema: ast.SchemaNode): Array<string> {\n  return ast.collectSync(schema, {\n    schema: (node) => {\n      const refNode = ast.narrowSchema(node, 'ref')\n      if (!refNode?.ref) return null\n\n      return ast.resolveRefName(refNode)\n    },\n  })\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from 'kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n  if (!group) {\n    return null\n  }\n\n  const defaultName = (ctx: { group: string }): string => {\n    if (group.type === 'path') {\n      return `${ctx.group.split('/')[1]}`\n    }\n\n    return camelCase(ctx.group)\n  }\n\n  return {\n    ...group,\n    name: group.name ? group.name : defaultName,\n  } satisfies Group\n}\n","import type { ast } from 'kubb/kit'\n\n/**\n * Converts a child schema to printer output. Plugins instantiate it with their own output type:\n * `string` for the zod and faker printers, `ts.TypeNode` for the TypeScript printer. A printer's\n * `this.transform` fits directly, so its `null` for an empty result carries through to `output`.\n */\nexport type SchemaTransform<TOutput> = (schema: ast.SchemaNode) => TOutput\n\n/**\n * A union or intersection member, or an array or tuple item, paired with its transformed output.\n */\nexport type MappedSchema<TOutput> = {\n  /**\n   * The original child schema, kept so the printer can read its metadata for leaf formatting.\n   */\n  schema: ast.SchemaNode\n  /**\n   * The child schema after being run through the transform.\n   */\n  output: TOutput\n}\n\n/**\n * An object property paired with its transformed output.\n */\nexport type MappedProperty<TOutput> = {\n  /**\n   * The property name as written on the schema, before any identifier quoting.\n   */\n  name: string\n  /**\n   * The original property node, kept so the printer can read `required`, `schema`, and metadata.\n   */\n  property: ast.PropertyNode\n  /**\n   * The property schema after being run through the transform.\n   */\n  output: TOutput\n}\n\n/**\n * Maps each property of an object schema to its transformed output. Pairs every result with the\n * original property so the printer keeps full control over modifiers, getters, and key syntax.\n *\n * @example\n * ```ts\n * const entries = mapSchemaProperties(node, (schema) => this.transform(schema))\n * // entries: [{ name: 'id', property, output: 'z.number()' }, ...]\n * ```\n */\nexport function mapSchemaProperties<TOutput>(node: ast.ObjectSchemaNode, transform: SchemaTransform<TOutput>): Array<MappedProperty<TOutput>> {\n  return node.properties.map((property) => ({ name: property.name, property, output: transform(property.schema) }))\n}\n\n/**\n * Maps each member of a union or intersection schema to its transformed output, pairing every\n * result with the original member.\n */\nexport function mapSchemaMembers<TOutput>(\n  node: ast.UnionSchemaNode | ast.IntersectionSchemaNode,\n  transform: SchemaTransform<TOutput>,\n): Array<MappedSchema<TOutput>> {\n  return (node.members ?? []).map((schema) => ({ schema, output: transform(schema) }))\n}\n\n/**\n * Maps each item of an array or tuple schema to its transformed output, pairing every result with\n * the original item.\n */\nexport function mapSchemaItems<TOutput>(node: ast.ArraySchemaNode, transform: SchemaTransform<TOutput>): Array<MappedSchema<TOutput>> {\n  return (node.items ?? []).map((schema) => ({ schema, output: transform(schema) }))\n}\n","import { mapSchemaItems, mapSchemaProperties } from '@internals/shared'\nimport { ast, isStringType, syncSchemaRef } from 'kubb/kit'\nimport { parserTs } from '@kubb/parser-ts'\nimport type ts from 'typescript'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX, OPTIONAL_ADDS_QUESTION_TOKEN, OPTIONAL_ADDS_UNDEFINED } from '../constants.ts'\nimport * as factory from '../factory.ts'\nimport type { PluginTs, ResolverTs } from '../types.ts'\nimport { buildPropertyJSDocComments, isInlineConstEnum } from '../utils.ts'\n\nconst { isNonNullable } = factory\n\n/**\n * Partial map of node-type overrides for the TypeScript printer.\n *\n * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function\n * replaces the built-in handler for that node type. Use `this.transform` to\n * recurse into nested schema nodes, and `this.options` to read printer options.\n *\n * @example Override the `date` handler\n * ```ts\n * pluginTs({\n *   printer: {\n *     nodes: {\n *       date(node) {\n *         return ts.factory.createTypeReferenceNode('Date', [])\n *       },\n *     },\n *   },\n * })\n * ```\n */\nexport type PrinterTsNodes = ast.PrinterPartial<ts.TypeNode, PrinterTsOptions>\n\nexport type PrinterTsOptions = {\n  /**\n   * Mark parameters as optional with `?` or `| undefined`.\n   * - `'questionToken'` adds `?` to properties\n   * - `'undefined'` adds `| undefined` to types\n   *\n   * @default `'questionToken'`\n   */\n  optionalType: PluginTs['resolvedOptions']['optionalType']\n  /**\n   * Array representation style.\n   * - `'array'` uses bracket notation (`T[]`)\n   * - `'generic'` uses generic syntax (`Array<T>`)\n   *\n   * @default `'array'`\n   */\n  arrayType: PluginTs['resolvedOptions']['arrayType']\n  /**\n   * Grouped enum settings. The printer emits references to enums, not the enum declarations, so only\n   * `type` (the output format) and `typeSuffix` (the enum key reference suffix) matter here.\n   * `constCasing` and `keyCasing` are ignored.\n   */\n  enum: PluginTs['resolvedOptions']['enum']\n  /**\n   * Syntax for generated declarations.\n   * - `'type'` generates type aliases\n   * - `'interface'` generates interface declarations\n   *\n   * @default `'type'`\n   */\n  syntaxType?: PluginTs['resolvedOptions']['syntaxType']\n  /**\n   * Exported name for the type declaration.\n   * When omitted, returns only the raw type node.\n   */\n  name?: string\n\n  /**\n   * JSDoc comment to attach to the generated type.\n   */\n  description?: string\n  /**\n   * Properties to exclude using `Omit<Type, Keys>`.\n   * Forces type alias syntax regardless of `syntaxType` setting.\n   */\n  keysToOmit?: Array<string> | null\n  /**\n   * Transforms raw schema names into valid TypeScript identifiers.\n   */\n  resolver: ResolverTs\n  /**\n   * Schema names that represent enums for suffixed key references.\n   */\n  enumSchemaNames?: Set<string>\n  /**\n   * Custom handler map for node type overrides.\n   */\n  nodes?: PrinterTsNodes\n}\n\n/**\n * TypeScript printer factory options: maps `SchemaNode` → `ts.TypeNode` (raw) or `ts.Node` (full declaration).\n */\nexport type PrinterTsFactory = ast.PrinterFactoryOptions<'typescript', PrinterTsOptions, ts.TypeNode, string>\n\ntype PrinterTs = PrinterTsFactory\n\n/**\n * TypeScript type printer built with `definePrinter`.\n *\n * Converts a `SchemaNode` AST node into a TypeScript AST node:\n * - **`printer.print(node)`** — when `options.typeName` is set, returns a full\n *   `type Name = …` or `interface Name { … }` declaration (`ts.Node`).\n *   Without `typeName`, returns the raw `ts.TypeNode` for the schema.\n *\n * Dispatches on `node.type` to the appropriate handler in `nodes`. Options are closed\n * over per printer instance, so each call to `printerTs(options)` produces an independent printer.\n *\n * @example Raw type node (no `typeName`)\n * ```ts\n * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' } })\n * const typeNode = printer.print(schemaNode) // ts.TypeNode\n * ```\n *\n * @example Full declaration (with `typeName`)\n * ```ts\n * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' }, typeName: 'MyType' })\n * const declaration = printer.print(schemaNode) // ts.TypeAliasDeclaration | ts.InterfaceDeclaration\n * ```\n */\nexport const printerTs = ast.createPrinter<PrinterTs>((options) => {\n  const addsUndefined = OPTIONAL_ADDS_UNDEFINED.has(options.optionalType)\n\n  return {\n    name: 'typescript',\n    options,\n    nodes: {\n      any: () => factory.keywordTypeNodes.any,\n      unknown: () => factory.keywordTypeNodes.unknown,\n      void: () => factory.keywordTypeNodes.void,\n      never: () => factory.keywordTypeNodes.never,\n      boolean: () => factory.keywordTypeNodes.boolean,\n      null: () => factory.keywordTypeNodes.null,\n      blob: () => factory.createTypeReferenceNode('Blob', []),\n      string: () => factory.keywordTypeNodes.string,\n      uuid: () => factory.keywordTypeNodes.string,\n      email: () => factory.keywordTypeNodes.string,\n      url: (node) => {\n        if (node.path) {\n          return factory.createUrlTemplateType(node.path)\n        }\n        return factory.keywordTypeNodes.string\n      },\n      ipv4: () => factory.keywordTypeNodes.string,\n      ipv6: () => factory.keywordTypeNodes.string,\n      datetime: () => factory.keywordTypeNodes.string,\n      number: () => factory.keywordTypeNodes.number,\n      integer: () => factory.keywordTypeNodes.number,\n      bigint: () => factory.keywordTypeNodes.bigint,\n      date: factory.dateOrStringNode,\n      time: factory.dateOrStringNode,\n      ref(node) {\n        if (!node.name) {\n          return null\n        }\n        // `node.name` may have been overridden (e.g. by the single-member allOf flatten using the\n        // property-derived child name), so resolve the target through `resolveRefName` instead.\n        const refName = ast.resolveRefName(node)\n        if (!refName) {\n          return null\n        }\n\n        // When a Key suffix is configured, enum refs must use the suffixed name (e.g. `StatusKey`)\n        // so the reference matches what the enum file actually exports.\n        const isEnumRef =\n          node.ref && ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enum.type) && this.options.enum.typeSuffix && this.options.enumSchemaNames?.has(refName)\n\n        const name = isEnumRef\n          ? this.options.resolver.enum.keyName({ name: refName }, this.options.enum.typeSuffix)\n          : node.ref\n            ? this.options.resolver.name(refName)\n            : refName\n\n        return factory.createTypeReferenceNode(name, undefined)\n      },\n      enum(node) {\n        const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? []\n\n        // A `const` (single-value enum) the adapter did not register as a named enum emits the bare\n        // literal regardless of `enum.type`, matching how its references resolve.\n        if (this.options.enum.type === 'inlineLiteral' || !node.name || isInlineConstEnum(node, this.options.enumSchemaNames)) {\n          const literalNodes = values\n            .filter((v): v is string | number | boolean => v !== null && v !== undefined)\n            .map((value) => factory.constToTypeNode(value, typeof value as 'string' | 'number' | 'boolean'))\n            .filter(isNonNullable)\n\n          return factory.createUnionDeclaration({ withParentheses: true, nodes: literalNodes }) ?? undefined\n        }\n\n        const resolvedName =\n          ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enum.type) && this.options.enum.typeSuffix\n            ? this.options.resolver.enum.keyName(node, this.options.enum.typeSuffix)\n            : this.options.resolver.name(node.name)\n\n        return factory.createTypeReferenceNode(resolvedName, undefined)\n      },\n      union(node) {\n        const members = node.members ?? []\n\n        const hasStringLiteral = members.some((m) => {\n          const enumNode = ast.narrowSchema(m, ast.schemaTypes.enum)\n          return enumNode?.primitive === 'string'\n        })\n        const hasPlainString = members.some((m) => isStringType(m))\n\n        if (hasStringLiteral && hasPlainString) {\n          const memberNodes = members\n            .map((m) => {\n              if (isStringType(m)) {\n                return factory.createIntersectionDeclaration({\n                  nodes: [factory.keywordTypeNodes.string, factory.createTypeLiteralNode([])],\n                  withParentheses: true,\n                })\n              }\n\n              return this.transform(m)\n            })\n            .filter(isNonNullable)\n\n          return factory.createUnionDeclaration({ withParentheses: true, nodes: memberNodes }) ?? undefined\n        }\n\n        return factory.createUnionDeclaration({ withParentheses: true, nodes: factory.buildMemberNodes(members, this.transform) }) ?? undefined\n      },\n      intersection(node) {\n        return factory.createIntersectionDeclaration({ withParentheses: true, nodes: factory.buildMemberNodes(node.members, this.transform) }) ?? null\n      },\n      array(node) {\n        const itemNodes = mapSchemaItems(node, (item) => this.transform(item))\n          .map(({ output }) => output)\n          .filter(isNonNullable)\n\n        return factory.createArrayDeclaration({ nodes: itemNodes, arrayType: this.options.arrayType }) ?? null\n      },\n      tuple(node) {\n        return factory.buildTupleNode(node, this.transform) ?? null\n      },\n      object(node) {\n        const { transform, options } = this\n\n        const addsQuestionToken = OPTIONAL_ADDS_QUESTION_TOKEN.has(options.optionalType)\n\n        const propertyNodes: Array<ts.TypeElement> = mapSchemaProperties(node, (schema) => transform(schema)).map(({ name, property, output }) => {\n          const baseType = output ?? factory.keywordTypeNodes.unknown\n          const optional = !property.required || !!property.schema.optional || !!property.schema.nullish\n          const type = factory.buildPropertyType(property.schema, baseType, options.optionalType, optional)\n          const propMeta = syncSchemaRef(property.schema)\n\n          const propertyNode = factory.createPropertySignature({\n            questionToken: optional ? addsQuestionToken : false,\n            name,\n            type,\n            readOnly: propMeta?.readOnly,\n          })\n\n          return factory.appendJSDocToNode({ node: propertyNode, comments: buildPropertyJSDocComments(property.schema, optional) })\n        })\n\n        const allElements = [...propertyNodes, ...factory.buildIndexSignatures(node, propertyNodes.length, transform)]\n\n        if (!allElements.length) {\n          return factory.keywordTypeNodes.object\n        }\n\n        return factory.createTypeLiteralNode(allElements)\n      },\n      ...options.nodes,\n    },\n    print(node) {\n      const { name, syntaxType = 'type', description, keysToOmit } = this.options\n\n      const transformed = this.transform(node)\n      if (!transformed) return null\n\n      // For ref nodes, structural metadata lives on node.schema rather than the ref node itself.\n      const meta = syncSchemaRef(node)\n\n      // Without name, apply modifiers inline and return.\n      if (!name) {\n        const withNullable = meta.nullable ? factory.createUnionDeclaration({ nodes: [transformed, factory.keywordTypeNodes.null] }) : transformed\n        const result =\n          (meta.nullish || meta.optional) && addsUndefined\n            ? factory.createUnionDeclaration({ nodes: [withNullable, factory.keywordTypeNodes.undefined] })\n            : withNullable\n        return parserTs().print(result)\n      }\n\n      // When keysToOmit is present, wrap with Omit first, then apply nullable/optional\n      // modifiers so they are not swallowed by NonNullable inside createOmitDeclaration.\n      const inner = (() => {\n        const omitted: ts.TypeNode = keysToOmit?.length\n          ? factory.createOmitDeclaration({ keys: keysToOmit, type: transformed, nonNullable: true })\n          : transformed\n        const withNullable = meta.nullable ? factory.createUnionDeclaration({ nodes: [omitted, factory.keywordTypeNodes.null] }) : omitted\n        // For named type declarations (type aliases), optional/nullish always produces | undefined\n        // regardless of optionalType — the questionToken ? modifier only applies to object properties.\n        return meta.nullish || meta.optional ? factory.createUnionDeclaration({ nodes: [withNullable, factory.keywordTypeNodes.undefined] }) : withNullable\n      })()\n\n      const useTypeGeneration = syntaxType === 'type' || inner.kind === factory.syntaxKind.union || !!keysToOmit?.length\n\n      const typeNode = factory.createTypeDeclaration({\n        name,\n        isExportable: true,\n        type: inner,\n        syntax: useTypeGeneration ? 'type' : 'interface',\n        comments: buildPropertyJSDocComments({\n          ...meta,\n          description,\n        }),\n      })\n\n      return parserTs().print(typeNode)\n    },\n  }\n})\n","import { buildOptionsSchema, buildResponses, collectRefNames, getOperationParameters, resolveContentTypeVariants } from '@internals/shared'\nimport { ast, defineGenerator } from 'kubb/kit'\nimport { File, jsxRenderer } from 'kubb/jsx'\nimport { Type } from '../components/Type.tsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX } from '../constants.ts'\nimport { printerTs } from '../printers/printerTs.ts'\nimport type { PluginTs, ResolvedEnumOptions, ResolverTs } from '../types'\nimport { buildParams, buildResponseUnion, isInlineConstEnum } from '../utils.ts'\n\ntype ResolveImportNameParams = {\n  schemaName: string\n  enumOptions: ResolvedEnumOptions\n  enumSchemaNames: Set<string>\n  resolver: ResolverTs\n}\n\n/**\n * Resolves the imported type name for a referenced schema. An enum schema emitted\n * as a `const` object imports its suffixed key alias (e.g. `StatusKey`); every other\n * schema imports its plain resolved name.\n */\nfunction resolveImportName({ schemaName, enumOptions, enumSchemaNames, resolver }: ResolveImportNameParams): string {\n  if (ENUM_TYPES_WITH_KEY_SUFFIX.has(enumOptions.type) && enumOptions.typeSuffix && enumSchemaNames.has(schemaName)) {\n    return resolver.enum.keyName({ name: schemaName }, enumOptions.typeSuffix)\n  }\n  return resolver.name(schemaName)\n}\n\n/**\n * Built-in generator for `@kubb/plugin-ts`. Emits one TypeScript file per\n * schema in the spec plus per-operation request, response, and parameter\n * types. Drop-replace with a custom `Generator<PluginTs>` to change how\n * TypeScript output is produced.\n */\nexport const typeGenerator = defineGenerator<PluginTs>({\n  name: 'typescript',\n  renderer: jsxRenderer,\n  schema(node, ctx) {\n    const { enum: enumOptions, syntaxType, optionalType, arrayType, output, group, printer } = ctx.options\n    const { config, resolver, root } = ctx\n\n    if (!node.name) {\n      return\n    }\n    // Build a set of schema names that are enums so the ref handler and the imports\n    // name callback can use the suffixed type name (e.g. `StatusKey`) for those refs.\n    const enumSchemaNames = new Set<string>(ctx.meta.enumNames)\n    const importName = (schemaName: string) => resolveImportName({ schemaName, enumOptions, enumSchemaNames, resolver })\n\n    const imports = resolver.imports({ node, root, output, group: group ?? undefined, name: importName })\n\n    const enumNode = ast.narrowSchema(node, ast.schemaTypes.enum)\n    // An inline `const` (single-value enum the adapter did not register) renders as a literal type,\n    // so it keeps its plain name instead of the suffixed enum-key name.\n    const isEnumSchema = !!enumNode && !isInlineConstEnum(enumNode, enumSchemaNames)\n\n    const meta = {\n      name: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumOptions.type) && isEnumSchema ? resolver.enum.keyName(node, enumOptions.typeSuffix) : resolver.name(node.name),\n      file: resolver.file({ name: node.name, extname: '.ts', root, output, group: group ?? undefined }),\n    } as const\n\n    const schemaPrinter = printerTs({\n      optionalType,\n      arrayType,\n      enum: enumOptions,\n      name: meta.name,\n      syntaxType,\n      description: node.description,\n      resolver,\n      enumSchemaNames,\n      nodes: printer?.nodes,\n    })\n\n    return (\n      <File\n        baseName={meta.file.baseName}\n        path={meta.file.path}\n        meta={meta.file.meta}\n        banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n        footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n      >\n        {imports.map((imp) => (\n          <File.Import key={[node.name, imp.path, imp.isTypeOnly].join('-')} root={meta.file.path} path={imp.path} name={imp.name} isTypeOnly />\n        ))}\n        <Type name={meta.name} node={node} enum={enumOptions} resolver={resolver} printer={schemaPrinter} />\n      </File>\n    )\n  },\n  operation(node, ctx) {\n    const { enum: enumOptions, optionalType, arrayType, syntaxType, group, output, printer } = ctx.options\n    const { config, resolver, root } = ctx\n\n    const meta = {\n      file: resolver.file({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path, root, output, group: group ?? undefined }),\n    } as const\n\n    // Build a set of schema names that are enums so the ref handler and the imports\n    // name callback can use the suffixed type name (e.g. `StatusKey`) for those refs.\n    const enumSchemaNames = new Set<string>(ctx.meta.enumNames)\n    const importName = (schemaName: string) => resolveImportName({ schemaName, enumOptions, enumSchemaNames, resolver })\n\n    function renderSchemaType({ schema, name, keysToOmit }: { schema: ast.SchemaNode | null; name: string; keysToOmit?: Array<string> | null }) {\n      if (!schema) return null\n\n      const imports = resolver.imports({ node: schema, root, output, group: group ?? undefined, name: importName })\n\n      const schemaPrinter = printerTs({\n        optionalType,\n        arrayType,\n        enum: enumOptions,\n        name,\n        syntaxType,\n        description: schema.description,\n        keysToOmit,\n        resolver,\n        enumSchemaNames,\n        nodes: printer?.nodes,\n      })\n\n      return (\n        <>\n          {imports.map((imp) => (\n            <File.Import key={[name, imp.path, imp.isTypeOnly].join('-')} root={meta.file.path} path={imp.path} name={imp.name} isTypeOnly />\n          ))}\n          <Type name={name} node={schema} enum={enumOptions} resolver={resolver} printer={schemaPrinter} />\n        </>\n      )\n    }\n\n    /**\n     * Emits an individual type per content type plus a plain union alias under `baseName`. Shared by\n     * the request body and multi-content-type responses. The response record discriminates these\n     * variants by content type in {@link buildResponses}; the standalone alias stays a plain union so\n     * query hooks and `result.data` keep the bare body.\n     */\n    function buildContentTypeVariants(\n      entries: Array<{ contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }>,\n      baseName: string,\n      decorate?: (schema: ast.SchemaNode) => ast.SchemaNode,\n    ) {\n      const variants = resolveContentTypeVariants(entries, baseName)\n      const unionSchema = ast.factory.createSchema({\n        type: 'union',\n        members: variants.map((variant) => ast.factory.createSchema({ type: 'ref', name: variant.name })),\n      })\n      return (\n        <>\n          {variants.map((variant) =>\n            renderSchemaType({\n              schema: decorate ? decorate(variant.schema) : variant.schema,\n              name: variant.name,\n              keysToOmit: variant.keysToOmit,\n            }),\n          )}\n          {renderSchemaType({ schema: unionSchema, name: baseName })}\n        </>\n      )\n    }\n\n    const { path: pathParams, query: queryParams, header: headerParams } = getOperationParameters(node)\n\n    const paramGroupTypes = [\n      pathParams.length > 0 && renderSchemaType({ schema: buildParams({ params: pathParams }), name: resolver.param.path(node, pathParams[0]!) }),\n      queryParams.length > 0 && renderSchemaType({ schema: buildParams({ params: queryParams }), name: resolver.param.query(node, queryParams[0]!) }),\n      headerParams.length > 0 && renderSchemaType({ schema: buildParams({ params: headerParams }), name: resolver.param.headers(node, headerParams[0]!) }),\n    ]\n\n    const requestBodyContent = node.requestBody?.content ?? []\n\n    function buildRequestType() {\n      if (requestBodyContent.length === 0) return null\n      if (requestBodyContent.length === 1) {\n        const entry = requestBodyContent[0]!\n        if (!entry.schema) return null\n        return renderSchemaType({\n          schema: {\n            ...entry.schema,\n            description: node.requestBody!.description ?? entry.schema.description,\n          },\n          name: resolver.response.body(node),\n          keysToOmit: entry.keysToOmit,\n        })\n      }\n      // Multiple content types — generate individual types + union alias\n      return buildContentTypeVariants(requestBodyContent, resolver.response.body(node), (schema) => ({\n        ...schema,\n        description: node.requestBody!.description ?? schema.description,\n      }))\n    }\n\n    const requestType = buildRequestType()\n\n    const responseTypes = node.responses.map((res) => {\n      const variants = (res.content ?? []).filter((entry) => entry.schema)\n      // Multiple content types for a single status code — generate per-variant types + a plain union.\n      // The `<Name>Responses` record discriminates them by content type (see buildResponses).\n      if (variants.length > 1) {\n        return buildContentTypeVariants(variants, resolver.response.status(node, res.statusCode))\n      }\n      const primary = variants[0] ?? res.content?.[0]\n      return renderSchemaType({\n        schema: primary?.schema ?? null,\n        name: resolver.response.status(node, res.statusCode),\n        keysToOmit: primary?.keysToOmit,\n      })\n    })\n\n    const optionsType = renderSchemaType({\n      schema: buildOptionsSchema(node, resolver),\n      name: resolver.response.options(node),\n    })\n\n    const responsesType = renderSchemaType({\n      schema: buildResponses(node, resolver),\n      name: resolver.response.responses(node),\n    })\n\n    function buildResponseType() {\n      const hasSchema = (res: ast.ResponseNode) => (res.content ?? []).some((entry) => entry.schema)\n      if (!node.responses.some(hasSchema)) {\n        return null\n      }\n\n      const responseName = resolver.response.response(node)\n\n      const responsesWithSchema = node.responses.filter(hasSchema)\n      const importedNames = new Set(\n        responsesWithSchema.flatMap((res) => (res.content ?? []).flatMap((entry) => (entry.schema ? collectRefNames(entry.schema).map(importName) : []))),\n      )\n\n      if (importedNames.has(responseName)) {\n        return null\n      }\n\n      return renderSchemaType({\n        schema: {\n          ...buildResponseUnion(node, { resolver })!,\n          description: 'Union of all possible responses',\n        },\n        name: responseName,\n      })\n    }\n\n    const responseType = buildResponseType()\n\n    return (\n      <File\n        baseName={meta.file.baseName}\n        path={meta.file.path}\n        meta={meta.file.meta}\n        banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n        footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n      >\n        {paramGroupTypes}\n        {responseTypes}\n        {requestType}\n        {optionsType}\n        {responsesType}\n        {responseType}\n      </File>\n    )\n  },\n})\n","import { createCasedFile, createOperationParamResolver, createOperationResponseResolver } from '@internals/shared'\nimport { ensureValidVarName, pascalCase } from '@internals/utils'\nimport { createResolver } from 'kubb/kit'\nimport type { PluginTs } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths\n * for every generated TypeScript type. Import this in other plugins that need\n * to reference the exact names `plugin-ts` produces without duplicating the\n * casing/file-layout rules.\n *\n * The `default` helpers are supplied by `createResolver`. This plugin overrides the top-level `name`\n * to use PascalCase for value and type names and `file` to write PascalCase file paths (dotted names\n * become `/`-joined), and groups the operation-specific naming under the `param`, `response`, and\n * `enum` namespaces.\n *\n * @example Resolve a type and file name\n * ```ts\n * import { resolverTs } from '@kubb/plugin-ts'\n *\n * resolverTs.name('list pets')                     // 'ListPets'\n * resolverTs.response.status(node, 200)            // 'ListPetsStatus200'\n * ```\n */\nexport const resolverTs = createResolver<PluginTs>({\n  pluginName: 'plugin-ts',\n  name(name) {\n    return ensureValidVarName(pascalCase(name))\n  },\n  file: createCasedFile(pascalCase),\n  param: createOperationParamResolver(),\n  response: {\n    ...createOperationResponseResolver(),\n    options(node) {\n      return this.name(`${node.operationId} Options`)\n    },\n  },\n  enum: {\n    keyName(node, enumTypeSuffix = 'key') {\n      return `${this.name(node.name ?? '')}${enumTypeSuffix}`\n    },\n  },\n})\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin, Resolver } from 'kubb/kit'\nimport { typeGenerator } from './generators/typeGenerator.tsx'\nimport { resolverTs } from './resolvers/resolverTs.ts'\nimport type { PluginTs } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-ts`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\n/**\n * Generates TypeScript `type` aliases and `interface` declarations from an\n * OpenAPI spec. The foundation that every other Kubb plugin builds on:\n * clients, query hooks, mocks, and validators all reference the names this\n * plugin produces.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n *\n * export default defineConfig({\n *   input: './petStore.yaml',\n *   output: { path: './src/gen' },\n *   plugins: [\n *     pluginTs({\n *       output: { path: './types' },\n *       enum: { type: 'asConst' },\n *       optionalType: 'questionTokenAndUndefined',\n *     }),\n *   ],\n * })\n * ```\n */\nexport const pluginTs = definePlugin<PluginTs>((options) => {\n  const {\n    output = { path: 'types', barrel: { type: 'named' } },\n    group,\n    exclude = [],\n    include,\n    override = [],\n    enum: enumOptions = {},\n    optionalType = 'questionToken',\n    arrayType = 'array',\n    syntaxType = 'type',\n    printer,\n    resolver: userResolver,\n    macros: userMacros,\n  } = options\n\n  const groupConfig = createGroupConfig(group)\n\n  const resolvedEnum = {\n    type: enumOptions.type ?? 'asConst',\n    constCasing: enumOptions.constCasing ?? 'camelCase',\n    typeSuffix: enumOptions.typeSuffix ?? 'Key',\n    keyCasing: enumOptions.keyCasing ?? 'none',\n  }\n\n  return {\n    name: pluginTsName,\n    options,\n    hooks: {\n      'kubb:plugin:setup'(ctx) {\n        ctx.setOptions({\n          output,\n          exclude,\n          include,\n          override,\n          optionalType,\n          group: groupConfig,\n          arrayType,\n          enum: resolvedEnum,\n          syntaxType,\n          printer,\n        })\n        ctx.setResolver(userResolver ? Resolver.merge(resolverTs, userResolver) : resolverTs)\n        if (userMacros?.length) {\n          ctx.setMacros(userMacros)\n        }\n        ctx.addGenerator(typeGenerator)\n      },\n    },\n  }\n})\n\nexport default pluginTs\n","/**\n * A type expression used as a function parameter type annotation.\n *\n * - a plain `string` is a type reference rendered as-is, e.g. `'string'`, `'QueryParams'`, `'Partial<Config>'`\n * - a {@link TypeLiteralNode} is an inline anonymous type, e.g. `{ petId: string; name?: string }`\n * - an {@link IndexedAccessTypeNode} is a single field accessed from a named type, e.g. `PathParams['petId']`\n */\nexport type TypeExpression = string | TypeLiteralNode | IndexedAccessTypeNode\n\n/**\n * An inline anonymous object type grouping named fields.\n * Renders as `{ key: Type; other?: OtherType }`.\n */\nexport type TypeLiteralNode = {\n  kind: 'TypeLiteral'\n  /**\n   * Members of the object type, rendered in order.\n   */\n  members: Array<{\n    /**\n     * Member key.\n     */\n    name: string\n    /**\n     * Member type expression.\n     */\n    type: TypeExpression\n    /**\n     * Whether the member is optional, rendered with `?`.\n     */\n    optional?: boolean\n  }>\n}\n\n/**\n * A single field accessed from a named group type. Renders as `target['key']`.\n */\nexport type IndexedAccessTypeNode = {\n  kind: 'IndexedAccessType'\n  /**\n   * Name of the type being indexed, e.g. `'GetPetPathParams'`.\n   */\n  target: string\n  /**\n   * Field key to access, e.g. `'petId'`.\n   */\n  key: string\n}\n\n/**\n * An object destructuring binding, used as the name of a grouped function parameter.\n * Renders as `{ id, name }` or `{ id: renamed }` when `propertyName` differs.\n */\nexport type ObjectBindingPatternNode = {\n  kind: 'ObjectBindingPattern'\n  /**\n   * Bound elements, rendered in order.\n   */\n  elements: Array<{\n    /**\n     * Local binding name.\n     */\n    name: string\n    /**\n     * Source key when it differs from the binding name, rendered as `propertyName: name`.\n     */\n    propertyName?: string\n  }>\n}\n\n/**\n * One function parameter.\n *\n * A simple parameter has a `string` name. A destructured group has an\n * {@link ObjectBindingPatternNode} name paired with a {@link TypeLiteralNode} type.\n *\n * @example Required parameter\n * `name: Type`\n *\n * @example Optional parameter\n * `name?: Type`\n *\n * @example Parameter with default value\n * `name: Type = defaultValue`\n *\n * @example Rest parameter\n * `...name: Type[]`\n *\n * @example Destructured group\n * `{ id, name? }: { id: string; name?: string } = {}`\n */\nexport type FunctionParameterNode = {\n  kind: 'FunctionParameter'\n  /**\n   * Parameter name, or an {@link ObjectBindingPatternNode} for a destructured group.\n   */\n  name: string | ObjectBindingPatternNode\n  /**\n   * Type annotation as a {@link TypeExpression}. Omit for untyped output.\n   */\n  type?: TypeExpression\n  /**\n   * Whether the parameter is optional, rendered with `?`.\n   */\n  optional?: boolean\n  /**\n   * Default value, written verbatim after `=`. Commonly `'{}'` for a destructured group.\n   */\n  default?: string\n  /**\n   * When `true` the parameter is emitted as a rest parameter, e.g. `...name: Type[]`.\n   */\n  rest?: boolean\n}\n\n/**\n * A complete function parameter list.\n *\n * Printers are responsible for sorting (`required` → `optional` → `defaulted`).\n */\nexport type FunctionParametersNode = {\n  kind: 'FunctionParameters'\n  /**\n   * Ordered parameter nodes.\n   */\n  params: ReadonlyArray<FunctionParameterNode>\n}\n\n/**\n * Narrows a {@link TypeExpression} to a {@link TypeLiteralNode}.\n */\nexport function isTypeLiteral(type: TypeExpression): type is TypeLiteralNode {\n  return typeof type !== 'string' && type.kind === 'TypeLiteral'\n}\n\n/**\n * Narrows a {@link TypeExpression} to an {@link IndexedAccessTypeNode}.\n */\nexport function isIndexedAccessType(type: TypeExpression): type is IndexedAccessTypeNode {\n  return typeof type !== 'string' && type.kind === 'IndexedAccessType'\n}\n\n/**\n * Creates a {@link TypeLiteralNode} representing an inline anonymous object type.\n *\n * @example\n * ```ts\n * createTypeLiteral({ members: [{ name: 'petId', type: 'string', optional: false }] })\n * // { petId: string }\n * ```\n */\nexport function createTypeLiteral(props: Omit<TypeLiteralNode, 'kind'>): TypeLiteralNode {\n  return { kind: 'TypeLiteral', ...props }\n}\n\n/**\n * Creates an {@link IndexedAccessTypeNode} representing a single field accessed from a named type.\n *\n * @example\n * ```ts\n * createIndexedAccessType({ target: 'DeletePetPathParams', key: 'petId' })\n * // DeletePetPathParams['petId']\n * ```\n */\nexport function createIndexedAccessType(props: Omit<IndexedAccessTypeNode, 'kind'>): IndexedAccessTypeNode {\n  return { kind: 'IndexedAccessType', ...props }\n}\n\n/**\n * Creates an {@link ObjectBindingPatternNode} for a destructured parameter binding.\n *\n * @example\n * ```ts\n * createObjectBindingPattern({ elements: [{ name: 'id' }, { name: 'name' }] })\n * // { id, name }\n * ```\n */\nexport function createObjectBindingPattern(props: Omit<ObjectBindingPatternNode, 'kind'>): ObjectBindingPatternNode {\n  return { kind: 'ObjectBindingPattern', ...props }\n}\n\n/**\n * Plain property descriptor for a destructured group built by {@link createFunctionParameter}.\n */\ntype FunctionParameterProperty = {\n  name: string\n  type: TypeExpression\n  optional?: boolean\n}\n\ntype FunctionParameterInput =\n  | { name: string | ObjectBindingPatternNode; type?: TypeExpression; optional?: boolean; default?: string; rest?: boolean }\n  | { properties: Array<FunctionParameterProperty>; optional?: boolean; default?: string }\n\n/**\n * Creates a {@link FunctionParameterNode}. `optional` defaults to `false`.\n * Passing `properties` builds a destructured group: an {@link ObjectBindingPatternNode} name\n * paired with a {@link TypeLiteralNode} type.\n *\n * @example Optional param\n * ```ts\n * createFunctionParameter({ name: 'params', type: 'QueryParams', optional: true })\n * // → params?: QueryParams\n * ```\n *\n * @example Destructured group\n * ```ts\n * createFunctionParameter({ properties: [{ name: 'id', type: 'string' }, { name: 'name', type: 'string', optional: true }], default: '{}' })\n * // → { id, name }: { id: string; name?: string } = {}\n * ```\n */\nexport function createFunctionParameter(input: FunctionParameterInput): FunctionParameterNode {\n  if ('properties' in input) {\n    return {\n      kind: 'FunctionParameter',\n      name: createObjectBindingPattern({ elements: input.properties.map((p) => ({ name: p.name })) }),\n      type: createTypeLiteral({ members: input.properties.map((p) => ({ name: p.name, type: p.type, optional: p.optional ?? false })) }),\n      optional: input.optional ?? false,\n      ...(input.default !== undefined ? { default: input.default } : {}),\n    }\n  }\n  return { kind: 'FunctionParameter', optional: false, ...input }\n}\n\n/**\n * Creates a {@link FunctionParametersNode} from an ordered list of parameters.\n *\n * @example\n * ```ts\n * const empty = createFunctionParameters()\n * // { params: [] }\n * ```\n */\nexport function createFunctionParameters(props: Partial<Omit<FunctionParametersNode, 'kind'>> = {}): FunctionParametersNode {\n  return { kind: 'FunctionParameters', params: [], ...props }\n}\n","import { PARAM_RANK } from '../constants.ts'\nimport { isIndexedAccessType, isTypeLiteral } from './functionParams.ts'\nimport type { FunctionParameterNode, FunctionParametersNode, ObjectBindingPatternNode, TypeExpression } from './functionParams.ts'\n\n/**\n * Renders a {@link TypeExpression} to its TypeScript source.\n *\n * - a `string` is a type reference, returned as-is\n * - an `IndexedAccessType` becomes `objectType['indexType']`\n * - a `TypeLiteral` becomes `{ key: Type; key?: Type }`\n *\n * `transformType` is applied once to the fully rendered type, matching how the\n * printer wrapped reference types before the `ts.factory` model.\n */\nexport function renderType(type: TypeExpression, transformType?: (type: string) => string): string {\n  const rendered = renderTypeExpression(type)\n  return transformType ? transformType(rendered) : rendered\n}\n\n/**\n * Renders an object-type key, quoting it as a string literal when it is not a valid\n * identifier so `{ 'content-type': string }` stays valid TypeScript.\n */\nfunction renderKey(name: string): string {\n  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) ? name : JSON.stringify(name)\n}\n\nfunction renderTypeExpression(type: TypeExpression): string {\n  if (typeof type === 'string') return type\n  if (isIndexedAccessType(type)) return `${type.target}['${type.key}']`\n\n  const parts = type.members.map((member) => {\n    const value = renderTypeExpression(member.type)\n    return member.optional ? `${renderKey(member.name)}?: ${value}` : `${renderKey(member.name)}: ${value}`\n  })\n  return `{ ${parts.join('; ')} }`\n}\n\nexport type FunctionPrinterOptions = {\n  /**\n   * Rendering modes supported by `functionPrinter`.\n   *\n   * | Mode          | Output example                    | Use case                       |\n   * |---------------|-----------------------------------|--------------------------------|\n   * | `declaration` | `id: string, config: Config = {}` | Function parameter declaration |\n   * | `call`        | `id, { method, url }`             | Function call arguments        |\n   */\n  mode: 'declaration' | 'call'\n  /**\n   * Optional transformation applied to every parameter name before printing.\n   */\n  transformName?: (name: string) => string\n  /**\n   * Optional transformation applied to every type string before printing.\n   */\n  transformType?: (type: string) => string\n}\n\nfunction groupMembers(param: FunctionParameterNode): ReadonlyArray<{ name: string; optional?: boolean }> | null {\n  if (typeof param.name === 'string') return null\n  return param.type && isTypeLiteral(param.type) ? param.type.members : []\n}\n\nfunction rank(param: FunctionParameterNode): number {\n  if (param.rest) return PARAM_RANK.rest\n  if (param.default) return PARAM_RANK.withDefault\n  const members = groupMembers(param)\n  if (members) return members.every((m) => m.optional) ? PARAM_RANK.optional : PARAM_RANK.required\n  return param.optional ? PARAM_RANK.optional : PARAM_RANK.required\n}\n\nfunction sortParams(params: ReadonlyArray<FunctionParameterNode>): Array<FunctionParameterNode> {\n  // `toSorted` is a stable sort, so equal-rank params keep their declared order.\n  return params.toSorted((a, b) => rank(a) - rank(b))\n}\n\n/**\n * Orders a destructured group's binding elements and type members together,\n * required fields first, matching how grouped children were sorted before.\n */\ntype GroupMember = { name: string; propertyName?: string; type?: TypeExpression; optional?: boolean }\n\nfunction sortedGroupMembers(name: ObjectBindingPatternNode, type: TypeExpression | undefined): Array<GroupMember> {\n  const members = type && isTypeLiteral(type) ? type.members : []\n  const memberRank = (optional?: boolean) => (optional ? PARAM_RANK.optional : PARAM_RANK.required)\n  return name.elements\n    .map((element, index) => ({\n      name: element.name,\n      propertyName: element.propertyName,\n      type: members[index]?.type,\n      optional: members[index]?.optional,\n    }))\n    .toSorted((a, b) => memberRank(a.optional) - memberRank(b.optional))\n}\n\n/**\n * Renders one binding element: the local name, prefixed with its source key when the\n * binding renames the property, as in `{ petId: id }`.\n */\nfunction renderBindingMember(member: GroupMember, transformName?: (name: string) => string): string {\n  const local = transformName ? transformName(member.name) : member.name\n  return member.propertyName ? `${member.propertyName}: ${local}` : local\n}\n\n/**\n * Renders the type annotation of a destructured group. An inline object type is\n * rendered from the already-sorted members so its key order matches the binding;\n * a reference type is rendered as-is.\n */\nfunction renderGroupType(type: TypeExpression | undefined, sorted: Array<GroupMember>, transformType?: (type: string) => string): string | undefined {\n  if (!type) return undefined\n  if (!isTypeLiteral(type)) return renderType(type)\n\n  const typed = sorted.filter((member) => member.type !== undefined)\n  if (!typed.length) return undefined\n  const parts = typed.map((member) => {\n    const key = renderKey(member.propertyName ?? member.name)\n    const value = renderType(member.type!, transformType)\n    return member.optional ? `${key}?: ${value}` : `${key}: ${value}`\n  })\n  return `{ ${parts.join('; ')} }`\n}\n\nfunction printParameter(node: FunctionParameterNode, options: FunctionPrinterOptions): string {\n  const { mode, transformName, transformType } = options\n  const bindingName = node.name\n\n  if (mode === 'call') {\n    if (typeof bindingName !== 'string') {\n      const keys = sortedGroupMembers(bindingName, node.type)\n        .map((member) => renderBindingMember(member))\n        .join(', ')\n      return `{ ${keys} }`\n    }\n    const name = transformName ? transformName(bindingName) : bindingName\n    return node.rest ? `...${name}` : name\n  }\n\n  if (typeof bindingName !== 'string') {\n    const sorted = sortedGroupMembers(bindingName, node.type)\n    const binding = `{ ${sorted.map((member) => renderBindingMember(member, transformName)).join(', ')} }`\n    const allOptional = sorted.every((member) => member.optional)\n    const type = renderGroupType(node.type, sorted, transformType)\n    if (type) {\n      if (allOptional) return `${binding}: ${type} = ${node.default ?? '{}'}`\n      return node.default ? `${binding}: ${type} = ${node.default}` : `${binding}: ${type}`\n    }\n    return node.default ? `${binding} = ${node.default}` : binding\n  }\n\n  const name = transformName ? transformName(bindingName) : bindingName\n  const type = node.type ? renderType(node.type, transformType) : undefined\n\n  if (node.rest) {\n    return type ? `...${name}: ${type}` : `...${name}`\n  }\n  if (type) {\n    if (node.optional) return `${name}?: ${type}`\n    return node.default ? `${name}: ${type} = ${node.default}` : `${name}: ${type}`\n  }\n  return node.default ? `${name} = ${node.default}` : name\n}\n\n/**\n * Default function-signature printer. Renders a parameter list in one of two modes:\n * `declaration` for the function signature and `call` for the call arguments.\n *\n * @example\n * ```ts\n * const printer = functionPrinter({ mode: 'declaration' })\n *\n * const sig = createFunctionParameters({\n *   params: [\n *     createFunctionParameter({ name: 'petId', type: 'string', optional: false }),\n *     createFunctionParameter({ name: 'config', type: 'Config', optional: false, default: '{}' }),\n *   ],\n * })\n *\n * printer.print(sig)  // → \"petId: string, config: Config = {}\"\n * ```\n */\nexport function functionPrinter(options: FunctionPrinterOptions) {\n  return {\n    name: 'functionParameters' as const,\n    options,\n    print(node: FunctionParametersNode): string {\n      return sortParams(node.params)\n        .map((p) => printParameter(p, options))\n        .filter(Boolean)\n        .join(', ')\n    },\n  }\n}\n","import { getOperationParameters } from '@internals/shared'\nimport type { OperationParamsResolver } from '@internals/shared'\nimport type { ast } from 'kubb/kit'\nimport { createFunctionParameter, createFunctionParameters, createIndexedAccessType, createTypeLiteral } from './functionParams.ts'\nimport type { FunctionParameterNode, FunctionParametersNode, TypeExpression, TypeLiteralNode } from './functionParams.ts'\n\n/**\n * Named type for a group of parameters (query or header) emitted as a single typed parameter.\n */\ntype ParamGroupType = {\n  /**\n   * Type expression for the group, a plain group-name reference.\n   */\n  type: TypeExpression\n  /**\n   * Whether the parameter group is optional.\n   */\n  optional: boolean\n}\n\n/**\n * A single member of a destructured parameter group, fed to `createFunctionParameter({ properties })`.\n */\ntype GroupProperty = {\n  name: string\n  type: TypeExpression\n  optional?: boolean\n}\n\n/**\n * Options for {@link createOperationParams}.\n */\nexport type CreateOperationParamsOptions = {\n  /**\n   * How all operation parameters are grouped in the function signature.\n   * - `'object'` wraps all params into a single destructured object `{ petId, data, params }`\n   * - `'inline'` emits each param category as a separate top-level parameter\n   */\n  paramsType: 'object' | 'inline'\n  /**\n   * How path parameters are emitted when `paramsType` is `'inline'`.\n   * - `'object'` groups them as `{ petId, storeId }: PathParams`\n   * - `'inline'` spreads them as individual parameters `petId: string, storeId: string`\n   * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams`\n   */\n  pathParamsType: 'object' | 'inline' | 'inlineSpread'\n  /**\n   * Resolver for parameter and request body type names.\n   * Pass `ResolverTs` from `@kubb/plugin-ts` directly.\n   * When omitted, falls back to the schema primitive or `'unknown'`.\n   */\n  resolver?: OperationParamsResolver\n  /**\n   * Default value for the path parameters binding when `pathParamsType` is `'object'`.\n   * Falls back to `'{}'` when all path params are optional.\n   */\n  pathParamsDefault?: string\n  /**\n   * Extra parameters appended after the standard operation parameters.\n   *\n   * @example Plugin-specific trailing parameter\n   * ```ts\n   * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial<RequestOptions>', default: '{}' })]\n   * ```\n   */\n  extraParams?: Array<FunctionParameterNode>\n  /**\n   * Override the default parameter names used for body, query, header, and rest-path groups.\n   *\n   * Useful when targeting languages or frameworks with different naming conventions.\n   *\n   * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' }\n   */\n  paramNames?: {\n    /**\n     * Name for the request body parameter.\n     * @default 'data'\n     */\n    data?: string\n    /**\n     * Name for the query parameters group parameter.\n     * @default 'params'\n     */\n    params?: string\n    /**\n     * Name for the header parameters group parameter.\n     * @default 'headers'\n     */\n    headers?: string\n    /**\n     * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`.\n     * @default 'pathParams'\n     */\n    path?: string\n  }\n  /**\n   * Transforms every resolved type name before it lands in a parameter node, for framework-level\n   * type wrappers.\n   *\n   * @example Vue Query, wrap every parameter type with `MaybeRefOrGetter`\n   * `typeWrapper: (t) => \\`MaybeRefOrGetter<${t}>\\``\n   */\n  typeWrapper?: (type: string) => string\n}\n\n/**\n * Resolves the {@link TypeExpression} for an individual parameter.\n *\n * Without a resolver, it falls back to the schema primitive (a plain type-name string). When the\n * parameter belongs to a named group, it emits an `IndexedAccessType` like `GroupParams['petId']`,\n * otherwise the resolved individual name.\n */\nfunction resolveParamType({\n  node,\n  param,\n  resolver,\n}: {\n  node: ast.OperationNode\n  param: ast.ParameterNode\n  resolver: OperationParamsResolver | undefined\n}): TypeExpression {\n  if (!resolver) {\n    return param.schema.primitive ?? 'unknown'\n  }\n\n  const individualName = resolver.param.name(node, param)\n\n  const groupLocation = param.in === 'path' || param.in === 'query' || param.in === 'header' ? param.in : undefined\n\n  const groupResolvers = {\n    path: resolver.param.path,\n    query: resolver.param.query,\n    header: resolver.param.headers,\n  } as const\n\n  const groupName = groupLocation ? groupResolvers[groupLocation].call(resolver, node, param) : undefined\n\n  if (groupName && groupName !== individualName) {\n    return createIndexedAccessType({ target: groupName, key: param.name })\n  }\n\n  return individualName\n}\n\n/**\n * Derives a {@link ParamGroupType} for a query or header group from the resolver.\n *\n * Returns `null` when there is no resolver, no params, or the group name equals the\n * individual param name (so there is no real group to emit).\n */\nfunction resolveGroupType({\n  node,\n  params,\n  group,\n  resolver,\n}: {\n  node: ast.OperationNode\n  params: Array<ast.ParameterNode>\n  group: 'query' | 'header'\n  resolver: OperationParamsResolver | undefined\n}): ParamGroupType | null {\n  if (!resolver || !params.length) {\n    return null\n  }\n  const firstParam = params[0]!\n  const groupMethod = group === 'query' ? resolver.param.query : resolver.param.headers\n  const groupName = groupMethod.call(resolver, node, firstParam)\n  if (groupName === resolver.param.name(node, firstParam)) {\n    return null\n  }\n  return { type: groupName, optional: params.every((p) => !p.required) }\n}\n\n/**\n * Converts an `OperationNode` into function parameters for code generation.\n *\n * Centralizes parameter grouping logic for all plugins. `paramsType` chooses between one\n * destructured object parameter (`object`) and separate top-level parameters (`inline`), while\n * `pathParamsType` controls how path params render in inline mode. Provide a `resolver` for type\n * name resolution and `extraParams` for plugin-specific trailing parameters such as an `options` object.\n */\nexport function createOperationParams(node: ast.OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode {\n  const { paramsType, pathParamsType, resolver, pathParamsDefault, extraParams = [], paramNames, typeWrapper } = options\n\n  const dataName = paramNames?.data ?? 'data'\n  const paramsName = paramNames?.params ?? 'params'\n  const headersName = paramNames?.headers ?? 'headers'\n  const pathName = paramNames?.path ?? 'pathParams'\n\n  const wrapType = (type: string): string => (typeWrapper ? typeWrapper(type) : type)\n  // typeWrapper takes a type-name string, so only plain references are wrapped.\n  // TypeLiteral and IndexedAccessType expressions are pre-resolved and pass through unchanged.\n  const wrapTypeExpression = (type: TypeExpression): TypeExpression => (typeof type === 'string' ? wrapType(type) : type)\n\n  const { path: pathParams, query: queryParams, header: headerParams } = getOperationParameters(node)\n\n  const toProperty = (param: ast.ParameterNode): GroupProperty => ({\n    name: param.name,\n    type: wrapTypeExpression(resolveParamType({ node, param, resolver })),\n    optional: !param.required,\n  })\n  const emptyObjectDefault = (props: Array<GroupProperty>): string | undefined => (props.every((p) => p.optional) ? '{}' : undefined)\n\n  const bodyType = node.requestBody?.content?.[0]?.schema ? wrapType(resolver?.response.body(node) ?? 'unknown') : undefined\n  const bodyProperty: Array<GroupProperty> = bodyType ? [{ name: dataName, type: bodyType, optional: !(node.requestBody?.required ?? false) }] : []\n\n  const trailingGroups: Array<BuildGroupArgs> = [\n    { name: paramsName, node, params: queryParams, groupType: resolveGroupType({ node, params: queryParams, group: 'query', resolver }), resolver, wrapType },\n    {\n      name: headersName,\n      node,\n      params: headerParams,\n      groupType: resolveGroupType({ node, params: headerParams, group: 'header', resolver }),\n      resolver,\n      wrapType,\n    },\n  ]\n\n  const params: Array<FunctionParameterNode> = []\n\n  if (paramsType === 'object') {\n    const children = [...pathParams.map(toProperty), ...bodyProperty, ...trailingGroups.flatMap(buildGroupProperty)]\n    if (children.length) {\n      params.push(createFunctionParameter({ properties: children, default: emptyObjectDefault(children) }))\n    }\n  } else {\n    if (pathParamsType === 'inlineSpread' && pathParams.length) {\n      const spreadType = resolver?.param.path(node, pathParams[0]!)\n      params.push(createFunctionParameter({ name: pathName, type: spreadType ? wrapType(spreadType) : undefined, rest: true }))\n    } else if (pathParamsType === 'inline') {\n      params.push(...pathParams.map((p) => createFunctionParameter(toProperty(p))))\n    } else if (pathParams.length) {\n      const pathChildren = pathParams.map(toProperty)\n      params.push(createFunctionParameter({ properties: pathChildren, default: pathParamsDefault ?? emptyObjectDefault(pathChildren) }))\n    }\n\n    params.push(...bodyProperty.map((p) => createFunctionParameter(p)))\n    params.push(...trailingGroups.flatMap(buildGroupParam))\n  }\n\n  params.push(...extraParams)\n\n  return createFunctionParameters({ params })\n}\n\n/**\n * Shared arguments for building a query or header parameter group.\n */\ntype BuildGroupArgs = {\n  name: string\n  node: ast.OperationNode\n  params: Array<ast.ParameterNode>\n  groupType: ParamGroupType | null\n  resolver: OperationParamsResolver | undefined\n  wrapType: (type: string) => string\n}\n\n/**\n * Builds the property descriptor for a query or header group.\n * Returns an empty array when there are no params to emit.\n *\n * A pre-resolved `groupType` emits `name: GroupType`. Otherwise it builds an inline\n * {@link TypeLiteralNode} from the individual params.\n */\nfunction buildGroupProperty({ name, node, params, groupType, resolver, wrapType }: BuildGroupArgs): Array<GroupProperty> {\n  if (groupType) {\n    const type = typeof groupType.type === 'string' ? wrapType(groupType.type) : groupType.type\n    return [{ name, type, optional: groupType.optional }]\n  }\n  if (params.length) {\n    return [{ name, type: buildTypeLiteral({ node, params, resolver }), optional: params.every((p) => !p.required) }]\n  }\n  return []\n}\n\n/**\n * Builds a single {@link FunctionParameterNode} for a query or header group.\n * Returns an empty array when there are no params to emit.\n */\nfunction buildGroupParam(args: BuildGroupArgs): Array<FunctionParameterNode> {\n  return buildGroupProperty(args).map((p) => createFunctionParameter(p))\n}\n\n/**\n * Builds a {@link TypeLiteralNode} for an inline anonymous type grouping named fields.\n *\n * Used when query or header parameters have no dedicated group type name.\n */\nfunction buildTypeLiteral({\n  node,\n  params,\n  resolver,\n}: {\n  node: ast.OperationNode\n  params: Array<ast.ParameterNode>\n  resolver: OperationParamsResolver | undefined\n}): TypeLiteralNode {\n  return createTypeLiteral({\n    members: params.map((p) => ({\n      name: p.name,\n      type: resolveParamType({ node, param: p, resolver }),\n      optional: !p.required,\n    })),\n  })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,KAC9E,KAAK,MAAM,CAAC;CAC5B,CAAC,CAAC,CACD,KAAK,EAAE,CAAC,CACR,QAAQ,iBAAiB,EAAE;AAChC;;;;;;;;;;AAWA,SAAgB,UAAU,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgB,CAAC,GAAW;CAC1F,OAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,KAAK;AAC7D;;;;;;;;;;AAWA,SAAgB,WAAW,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgB,CAAC,GAAW;CAC3F,OAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,IAAI;AAC5D;;;;;;;;;;AAsBA,SAAgB,UAAU,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgB,CAAC,GAAW;CAE1F,OADkB,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,KACjC,CAAC,CACb,QAAQ,mBAAmB,OAAO,CAAC,CACnC,QAAQ,aAAa,GAA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