@hey-api/openapi-python 0.0.0-next-20260621202931 → 0.0.0-next-20260623210047
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -19
- package/bin/run.js +8 -15
- package/dist/clients/aiohttp/__init__.py +3 -0
- package/dist/clients/aiohttp/client.py +128 -0
- package/dist/clients/requests/__init__.py +3 -0
- package/dist/clients/requests/client.py +128 -0
- package/dist/clients/urllib3/__init__.py +3 -0
- package/dist/clients/urllib3/client.py +128 -0
- package/dist/index-Baeurbo3.d.mts +3319 -0
- package/dist/index-Baeurbo3.d.mts.map +1 -0
- package/dist/index.d.mts +2 -3042
- package/dist/index.mjs +2 -2
- package/dist/plugins.d.mts +2 -9
- package/dist/plugins.mjs +8 -2
- package/dist/plugins.mjs.map +1 -1
- package/dist/{chunk-z9aeyW2b.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
- package/dist/run.mjs +12 -47
- package/dist/run.mjs.map +1 -1
- package/dist/{src-DaXm5pxY.mjs → src-D2qiV4Jp.mjs} +57 -14
- package/dist/src-D2qiV4Jp.mjs.map +1 -0
- package/package.json +5 -5
- package/bin/run.cmd +0 -3
- package/dist/index.d.mts.map +0 -1
- package/dist/plugins.d.mts.map +0 -1
- package/dist/src-DaXm5pxY.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-D2qiV4Jp.mjs","names":["defaultConfig","defineConfig","defaultConfig","defineConfig","defaultConfig","defineConfig","defaultConfig","defineConfig","__filename","__dirname","SYMBOLS.FUNC_TOOLS","SYMBOLS.TYPING","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","Mixed","$","$","$","toNode","toNode","handler","defaultConfig","defineConfig","SYMBOLS.PYDANTIC","SYMBOLS.DATETIME","SYMBOLS.ENUM","SYMBOLS.TYPING","SYMBOLS.UUID","Mixed","$","$","Mixed","$","$","Mixed","$","Mixed","$","$","baseNode","$$","$","constNode","$$","$","baseNode","baseNode","$$","$","baseNode","$$","baseNode","$$","baseNode","$$","constNode","$$","$","baseNode","$$","baseNode","$","$$","constNode","$","baseNode","baseNode","$$","$","baseNode","$$","baseNode","$$","$","baseNode","$$","$$","defineConfig","heyApiClientAiohttp","heyApiClientHttpx","heyApiClientRequests","heyApiClientUrllib3","heyApiSdk","createClient","ms","pCreateClient","defineConfig"],"sources":["../src/config/expand.ts","../src/plugins/@hey-api/client-core/config.ts","../src/plugins/@hey-api/client-aiohttp/config.ts","../src/plugins/@hey-api/client-httpx/config.ts","../src/plugins/@hey-api/client-requests/config.ts","../src/plugins/@hey-api/client-urllib3/config.ts","../src/config/utils.ts","../src/plugins/@hey-api/client-core/utils.ts","../src/generate/client.ts","../src/symbols/datetime.ts","../src/symbols/enum.ts","../src/symbols/func-tools.ts","../src/symbols/pydantic.ts","../src/symbols/typing.ts","../src/symbols/uuid.ts","../src/plugins/@hey-api/sdk/imports.ts","../src/plugins/@hey-api/sdk/operations/resolve.ts","../src/py-compiler/nodes/kinds.ts","../src/py-compiler/nodes/statements/block.ts","../src/py-compiler/nodes/declarations/class.ts","../src/py-compiler/nodes/declarations/function.ts","../src/py-compiler/nodes/declarations/function-parameter.ts","../src/py-compiler/nodes/expressions/async.ts","../src/py-compiler/nodes/expressions/await.ts","../src/py-compiler/nodes/expressions/binary.ts","../src/py-compiler/nodes/expressions/call.ts","../src/py-compiler/nodes/expressions/comprehensions/dict.ts","../src/py-compiler/nodes/expressions/comprehensions/list.ts","../src/py-compiler/nodes/expressions/comprehensions/set.ts","../src/py-compiler/nodes/expressions/dict.ts","../src/py-compiler/nodes/expressions/f-string.ts","../src/py-compiler/nodes/expressions/generator.ts","../src/py-compiler/nodes/expressions/identifier.ts","../src/py-compiler/nodes/expressions/keyword-arg.ts","../src/py-compiler/nodes/expressions/lambda.ts","../src/py-compiler/nodes/expressions/list.ts","../src/py-compiler/nodes/expressions/literal.ts","../src/py-compiler/nodes/expressions/member.ts","../src/py-compiler/nodes/expressions/r-string.ts","../src/py-compiler/nodes/expressions/set.ts","../src/py-compiler/nodes/expressions/subscript.ts","../src/py-compiler/nodes/expressions/subscript-slice.ts","../src/py-compiler/nodes/expressions/tuple.ts","../src/py-compiler/nodes/expressions/yield.ts","../src/py-compiler/nodes/expressions/yield-from.ts","../src/py-compiler/nodes/statements/assignment.ts","../src/py-compiler/nodes/statements/augmented-assignment.ts","../src/py-compiler/nodes/statements/break.ts","../src/py-compiler/nodes/statements/continue.ts","../src/py-compiler/nodes/statements/empty.ts","../src/py-compiler/nodes/statements/except.ts","../src/py-compiler/nodes/statements/expression.ts","../src/py-compiler/nodes/statements/for.ts","../src/py-compiler/nodes/statements/if.ts","../src/py-compiler/nodes/statements/import.ts","../src/py-compiler/nodes/statements/raise.ts","../src/py-compiler/nodes/statements/return.ts","../src/py-compiler/nodes/statements/try.ts","../src/py-compiler/nodes/statements/while.ts","../src/py-compiler/nodes/statements/with.ts","../src/py-compiler/nodes/statements/with-item.ts","../src/py-compiler/nodes/structure/comment.ts","../src/py-compiler/nodes/structure/source-file.ts","../src/py-compiler/nodes/factory.ts","../src/py-compiler/printer.ts","../src/py-compiler/index.ts","../src/py-dsl/base.ts","../src/py-dsl/layout/newline.ts","../src/py-dsl/mixins/decorator.ts","../src/py-dsl/utils/context.ts","../src/py-dsl/layout/doc.ts","../src/py-dsl/mixins/doc.ts","../src/py-dsl/mixins/layout.ts","../src/py-dsl/mixins/modifiers.ts","../src/py-dsl/utils/regexp.ts","../src/py-dsl/utils/keywords.ts","../src/py-dsl/utils/reserved.ts","../src/py-dsl/utils/name.ts","../src/py-dsl/decl/class.ts","../src/py-dsl/decl/enum.ts","../src/py-dsl/mixins/value.ts","../src/py-dsl/decl/field.ts","../src/py-dsl/stmt/stmt.ts","../src/py-dsl/mixins/do.ts","../src/py-dsl/decl/param.ts","../src/py-dsl/mixins/param.ts","../src/py-dsl/mixins/returns.ts","../src/py-dsl/decl/func.ts","../src/py-dsl/decl/method.ts","../src/py-dsl/utils/factories.ts","../src/py-dsl/mixins/expr.ts","../src/py-dsl/expr/attr.ts","../src/py-dsl/expr/binary.ts","../src/py-dsl/mixins/args.ts","../src/py-dsl/expr/call.ts","../src/py-dsl/expr/dict.ts","../src/py-dsl/expr/expr.ts","../src/py-dsl/expr/identifier.ts","../src/py-dsl/utils/r-string.ts","../src/py-dsl/expr/kwarg.ts","../src/py-dsl/expr/list.ts","../src/py-dsl/expr/literal.ts","../src/py-dsl/expr/set.ts","../src/py-dsl/expr/subscript.ts","../src/py-dsl/expr/tuple.ts","../src/py-dsl/layout/hint.ts","../src/py-dsl/stmt/block.ts","../src/py-dsl/stmt/break.ts","../src/py-dsl/stmt/continue.ts","../src/py-dsl/stmt/for.ts","../src/py-dsl/stmt/if.ts","../src/py-dsl/stmt/import.ts","../src/py-dsl/stmt/raise.ts","../src/py-dsl/stmt/return.ts","../src/py-dsl/stmt/try.ts","../src/py-dsl/stmt/var.ts","../src/py-dsl/stmt/while.ts","../src/py-dsl/stmt/with.ts","../src/py-dsl/type/or.ts","../src/py-dsl/type/tuple.ts","../src/py-dsl/utils/lazy.ts","../src/py-dsl/utils/render-utils.ts","../src/py-dsl/utils/render.ts","../src/py-dsl/index.ts","../src/plugins/shared/utils/operation.ts","../src/plugins/@hey-api/sdk/shared/signature.ts","../src/plugins/@hey-api/sdk/shared/operation.ts","../src/plugins/@hey-api/sdk/v1/node.ts","../src/plugins/@hey-api/sdk/v1/plugin.ts","../src/plugins/@hey-api/sdk/plugin.ts","../src/plugins/@hey-api/sdk/config.ts","../src/plugins/pydantic/imports.ts","../src/plugins/pydantic/shared/operation-schema.ts","../src/plugins/pydantic/shared/operation.ts","../src/plugins/pydantic/shared/webhook.ts","../src/plugins/pydantic/dsl/decl/enum.ts","../src/py-dsl/mixins/optional.ts","../src/plugins/pydantic/dsl/utils/literal.ts","../src/plugins/pydantic/dsl/decl/field.ts","../src/plugins/pydantic/v2/constants.ts","../src/plugins/pydantic/shared/base-model.ts","../src/plugins/pydantic/dsl/decl/model.ts","../src/plugins/pydantic/dsl/decl/root-model.ts","../src/plugins/pydantic/dsl/decl/type-alias.ts","../src/plugins/pydantic/dsl/expr/constraints.ts","../src/plugins/pydantic/dsl/expr/constrained-type.ts","../src/plugins/pydantic/dsl/index.ts","../src/plugins/pydantic/shared/export.ts","../src/plugins/pydantic/shared/meta.ts","../src/plugins/pydantic/v2/toAst/array.ts","../src/plugins/pydantic/v2/toAst/boolean.ts","../src/plugins/pydantic/v2/toAst/enum.ts","../src/plugins/pydantic/v2/toAst/intersection.ts","../src/plugins/pydantic/v2/toAst/never.ts","../src/plugins/pydantic/v2/toAst/null.ts","../src/plugins/pydantic/v2/toAst/number.ts","../src/plugins/pydantic/v2/toAst/object.ts","../src/plugins/pydantic/v2/toAst/string.ts","../src/plugins/pydantic/v2/toAst/tuple.ts","../src/plugins/pydantic/v2/toAst/undefined.ts","../src/plugins/pydantic/v2/toAst/union.ts","../src/plugins/pydantic/v2/toAst/unknown.ts","../src/plugins/pydantic/v2/toAst/void.ts","../src/plugins/pydantic/v2/visitor.ts","../src/plugins/pydantic/v2/processor.ts","../src/plugins/pydantic/v2/plugin.ts","../src/plugins/pydantic/plugin.ts","../src/plugins/pydantic/config.ts","../src/plugins/config.ts","../src/config/output/postprocess.ts","../src/config/output/config.ts","../src/config/resolve.ts","../src/config/validate.ts","../src/config/init.ts","../src/generate/output.ts","../src/create-client.ts","../src/generate.ts","../src/index.ts"],"sourcesContent":["import { getInput } from '@hey-api/shared';\nimport colors from 'ansi-colors';\n\nimport type { UserConfig } from './types';\n\nexport interface Job {\n config: UserConfig;\n index: number;\n}\n\nexport function expandToJobs(configs: ReadonlyArray<UserConfig>): ReadonlyArray<Job> {\n const jobs: Array<Job> = [];\n let jobIndex = 0;\n\n for (const config of configs) {\n const inputs = getInput(config);\n const outputs = config.output instanceof Array ? config.output : [config.output];\n\n if (outputs.length === 1) {\n jobs.push({\n config: {\n ...config,\n input: inputs,\n output: outputs[0]!, // output array with single item\n },\n index: jobIndex++,\n });\n } else if (outputs.length > 1 && inputs.length !== outputs.length) {\n // Warn and create job per output (all with same inputs)\n console.warn(\n `⚙️ ${colors.yellow('Warning:')} You provided ${colors.cyan(String(inputs.length))} ${colors.cyan(inputs.length === 1 ? 'input' : 'inputs')} and ${colors.yellow(String(outputs.length))} ${colors.yellow('outputs')}. This will produce identical output in multiple locations. You likely want to provide a single output or the same number of outputs as inputs.`,\n );\n for (const output of outputs) {\n jobs.push({\n config: { ...config, input: inputs, output },\n index: jobIndex++,\n });\n }\n } else if (outputs.length > 1) {\n // Pair inputs with outputs by index\n outputs.forEach((output, index) => {\n jobs.push({\n config: { ...config, input: inputs[index]!, output },\n index: jobIndex++,\n });\n });\n }\n }\n\n return jobs;\n}\n","export const clientDefaultConfig = {\n baseUrl: true,\n bundle: true,\n includeInEntry: false,\n} as const;\n\nexport const clientDefaultMeta = {\n tags: ['client'],\n} as const;\n","import { definePluginConfig } from '@hey-api/shared';\n\nimport { clientDefaultConfig, clientDefaultMeta } from '../client-core/config';\nimport type { HeyApiClientAiohttpPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientAiohttpPlugin['Config'] = {\n ...clientDefaultMeta,\n config: clientDefaultConfig,\n handler() {\n // TODO: handler\n },\n name: '@hey-api/client-aiohttp',\n symbolMeta() {\n return {\n artifact: 'client',\n };\n },\n};\n\n/**\n * Type helper for `@hey-api/client-aiohttp` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import { definePluginConfig } from '@hey-api/shared';\n\nimport { clientDefaultConfig, clientDefaultMeta } from '../client-core/config';\nimport type { HeyApiClientHttpxPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientHttpxPlugin['Config'] = {\n ...clientDefaultMeta,\n config: clientDefaultConfig,\n handler() {\n // TODO: handler\n },\n name: '@hey-api/client-httpx',\n symbolMeta() {\n return {\n artifact: 'client',\n };\n },\n};\n\n/**\n * Type helper for `@hey-api/client-httpx` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import { definePluginConfig } from '@hey-api/shared';\n\nimport { clientDefaultConfig, clientDefaultMeta } from '../client-core/config';\nimport type { HeyApiClientRequestsPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientRequestsPlugin['Config'] = {\n ...clientDefaultMeta,\n config: clientDefaultConfig,\n handler() {\n // TODO: handler\n },\n name: '@hey-api/client-requests',\n symbolMeta() {\n return {\n artifact: 'client',\n };\n },\n};\n\n/**\n * Type helper for `@hey-api/client-requests` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import { definePluginConfig } from '@hey-api/shared';\n\nimport { clientDefaultConfig, clientDefaultMeta } from '../client-core/config';\nimport type { HeyApiClientUrllib3Plugin } from './types';\n\nexport const defaultConfig: HeyApiClientUrllib3Plugin['Config'] = {\n ...clientDefaultMeta,\n config: clientDefaultConfig,\n handler() {\n // TODO: handler\n },\n name: '@hey-api/client-urllib3',\n symbolMeta() {\n return {\n artifact: 'client',\n };\n },\n};\n\n/**\n * Type helper for `@hey-api/client-urllib3` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import type { Context, PluginInstance } from '@hey-api/shared';\n\nimport type { Config } from './types';\n\nexport function getTypedConfig(\n plugin: Pick<PluginInstance, 'context'> | Pick<Context, 'config'>,\n): Config {\n if ('context' in plugin) {\n return plugin.context.config as Config;\n }\n return plugin.config as Config;\n}\n","import type { Config } from '../../../config/types';\nimport type { PluginClientNames } from '../../types';\n\nexport function getClientPlugin(\n config: Config,\n): Config['plugins'][PluginClientNames] & { name: PluginClientNames } {\n for (const name of config.pluginOrder) {\n const plugin = config.plugins[name];\n if (plugin?.tags?.includes('client')) {\n return plugin as Config['plugins'][PluginClientNames] & {\n name: PluginClientNames;\n };\n }\n }\n\n return {\n config: {\n // @ts-expect-error\n name: '',\n },\n // @ts-expect-error\n name: '',\n };\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { IProject } from '@hey-api/codegen-core';\nimport type { DefinePlugin, OutputHeader } from '@hey-api/shared';\nimport { ensureDirSync, isEnvironment, outputHeaderToPrefix } from '@hey-api/shared';\n\nimport type { Config } from '../config/types';\nimport type { Client } from '../plugins/@hey-api/client-core/types';\nimport { getClientPlugin } from '../plugins/@hey-api/client-core/utils';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n/**\n * Returns paths to client bundle files based on execution context\n */\nfunction getClientBundlePaths(pluginName: string): {\n clientPath: string;\n corePath: string;\n} {\n const clientName = pluginName.slice('@hey-api/client-'.length);\n\n if (isEnvironment('development')) {\n // Dev: source bundle folders at src/plugins/@hey-api/{client}/bundle\n const pluginsDir = path.resolve(__dirname, '..', 'plugins', '@hey-api');\n return {\n clientPath: path.resolve(pluginsDir, `client-${clientName}`, 'bundle'),\n corePath: path.resolve(pluginsDir, 'client-core', 'bundle'),\n };\n }\n\n // Prod: copied to dist/clients/{clientName}\n return {\n clientPath: path.resolve(__dirname, 'clients', clientName),\n corePath: path.resolve(__dirname, 'clients', 'core'),\n };\n}\n\n/**\n * Returns absolute path to the client folder. This is hard-coded for now.\n */\nexport function clientFolderAbsolutePath(config: Config): string {\n const client = getClientPlugin(config);\n\n if ('bundle' in client.config && client.config.bundle) {\n // not proud of this one\n const renamed: Map<string, string> | undefined =\n // @ts-expect-error\n config._FRAGILE_CLIENT_BUNDLE_RENAMED;\n return path.resolve(config.output.path, 'client', `${renamed?.get('index') ?? 'index'}.py`);\n }\n\n return client.name;\n}\n\n/**\n * Recursively copies files and directories.\n * This is a PnP-compatible alternative to fs.cpSync that works with Yarn PnP's\n * virtualized filesystem.\n */\nfunction copyRecursivePnP(src: string, dest: string): void {\n const stat = fs.statSync(src);\n\n if (stat.isDirectory()) {\n if (!fs.existsSync(dest)) {\n fs.mkdirSync(dest, { recursive: true });\n }\n\n const files = fs.readdirSync(src);\n for (const file of files) {\n copyRecursivePnP(path.join(src, file), path.join(dest, file));\n }\n } else {\n const content = fs.readFileSync(src);\n fs.writeFileSync(dest, content);\n }\n}\n\nfunction renameFile({\n filePath,\n project,\n renamed,\n}: {\n filePath: string;\n project: IProject;\n renamed: Map<string, string>;\n}): void {\n const extension = path.extname(filePath);\n const name = path.basename(filePath, extension);\n const renamedName = project.fileName?.(name) || name;\n if (renamedName !== name) {\n const outputPath = path.dirname(filePath);\n fs.renameSync(filePath, path.resolve(outputPath, `${renamedName}${extension}`));\n renamed.set(name, renamedName);\n }\n}\n\nfunction replaceImports({\n filePath,\n header,\n renamed,\n}: {\n filePath: string;\n header?: string;\n renamed: Map<string, string>;\n}): void {\n let content = fs.readFileSync(filePath, 'utf8');\n\n // Dev mode: rewrite source bundle imports to match output structure\n if (isEnvironment('development')) {\n // ...client_core.bundle.foo -> ..core.foo\n content = content.replace(\n /from\\s+(\\.{3,})\\.?client_core\\.bundle\\./g,\n (match, dots) => `from ${dots === '...' ? '..' : dots.slice(0, -1)}core.`,\n );\n // ...client_core.bundle (index import) -> ..core\n content = content.replace(\n /from\\s+(\\.{3,})\\.?client_core\\.bundle['\"]?/g,\n (match, dots) => `from ${dots === '...' ? '..' : dots.slice(0, -1)}core`,\n );\n }\n\n content = content.replace(/from\\s+(.+?)\\s+import/g, (match, importPath) => {\n const cleanPath = importPath.replace(/^['\"]|['\"]$/g, '');\n if (!cleanPath.startsWith('.')) return match;\n const leadingDots = cleanPath.match(/^\\.+/)?.[0] || '';\n const moduleName = cleanPath.replace(/^\\.+/, '');\n if (!moduleName) return match;\n const replacedName = renamed.get(moduleName) ?? moduleName;\n return `from ${leadingDots}${replacedName} import`;\n });\n\n const fileHeader = header ?? '';\n\n content = `${fileHeader}${content}`;\n\n fs.writeFileSync(filePath, content, 'utf8');\n}\n\n/**\n * Creates a `client` folder containing the same modules as the client package.\n */\nexport function generateClientBundle({\n header,\n outputPath,\n plugin,\n project,\n}: {\n header?: OutputHeader;\n outputPath: string;\n plugin: DefinePlugin<Client.Config & { name: string }>['Config'];\n project: IProject;\n}): Map<string, string> | undefined {\n const renamed = new Map<string, string>();\n const headerPrefix = outputHeaderToPrefix({\n defaultValue: ['# This file is auto-generated by @hey-api/openapi-python'],\n header,\n project,\n });\n\n // copy Hey API clients to output\n const isHeyApiClientPlugin = plugin.name.startsWith('@hey-api/client-');\n if (isHeyApiClientPlugin) {\n const { clientPath } = getClientBundlePaths(plugin.name);\n // const { clientPath, corePath } = getClientBundlePaths(plugin.name);\n\n // copy client core\n // const coreOutputPath = path.resolve(outputPath, 'core');\n // ensureDirSync(coreOutputPath);\n // copyRecursivePnP(corePath, coreOutputPath);\n\n // copy client bundle\n const clientOutputPath = path.resolve(outputPath, 'client');\n ensureDirSync(clientOutputPath);\n copyRecursivePnP(clientPath, clientOutputPath);\n\n if (project) {\n // const copiedCoreFiles = fs.readdirSync(coreOutputPath);\n // for (const file of copiedCoreFiles) {\n // renameFile({\n // filePath: path.resolve(coreOutputPath, file),\n // project,\n // renamed,\n // });\n // }\n\n const copiedClientFiles = fs.readdirSync(clientOutputPath);\n for (const file of copiedClientFiles) {\n renameFile({\n filePath: path.resolve(clientOutputPath, file),\n project,\n renamed,\n });\n }\n }\n\n // const coreFiles = fs.readdirSync(coreOutputPath);\n // for (const file of coreFiles) {\n // replaceImports({\n // filePath: path.resolve(coreOutputPath, file),\n // renamed,\n // });\n // }\n\n const clientFiles = fs.readdirSync(clientOutputPath);\n for (const file of clientFiles) {\n replaceImports({\n filePath: path.resolve(clientOutputPath, file),\n header: headerPrefix,\n renamed,\n });\n }\n return renamed;\n }\n\n const clientSrcPath = path.isAbsolute(plugin.name) ? path.dirname(plugin.name) : undefined;\n\n // copy custom local client to output\n if (clientSrcPath) {\n const dirPath = path.resolve(outputPath, 'client');\n ensureDirSync(dirPath);\n copyRecursivePnP(clientSrcPath, dirPath);\n return;\n }\n\n // copy third-party client to output\n const clientModulePath = path.normalize(require.resolve(plugin.name));\n const clientModulePathComponents = clientModulePath.split(path.sep);\n const clientDistPath = clientModulePathComponents\n .slice(0, clientModulePathComponents.indexOf('dist') + 1)\n .join(path.sep);\n\n const indexJsFile = clientModulePathComponents[clientModulePathComponents.length - 1];\n const distFiles = [indexJsFile!, 'index.d.mts', 'index.d.cts'];\n const dirPath = path.resolve(outputPath, 'client');\n ensureDirSync(dirPath);\n for (const file of distFiles) {\n fs.copyFileSync(path.resolve(clientDistPath, file), path.resolve(dirPath, file));\n }\n\n return;\n}\n","import type { SymbolFactory } from '@hey-api/shared';\n\nexport function DATETIME(factory: SymbolFactory) {\n return {\n date: factory.register('date', { external: 'datetime' }),\n datetime: factory.register('datetime', { external: 'datetime' }),\n time: factory.register('time', { external: 'datetime' }),\n timedelta: factory.register('timedelta', { external: 'datetime' }),\n };\n}\n\nexport type DateTimeSymbols = ReturnType<typeof DATETIME>;\n","import type { SymbolFactory } from '@hey-api/shared';\n\nexport function ENUM(factory: SymbolFactory) {\n return {\n Enum: factory.register('Enum', { external: 'enum' }),\n IntEnum: factory.register('IntEnum', { external: 'enum' }),\n StrEnum: factory.register('StrEnum', { external: 'enum' }),\n };\n}\n\nexport type EnumSymbols = ReturnType<typeof ENUM>;\n","import type { SymbolFactory } from '@hey-api/shared';\n\nexport function FUNC_TOOLS(factory: SymbolFactory) {\n return {\n cachedProperty: factory.register('cached_property', {\n external: 'functools',\n }),\n };\n}\n\nexport type FuncToolsSymbols = ReturnType<typeof FUNC_TOOLS>;\n","import type { SymbolChild } from '@hey-api/codegen-core';\nimport type { SymbolFactory } from '@hey-api/shared';\n\nexport function PYDANTIC(factory: SymbolFactory) {\n const BASE_MODEL_CHILDREN = [\n // v2 model_* API\n {\n kind: 'function',\n name: 'model_computed_fields',\n },\n {\n kind: 'var',\n name: 'model_config',\n },\n {\n kind: 'function',\n name: 'model_construct',\n },\n {\n kind: 'function',\n name: 'model_copy',\n },\n {\n kind: 'function',\n name: 'model_dump_json',\n },\n {\n kind: 'function',\n name: 'model_dump',\n },\n {\n kind: 'var',\n name: 'model_extra',\n },\n {\n kind: 'var',\n name: 'model_fields_set',\n },\n {\n kind: 'function',\n name: 'model_fields',\n },\n {\n kind: 'function',\n name: 'model_json_schema',\n },\n {\n kind: 'function',\n name: 'model_parametrized_name',\n },\n {\n kind: 'function',\n name: 'model_post_init',\n },\n {\n kind: 'function',\n name: 'model_rebuild',\n },\n {\n kind: 'function',\n name: 'model_validate_json',\n },\n {\n kind: 'function',\n name: 'model_validate_strings',\n },\n {\n kind: 'function',\n name: 'model_validate',\n },\n // v1 carryovers still present on BaseModel\n {\n kind: 'function',\n name: 'construct',\n },\n {\n kind: 'function',\n name: 'copy',\n },\n {\n kind: 'function',\n name: 'dict',\n },\n {\n kind: 'function',\n name: 'from_orm',\n },\n {\n kind: 'function',\n name: 'json',\n },\n {\n kind: 'function',\n name: 'parse_file',\n },\n {\n kind: 'function',\n name: 'parse_obj',\n },\n {\n kind: 'function',\n name: 'parse_raw',\n },\n {\n kind: 'function',\n name: 'schema_json',\n },\n {\n kind: 'function',\n name: 'schema',\n },\n {\n kind: 'function',\n name: 'validate',\n },\n ] as const satisfies ReadonlyArray<SymbolChild>;\n\n return {\n AnyUrl: factory.register('AnyUrl', { external: 'pydantic' }),\n BaseModel: factory.register('BaseModel', {\n children: [...BASE_MODEL_CHILDREN],\n external: 'pydantic',\n }),\n ConfigDict: factory.register('ConfigDict', { external: 'pydantic' }),\n EmailStr: factory.register('EmailStr', { external: 'pydantic' }),\n Field: factory.register('Field', { external: 'pydantic' }),\n RootModel: factory.register('RootModel', {\n children: [...BASE_MODEL_CHILDREN, { kind: 'var', name: 'root' }],\n external: 'pydantic',\n }),\n dataclass: factory.register('dataclass', { external: 'pydantic.dataclasses' }),\n };\n}\n\nexport type PydanticSymbols = ReturnType<typeof PYDANTIC>;\n","import type { SymbolFactory } from '@hey-api/shared';\n\nexport function TYPING(factory: SymbolFactory) {\n return {\n Annotated: factory.register('Annotated', { external: 'typing' }),\n Any: factory.register('Any', { external: 'typing' }),\n Literal: factory.register('Literal', { external: 'typing' }),\n NoReturn: factory.register('NoReturn', { external: 'typing' }),\n Optional: factory.register('Optional', { external: 'typing' }),\n Tuple: factory.register('Tuple', { external: 'typing' }),\n TypeAlias: factory.register('TypeAlias', { external: 'typing' }),\n Union: factory.register('Union', { external: 'typing' }),\n };\n}\n\nexport type TypingSymbols = ReturnType<typeof TYPING>;\n","import type { SymbolFactory } from '@hey-api/shared';\n\nexport function UUID(factory: SymbolFactory) {\n return {\n UUID: factory.register('UUID', { external: 'uuid' }),\n };\n}\n\nexport type UUIDSymbols = ReturnType<typeof UUID>;\n","import type { PluginInstance } from '@hey-api/shared';\n\nimport { getTypedConfig } from '../../../config/utils';\nimport { clientFolderAbsolutePath } from '../../../generate/client';\nimport * as SYMBOLS from '../../../symbols';\n\nexport function sdkImports(plugin: PluginInstance) {\n const clientModule = clientFolderAbsolutePath(getTypedConfig(plugin));\n const factory = plugin.symbolFactory;\n\n return {\n Client: factory.register('Client', {\n external: clientModule,\n meta: {\n resource: 'client.Client',\n },\n }),\n buildClientParams: factory.register('build_client_params', {\n external: clientModule,\n meta: {\n resource: 'client.build_client_params',\n },\n }),\n funcTools: SYMBOLS.FUNC_TOOLS(factory),\n typing: SYMBOLS.TYPING(factory),\n };\n}\n\nexport type SdkImports = ReturnType<typeof sdkImports>;\n","import type { OperationPathStrategy, OperationStructureStrategy } from '@hey-api/shared';\nimport { OperationPath, OperationStrategy } from '@hey-api/shared';\n\nimport type { HeyApiSdkPlugin } from '../types';\n\nfunction resolvePath(plugin: HeyApiSdkPlugin['Instance']): OperationPathStrategy {\n if (plugin.config.operations.nesting === 'id') {\n return OperationPath.id();\n }\n\n if (plugin.config.operations.nesting === 'operationId') {\n return OperationPath.fromOperationId({\n delimiters: plugin.config.operations.nestingDelimiters,\n fallback: OperationPath.id(),\n });\n }\n\n return plugin.config.operations.nesting;\n}\n\nexport function resolveStrategy(plugin: HeyApiSdkPlugin['Instance']): OperationStructureStrategy {\n // if (plugin.config.operations.strategy === 'flat') {\n // return OperationStrategy.flat({\n // path: (operation) => [resolvePath(plugin)(operation).join('.')],\n // });\n // }\n\n if (plugin.config.operations.strategy === 'single') {\n const root = plugin.config.operations.containerName;\n return OperationStrategy.single({\n path: resolvePath(plugin),\n root: typeof root.name === 'string' ? root.name : (root.name?.('') ?? ''),\n });\n }\n\n if (plugin.config.operations.strategy === 'byTags') {\n return OperationStrategy.byTags({\n fallback: plugin.config.operations.strategyDefaultTag,\n path: resolvePath(plugin),\n });\n }\n\n return plugin.config.operations.strategy;\n}\n","export enum PyNodeKind {\n Assignment = 'Assignment',\n AsyncExpression = 'AsyncExpression',\n AugmentedAssignment = 'AugmentedAssignment',\n AwaitExpression = 'AwaitExpression',\n BinaryExpression = 'BinaryExpression',\n Block = 'Block',\n BreakStatement = 'BreakStatement',\n CallExpression = 'CallExpression',\n ClassDeclaration = 'ClassDeclaration',\n Comment = 'Comment',\n ContinueStatement = 'ContinueStatement',\n DictComprehension = 'DictComprehension',\n DictExpression = 'DictExpression',\n EmptyStatement = 'EmptyStatement',\n ExceptClause = 'ExceptClause',\n ExpressionStatement = 'ExpressionStatement',\n FStringExpression = 'FStringExpression',\n ForStatement = 'ForStatement',\n FunctionDeclaration = 'FunctionDeclaration',\n FunctionParameter = 'FunctionParameter',\n GeneratorExpression = 'GeneratorExpression',\n Identifier = 'Identifier',\n IfStatement = 'IfStatement',\n ImportStatement = 'ImportStatement',\n KeywordArgument = 'KeywordArgument',\n LambdaExpression = 'LambdaExpression',\n ListComprehension = 'ListComprehension',\n ListExpression = 'ListExpression',\n Literal = 'Literal',\n MemberExpression = 'MemberExpression',\n RStringExpression = 'RStringExpression',\n RaiseStatement = 'RaiseStatement',\n ReturnStatement = 'ReturnStatement',\n SetComprehension = 'SetComprehension',\n SetExpression = 'SetExpression',\n SourceFile = 'SourceFile',\n SubscriptExpression = 'SubscriptExpression',\n SubscriptSlice = 'SubscriptSlice',\n TryStatement = 'TryStatement',\n TupleExpression = 'TupleExpression',\n WhileStatement = 'WhileStatement',\n WithItem = 'WithItem',\n WithStatement = 'WithStatement',\n YieldExpression = 'YieldExpression',\n YieldFromExpression = 'YieldFromExpression',\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\n\nexport interface PyBlock extends PyNodeBase {\n kind: PyNodeKind.Block;\n statements: ReadonlyArray<PyStatement>;\n}\n\nexport function createBlock(\n statements: ReadonlyArray<PyStatement>,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyBlock {\n return {\n kind: PyNodeKind.Block,\n leadingComments,\n statements,\n trailingComments,\n };\n}\n","import type { PyNode, PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport type { PyBlock } from '../statements/block';\nimport { createBlock } from '../statements/block';\n\nexport interface PyClassDeclaration extends PyNodeBase {\n baseClasses?: ReadonlyArray<PyNode>;\n body: PyBlock;\n decorators?: ReadonlyArray<PyExpression>;\n docstring?: string;\n kind: PyNodeKind.ClassDeclaration;\n name: string;\n}\n\nexport function createClassDeclaration(\n name: string,\n body: ReadonlyArray<PyStatement>,\n decorators?: ReadonlyArray<PyExpression>,\n baseClasses?: ReadonlyArray<PyNode>,\n docstring?: string,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyClassDeclaration {\n return {\n baseClasses,\n body: createBlock(body),\n decorators,\n docstring,\n kind: PyNodeKind.ClassDeclaration,\n leadingComments,\n name,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport type { PyBlock } from '../statements/block';\nimport { createBlock } from '../statements/block';\nimport type { PyFunctionParameter } from './function-parameter';\n\nexport interface PyFunctionDeclaration extends PyNodeBase {\n body: PyBlock;\n decorators?: ReadonlyArray<PyExpression>;\n docstring?: string;\n kind: PyNodeKind.FunctionDeclaration;\n modifiers?: ReadonlyArray<PyExpression>;\n name: string;\n parameters: ReadonlyArray<PyFunctionParameter>;\n returnType?: PyExpression;\n}\n\nexport function createFunctionDeclaration(\n name: string,\n parameters: ReadonlyArray<PyFunctionParameter>,\n returnType: PyExpression | undefined,\n body: ReadonlyArray<PyStatement>,\n decorators?: ReadonlyArray<PyExpression>,\n docstring?: string,\n modifiers?: ReadonlyArray<PyExpression>,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyFunctionDeclaration {\n return {\n body: createBlock(body),\n decorators,\n docstring,\n kind: PyNodeKind.FunctionDeclaration,\n leadingComments,\n modifiers,\n name,\n parameters,\n returnType,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyFunctionParameter extends PyNodeBase {\n defaultValue?: PyExpression;\n kind: PyNodeKind.FunctionParameter;\n name: string;\n type?: PyExpression;\n}\n\nexport function createFunctionParameter(\n name: string,\n type?: PyExpression,\n defaultValue?: PyExpression,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyFunctionParameter {\n return {\n defaultValue,\n kind: PyNodeKind.FunctionParameter,\n leadingComments,\n name,\n trailingComments,\n type,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyAsyncExpression extends PyNodeBase {\n expression: PyExpression;\n kind: PyNodeKind.AsyncExpression;\n}\n\nexport function createAsyncExpression(expression: PyExpression): PyAsyncExpression {\n return {\n expression,\n kind: PyNodeKind.AsyncExpression,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyAwaitExpression extends PyNodeBase {\n expression: PyExpression;\n kind: PyNodeKind.AwaitExpression;\n}\n\nexport function createAwaitExpression(expression: PyExpression): PyAwaitExpression {\n return {\n expression,\n kind: PyNodeKind.AwaitExpression,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport type PyBinaryOperator =\n | '+'\n | '-'\n | '*'\n | '/'\n | '//'\n | '%'\n | '**'\n | '=='\n | '!='\n | '>'\n | '>='\n | '<'\n | '<='\n | 'is'\n | 'is not'\n | 'in'\n | 'not in'\n | 'and'\n | 'or'\n | '|'\n | '&'\n | '^'\n | '<<'\n | '>>';\n\nexport interface PyBinaryExpression extends PyNodeBase {\n kind: PyNodeKind.BinaryExpression;\n left: PyExpression;\n operator: PyBinaryOperator;\n right: PyExpression;\n}\n\nexport function createBinaryExpression(\n left: PyExpression,\n operator: PyBinaryOperator,\n right: PyExpression,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyBinaryExpression {\n return {\n kind: PyNodeKind.BinaryExpression,\n leadingComments,\n left,\n operator,\n right,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyCallExpression extends PyNodeBase {\n args: ReadonlyArray<PyExpression>;\n callee: PyExpression;\n kind: PyNodeKind.CallExpression;\n}\n\nexport function createCallExpression(\n callee: PyExpression,\n args: ReadonlyArray<PyExpression>,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyCallExpression {\n return {\n args,\n callee,\n kind: PyNodeKind.CallExpression,\n leadingComments,\n trailingComments,\n };\n}\n","import type { PyComprehensionNode } from '../../comprehension';\nimport type { PyExpression } from '../../expression';\nimport { PyNodeKind } from '../../kinds';\n\nexport interface PyDictComprehension extends PyComprehensionNode {\n key: PyExpression;\n kind: PyNodeKind.DictComprehension;\n value: PyExpression;\n}\n\nexport function createDictComprehension(\n key: PyExpression,\n value: PyExpression,\n target: PyExpression,\n iterable: PyExpression,\n ifs?: ReadonlyArray<PyExpression>,\n isAsync?: boolean,\n): PyDictComprehension {\n return {\n ifs,\n isAsync,\n iterable,\n key,\n kind: PyNodeKind.DictComprehension,\n target,\n value,\n };\n}\n","import type { PyComprehensionNode } from '../../comprehension';\nimport type { PyExpression } from '../../expression';\nimport { PyNodeKind } from '../../kinds';\n\nexport interface PyListComprehension extends PyComprehensionNode {\n element: PyExpression;\n kind: PyNodeKind.ListComprehension;\n}\n\nexport function createListComprehension(\n element: PyExpression,\n target: PyExpression,\n iterable: PyExpression,\n ifs?: ReadonlyArray<PyExpression>,\n isAsync?: boolean,\n): PyListComprehension {\n return {\n element,\n ifs,\n isAsync,\n iterable,\n kind: PyNodeKind.ListComprehension,\n target,\n };\n}\n","import type { PyComprehensionNode } from '../../comprehension';\nimport type { PyExpression } from '../../expression';\nimport { PyNodeKind } from '../../kinds';\n\nexport interface PySetComprehension extends PyComprehensionNode {\n element: PyExpression;\n kind: PyNodeKind.SetComprehension;\n}\n\nexport function createSetComprehension(\n element: PyExpression,\n target: PyExpression,\n iterable: PyExpression,\n ifs?: ReadonlyArray<PyExpression>,\n isAsync?: boolean,\n): PySetComprehension {\n return {\n element,\n ifs,\n isAsync,\n iterable,\n kind: PyNodeKind.SetComprehension,\n target,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyDictExpression extends PyNodeBase {\n entries: ReadonlyArray<{\n key: PyExpression;\n value: PyExpression;\n }>;\n kind: PyNodeKind.DictExpression;\n}\n\nexport function createDictExpression(\n entries: ReadonlyArray<{ key: PyExpression; value: PyExpression }>,\n): PyDictExpression {\n return {\n entries,\n kind: PyNodeKind.DictExpression,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyFStringExpression extends PyNodeBase {\n kind: PyNodeKind.FStringExpression;\n parts: Array<string | PyExpression>;\n}\n\nexport function createFStringExpression(\n parts: Array<string | PyExpression>,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyFStringExpression {\n return {\n kind: PyNodeKind.FStringExpression,\n leadingComments,\n parts,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyGeneratorExpression extends PyNodeBase {\n element: PyExpression;\n ifs?: ReadonlyArray<PyExpression>;\n isAsync?: boolean;\n iterable: PyExpression;\n kind: PyNodeKind.GeneratorExpression;\n target: PyExpression;\n}\n\nexport function createGeneratorExpression(\n element: PyExpression,\n target: PyExpression,\n iterable: PyExpression,\n ifs?: ReadonlyArray<PyExpression>,\n isAsync?: boolean,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyGeneratorExpression {\n return {\n element,\n ifs,\n isAsync,\n iterable,\n kind: PyNodeKind.GeneratorExpression,\n leadingComments,\n target,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyIdentifier extends PyNodeBase {\n kind: PyNodeKind.Identifier;\n name: string;\n}\n\nexport function createIdentifier(\n name: string,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyIdentifier {\n return {\n kind: PyNodeKind.Identifier,\n leadingComments,\n name,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyKeywordArgument extends PyNodeBase {\n kind: PyNodeKind.KeywordArgument;\n name: string;\n value: PyExpression;\n}\n\nexport function createKeywordArgument(\n name: string,\n value: PyExpression,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyKeywordArgument {\n return {\n kind: PyNodeKind.KeywordArgument,\n leadingComments,\n name,\n trailingComments,\n value,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyFunctionParameter } from '../declarations/function-parameter';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyLambdaExpression extends PyNodeBase {\n expression: PyExpression;\n kind: PyNodeKind.LambdaExpression;\n parameters: ReadonlyArray<PyFunctionParameter>;\n}\n\nexport function createLambdaExpression(\n parameters: ReadonlyArray<PyFunctionParameter>,\n expression: PyExpression,\n): PyLambdaExpression {\n return {\n expression,\n kind: PyNodeKind.LambdaExpression,\n parameters,\n };\n}\n","import type { PyNode, PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyListExpression extends PyNodeBase {\n elements: ReadonlyArray<PyNode>;\n kind: PyNodeKind.ListExpression;\n}\n\nexport function createListExpression(elements: ReadonlyArray<PyNode>): PyListExpression {\n return {\n elements,\n kind: PyNodeKind.ListExpression,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport type PyLiteralValue = string | number | boolean | null;\n\nexport interface PyLiteral extends PyNodeBase {\n kind: PyNodeKind.Literal;\n value: PyLiteralValue;\n}\n\nexport function createLiteral(\n value: PyLiteralValue,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyLiteral {\n return {\n kind: PyNodeKind.Literal,\n leadingComments,\n trailingComments,\n value,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\nimport type { PyIdentifier } from './identifier';\n\nexport interface PyMemberExpression extends PyNodeBase {\n kind: PyNodeKind.MemberExpression;\n member: PyIdentifier;\n object: PyExpression;\n}\n\nexport function createMemberExpression(\n object: PyExpression,\n member: PyIdentifier,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyMemberExpression {\n return {\n kind: PyNodeKind.MemberExpression,\n leadingComments,\n member,\n object,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyRStringExpression extends PyNodeBase {\n kind: PyNodeKind.RStringExpression;\n value: string;\n}\n\nexport function createRStringExpression(\n value: string,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyRStringExpression {\n return {\n kind: PyNodeKind.RStringExpression,\n leadingComments,\n trailingComments,\n value,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PySetExpression extends PyNodeBase {\n elements: ReadonlyArray<PyExpression>;\n kind: PyNodeKind.SetExpression;\n}\n\nexport function createSetExpression(elements: ReadonlyArray<PyExpression>): PySetExpression {\n return {\n elements,\n kind: PyNodeKind.SetExpression,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PySubscriptExpression extends PyNodeBase {\n kind: PyNodeKind.SubscriptExpression;\n slice: PyExpression;\n value: PyExpression;\n}\n\nexport function createSubscriptExpression(\n value: PyExpression,\n slice: PyExpression,\n): PySubscriptExpression {\n return {\n kind: PyNodeKind.SubscriptExpression,\n slice,\n value,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PySubscriptSlice extends PyNodeBase {\n elements: ReadonlyArray<PyExpression>;\n kind: PyNodeKind.SubscriptSlice;\n}\n\nexport function createSubscriptSlice(elements: ReadonlyArray<PyExpression>): PySubscriptSlice {\n return {\n elements,\n kind: PyNodeKind.SubscriptSlice,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyTupleExpression extends PyNodeBase {\n elements: ReadonlyArray<PyExpression>;\n kind: PyNodeKind.TupleExpression;\n}\n\nexport function createTupleExpression(elements: ReadonlyArray<PyExpression>): PyTupleExpression {\n return {\n elements,\n kind: PyNodeKind.TupleExpression,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyYieldExpression extends PyNodeBase {\n kind: PyNodeKind.YieldExpression;\n value?: PyExpression;\n}\n\nexport function createYieldExpression(value?: PyExpression): PyYieldExpression {\n return {\n kind: PyNodeKind.YieldExpression,\n value,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyYieldFromExpression extends PyNodeBase {\n expression: PyExpression;\n kind: PyNodeKind.YieldFromExpression;\n}\n\nexport function createYieldFromExpression(expression: PyExpression): PyYieldFromExpression {\n return {\n expression,\n kind: PyNodeKind.YieldFromExpression,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyAssignment extends PyNodeBase {\n kind: PyNodeKind.Assignment;\n target: PyExpression;\n type?: PyExpression;\n value?: PyExpression;\n}\n\nexport function createAssignment(\n target: PyExpression,\n type?: PyExpression,\n value?: PyExpression,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyAssignment {\n if (!type && !value) {\n throw new Error('Assignment requires at least type or value');\n }\n\n return {\n kind: PyNodeKind.Assignment,\n leadingComments,\n target,\n trailingComments,\n type,\n value,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport type PyAugmentedOperator =\n | '+='\n | '-='\n | '*='\n | '/='\n | '//='\n | '%='\n | '**='\n | '&='\n | '|='\n | '^='\n | '>>='\n | '<<=';\n\nexport interface PyAugmentedAssignment extends PyNodeBase {\n kind: PyNodeKind.AugmentedAssignment;\n operator: PyAugmentedOperator;\n target: PyExpression;\n value: PyExpression;\n}\n\nexport function createAugmentedAssignment(\n target: PyExpression,\n operator: PyAugmentedOperator,\n value: PyExpression,\n): PyAugmentedAssignment {\n return {\n kind: PyNodeKind.AugmentedAssignment,\n operator,\n target,\n value,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyBreakStatement extends PyNodeBase {\n kind: PyNodeKind.BreakStatement;\n}\n\nexport function createBreakStatement(): PyBreakStatement {\n return {\n kind: PyNodeKind.BreakStatement,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyContinueStatement extends PyNodeBase {\n kind: PyNodeKind.ContinueStatement;\n}\n\nexport function createContinueStatement(): PyContinueStatement {\n return {\n kind: PyNodeKind.ContinueStatement,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyEmptyStatement extends PyNodeBase {\n kind: PyNodeKind.EmptyStatement;\n}\n\nexport function createEmptyStatement(): PyEmptyStatement {\n return {\n kind: PyNodeKind.EmptyStatement,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport type { PyIdentifier } from '../expressions/identifier';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport { createBlock, type PyBlock } from './block';\n\nexport interface PyExceptClause extends PyNodeBase {\n block: PyBlock;\n exceptionName?: PyIdentifier;\n exceptionType?: PyExpression;\n kind: PyNodeKind.ExceptClause;\n}\n\nexport function createExceptClause(\n block: ReadonlyArray<PyStatement>,\n exceptionType?: PyExpression,\n exceptionName?: PyIdentifier,\n): PyExceptClause {\n return {\n block: createBlock(block),\n exceptionName,\n exceptionType,\n kind: PyNodeKind.ExceptClause,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyExpressionStatement extends PyNodeBase {\n expression: PyExpression;\n kind: PyNodeKind.ExpressionStatement;\n}\n\nexport function createExpressionStatement(expression: PyExpression): PyExpressionStatement {\n return {\n expression,\n kind: PyNodeKind.ExpressionStatement,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport type { PyBlock } from './block';\nimport { createBlock } from './block';\n\nexport interface PyForStatement extends PyNodeBase {\n body: PyBlock;\n elseBlock?: PyBlock;\n iterable: PyExpression;\n kind: PyNodeKind.ForStatement;\n target: PyExpression;\n}\n\nexport function createForStatement(\n target: PyExpression,\n iterable: PyExpression,\n body: ReadonlyArray<PyStatement>,\n elseBlock?: ReadonlyArray<PyStatement>,\n): PyForStatement {\n return {\n body: createBlock(body),\n elseBlock: elseBlock ? createBlock(elseBlock) : undefined,\n iterable,\n kind: PyNodeKind.ForStatement,\n target,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport { createBlock, type PyBlock } from './block';\n\nexport interface PyIfStatement extends PyNodeBase {\n condition: PyExpression;\n elseBlock?: PyBlock | PyIfStatement;\n kind: PyNodeKind.IfStatement;\n thenBlock: PyBlock;\n}\n\nexport function createIfStatement(\n condition: PyExpression,\n thenBlock: ReadonlyArray<PyStatement>,\n elseBlock?: ReadonlyArray<PyStatement> | PyIfStatement,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyIfStatement {\n return {\n condition,\n elseBlock: elseBlock instanceof Array ? createBlock(elseBlock) : elseBlock,\n kind: PyNodeKind.IfStatement,\n leadingComments,\n thenBlock: createBlock(thenBlock),\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyImportStatement extends PyNodeBase {\n isFrom: boolean;\n kind: PyNodeKind.ImportStatement;\n module: string;\n names?: ReadonlyArray<{ alias?: string; name: string }>;\n}\n\nexport function createImportStatement(\n module: string,\n names?: ReadonlyArray<{ alias?: string; name: string }>,\n isFrom: boolean = false,\n): PyImportStatement {\n return {\n isFrom,\n kind: PyNodeKind.ImportStatement,\n module,\n names,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyRaiseStatement extends PyNodeBase {\n expression?: PyExpression;\n kind: PyNodeKind.RaiseStatement;\n}\n\nexport function createRaiseStatement(expression?: PyExpression): PyRaiseStatement {\n return {\n expression,\n kind: PyNodeKind.RaiseStatement,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyReturnStatement extends PyNodeBase {\n expression?: PyExpression;\n kind: PyNodeKind.ReturnStatement;\n}\n\nexport function createReturnStatement(expression?: PyExpression): PyReturnStatement {\n return {\n expression,\n kind: PyNodeKind.ReturnStatement,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport { createBlock, type PyBlock } from './block';\nimport type { PyExceptClause } from './except';\n\nexport interface PyTryStatement extends PyNodeBase {\n elseBlock?: PyBlock;\n exceptClauses?: ReadonlyArray<PyExceptClause>;\n finallyBlock?: PyBlock;\n kind: PyNodeKind.TryStatement;\n tryBlock: PyBlock;\n}\n\nexport function createTryStatement(\n tryBlock: ReadonlyArray<PyStatement>,\n exceptClauses?: ReadonlyArray<PyExceptClause>,\n elseBlock?: ReadonlyArray<PyStatement>,\n finallyBlock?: ReadonlyArray<PyStatement>,\n): PyTryStatement {\n return {\n elseBlock: elseBlock ? createBlock(elseBlock) : undefined,\n exceptClauses,\n finallyBlock: finallyBlock ? createBlock(finallyBlock) : undefined,\n kind: PyNodeKind.TryStatement,\n tryBlock: createBlock(tryBlock),\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport type { PyBlock } from './block';\nimport { createBlock } from './block';\n\nexport interface PyWhileStatement extends PyNodeBase {\n body: PyBlock;\n condition: PyExpression;\n elseBlock?: PyBlock;\n kind: PyNodeKind.WhileStatement;\n}\n\nexport function createWhileStatement(\n condition: PyExpression,\n body: ReadonlyArray<PyStatement>,\n elseBlock?: ReadonlyArray<PyStatement>,\n): PyWhileStatement {\n return {\n body: createBlock(body),\n condition,\n elseBlock: elseBlock ? createBlock(elseBlock) : undefined,\n kind: PyNodeKind.WhileStatement,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\nimport type { PyStatement } from '../statement';\nimport { createBlock, type PyBlock } from './block';\nimport type { PyWithItem } from './with-item';\n\nexport interface PyWithStatement extends PyNodeBase {\n body: PyBlock;\n items: ReadonlyArray<PyWithItem>;\n kind: PyNodeKind.WithStatement;\n modifiers?: ReadonlyArray<PyExpression>;\n}\n\nexport function createWithStatement(\n items: ReadonlyArray<PyWithItem>,\n body: ReadonlyArray<PyStatement>,\n modifiers?: ReadonlyArray<PyExpression>,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyWithStatement {\n return {\n body: createBlock(body),\n items,\n kind: PyNodeKind.WithStatement,\n leadingComments,\n modifiers,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport type { PyExpression } from '../expression';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyWithItem extends PyNodeBase {\n alias?: PyExpression;\n contextExpr: PyExpression;\n kind: PyNodeKind.WithItem;\n}\n\nexport function createWithItem(\n contextExpr: PyExpression,\n alias?: PyExpression,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PyWithItem {\n return {\n alias,\n contextExpr,\n kind: PyNodeKind.WithItem,\n leadingComments,\n trailingComments,\n };\n}\n","import type { PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PyComment extends PyNodeBase {\n kind: PyNodeKind.Comment;\n text: string;\n}\n\nexport function createComment(text: string): PyComment {\n return {\n kind: PyNodeKind.Comment,\n text,\n };\n}\n","import type { PyNode, PyNodeBase } from '../base';\nimport { PyNodeKind } from '../kinds';\n\nexport interface PySourceFile extends PyNodeBase {\n docstring?: string;\n kind: PyNodeKind.SourceFile;\n statements: ReadonlyArray<PyNode>;\n}\n\nexport function createSourceFile(\n statements: ReadonlyArray<PyNode>,\n docstring?: string,\n leadingComments?: ReadonlyArray<string>,\n trailingComments?: ReadonlyArray<string>,\n): PySourceFile {\n return {\n docstring,\n kind: PyNodeKind.SourceFile,\n leadingComments,\n statements,\n trailingComments,\n };\n}\n","import { createClassDeclaration } from './declarations/class';\nimport { createFunctionDeclaration } from './declarations/function';\nimport { createFunctionParameter } from './declarations/function-parameter';\nimport { createAsyncExpression } from './expressions/async';\nimport { createAwaitExpression } from './expressions/await';\nimport { createBinaryExpression } from './expressions/binary';\nimport { createCallExpression } from './expressions/call';\nimport { createDictComprehension } from './expressions/comprehensions/dict';\nimport { createListComprehension } from './expressions/comprehensions/list';\nimport { createSetComprehension } from './expressions/comprehensions/set';\nimport { createDictExpression } from './expressions/dict';\nimport { createFStringExpression } from './expressions/f-string';\nimport { createGeneratorExpression } from './expressions/generator';\nimport { createIdentifier } from './expressions/identifier';\nimport { createKeywordArgument } from './expressions/keyword-arg';\nimport { createLambdaExpression } from './expressions/lambda';\nimport { createListExpression } from './expressions/list';\nimport { createLiteral } from './expressions/literal';\nimport { createMemberExpression } from './expressions/member';\nimport { createRStringExpression } from './expressions/r-string';\nimport { createSetExpression } from './expressions/set';\nimport { createSubscriptExpression } from './expressions/subscript';\nimport { createSubscriptSlice } from './expressions/subscript-slice';\nimport { createTupleExpression } from './expressions/tuple';\nimport { createYieldExpression } from './expressions/yield';\nimport { createYieldFromExpression } from './expressions/yield-from';\nimport { createAssignment } from './statements/assignment';\nimport { createAugmentedAssignment } from './statements/augmented-assignment';\nimport { createBlock } from './statements/block';\nimport { createBreakStatement } from './statements/break';\nimport { createContinueStatement } from './statements/continue';\nimport { createEmptyStatement } from './statements/empty';\nimport { createExceptClause } from './statements/except';\nimport { createExpressionStatement } from './statements/expression';\nimport { createForStatement } from './statements/for';\nimport { createIfStatement } from './statements/if';\nimport { createImportStatement } from './statements/import';\nimport { createRaiseStatement } from './statements/raise';\nimport { createReturnStatement } from './statements/return';\nimport { createTryStatement } from './statements/try';\nimport { createWhileStatement } from './statements/while';\nimport { createWithStatement } from './statements/with';\nimport { createWithItem } from './statements/with-item';\nimport { createComment } from './structure/comment';\nimport { createSourceFile } from './structure/source-file';\n\nexport const factory = {\n createAssignment,\n createAsyncExpression,\n createAugmentedAssignment,\n createAwaitExpression,\n createBinaryExpression,\n createBlock,\n createBreakStatement,\n createCallExpression,\n createClassDeclaration,\n createComment,\n createContinueStatement,\n createDictComprehension,\n createDictExpression,\n createEmptyStatement,\n createExceptClause,\n createExpressionStatement,\n createFStringExpression,\n createForStatement,\n createFunctionDeclaration,\n createFunctionParameter,\n createGeneratorExpression,\n createIdentifier,\n createIfStatement,\n createImportStatement,\n createKeywordArgument,\n createLambdaExpression,\n createListComprehension,\n createListExpression,\n createLiteral,\n createMemberExpression,\n createRStringExpression,\n createRaiseStatement,\n createReturnStatement,\n createSetComprehension,\n createSetExpression,\n createSourceFile,\n createSubscriptExpression,\n createSubscriptSlice,\n createTryStatement,\n createTupleExpression,\n createWhileStatement,\n createWithItem,\n createWithStatement,\n createYieldExpression,\n createYieldFromExpression,\n};\n","import type { PyNode } from './nodes/base';\nimport { PyNodeKind } from './nodes/kinds';\n\nexport type QuoteStyle = 'single' | 'double';\nexport type QuoteFallback = 'avoid-escape' | 'escape';\n\nexport interface PyPrinterOptions {\n /**\n * Number of spaces per indentation level.\n *\n * @default 4\n */\n indentSize?: number;\n /**\n * How to handle strings that contain the preferred quote character.\n * - `'avoid-escape'`: switch to the alternative quote style to avoid\n * escaping, unless the string contains both quote characters\n * - `'escape'`: always use the preferred quote style, escaping conflicts\n * with a backslash\n *\n * @default 'avoid-escape'\n */\n quoteConflict?: QuoteFallback;\n /**\n * Preferred string quote character.\n *\n * @default 'double'\n */\n quoteStyle?: QuoteStyle;\n}\n\nconst DEFAULT_INDENT_SIZE = 4;\nconst PARAMS_MULTILINE_THRESHOLD = 3;\n\nexport function createPrinter(options?: PyPrinterOptions) {\n const indentSize = options?.indentSize ?? DEFAULT_INDENT_SIZE;\n const quoteStyle = options?.quoteStyle ?? 'double';\n const quoteConflict = options?.quoteConflict ?? 'avoid-escape';\n\n function selectQuote(value: string): { conflict: boolean; quote: string } {\n const preferred = quoteStyle === 'double' ? '\"' : \"'\";\n const alternative = quoteStyle === 'double' ? \"'\" : '\"';\n\n const hasPreferred = value.includes(preferred);\n const hasAlternative = value.includes(alternative);\n\n if (quoteConflict === 'escape' || (hasPreferred && hasAlternative)) {\n return { conflict: true, quote: preferred };\n }\n\n return { conflict: false, quote: hasPreferred ? alternative : preferred };\n }\n\n function createStringLiteral(value: string): string {\n const result = selectQuote(value);\n if (result.conflict) {\n return `${result.quote}${value.replaceAll(result.quote, `\\\\${result.quote}`)}${result.quote}`;\n }\n return `${result.quote}${value}${result.quote}`;\n }\n\n let indentLevel = 0;\n\n function printComments(\n parts: Array<string>,\n lines: ReadonlyArray<string>,\n indent?: boolean,\n ): void {\n if (indent) indentLevel += 1;\n parts.push(...lines.map((line) => printLine(`# ${line}`)));\n if (indent) indentLevel -= 1;\n }\n\n function printDocstring(docstring: string): Array<string> {\n const lines = docstring.split('\\n');\n const parts: Array<string> = [];\n if (lines.length === 1) {\n parts.push(printLine(`\"\"\"${lines[0]}\"\"\"`), '');\n } else {\n parts.push(printLine(`\"\"\"${lines[0]}`));\n parts.push(...lines.slice(1).map((line) => printLine(line)));\n parts.push(printLine(`\"\"\"`), '');\n }\n return parts;\n }\n\n function printLine(line: string): string {\n if (line === '') return '';\n return ' '.repeat(indentLevel * indentSize) + line;\n }\n\n function printNode(node: PyNode): string {\n const parts: Array<string> = [];\n\n if (node.leadingComments) {\n printComments(parts, node.leadingComments);\n }\n\n let indentTrailingComments = false;\n\n switch (node.kind) {\n case PyNodeKind.Assignment: {\n const target = printNode(node.target);\n if (node.type) {\n const type = printNode(node.type);\n if (node.value) {\n parts.push(printLine(`${target}: ${type} = ${printNode(node.value)}`));\n } else {\n parts.push(printLine(`${target}: ${type}`));\n }\n } else {\n parts.push(printLine(`${target} = ${printNode(node.value!)}`));\n }\n break;\n }\n\n case PyNodeKind.AsyncExpression:\n parts.push(`async ${printNode(node.expression)}`);\n break;\n\n case PyNodeKind.AugmentedAssignment:\n parts.push(\n printLine(`${printNode(node.target)} ${node.operator} ${printNode(node.value)}`),\n );\n break;\n\n case PyNodeKind.AwaitExpression:\n parts.push(`await ${printNode(node.expression)}`);\n break;\n\n case PyNodeKind.BinaryExpression:\n parts.push(`${printNode(node.left)} ${node.operator} ${printNode(node.right)}`);\n break;\n\n case PyNodeKind.Block:\n indentLevel += 1;\n if (node.statements.length) {\n parts.push(...node.statements.map(printNode));\n } else {\n parts.push(printLine('pass'));\n }\n indentLevel -= 1;\n break;\n\n case PyNodeKind.BreakStatement:\n parts.push(printLine('break'));\n break;\n\n case PyNodeKind.CallExpression:\n parts.push(`${printNode(node.callee)}(${node.args.map(printNode).join(', ')})`);\n break;\n\n case PyNodeKind.ClassDeclaration: {\n indentTrailingComments = true;\n if (node.decorators) {\n parts.push(...node.decorators.map((decorator) => printLine(`@${printNode(decorator)}`)));\n }\n const bases = node.baseClasses?.length\n ? `(${node.baseClasses.map(printNode).join(', ')})`\n : '';\n parts.push(printLine(`class ${node.name}${bases}:`));\n if (node.docstring) {\n indentLevel += 1;\n parts.push(...printDocstring(node.docstring));\n indentLevel -= 1;\n }\n parts.push(printNode(node.body));\n break;\n }\n\n case PyNodeKind.Comment:\n parts.push(printLine(`# ${node.text}`));\n break;\n\n case PyNodeKind.ContinueStatement:\n parts.push(printLine('continue'));\n break;\n\n case PyNodeKind.DictComprehension: {\n const asyncPrefix = node.isAsync ? 'async ' : '';\n const children: Array<string> = [\n `${printNode(node.key)}: ${printNode(node.value)} ${asyncPrefix}for ${printNode(node.target)} in ${printNode(node.iterable)}`,\n ];\n if (node.ifs) {\n for (const condition of node.ifs) {\n children.push(`if ${printNode(condition)}`);\n }\n }\n parts.push(`{${children.join(' ')}}`);\n break;\n }\n\n case PyNodeKind.DictExpression: {\n const entries = node.entries\n .map(({ key, value }) => `${printNode(key)}: ${printNode(value)}`)\n .join(', ');\n parts.push(`{${entries}}`);\n break;\n }\n\n case PyNodeKind.EmptyStatement:\n parts.push('');\n break;\n\n case PyNodeKind.ExpressionStatement:\n parts.push(printLine(printNode(node.expression)));\n break;\n\n case PyNodeKind.ForStatement:\n parts.push(printLine(`for ${printNode(node.target)} in ${printNode(node.iterable)}:`));\n parts.push(printNode(node.body));\n if (node.elseBlock) {\n parts.push(`${printLine('else:')}`);\n parts.push(`${printNode(node.elseBlock)}`);\n }\n break;\n\n case PyNodeKind.FStringExpression: {\n const children = node.parts.map((part) =>\n typeof part === 'string' ? part : `{${printNode(part)}}`,\n );\n parts.push(`f${createStringLiteral(children.join(''))}`);\n break;\n }\n\n case PyNodeKind.FunctionDeclaration: {\n if (node.decorators) {\n parts.push(...node.decorators.map((decorator) => printLine(`@${printNode(decorator)}`)));\n }\n const modifiers = node.modifiers?.map(printNode).join(' ') ?? '';\n const defPrefix = modifiers ? `${modifiers} def` : 'def';\n const formatParameter = (parameter: (typeof node.parameters)[number]): string => {\n const children: Array<string> = [parameter.name];\n if (parameter.type) children.push(`: ${printNode(parameter.type)}`);\n if (parameter.defaultValue) children.push(` = ${printNode(parameter.defaultValue)}`);\n return children.join('');\n };\n const returnAnnotation = node.returnType ? ` -> ${printNode(node.returnType)}` : '';\n const preParams = `${defPrefix} ${node.name}(`;\n const postParams = `)${returnAnnotation}:`;\n\n if (node.parameters.length > PARAMS_MULTILINE_THRESHOLD) {\n parts.push(printLine(preParams));\n indentLevel += 1;\n const params = node.parameters.map((parameter) =>\n printLine(`${formatParameter(parameter)},`),\n );\n parts.push(...params);\n indentLevel -= 1;\n parts.push(printLine(postParams));\n } else {\n const parameters = node.parameters.map((parameter) => formatParameter(parameter));\n const params = parameters.join(', ');\n parts.push(printLine(`${preParams}${params}${postParams}`));\n }\n\n if (node.docstring) {\n indentLevel += 1;\n parts.push(...printDocstring(node.docstring));\n indentLevel -= 1;\n }\n parts.push(printNode(node.body));\n break;\n }\n\n case PyNodeKind.GeneratorExpression: {\n const asyncPrefix = node.isAsync ? 'async ' : '';\n const children: Array<string> = [\n `${printNode(node.element)} ${asyncPrefix}for ${printNode(node.target)} in ${printNode(node.iterable)}`,\n ];\n if (node.ifs) {\n for (const condition of node.ifs) {\n children.push(`if ${printNode(condition)}`);\n }\n }\n parts.push(`(${children.join(' ')})`);\n break;\n }\n\n case PyNodeKind.Identifier:\n parts.push(node.name);\n break;\n\n case PyNodeKind.IfStatement:\n parts.push(printLine(`if ${printNode(node.condition)}:`));\n parts.push(`${printNode(node.thenBlock)}`);\n if (node.elseBlock) {\n parts.push(`${printLine('else:')}`);\n parts.push(`${printNode(node.elseBlock)}`);\n }\n break;\n\n case PyNodeKind.KeywordArgument:\n parts.push(`${node.name}=${printNode(node.value)}`);\n break;\n\n case PyNodeKind.ImportStatement: {\n const fromPrefix = node.isFrom ? `from ${node.module} ` : '';\n if (fromPrefix) {\n if (node.names && node.names.length) {\n const imports = node.names\n .map(({ alias, name }) => (alias ? `${name} as ${alias}` : name))\n .join(', ');\n parts.push(printLine(`${fromPrefix}import ${imports}`));\n } else {\n parts.push(printLine(`${fromPrefix}import *`));\n }\n } else {\n if (node.names && node.names.length) {\n const imports = node.names\n .map(({ alias, name }) => (alias ? `${name} as ${alias}` : name))\n .join(', ');\n parts.push(printLine(`import ${imports}`));\n } else {\n parts.push(printLine(`import ${node.module}`));\n }\n }\n break;\n }\n\n case PyNodeKind.LambdaExpression: {\n const parameters = node.parameters.map((parameter) => {\n const children: Array<string> = [parameter.name];\n if (parameter.type) children.push(`: ${printNode(parameter.type)}`);\n if (parameter.defaultValue) children.push(` = ${printNode(parameter.defaultValue)}`);\n return children.join('');\n });\n parts.push(`lambda ${parameters.join(', ')}: ${printNode(node.expression)}`);\n break;\n }\n\n case PyNodeKind.ListComprehension: {\n const asyncPrefix = node.isAsync ? 'async ' : '';\n const children: Array<string> = [\n `${printNode(node.element)} ${asyncPrefix}for ${printNode(node.target)} in ${printNode(node.iterable)}`,\n ];\n if (node.ifs) {\n for (const condition of node.ifs) {\n children.push(`if ${printNode(condition)}`);\n }\n }\n parts.push(`[${children.join(' ')}]`);\n break;\n }\n\n case PyNodeKind.ListExpression:\n parts.push(`[${node.elements.map(printNode).join(', ')}]`);\n break;\n\n case PyNodeKind.Literal:\n if (typeof node.value === 'string') {\n if (node.value.includes('\\n')) {\n const { quote } = selectQuote(node.value);\n const tripleQuote = quote.repeat(3);\n const escaped = node.value\n .replaceAll('\\\\', '\\\\\\\\')\n .replaceAll(tripleQuote, `\\\\${quote}${quote}${quote}`);\n parts.push(`${tripleQuote}${escaped}${tripleQuote}`);\n } else {\n parts.push(createStringLiteral(node.value));\n }\n } else if (typeof node.value === 'boolean') {\n parts.push(node.value ? 'True' : 'False');\n } else if (node.value === null) {\n parts.push('None');\n } else {\n parts.push(String(node.value));\n }\n break;\n\n case PyNodeKind.MemberExpression:\n parts.push(`${printNode(node.object)}.${printNode(node.member)}`);\n break;\n\n case PyNodeKind.RaiseStatement:\n if (node.expression) {\n parts.push(printLine(`raise ${printNode(node.expression)}`));\n } else {\n parts.push(printLine('raise'));\n }\n break;\n\n case PyNodeKind.RStringExpression: {\n const trailingBackslashes = node.value.match(/\\\\+$/);\n const endsWithOddBackslashes =\n trailingBackslashes !== null &&\n trailingBackslashes !== undefined &&\n trailingBackslashes[0].length % 2 !== 0;\n if (endsWithOddBackslashes) {\n parts.push(createStringLiteral(node.value.replaceAll('\\\\', '\\\\\\\\')));\n break;\n }\n const result = selectQuote(node.value);\n if (result.conflict) {\n const tripleQuote = result.quote.repeat(3);\n if (node.value.includes(tripleQuote)) {\n parts.push(createStringLiteral(node.value.replaceAll('\\\\', '\\\\\\\\')));\n } else {\n parts.push(`r${tripleQuote}${node.value}${tripleQuote}`);\n }\n } else {\n parts.push(`r${result.quote}${node.value}${result.quote}`);\n }\n break;\n }\n\n case PyNodeKind.ReturnStatement:\n if (node.expression) {\n parts.push(printLine(`return ${printNode(node.expression)}`));\n } else {\n parts.push(printLine('return'));\n }\n break;\n\n case PyNodeKind.SetComprehension: {\n const asyncPrefix = node.isAsync ? 'async ' : '';\n const children: Array<string> = [\n `${printNode(node.element)} ${asyncPrefix}for ${printNode(node.target)} in ${printNode(node.iterable)}`,\n ];\n if (node.ifs) {\n for (const condition of node.ifs) {\n children.push(`if ${printNode(condition)}`);\n }\n }\n parts.push(`{${children.join(' ')}}`);\n break;\n }\n\n case PyNodeKind.SetExpression: {\n if (!node.elements.length) {\n parts.push('set()');\n } else {\n parts.push(`{${node.elements.map(printNode).join(', ')}}`);\n }\n break;\n }\n\n case PyNodeKind.SourceFile:\n if (node.docstring) {\n parts.push(...printDocstring(node.docstring));\n }\n parts.push(...node.statements.map(printNode));\n break;\n\n case PyNodeKind.SubscriptExpression:\n parts.push(`${printNode(node.value)}[${printNode(node.slice)}]`);\n break;\n\n case PyNodeKind.SubscriptSlice:\n parts.push(node.elements.map(printNode).join(', '));\n break;\n\n case PyNodeKind.TryStatement: {\n parts.push(printLine('try:'), printNode(node.tryBlock));\n if (node.exceptClauses) {\n for (const clause of node.exceptClauses) {\n const type = clause.exceptionType ? ` ${printNode(clause.exceptionType)}` : '';\n const name = clause.exceptionName ? ` as ${printNode(clause.exceptionName)}` : '';\n parts.push(printLine(`except${type}${name}:`), printNode(clause.block));\n }\n }\n if (node.elseBlock) {\n parts.push(printLine(`else:`), printNode(node.elseBlock));\n }\n if (node.finallyBlock) {\n parts.push(printLine(`finally:`), printNode(node.finallyBlock));\n }\n break;\n }\n\n case PyNodeKind.TupleExpression: {\n // Single-element tuple needs trailing comma\n const trailingComma = node.elements.length === 1 ? ',' : '';\n parts.push(`(${node.elements.map(printNode).join(', ')}${trailingComma})`);\n break;\n }\n\n case PyNodeKind.WhileStatement: {\n parts.push(printLine(`while ${printNode(node.condition)}:`));\n parts.push(printNode(node.body));\n if (node.elseBlock) {\n parts.push(`${printLine('else:')}`);\n parts.push(`${printNode(node.elseBlock)}`);\n }\n break;\n }\n\n case PyNodeKind.WithStatement: {\n const modifiers = node.modifiers?.map(printNode).join(' ') ?? '';\n const withPrefix = modifiers ? `${modifiers} with` : 'with';\n const items = node.items\n .map((item) =>\n item.alias\n ? `${printNode(item.contextExpr)} as ${printNode(item.alias)}`\n : printNode(item.contextExpr),\n )\n .join(', ');\n parts.push(printLine(`${withPrefix} ${items}:`));\n parts.push(printNode(node.body));\n break;\n }\n\n case PyNodeKind.YieldExpression:\n if (node.value) {\n parts.push(`yield ${printNode(node.value)}`);\n } else {\n parts.push('yield');\n }\n break;\n\n case PyNodeKind.YieldFromExpression:\n parts.push(`yield from ${printNode(node.expression)}`);\n break;\n\n default:\n throw new Error(`Unsupported node kind: ${(node as { kind: string }).kind}`);\n }\n\n if (node.trailingComments) {\n printComments(parts, node.trailingComments, indentTrailingComments);\n }\n\n return parts.join('\\n');\n }\n\n function printFile(node: PyNode): string {\n const parts: Array<string> = [printNode(node), ''];\n return parts.join('\\n');\n }\n\n return {\n printFile,\n };\n}\n\nexport function printAst(node: PyNode): string {\n return JSON.stringify(node, null, 2);\n}\n","import type { PyNode as _PyNode, PyNodeBase as _PyNodeBase } from './nodes/base';\nimport type {\n PyComprehension as _PyComprehension,\n PyComprehensionNode as _PyComprehensionNode,\n} from './nodes/comprehension';\nimport type { PyClassDeclaration as _PyClassDeclaration } from './nodes/declarations/class';\nimport type { PyFunctionDeclaration as _PyFunctionDeclaration } from './nodes/declarations/function';\nimport type { PyFunctionParameter as _PyFunctionParameter } from './nodes/declarations/function-parameter';\nimport type { PyExpression as _PyExpression } from './nodes/expression';\nimport type { PyAsyncExpression as _PyAsyncExpression } from './nodes/expressions/async';\nimport type { PyAwaitExpression as _PyAwaitExpression } from './nodes/expressions/await';\nimport type {\n PyBinaryExpression as _PyBinaryExpression,\n PyBinaryOperator as _PyBinaryOperator,\n} from './nodes/expressions/binary';\nimport type { PyCallExpression as _PyCallExpression } from './nodes/expressions/call';\nimport type { PyDictComprehension as _PyDictComprehension } from './nodes/expressions/comprehensions/dict';\nimport type { PyListComprehension as _PyListComprehension } from './nodes/expressions/comprehensions/list';\nimport type { PySetComprehension as _PySetComprehension } from './nodes/expressions/comprehensions/set';\nimport type { PyDictExpression as _PyDictExpression } from './nodes/expressions/dict';\nimport type { PyFStringExpression as _PyFStringExpression } from './nodes/expressions/f-string';\nimport type { PyGeneratorExpression as _PyGeneratorExpression } from './nodes/expressions/generator';\nimport type { PyIdentifier as _PyIdentifier } from './nodes/expressions/identifier';\nimport type { PyKeywordArgument as _PyKeywordArgument } from './nodes/expressions/keyword-arg';\nimport type { PyLambdaExpression as _PyLambdaExpression } from './nodes/expressions/lambda';\nimport type { PyListExpression as _PyListExpression } from './nodes/expressions/list';\nimport type {\n PyLiteral as _PyLiteral,\n PyLiteralValue as _PyLiteralValue,\n} from './nodes/expressions/literal';\nimport type { PyMemberExpression as _PyMemberExpression } from './nodes/expressions/member';\nimport type { PyRStringExpression as _PyRStringExpression } from './nodes/expressions/r-string';\nimport type { PySetExpression as _PySetExpression } from './nodes/expressions/set';\nimport type { PySubscriptExpression as _PySubscriptExpression } from './nodes/expressions/subscript';\nimport type { PySubscriptSlice as _PySubscriptSlice } from './nodes/expressions/subscript-slice';\nimport type { PyTupleExpression as _PyTupleExpression } from './nodes/expressions/tuple';\nimport type { PyYieldExpression as _PyYieldExpression } from './nodes/expressions/yield';\nimport type { PyYieldFromExpression as _PyYieldFromExpression } from './nodes/expressions/yield-from';\nimport { factory } from './nodes/factory';\nimport { PyNodeKind } from './nodes/kinds';\nimport type { PyStatement as _PyStatement } from './nodes/statement';\nimport type { PyAssignment as _PyAssignment } from './nodes/statements/assignment';\nimport type {\n PyAugmentedAssignment as _PyAugmentedAssignment,\n PyAugmentedOperator as _PyAugmentedOperator,\n} from './nodes/statements/augmented-assignment';\nimport type { PyBlock as _PyBlock } from './nodes/statements/block';\nimport type { PyBreakStatement as _PyBreakStatement } from './nodes/statements/break';\nimport type { PyContinueStatement as _PyContinueStatement } from './nodes/statements/continue';\nimport type { PyEmptyStatement as _PyEmptyStatement } from './nodes/statements/empty';\nimport type { PyExceptClause as _PyExceptClause } from './nodes/statements/except';\nimport type { PyExpressionStatement as _PyExpressionStatement } from './nodes/statements/expression';\nimport type { PyForStatement as _PyForStatement } from './nodes/statements/for';\nimport type { PyIfStatement as _PyIfStatement } from './nodes/statements/if';\nimport type { PyImportStatement as _PyImportStatement } from './nodes/statements/import';\nimport type { PyRaiseStatement as _PyRaiseStatement } from './nodes/statements/raise';\nimport type { PyReturnStatement as _PyReturnStatement } from './nodes/statements/return';\nimport type { PyTryStatement as _PyTryStatement } from './nodes/statements/try';\nimport type { PyWhileStatement as _PyWhileStatement } from './nodes/statements/while';\nimport type { PyWithStatement as _PyWithStatement } from './nodes/statements/with';\nimport type { PyWithItem as _PyWithItem } from './nodes/statements/with-item';\nimport type { PyComment as _PyComment } from './nodes/structure/comment';\nimport type { PySourceFile as _PySourceFile } from './nodes/structure/source-file';\nimport type { PyPrinterOptions as _PyPrinterOptions } from './printer';\nimport { createPrinter, printAst } from './printer';\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace py {\n // Base / Core\n export type Node = _PyNode;\n export type NodeBase = _PyNodeBase;\n export type NodeKind = PyNodeKind;\n export type Expression = _PyExpression;\n export type Statement = _PyStatement;\n\n // Structure\n export type SourceFile = _PySourceFile;\n export type Comment = _PyComment;\n\n // Declarations\n export type ClassDeclaration = _PyClassDeclaration;\n export type FunctionDeclaration = _PyFunctionDeclaration;\n export type FunctionParameter = _PyFunctionParameter;\n\n // Statements\n export type Assignment = _PyAssignment;\n export type AugmentedAssignment = _PyAugmentedAssignment;\n export type AugmentedOperator = _PyAugmentedOperator;\n export type Block = _PyBlock;\n export type BreakStatement = _PyBreakStatement;\n export type ContinueStatement = _PyContinueStatement;\n export type EmptyStatement = _PyEmptyStatement;\n export type ExceptClause = _PyExceptClause;\n export type ExpressionStatement = _PyExpressionStatement;\n export type ForStatement = _PyForStatement;\n export type IfStatement = _PyIfStatement;\n export type ImportStatement = _PyImportStatement;\n export type RaiseStatement = _PyRaiseStatement;\n export type ReturnStatement = _PyReturnStatement;\n export type TryStatement = _PyTryStatement;\n export type WhileStatement = _PyWhileStatement;\n export type WithItem = _PyWithItem;\n export type WithStatement = _PyWithStatement;\n\n // Expressions\n export type AsyncExpression = _PyAsyncExpression;\n export type AwaitExpression = _PyAwaitExpression;\n export type BinaryExpression = _PyBinaryExpression;\n export type BinaryOperator = _PyBinaryOperator;\n export type CallExpression = _PyCallExpression;\n export type DictExpression = _PyDictExpression;\n export type FStringExpression = _PyFStringExpression;\n export type GeneratorExpression = _PyGeneratorExpression;\n export type Identifier = _PyIdentifier;\n export type KeywordArgument = _PyKeywordArgument;\n export type LambdaExpression = _PyLambdaExpression;\n export type ListExpression = _PyListExpression;\n export type Literal = _PyLiteral;\n export type MemberExpression = _PyMemberExpression;\n export type RStringExpression = _PyRStringExpression;\n export type SetExpression = _PySetExpression;\n export type SubscriptExpression = _PySubscriptExpression;\n export type SubscriptSlice = _PySubscriptSlice;\n export type TupleExpression = _PyTupleExpression;\n export type YieldExpression = _PyYieldExpression;\n export type YieldFromExpression = _PyYieldFromExpression;\n\n // Comprehensions\n export type Comprehension = _PyComprehension;\n export type ComprehensionNode = _PyComprehensionNode;\n export type DictComprehension = _PyDictComprehension;\n export type ListComprehension = _PyListComprehension;\n export type SetComprehension = _PySetComprehension;\n\n // Printer\n export type PrinterOptions = _PyPrinterOptions;\n\n // Miscellaneous\n export type LiteralValue = _PyLiteralValue;\n}\n\nexport const py = {\n PyNodeKind,\n createPrinter,\n factory,\n printAst,\n} as const;\n","// TODO: symbol should be protected, but needs to be public to satisfy types\nimport type {\n AnalysisContext,\n File,\n FromRef,\n Language,\n Node,\n NodeName,\n NodeNameSanitizer,\n NodeRelationship,\n NodeScope,\n ProjectMeta,\n Ref,\n Symbol,\n} from '@hey-api/codegen-core';\nimport { fromRef, isNode, isRef, isSymbol, nodeBrand, ref } from '@hey-api/codegen-core';\nimport type { AnyString } from '@hey-api/types';\n\nimport { py } from '../py-compiler';\nimport type { AccessOptions } from './utils/context';\n\nexport abstract class PyDsl<\n T extends py.Node = py.Node,\n L extends Language = 'python',\n> implements Node<T, L> {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n analyze(_: AnalysisContext): void {}\n clone(): this {\n const cloned = Object.create(Object.getPrototypeOf(this));\n Object.assign(cloned, this);\n return cloned;\n }\n exported?: boolean;\n file?: File;\n get name(): Node['name'] {\n const nameRef = this._name;\n const nameValue = nameRef ? fromRef(nameRef) : undefined;\n const symbolValue = isSymbol(nameValue) ? nameValue : undefined;\n return {\n ...nameRef,\n set: (value) => {\n this._name = ref(value);\n if (isSymbol(value)) {\n value.setNode(this);\n }\n },\n symbol: symbolValue,\n toString: () => (nameRef ? this.$name(nameRef) : ''),\n } as Node['name'];\n }\n readonly nameSanitizer?: NodeNameSanitizer;\n language: L = 'python' as L;\n meta: Required<ProjectMeta>[L] = {} as Required<ProjectMeta>[L];\n parent?: Node;\n root: boolean = false;\n scope?: NodeScope = 'value';\n structuralChildren?: Map<PyDsl, NodeRelationship>;\n structuralParents?: Map<PyDsl, NodeRelationship>;\n symbol?: Symbol;\n toAst(): T {\n return undefined as unknown as T;\n }\n readonly '~brand' = nodeBrand;\n\n /** Branding property to identify the DSL class at runtime. */\n abstract readonly '~dsl': AnyString;\n\n /** Conditionally applies a callback to this builder. */\n $if<T extends PyDsl, V, R extends PyDsl = T>(\n this: T,\n value: V,\n ifTrue: (self: T, v: Exclude<V, false | null | undefined>) => R | void,\n ifFalse?: (self: T, v: Extract<V, false | null | undefined>) => R | void,\n ): R | T;\n $if<T extends PyDsl, V, R extends PyDsl = T>(\n this: T,\n value: V,\n ifTrue: (v: Exclude<V, false | null | undefined>) => R | void,\n ifFalse?: (v: Extract<V, false | null | undefined>) => R | void,\n ): R | T;\n $if<T extends PyDsl, V, R extends PyDsl = T>(\n this: T,\n value: V,\n ifTrue: () => R | void,\n ifFalse?: () => R | void,\n ): R | T;\n $if<T extends PyDsl, V, R extends PyDsl = T>(\n this: T,\n value: V,\n ifTrue: any,\n ifFalse?: any,\n ): R | T {\n if (value) {\n // Try calling with (self, value), then (value), then ()\n let result: R | void | undefined;\n try {\n result = ifTrue?.(this, value as Exclude<V, false | null | undefined>);\n } catch {\n // ignore and try other signatures\n }\n if (result === undefined) {\n try {\n result = ifTrue?.(value as Exclude<V, false | null | undefined>);\n } catch {\n // ignore and try zero-arg\n }\n }\n if (result === undefined) {\n try {\n result = ifTrue?.();\n } catch {\n // swallow\n }\n }\n return (result ?? this) as R | T;\n }\n if (ifFalse) {\n let result: R | void | undefined;\n try {\n result = ifFalse?.(this, value as Extract<V, false | null | undefined>);\n } catch {\n // ignore\n }\n if (result === undefined) {\n try {\n result = ifFalse?.(value as Extract<V, false | null | undefined>);\n } catch {\n // ignore\n }\n }\n if (result === undefined) {\n try {\n result = ifFalse?.();\n } catch {\n // ignore\n }\n }\n return (result ?? this) as R | T;\n }\n return this;\n }\n\n /** Access patterns for this node. */\n toAccessNode?(\n node: this,\n options: AccessOptions,\n ctx: {\n /** The full chain. */\n chain: ReadonlyArray<PyDsl>;\n /** Position in the chain (0 = root). */\n index: number;\n /** Is this the leaf node? */\n isLeaf: boolean;\n /** Is this the root node? */\n isRoot: boolean;\n /** Total length of the chain. */\n length: number;\n },\n ): PyDsl | undefined;\n\n protected $maybeId<T extends string | py.Expression>(\n expr: T,\n ): T extends string ? py.Identifier : T {\n return (typeof expr === 'string' ? py.factory.createIdentifier(expr) : expr) as T extends string\n ? py.Identifier\n : T;\n }\n\n protected $name(name: Ref<NodeName>): string {\n const value = fromRef(name);\n if (isSymbol(value)) {\n try {\n return value.finalName;\n } catch {\n return value.name;\n }\n }\n return String(value);\n }\n\n protected $node<I>(value: I): NodeOfMaybe<I> {\n if (value === undefined) {\n return undefined as NodeOfMaybe<I>;\n }\n // @ts-expect-error\n if (isRef(value)) value = fromRef(value);\n if (isSymbol(value)) {\n return this.$maybeId(value.finalName) as NodeOfMaybe<I>;\n }\n if (typeof value === 'string') {\n return this.$maybeId(value) as NodeOfMaybe<I>;\n }\n if (value instanceof Array) {\n return value.map((item) => {\n if (isRef(item)) item = fromRef(item);\n return this.unwrap(item);\n }) as NodeOfMaybe<I>;\n }\n return this.unwrap(value as any) as NodeOfMaybe<I>;\n }\n\n private _name?: Ref<NodeName>;\n\n /** Unwraps nested nodes into raw Python AST. */\n private unwrap<I>(value: I): I extends PyDsl<infer N> ? N : I {\n return (isNode(value) ? value.toAst() : value) as I extends PyDsl<infer N> ? N : I;\n }\n}\n\ntype NodeOfMaybe<I> = undefined extends I\n ? NodeOf<NonNullable<FromRef<I>>> | undefined\n : NodeOf<FromRef<I>>;\n\ntype NodeOf<I> =\n I extends ReadonlyArray<infer U>\n ? ReadonlyArray<U extends PyDsl<infer N> ? N : U>\n : I extends string\n ? py.Expression\n : I extends PyDsl<infer N>\n ? N\n : I extends py.Node\n ? I\n : never;\n\nexport type MaybePyDsl<T> = [T] extends [PyDsl<infer U>]\n ? U | PyDsl<U>\n : [T] extends [py.Node]\n ? T | PyDsl<T>\n : never;\n\n// export abstract class TypePyDsl<T extends py.Expression = py.Expression> extends PyDsl<T> {}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\nexport class NewlinePyDsl extends PyDsl<py.EmptyStatement> {\n readonly '~dsl' = 'NewlinePyDsl';\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n override toAst() {\n return py.factory.createEmptyStatement();\n }\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport type { BaseCtor, MixinCtor } from './types';\n\ntype DecoratorArg = MaybePyDsl<py.Expression>;\ntype DecoratorName = NodeName | MaybePyDsl<py.Expression>;\n\nexport interface DecoratorMethods extends Node {\n $decorators(): ReadonlyArray<py.Expression>;\n decorator(name: DecoratorName, ...args: ReadonlyArray<DecoratorArg>): this;\n}\n\nexport function DecoratorMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Decorator extends Base {\n protected _decorators: Array<{\n args: ReadonlyArray<Ref<DecoratorArg>>;\n name: Ref<DecoratorName>;\n }> = [];\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const decorator of this._decorators) {\n ctx.analyze(decorator.name);\n for (const arg of decorator.args) {\n ctx.analyze(arg);\n }\n }\n }\n\n protected decorator(name: DecoratorName, ...args: ReadonlyArray<DecoratorArg>): this {\n this._decorators.push({\n args: args.map((arg) => ref(arg)),\n name: ref(name),\n });\n return this;\n }\n\n protected $decorators(): ReadonlyArray<py.Expression> {\n return this._decorators.map((decorator) =>\n decorator.args.length\n ? py.factory.createCallExpression(\n this.$node(decorator.name),\n decorator.args.map((arg) => this.$node(arg)),\n )\n : this.$node(decorator.name),\n );\n }\n }\n\n return Decorator as unknown as MixinCtor<TBase, DecoratorMethods>;\n}\n","import type { BindingKind } from '@hey-api/codegen-core';\n// import type { BindingKind, NodeScope, Symbol } from '@hey-api/codegen-core';\n// import { isSymbol } from '@hey-api/codegen-core';\nimport type { MaybeFunc } from '@hey-api/types';\n\nimport type { py } from '../../py-compiler';\nimport type { DollarPyDsl } from '../../py-dsl';\n// import { $, PythonRenderer } from '../../py-dsl';\nimport type { PyDsl } from '../base';\nimport type { CallArgs } from '../expr/call';\n\nexport type NodeChain = ReadonlyArray<PyDsl>;\n\nexport interface AccessOptions {\n /** The access context. */\n context?: 'example';\n /** Enable debug mode. */\n debug?: boolean;\n /** Transform function for each node in the access chain. */\n transform?: (node: PyDsl, index: number, chain: NodeChain) => PyDsl;\n}\n\n// export type AccessResult = ReturnType<typeof $.expr | typeof $.attr | typeof $.call | typeof $.new>;\n\nexport interface ExampleOptions {\n /** Import kind for the root node. */\n importKind?: BindingKind;\n /** Import name for the root node. */\n importName?: string;\n /** Setup to run before calling the example. */\n importSetup?: MaybeFunc<\n (\n ctx: DollarPyDsl & {\n /** The imported expression. */\n node: PyDsl<py.Expression>;\n },\n ) => PyDsl<py.Expression>\n >;\n /** Module to import from. */\n moduleName?: string;\n /** Example request payload. */\n payload?: MaybeFunc<(ctx: DollarPyDsl) => CallArgs | CallArgs[number]>;\n /** Variable name for setup node. */\n setupName?: string;\n}\n\n// function accessChainToNode<T = AccessResult>(accessChain: NodeChain): T {\n// let result!: AccessResult;\n// accessChain.forEach((node, index) => {\n// if (index === 0) {\n// // assume correct node\n// result = node as typeof result;\n// } else {\n// result = result.attr(node.name);\n// }\n// });\n// return result as T;\n// }\n\n// function getAccessChainForNode(node: PyDsl): NodeChain {\n// const structuralChain = [...getStructuralChainForNode(node, new Set())];\n// const accessChain = structuralToAccessChain(structuralChain);\n// if (!accessChain.length) {\n// // I _think_ this should not happen, but it does and this fix works for now.\n// // I assume this will cause issues with imports in some cases, investigate\n// // when it actually happens.\n// return [node.clone()];\n// }\n// return accessChain.map((node) => node.clone());\n// }\n\n// function getScope(node: PyDsl): NodeScope {\n// return node.scope ?? 'value';\n// }\n\n// function getStructuralChainForNode(node: PyDsl, visited: Set<PyDsl>): NodeChain {\n// if (visited.has(node)) return [];\n// visited.add(node);\n\n// if (isStopNode(node)) return [];\n\n// if (node.structuralParents) {\n// for (const [parent] of node.structuralParents) {\n// if (getScope(parent) !== getScope(node)) continue;\n\n// const chain = getStructuralChainForNode(parent, visited);\n// if (chain.length) return [...chain, node];\n// }\n// }\n\n// if (!node.root) return [];\n\n// return [node];\n// }\n\n// function isAccessorNode(node: PyDsl): boolean {\n// return (\n// node['~dsl'] === 'FieldPyDsl' ||\n// node['~dsl'] === 'GetterPyDsl' ||\n// node['~dsl'] === 'MethodPyDsl'\n// );\n// }\n\n// function isStopNode(node: PyDsl): boolean {\n// return node['~dsl'] === 'FuncPyDsl' || node['~dsl'] === 'TemplatePyDsl';\n// }\n\n/**\n * Fold a structural chain to an access chain by removing\n * non-accessor nodes.\n */\n// function structuralToAccessChain(structuralChain: NodeChain): NodeChain {\n// const accessChain: Array<PyDsl> = [];\n// structuralChain.forEach((node, index) => {\n// // assume first node is always included\n// if (index === 0) {\n// accessChain.push(node);\n// } else if (isAccessorNode(node)) {\n// accessChain.push(node);\n// }\n// });\n// return accessChain;\n// }\n\n// function transformAccessChain(accessChain: NodeChain, options: AccessOptions = {}): NodeChain {\n// return accessChain.map((node, index) => {\n// const transformedNode = options.transform?.(node, index, accessChain);\n// if (transformedNode) return transformedNode;\n// const accessNode = node.toAccessNode?.(node, options, {\n// chain: accessChain,\n// index,\n// isLeaf: index === accessChain.length - 1,\n// isRoot: index === 0,\n// length: accessChain.length,\n// });\n// if (accessNode) return accessNode;\n// if (index === 0) {\n// if (node['~dsl'] === 'ClassPyDsl') {\n// const nextNode = accessChain[index + 1];\n// if (nextNode && isAccessorNode(nextNode)) {\n// if ((nextNode as ReturnType<typeof $.field>).hasModifier('static')) {\n// return $(node.name);\n// }\n// }\n// return $.new(node.name).args();\n// }\n// return $(node.name);\n// }\n// return node;\n// });\n// }\n\nexport class PyDslContext {\n /**\n * Build an expression for accessing the node.\n *\n * @param node - The node or symbol to build access for\n * @param options - Access options\n * @returns Expression for accessing the node\n *\n * @example\n * ```ts\n * ctx.access(node); // → Expression for accessing the node\n * ```\n */\n // access<T = AccessResult>(node: PyDsl | Symbol<PyDsl>, options?: AccessOptions): T {\n // const n = isSymbol(node) ? node.node : node;\n // if (!n) {\n // throw new Error(`Symbol ${node.name} is not resolved to a node.`);\n // }\n // const accessChain = getAccessChainForNode(n);\n // const finalChain = transformAccessChain(accessChain, options);\n // return accessChainToNode<T>(finalChain);\n // }\n /**\n * Build an example.\n *\n * @param node - The node to generate an example for\n * @param options - Example options\n * @returns Full example string\n *\n * @example\n * ```ts\n * ctx.example(node, { moduleName: 'my-sdk' }); // → Full example string\n * ```\n */\n // example(\n // node: PyDsl,\n // options?: ExampleOptions,\n // astOptions?: Parameters<typeof PythonRenderer.astToString>[0],\n // ): string {\n // if (astOptions) {\n // return PythonRenderer.astToString(astOptions);\n // }\n // options ||= {};\n // const accessChain = getAccessChainForNode(node);\n // if (options.importName) {\n // accessChain[0]!.name.set(options.importName);\n // }\n // const importNode = $(accessChain[0]!.name.toString()); // must store name before transform\n // const finalChain = transformAccessChain(accessChain, {\n // context: 'example',\n // });\n // const setupNode = options.importSetup\n // ? typeof options.importSetup === 'function'\n // ? options.importSetup({ $, node: importNode })\n // : options.importSetup\n // : (finalChain[0]! as PyDsl<py.Expression>);\n // const setupName = options.setupName;\n // let payload = typeof options.payload === 'function' ? options.payload({ $ }) : options.payload;\n // payload = payload instanceof Array ? payload : payload ? [payload] : [];\n // let nodes: Array<PyDsl> = [];\n // if (setupName) {\n // nodes = [\n // $.const(setupName).assign(setupNode),\n // $.await(accessChainToNode([$(setupName), ...finalChain.slice(1)]).call(...payload)),\n // ];\n // } else {\n // nodes = [$.await(accessChainToNode([setupNode, ...finalChain.slice(1)]).call(...payload))];\n // }\n // const localName = importNode.name.toString();\n // return PythonRenderer.astToString({\n // imports: [\n // [\n // {\n // imports:\n // !options.importKind || options.importKind === 'named'\n // ? [\n // {\n // isTypeOnly: false,\n // localName,\n // sourceName: localName,\n // },\n // ]\n // : [],\n // isTypeOnly: false,\n // kind: options.importKind ?? 'named',\n // localName: options.importKind !== 'named' ? localName : undefined,\n // modulePath: options.moduleName ?? 'your-package',\n // },\n // ],\n // ],\n // nodes,\n // trailingNewline: false,\n // });\n // }\n}\n\nexport const ctx = new PyDslContext();\n","import type { AnalysisContext } from '@hey-api/codegen-core';\nimport type { MaybeArray } from '@hey-api/types';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport type { PyDslContext } from '../utils/context';\nimport { ctx } from '../utils/context';\n\ntype DocMaybeLazy<T> = ((ctx: PyDslContext) => T) | T;\nexport type DocFn = (d: DocPyDsl) => void;\nexport type DocLines = DocMaybeLazy<MaybeArray<string>>;\n\nexport class DocPyDsl extends PyDsl<py.Comment> {\n readonly '~dsl' = 'DocPyDsl';\n\n protected _lines: Array<DocLines> = [];\n\n constructor(lines?: DocLines, fn?: DocFn) {\n super();\n if (lines) this.add(lines);\n fn?.(this);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n add(lines: DocLines): this {\n this._lines.push(lines);\n return this;\n }\n\n resolve(): string | undefined {\n const lines = this._lines.reduce((lines: Array<string>, line: DocLines) => {\n if (typeof line === 'function') line = line(ctx);\n for (const l of typeof line === 'string' ? [line] : line) {\n if (l || l === '') lines.push(l);\n }\n return lines;\n }, []);\n if (!lines.length) return;\n return lines.join('\\n');\n }\n\n override toAst() {\n // Return a dummy comment node for compliance.\n return py.factory.createComment(this.resolve() ?? '');\n // return this.$node(new IdTsDsl(''));\n }\n}\n","import type { AnalysisContext, Node } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { DocFn, DocLines } from '../layout/doc';\nimport { DocPyDsl } from '../layout/doc';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport interface DocMethods extends Node {\n $docs(): string | undefined;\n doc(lines?: DocLines, fn?: DocFn): this;\n}\n\nexport function DocMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Doc extends Base {\n private _doc?: DocPyDsl;\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n protected doc(lines?: DocLines, fn?: DocFn): this {\n this._doc = new DocPyDsl(lines, fn);\n return this;\n }\n\n protected $docs(): string | undefined {\n return this._doc ? this._doc.resolve() : undefined;\n }\n }\n\n return Doc as unknown as MixinCtor<TBase, DocMethods>;\n}\n","import type { AnalysisContext, Node } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport interface LayoutMethods extends Node {\n /** Computes whether output should be multiline based on layout setting and element count. */\n $multiline(count: number): boolean;\n /** Sets automatic line output with optional threshold (default: 3). */\n auto(threshold?: number): this;\n /** Sets single line output. */\n inline(): this;\n /** Sets multi line output. */\n pretty(): this;\n}\n\nexport function LayoutMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Layout extends Base {\n protected static readonly DEFAULT_THRESHOLD = 3;\n protected layout: boolean | number | undefined;\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n protected auto(threshold: number = Layout.DEFAULT_THRESHOLD): this {\n this.layout = threshold;\n return this;\n }\n\n protected inline(): this {\n this.layout = false;\n return this;\n }\n\n protected pretty(): this {\n this.layout = true;\n return this;\n }\n\n protected $multiline(count: number): boolean {\n if (this.layout === undefined) {\n this.layout = Layout.DEFAULT_THRESHOLD;\n }\n if (count === 0) return false;\n return typeof this.layout === 'number' ? count >= this.layout : this.layout;\n }\n }\n\n return Layout as unknown as MixinCtor<TBase, LayoutMethods>;\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport type Modifiers = {\n /**\n * Checks if specified modifier is present.\n *\n * @param modifier - The modifier to check.\n * @returns True if modifier is present, false otherwise.\n */\n hasModifier(modifier: Modifier): boolean;\n modifiers: Array<py.Expression>;\n};\n\ntype Modifier = 'async';\n\nexport interface ModifierMethods extends Modifiers {\n /**\n * Adds a modifier of specified kind to modifiers list if condition is true.\n *\n * @param modifier - The modifier to add.\n * @param condition - Whether to add modifier.\n * @returns The parent node for chaining.\n */\n _m(modifier: Modifier, condition: boolean): this;\n}\n\nfunction modifierToKind(modifier: Modifier): py.Expression {\n switch (modifier) {\n case 'async':\n return py.factory.createIdentifier('async');\n }\n}\n\nfunction ModifiersMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Modifiers extends Base {\n protected modifiers: Array<py.Expression> = [];\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n protected hasModifier(modifier: Modifier): boolean {\n const kind = modifierToKind(modifier);\n return Boolean(this.modifiers.find((mod) => mod === kind));\n }\n\n protected _m(modifier: Modifier, condition: boolean): this {\n if (condition) {\n const kind = modifierToKind(modifier);\n this.modifiers.push(kind);\n }\n return this;\n }\n }\n\n return Modifiers as unknown as MixinCtor<TBase, ModifierMethods>;\n}\n\nexport interface AsyncMethods extends Modifiers {\n /**\n * Adds an `async` keyword modifier if condition is true.\n *\n * @param condition - Whether to add modifier (default: true).\n * @returns The target object for chaining.\n */\n async(condition?: boolean): this;\n}\n\n/**\n * Mixin that adds an `async` modifier to a node.\n */\nexport function AsyncMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n const Mixed = ModifiersMixin(Base as BaseCtor<T>);\n\n abstract class Async extends Mixed {\n protected async(condition?: boolean): this {\n const cond = !arguments.length ? true : Boolean(condition);\n return this._m('async', cond);\n }\n }\n\n return Async as unknown as MixinCtor<TBase, AsyncMethods>;\n}\n\nexport interface ExportMethods extends Modifiers {\n /**\n * Adds the `export` keyword modifier if the condition is true.\n *\n * @param condition - Whether to add the modifier (default: true).\n * @returns The target object for chaining.\n */\n export(condition?: boolean): this;\n}\n\n/**\n * Mixin that adds an `export` modifier to a node.\n */\nexport function ExportMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n const Mixed = ModifiersMixin(Base as BaseCtor<T>);\n\n abstract class Export extends Mixed {\n /**\n * Adds the `export` keyword modifier if the condition is true.\n *\n * @param condition - Whether to add the modifier (default: true).\n * @returns The target object for chaining.\n */\n protected export(condition?: boolean): this {\n const cond = !arguments.length ? true : Boolean(condition);\n this.exported = cond;\n // TODO: remove this side-effect once planner handles exported flag\n if (this.symbol) this.symbol.setExported(cond);\n return this;\n }\n }\n\n return Export as unknown as MixinCtor<TBase, ExportMethods>;\n}\n","/**\n * Matches characters from the start that are not valid Python identifier starts.\n * Python identifiers: starts with letter/underscore, followed by letters/digits/underscores.\n */\nconst illegalStartCharactersRegExp = /^[^a-zA-Z_]+/;\n\n/**\n * Matches if string contains only digits and optionally decimal point or leading minus.\n */\nconst numberRegExp = /^-?\\d+(\\.\\d+)?$/;\n\n/**\n * Python identifier pattern: starts with letter or underscore,\n * followed by letters, digits, or underscores.\n * Uses Unicode categories for full Python 3 compliance.\n */\nconst validPythonIdentifierRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/u;\n\n/**\n * Matches if a string looks like a valid Python identifier.\n */\nconst looksLikeIdentifierRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\nexport const regexp = {\n /**\n * Matches characters from the start that are not valid Python identifier starts.\n */\n illegalStartCharacters: illegalStartCharactersRegExp,\n /**\n * Simpler pattern for quick identifier checks.\n */\n looksLikeIdentifier: looksLikeIdentifierRegExp,\n /**\n * Matches if string contains only digits and optionally decimal point or leading minus.\n */\n number: numberRegExp,\n /**\n * Python identifier pattern for validation.\n */\n pythonIdentifier: validPythonIdentifierRegExp,\n};\n","const pythonKeywords = [\n 'and',\n 'as',\n 'assert',\n 'async',\n 'await',\n 'break',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'False',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'None',\n 'nonlocal',\n 'not',\n 'or',\n 'pass',\n 'raise',\n 'return',\n 'True',\n 'try',\n 'while',\n 'with',\n 'yield',\n];\n\nconst pythonBuiltins = [\n 'abs',\n 'aiter',\n 'all',\n 'anext',\n 'any',\n 'ascii',\n 'bin',\n 'bool',\n 'breakpoint',\n 'bytearray',\n 'bytes',\n 'callable',\n 'chr',\n 'classmethod',\n 'compile',\n 'complex',\n 'delattr',\n 'dict',\n 'dir',\n 'divmod',\n 'enumerate',\n 'eval',\n 'exec',\n 'filter',\n 'float',\n 'format',\n 'frozenset',\n 'getattr',\n 'globals',\n 'hasattr',\n 'hash',\n 'help',\n 'hex',\n 'id',\n 'input',\n 'int',\n 'isinstance',\n 'issubclass',\n 'iter',\n 'len',\n 'list',\n 'locals',\n 'map',\n 'max',\n 'memoryview',\n 'min',\n 'next',\n 'object',\n 'oct',\n 'open',\n 'ord',\n 'pow',\n 'print',\n 'property',\n 'range',\n 'repr',\n 'reversed',\n 'round',\n 'set',\n 'setattr',\n 'slice',\n 'sorted',\n 'staticmethod',\n 'str',\n 'sum',\n 'super',\n 'tuple',\n 'type',\n 'vars',\n 'zip',\n];\n\nexport const keywords = {\n pythonBuiltins,\n pythonKeywords,\n};\n","import { keywords } from './keywords';\n\ntype List = ReadonlyArray<string>;\n\nexport class ReservedList {\n private _array: List;\n private _set: Set<string>;\n\n constructor(values: List) {\n this._array = values;\n this._set = new Set(values);\n }\n\n get '~values'() {\n return this._set;\n }\n\n /**\n * Updates the reserved list with new values.\n *\n * @param values New reserved values or a function that receives the previous\n * reserved values and returns the new ones.\n */\n set(values: List | ((prev: List) => List)): void {\n const vals = typeof values === 'function' ? values(this._array) : values;\n this._array = vals;\n this._set = new Set(vals);\n }\n}\n\nconst runtimeReserved = new ReservedList([...keywords.pythonKeywords, ...keywords.pythonBuiltins]);\nconst keywordReserved = new ReservedList([...keywords.pythonKeywords]);\n\n/**\n * Reserved names for identifiers. These names will not be used\n * for variables, functions, classes, or other identifiers in generated code.\n */\nexport const reserved = {\n /**\n * Reserved names for Python language keywords. These names are syntactically\n * invalid as identifiers in any scope.\n */\n keywords: keywordReserved,\n /**\n * Reserved names for runtime identifiers. These names will not be used\n * for variables, functions, classes, or other runtime identifiers in\n * generated code.\n */\n runtime: runtimeReserved,\n};\n","import { regexp } from './regexp';\nimport type { ReservedList } from './reserved';\nimport { reserved } from './reserved';\n\nexport function safeAccessorName(name: string): string {\n regexp.number.lastIndex = 0;\n if (regexp.number.test(name)) {\n return name.startsWith('-') ? `'${name}'` : name;\n }\n\n regexp.pythonIdentifier.lastIndex = 0;\n if (regexp.pythonIdentifier.test(name)) {\n return name;\n }\n return `'${name}'`;\n}\n\nconst validPythonChar = /^[a-zA-Z0-9_]$/;\n\nfunction safeName(name: string, reserved: ReservedList): string {\n let sanitized = '';\n let index: number;\n\n const first = name[0] ?? '';\n regexp.illegalStartCharacters.lastIndex = 0;\n if (regexp.illegalStartCharacters.test(first)) {\n // Check if character becomes valid when not in leading position (e.g., digits)\n if (validPythonChar.test(first)) {\n sanitized += '_';\n index = 0;\n } else {\n sanitized += '_';\n index = 1;\n }\n } else {\n sanitized += first;\n index = 1;\n }\n\n while (index < name.length) {\n const char = name[index] ?? '';\n sanitized += validPythonChar.test(char) ? char : '_';\n index += 1;\n }\n\n if (reserved['~values'].has(sanitized)) {\n sanitized = `${sanitized}_`;\n }\n\n return sanitized || '_';\n}\n\nexport function safeRuntimeName(name: string): string {\n return safeName(name, reserved.runtime);\n}\n\nexport function safeKeywordName(name: string): string {\n return safeName(name, reserved.keywords);\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { isSymbol, ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport type { SubscriptExpr } from '../expr/subscript';\nimport { NewlinePyDsl } from '../layout/newline';\nimport { DecoratorMixin } from '../mixins/decorator';\nimport { DocMixin } from '../mixins/doc';\nimport { LayoutMixin } from '../mixins/layout';\nimport { ExportMixin } from '../mixins/modifiers';\nimport { safeRuntimeName } from '../utils/name';\n\nexport type ClassBody = Array<PyDsl<py.Statement>>;\n\nconst Mixed = DecoratorMixin(DocMixin(ExportMixin(LayoutMixin(PyDsl<py.ClassDeclaration>))));\n\nexport class ClassPyDsl extends Mixed {\n readonly '~dsl' = 'ClassPyDsl';\n override readonly nameSanitizer = safeRuntimeName;\n\n protected baseClasses: Array<Ref<NodeName | SubscriptExpr>> = [];\n protected body: ClassBody = [];\n\n constructor(name: NodeName) {\n super();\n this.name.set(name);\n if (isSymbol(name)) {\n name.setKind('class');\n }\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const baseClass of this.baseClasses) {\n ctx.analyze(baseClass);\n }\n ctx.analyze(this.name);\n ctx.pushScope();\n try {\n for (const baseClass of this.baseClasses) {\n ctx.injectChildren(baseClass);\n }\n for (const item of this.body) {\n ctx.analyze(item);\n }\n } finally {\n ctx.popScope();\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n /** Returns true if the class has any members. */\n get hasBody(): boolean {\n return Boolean(this.body.length);\n }\n\n /** Adds one or more class members (fields, methods, etc.). */\n do(...items: ClassBody): this {\n this.body.push(...items);\n return this;\n }\n\n /** Records base classes to extend from. */\n extends(...baseClass: ReadonlyArray<NodeName | SubscriptExpr>): this {\n this.baseClasses.push(...baseClass.map((item) => ref(item)));\n return this;\n }\n\n /** Inserts an empty line between members for formatting. */\n newline(): this {\n this.body.push(new NewlinePyDsl());\n return this;\n }\n\n override toAst() {\n this.$validate();\n // const uniqueClasses: Array<py.Expression> = [];\n\n // for (const base of baseClass) {\n // let expr: py.Expression;\n // if (typeof base === 'string' || base instanceof PyDsl) {\n // expr = this.$node(base) as py.Expression;\n // } else if (isSymbol(base)) {\n // expr = py.factory.createIdentifier(base.finalName);\n // }\n\n // // Avoid duplicates by checking if already added\n // const exists = uniqueClasses.some((existing) => {\n // const existingExpr = this.$node(existing) as py.Expression;\n // return existingExpr === expr;\n // });\n\n // if (!exists) {\n // uniqueClasses.push(expr);\n // }\n // }\n\n return py.factory.createClassDeclaration(\n this.name.toString(),\n this.$node(this.body),\n this.$decorators(),\n this.baseClasses.map((c) => this.$node(c)),\n this.$docs(),\n );\n }\n\n $validate(): asserts this {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Class declaration missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.name.toString()) missing.push('name');\n return missing;\n }\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { isSymbol, ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport { DecoratorMixin } from '../mixins/decorator';\nimport { DocMixin } from '../mixins/doc';\nimport { LayoutMixin } from '../mixins/layout';\nimport { ExportMixin } from '../mixins/modifiers';\nimport { safeRuntimeName } from '../utils/name';\n\nexport type EnumMember = {\n name: NodeName;\n value: number | string | boolean;\n};\n\ntype EnumDecision =\n | { baseRefs: Array<Ref<NodeName>>; strategy: 'StrEnum' }\n | { baseRefs: Array<Ref<NodeName>>; strategy: 'IntEnum' }\n | { baseRefs: Array<Ref<NodeName>>; enumSymbol: NodeName; strategy: 'str+Enum' }\n | { baseRefs: Array<Ref<NodeName>>; enumSymbol: NodeName; strategy: 'int+Enum' }\n | { baseRefs: Array<Ref<NodeName>>; enumSymbol: NodeName; strategy: 'Enum' };\n\nconst Mixed = DecoratorMixin(DocMixin(ExportMixin(LayoutMixin(PyDsl<py.ClassDeclaration>))));\n\nexport class EnumPyDsl extends Mixed {\n readonly '~dsl' = 'EnumPyDsl';\n override readonly nameSanitizer = safeRuntimeName;\n\n private _decision?: EnumDecision;\n private _members: Array<EnumMember> = [];\n\n constructor(name: NodeName) {\n super();\n this.name.set(name);\n if (isSymbol(name)) {\n name.setKind('class');\n }\n }\n\n members(...members: ReadonlyArray<EnumMember>): this {\n this._members.push(...members);\n return this;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n\n const hasStrings = this._members.some((m) => typeof m.value === 'string');\n const hasNumbers = this._members.some((m) => typeof m.value === 'number');\n const isMixed = hasStrings && hasNumbers;\n\n if (!isMixed && hasStrings) {\n if (this.meta.Version.gte('3.11')) {\n this._decision = { baseRefs: [ref(this.meta.symbols.enum.StrEnum)], strategy: 'StrEnum' };\n } else {\n this._decision = {\n baseRefs: [ref('str'), ref(this.meta.symbols.enum.Enum)],\n enumSymbol: this.meta.symbols.enum.Enum,\n strategy: 'str+Enum',\n };\n }\n } else if (!isMixed && hasNumbers) {\n if (this.meta.Version.gte('3.11')) {\n this._decision = { baseRefs: [ref(this.meta.symbols.enum.IntEnum)], strategy: 'IntEnum' };\n } else {\n this._decision = {\n baseRefs: [ref('int'), ref(this.meta.symbols.enum.Enum)],\n enumSymbol: this.meta.symbols.enum.Enum,\n strategy: 'int+Enum',\n };\n }\n } else {\n this._decision = {\n baseRefs: [ref(this.meta.symbols.enum.Enum)],\n enumSymbol: this.meta.symbols.enum.Enum,\n strategy: 'Enum',\n };\n }\n\n for (const r of this._decision.baseRefs) {\n ctx.analyze(r);\n }\n for (const m of this._members) {\n ctx.analyze(ref(m.name));\n }\n\n ctx.analyze(this.name);\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n override toAst() {\n this.$validate();\n\n const decision = this._decision!;\n\n const body = this._members.map((m) =>\n py.factory.createAssignment(this.$node(m.name), undefined, py.factory.createLiteral(m.value)),\n );\n\n return py.factory.createClassDeclaration(\n this.name.toString(),\n body,\n this.$decorators(),\n decision.baseRefs.map((r) => this.$node(r)),\n this.$docs(),\n );\n }\n\n $validate(): asserts this {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Enum declaration missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.name.toString()) missing.push('name');\n if (!this._decision) missing.push('analyze');\n return missing;\n }\n}\n","import type { AnalysisContext, Node, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport type ValueExpr = NodeName | MaybePyDsl<py.Expression>;\n\nexport interface ValueMethods extends Node {\n $value(): py.Expression | undefined;\n /** Sets the initializer expression (e.g., `= expr`). */\n assign(expr: ValueExpr): this;\n}\n\nexport function ValueMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Value extends Base {\n protected value?: Ref<ValueExpr>;\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this.value);\n }\n\n protected assign(expr: ValueExpr): this {\n this.value = ref(expr);\n return this;\n }\n\n protected $value(): py.Expression | undefined {\n return this.$node(this.value);\n }\n }\n\n return Value as unknown as MixinCtor<TBase, ValueMethods>;\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { isSymbol, ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { type MaybePyDsl, PyDsl } from '../base';\nimport { ValueMixin } from '../mixins/value';\nimport { safeKeywordName } from '../utils/name';\n\nconst Mixed = ValueMixin(PyDsl<py.Assignment>);\n\nexport type FieldType = NodeName | MaybePyDsl<py.Expression>;\n\nexport class FieldPyDsl extends Mixed {\n readonly '~dsl' = 'FieldPyDsl';\n override readonly nameSanitizer = safeKeywordName;\n\n protected _type?: Ref<FieldType>;\n\n constructor(name?: NodeName) {\n super();\n if (name) this.name.set(name);\n if (isSymbol(name)) {\n name.setKind('var');\n }\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this.name);\n ctx.analyze(this._type);\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n /** Sets the type annotation for the field. */\n type(type: FieldType): this {\n this._type = ref(type);\n return this;\n }\n\n override toAst() {\n this.$validate();\n const target = this.$node(this.name)!;\n const type = this.$_type();\n const value = this.$value();\n\n return py.factory.createAssignment(target, type, value);\n }\n\n $validate(): asserts this {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Field declaration missing ${missing.join(' and ')}`);\n }\n\n protected $_type(): py.Expression | undefined {\n return this.$node(this._type);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.$node(this.name)) missing.push('name');\n const hasAnnotation = this.$_type();\n const hasValue = this.$value();\n if (!hasAnnotation && !hasValue) {\n missing.push('.type() or .assign()');\n }\n return missing;\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\nconst Mixed = PyDsl<py.Statement>;\n\nexport class StmtPyDsl extends Mixed {\n readonly '~dsl' = 'StmtPyDsl';\n\n protected _inner: py.Expression | py.Statement | PyDsl<any>;\n\n constructor(inner: py.Expression | py.Statement | PyDsl<any>) {\n super();\n this._inner = inner;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._inner);\n }\n\n override toAst() {\n const node = this.$node(this._inner);\n if (isStatement(node)) return node;\n return py.factory.createExpressionStatement(node);\n }\n}\n\n/** Checks whether a Python AST node is a statement. */\nfunction isStatement(node: py.Expression | py.Statement): node is py.Statement {\n const statementKinds = new Set([\n py.PyNodeKind.Assignment,\n py.PyNodeKind.AugmentedAssignment,\n py.PyNodeKind.Block,\n py.PyNodeKind.BreakStatement,\n py.PyNodeKind.ClassDeclaration,\n py.PyNodeKind.Comment,\n py.PyNodeKind.ContinueStatement,\n py.PyNodeKind.EmptyStatement,\n py.PyNodeKind.ExpressionStatement,\n py.PyNodeKind.ForStatement,\n py.PyNodeKind.FunctionDeclaration,\n py.PyNodeKind.IfStatement,\n py.PyNodeKind.ImportStatement,\n py.PyNodeKind.RaiseStatement,\n py.PyNodeKind.ReturnStatement,\n py.PyNodeKind.TryStatement,\n py.PyNodeKind.WhileStatement,\n py.PyNodeKind.WithStatement,\n ]);\n return statementKinds.has(node.kind);\n}\n","import type { AnalysisContext, Node } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { StmtPyDsl } from '../stmt/stmt';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport type DoExpr = MaybePyDsl<py.Expression | py.Statement>;\n\nexport interface DoMethods extends Node {\n /** Renders the collected `.do()` calls into an array of `py.Statement` nodes. */\n $do(): ReadonlyArray<py.Statement>;\n _do: Array<DoExpr>;\n /** Adds one or more expressions/statements to the body. */\n do(...items: ReadonlyArray<DoExpr>): this;\n}\n\nexport function DoMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Do extends Base {\n protected _do: Array<DoExpr> = [];\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.pushScope();\n try {\n for (const item of this._do) {\n ctx.analyze(item);\n }\n } finally {\n ctx.popScope();\n }\n }\n\n protected do(...items: ReadonlyArray<DoExpr>): this {\n this._do.push(...items);\n return this;\n }\n\n protected $do(): ReadonlyArray<py.Statement> {\n return this.$node(this._do.map((item) => new StmtPyDsl(item)));\n }\n }\n\n return Do as unknown as MixinCtor<TBase, DoMethods>;\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\nexport type ParamDefaultValue = NodeName | py.Expression | undefined;\nexport type ParamFn = (p: ParamPyDsl) => void;\nexport type ParamName = NodeName | ParamFn;\nexport type ParamType = NodeName | PyDsl<py.Expression> | undefined;\n\nexport type ParamCtor = (name: ParamName, fn?: ParamFn) => ParamPyDsl;\n\nexport class ParamPyDsl extends PyDsl<py.FunctionParameter> {\n readonly '~dsl' = 'ParamPyDsl';\n\n protected _defaultValue?: Ref<ParamDefaultValue>;\n protected _type?: Ref<ParamType>;\n\n constructor(name: ParamName, fn?: ParamFn) {\n super();\n if (typeof name === 'function') {\n name(this);\n } else {\n this.name.set(name);\n fn?.(this);\n }\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this.name);\n ctx.analyze(this._type);\n ctx.analyze(this._defaultValue);\n }\n\n /** Sets the parameter default value. */\n default(value: ParamDefaultValue): this {\n this._defaultValue = ref(value);\n return this;\n }\n\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n /** Sets the parameter type. */\n type(type: ParamType): this {\n this._type = ref(type);\n return this;\n }\n\n override toAst() {\n this.$validate();\n return py.factory.createFunctionParameter(\n this.name.toString(),\n this.$node(this._type),\n this.$node(this._defaultValue),\n );\n }\n\n $validate(): asserts this {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Parameter missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.name.toString()) missing.push('name');\n return missing;\n }\n}\n","import type { AnalysisContext, Node } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport type { ParamCtor, ParamFn, ParamName } from '../decl/param';\nimport { ParamPyDsl } from '../decl/param';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport interface ParamMethods extends Node {\n /** Renders the parameters into an array of `FunctionParameter`s. */\n $params(): ReadonlyArray<py.FunctionParameter>;\n /** Adds a parameter. */\n param(...args: Parameters<ParamCtor>): this;\n /** Adds multiple parameters. */\n params(...params: ReadonlyArray<MaybePyDsl<py.FunctionParameter>>): this;\n}\n\nexport function ParamMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Param extends Base {\n protected _params: Array<MaybePyDsl<py.FunctionParameter>> = [];\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const param of this._params) {\n ctx.analyze(param);\n }\n }\n\n protected param(name: ParamName, fn?: ParamFn): this {\n const p = typeof name === 'function' ? new ParamPyDsl(name) : new ParamPyDsl(name, fn);\n this._params.push(p);\n return this;\n }\n\n protected params(...params: ReadonlyArray<MaybePyDsl<py.FunctionParameter>>): this {\n this._params.push(...params);\n return this;\n }\n\n protected $params(): ReadonlyArray<py.FunctionParameter> {\n return this.$node(this._params);\n }\n }\n\n return Param as unknown as MixinCtor<TBase, ParamMethods>;\n}\n","import type { AnalysisContext, Node, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport interface ReturnsMethods extends Node {\n $returns(): py.Expression | undefined;\n returns(type: NodeName | py.Expression): this;\n}\n\nexport function ReturnsMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Returns extends Base {\n protected _returns?: Ref<NodeName | py.Expression>;\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._returns);\n }\n\n returns(type: NodeName | py.Expression): this {\n this._returns = ref(type);\n return this;\n }\n\n protected $returns(): py.Expression | undefined {\n return this.$node(this._returns);\n }\n }\n\n return Returns as unknown as MixinCtor<TBase, ReturnsMethods>;\n}\n","import type { AnalysisContext, NodeName } from '@hey-api/codegen-core';\nimport { isSymbol } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport { DecoratorMixin } from '../mixins/decorator';\nimport { DoMixin } from '../mixins/do';\nimport { DocMixin } from '../mixins/doc';\nimport { LayoutMixin } from '../mixins/layout';\nimport { AsyncMixin, ExportMixin } from '../mixins/modifiers';\nimport { ParamMixin } from '../mixins/param';\nimport { ReturnsMixin } from '../mixins/returns';\nimport { safeRuntimeName } from '../utils/name';\n\nconst Mixed = AsyncMixin(\n DecoratorMixin(\n DocMixin(\n DoMixin(ExportMixin(LayoutMixin(ParamMixin(ReturnsMixin(PyDsl<py.FunctionDeclaration>))))),\n ),\n ),\n);\n\nexport class FuncPyDsl extends Mixed {\n readonly '~dsl' = 'FuncPyDsl';\n override readonly nameSanitizer = safeRuntimeName;\n\n constructor(name: NodeName, fn?: (f: FuncPyDsl) => void) {\n super();\n this.name.set(name);\n if (isSymbol(name)) {\n name.setKind('function');\n }\n fn?.(this);\n }\n\n override analyze(ctx: AnalysisContext): void {\n ctx.pushScope();\n try {\n super.analyze(ctx);\n ctx.analyze(this.name);\n } finally {\n ctx.popScope();\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n override toAst() {\n this.$validate();\n return py.factory.createFunctionDeclaration(\n this.name.toString(),\n this.$params(),\n this.$returns(),\n this.$do(),\n this.$decorators(),\n this.$docs(),\n this.modifiers,\n );\n }\n\n $validate(): asserts this {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Function declaration missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.name.toString()) missing.push('name');\n return missing;\n }\n}\n","import type { AnalysisContext, NodeName } from '@hey-api/codegen-core';\nimport { isSymbol } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport { DecoratorMixin } from '../mixins/decorator';\nimport { DoMixin } from '../mixins/do';\nimport { DocMixin } from '../mixins/doc';\nimport { LayoutMixin } from '../mixins/layout';\nimport { AsyncMixin } from '../mixins/modifiers';\nimport { ParamMixin } from '../mixins/param';\nimport { ReturnsMixin } from '../mixins/returns';\nimport { safeKeywordName } from '../utils/name';\n\nconst Mixed = AsyncMixin(\n DecoratorMixin(\n DocMixin(DoMixin(LayoutMixin(ParamMixin(ReturnsMixin(PyDsl<py.FunctionDeclaration>))))),\n ),\n);\n\nexport class MethodPyDsl extends Mixed {\n readonly '~dsl' = 'MethodPyDsl';\n override readonly nameSanitizer = safeKeywordName;\n\n constructor(name: NodeName, fn?: (f: MethodPyDsl) => void) {\n super();\n this.name.set(name);\n if (isSymbol(name)) {\n name.setKind('function');\n }\n fn?.(this);\n }\n\n override analyze(ctx: AnalysisContext): void {\n ctx.pushScope();\n try {\n super.analyze(ctx);\n ctx.analyze(this.name);\n } finally {\n ctx.popScope();\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n override toAst() {\n this.$validate();\n return py.factory.createFunctionDeclaration(\n this.name.toString(),\n this.$params(),\n this.$returns(),\n this.$do(),\n this.$decorators(),\n this.$docs(),\n this.modifiers,\n );\n }\n\n $validate(): asserts this {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Method declaration missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.name.toString()) missing.push('name');\n return missing;\n }\n}\n","import type { AttrCtor } from '../expr/attr';\nimport type { BinaryCtor } from '../expr/binary';\nimport type { CallCtor } from '../expr/call';\nimport type { ExprCtor } from '../expr/expr';\nimport type { SubscriptCtor } from '../expr/subscript';\nimport type { TupleCtor } from '../expr/tuple';\nimport type { ReturnCtor } from '../stmt/return';\n\ntype Ctor = (...args: Array<any>) => any;\n\ntype Factory<T extends Ctor> = {\n (...args: Parameters<T>): ReturnType<T>;\n /** Sets the implementation of this factory. */\n set(fn: T): void;\n};\n\nfunction createFactory<T extends Ctor>(name: string): Factory<T> {\n let impl: T | undefined;\n\n const slot = ((...args: Parameters<T>) => {\n if (!impl) throw new Error(`${name} factory not registered`);\n return impl(...args);\n }) as Factory<T>;\n\n slot.set = (fn: T) => {\n impl = fn;\n };\n\n return slot;\n}\n\nexport const f = {\n /** Factory for creating property access expressions (e.g., `obj.foo`). */\n attr: createFactory<AttrCtor>('attr'),\n\n /** Factory for creating binary expressions (e.g., `a + b`). */\n binary: createFactory<BinaryCtor>('binary'),\n\n /** Factory for creating function or method call expressions (e.g., `fn(arg)`). */\n call: createFactory<CallCtor>('call'),\n\n /** Factory for creating expression nodes. */\n expr: createFactory<ExprCtor>('expr'),\n\n /** Factory for creating return statements. */\n return: createFactory<ReturnCtor>('return'),\n\n /** Factory for creating slice expressions. */\n slice: createFactory<SubscriptCtor>('slice'),\n\n /** Factory for creating tuple expressions. */\n tuple: createFactory<TupleCtor>('tuple'),\n};\n","import type { AnalysisContext, Node } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport { f } from '../utils/factories';\nimport type { BaseCtor, DropFirst, MixinCtor } from './types';\n\nexport interface ExprMethods extends Node {\n /** Accesses a property on the current expression (e.g., `this.foo`). */\n attr(...args: DropFirst<Parameters<typeof f.attr>>): ReturnType<typeof f.attr>;\n /** Calls the current expression (e.g., `fn(arg1, arg2)`). */\n call(...args: DropFirst<Parameters<typeof f.call>>): ReturnType<typeof f.call>;\n /** Produces a `return` statement returning the current expression. */\n return(): ReturnType<typeof f.return>;\n /** Produces a subscript/slice expression (e.g., `expr[args]`). */\n slice(...args: DropFirst<Parameters<typeof f.slice>>): ReturnType<typeof f.slice>;\n}\n\nexport function ExprMixin<T extends py.Expression, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Expr extends Base {\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n protected attr(...args: DropFirst<Parameters<typeof f.attr>>): ReturnType<typeof f.attr> {\n return f.attr(this, ...args);\n }\n\n protected call(...args: DropFirst<Parameters<typeof f.call>>): ReturnType<typeof f.call> {\n return f.call(this, ...args);\n }\n\n protected return(): ReturnType<typeof f.return> {\n return f.return(this);\n }\n\n protected slice(...args: DropFirst<Parameters<typeof f.slice>>): ReturnType<typeof f.slice> {\n return f.slice(this, ...args);\n }\n }\n\n return Expr as unknown as MixinCtor<TBase, ExprMethods>;\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { fromRef, isSymbol, ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { ExprMixin } from '../mixins/expr';\nimport { f } from '../utils/factories';\n\nexport type AttrLeft = NodeName | MaybePyDsl<py.Expression>;\nexport type AttrCtor = (left: AttrLeft, right: NodeName) => AttrPyDsl;\n\nconst Mixed = ExprMixin(PyDsl<py.MemberExpression>);\n\nexport class AttrPyDsl extends Mixed {\n readonly '~dsl' = 'AttrPyDsl';\n\n protected left: Ref<AttrLeft>;\n\n constructor(left: AttrLeft, right: NodeName) {\n super();\n this.left = ref(left);\n this.name.set(right);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this.left);\n ctx.analyze(this.name);\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n override toAst() {\n this.$validate();\n\n const leftNode = this.$node(this.left);\n const right = fromRef(this.name);\n const value = isSymbol(right) ? right.finalName : right;\n return py.factory.createMemberExpression(\n leftNode,\n py.factory.createIdentifier(value as string),\n );\n }\n\n $validate(): asserts this is this & {\n left: MaybePyDsl<py.Expression>;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Attribute access missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.name.toString()) missing.push('property name');\n return missing;\n }\n}\n\nf.attr.set((...args) => new AttrPyDsl(...args));\n","import type { AnalysisContext, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { PyBinaryOperator } from '../../py-compiler/nodes/expressions/binary';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { f } from '../utils/factories';\n\nexport type BinaryCtor = (\n left: MaybePyDsl<py.Expression>,\n op: PyBinaryOperator,\n right: MaybePyDsl<py.Expression>,\n) => BinaryPyDsl;\n\nconst Mixed = PyDsl<py.BinaryExpression>;\n\nexport class BinaryPyDsl extends Mixed {\n readonly '~dsl' = 'BinaryPyDsl';\n\n protected _left?: Ref<MaybePyDsl<py.Expression>>;\n protected _op?: PyBinaryOperator;\n protected _right?: Ref<MaybePyDsl<py.Expression>>;\n\n constructor(\n left: MaybePyDsl<py.Expression>,\n op: PyBinaryOperator,\n right: MaybePyDsl<py.Expression>,\n ) {\n super();\n this._left = ref(left);\n this._op = op;\n this._right = ref(right);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._left);\n ctx.analyze(this._right);\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n and(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('and', right);\n }\n\n div(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('/', right);\n }\n\n eq(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('==', right);\n }\n\n floordiv(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('//', right);\n }\n\n gt(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('>', right);\n }\n\n gte(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('>=', right);\n }\n\n in_(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('in', right);\n }\n\n is(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('is', right);\n }\n\n isNot(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('is not', right);\n }\n\n lt(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('<', right);\n }\n\n lte(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('<=', right);\n }\n\n minus(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('-', right);\n }\n\n mod(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('%', right);\n }\n\n neq(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('!=', right);\n }\n\n notIn(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('not in', right);\n }\n\n or(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('or', right);\n }\n\n plus(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('+', right);\n }\n\n pow(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('**', right);\n }\n\n times(right: MaybePyDsl<py.Expression>): this {\n return this.opAndExpr('*', right);\n }\n\n override toAst() {\n this.$validate();\n\n return py.factory.createBinaryExpression(\n this.$node(this._left!),\n this._op!,\n this.$node(this._right!),\n );\n }\n\n $validate(): asserts this is this & {\n _left: MaybePyDsl<py.Expression>;\n _op: PyBinaryOperator;\n _right: MaybePyDsl<py.Expression>;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Binary expression missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this._left) missing.push('left operand');\n if (!this._op) missing.push('operator');\n if (!this._right) missing.push('right operand');\n return missing;\n }\n\n private opAndExpr(op: PyBinaryOperator, right: MaybePyDsl<py.Expression>): this {\n this._right = ref(right);\n this._op = op;\n return this;\n }\n}\n\nf.binary.set((...args) => new BinaryPyDsl(...args));\n","import type { AnalysisContext, Node, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport type { BaseCtor, MixinCtor } from './types';\n\ntype Arg = NodeName | MaybePyDsl<py.Expression>;\n\nexport interface ArgsMethods extends Node {\n /** Renders the arguments into an array of `Expression`s. */\n $args(): ReadonlyArray<py.Expression>;\n /** Adds a single expression argument. */\n arg(arg: Arg | undefined): this;\n /** Adds one or more expression arguments. */\n args(...args: ReadonlyArray<Arg | undefined>): this;\n}\n\n/**\n * Adds `.arg()` and `.args()` for managing expression arguments in call-like nodes.\n */\nexport function ArgsMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Args extends Base {\n protected _args: Array<Ref<Arg>> = [];\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const arg of this._args) {\n ctx.analyze(arg);\n }\n }\n\n protected arg(arg: Arg | undefined): this {\n if (arg !== undefined) this._args.push(ref(arg));\n return this;\n }\n\n protected args(...args: ReadonlyArray<Arg | undefined>): this {\n this._args.push(\n ...args.filter((a): a is NonNullable<typeof a> => a !== undefined).map((a) => ref(a)),\n );\n return this;\n }\n\n protected $args(): ReadonlyArray<py.Expression> {\n return this.$node(this._args).map((arg) => this.$node(arg));\n }\n }\n\n return Args as unknown as MixinCtor<TBase, ArgsMethods>;\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { ArgsMixin } from '../mixins/args';\nimport { ExprMixin } from '../mixins/expr';\nimport { f } from '../utils/factories';\n\nexport type CallArgs = ReadonlyArray<CallCallee | undefined>;\nexport type CallCallee = NodeName | MaybePyDsl<py.Expression>;\nexport type CallCtor = (callee: CallCallee, ...args: CallArgs) => CallPyDsl;\n\nconst Mixed = ArgsMixin(ExprMixin(PyDsl<py.CallExpression>));\n\nexport class CallPyDsl extends Mixed {\n readonly '~dsl' = 'CallPyDsl';\n\n protected _callee: Ref<CallCallee>;\n\n constructor(callee: CallCallee, ...args: CallArgs) {\n super();\n this._callee = ref(callee);\n this.args(...args);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._callee);\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n override toAst() {\n this.$validate();\n\n return py.factory.createCallExpression(this.$node(this._callee!), this.$args());\n }\n\n $validate(): asserts this is this & {\n _callee: MaybePyDsl<py.Expression>;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Call expression missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this._callee) missing.push('callee');\n return missing;\n }\n}\n\nf.call.set((...args) => new CallPyDsl(...args));\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { LayoutMixin } from '../mixins/layout';\n\nconst Mixed = LayoutMixin(PyDsl<py.DictExpression>);\n\nexport class DictPyDsl extends Mixed {\n readonly '~dsl' = 'DictPyDsl';\n\n protected _entries: Array<{\n key: MaybePyDsl<py.Expression>;\n value: MaybePyDsl<py.Expression>;\n }> = [];\n\n constructor(\n ...entries: Array<{ key: MaybePyDsl<py.Expression>; value: MaybePyDsl<py.Expression> }>\n ) {\n super();\n this._entries = entries;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const entry of this._entries) {\n ctx.analyze(entry.key);\n ctx.analyze(entry.value);\n }\n }\n\n entry(key: MaybePyDsl<py.Expression>, value: MaybePyDsl<py.Expression>): this {\n this._entries.push({ key, value });\n return this;\n }\n\n entries(\n ...entries: ReadonlyArray<{ key: MaybePyDsl<py.Expression>; value: MaybePyDsl<py.Expression> }>\n ): this {\n this._entries.push(...entries);\n return this;\n }\n\n override toAst() {\n const astEntries = this._entries.map((entry) => ({\n key: this.$node(entry.key),\n value: this.$node(entry.value),\n }));\n return py.factory.createDictExpression(astEntries);\n }\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { isNode, isSymbol, ref } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { ExprMixin } from '../mixins/expr';\nimport { f } from '../utils/factories';\n\nexport type ExprId = NodeName | MaybePyDsl<py.Expression>;\nexport type ExprCtor = (id: ExprId) => ExprPyDsl;\n\nconst Mixed = ExprMixin(PyDsl<py.Expression>);\n\nexport class ExprPyDsl extends Mixed {\n readonly '~dsl' = 'ExprPyDsl';\n\n protected _exprInput: Ref<ExprId>;\n\n constructor(id: ExprId) {\n super();\n this._exprInput = ref(id);\n if (typeof id === 'string' || isSymbol(id)) {\n this.name.set(id);\n } else if (isNode(id)) {\n this.name.set(id.name);\n }\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._exprInput);\n }\n\n override toAst() {\n return this.$node(this._exprInput);\n }\n}\n\nf.expr.set((...args) => new ExprPyDsl(...args));\n","import type { AnalysisContext, NodeName } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\nconst Mixed = PyDsl<py.Identifier>;\n\nexport class IdPyDsl extends Mixed {\n readonly '~dsl' = 'IdPyDsl';\n\n constructor(name: NodeName) {\n super();\n this.name.set(name);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this.name);\n }\n\n override toAst() {\n return py.factory.createIdentifier(this.name.toString());\n }\n}\n","export class RString {\n readonly '~brand' = 'RString' as const;\n constructor(readonly value: string) {}\n}\n\nexport function rString(value: string): RString {\n return new RString(value);\n}\n","import type { NodeName } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { RString } from '../utils/r-string';\n\nexport type KwargValue = string | number | boolean | null | RString | MaybePyDsl<py.Expression>;\n\nconst Mixed = PyDsl<py.KeywordArgument>;\n\nexport class KwargPyDsl extends Mixed {\n readonly '~dsl' = 'KwargPyDsl';\n\n protected _value: KwargValue;\n\n constructor(name: NodeName, value: KwargValue) {\n super();\n this.name.set(name);\n this._value = value;\n }\n\n get key(): string {\n return this.name.toString();\n }\n\n override toAst() {\n return py.factory.createKeywordArgument(this.name.toString(), this.$valueToNode(this._value));\n }\n\n private $valueToNode(value: KwargValue) {\n if (value instanceof RString) {\n return py.factory.createRStringExpression(value.value);\n }\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value === null\n ) {\n return py.factory.createLiteral(value);\n }\n return this.$node(value);\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { LayoutMixin } from '../mixins/layout';\n\nconst Mixed = LayoutMixin(PyDsl<py.ListExpression>);\n\nexport class ListPyDsl extends Mixed {\n readonly '~dsl' = 'ListPyDsl';\n\n protected _elements: Array<MaybePyDsl<py.Expression>> = [];\n\n constructor(...elements: Array<MaybePyDsl<py.Expression>>) {\n super();\n this._elements = elements;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const el of this._elements) {\n ctx.analyze(el);\n }\n }\n\n element(expr: MaybePyDsl<py.Expression>): this {\n this._elements.push(expr);\n return this;\n }\n\n elements(...exprs: ReadonlyArray<MaybePyDsl<py.Expression>>): this {\n this._elements.push(...exprs);\n return this;\n }\n\n override toAst() {\n const astElements = this._elements.map((el) => this.$node(el));\n return py.factory.createListExpression(astElements);\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\nconst Mixed = PyDsl<py.Literal>;\n\nexport class LiteralPyDsl extends Mixed {\n readonly '~dsl' = 'LiteralPyDsl';\n\n protected value: py.LiteralValue;\n\n constructor(value: py.LiteralValue) {\n super();\n this.value = value;\n }\n\n override analyze(_ctx: AnalysisContext): void {\n super.analyze(_ctx);\n }\n\n override toAst() {\n return py.factory.createLiteral(this.value);\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { LayoutMixin } from '../mixins/layout';\n\nconst Mixed = LayoutMixin(PyDsl<py.SetExpression>);\n\nexport class SetPyDsl extends Mixed {\n readonly '~dsl' = 'SetPyDsl';\n\n protected _elements: Array<MaybePyDsl<py.Expression>> = [];\n\n constructor(...elements: Array<MaybePyDsl<py.Expression>>) {\n super();\n this._elements = elements;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const el of this._elements) {\n ctx.analyze(el);\n }\n }\n\n element(expr: MaybePyDsl<py.Expression>): this {\n this._elements.push(expr);\n return this;\n }\n\n elements(...exprs: ReadonlyArray<MaybePyDsl<py.Expression>>): this {\n this._elements.push(...exprs);\n return this;\n }\n\n override toAst() {\n const astElements = this._elements.map((el) => this.$node(el));\n return py.factory.createSetExpression(astElements);\n }\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { type MaybePyDsl, PyDsl } from '../base';\nimport { LayoutMixin } from '../mixins/layout';\nimport { f } from '../utils/factories';\n\nexport type SubscriptExpr = NodeName | MaybePyDsl<py.Expression>;\nexport type SubscriptCtor = (\n value: SubscriptExpr,\n ...slices: Array<SubscriptExpr>\n) => SubscriptPyDsl;\n\nconst Mixed = LayoutMixin(PyDsl<py.SubscriptExpression>);\n\nexport class SubscriptPyDsl extends Mixed {\n readonly '~dsl' = 'SubscriptPyDsl';\n\n protected _slices: Array<Ref<SubscriptExpr>>;\n protected _value: Ref<SubscriptExpr>;\n\n constructor(value: SubscriptExpr, ...slices: Array<SubscriptExpr>) {\n super();\n this._slices = slices.map((slice) => ref(slice));\n this._value = ref(value);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._value);\n for (const slice of this._slices) {\n ctx.analyze(slice);\n }\n }\n\n override toAst() {\n const slice =\n this._slices.length === 1\n ? this.$node(this._slices[0]!)\n : py.factory.createSubscriptSlice(this._slices.map((s) => this.$node(s)));\n return py.factory.createSubscriptExpression(this.$node(this._value), slice);\n }\n}\n\nf.slice.set((...args) => new SubscriptPyDsl(...args));\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { LayoutMixin } from '../mixins/layout';\nimport { f } from '../utils/factories';\n\nexport type TupleElement = NodeName | MaybePyDsl<py.Expression>;\nexport type TupleCtor = (...elements: Array<TupleElement>) => TuplePyDsl;\n\nconst Mixed = LayoutMixin(PyDsl<py.TupleExpression>);\n\nexport class TuplePyDsl extends Mixed {\n readonly '~dsl' = 'TuplePyDsl';\n\n protected _elements: Array<Ref<TupleElement>> = [];\n\n constructor(...elements: Array<TupleElement>) {\n super();\n this._elements = elements.map((element) => ref(element));\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const el of this._elements) {\n ctx.analyze(el);\n }\n }\n\n element(expr: TupleElement): this {\n this._elements.push(ref(expr));\n return this;\n }\n\n elements(...exprs: ReadonlyArray<TupleElement>): this {\n this._elements.push(...exprs.map((expr) => ref(expr)));\n return this;\n }\n\n override toAst() {\n const astElements = this._elements.map((el) => this.$node(el));\n return py.factory.createTupleExpression(astElements);\n }\n}\n\nf.tuple.set((...args) => new TuplePyDsl(...args));\n","import type { AnalysisContext } from '@hey-api/codegen-core';\nimport type { MaybeArray } from '@hey-api/types';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport type { PyDslContext } from '../utils/context';\nimport { ctx } from '../utils/context';\n\ntype HintMaybeLazy<T> = ((ctx: PyDslContext) => T) | T;\nexport type HintFn = (d: HintPyDsl) => void;\nexport type HintLines = HintMaybeLazy<MaybeArray<string>>;\n\nexport class HintPyDsl extends PyDsl<py.Comment> {\n readonly '~dsl' = 'HintPyDsl';\n\n protected _lines: Array<HintLines> = [];\n\n constructor(lines?: HintLines, fn?: HintFn) {\n super();\n if (lines) this.add(lines);\n fn?.(this);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n add(lines: HintLines): this {\n this._lines.push(lines);\n return this;\n }\n\n apply<T extends py.Node>(node: T): T {\n const lines = this._resolveLines();\n if (!lines.length) return node;\n\n const existing = node.leadingComments ? [...node.leadingComments] : [];\n existing.push(...lines);\n node.leadingComments = existing;\n return node;\n }\n\n override toAst() {\n // Return a dummy comment node for compliance.\n const lines = this._resolveLines();\n return py.factory.createComment(lines.join('\\n'));\n }\n\n private _resolveLines(): Array<string> {\n return this._lines.reduce((lines: Array<string>, line: HintLines) => {\n if (typeof line === 'function') line = line(ctx);\n for (const l of typeof line === 'string' ? [line] : line) {\n if (l || l === '') lines.push(l);\n }\n return lines;\n }, []);\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport type { DoExpr } from '../mixins/do';\nimport { DoMixin } from '../mixins/do';\nimport { LayoutMixin } from '../mixins/layout';\n\nconst Mixed = DoMixin(LayoutMixin(PyDsl<py.Block>));\n\nexport class BlockPyDsl extends Mixed {\n readonly '~dsl' = 'BlockPyDsl';\n\n constructor(...items: Array<DoExpr>) {\n super();\n this.do(...items);\n }\n\n override analyze(ctx: AnalysisContext) {\n super.analyze(ctx);\n }\n\n override toAst() {\n const statements = this.$do();\n return py.factory.createBlock(statements);\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\nconst Mixed = PyDsl<py.BreakStatement>;\n\nexport class BreakPyDsl extends Mixed {\n readonly '~dsl' = 'BreakPyDsl';\n\n override analyze(_ctx: AnalysisContext): void {\n super.analyze(_ctx);\n }\n\n override toAst() {\n return py.factory.createBreakStatement();\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\nconst Mixed = PyDsl<py.ContinueStatement>;\n\nexport class ContinuePyDsl extends Mixed {\n readonly '~dsl' = 'ContinuePyDsl';\n\n override analyze(_ctx: AnalysisContext): void {\n super.analyze(_ctx);\n }\n\n override toAst() {\n return py.factory.createContinueStatement();\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport type { DoExpr } from '../mixins/do';\nimport { BlockPyDsl } from './block';\n\nconst Mixed = PyDsl<py.ForStatement>;\n\nexport class ForPyDsl extends Mixed {\n readonly '~dsl' = 'ForPyDsl';\n\n protected _body?: Array<DoExpr>;\n protected _else?: Array<DoExpr>;\n protected _iterable?: MaybePyDsl<py.Expression>;\n protected _target?: MaybePyDsl<py.Expression>;\n\n constructor(\n target: MaybePyDsl<py.Expression>,\n iterable: MaybePyDsl<py.Expression>,\n ...body: Array<DoExpr>\n ) {\n super();\n this._target = target;\n this._iterable = iterable;\n this._body = body;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n\n if (this._target) ctx.analyze(this._target);\n if (this._iterable) ctx.analyze(this._iterable);\n\n if (this._body) {\n ctx.pushScope();\n try {\n for (const stmt of this._body) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n\n if (this._else) {\n ctx.pushScope();\n try {\n for (const stmt of this._else) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n body(...items: Array<DoExpr>): this {\n this._body = items;\n return this;\n }\n\n else(...items: Array<DoExpr>): this {\n this._else = items;\n return this;\n }\n\n override toAst() {\n this.$validate();\n\n const body = new BlockPyDsl(...this._body!).$do();\n const elseBlock = this._else ? new BlockPyDsl(...this._else).$do() : undefined;\n\n return py.factory.createForStatement(\n this.$node(this._target!),\n this.$node(this._iterable!),\n [...body],\n elseBlock ? [...elseBlock] : undefined,\n );\n }\n\n $validate(): asserts this is this & {\n _body: Array<DoExpr>;\n _iterable: MaybePyDsl<py.Expression>;\n _target: MaybePyDsl<py.Expression>;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`For statement missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this._target) missing.push('target');\n if (!this._iterable) missing.push('iterable');\n if (!this._body || !this._body.length) missing.push('body');\n return missing;\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport type { DoExpr } from '../mixins/do';\nimport { DoMixin } from '../mixins/do';\nimport { BlockPyDsl } from './block';\n\nexport type IfCondition = string | MaybePyDsl<py.Expression>;\n\nconst Mixed = DoMixin(PyDsl<py.IfStatement>);\n\nexport class IfPyDsl extends Mixed {\n readonly '~dsl' = 'IfPyDsl';\n\n protected _condition?: IfCondition;\n protected _else?: Array<DoExpr>;\n\n constructor(condition?: IfCondition) {\n super();\n if (condition) this.condition(condition);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._condition);\n if (this._else) {\n ctx.pushScope();\n try {\n for (const stmt of this._else) {\n ctx.analyze(stmt);\n }\n } finally {\n ctx.popScope();\n }\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n condition(condition: IfCondition): this {\n this._condition = condition;\n return this;\n }\n\n otherwise(...items: Array<DoExpr>): this {\n this._else = items;\n return this;\n }\n\n override toAst() {\n this.$validate();\n\n const thenStatements = this.$do();\n const elseStatements = this._else ? new BlockPyDsl(...this._else).$do() : undefined;\n\n return py.factory.createIfStatement(\n this.$node(this._condition!),\n [...thenStatements],\n elseStatements ? [...elseStatements] : undefined,\n );\n }\n\n $validate(): asserts this is this & {\n _condition: IfCondition;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`If statement missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this._condition) missing.push('.condition()');\n if (!this._do.length) missing.push('.do()');\n return missing;\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\n\ntype ImportName = { alias?: string; name: string };\n\nconst Mixed = PyDsl<py.ImportStatement>;\n\nexport class ImportPyDsl extends Mixed {\n readonly '~dsl' = 'ImportPyDsl';\n\n protected isFrom: boolean = true;\n protected module: string = '';\n protected names?: ReadonlyArray<ImportName>;\n\n constructor(module: string);\n constructor(module: string, isFrom: boolean);\n constructor(module: string, names: ReadonlyArray<ImportName>, isFrom: boolean);\n constructor(\n module: string,\n namesOrIsFrom?: ReadonlyArray<ImportName> | boolean,\n isFrom?: boolean,\n ) {\n super();\n this.module = module;\n if (typeof namesOrIsFrom === 'boolean') {\n this.isFrom = namesOrIsFrom;\n } else if (Array.isArray(namesOrIsFrom)) {\n this.names = namesOrIsFrom;\n this.isFrom = isFrom ?? true;\n } else {\n this.isFrom = true;\n }\n }\n\n static from(module: string, names?: ReadonlyArray<ImportName>): ImportPyDsl {\n return names ? new ImportPyDsl(module, names, true) : new ImportPyDsl(module, true);\n }\n\n static direct(module: string): ImportPyDsl {\n return new ImportPyDsl(module, false);\n }\n\n override analyze(_ctx: AnalysisContext): void {\n super.analyze(_ctx);\n }\n\n override toAst() {\n return py.factory.createImportStatement(this.module, this.names, this.isFrom);\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\n// import { LiteralPyDsl } from '../expr/literal';\n\nconst Mixed = PyDsl<py.RaiseStatement>;\n\nexport class RaisePyDsl extends Mixed {\n readonly '~dsl' = 'RaisePyDsl';\n\n protected _error?: string | MaybePyDsl<py.Expression>;\n // protected msg?: string | MaybePyDsl<py.Expression>;\n\n constructor(error?: string | MaybePyDsl<py.Expression>) {\n super();\n this._error = error;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._error);\n // ctx.analyze(this.msg);\n }\n\n // /** Sets the message argument for the exception (e.g., `raise ValueError('msg')`). */\n // message(value: string | MaybePyDsl<py.Expression>): this {\n // this.msg = value;\n // return this;\n // }\n\n override toAst() {\n // Python's `raise` can be bare (re-raise), or `raise <expr>`.\n // Unlike JS `throw new Error(msg)`, Python uses `raise ErrorType(msg)` directly,\n // so the caller constructs the call expression themselves.\n const errorNode = this._error ? this.$node(this._error) : undefined;\n return py.factory.createRaiseStatement(errorNode);\n }\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { f } from '../utils/factories';\n\nexport type ReturnExpr = NodeName | MaybePyDsl<py.Expression>;\nexport type ReturnCtor = (expr?: ReturnExpr) => ReturnPyDsl;\n\nconst Mixed = PyDsl<py.ReturnStatement>;\n\nexport class ReturnPyDsl extends Mixed {\n readonly '~dsl' = 'ReturnPyDsl';\n\n protected _returnExpr?: Ref<ReturnExpr>;\n\n constructor(expr?: ReturnExpr) {\n super();\n if (expr) this._returnExpr = ref(expr);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this._returnExpr);\n }\n\n override toAst() {\n return py.factory.createReturnStatement(this.$node(this._returnExpr));\n }\n}\n\nf.return.set((...args) => new ReturnPyDsl(...args));\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { ref } from '@hey-api/codegen-core';\nimport type { MaybeArray } from '@hey-api/types';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport type { DoExpr } from '../mixins/do';\nimport { BlockPyDsl } from './block';\n\nconst Mixed = PyDsl<py.TryStatement>;\n\ntype ExceptType = string | MaybePyDsl<py.Expression>;\n\ninterface ExceptEntry {\n body: Array<DoExpr>;\n name?: Ref<NodeName>;\n types: Array<ExceptType>;\n}\n\nfunction exceptKey(types: Array<ExceptType>): string {\n return types\n .map((t) => (typeof t === 'string' ? t : '<<expr>>'))\n .sort()\n .join(',');\n}\n\nexport class TryPyDsl extends Mixed {\n readonly '~dsl' = 'TryPyDsl';\n\n /**\n * Ordered list of except clauses. We also keep a lookup map\n * (`_exceptIndex`) keyed by the normalised type key so that\n * repeated `.except()` calls with the same type set merge their\n * body statements instead of creating duplicate clauses.\n */\n protected _excepts: Array<ExceptEntry> = [];\n protected _exceptIndex: Map<string, number> = new Map();\n\n protected _finally?: Array<DoExpr>;\n protected _try?: Array<DoExpr>;\n\n constructor(...tryBlock: Array<DoExpr>) {\n super();\n this.try(...tryBlock);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n\n if (this._try) {\n ctx.pushScope();\n try {\n for (const stmt of this._try) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n\n for (const entry of this._excepts) {\n ctx.pushScope();\n try {\n ctx.analyze(entry.name);\n for (const t of entry.types) ctx.analyze(t);\n for (const stmt of entry.body) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n\n if (this._finally) {\n ctx.pushScope();\n try {\n for (const stmt of this._finally) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n /**\n * Add (or merge into) an except clause.\n *\n * ```ts\n * $.try(...)\n * .except('ValueError', 'e', body1, body2) // except ValueError as e:\n * .except(['TypeError', 'KeyError'], 'e', ...) // except (TypeError, KeyError) as e:\n * .except('ValueError', moreBody) // merges into first clause\n * ```\n *\n * @param types Single exception type or array of types.\n * @param nameOrBody Either the `as` variable name (`NodeName`) or the\n * first body expression. If it looks like a `NodeName` (string that\n * is a valid Python identifier and is *not* a DSL node), it is treated\n * as the name; pass body items after it.\n * @param body Remaining body statements.\n */\n except(\n types: MaybeArray<ExceptType>,\n nameOrBody?: NodeName | DoExpr,\n ...body: Array<DoExpr>\n ): this {\n const typeArr = Array.isArray(types) ? types : [types];\n const key = exceptKey(typeArr);\n\n let name: Ref<NodeName> | undefined;\n let bodyItems: Array<DoExpr>;\n\n // Disambiguate: if the second arg is a plain string that looks like\n // an identifier (no dots, no spaces, not a DSL node) treat it as\n // the `as` name. Otherwise it's the first body expression.\n if (nameOrBody !== undefined && this._isNodeName(nameOrBody)) {\n name = ref(nameOrBody as NodeName);\n bodyItems = body;\n } else if (nameOrBody !== undefined) {\n bodyItems = [nameOrBody as DoExpr, ...body];\n } else {\n bodyItems = body;\n }\n\n const existing = this._exceptIndex.get(key);\n if (existing !== undefined) {\n const entry = this._excepts[existing]!;\n entry.body.push(...bodyItems);\n if (name !== undefined) entry.name = name;\n } else {\n this._exceptIndex.set(key, this._excepts.length);\n this._excepts.push({ body: bodyItems, name, types: typeArr });\n }\n\n return this;\n }\n\n /** Add a bare `except:` clause (catches everything). */\n exceptAll(...body: Array<DoExpr>): this {\n const key = '';\n const existing = this._exceptIndex.get(key);\n if (existing !== undefined) {\n this._excepts[existing]!.body.push(...body);\n } else {\n this._exceptIndex.set(key, this._excepts.length);\n this._excepts.push({ body, types: [] });\n }\n return this;\n }\n\n finally(...items: Array<DoExpr>): this {\n this._finally = items;\n return this;\n }\n\n try(...items: Array<DoExpr>): this {\n this._try = items;\n return this;\n }\n\n override toAst() {\n this.$validate();\n\n const tryStatements = new BlockPyDsl(...this._try!).$do();\n\n let exceptClauses: Array<py.ExceptClause> | undefined;\n if (this._excepts.length) {\n exceptClauses = this._excepts.map((entry) => {\n const bodyStatements = new BlockPyDsl(...entry.body).$do();\n\n let exceptionType: py.Expression | undefined;\n if (entry.types.length === 1) {\n exceptionType = this.$node(entry.types[0]!);\n } else if (entry.types.length > 1) {\n exceptionType = py.factory.createTupleExpression(entry.types.map((t) => this.$node(t)));\n }\n\n const exceptionName = entry.name\n ? py.factory.createIdentifier(this.$name(entry.name) || String(entry.name['~ref']))\n : undefined;\n\n return py.factory.createExceptClause([...bodyStatements], exceptionType, exceptionName);\n });\n }\n\n const finallyStatements = this._finally\n ? [...new BlockPyDsl(...this._finally).$do()]\n : undefined;\n\n return py.factory.createTryStatement(\n [...tryStatements],\n exceptClauses,\n undefined,\n finallyStatements,\n );\n }\n\n $validate(): asserts this is this & {\n _try: Array<DoExpr>;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Try statement missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this._try || !this._try.length) missing.push('.try()');\n return missing;\n }\n\n /**\n * Heuristic: a value is a `NodeName` (intended as the `as` variable)\n * if it is a plain string matching a Python identifier pattern, or a\n * Symbol.\n */\n private _isNodeName(value: unknown): boolean {\n if (typeof value === 'string') {\n return /^[A-Za-z_]\\w*$/.test(value);\n }\n // Symbols from codegen-core have `~brand`\n if (value && typeof value === 'object' && '~brand' in value) {\n return true;\n }\n return false;\n }\n}\n","import type { AnalysisContext, NodeName, Ref } from '@hey-api/codegen-core';\nimport { isSymbol, ref } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport { type MaybePyDsl, PyDsl } from '../base';\nimport { ValueMixin } from '../mixins/value';\nimport { safeRuntimeName } from '../utils/name';\n\nconst Mixed = ValueMixin(PyDsl<py.Assignment>);\n\nexport type VarType = NodeName | MaybePyDsl<py.Expression>;\n\nexport class VarPyDsl extends Mixed {\n readonly '~dsl' = 'VarPyDsl';\n override readonly nameSanitizer = safeRuntimeName;\n\n protected _type?: Ref<VarType>;\n\n constructor(name?: NodeName) {\n super();\n if (name) this.name.set(name);\n if (isSymbol(name)) {\n name.setKind('var');\n }\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this.name);\n ctx.analyze(this._type);\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n /** Sets the type annotation for the variable. */\n type(type: VarType): this {\n this._type = ref(type);\n return this;\n }\n\n override toAst() {\n this.$validate();\n const target = this.$node(this.name)!;\n const type = this.$_type();\n const value = this.$value();\n\n return py.factory.createAssignment(target, type, value);\n }\n\n $validate(): asserts this {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`Variable assignment missing ${missing.join(' and ')}`);\n }\n\n protected $_type(): py.Expression | undefined {\n return this.$node(this._type);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this.$node(this.name)) missing.push('name');\n const hasAnnotation = this.$_type();\n const hasValue = this.$value();\n if (!hasAnnotation && !hasValue) {\n missing.push('.type() or .assign()');\n }\n return missing;\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport type { DoExpr } from '../mixins/do';\nimport { BlockPyDsl } from './block';\n\nconst Mixed = PyDsl<py.WhileStatement>;\n\nexport class WhilePyDsl extends Mixed {\n readonly '~dsl' = 'WhilePyDsl';\n\n protected _body?: Array<DoExpr>;\n protected _condition?: MaybePyDsl<py.Expression>;\n protected _else?: Array<DoExpr>;\n\n constructor(condition: MaybePyDsl<py.Expression>, ...body: Array<DoExpr>) {\n super();\n this._condition = condition;\n this._body = body;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n\n if (this._condition) ctx.analyze(this._condition);\n\n if (this._body) {\n ctx.pushScope();\n try {\n for (const stmt of this._body) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n\n if (this._else) {\n ctx.pushScope();\n try {\n for (const stmt of this._else) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n body(...items: Array<DoExpr>): this {\n this._body = items;\n return this;\n }\n\n else(...items: Array<DoExpr>): this {\n this._else = items;\n return this;\n }\n\n override toAst() {\n this.$validate();\n\n const body = new BlockPyDsl(...this._body!).$do();\n const elseBlock = this._else ? new BlockPyDsl(...this._else).$do() : undefined;\n\n return py.factory.createWhileStatement(\n this.$node(this._condition!),\n [...body],\n elseBlock ? [...elseBlock] : undefined,\n );\n }\n\n $validate(): asserts this is this & {\n _body: Array<DoExpr>;\n _condition: MaybePyDsl<py.Expression>;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`While statement missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this._condition) missing.push('condition');\n if (!this._body || !this._body.length) missing.push('body');\n return missing;\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport type { DoExpr } from '../mixins/do';\nimport { BlockPyDsl } from './block';\n\nconst Mixed = PyDsl<py.WithStatement>;\n\nexport type WithItemInput =\n | MaybePyDsl<py.Expression>\n | { alias?: MaybePyDsl<py.Expression>; context: MaybePyDsl<py.Expression> };\n\nexport class WithPyDsl extends Mixed {\n readonly '~dsl' = 'WithPyDsl';\n\n protected _body?: Array<DoExpr>;\n protected _items: Array<WithItemInput> = [];\n protected _modifier?: MaybePyDsl<py.Expression>;\n\n constructor(...items: Array<WithItemInput>) {\n super();\n this._items = items;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n\n for (const item of this._items) {\n if (typeof item === 'object' && 'context' in item) {\n ctx.analyze(item.context);\n ctx.analyze(item.alias);\n } else {\n ctx.analyze(item);\n }\n }\n if (this._modifier) ctx.analyze(this._modifier);\n\n if (this._body) {\n ctx.pushScope();\n try {\n for (const stmt of this._body) ctx.analyze(stmt);\n } finally {\n ctx.popScope();\n }\n }\n }\n\n /** Returns true when all required builder calls are present. */\n get isValid(): boolean {\n return !this.missingRequiredCalls().length;\n }\n\n body(...items: Array<DoExpr>): this {\n this._body = items;\n return this;\n }\n\n item(item: WithItemInput): this {\n this._items.push(item);\n return this;\n }\n\n modifier(expr: MaybePyDsl<py.Expression>): this {\n this._modifier = expr;\n return this;\n }\n\n async(): this {\n this._modifier = py.factory.createIdentifier('async');\n return this;\n }\n\n override toAst() {\n this.$validate();\n\n const astItems = this._items.map((item) => {\n if (typeof item === 'object' && 'context' in item) {\n return py.factory.createWithItem(this.$node(item.context), this.$node(item.alias));\n }\n return py.factory.createWithItem(this.$node(item), undefined);\n });\n\n const body = new BlockPyDsl(...this._body!).$do();\n\n return py.factory.createWithStatement(\n astItems,\n [...body],\n this._modifier ? [this.$node(this._modifier)] : undefined,\n );\n }\n\n $validate(): asserts this is this & {\n _body: Array<DoExpr>;\n } {\n const missing = this.missingRequiredCalls();\n if (!missing.length) return;\n throw new Error(`With statement missing ${missing.join(' and ')}`);\n }\n\n private missingRequiredCalls(): ReadonlyArray<string> {\n const missing: Array<string> = [];\n if (!this._items.length) missing.push('items');\n if (!this._body || !this._body.length) missing.push('.body()');\n return missing;\n }\n}\n","import type { AnalysisContext, NodeName, NodeScope, Ref, Symbol } from '@hey-api/codegen-core';\nimport { fromRef, ref } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { f } from '../utils/factories';\n\nconst Mixed = PyDsl<py.Expression>;\n\ntype Type = NodeName | MaybePyDsl<py.Expression>;\n\ntype TypeOrDecision =\n | {\n strategy: 'identity' | 'bitor';\n }\n | {\n strategy: 'typing';\n unionSymbol: Symbol;\n }\n | {\n optionalSymbol: Symbol;\n strategy: 'optional';\n unionSymbol?: Symbol;\n };\n\nexport class TypeOrPyDsl extends Mixed {\n readonly '~dsl' = 'TypeOrPyDsl';\n override scope: NodeScope = 'type';\n\n protected _types: Array<Ref<Type>> = [];\n private _decision?: TypeOrDecision;\n\n constructor(...nodes: Array<Type>) {\n super();\n this.types(...nodes);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const type of this._types) {\n ctx.analyze(type);\n }\n\n const flat = this.$flattenRefs(this._types);\n if (flat.length === 1) {\n this._decision = { strategy: 'identity' };\n } else if (this.meta.Version.gte('3.10')) {\n this._decision = { strategy: 'bitor' };\n } else if (this.meta.Version.lte('3.9')) {\n const hasNone = flat.some((r) => fromRef(r) === 'None');\n const nonNoneCount = flat.length - (hasNone ? 1 : 0);\n\n if (hasNone) {\n const optionalSymbol = this.meta.symbols.typing.Optional;\n ctx.analyze(optionalSymbol);\n\n if (nonNoneCount > 1) {\n const unionSymbol = this.meta.symbols.typing.Union;\n ctx.analyze(unionSymbol);\n this._decision = { optionalSymbol, strategy: 'optional', unionSymbol };\n } else {\n this._decision = { optionalSymbol, strategy: 'optional' };\n }\n } else {\n const unionSymbol = this.meta.symbols.typing.Union;\n ctx.analyze(unionSymbol);\n this._decision = { strategy: 'typing', unionSymbol };\n }\n }\n }\n\n types(...nodes: Array<Type>): this {\n this._types.push(...nodes.map((n) => ref(n)));\n return this;\n }\n\n override toAst() {\n this.$validate();\n\n const decision = this._decision!;\n const flat = this.$flatten(this._types);\n\n if (decision.strategy === 'identity') {\n return flat[0]!;\n }\n\n if (decision.strategy === 'bitor') {\n return this.$node(\n flat\n .slice(1)\n .reduce<MaybePyDsl<py.Expression>>((left, right) => f.binary(left, '|', right), flat[0]!),\n );\n }\n\n if (decision.strategy === 'optional') {\n const flatRefs = this.$flattenRefs(this._types);\n const innerRefs = flatRefs.filter((r) => fromRef(r) !== 'None');\n const inner = innerRefs.map((r) => this.$node(r));\n const innerType =\n inner.length === 1 ? inner[0]! : this.$node(f.slice(decision.unionSymbol!, ...inner));\n return this.$node(f.slice(decision.optionalSymbol, innerType));\n }\n\n if (decision.strategy === 'typing') {\n return this.$node(f.slice(decision.unionSymbol, ...flat));\n }\n\n throw new Error('Invalid strategy');\n }\n\n $validate(): asserts this {\n if (!this._types.length) {\n throw new Error('Or type requires at least one member type');\n }\n }\n\n private $flatten(types: Array<Ref<Type>>): Array<py.Expression> {\n const flat: Array<py.Expression> = [];\n for (const t of types) {\n const node = fromRef(t);\n if (node instanceof TypeOrPyDsl) {\n flat.push(...this.$flatten(node._types));\n } else {\n flat.push(this.$node(t));\n }\n }\n return flat;\n }\n\n private $flattenRefs(types: Array<Ref<Type>>): Array<Ref<Type>> {\n const flat: Array<Ref<Type>> = [];\n const seen = new Set<Type>();\n for (const t of types) {\n const node = fromRef(t);\n if (node instanceof TypeOrPyDsl) {\n flat.push(...this.$flattenRefs(node._types));\n } else {\n if (!seen.has(node)) {\n seen.add(node);\n flat.push(t);\n }\n }\n }\n return flat;\n }\n}\n","import type { AnalysisContext, NodeName, NodeScope, Ref, Symbol } from '@hey-api/codegen-core';\nimport { fromRef, ref } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { MaybePyDsl } from '../base';\nimport { PyDsl } from '../base';\nimport { f } from '../utils/factories';\n\nconst Mixed = PyDsl<py.Expression>;\n\ntype Type = NodeName | MaybePyDsl<py.Expression>;\n\ntype TypeTupleDecision =\n | { strategy: 'empty' }\n | { anySymbol: Symbol; strategy: 'variadic' }\n | { strategy: 'fixed' };\n\nexport class TypeTuplePyDsl extends Mixed {\n readonly '~dsl' = 'TypeTuplePyDsl';\n override scope: NodeScope = 'type';\n\n protected _items: Array<Ref<Type>> = [];\n private _decision?: TypeTupleDecision;\n\n constructor(...nodes: Array<Type>) {\n super();\n this.items(...nodes);\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n for (const item of this._items) {\n ctx.analyze(item);\n }\n\n if (!this._items.length) {\n this._decision = { strategy: 'empty' };\n } else {\n const flat = this.$flattenRefs(this._items);\n const allResolved = flat.every((r) => fromRef(r) !== undefined);\n\n if (!allResolved) {\n const anySymbol = this.meta.symbols.typing.Any;\n ctx.analyze(anySymbol);\n this._decision = { anySymbol, strategy: 'variadic' };\n } else {\n this._decision = { strategy: 'fixed' };\n }\n }\n }\n\n items(...nodes: Array<Type>): this {\n this._items.push(...nodes.map((n) => ref(n)));\n return this;\n }\n\n override toAst() {\n this.$validate();\n\n const decision = this._decision!;\n\n if (decision.strategy === 'empty') {\n return this.$node(f.slice('tuple', f.tuple()));\n }\n\n if (decision.strategy === 'variadic') {\n return this.$node(f.slice('tuple', decision.anySymbol, '...'));\n }\n\n const flat = this.$flatten(this._items);\n return this.$node(f.slice('tuple', ...flat));\n }\n\n $validate(): asserts this {\n if (this._decision === undefined) {\n throw new Error('TypeTuplePyDsl has not been analyzed');\n }\n }\n\n private $flatten(items: Array<Ref<Type>>): Array<py.Expression> {\n return items.map((t) => this.$node(t));\n }\n\n private $flattenRefs(items: Array<Ref<Type>>): Array<Ref<Type>> {\n return items;\n }\n}\n","import type { AnalysisContext } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport { PyDsl } from '../base';\nimport type { PyDslContext } from './context';\nimport { ctx } from './context';\n\nexport type LazyThunk<T extends py.Node> = (ctx: PyDslContext) => PyDsl<T>;\n\nexport class LazyPyDsl<T extends py.Node = py.Node> extends PyDsl<T> {\n readonly '~dsl' = 'LazyPyDsl';\n\n private _thunk: LazyThunk<T>;\n private _result?: PyDsl<T>;\n\n constructor(thunk: LazyThunk<T>) {\n super();\n this._thunk = thunk;\n }\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n ctx.analyze(this.toResult());\n }\n\n toResult(): PyDsl<T> {\n this._result ??= this._thunk(ctx);\n return this._result;\n }\n\n override toAst() {\n return this.toResult().toAst();\n }\n}\n","import path from 'node:path';\n\nimport type { ExportModule, File, ImportModule } from '@hey-api/codegen-core';\n\nimport { py } from '../../py-compiler';\n\nconst printer = py.createPrinter({\n indentSize: 4,\n});\n\n/** Print a Python node to a string. */\nexport function astToString(node: py.Node): string {\n const result = printer.printFile(node);\n return result;\n}\n\nexport type SortGroup = number;\nexport type SortDistance = number;\nexport type SortModule = string;\nexport type SortKey = [SortGroup, SortDistance, SortModule];\n\nexport type ModuleExport = Omit<ExportModule, 'from'> & {\n /** Module specifier for re-exports, e.g., `./foo`. */\n modulePath: string;\n};\n\nexport type ModuleImport = Omit<ImportModule, 'from'> & {\n /** Module specifier for imports, e.g., `./foo`. */\n modulePath: string;\n};\n\nexport const pythonStdlib = new Set([\n 'abc',\n 'aifc',\n 'antigravity',\n 'argparse',\n 'array',\n 'ast',\n 'asynchat',\n 'asyncio',\n 'asyncore',\n 'atexit',\n 'audioop',\n 'base64',\n 'bdb',\n 'binascii',\n 'binhex',\n 'bisect',\n 'builtins',\n 'bz2',\n 'calendar',\n 'cgi',\n 'cgitb',\n 'chunk',\n 'cmath',\n 'cmd',\n 'code',\n 'codecs',\n 'codeop',\n 'collections',\n 'colorsys',\n 'compileall',\n 'concurrent',\n 'configparser',\n 'contextlib',\n 'contextvars',\n 'copy',\n 'copyreg',\n 'cProfile',\n 'crypt',\n 'csv',\n 'ctypes',\n 'curses',\n 'dataclasses',\n 'datetime',\n 'dbm',\n 'decimal',\n 'difflib',\n 'dis',\n 'distutils',\n 'doctest',\n 'email',\n 'encodings',\n 'ensurepip',\n 'enum',\n 'errno',\n 'faulthandler',\n 'fcntl',\n 'filecmp',\n 'fileinput',\n 'fnmatch',\n 'formatter',\n 'fractions',\n 'ftplib',\n 'functools',\n 'gc',\n 'genericpath',\n 'getopt',\n 'getpass',\n 'gettext',\n 'glob',\n 'graphlib',\n 'grp',\n 'gzip',\n 'hashlib',\n 'heapq',\n 'hmac',\n 'html',\n 'http',\n 'imaplib',\n 'imghdr',\n 'imp',\n 'importlib',\n 'inspect',\n 'io',\n 'ipaddress',\n 'itertools',\n 'json',\n 'keyword',\n 'lib2to3',\n 'linecache',\n 'locale',\n 'logging',\n 'lzma',\n 'mailbox',\n 'mailcap',\n 'marshal',\n 'math',\n 'mimetypes',\n 'mmap',\n 'modulefinder',\n 'msilib',\n 'msvcrt',\n 'multiprocessing',\n 'netrc',\n 'nis',\n 'nntplib',\n 'nt',\n 'ntpath',\n 'nturl2path',\n 'numbers',\n 'opcode',\n 'operator',\n 'optparse',\n 'os',\n 'ossaudiodev',\n 'parser',\n 'pathlib',\n 'pdb',\n 'pickle',\n 'pickletools',\n 'pipes',\n 'pkgutil',\n 'platform',\n 'plistlib',\n 'poplib',\n 'posix',\n 'posixpath',\n 'pprint',\n 'profile',\n 'pstats',\n 'pty',\n 'pwd',\n 'py_compile',\n 'pyclbr',\n 'pydoc_data',\n 'pydoc',\n 'pyexpat',\n 'queue',\n 'quopri',\n 'random',\n 're',\n 'readline',\n 'reprlib',\n 'resource',\n 'rlcompleter',\n 'runpy',\n 'sched',\n 'secrets',\n 'select',\n 'selectors',\n 'shelve',\n 'shlex',\n 'shutil',\n 'signal',\n 'site',\n 'smtpd',\n 'smtplib',\n 'sndhdr',\n 'socket',\n 'socketserver',\n 'spwd',\n 'sqlite3',\n 'sre_compile',\n 'sre_constants',\n 'sre_parse',\n 'ssl',\n 'stat',\n 'statistics',\n 'string',\n 'stringprep',\n 'struct',\n 'subprocess',\n 'sunau',\n 'symbol',\n 'symtable',\n 'sys',\n 'sysconfig',\n 'syslog',\n 'tabnanny',\n 'tarfile',\n 'telnetlib',\n 'tempfile',\n 'termios',\n 'textwrap',\n 'this',\n 'threading',\n 'time',\n 'timeit',\n 'tkinter',\n 'token',\n 'tokenize',\n 'tomllib',\n 'trace',\n 'traceback',\n 'tracemalloc',\n 'tty',\n 'turtle',\n 'types',\n 'typing',\n 'unicodedata',\n 'unittest',\n 'urllib',\n 'uu',\n 'uuid',\n 'venv',\n 'warnings',\n 'wave',\n 'weakref',\n 'webbrowser',\n 'winreg',\n 'winsound',\n 'wsgiref',\n 'xdrlib',\n 'xml',\n 'xmlrpc',\n 'zipapp',\n 'zipfile',\n 'zipimport',\n 'zlib',\n 'zoneinfo',\n]);\n\nexport function moduleSortKey({\n file,\n fromFile,\n root,\n}: {\n file: Pick<File, 'finalPath'>;\n fromFile: Pick<File, 'finalPath' | 'extension' | 'external' | 'name'>;\n preferFileExtension: string;\n root: string;\n}): SortKey {\n const filePath = file.finalPath!.split(path.sep).join('/');\n let modulePath = fromFile.finalPath!.split(path.sep).join('/');\n\n if (fromFile.external && !path.isAbsolute(modulePath)) {\n // __future__\n if (modulePath === '__future__') {\n return [0, 0, modulePath];\n }\n\n // stdlib\n const topLevel = modulePath.split('.')[0]!;\n if (pythonStdlib.has(topLevel)) {\n return [1, 0, modulePath];\n }\n\n // third-party\n return [2, 0, modulePath];\n }\n\n // outside project root\n if (!modulePath.startsWith(root.split(path.sep).join('/'))) {\n return [3, 0, modulePath];\n }\n\n // local\n const rel = path\n .relative(path.dirname(filePath), path.dirname(modulePath))\n .split(path.sep)\n .join('/');\n\n const segments = rel ? rel.split('/') : [];\n const parentCount = segments.filter((s) => s === '..').length;\n\n const leadingDots = '.'.repeat(parentCount + 1);\n\n const pathSegments = segments.filter((s) => s !== '..' && s !== '.');\n\n const filename = modulePath.split('/').at(-1)!;\n // TODO: replace with extension check, there's an issue with external files\n // not having extension set\n const moduleName = filename.replace(/\\.[^.]+$/, '');\n // const moduleName = fromFile.extension\n // ? filename.slice(0, -fromFile.extension.length)\n // : filename;\n\n // index/__init__ are implicit\n const isImplicitModule = moduleName === 'index' || moduleName === '__init__';\n if (!isImplicitModule) {\n pathSegments.push(moduleName);\n }\n\n modulePath = pathSegments.length ? leadingDots + pathSegments.join('.') : leadingDots;\n\n return [4, parentCount, modulePath];\n}\n","import type { RenderContext, Renderer } from '@hey-api/codegen-core';\nimport type { BaseOutput } from '@hey-api/shared';\nimport type { MaybeArray, MaybeFunc } from '@hey-api/types';\n\nimport { py } from '../../py-compiler';\nimport type { PyDsl } from '../../py-dsl';\nimport type { ModuleExport, ModuleImport, SortGroup, SortKey, SortModule } from './render-utils';\nimport { astToString, moduleSortKey } from './render-utils';\n\ntype Exports = ReadonlyArray<ReadonlyArray<ModuleExport>>;\ntype ExportsOptions = {\n preferExportAll?: boolean;\n};\ntype Header = MaybeArray<string> | null | undefined;\ntype HeaderArg = MaybeFunc<(ctx: RenderContext<PyDsl>) => Header>;\ntype Imports = Array<ReadonlyArray<ModuleImport>>;\n\nfunction headerToLines(header: Header): ReadonlyArray<string> {\n if (!header) return [];\n const lines: Array<string> = [];\n if (typeof header === 'string') {\n lines.push(...header.split(/\\r?\\n/));\n return lines;\n }\n for (const line of header) {\n lines.push(...line.split(/\\r?\\n/));\n }\n return lines;\n}\n\nexport class PythonRenderer implements Renderer {\n /**\n * Function to generate a file header.\n *\n * @private\n */\n private _header?: HeaderArg;\n /**\n * Options for module specifier resolution.\n *\n * @private\n */\n private _module?: Partial<BaseOutput>['module'];\n /**\n * Whether `export * from 'module'` should be used when possible instead of named exports.\n *\n * @private\n */\n private _preferExportAll: boolean;\n\n constructor(\n args: Pick<Partial<BaseOutput>, 'module'> & {\n header?: HeaderArg;\n preferExportAll?: boolean;\n } = {},\n ) {\n this._header = args.header;\n this._module = args.module;\n this._preferExportAll = args.preferExportAll ?? false;\n }\n\n render(ctx: RenderContext<PyDsl>): string {\n const header = typeof this._header === 'function' ? this._header(ctx) : this._header;\n return PythonRenderer.astToString({\n exports: this.getExports(ctx),\n exportsOptions: {\n preferExportAll: this._preferExportAll,\n },\n header,\n imports: this.getImports(ctx),\n nodes: ctx.file.nodes,\n });\n }\n\n supports(ctx: RenderContext): boolean {\n return ctx.file.language === 'python';\n }\n\n static astToString(args: {\n exports?: Exports;\n exportsOptions?: ExportsOptions;\n header?: Header;\n imports?: Imports;\n nodes?: ReadonlyArray<PyDsl>;\n /**\n * Whether to include a trailing newline at the end of the file.\n *\n * @default true\n */\n trailingNewline?: boolean;\n }): string {\n let text = '';\n for (const header of headerToLines(args.header)) {\n text += `${header}\\n`;\n }\n\n const argsImports = args.imports ?? [];\n\n for (const group of args.exports ?? []) {\n for (const exp of group) {\n let found = false;\n for (const impGroup of argsImports) {\n if (found) break;\n for (const imp of impGroup) {\n if (imp.modulePath === exp.modulePath) {\n // TODO: merge imports and exports from the same module\n found = true;\n break;\n }\n }\n }\n if (!found) {\n argsImports.push([\n {\n imports: exp.exports.map((exp) => ({\n isTypeOnly: exp.isTypeOnly,\n localName: exp.exportedName,\n sourceName: exp.exportedName,\n })),\n isTypeOnly: false,\n kind: 'named',\n modulePath: exp.modulePath,\n },\n ]);\n }\n }\n }\n\n let imports = '';\n for (const group of argsImports) {\n if (imports) imports += '\\n';\n for (const imp of group) {\n imports += `${astToString(PythonRenderer.toImportAst(imp))}`;\n }\n }\n text = `${text}${text && imports ? '\\n' : ''}${imports}`;\n\n let exports = '';\n for (const group of args.exports ?? []) {\n if (exports) exports += '\\n';\n for (const exp of group) {\n exports += `${astToString(PythonRenderer.toExportAst(exp, args.exportsOptions))}`;\n }\n }\n text = `${text}${text && exports ? '\\n' : ''}${exports}`;\n\n let nodes = '';\n for (const node of args.nodes ?? []) {\n if (nodes) nodes += '\\n\\n';\n nodes += `${astToString(node.toAst())}`;\n }\n text = `${text}${text && nodes ? '\\n\\n' : ''}${nodes}`;\n\n if (args.trailingNewline === false && text.endsWith('\\n')) {\n text = text.slice(0, -1);\n }\n\n return text;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static toExportAst(group: ModuleExport, options?: ExportsOptions): py.Assignment {\n const specifiers = group.exports.map((exp) => py.factory.createLiteral(exp.exportedName));\n return py.factory.createAssignment(\n py.factory.createIdentifier('__all__'),\n undefined,\n py.factory.createListExpression(specifiers),\n );\n }\n\n static toImportAst(group: ModuleImport): py.ImportStatement {\n const names: Array<{\n alias?: string;\n name: string;\n }> = group.imports.map((imp) => ({\n alias: imp.localName !== imp.sourceName ? imp.localName : undefined,\n name: imp.sourceName,\n }));\n return py.factory.createImportStatement(group.modulePath, names, Boolean(group.imports.length));\n }\n\n private getExports(ctx: RenderContext): Exports {\n type ModuleEntry = {\n group: ModuleExport;\n sortKey: SortKey;\n };\n\n const groups = new Map<SortGroup, Map<SortModule, ModuleEntry>>();\n\n for (const exp of ctx.file.exports) {\n const sortKey = moduleSortKey({\n file: ctx.file,\n fromFile: exp.from,\n preferFileExtension: this._module?.extension || '',\n root: ctx.project.root,\n });\n const modulePath = this._module?.resolve?.(sortKey[2], ctx) ?? sortKey[2];\n const [groupIndex] = sortKey;\n\n if (!groups.has(groupIndex)) groups.set(groupIndex, new Map());\n const moduleMap = groups.get(groupIndex)!;\n\n if (!moduleMap.has(modulePath)) {\n moduleMap.set(modulePath, {\n group: {\n canExportAll: exp.canExportAll,\n exports: exp.exports,\n isTypeOnly: exp.isTypeOnly,\n modulePath,\n namespaceExport: exp.namespaceExport,\n },\n sortKey,\n });\n }\n }\n\n const exports: Array<Array<ModuleExport>> = Array.from(groups.entries())\n .sort((a, b) => a[0] - b[0])\n .map(([, moduleMap]) => {\n const entries = Array.from(moduleMap.values());\n\n entries.sort((a, b) => {\n const d = a.sortKey[1] - b.sortKey[1];\n return d !== 0 ? d : a.group.modulePath.localeCompare(b.group.modulePath);\n });\n\n return entries.map((e) => {\n const group = e.group;\n if (group.namespaceExport) {\n group.exports = [];\n } else {\n const isTypeOnly = !group.exports.find((exp) => !exp.isTypeOnly);\n if (isTypeOnly) {\n group.isTypeOnly = true;\n for (const exp of group.exports) {\n exp.isTypeOnly = false;\n }\n }\n group.exports.sort((a, b) => a.exportedName.localeCompare(b.exportedName));\n }\n return group;\n });\n });\n\n return exports;\n }\n\n private getImports(ctx: RenderContext): Imports {\n type ModuleEntry = {\n group: ModuleImport;\n sortKey: SortKey;\n };\n\n const groups = new Map<SortGroup, Map<SortModule, ModuleEntry>>();\n\n for (const imp of ctx.file.imports) {\n const sortKey = moduleSortKey({\n file: ctx.file,\n fromFile: imp.from,\n preferFileExtension: this._module?.extension || '',\n root: ctx.project.root,\n });\n const modulePath = this._module?.resolve?.(sortKey[2], ctx) ?? sortKey[2];\n const [groupIndex] = sortKey;\n\n if (!groups.has(groupIndex)) groups.set(groupIndex, new Map());\n const moduleMap = groups.get(groupIndex)!;\n\n if (!moduleMap.has(modulePath)) {\n moduleMap.set(modulePath, {\n group: {\n imports: [],\n isTypeOnly: false,\n kind: imp.kind,\n modulePath,\n },\n sortKey,\n });\n }\n\n const entry = moduleMap.get(modulePath)!;\n const group = entry.group;\n\n if (imp.kind !== 'named') {\n group.isTypeOnly = imp.isTypeOnly;\n group.kind = imp.kind;\n group.localName = imp.localName;\n } else {\n group.imports.push(...imp.imports);\n }\n }\n\n const imports: Array<Array<ModuleImport>> = Array.from(groups.entries())\n .sort((a, b) => a[0] - b[0])\n .map(([, moduleMap]) => {\n const entries = Array.from(moduleMap.values());\n\n entries.sort((a, b) => {\n const d = a.sortKey[1] - b.sortKey[1];\n return d !== 0 ? d : a.group.modulePath.localeCompare(b.group.modulePath);\n });\n\n return entries.map((e) => {\n const group = e.group;\n if (group.kind === 'namespace') {\n group.imports = [];\n } else {\n const isTypeOnly = !group.imports.find((imp) => !imp.isTypeOnly);\n if (isTypeOnly) {\n group.isTypeOnly = true;\n for (const imp of group.imports) {\n imp.isTypeOnly = false;\n }\n }\n group.imports.sort((a, b) => a.localName.localeCompare(b.localName));\n }\n return group;\n });\n });\n\n return imports;\n }\n}\n","import type { NodeName } from '@hey-api/codegen-core';\n\nimport type { py } from '../py-compiler';\nimport { ClassPyDsl } from './decl/class';\nimport { EnumPyDsl } from './decl/enum';\n// import { DecoratorPyDsl } from './decl/decorator';\nimport { FieldPyDsl } from './decl/field';\nimport { FuncPyDsl } from './decl/func';\n// import { GetterPyDsl } from './decl/getter';\n// import { InitPyDsl } from './decl/init';\n// import { EnumMemberPyDsl } from './decl/member';\nimport { MethodPyDsl } from './decl/method';\nimport { ParamPyDsl } from './decl/param';\n// import { PatternPyDsl } from './decl/pattern';\n// import { SetterPyDsl } from './decl/setter';\n// import { ArrayPyDsl } from './expr/array';\n// import { AsPyDsl } from './expr/as';\nimport { AttrPyDsl } from './expr/attr';\n// import { AwaitPyDsl } from './expr/await';\nimport { BinaryPyDsl } from './expr/binary';\nimport { CallPyDsl } from './expr/call';\nimport { DictPyDsl } from './expr/dict';\nimport { ExprPyDsl } from './expr/expr';\n// import { fromValue as exprValue } from './expr/from-value';\nimport { IdPyDsl } from './expr/identifier';\nimport { KwargPyDsl } from './expr/kwarg';\nimport { ListPyDsl } from './expr/list';\nimport { LiteralPyDsl } from './expr/literal';\n// import { NewPyDsl } from './expr/new';\n// import { ObjectPyDsl } from './expr/object';\n// import { PrefixPyDsl } from './expr/prefix';\n// import { ObjectPropPyDsl } from './expr/prop';\n// import { RegExpPyDsl } from './expr/regexp';\nimport { SetPyDsl } from './expr/set';\nimport { SubscriptPyDsl } from './expr/subscript';\n// import { TemplatePyDsl } from './expr/template';\n// import { TernaryPyDsl } from './expr/ternary';\nimport { TuplePyDsl } from './expr/tuple';\n// import { TypeOfExprPyDsl } from './expr/typeof';\nimport { DocPyDsl } from './layout/doc';\nimport { HintPyDsl } from './layout/hint';\nimport { NewlinePyDsl } from './layout/newline';\nimport { BlockPyDsl } from './stmt/block';\nimport { BreakPyDsl } from './stmt/break';\nimport { ContinuePyDsl } from './stmt/continue';\nimport { ForPyDsl } from './stmt/for';\nimport { IfPyDsl } from './stmt/if';\nimport { ImportPyDsl } from './stmt/import';\nimport { RaisePyDsl } from './stmt/raise';\nimport { ReturnPyDsl } from './stmt/return';\nimport { StmtPyDsl } from './stmt/stmt';\nimport { TryPyDsl } from './stmt/try';\nimport { VarPyDsl } from './stmt/var';\nimport { WhilePyDsl } from './stmt/while';\nimport { WithPyDsl } from './stmt/with';\nimport { TypeOrPyDsl } from './type/or';\nimport { TypeTuplePyDsl } from './type/tuple';\n// import { TokenPyDsl } from './token';\n// import { TypeAliasPyDsl } from './type/alias';\n// import { TypeAndPyDsl } from './type/and';\n// import { TypeAttrPyDsl } from './type/attr';\n// import { TypeExprPyDsl } from './type/expr';\n// import { fromValue as typeValue } from './type/from-value';\n// import { TypeFuncPyDsl } from './type/func';\n// import { TypeIdxPyDsl } from './type/idx';\n// import { TypeLiteralPyDsl } from './type/literal';\n// import { TypeMappedPyDsl } from './type/mapped';\n// import { TypeObjectPyDsl } from './type/object';\n// import { TypeOperatorPyDsl } from './type/operator';\n// import { TypeOrPyDsl } from './type/or';\n// import { TypeParamPyDsl } from './type/param';\n// import { TypeQueryPyDsl } from './type/query';\n// import { TypeTemplatePyDsl } from './type/template';\nimport { LazyPyDsl } from './utils/lazy';\n\nconst pyDsl = {\n /** Creates an array literal expression (e.g., `[1, 2, 3]`). */\n // array: (...args: ConstructorParameters<typeof ArrayTsDsl>) => new ArrayTsDsl(...args),\n /** Creates an `as` type assertion expression (e.g., `value as Type`). */\n // as: (...args: ConstructorParameters<typeof AsTsDsl>) => new AsTsDsl(...args),\n\n /** Creates a property access expression (e.g., `obj.foo`). */\n attr: (...args: ConstructorParameters<typeof AttrPyDsl>) => new AttrPyDsl(...args),\n\n /** Creates an await expression (e.g., `await promise`). */\n // await: (...args: ConstructorParameters<typeof AwaitTsDsl>) => new AwaitTsDsl(...args),\n\n /** Creates a binary expression (e.g., `a + b`). */\n binary: (...args: ConstructorParameters<typeof BinaryPyDsl>) => new BinaryPyDsl(...args),\n\n /** Creates a statement block. */\n block: (...args: ConstructorParameters<typeof BlockPyDsl>) => new BlockPyDsl(...args),\n\n /** Creates a break statement. */\n break: (...args: ConstructorParameters<typeof BreakPyDsl>) => new BreakPyDsl(...args),\n\n /** Creates a function or method call expression (e.g., `fn(arg)`). */\n call: (...args: ConstructorParameters<typeof CallPyDsl>) => new CallPyDsl(...args),\n\n /** Creates a class declaration or expression. */\n class: (...args: ConstructorParameters<typeof ClassPyDsl>) => new ClassPyDsl(...args),\n\n /** Creates a continue statement. */\n continue: (...args: ConstructorParameters<typeof ContinuePyDsl>) => new ContinuePyDsl(...args),\n\n /** Creates a decorator expression (e.g., `@decorator`). */\n // decorator: (...args: ConstructorParameters<typeof DecoratorTsDsl>) => new DecoratorTsDsl(...args),\n\n /** Creates a dictionary expression (e.g., `{ 'a': 1 }`). */\n dict: (...args: ConstructorParameters<typeof DictPyDsl>) => new DictPyDsl(...args),\n\n /** Creates a Python docstring (`\"\"\"...\"\"\"`). */\n doc: (...args: ConstructorParameters<typeof DocPyDsl>) => new DocPyDsl(...args),\n\n /** Creates an enum declaration. */\n enum: (...args: ConstructorParameters<typeof EnumPyDsl>) => new EnumPyDsl(...args),\n\n /** Creates a general expression node. */\n expr: (...args: ConstructorParameters<typeof ExprPyDsl>) => new ExprPyDsl(...args),\n\n /** Creates a field declaration in a class body. */\n field: (...args: ConstructorParameters<typeof FieldPyDsl>) => new FieldPyDsl(...args),\n\n /** Creates a for statement (e.g., `for x in items:`). */\n for: (...args: ConstructorParameters<typeof ForPyDsl>) => new ForPyDsl(...args),\n\n /** Converts a runtime value into a corresponding expression node. */\n // fromValue: (...args: Parameters<typeof exprValue>) => exprValue(...args),\n\n /** Creates a function declaration. */\n func: ((name: NodeName, fn?: (f: FuncPyDsl) => void) => new FuncPyDsl(name, fn)) as {\n (name: NodeName): FuncPyDsl;\n (name: NodeName, fn: (f: FuncPyDsl) => void): FuncPyDsl;\n },\n\n /** Creates a getter method declaration. */\n // getter: (...args: ConstructorParameters<typeof GetterTsDsl>) => new GetterTsDsl(...args),\n\n /** Creates a Python comment (`# ...`). */\n hint: (...args: ConstructorParameters<typeof HintPyDsl>) => new HintPyDsl(...args),\n\n /** Creates an identifier (e.g., `foo`). */\n id: (...args: ConstructorParameters<typeof IdPyDsl>) => new IdPyDsl(...args),\n\n /** Creates an if statement. */\n if: (...args: ConstructorParameters<typeof IfPyDsl>) => new IfPyDsl(...args),\n\n /** Creates an import statement. */\n import: (...args: ConstructorParameters<typeof ImportPyDsl>) => new ImportPyDsl(...args),\n\n /** Creates an initialization block or statement. */\n // init: (...args: ConstructorParameters<typeof InitTsDsl>) => new InitTsDsl(...args),\n\n /** Creates a keyword argument expression (e.g., `name=value`). */\n kwarg: (...args: ConstructorParameters<typeof KwargPyDsl>) => new KwargPyDsl(...args),\n\n /** Creates a lazy, context-aware node with deferred evaluation. */\n lazy: <T extends py.Node>(...args: ConstructorParameters<typeof LazyPyDsl<T>>) =>\n new LazyPyDsl<T>(...args),\n\n /** Creates a list expression (e.g., `[1, 2, 3]`). */\n list: (...args: ConstructorParameters<typeof ListPyDsl>) => new ListPyDsl(...args),\n\n /** Creates a literal value (e.g., string, number, boolean). */\n literal: (...args: ConstructorParameters<typeof LiteralPyDsl>) => new LiteralPyDsl(...args),\n\n /** Creates an enum member declaration. */\n // member: (...args: ConstructorParameters<typeof EnumMemberTsDsl>) => new EnumMemberTsDsl(...args),\n\n /** Creates a method declaration in a class body. */\n method: ((name: NodeName, fn?: (f: MethodPyDsl) => void) => new MethodPyDsl(name, fn)) as {\n (name: NodeName): MethodPyDsl;\n (name: NodeName, fn: (f: MethodPyDsl) => void): MethodPyDsl;\n },\n\n /** Creates a negation expression (`-x`). */\n // neg: (...args: ConstructorParameters<typeof PrefixTsDsl>) => new PrefixTsDsl(...args).neg(),\n\n /** Creates a new expression (e.g., `new ClassName()`). */\n // new: (...args: ConstructorParameters<typeof NewTsDsl>) => new NewTsDsl(...args),\n\n /** Creates a newline (for formatting purposes). */\n newline: (...args: ConstructorParameters<typeof NewlinePyDsl>) => new NewlinePyDsl(...args),\n\n /** Creates a logical NOT expression (`!x`). */\n // not: (...args: ConstructorParameters<typeof PrefixTsDsl>) => new PrefixTsDsl(...args).not(),\n\n /** Creates an object literal expression. */\n // object: (...args: ConstructorParameters<typeof ObjectTsDsl>) => new ObjectTsDsl(...args),\n\n /** Creates a parameter declaration for functions or methods. */\n param: (...args: ConstructorParameters<typeof ParamPyDsl>) => new ParamPyDsl(...args),\n\n /** Creates a pattern for destructuring or matching. */\n // pattern: (...args: ConstructorParameters<typeof PatternTsDsl>) => new PatternTsDsl(...args),\n\n /** Creates a prefix unary expression (e.g., `-x`, `!x`, `~x`). */\n // prefix: (...args: ConstructorParameters<typeof PrefixTsDsl>) => new PrefixTsDsl(...args),\n\n /** Creates an object literal property (e.g., `{ foo: bar }`). */\n // prop: (...args: ConstructorParameters<typeof ObjectPropTsDsl>) => new ObjectPropTsDsl(...args),\n\n /** Creates a raise statement. */\n raise: (...args: ConstructorParameters<typeof RaisePyDsl>) => new RaisePyDsl(...args),\n\n /** Creates a regular expression literal (e.g., `/foo/gi`). */\n // regexp: (...args: ConstructorParameters<typeof RegExpTsDsl>) => new RegExpTsDsl(...args),\n\n /** Creates a return statement. */\n return: (...args: ConstructorParameters<typeof ReturnPyDsl>) => new ReturnPyDsl(...args),\n\n /** Creates a set expression (e.g., `{1, 2, 3}`). */\n set: (...args: ConstructorParameters<typeof SetPyDsl>) => new SetPyDsl(...args),\n\n /** Creates a setter method declaration. */\n // setter: (...args: ConstructorParameters<typeof SetterTsDsl>) => new SetterTsDsl(...args),\n\n /** Wraps an expression or statement-like value into a `StmtPyDsl`. */\n stmt: (...args: ConstructorParameters<typeof StmtPyDsl>) => new StmtPyDsl(...args),\n\n /** Creates a subscript expression (e.g., `obj[index]` or `Type[Param]`). */\n subscript: (...args: ConstructorParameters<typeof SubscriptPyDsl>) => new SubscriptPyDsl(...args),\n\n /** Creates a template literal expression. */\n // template: (...args: ConstructorParameters<typeof TemplateTsDsl>) => new TemplateTsDsl(...args),\n\n /** Creates a ternary conditional expression (if ? then : else). */\n // ternary: (...args: ConstructorParameters<typeof TernaryTsDsl>) => new TernaryTsDsl(...args),\n\n // /** Creates a throw statement. */\n // throw: (...args: ConstructorParameters<typeof ThrowTsDsl>) => new ThrowTsDsl(...args),\n\n /** Creates a syntax token (e.g., `?`, `readonly`, `+`, `-`). */\n // token: (...args: ConstructorParameters<typeof TokenTsDsl>) => new TokenTsDsl(...args),\n\n /** Creates a try/except/finally statement. */\n try: (...args: ConstructorParameters<typeof TryPyDsl>) => new TryPyDsl(...args),\n\n /** Creates a tuple expression (e.g., `(1, 2, 3)`). */\n tuple: (...args: ConstructorParameters<typeof TuplePyDsl>) => new TuplePyDsl(...args),\n\n /** Creates a basic type reference or type expression (e.g., Foo or Foo<T>). */\n type: {\n // type: Object.assign(\n // (...args: ConstructorParameters<typeof TypeExprTsDsl>) => new TypeExprTsDsl(...args),\n // {\n /** Creates a type alias declaration (e.g., `type Foo = Bar`). */\n // alias: (...args: ConstructorParameters<typeof TypeAliasTsDsl>) => new TypeAliasTsDsl(...args),\n /** Creates an intersection type (e.g., `A & B`). */\n // and: (...args: ConstructorParameters<typeof TypeAndTsDsl>) => new TypeAndTsDsl(...args),\n /** Creates a qualified type reference (e.g., Foo.Bar). */\n // attr: (...args: ConstructorParameters<typeof TypeAttrTsDsl>) => new TypeAttrTsDsl(...args),\n /** Creates a basic type reference or type expression (e.g., Foo or Foo<T>). */\n // expr: (...args: ConstructorParameters<typeof TypeExprTsDsl>) => new TypeExprTsDsl(...args),\n /** Converts a runtime value into a corresponding type expression node. */\n // fromValue: (...args: Parameters<typeof typeValue>) => typeValue(...args),\n /** Creates a function type node (e.g., `(a: string) => number`). */\n // func: (...args: ConstructorParameters<typeof TypeFuncTsDsl>) => new TypeFuncTsDsl(...args),\n /** Creates an indexed-access type (e.g., `Foo<T>[K]`). */\n // idx: (...args: ConstructorParameters<typeof TypeIdxTsDsl>) => new TypeIdxTsDsl(...args),\n /** Creates a literal type node (e.g., 'foo', 42, or true). */\n // literal: (...args: ConstructorParameters<typeof TypeLiteralTsDsl>) =>\n // new TypeLiteralTsDsl(...args),\n /** Creates a mapped type (e.g., `{ [K in keyof T]: U }`). */\n // mapped: (...args: ConstructorParameters<typeof TypeMappedTsDsl>) =>\n // new TypeMappedTsDsl(...args),\n /** Creates a type literal node (e.g., { foo: string }). */\n // object: (...args: ConstructorParameters<typeof TypeObjectTsDsl>) =>\n // new TypeObjectTsDsl(...args),\n /** Creates a type operator node (e.g., `readonly T`, `keyof T`, `unique T`). */\n // operator: (...args: ConstructorParameters<typeof TypeOperatorTsDsl>) =>\n // new TypeOperatorTsDsl(...args),\n\n /** Creates a union type (e.g., `A | B | C`). */\n or: (...args: ConstructorParameters<typeof TypeOrPyDsl>) => new TypeOrPyDsl(...args),\n\n /** Creates a type parameter (e.g., `<T>`). */\n // param: (...args: ConstructorParameters<typeof TypeParamTsDsl>) => new TypeParamTsDsl(...args),\n /** Creates a type query node (e.g., `typeof Foo`). */\n // query: (...args: ConstructorParameters<typeof TypeQueryTsDsl>) => new TypeQueryTsDsl(...args),\n /** Builds a TypeScript template literal *type* (e.g., `${Foo}-${Bar}` as a type). */\n // template: (...args: ConstructorParameters<typeof TypeTemplateTsDsl>) =>\n // new TypeTemplateTsDsl(...args),\n\n /** Creates a tuple type (e.g., [A, B, C]). */\n tuple: (...args: ConstructorParameters<typeof TypeTuplePyDsl>) => new TypeTuplePyDsl(...args),\n },\n // ),\n /** Creates a `typeof` expression (e.g., `typeof value`). */\n // typeofExpr: (...args: ConstructorParameters<typeof TypeOfExprTsDsl>) =>\n // new TypeOfExprTsDsl(...args),\n\n /** Creates a variable assignment. */\n var: (...args: ConstructorParameters<typeof VarPyDsl>) => new VarPyDsl(...args),\n\n /** Creates a while statement (e.g., `while x:`). */\n while: (...args: ConstructorParameters<typeof WhilePyDsl>) => new WhilePyDsl(...args),\n\n /** Creates a with statement (e.g., `with open(f) as file:`). */\n with: (...args: ConstructorParameters<typeof WithPyDsl>) => new WithPyDsl(...args),\n};\n\nexport const $ = Object.assign(\n (...args: ConstructorParameters<typeof ExprPyDsl>) => new ExprPyDsl(...args),\n pyDsl,\n);\n\nexport type DollarPyDsl = {\n /**\n * Entry point to the Python DSL.\n *\n * `$` creates a general expression node by default, but also exposes\n * builders for all other constructs.\n *\n * Example:\n * ```ts\n * const node = $('console').attr('log').call($.literal('Hello'));\n * ```\n *\n * Returns:\n * - A new `ExprPyDsl` instance when called directly.\n * - The `pyDsl` object for constructing more specific nodes.\n */\n $: typeof $;\n};\n\nexport type { MaybePyDsl } from './base';\nexport { PyDsl } from './base';\nexport type { EnumMember } from './decl/enum';\nexport type { CallArgs } from './expr/call';\nexport { KwargPyDsl } from './expr/kwarg';\nexport type { ExampleOptions } from './utils/context';\nexport { ctx, PyDslContext } from './utils/context';\nexport { keywords } from './utils/keywords';\nexport { regexp } from './utils/regexp';\nexport { PythonRenderer } from './utils/render';\nexport { reserved } from './utils/reserved';\n","import type { IR } from '@hey-api/shared';\nimport { escapeComment } from '@hey-api/shared';\n\nexport function createOperationComment(\n operation: IR.OperationObject,\n): ReadonlyArray<string> | undefined {\n const comments: Array<string> = [];\n\n if (operation.summary) {\n comments.push(escapeComment(operation.summary));\n }\n\n if (operation.description) {\n if (comments.length) {\n comments.push(''); // Add an empty line between summary and description\n }\n\n comments.push(escapeComment(operation.description));\n }\n\n if (operation.deprecated) {\n if (comments.length) {\n comments.push(''); // Add an empty line before deprecated\n }\n\n // TODO: smarter deprecation message\n comments.push('Deprecated.');\n }\n\n return comments.length ? comments : undefined;\n}\n","import type { IR } from '@hey-api/shared';\nimport { refToName, toCase } from '@hey-api/shared';\n\ntype Location = keyof IR.ParametersObject | 'body';\n\ntype SignatureParameter = {\n in: Location;\n isRequired: boolean;\n name: string;\n originalName?: string;\n schema: IR.SchemaObject;\n};\n\ntype SignatureParameters = Record<string, SignatureParameter>;\n\ntype Field = {\n in: Location | 'headers';\n key: string;\n map?: string;\n};\n\ntype Signature = {\n bodyRef?: string;\n fields: Field[];\n parameters: SignatureParameters;\n};\n\nexport function getSignatureParameters({\n operation,\n}: {\n operation: IR.OperationObject;\n}): Signature | undefined {\n const locations = ['header', 'path', 'query'] as const satisfies ReadonlyArray<Location>;\n const nameToLocations: Record<string, Set<Location>> = {};\n\n const addParameter = (name: string, location: Location): void => {\n if (!nameToLocations[name]) {\n nameToLocations[name] = new Set();\n }\n nameToLocations[name]!.add(location);\n };\n\n for (const location of locations) {\n const parameters = operation.parameters?.[location];\n if (parameters) {\n for (const key in parameters) {\n const parameter = parameters[key]!;\n addParameter(parameter.name, location);\n }\n }\n }\n\n if (operation.body) {\n if (\n !operation.body.schema.logicalOperator &&\n operation.body.schema.type === 'object' &&\n operation.body.schema.properties\n ) {\n const properties = operation.body.schema.properties;\n for (const key in properties) {\n addParameter(key, 'body');\n }\n } else if (operation.body.schema.$ref) {\n const name = refToName(operation.body.schema.$ref);\n const key = toCase(name, 'snake_case');\n addParameter(key, 'body');\n } else {\n addParameter('body', 'body');\n }\n }\n\n const conflicts = new Set<string>();\n for (const name in nameToLocations) {\n if (nameToLocations[name]!.size > 1) {\n conflicts.add(name);\n }\n }\n\n const signatureParameters: SignatureParameters = {};\n const fields: Field[] = [];\n\n for (const location of locations) {\n const parameters = operation.parameters?.[location];\n if (parameters) {\n for (const key in parameters) {\n const parameter = parameters[key]!;\n const originalName = parameter.name;\n const name = conflicts.has(originalName) ? `${location}_${originalName}` : originalName;\n const signatureParameter: SignatureParameter = {\n in: location,\n isRequired: parameter.required ?? false,\n name,\n schema: parameter.schema,\n };\n if (name !== originalName) {\n signatureParameter.originalName = originalName;\n }\n signatureParameters[name] = signatureParameter;\n fields.push({\n in: location === 'header' ? 'headers' : location,\n key: name,\n ...(name !== originalName ? { map: originalName } : {}),\n });\n }\n }\n }\n\n let bodyRef: string | undefined;\n\n if (operation.body) {\n const location = 'body';\n if (\n !operation.body.schema.logicalOperator &&\n operation.body.schema.type === 'object' &&\n operation.body.schema.properties\n ) {\n const properties = operation.body.schema.properties;\n for (const originalName in properties) {\n const property = properties[originalName]!;\n const name = conflicts.has(originalName) ? `${location}_${originalName}` : originalName;\n const signatureParameter: SignatureParameter = {\n in: location,\n isRequired: operation.body.schema.required?.includes(originalName) ?? false,\n name,\n schema: property,\n };\n if (name !== originalName) {\n signatureParameter.originalName = originalName;\n }\n signatureParameters[name] = signatureParameter;\n fields.push({\n in: location,\n key: name,\n ...(name !== originalName ? { map: originalName } : {}),\n });\n }\n } else if (operation.body.schema.$ref) {\n const value = refToName(operation.body.schema.$ref);\n const originalName = toCase(value, 'snake_case');\n const name = conflicts.has(originalName) ? `${location}_${originalName}` : originalName;\n bodyRef = toCase(value, 'PascalCase');\n const signatureParameter: SignatureParameter = {\n in: location,\n isRequired: operation.body.required ?? false,\n name,\n schema: operation.body.schema,\n };\n if (name !== originalName) {\n signatureParameter.originalName = originalName;\n }\n signatureParameters[name] = signatureParameter;\n fields.push({\n in: location,\n key: name,\n map: 'body',\n });\n } else {\n signatureParameters.body = {\n in: location,\n isRequired: operation.body.required ?? false,\n name: 'body',\n schema: operation.body.schema,\n };\n fields.push({\n in: location,\n key: 'body',\n map: 'body',\n });\n }\n }\n\n if (!Object.keys(signatureParameters).length) {\n return;\n }\n\n return { bodyRef, fields, parameters: signatureParameters };\n}\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type { IR } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport type { HeyApiSdkPlugin } from '../types';\nimport { getSignatureParameters } from './signature';\n\ntype OperationParameters = {\n bodyRef?: string;\n fields: Array<{\n in: string;\n key: string;\n map?: string;\n }>;\n parameters: Array<ReturnType<typeof $.param>>;\n};\n\nconst PYTHON_BUILTIN_TYPES: Record<string, string> = {\n array: 'list',\n boolean: 'bool',\n integer: 'int',\n number: 'float',\n object: 'dict',\n string: 'str',\n};\n\nfunction schemaToPythonType(\n schema: IR.SchemaObject,\n plugin: HeyApiSdkPlugin['Instance'],\n): ReturnType<typeof $.expr | typeof $.subscript> | Symbol {\n if (schema.$ref) {\n // TODO: contract (?)\n return plugin.referenceSymbol({\n category: 'schema',\n resourceId: schema.$ref,\n });\n }\n\n if (schema.type === 'array') {\n const itemsSchema = schema.items?.[0];\n const itemType = itemsSchema\n ? schemaToPythonType(itemsSchema, plugin)\n : plugin.imports.typing.Any;\n return $('list').slice(itemType);\n }\n\n if (schema.type === 'object' || schema.additionalProperties) {\n if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {\n const valueType = schemaToPythonType(schema.additionalProperties, plugin);\n return $('dict').slice('str', valueType);\n }\n return $('dict').slice('str', plugin.imports.typing.Any);\n }\n\n if (schema.type === 'tuple') {\n const itemsSchema = schema.items;\n const itemTypes = itemsSchema\n ? itemsSchema.map((item) => schemaToPythonType(item, plugin))\n : [];\n return $('tuple').slice(...itemTypes);\n }\n\n const builtinType = schema.type ? PYTHON_BUILTIN_TYPES[schema.type] : undefined;\n return $(builtinType ?? plugin.imports.typing.Any);\n}\n\nexport function operationParameters({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}): OperationParameters {\n const result: OperationParameters = {\n fields: [],\n parameters: [],\n };\n\n if (plugin.config.paramsStructure === 'flat') {\n const signature = getSignatureParameters({ operation });\n if (!signature) return result;\n\n result.bodyRef = signature.bodyRef;\n result.fields = signature.fields;\n\n const paramEntries = Object.entries(signature.parameters).sort(([, valueA], [, valueB]) =>\n valueA.isRequired === valueB.isRequired ? 0 : valueA.isRequired ? -1 : 1,\n );\n\n for (const [paramName, param] of paramEntries) {\n const type = schemaToPythonType(param.schema, plugin);\n\n if (param.isRequired) {\n result.parameters.push($.param(paramName).type(type));\n } else {\n result.parameters.push($.param(paramName).type($.type.or(type, 'None')).default('None'));\n }\n }\n }\n\n return result;\n}\n","import type {\n StructureItem,\n StructureNode,\n StructureShell,\n Symbol,\n SymbolMeta,\n} from '@hey-api/codegen-core';\nimport type { IR } from '@hey-api/shared';\nimport { applyNaming, toCase } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { createOperationComment } from '../../../shared/utils/operation';\nimport { operationParameters } from '../shared/operation';\nimport type { HeyApiSdkPlugin } from '../types';\n\nexport interface OperationItem {\n operation: IR.OperationObject;\n path: ReadonlyArray<string | number>;\n tags: ReadonlyArray<string> | undefined;\n}\n\nexport const source = globalThis.Symbol('@hey-api/python-sdk');\n\nfunction attachComment<T extends ReturnType<typeof $.method>>(args: {\n node: T;\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}): T {\n const { node, operation, plugin } = args;\n return node.$if(plugin.config.comments && createOperationComment(operation), (n, v) =>\n n.doc(v),\n ) as T;\n}\n\nfunction createShellMeta(node: StructureNode): SymbolMeta {\n return {\n artifact: 'sdk',\n category: 'utility',\n resource: 'class',\n resourceId: node.getPath().join('.'),\n };\n}\n\nfunction createFnSymbol(\n plugin: HeyApiSdkPlugin['Instance'],\n item: StructureItem & { data: OperationItem },\n): Symbol {\n const { operation, path, tags } = item.data;\n const name = item.location[item.location.length - 1]!;\n return plugin.symbol(applyNaming(name, plugin.config.operations.methodName), {\n meta: {\n category: 'sdk',\n path,\n resource: 'operation',\n resourceId: operation.id,\n tags,\n },\n });\n}\n\nfunction childToNode(\n resource: StructureNode,\n plugin: HeyApiSdkPlugin['Instance'],\n): ReadonlyArray<ReturnType<typeof $.method>> {\n // TODO: contract (self)\n const refChild = plugin.referenceSymbol(createShellMeta(resource));\n const memberNameStr = toCase(\n refChild.name,\n plugin.config.operations.methodName.casing ?? 'camelCase',\n );\n const memberName = plugin.symbol(memberNameStr);\n\n return [\n $.method(memberName)\n .decorator(plugin.imports.funcTools.cachedProperty)\n .param('self')\n .returns(refChild)\n .do(\n $(refChild)\n .call($.kwarg('client', $('self').attr('client')))\n .return(),\n ),\n ];\n}\n\nexport function createShell(plugin: HeyApiSdkPlugin['Instance']): StructureShell {\n return {\n define: (node) => {\n const symbol = plugin.symbol(\n applyNaming(\n node.name,\n node.isRoot\n ? plugin.config.operations.containerName\n : plugin.config.operations.segmentName,\n ),\n {\n meta: createShellMeta(node),\n },\n );\n\n const c = $.class(symbol).export().extends(plugin.imports.Client);\n\n const dependencies: Array<ReturnType<typeof $.class>> = [];\n\n return { dependencies, node: c };\n },\n };\n}\n\nfunction implementFn<T extends ReturnType<typeof $.method>>(args: {\n node: T;\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}): T {\n const { node, operation, plugin } = args;\n const method = operation.method.toLowerCase();\n const opParameters = operationParameters({ operation, plugin });\n\n if (plugin.config.paramsStructure === 'flat' && opParameters.fields.length) {\n const paramNames = opParameters.parameters.map((parameter) => parameter.name.toString());\n\n const fieldsList = $.list();\n for (const field of opParameters.fields) {\n const fieldDict = $.dict();\n fieldDict.entry($.literal('in'), $.literal(field.in));\n fieldDict.entry($.literal('key'), $.literal(field.key));\n if (field.map) {\n fieldDict.entry($.literal('map'), $.literal(field.map));\n }\n fieldsList.element(fieldDict);\n }\n\n return (\n node\n .params(...opParameters.parameters)\n // TODO: extract operation statements into a separate function\n .do(\n $.var('params').assign(\n $(plugin.imports.buildClientParams).call(\n fieldsList,\n ...paramNames.map((name) => $.kwarg(name, name)),\n ),\n ),\n )\n .do(\n $('self')\n .attr('client')\n .attr(method)\n .call($.literal(operation.path), $.kwarg('params', $('params') as never))\n .return(),\n ) as T\n );\n }\n\n return node\n .params(...opParameters.parameters)\n .do($('self').attr('client').attr(method).call($.literal(operation.path)).return()) as T;\n}\n\nexport function toNode(\n model: StructureNode,\n plugin: HeyApiSdkPlugin['Instance'],\n): {\n dependencies?: Array<ReturnType<typeof $.class | typeof $.func>>;\n nodes: ReadonlyArray<ReturnType<typeof $.class | typeof $.func>>;\n} {\n if (model.virtual) {\n const nodes: Array<ReturnType<typeof $.func>> = [];\n for (const item of model.itemsFrom<OperationItem>(source)) {\n const fnName = applyNaming(\n String(item.location[item.location.length - 1]),\n plugin.config.operations.methodName,\n );\n const node = $.func(fnName).export().do($('None').return());\n nodes.push(node);\n }\n return { nodes };\n }\n\n if (!model.shell) {\n return { nodes: [] };\n }\n\n const nodes: Array<ReturnType<typeof $.class | typeof $.func>> = [];\n const shell = model.shell.define(model);\n const node = shell.node as ReturnType<typeof $.class | typeof $.func>;\n\n let index = 0;\n for (const item of model.itemsFrom<OperationItem>(source)) {\n const { operation } = item.data;\n if (node['~dsl'] === 'FuncPyDsl') {\n // TODO: function?\n } else {\n if (index > 0 || node.hasBody) node.newline();\n const method = implementFn({\n node: $.method(createFnSymbol(plugin, item), (m) =>\n attachComment({\n node: m,\n operation,\n plugin,\n }),\n ).param('self'),\n operation,\n plugin,\n });\n node.do(method);\n // exampleIntent(method, operation, plugin);\n }\n index += 1;\n }\n\n for (const child of model.children.values()) {\n if (node['~dsl'] === 'FuncPyDsl') {\n // TODO: function?\n } else {\n if (node.hasBody) node.newline();\n node.do(...childToNode(child, plugin));\n }\n }\n\n nodes.push(node);\n\n return {\n dependencies: shell.dependencies as Array<ReturnType<typeof $.class | typeof $.func>>,\n nodes,\n };\n}\n","import { StructureModel } from '@hey-api/codegen-core';\n\nimport type { $ } from '../../../../py-dsl';\nimport { resolveStrategy } from '../operations';\nimport type { HeyApiSdkPlugin } from '../types';\nimport { createShell, type OperationItem, source, toNode } from './node';\n\nexport const handlerV1: HeyApiSdkPlugin['Handler'] = ({ plugin }) => {\n const structure = new StructureModel();\n const shell = createShell(plugin);\n const strategy = resolveStrategy(plugin);\n\n plugin.forEach(\n 'operation',\n (event) => {\n structure.insert({\n data: {\n operation: event.operation,\n path: event._path,\n tags: event.tags,\n } satisfies OperationItem,\n locations: strategy(event.operation).map((path) => ({ path, shell })),\n source,\n });\n },\n { order: 'declarations' },\n );\n\n const allDependencies: Array<ReturnType<typeof $.class | typeof $.func>> = [];\n const allNodes: Array<ReturnType<typeof $.class | typeof $.func>> = [];\n\n for (const node of structure.walk()) {\n const { dependencies, nodes } = toNode(node, plugin);\n allDependencies.push(...(dependencies ?? []));\n allNodes.push(...nodes);\n }\n\n for (const dep of allDependencies) {\n plugin.node(dep);\n }\n\n for (const node of allNodes) {\n plugin.node(node);\n }\n};\n","import type { HeyApiSdkPlugin } from './types';\nimport { handlerV1 } from './v1/plugin';\n\nexport const handler: HeyApiSdkPlugin['Handler'] = (args) => handlerV1(args);\n","import type { PluginContext } from '@hey-api/shared';\nimport { coerce, definePluginConfig } from '@hey-api/shared';\n\nimport { sdkImports } from './imports';\nimport type { UserOperationsConfig } from './operations';\nimport { handler } from './plugin';\nimport type { HeyApiSdkPlugin } from './types';\n\nexport const defaultConfig: HeyApiSdkPlugin['Config'] = {\n config: {\n $dependencies: ['client'],\n client: coerce((value, context) => {\n if (value === true || value === undefined) {\n return (context as PluginContext).resolveTag('client', {\n defaultPlugin: '@hey-api/client-httpx',\n });\n }\n return value;\n }),\n comments: true,\n examples: {\n $coerceAny: ({ value }) => ({ enabled: Boolean(value) }),\n enabled: false,\n language: 'Python',\n },\n includeInEntry: true,\n operations: {\n $cascade: ['strategy'],\n $coerceAny: ({ type, value }) => ({\n ...(type === 'string' || type === 'function'\n ? { strategy: value as UserOperationsConfig['strategy'] }\n : {}),\n }),\n container: 'class',\n containerName: {\n $coerce: {\n function: (v) => ({ name: v }),\n string: (v) => ({ name: v }),\n },\n casing: 'PascalCase',\n name: coerce((value, context) =>\n value !== undefined\n ? value\n : (context as UserOperationsConfig).strategy === 'single'\n ? 'Sdk'\n : '',\n ),\n },\n methodName: {\n $coerce: {\n function: (v) => ({ name: v }),\n string: (v) => ({ name: v }),\n },\n casing: 'snake_case',\n name: '',\n },\n methods: 'instance',\n nesting: 'operationId',\n nestingDelimiters: /[./]/,\n segmentName: {\n $coerce: {\n function: (v) => ({ name: v }),\n string: (v) => ({ name: v }),\n },\n casing: 'PascalCase',\n name: '',\n },\n strategy: 'single',\n strategyDefaultTag: 'default',\n },\n paramsStructure: 'grouped',\n },\n dependencies: ['pydantic'],\n handler,\n imports: sdkImports,\n name: '@hey-api/python-sdk',\n symbolMeta() {\n return {\n artifact: 'sdk',\n };\n },\n};\n\n/**\n * Type helper for `@hey-api/python-sdk` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import type { PluginInstance } from '@hey-api/shared';\n\nimport * as SYMBOLS from '../../symbols';\n\nexport function pydanticImports(plugin: PluginInstance) {\n const factory = plugin.symbolFactory;\n return {\n ...SYMBOLS.PYDANTIC(factory),\n datetime: SYMBOLS.DATETIME(factory),\n enum: SYMBOLS.ENUM(factory),\n typing: SYMBOLS.TYPING(factory),\n uuid: SYMBOLS.UUID(factory),\n };\n}\n\nexport type PydanticImports = ReturnType<typeof pydanticImports>;\n","import type { IR } from '@hey-api/shared';\n\nexport interface OperationSchemaResult {\n required: ReadonlyArray<string>;\n schema: IR.SchemaObject;\n}\n\nexport function buildOperationSchema(operation: IR.OperationObject): OperationSchemaResult {\n const requiredProperties = new Set<string>();\n\n const schema: IR.SchemaObject = {\n additionalProperties: { type: 'never' },\n properties: {},\n type: 'object',\n };\n\n if (operation.parameters) {\n // TODO: add support for cookies\n\n for (const location of ['header', 'path', 'query'] satisfies ReadonlyArray<\n keyof typeof operation.parameters\n >) {\n const params = operation.parameters[location];\n if (!params) continue;\n\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n const propKey = location === 'header' ? 'headers' : location;\n\n for (const key in params) {\n const parameter = params[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add(propKey);\n }\n }\n\n if (Object.keys(properties).length) {\n schema.properties![propKey] = { properties, required, type: 'object' };\n }\n }\n }\n\n if (operation.body) {\n schema.properties!.body = operation.body.schema;\n if (operation.body.required) {\n requiredProperties.add('body');\n }\n }\n\n schema.required = [...requiredProperties];\n\n return { required: schema.required, schema };\n}\n","import type { IR } from '@hey-api/shared';\nimport { operationResponsesMap } from '@hey-api/shared';\n\nimport { buildOperationSchema } from './operation-schema';\nimport type { ProcessorContext, ProcessorResult } from './processor';\n\nexport function irOperationToAst({\n operation,\n path,\n plugin,\n processor,\n tags,\n}: Pick<ProcessorContext, 'path' | 'plugin' | 'tags'> & {\n operation: IR.OperationObject;\n processor: ProcessorResult;\n}): void {\n if (plugin.config.requests.enabled) {\n const { schema } = buildOperationSchema(operation);\n\n if (schema.properties?.body && schema.properties.body.type !== 'never') {\n processor.process({\n meta: {\n resource: 'operation',\n resourceId: operation.id,\n role: 'request-body',\n },\n naming: plugin.config.requests.body,\n namingAnchor: operation.id,\n path: [...path, 'body'],\n plugin,\n schema: schema.properties.body,\n tags,\n });\n }\n\n // TODO: add support for cookies\n\n if (schema.properties?.headers && schema.properties.headers.type === 'object') {\n processor.process({\n meta: {\n resource: 'operation',\n resourceId: operation.id,\n role: 'request-headers',\n },\n naming: plugin.config.requests.headers,\n namingAnchor: operation.id,\n path: [...path, 'headers'],\n plugin,\n schema: schema.properties.headers,\n tags,\n });\n }\n\n if (schema.properties?.path && schema.properties.path.type === 'object') {\n processor.process({\n meta: {\n resource: 'operation',\n resourceId: operation.id,\n role: 'request-path',\n },\n naming: plugin.config.requests.path,\n namingAnchor: operation.id,\n path: [...path, 'path'],\n plugin,\n schema: schema.properties.path,\n tags,\n });\n }\n\n if (schema.properties?.query && schema.properties.query.type === 'object') {\n processor.process({\n meta: {\n resource: 'operation',\n resourceId: operation.id,\n role: 'request-query',\n },\n naming: plugin.config.requests.query,\n namingAnchor: operation.id,\n path: [...path, 'query'],\n plugin,\n schema: schema.properties.query,\n tags,\n });\n }\n }\n\n if (plugin.config.responses.enabled) {\n if (operation.responses) {\n const { response } = operationResponsesMap(operation);\n\n if (response) {\n processor.process({\n meta: {\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n },\n naming: plugin.config.responses,\n namingAnchor: operation.id,\n path: [...path, 'responses'],\n plugin,\n schema: response,\n tags,\n });\n }\n }\n }\n}\n","import type { IR } from '@hey-api/shared';\n\nimport { buildOperationSchema } from './operation-schema';\nimport type { ProcessorContext, ProcessorResult } from './processor';\n\nexport function irWebhookToAst({\n operation,\n path,\n plugin,\n processor,\n tags,\n}: Pick<ProcessorContext, 'path' | 'plugin' | 'tags'> & {\n operation: IR.OperationObject;\n processor: ProcessorResult;\n}): void {\n if (plugin.config.webhooks.enabled) {\n const { schema } = buildOperationSchema(operation);\n\n processor.process({\n meta: {\n resource: 'webhook',\n resourceId: operation.id,\n role: 'data',\n },\n naming: plugin.config.webhooks,\n namingAnchor: operation.id,\n path,\n plugin,\n schema,\n tags,\n });\n }\n}\n","import type { AnalysisContext, NodeName } from '@hey-api/codegen-core';\n\nimport type { py } from '../../../../py-compiler';\nimport { $, PyDsl } from '../../../../py-dsl';\nimport type { EnumMember } from '../../../../py-dsl/decl/enum';\nimport { DocMixin } from '../../../../py-dsl/mixins/doc';\n\nconst Mixed = DocMixin(PyDsl<py.ClassDeclaration>);\n\nexport class PydanticEnumDsl extends Mixed {\n readonly '~dsl' = 'PydanticEnumDsl';\n\n private _dsl?: ReturnType<typeof $.enum>;\n private _members: Array<EnumMember> = [];\n\n constructor(name: NodeName) {\n super();\n this.name.set(name);\n }\n\n members(...members: ReadonlyArray<EnumMember>): this {\n this._members.push(...members);\n return this;\n }\n\n _build(): ReturnType<typeof $.enum> {\n if (this._dsl) return this._dsl;\n\n const cls = $.enum(this.name)\n .$if(this.$docs(), (c, v) => c.doc(v))\n .members(...this._members);\n this._dsl = cls;\n return cls;\n }\n\n override analyze(ctx: AnalysisContext): void {\n this._build();\n ctx.analyze(this._dsl!);\n super.analyze(ctx);\n }\n\n override toAst() {\n this._build();\n return this._dsl!.toAst();\n }\n}\n","import type { AnalysisContext, Node } from '@hey-api/codegen-core';\n\nimport type { py } from '../../py-compiler';\nimport type { BaseCtor, MixinCtor } from './types';\n\nexport interface OptionalMethods extends Node {\n _optional?: boolean;\n /** Marks the node as optional when the condition is true. */\n optional(condition?: boolean): this;\n /** Marks the node as required when the condition is true. */\n required(condition?: boolean): this;\n}\n\nexport function OptionalMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) {\n abstract class Optional extends Base {\n protected _optional?: boolean;\n\n override analyze(ctx: AnalysisContext): void {\n super.analyze(ctx);\n }\n\n protected optional(condition?: boolean): this {\n this._optional = !arguments.length ? true : Boolean(condition);\n return this;\n }\n\n protected required(condition?: boolean): this {\n this._optional = !arguments.length ? false : !condition;\n return this;\n }\n }\n\n return Optional as unknown as MixinCtor<TBase, OptionalMethods>;\n}\n","import { $ } from '../../../../py-dsl';\n\nexport function literalize(\n value: unknown,\n): string | number | ReturnType<typeof $.expr | typeof $.literal> {\n if (value === null) return $('None');\n if (typeof value === 'string') return $.literal(value);\n if (typeof value === 'number') return $.literal(value);\n if (typeof value === 'boolean') return value ? $('True') : $('False');\n return String(value);\n}\n","import type { AnalysisContext, NodeName, Symbol } from '@hey-api/codegen-core';\nimport { applyNaming } from '@hey-api/shared';\n\nimport type { py } from '../../../../py-compiler';\nimport type { MaybePyDsl } from '../../../../py-dsl';\nimport { $, KwargPyDsl, PyDsl } from '../../../../py-dsl';\nimport { OptionalMixin } from '../../../../py-dsl/mixins/optional';\nimport { safeKeywordName } from '../../../../py-dsl/utils/name';\nimport type { PydanticPlugin } from '../../types';\nimport type { PydanticConstrainedTypeDsl } from '../expr/constrained-type';\nimport type { PydanticFieldConstraints } from '../expr/constraints';\nimport { literalize } from '../utils/literal';\n\nconst Mixed = OptionalMixin(PyDsl<py.Statement>);\n\nexport class PydanticFieldDsl extends Mixed {\n readonly '~dsl' = 'PydanticFieldDsl';\n\n protected plugin: PydanticPlugin['Instance'];\n\n private _decision?: { fieldSymbol: Symbol; strategy: 'field' };\n private _fieldArgs?: Array<ReturnType<typeof $.expr | typeof $.kwarg>>;\n private _pythonName: string;\n private _wireName: string;\n\n private _alias?: string;\n private _default: unknown;\n private _defaultFactory?: string;\n private _deprecated?: boolean;\n private _discriminator?: string;\n private _dsl?: ReturnType<typeof $.field>;\n private _constrainedType?: PydanticConstrainedTypeDsl;\n private _nullable?: boolean;\n private _unionMembers?: Array<PydanticConstrainedTypeDsl>;\n\n constructor(plugin: PydanticPlugin['Instance'], name: string) {\n super();\n this._wireName = name;\n this.plugin = plugin;\n\n const snaked = applyNaming(this._wireName, { casing: 'snake_case' });\n this._pythonName = safeKeywordName(snaked);\n this.name.set(plugin.symbol(this._pythonName));\n }\n\n get hasAlias(): boolean {\n const effectiveAlias =\n this._alias ?? (this._pythonName !== this._wireName ? this._wireName : undefined);\n return effectiveAlias !== undefined;\n }\n\n alias(name: string): this {\n this._alias = name;\n return this;\n }\n\n default(value: unknown): this {\n this._default = value;\n return this;\n }\n\n defaultFactory(factory: string): this {\n this._defaultFactory = factory;\n return this;\n }\n\n deprecated(value: boolean): this {\n this._deprecated = value;\n return this;\n }\n\n discriminator(field: string): this {\n this._discriminator = field;\n return this;\n }\n\n metadata(constrainedType: PydanticConstrainedTypeDsl): this {\n this._constrainedType = constrainedType;\n return this;\n }\n\n nullable(value: boolean): this {\n this._nullable = value;\n return this;\n }\n\n type(constrainedType: PydanticConstrainedTypeDsl | Array<PydanticConstrainedTypeDsl>): this {\n if (Array.isArray(constrainedType)) {\n this._unionMembers = constrainedType;\n } else {\n this._constrainedType = constrainedType;\n }\n return this;\n }\n\n private _buildUnionVarType(): ReturnType<typeof $.subscript | typeof $.type.or> | undefined {\n const members = this._unionMembers;\n if (!members?.length) return;\n\n const { plugin } = this;\n\n const itemExprs = members.map((ct) => {\n if (!ct.constraints.hasValidationConstraints) {\n return ct.type;\n }\n\n return $(plugin.imports.typing.Annotated).slice(\n ct.type,\n $(plugin.imports.Field).call(...this._constraintsToKwargs(ct.constraints.values)),\n );\n });\n\n const unionType = $.type.or(...itemExprs);\n\n if (this._discriminator) {\n return $(plugin.imports.typing.Annotated).slice(\n unionType,\n $(plugin.imports.Field).call($.kwarg('discriminator', this._discriminator)),\n );\n }\n\n return unionType;\n }\n\n private _constraintsToKwargs(\n cv: Readonly<PydanticFieldConstraints>,\n ): Array<ReturnType<typeof $.kwarg>> {\n const args: Array<ReturnType<typeof $.kwarg>> = [];\n if (cv.gt !== undefined) args.push($.kwarg('gt', cv.gt));\n if (cv.ge !== undefined) args.push($.kwarg('ge', cv.ge));\n if (cv.lt !== undefined) args.push($.kwarg('lt', cv.lt));\n if (cv.le !== undefined) args.push($.kwarg('le', cv.le));\n if (cv.multiple_of !== undefined) args.push($.kwarg('multiple_of', cv.multiple_of));\n if (cv.min_length !== undefined) args.push($.kwarg('min_length', cv.min_length));\n if (cv.max_length !== undefined) args.push($.kwarg('max_length', cv.max_length));\n if (cv.pattern !== undefined) args.push($.kwarg('pattern', cv.pattern));\n return args;\n }\n\n _build(): ReturnType<typeof $.field> {\n if (this._dsl) return this._dsl;\n\n const { plugin } = this;\n\n const isUnion = Boolean(this._unionMembers?.length);\n\n const cv = this._constrainedType?.constraints.values ?? {};\n const hasValidationConstraints = this._constrainedType\n ? this._constrainedType.constraints.hasValidationConstraints\n : false;\n\n const hasDefault = this._default !== undefined;\n\n let varType:\n | ReturnType<typeof $.expr | typeof $.field | typeof $.type.or>\n | NodeName\n | MaybePyDsl<py.Expression>\n | undefined;\n\n if (isUnion) {\n varType = this._buildUnionVarType();\n if (this._discriminator) this._discriminator = undefined;\n } else {\n varType = this._constrainedType?.type;\n if (hasValidationConstraints && varType) {\n varType = $(plugin.imports.typing.Annotated).slice(\n varType,\n $(plugin.imports.Field).call(...this._constraintsToKwargs(cv)),\n );\n }\n }\n\n if ((this._nullable || this._optional) && varType) {\n varType = $.type.or(varType, 'None');\n }\n\n const effectiveAlias =\n this._alias ?? (this._pythonName !== this._wireName ? this._wireName : undefined);\n\n const stmt = $.field(this.name).$if(varType, (v, t) => v.type(t));\n\n const needsField =\n this._defaultFactory !== undefined ||\n effectiveAlias !== undefined ||\n this._discriminator !== undefined ||\n cv.title !== undefined ||\n cv.description !== undefined ||\n this._deprecated !== undefined;\n\n const args: Array<ReturnType<typeof $.expr | typeof $.kwarg>> = [];\n\n const isRequired = !this._nullable && !this._optional && !hasDefault && !this._defaultFactory;\n if (isRequired) {\n args.push($('...'));\n } else if (hasDefault) {\n args.push($.kwarg('default', literalize(this._default)));\n } else if (this._nullable || this._optional) {\n args.push($.kwarg('default', literalize(null)));\n }\n this._fieldArgs = args;\n\n if (needsField) {\n if (this._defaultFactory) args.push($.kwarg('default_factory', this._defaultFactory));\n if (effectiveAlias !== undefined) args.push($.kwarg('alias', effectiveAlias));\n if (cv.title !== undefined) args.push($.kwarg('title', cv.title));\n if (cv.description !== undefined) args.push($.kwarg('description', cv.description));\n if (this._deprecated !== undefined) args.push($.kwarg('deprecated', this._deprecated));\n if (this._discriminator !== undefined) {\n args.push($.kwarg('discriminator', this._discriminator));\n }\n\n this._fieldArgs = args;\n stmt.assign($(plugin.imports.Field).call(...args));\n } else if (hasDefault) {\n stmt.assign(literalize(this._default));\n } else if (this._nullable || this._optional) {\n stmt.assign(literalize(null));\n }\n\n this._dsl = stmt;\n return this._dsl;\n }\n\n override analyze(ctx: AnalysisContext): void {\n this._build();\n ctx.analyze(this._dsl!);\n this.name.symbol?.on('finalName', ({ symbol }) => {\n if (!symbol.isRenamed) return;\n const fieldSymbol = this.plugin.imports.Field;\n const targetFile = ctx.symbol?.file;\n fieldSymbol.on('import', ({ symbol: importSymbol }) => {\n if (targetFile && importSymbol.file?.id === targetFile.id) {\n this._decision = { fieldSymbol: importSymbol, strategy: 'field' };\n }\n });\n ctx.analyze(fieldSymbol);\n });\n super.analyze(ctx);\n }\n\n override toAst() {\n this._build();\n if (this._decision?.strategy === 'field') {\n const args = this._fieldArgs ?? [];\n if (!args.some((a) => a instanceof KwargPyDsl && a.key === 'alias')) {\n args.push($.kwarg('alias', this._wireName));\n }\n this._dsl!.assign($(this._decision.fieldSymbol).call(...args));\n }\n return this._dsl!.toAst();\n }\n}\n","export const identifiers = {\n model_config: 'model_config',\n root: 'root',\n};\n","import type { Symbol, SymbolMeta } from '@hey-api/codegen-core';\n\nimport { $ } from '../../../py-dsl';\nimport type { PydanticPlugin } from '../types';\nimport { identifiers } from '../v2/constants';\n\nexport const BASE_MODEL_META = {\n category: 'utility',\n resource: 'BaseModel',\n} as const satisfies SymbolMeta;\n\nexport function createBaseModel(\n plugin: PydanticPlugin['Instance'],\n symbol: Symbol,\n): ReturnType<typeof $.class> {\n const configKwargs = resolveBaseModelConfig({ populateByName: false });\n\n return $.class(symbol)\n .export()\n .extends(plugin.imports.BaseModel)\n .$if(configKwargs.length, (c) =>\n c.do(\n $.field(identifiers.model_config).assign(\n $(plugin.imports.ConfigDict).call(...configKwargs),\n ),\n ),\n );\n}\n\nexport function resolveBaseModelConfig(options: {\n populateByName: boolean;\n}): Array<ReturnType<typeof $.expr | typeof $.kwarg>> {\n const kwargs: Array<ReturnType<typeof $.expr | typeof $.kwarg>> = [];\n\n if (options.populateByName) {\n kwargs.push($.kwarg('populate_by_name', true));\n }\n\n return kwargs;\n}\n","import type { AnalysisContext, NodeName } from '@hey-api/codegen-core';\n\nimport type { py } from '../../../../py-compiler';\nimport { KwargPyDsl, PyDsl } from '../../../../py-dsl';\nimport { $ } from '../../../../py-dsl';\nimport { DocMixin } from '../../../../py-dsl/mixins/doc';\nimport { resolveBaseModelConfig } from '../../shared/base-model';\nimport type { PydanticModelConfig } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\nimport { identifiers } from '../../v2/constants';\nimport type { PydanticFieldDsl } from './field';\n\nconst Mixed = DocMixin(PyDsl<py.ClassDeclaration>);\n\nexport class PydanticModelDsl extends Mixed {\n readonly '~dsl' = 'PydanticModelDsl';\n\n protected plugin: PydanticPlugin['Instance'];\n\n private _bases: Array<NodeName> = [];\n private _configKwargs: Array<[string, string | number | boolean]> = [];\n private _dsl?: ReturnType<typeof $.class>;\n private _fields: Array<PydanticFieldDsl> = [];\n\n constructor(plugin: PydanticPlugin['Instance'], name: NodeName) {\n super();\n this.plugin = plugin;\n this.name.set(name);\n }\n\n config(options: PydanticModelConfig): this {\n for (const [key, value] of Object.entries(options)) {\n this._configKwargs.push([key, value]);\n }\n return this;\n }\n\n extends(base: NodeName): this {\n this._bases.push(base);\n return this;\n }\n\n fields(...fields: ReadonlyArray<PydanticFieldDsl>): this {\n this._fields.push(...fields);\n return this;\n }\n\n _build(): ReturnType<typeof $.class> {\n if (this._dsl) return this._dsl;\n\n const { plugin } = this;\n\n if (plugin.config.modelType === 'dataclass') {\n const cls = $.class(this.name)\n .decorator(plugin.imports.dataclass)\n .do(...this._fields);\n this._dsl = cls;\n return cls;\n }\n\n const hasAnyAlias = this._fields.some((f) => f.hasAlias);\n const modelKeys = new Set(this._configKwargs.map(([k]) => k));\n const baseKwargs = resolveBaseModelConfig({ populateByName: hasAnyAlias }).filter(\n (kw) => kw instanceof KwargPyDsl && !modelKeys.has(kw.key),\n );\n const mergedKwargs = [...baseKwargs, ...this._configKwargs.map(([k, v]) => $.kwarg(k, v))];\n\n const cls = $.class(this.name)\n // plugin.querySymbol(BASE_MODEL_META)!\n .extends(plugin.imports.BaseModel, ...this._bases)\n .$if(this.$docs(), (c, v) => c.doc(v))\n .$if(this._configKwargs.length, (c) =>\n c.do(\n $.field(identifiers.model_config).assign(\n $(plugin.imports.ConfigDict).call(...mergedKwargs),\n ),\n ),\n )\n .do(...this._fields);\n\n this._dsl = cls;\n return cls;\n }\n\n override analyze(ctx: AnalysisContext): void {\n this._build();\n ctx.analyze(this._dsl!);\n super.analyze(ctx);\n }\n\n override toAst() {\n this._build();\n return this._dsl!.toAst();\n }\n}\n","import type { AnalysisContext, NodeName } from '@hey-api/codegen-core';\n\nimport type { py } from '../../../../py-compiler';\nimport { $, PyDsl } from '../../../../py-dsl';\nimport { DocMixin } from '../../../../py-dsl/mixins/doc';\nimport type { PydanticPlugin } from '../../types';\nimport { identifiers } from '../../v2/constants';\nimport type { PydanticConstrainedTypeDsl } from '../expr/constrained-type';\nimport { PydanticFieldDsl } from './field';\n\nconst Mixed = DocMixin(PyDsl<py.ClassDeclaration>);\n\nexport class PydanticRootModelDsl extends Mixed {\n readonly '~dsl' = 'PydanticRootModelDsl';\n\n protected plugin: PydanticPlugin['Instance'];\n\n private _discriminator?: string;\n private _dsl?: ReturnType<typeof $.class>;\n private _type?: PydanticConstrainedTypeDsl;\n\n constructor(plugin: PydanticPlugin['Instance'], name: NodeName) {\n super();\n this.plugin = plugin;\n this.name.set(name);\n }\n\n type(constrainedType: PydanticConstrainedTypeDsl): this {\n this._type = constrainedType;\n return this;\n }\n\n discriminator(field: string): this {\n this._discriminator = field;\n return this;\n }\n\n _build(): ReturnType<typeof $.class> {\n if (this._dsl) return this._dsl;\n\n const { plugin } = this;\n\n const rootModelBase = $(plugin.imports.RootModel).slice(\n this._type?.type ?? plugin.imports.typing.Any,\n );\n\n const rootField = new PydanticFieldDsl(plugin, identifiers.root)\n .$if(this._type !== undefined, (f) => f.type(this._type!))\n .$if(this._discriminator !== undefined, (f) => f.discriminator(this._discriminator!));\n\n this._dsl = $.class(this.name)\n .extends(rootModelBase)\n .$if(this.$docs(), (c, v) => c.doc(v))\n .do(rootField);\n\n return this._dsl;\n }\n\n override analyze(ctx: AnalysisContext): void {\n this._build();\n ctx.analyze(this._dsl!);\n super.analyze(ctx);\n }\n\n override toAst() {\n this._build();\n return this._dsl!.toAst();\n }\n}\n","import type { AnalysisContext, NodeName } from '@hey-api/codegen-core';\n\nimport type { py } from '../../../../py-compiler';\nimport { $, PyDsl } from '../../../../py-dsl';\nimport type { PydanticPlugin } from '../../types';\nimport type { PydanticConstrainedTypeDsl } from '../expr/constrained-type';\n\nconst Mixed = PyDsl<py.Statement>;\n\nexport class PydanticTypeAliasDsl extends Mixed {\n readonly '~dsl' = 'PydanticTypeAliasDsl';\n\n readonly aliased?: PydanticConstrainedTypeDsl;\n\n protected plugin: PydanticPlugin['Instance'];\n private _dsl?: ReturnType<typeof $.var>;\n\n constructor(\n plugin: PydanticPlugin['Instance'],\n name: NodeName,\n aliased?: PydanticConstrainedTypeDsl,\n ) {\n super();\n this.name.set(name);\n this.aliased = aliased;\n this.plugin = plugin;\n }\n\n _build(): ReturnType<typeof $.var> {\n if (this._dsl) return this._dsl;\n\n const { plugin } = this;\n\n this._dsl = $.var(this.name)\n .type(plugin.imports.typing.TypeAlias)\n .assign(this.aliased?.type ?? plugin.imports.typing.Any);\n\n return this._dsl;\n }\n\n override analyze(ctx: AnalysisContext): void {\n this._build();\n ctx.analyze(this._dsl!);\n super.analyze(ctx);\n }\n\n override toAst() {\n this._build();\n return this._dsl!.toAst();\n }\n}\n","import type { RString } from '../../../../py-dsl/utils/r-string';\nimport { rString } from '../../../../py-dsl/utils/r-string';\n\nexport interface PydanticFieldConstraints {\n description?: string;\n /** Greater than or equal constraint for numbers. */\n ge?: number;\n /** Greater than constraint for numbers. */\n gt?: number;\n /** Less than or equal constraint for numbers. */\n le?: number;\n /** Less than constraint for numbers. */\n lt?: number;\n /** Maximum length constraint for strings/arrays. */\n max_length?: number;\n /** Minimum length constraint for strings/arrays. */\n min_length?: number;\n /** Multiple of constraint for numbers. */\n multiple_of?: number;\n /** Regex pattern constraint for strings. */\n pattern?: RString;\n title?: string;\n}\n\nconst VALIDATION_KEYS: ReadonlyArray<keyof PydanticFieldConstraints> = [\n 'ge',\n 'gt',\n 'le',\n 'lt',\n 'min_length',\n 'max_length',\n 'multiple_of',\n 'pattern',\n];\n\nexport class PydanticConstraintsDsl {\n readonly '~dsl' = 'PydanticConstraintsDsl';\n\n private _values: PydanticFieldConstraints = {};\n\n get hasValidationConstraints(): boolean {\n return VALIDATION_KEYS.some((k) => this._values[k] !== undefined);\n }\n\n get isEmpty(): boolean {\n return Object.keys(this._values).length === 0;\n }\n\n get values(): Readonly<PydanticFieldConstraints> {\n return this._values;\n }\n\n description(text: string): this {\n this._values.description = text;\n return this;\n }\n\n ge(n: number): this {\n this._values.ge = n;\n return this;\n }\n\n gt(n: number): this {\n this._values.gt = n;\n return this;\n }\n\n le(n: number): this {\n this._values.le = n;\n return this;\n }\n\n lt(n: number): this {\n this._values.lt = n;\n return this;\n }\n\n maxLength(n: number): this {\n this._values.max_length = n;\n return this;\n }\n\n merge(other: PydanticConstraintsDsl): PydanticConstraintsDsl {\n this._values = { ...this._values, ...other._values };\n return this;\n }\n\n minLength(n: number): this {\n this._values.min_length = n;\n return this;\n }\n\n multipleOf(n: number): this {\n this._values.multiple_of = n;\n return this;\n }\n\n pattern(p: string): this {\n this._values.pattern = rString(p);\n return this;\n }\n\n title(text: string): this {\n this._values.title = text;\n return this;\n }\n}\n","import type { NodeName } from '@hey-api/codegen-core';\n\nimport type { py } from '../../../../py-compiler';\nimport type { MaybePyDsl } from '../../../../py-dsl';\nimport { PydanticConstraintsDsl } from './constraints';\n\nexport class PydanticConstrainedTypeDsl {\n readonly '~dsl' = 'PydanticConstrainedTypeDsl';\n\n readonly constraints: PydanticConstraintsDsl;\n readonly type: NodeName | MaybePyDsl<py.Expression>;\n\n constructor(\n type: NodeName | MaybePyDsl<py.Expression>,\n constraints: PydanticConstraintsDsl = new PydanticConstraintsDsl(),\n ) {\n this.constraints = constraints;\n this.type = type;\n }\n\n mergeConstraints(constraints: PydanticConstraintsDsl): this {\n this.constraints.merge(constraints);\n return this;\n }\n}\n","import { PydanticEnumDsl } from './decl/enum';\nimport { PydanticFieldDsl } from './decl/field';\nimport { PydanticModelDsl } from './decl/model';\nimport { PydanticRootModelDsl } from './decl/root-model';\nimport { PydanticTypeAliasDsl } from './decl/type-alias';\nimport { PydanticConstrainedTypeDsl } from './expr/constrained-type';\nimport { PydanticConstraintsDsl } from './expr/constraints';\n\nconst pydanticDsl = {\n /** Constrained type: a type with attached validation constraints and metadata. */\n constrainedType: (...args: ConstructorParameters<typeof PydanticConstrainedTypeDsl>) =>\n new PydanticConstrainedTypeDsl(...args),\n\n /** Constraints bag: validation constraints and field metadata. */\n constraints: (...args: ConstructorParameters<typeof PydanticConstraintsDsl>) =>\n new PydanticConstraintsDsl(...args),\n\n /** Pydantic enum class. */\n enum: (...args: ConstructorParameters<typeof PydanticEnumDsl>) => new PydanticEnumDsl(...args),\n\n /** Pydantic field. */\n field: (...args: ConstructorParameters<typeof PydanticFieldDsl>) => new PydanticFieldDsl(...args),\n\n /** Pydantic model class. */\n model: (...args: ConstructorParameters<typeof PydanticModelDsl>) => new PydanticModelDsl(...args),\n\n /** Pydantic RootModel class. */\n rootModel: (...args: ConstructorParameters<typeof PydanticRootModelDsl>) =>\n new PydanticRootModelDsl(...args),\n\n /** Pydantic type alias. */\n typeAlias: (...args: ConstructorParameters<typeof PydanticTypeAliasDsl>) =>\n new PydanticTypeAliasDsl(...args),\n};\n\nexport const $ = Object.assign(\n (...args: ConstructorParameters<typeof PydanticModelDsl>) => new PydanticModelDsl(...args),\n pydanticDsl,\n);\n\nexport { PydanticEnumDsl } from './decl/enum';\nexport { PydanticFieldDsl } from './decl/field';\nexport { PydanticModelDsl } from './decl/model';\nexport { PydanticRootModelDsl } from './decl/root-model';\nexport { PydanticTypeAliasDsl } from './decl/type-alias';\nexport { PydanticConstrainedTypeDsl } from './expr/constrained-type';\nexport { PydanticConstraintsDsl } from './expr/constraints';\n","import { buildSymbolIn, pathToName } from '@hey-api/shared';\n\nimport type { DocLines } from '../../../py-dsl/layout/doc';\nimport { $ } from '../dsl';\nimport type { ProcessorContext } from './processor';\nimport type { PydanticNode } from './types';\n\n// TODO: move this somewhere else, maybe Python utils?\nexport function toDocLines(title?: string, description?: string): DocLines {\n if (title && description) return [title, '', description];\n if (title) return title;\n if (description) return description;\n return [];\n}\n\nexport function exportAst({\n meta,\n naming,\n namingAnchor,\n node,\n path,\n plugin,\n schema,\n tags,\n}: ProcessorContext & {\n node: PydanticNode;\n}): void {\n const name = pathToName(path, { anchor: namingAnchor });\n const symbol = plugin.symbol(\n buildSymbolIn({\n meta: {\n category: 'schema',\n path,\n tags,\n ...meta,\n },\n name,\n naming,\n path,\n plugin,\n schema,\n }),\n );\n\n const docLines = toDocLines(schema.title, schema.description);\n\n if (node.kind === 'enum') {\n const enumNode = $.enum(symbol)\n .members(...node.members)\n .doc(docLines);\n plugin.node(enumNode);\n return;\n }\n\n if (node.kind === 'model') {\n // if (plugin.config.modelType === 'BaseModel') {\n // let baseModelSymbol: Symbol | undefined = plugin.querySymbol(BASE_MODEL_META);\n // if (!baseModelSymbol) {\n // baseModelSymbol = plugin.symbol('BaseModel', {\n // children: [...plugin.imports.BaseModel.children],\n // meta: BASE_MODEL_META,\n // });\n // const baseModel = createBaseModel(plugin, baseModelSymbol);\n // plugin.node(baseModel);\n // }\n // }\n\n const model = $.model(plugin, symbol)\n .doc(docLines)\n .$if(plugin.config.strict, (m) => m.config({ extra: 'forbid' }))\n .$if(node.config, (m, c) => m.config(c))\n .fields(...node.fields);\n plugin.node(model);\n return;\n }\n\n if (node.kind === 'rootModel') {\n const rootModel = $.rootModel(plugin, symbol)\n .doc(docLines)\n .type(node.type)\n .$if(node.discriminator, (m, d) => m.discriminator(d));\n plugin.node(rootModel);\n return;\n }\n\n plugin.node($.typeAlias(plugin, symbol, node.type));\n}\n","import type { IR } from '@hey-api/shared';\n\nimport type { PydanticMeta, PydanticResult } from './types';\n\n/**\n * Creates default metadata from a schema.\n */\nexport function defaultMeta(schema: IR.SchemaObject): PydanticMeta {\n return {\n default: schema.default,\n hasForwardReference: false,\n nullable: false,\n readonly: schema.accessScope === 'read',\n };\n}\n\n/**\n * Composes metadata from child results.\n *\n * @param children - Results from walking child schemas\n * @param overrides - Explicit overrides (e.g., from parent schema)\n */\nexport function composeMeta(\n children: ReadonlyArray<PydanticResult>,\n overrides?: Partial<PydanticMeta>,\n): PydanticMeta {\n return {\n default: overrides?.default,\n hasForwardReference:\n overrides?.hasForwardReference ?? children.some((c) => c.meta.hasForwardReference),\n nullable: overrides?.nullable ?? children.some((c) => c.meta.nullable),\n readonly: overrides?.readonly ?? children.some((c) => c.meta.readonly),\n };\n}\n\n/**\n * Merges parent schema metadata with composed child metadata.\n *\n * @param parent - The parent schema\n * @param children - Results from walking child schemas\n */\nexport function inheritMeta(\n parent: IR.SchemaObject,\n children: ReadonlyArray<PydanticResult>,\n): PydanticMeta {\n return composeMeta(children, {\n default: parent.default,\n nullable: false,\n readonly: parent.accessScope === 'read',\n });\n}\n","import { childContext, deduplicateSchema } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { ArrayResolverContext } from '../../resolvers';\nimport type { PydanticResult, PydanticType } from '../../shared/types';\n\nfunction baseNode(ctx: ArrayResolverContext): PydanticType {\n const { applyModifiers, childResults, plugin } = ctx;\n const any = plugin.imports.typing.Any;\n\n if (!childResults.length) {\n const type = $$.constrainedType($('list').slice(any));\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n }\n\n if (childResults.length === 1) {\n const itemResult = applyModifiers(childResults[0]!);\n const type = $$.constrainedType($('list').slice(itemResult.type?.type ?? any));\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n }\n\n const itemTypes = childResults.map((r) => applyModifiers(r).type?.type ?? any);\n const type = $$.constrainedType($('list').slice($.type.or(...itemTypes)));\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n}\n\nfunction arrayResolver(ctx: ArrayResolverContext): PydanticType {\n const baseResult = ctx.nodes.base(ctx);\n const { schema } = ctx;\n const c = $$.constraints();\n\n if (schema.minItems !== undefined) c.minLength(schema.minItems);\n if (schema.maxItems !== undefined) c.maxLength(schema.maxItems);\n if (schema.description !== undefined) c.description(schema.description);\n\n if (!c.isEmpty && baseResult.type) {\n return {\n node: baseResult.node,\n type: baseResult.type.mergeConstraints(c),\n };\n }\n\n return baseResult;\n}\n\nexport interface ArrayToTypeResult extends PydanticType {\n childResults: Array<PydanticResult>;\n}\n\nexport function arrayToType(\n ctx: Pick<ArrayResolverContext, 'applyModifiers' | 'path' | 'plugin' | 'schema' | 'walk'>,\n): ArrayToTypeResult {\n const { applyModifiers, path, plugin, schema, walk } = ctx;\n const any = plugin.imports.typing.Any;\n\n const childResults: Array<PydanticResult> = [];\n\n if (schema.items) {\n const normalizedSchema = deduplicateSchema({ schema });\n for (let i = 0; i < normalizedSchema.items!.length; i++) {\n const item = normalizedSchema.items![i]!;\n const result = walk(item, childContext({ path, plugin }, 'items', i));\n childResults.push(result);\n }\n }\n\n const resolverCtx: ArrayResolverContext = {\n $,\n applyModifiers,\n childResults,\n nodes: {\n base: baseNode,\n },\n path,\n plugin,\n schema,\n walk,\n };\n\n const resolver = plugin.config.$resolvers?.array ?? plugin.config['~resolvers']?.array;\n const resolved = resolver?.(resolverCtx) ?? arrayResolver(resolverCtx);\n\n if (!resolved.type) {\n resolved.type = $$.constrainedType($('list').slice(any));\n }\n\n return {\n ...resolved,\n childResults,\n };\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { BooleanResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\nfunction constNode(ctx: BooleanResolverContext): PydanticType | undefined {\n const { plugin, schema } = ctx;\n\n if (typeof schema.const === 'boolean') {\n const literal = plugin.imports.typing.Literal;\n const type = $$.constrainedType($(literal).slice($.literal(schema.const)));\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction baseNode(_ctx: BooleanResolverContext): PydanticType {\n const type = $$.constrainedType('bool');\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n}\n\nfunction booleanResolver(ctx: BooleanResolverContext): PydanticType {\n const constResult = ctx.nodes.const(ctx);\n if (constResult) return constResult;\n\n return ctx.nodes.base(ctx);\n}\n\nexport function booleanToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'boolean'>;\n}): PydanticType {\n const ctx: BooleanResolverContext = {\n $,\n nodes: {\n base: baseNode,\n const: constNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.boolean ?? plugin.config['~resolvers']?.boolean;\n return resolver?.(ctx) ?? booleanResolver(ctx);\n}\n","import { fromRef } from '@hey-api/codegen-core';\nimport type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\nimport { pathToJsonPointer, toCase } from '@hey-api/shared';\n\nimport type { EnumMember } from '../../../../py-dsl';\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { EnumResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\nexport interface EnumToTypeResult extends PydanticType {\n enumMembers: Array<EnumMember>;\n isNullable: boolean;\n}\n\n// TODO: move to Pydantic enum (member?) DSL, replace with casing utils\nfunction toEnumMemberName(value: boolean | number | string): string {\n if (typeof value === 'boolean') {\n return toCase(String(value), 'SCREAMING_SNAKE_CASE');\n }\n if (typeof value === 'number') {\n return `VALUE_${value}`.replace(/-/g, '_NEG_').replace(/\\./g, '_DOT_');\n }\n return toCase(value, 'SCREAMING_SNAKE_CASE');\n}\n\nfunction itemsNode(ctx: EnumResolverContext): {\n enumMembers: Array<EnumMember>;\n isNullable: boolean;\n} {\n const { plugin, schema } = ctx;\n const enumMembers: Array<EnumMember> = [];\n let isNullable = false;\n\n for (const item of schema.items ?? []) {\n if (item.type === 'null' || item.const === null) {\n isNullable = true;\n continue;\n }\n\n if (\n (item.type === 'string' && typeof item.const === 'string') ||\n ((item.type === 'integer' || item.type === 'number') && typeof item.const === 'number') ||\n (item.type === 'boolean' && typeof item.const === 'boolean')\n ) {\n enumMembers.push({\n name: plugin.symbol(toEnumMemberName(item.const)),\n value: item.const,\n });\n }\n }\n\n return { enumMembers, isNullable };\n}\n\nfunction baseNode(ctx: EnumResolverContext): PydanticType {\n const { plugin } = ctx;\n const { enumMembers } = ctx.nodes.items(ctx);\n\n if (!enumMembers.length) {\n return {\n type: $$.constrainedType(plugin.imports.typing.Any),\n };\n }\n\n const mode = plugin.config.enums ?? 'enum';\n\n if (mode === 'literal') {\n const literal = plugin.imports.typing.Literal;\n const values = enumMembers.map((m) =>\n // TODO: replace\n typeof m.value === 'string' ? `\"<<<<${m.value}\"` : `<<<${m.value}`,\n );\n\n return {\n type: $$.constrainedType($(literal).slice(...values)),\n };\n }\n // TODO: contract (self)\n const refSymbol = plugin.referenceSymbol({\n artifact: 'pydantic',\n category: 'schema',\n resource: 'definition',\n resourceId: pathToJsonPointer(fromRef(ctx.path)),\n });\n\n return {\n type: $$.constrainedType(refSymbol),\n };\n}\n\nfunction enumResolver(ctx: EnumResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport function enumToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'enum'>;\n}): EnumToTypeResult {\n const ctx: EnumResolverContext = {\n $,\n nodes: {\n base: baseNode,\n items: itemsNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.enum ?? plugin.config['~resolvers']?.enum;\n const resolved = resolver?.(ctx) ?? enumResolver(ctx);\n\n const { enumMembers, isNullable } = ctx.nodes.items(ctx);\n\n return {\n ...resolved,\n enumMembers,\n isNullable,\n };\n}\n","import { isSymbol } from '@hey-api/codegen-core';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { IntersectionResolverContext } from '../../resolvers';\nimport type { PydanticResult, PydanticType } from '../../shared/types';\n\nfunction isReferenceResult(result: PydanticResult): boolean {\n // A reference result has no pre-resolved node and its type is a Symbol\n // (set by the visitor's reference() handler via plugin.referenceSymbol()).\n return !result.node && result.type !== undefined && isSymbol(result.type.type);\n}\n\nfunction baseNode(ctx: IntersectionResolverContext): PydanticType {\n const { applyModifiers, childResults, plugin } = ctx;\n\n if (!childResults.length) {\n return { type: $$.constrainedType(plugin.imports.typing.Any) };\n }\n\n if (childResults.length === 1) {\n return applyModifiers(childResults[0]!);\n }\n\n const baseClasses: Array<ReturnType<typeof $$.constrainedType>> = [];\n\n for (const result of childResults) {\n if (isReferenceResult(result)) {\n const t = result.type!;\n if (!baseClasses.includes(t)) baseClasses.push(t);\n }\n }\n\n if (baseClasses.length) {\n return { type: baseClasses[0]! };\n }\n\n return { type: $$.constrainedType(plugin.imports.typing.Any) };\n}\n\nfunction intersectionResolver(ctx: IntersectionResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport interface IntersectionToTypeResult extends PydanticType {\n baseClasses?: Array<ReturnType<typeof $$.constrainedType>>;\n childResults: Array<PydanticResult>;\n mergedFields?: Array<ReturnType<typeof $$.field>>;\n}\n\nexport function intersectionToType({\n applyModifiers,\n childResults,\n parentSchema,\n path,\n plugin,\n}: Pick<\n IntersectionResolverContext,\n 'applyModifiers' | 'childResults' | 'parentSchema' | 'path' | 'plugin'\n>): IntersectionToTypeResult {\n const resolverCtx: IntersectionResolverContext = {\n $,\n applyModifiers,\n childResults,\n nodes: { base: baseNode },\n parentSchema,\n path,\n plugin,\n schema: parentSchema,\n };\n\n const resolver =\n plugin.config.$resolvers?.intersection ?? plugin.config['~resolvers']?.intersection;\n let resolved = resolver?.(resolverCtx) ?? intersectionResolver(resolverCtx);\n\n if (parentSchema.description !== undefined && resolved.type) {\n resolved = {\n ...resolved,\n type: resolved.type.mergeConstraints($$.constraints().description(parentSchema.description)),\n };\n }\n\n const baseClasses: Array<ReturnType<typeof $$.constrainedType>> = [];\n const mergedFields: Array<ReturnType<typeof $$.field>> = [];\n const seenFieldNames = new Set<object>();\n\n for (const result of childResults) {\n if (isReferenceResult(result)) {\n const t = result.type!;\n if (!baseClasses.includes(t)) baseClasses.push(t);\n continue;\n }\n\n const finalResult = applyModifiers(result);\n\n if (finalResult.node?.kind === 'model') {\n for (const field of finalResult.node.fields) {\n if (!seenFieldNames.has(field.name as object)) {\n seenFieldNames.add(field.name as object);\n mergedFields.push(field);\n }\n }\n }\n }\n\n return {\n ...resolved,\n baseClasses: baseClasses.length ? baseClasses : undefined,\n childResults,\n mergedFields: mergedFields.length ? mergedFields : undefined,\n };\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { NeverResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\nfunction baseNode(ctx: NeverResolverContext): PydanticType {\n const { plugin } = ctx;\n return {\n type: $$.constrainedType(plugin.imports.typing.NoReturn),\n };\n}\n\nfunction neverResolver(ctx: NeverResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport function neverToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'never'>;\n}): PydanticType {\n const ctx: NeverResolverContext = {\n $,\n nodes: {\n base: baseNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.never ?? plugin.config['~resolvers']?.never;\n return resolver?.(ctx) ?? neverResolver(ctx);\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { NullResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction baseNode(_ctx: NullResolverContext): PydanticType {\n const type = $$.constrainedType('None');\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n}\n\nfunction nullResolver(ctx: NullResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport function nullToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'null'>;\n}): PydanticType {\n const ctx: NullResolverContext = {\n $,\n nodes: {\n base: baseNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.null ?? plugin.config['~resolvers']?.null;\n return resolver?.(ctx) ?? nullResolver(ctx);\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { NumberResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\nfunction constNode(ctx: NumberResolverContext): PydanticType | undefined {\n const { plugin, schema } = ctx;\n\n if (typeof schema.const === 'number') {\n const literal = plugin.imports.typing.Literal;\n return {\n type: $$.constrainedType($(literal).slice($.literal(schema.const))),\n };\n }\n}\n\nfunction baseNode(ctx: NumberResolverContext): PydanticType {\n const { schema } = ctx;\n\n const c = $$.constraints();\n\n if (schema.minimum !== undefined) c.ge(schema.minimum);\n if (schema.exclusiveMinimum !== undefined) c.gt(schema.exclusiveMinimum);\n if (schema.maximum !== undefined) c.le(schema.maximum);\n if (schema.exclusiveMaximum !== undefined) c.lt(schema.exclusiveMaximum);\n if (schema.description !== undefined) c.description(schema.description);\n\n return {\n type: $$.constrainedType(\n schema.type === 'integer' ? 'int' : 'float',\n c.isEmpty ? undefined : c,\n ),\n };\n}\n\nfunction numberResolver(ctx: NumberResolverContext): PydanticType {\n const constResult = ctx.nodes.const(ctx);\n if (constResult) return constResult;\n\n return ctx.nodes.base(ctx);\n}\n\nexport function numberToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'integer' | 'number'>;\n}): PydanticType {\n const ctx: NumberResolverContext = {\n $,\n nodes: {\n base: baseNode,\n const: constNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.number ?? plugin.config['~resolvers']?.number;\n return resolver?.(ctx) ?? numberResolver(ctx);\n}\n","import { childContext } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { ObjectResolverContext } from '../../resolvers';\nimport type { PydanticResult, PydanticType } from '../../shared/types';\n\nexport interface ObjectToFieldsResult extends PydanticType {\n childResults: Array<PydanticResult>;\n}\n\nfunction additionalPropertiesNode(ctx: ObjectResolverContext): PydanticType | null | undefined {\n const { path, plugin, schema } = ctx;\n\n if (!schema.additionalProperties) return;\n if (schema.additionalProperties.type === 'never') return null;\n if (schema.additionalProperties.type === 'unknown') {\n if (ctx.schema.properties) {\n return {\n node: {\n config: { extra: 'allow' },\n fields: fieldsNode(ctx),\n kind: 'model',\n },\n };\n }\n return;\n }\n\n const result = ctx.walk(\n schema.additionalProperties,\n childContext({ path, plugin }, 'additionalProperties'),\n );\n ctx._childResults.push(result);\n\n return { type: result.type };\n}\n\nfunction fieldsNode(ctx: ObjectResolverContext): Array<ReturnType<typeof $$.field>> {\n const { path, plugin, schema } = ctx;\n const fields: Array<ReturnType<typeof $$.field>> = [];\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const isRequired = schema.required?.includes(name) ?? false;\n\n const result = ctx.walk(property, childContext({ path, plugin }, 'properties', name));\n ctx._childResults.push(result);\n\n if (property.description !== undefined && result.type) {\n result.type.mergeConstraints($$.constraints().description(property.description));\n }\n if (property.title !== undefined && result.type) {\n result.type.mergeConstraints($$.constraints().title(property.title));\n }\n\n const isOptional = !isRequired;\n const nullable = result.meta.nullable || isOptional;\n\n const hasSchemaDefault = result.meta.default !== undefined;\n const defaultValue = hasSchemaDefault ? result.meta.default : isOptional ? null : undefined;\n\n const field = $$.field(plugin, name)\n .$if(result.unionMembers, (f, t) => f.type(t))\n .$if(!result.unionMembers && result.type, (f, t) => f.type(t))\n .$if(result.unionMembers && result.type, (f, t) => f.metadata(t))\n .nullable(nullable)\n .$if(defaultValue !== undefined, (f) => f.default(defaultValue))\n .$if(property.deprecated, (f) => f.deprecated(true))\n .$if(result.discriminator, (f, d) => f.discriminator(d));\n\n fields.push(field);\n }\n\n return fields;\n}\n\nfunction baseNode(ctx: ObjectResolverContext): PydanticType {\n const additional = additionalPropertiesNode(ctx);\n\n if (additional === null) {\n return {\n node: {\n config: { extra: 'forbid' },\n fields: fieldsNode(ctx),\n kind: 'model',\n },\n };\n }\n\n if (additional) {\n if (!ctx.schema.properties) {\n const type = $$.constrainedType($('dict').slice('str', additional.type!.type));\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n }\n return {\n node: {\n config: { extra: 'allow' },\n fields: fieldsNode(ctx),\n kind: 'model',\n },\n };\n }\n\n if (ctx.schema.properties) {\n return { node: { fields: fieldsNode(ctx), kind: 'model' } };\n }\n\n return {\n node: { fields: [], kind: 'model' },\n type: $$.constrainedType($('dict').slice('str', ctx.plugin.imports.typing.Any)),\n };\n}\n\nfunction objectResolver(ctx: ObjectResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport function objectToFields(\n ctx: Pick<ObjectResolverContext, 'applyModifiers' | 'path' | 'plugin' | 'schema' | 'walk'>,\n): ObjectToFieldsResult {\n const { applyModifiers, path, plugin, schema, walk } = ctx;\n const childResults: Array<PydanticResult> = [];\n\n const extendedCtx: ObjectResolverContext = {\n $,\n _childResults: childResults,\n applyModifiers,\n nodes: {\n additionalProperties: additionalPropertiesNode,\n base: baseNode,\n fields: fieldsNode,\n },\n path,\n plugin,\n schema,\n walk,\n };\n\n const resolver = plugin.config.$resolvers?.object ?? plugin.config['~resolvers']?.object;\n const resolved = resolver?.(extendedCtx) ?? objectResolver(extendedCtx);\n\n return { childResults, ...resolved };\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { StringResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\nfunction collectConstraints(schema: StringResolverContext['schema']) {\n const c = $$.constraints();\n\n if (schema.minLength !== undefined) c.minLength(schema.minLength);\n if (schema.maxLength !== undefined) c.maxLength(schema.maxLength);\n if (schema.pattern !== undefined) c.pattern(schema.pattern);\n if (schema.description !== undefined) c.description(schema.description);\n\n return c;\n}\n\nfunction constNode(ctx: StringResolverContext): PydanticType | undefined {\n const { plugin, schema } = ctx;\n\n if (typeof schema.const === 'string') {\n const literal = plugin.imports.typing.Literal;\n const c = collectConstraints(schema);\n const type = $$.constrainedType(\n $(literal).slice($.literal(schema.const)),\n c.isEmpty ? undefined : c,\n );\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n }\n}\n\nfunction baseNode(ctx: StringResolverContext): PydanticType {\n const { schema } = ctx;\n\n const c = collectConstraints(schema);\n const type = $$.constrainedType('str', c.isEmpty ? undefined : c);\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n}\n\nfunction formatNode(ctx: StringResolverContext): PydanticType | undefined {\n const { plugin, schema } = ctx;\n\n const c = collectConstraints(schema);\n\n switch (schema.format) {\n case 'binary': {\n const type = $$.constrainedType('bytes', c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n case 'date': {\n const type = $$.constrainedType(plugin.imports.datetime.date, c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n case 'date-time': {\n const type = $$.constrainedType(plugin.imports.datetime.datetime, c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n case 'duration': {\n const type = $$.constrainedType(plugin.imports.datetime.timedelta, c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n case 'email': {\n const type = $$.constrainedType(plugin.imports.EmailStr, c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n case 'time': {\n const type = $$.constrainedType(plugin.imports.datetime.time, c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n case 'uri': {\n const type = $$.constrainedType(plugin.imports.AnyUrl, c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n case 'uuid': {\n const type = $$.constrainedType(plugin.imports.uuid.UUID, c.isEmpty ? undefined : c);\n return { node: { kind: 'rootModel', type }, type };\n }\n default:\n return;\n }\n}\n\nfunction stringResolver(ctx: StringResolverContext): PydanticType {\n const constResult = ctx.nodes.const(ctx);\n if (constResult) return constResult;\n\n const formatResult = ctx.nodes.format(ctx);\n if (formatResult) return formatResult;\n\n return ctx.nodes.base(ctx);\n}\n\nexport function stringToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'string'>;\n}): PydanticType {\n const ctx: StringResolverContext = {\n $,\n nodes: {\n base: baseNode,\n const: constNode,\n format: formatNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.string ?? plugin.config['~resolvers']?.string;\n return resolver?.(ctx) ?? stringResolver(ctx);\n}\n","import { childContext } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { TupleResolverContext } from '../../resolvers';\nimport type { PydanticResult, PydanticType } from '../../shared/types';\n\nfunction baseNode(ctx: TupleResolverContext): PydanticType {\n const { applyModifiers, childResults } = ctx;\n\n const itemTypes = childResults\n .map((r) => applyModifiers(r).type)\n .filter((t) => t !== undefined)\n .map((t) => t!.type);\n\n return { type: $$.constrainedType($.type.tuple(...itemTypes)) };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction constNode(_ctx: TupleResolverContext): PydanticType | undefined {\n return;\n}\n\nfunction tupleResolver(ctx: TupleResolverContext): PydanticType {\n const baseResult = ctx.nodes.base(ctx);\n\n if (ctx.schema.description !== undefined && baseResult.type) {\n return {\n ...baseResult,\n type: baseResult.type.mergeConstraints($$.constraints().description(ctx.schema.description)),\n };\n }\n\n return baseResult;\n}\n\nexport interface TupleToTypeResult extends PydanticType {\n childResults: Array<PydanticResult>;\n}\n\nexport function tupleToType(\n ctx: Pick<TupleResolverContext, 'applyModifiers' | 'path' | 'plugin' | 'schema' | 'walk'>,\n): TupleToTypeResult {\n const { applyModifiers, path, plugin, schema, walk } = ctx;\n\n const childResults: Array<PydanticResult> = [];\n\n if (schema.items && schema.items.length) {\n for (let i = 0; i < schema.items.length; i++) {\n const item = schema.items[i]!;\n const result = walk(item, childContext({ path, plugin }, 'items', i));\n childResults.push(result);\n }\n }\n\n const resolverCtx: TupleResolverContext = {\n $,\n applyModifiers,\n childResults,\n nodes: {\n base: baseNode,\n const: constNode,\n },\n path,\n plugin,\n schema,\n walk,\n };\n\n const resolver = plugin.config.$resolvers?.tuple ?? plugin.config['~resolvers']?.tuple;\n const resolved = resolver?.(resolverCtx) ?? tupleResolver(resolverCtx);\n\n return {\n ...resolved,\n childResults,\n };\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { UndefinedResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction baseNode(_ctx: UndefinedResolverContext): PydanticType {\n const type = $$.constrainedType('None');\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n}\n\nfunction undefinedResolver(ctx: UndefinedResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport function undefinedToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'undefined'>;\n}): PydanticType {\n const ctx: UndefinedResolverContext = {\n $,\n nodes: {\n base: baseNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.undefined ?? plugin.config['~resolvers']?.undefined;\n return resolver?.(ctx) ?? undefinedResolver(ctx);\n}\n","import { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { UnionResolverContext } from '../../resolvers';\nimport type { PydanticResult, PydanticType } from '../../shared/types';\n\nfunction baseNode(ctx: UnionResolverContext): PydanticType {\n const { applyModifiers, childResults } = ctx;\n\n const nonNullResults: Array<PydanticResult> = [];\n let isNullable = false;\n\n for (const result of childResults) {\n if (result.type?.type === 'None') {\n isNullable = true;\n } else {\n nonNullResults.push(result);\n }\n }\n\n isNullable = isNullable || childResults.some((r) => r.meta.nullable);\n\n if (!nonNullResults.length) {\n return { type: $$.constrainedType('None') };\n }\n\n if (nonNullResults.length === 1 && !isNullable) {\n return applyModifiers(nonNullResults[0]!);\n }\n\n const nonNullMembers = nonNullResults.map(\n (r) => applyModifiers(r).type ?? $$.constrainedType(ctx.plugin.imports.typing.Any),\n );\n\n const unionMembers = nonNullMembers;\n const unionType = $$.constrainedType($.type.or(...unionMembers.map((m) => m.type)));\n\n const discriminator =\n ctx.parentSchema.discriminator?.propertyName ??\n (nonNullResults.length === 1 ? nonNullResults[0]!.discriminator : undefined);\n\n return {\n node: { kind: 'rootModel', type: unionType },\n type: unionType,\n unionMembers,\n ...(discriminator && { discriminator }),\n };\n}\n\nfunction unionResolver(ctx: UnionResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport interface UnionToTypeResult extends PydanticType {\n childResults: Array<PydanticResult>;\n isNullable: boolean;\n}\n\nexport function unionToType({\n applyModifiers,\n childResults,\n parentSchema,\n path,\n plugin,\n schemas,\n}: Pick<\n UnionResolverContext,\n 'applyModifiers' | 'childResults' | 'parentSchema' | 'path' | 'plugin' | 'schemas'\n>): UnionToTypeResult {\n let isNullable = false;\n for (const result of childResults) {\n if (result.type?.type === 'None') {\n isNullable = true;\n break;\n }\n }\n isNullable = isNullable || childResults.some((r) => r.meta.nullable);\n\n const resolverCtx: UnionResolverContext = {\n $,\n applyModifiers,\n childResults,\n nodes: {\n base: baseNode,\n },\n parentSchema,\n path,\n plugin,\n schema: parentSchema,\n schemas,\n };\n\n const resolver = plugin.config.$resolvers?.union ?? plugin.config['~resolvers']?.union;\n let resolved = resolver?.(resolverCtx) ?? unionResolver(resolverCtx);\n\n if (parentSchema.description !== undefined) {\n const c = $$.constraints().description(parentSchema.description);\n const base = resolved.type ?? $$.constrainedType('None');\n resolved = { ...resolved, type: base.mergeConstraints(c) };\n }\n\n return {\n ...resolved,\n childResults,\n isNullable,\n };\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { UnknownResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\nfunction baseNode(ctx: UnknownResolverContext): PydanticType {\n const { plugin } = ctx;\n const type = $$.constrainedType(plugin.imports.typing.Any);\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n}\n\nfunction unknownResolver(ctx: UnknownResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport function unknownToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'unknown'>;\n}): PydanticType {\n const ctx: UnknownResolverContext = {\n $,\n nodes: {\n base: baseNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.unknown ?? plugin.config['~resolvers']?.unknown;\n return resolver?.(ctx) ?? unknownResolver(ctx);\n}\n","import type { SchemaVisitorContext, SchemaWithType } from '@hey-api/shared';\n\nimport { $ } from '../../../../py-dsl';\nimport { $ as $$ } from '../../dsl';\nimport type { VoidResolverContext } from '../../resolvers';\nimport type { PydanticType } from '../../shared/types';\nimport type { PydanticPlugin } from '../../types';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction baseNode(_ctx: VoidResolverContext): PydanticType {\n const type = $$.constrainedType('None');\n return {\n node: { kind: 'rootModel', type },\n type,\n };\n}\n\nfunction voidResolver(ctx: VoidResolverContext): PydanticType {\n return ctx.nodes.base(ctx);\n}\n\nexport function voidToType({\n path,\n plugin,\n schema,\n}: SchemaVisitorContext<PydanticPlugin['Instance']> & {\n schema: SchemaWithType<'void'>;\n}): PydanticType {\n const ctx: VoidResolverContext = {\n $,\n nodes: {\n base: baseNode,\n },\n path,\n plugin,\n schema,\n };\n\n const resolver = plugin.config.$resolvers?.void ?? plugin.config['~resolvers']?.void;\n return resolver?.(ctx) ?? voidResolver(ctx);\n}\n","import type { SymbolMeta } from '@hey-api/codegen-core';\nimport { fromRef } from '@hey-api/codegen-core';\nimport type { SchemaExtractor, SchemaVisitor } from '@hey-api/shared';\nimport { pathToJsonPointer } from '@hey-api/shared';\n\nimport { $ } from '../../pydantic/dsl';\nimport { composeMeta, defaultMeta, inheritMeta } from '../shared/meta';\nimport type { ProcessorContext } from '../shared/processor';\nimport type { PydanticResult } from '../shared/types';\nimport type { PydanticPlugin } from '../types';\nimport { arrayToType } from './toAst/array';\nimport { booleanToType } from './toAst/boolean';\nimport { enumToType } from './toAst/enum';\nimport { intersectionToType } from './toAst/intersection';\nimport { neverToType } from './toAst/never';\nimport { nullToType } from './toAst/null';\nimport { numberToType } from './toAst/number';\nimport { objectToFields } from './toAst/object';\nimport { stringToType } from './toAst/string';\nimport { tupleToType } from './toAst/tuple';\nimport { undefinedToType } from './toAst/undefined';\nimport { unionToType } from './toAst/union';\nimport { unknownToType } from './toAst/unknown';\nimport { voidToType } from './toAst/void';\n\nexport interface VisitorConfig {\n /** The plugin instance. */\n plugin: PydanticPlugin['Instance'];\n /** Optional schema extractor function. */\n schemaExtractor?: SchemaExtractor<ProcessorContext>;\n}\n\nexport function createVisitor(\n config: VisitorConfig,\n): SchemaVisitor<PydanticResult, PydanticPlugin['Instance']> {\n const { plugin, schemaExtractor } = config;\n\n return {\n applyModifiers(result): PydanticResult {\n return result;\n },\n array(schema, ctx, walk) {\n const result = arrayToType({\n applyModifiers: (result, opts) => this.applyModifiers(result, ctx, opts) as PydanticResult,\n path: ctx.path,\n plugin,\n schema,\n walk,\n });\n\n return {\n ...result,\n meta: composeMeta(result.childResults, { ...defaultMeta(schema) }),\n };\n },\n boolean(schema, ctx) {\n const result = booleanToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: defaultMeta(schema),\n };\n },\n enum(schema, ctx) {\n const result = enumToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: {\n ...defaultMeta(schema),\n nullable: result.isNullable,\n },\n node: result.enumMembers.length ? { kind: 'enum', members: result.enumMembers } : undefined,\n };\n },\n integer(schema, ctx) {\n const result = numberToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: defaultMeta(schema),\n };\n },\n intercept(schema, ctx, walk) {\n if (schemaExtractor && !schema.$ref) {\n const extracted = schemaExtractor({\n meta: { resource: 'definition', resourceId: pathToJsonPointer(fromRef(ctx.path)) },\n naming: plugin.config.definitions,\n path: fromRef(ctx.path),\n plugin,\n schema,\n });\n if (extracted !== schema) return walk(extracted, ctx);\n }\n },\n intersection(items, schemas, parentSchema, ctx) {\n const result = intersectionToType({\n applyModifiers: (result, opts) => this.applyModifiers(result, ctx, opts) as PydanticResult,\n childResults: items,\n parentSchema,\n path: ctx.path,\n plugin,\n });\n\n return {\n ...result,\n meta: composeMeta(items, { default: parentSchema.default }),\n };\n },\n never(schema, ctx) {\n const result = neverToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: {\n ...defaultMeta(schema),\n nullable: false,\n readonly: false,\n },\n };\n },\n null(schema, ctx) {\n const result = nullToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: {\n ...defaultMeta(schema),\n nullable: true,\n readonly: false,\n },\n };\n },\n number(schema, ctx) {\n const result = numberToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: defaultMeta(schema),\n };\n },\n object(schema, ctx, walk) {\n const result = objectToFields({\n applyModifiers: (result, opts) => this.applyModifiers(result, ctx, opts) as PydanticResult,\n path: ctx.path,\n plugin,\n schema,\n walk,\n });\n\n return {\n ...result,\n meta: inheritMeta(schema, result.childResults),\n };\n },\n postProcess(result) {\n return result;\n },\n reference($ref, schema) {\n const query: SymbolMeta = {\n artifact: 'pydantic',\n category: 'schema',\n resource: 'definition',\n resourceId: $ref,\n };\n // TODO: contract (self)\n const refSymbol = plugin.referenceSymbol(query);\n // TODO: contract (self)\n const isRegistered = plugin.isSymbolRegistered(query);\n const type = $.constrainedType(refSymbol);\n\n return {\n meta: {\n ...defaultMeta(schema),\n hasForwardReference: !isRegistered,\n },\n node: { kind: 'rootModel', type },\n type,\n };\n },\n string(schema, ctx) {\n const result = stringToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: defaultMeta(schema),\n };\n },\n tuple(schema, ctx, walk) {\n const result = tupleToType({\n applyModifiers: (result, opts) => this.applyModifiers(result, ctx, opts) as PydanticResult,\n path: ctx.path,\n plugin,\n schema,\n walk,\n });\n\n return {\n ...result,\n meta: composeMeta(result.childResults, { ...defaultMeta(schema) }),\n };\n },\n undefined(schema, ctx) {\n const result = undefinedToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: {\n ...defaultMeta(schema),\n nullable: false,\n readonly: false,\n },\n };\n },\n union(items, schemas, parentSchema, ctx) {\n const result = unionToType({\n applyModifiers: (result, opts) => this.applyModifiers(result, ctx, opts) as PydanticResult,\n childResults: items,\n parentSchema,\n path: ctx.path,\n plugin,\n schemas,\n });\n\n return {\n ...result,\n meta: composeMeta(items, { default: parentSchema.default }),\n };\n },\n unknown(schema, ctx) {\n const result = unknownToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: {\n ...defaultMeta(schema),\n nullable: false,\n readonly: false,\n },\n };\n },\n void(schema, ctx) {\n const result = voidToType({ path: ctx.path, plugin, schema });\n return {\n ...result,\n meta: {\n ...defaultMeta(schema),\n nullable: false,\n readonly: false,\n },\n };\n },\n };\n}\n","import { ref } from '@hey-api/codegen-core';\nimport type { SchemaExtractor } from '@hey-api/shared';\nimport { createSchemaProcessor, createSchemaWalker, pathToJsonPointer } from '@hey-api/shared';\n\nimport { $ } from '../dsl';\nimport { exportAst } from '../shared/export';\nimport type { ProcessorContext, ProcessorResult } from '../shared/processor';\nimport type { PydanticNode, PydanticResult } from '../shared/types';\nimport type { PydanticPlugin } from '../types';\nimport { createVisitor } from './visitor';\n\nfunction toNode(result: PydanticResult, plugin: PydanticPlugin['Instance']): PydanticNode {\n if (result.node) {\n return result.node;\n }\n return { kind: 'alias', type: result.type ?? $.constrainedType(plugin.imports.typing.Any) };\n}\n\nexport function createProcessor(plugin: PydanticPlugin['Instance']): ProcessorResult {\n const processor = createSchemaProcessor();\n\n const extractorHooks = plugin.getHooks(\n (hooks) => hooks.schemas?.shouldExtract,\n (ctx) =>\n ctx.schema.type === 'object' &&\n (ctx.schema.properties !== undefined || !ctx.schema.additionalProperties),\n (ctx) =>\n ctx.schema.type === 'enum' &&\n ctx.schema.items !== undefined &&\n Boolean(ctx.schema.items.length),\n );\n\n const schemaExtractor: SchemaExtractor<ProcessorContext> = (ctx) => {\n if (processor.hasEmitted(ctx.path)) {\n return ctx.schema;\n }\n\n for (const hook of extractorHooks) {\n const result = typeof hook === 'boolean' ? hook : hook(ctx);\n if (result) {\n process({\n namingAnchor: processor.context.anchor,\n tags: processor.context.tags,\n ...ctx,\n });\n return { $ref: pathToJsonPointer(ctx.path) };\n }\n }\n\n return ctx.schema;\n };\n\n function process(ctx: ProcessorContext): PydanticNode | void {\n if (!processor.markEmitted(ctx.path)) return;\n\n const shouldExport = ctx.export !== false;\n\n return processor.withContext({ anchor: ctx.namingAnchor, tags: ctx.tags }, () => {\n const visitor = createVisitor({ plugin, schemaExtractor });\n const walk = createSchemaWalker(visitor);\n\n const result = walk(ctx.schema, {\n path: ref(ctx.path),\n plugin,\n });\n\n const final = visitor.applyModifiers(result, {\n path: ref(ctx.path),\n plugin,\n }) as PydanticResult;\n\n const node = toNode(final, plugin);\n\n if (shouldExport) {\n exportAst({ ...ctx, node, plugin });\n return;\n }\n\n return node;\n });\n }\n\n return { process };\n}\n","import { pathToJsonPointer } from '@hey-api/shared';\n\nimport { irOperationToAst } from '../shared/operation';\nimport { irWebhookToAst } from '../shared/webhook';\nimport type { PydanticPlugin } from '../types';\nimport { createProcessor } from './processor';\n\nexport const handlerV2: PydanticPlugin['Handler'] = ({ plugin }) => {\n const processor = createProcessor(plugin);\n\n plugin.forEach('operation', 'parameter', 'requestBody', 'schema', 'webhook', (event) => {\n switch (event.type) {\n case 'operation':\n irOperationToAst({\n operation: event.operation,\n path: event._path,\n plugin,\n processor,\n tags: event.tags,\n });\n break;\n case 'parameter':\n processor.process({\n meta: {\n resource: 'definition',\n resourceId: pathToJsonPointer(event._path),\n },\n naming: plugin.config.definitions,\n path: event._path,\n plugin,\n schema: event.parameter.schema,\n tags: event.tags,\n });\n break;\n case 'requestBody':\n processor.process({\n meta: {\n resource: 'definition',\n resourceId: pathToJsonPointer(event._path),\n },\n naming: plugin.config.definitions,\n path: event._path,\n plugin,\n schema: event.requestBody.schema,\n tags: event.tags,\n });\n break;\n case 'schema':\n processor.process({\n meta: {\n resource: 'definition',\n resourceId: pathToJsonPointer(event._path),\n },\n naming: plugin.config.definitions,\n path: event._path,\n plugin,\n schema: event.schema,\n tags: event.tags,\n });\n break;\n case 'webhook':\n irWebhookToAst({\n operation: event.operation,\n path: event._path,\n plugin,\n processor,\n tags: event.tags,\n });\n break;\n }\n });\n};\n","import type { PydanticPlugin } from './types';\nimport { handlerV2 } from './v2/plugin';\n\nexport const handler: PydanticPlugin['Handler'] = (args) => handlerV2(args);\n","import { definePluginConfig } from '@hey-api/shared';\n\nimport { pydanticImports } from './imports';\nimport { handler } from './plugin';\nimport type { PydanticPlugin } from './types';\n\nexport const defaultConfig: PydanticPlugin['Config'] = {\n config: {\n $cascade: ['case'],\n case: 'PascalCase',\n comments: true,\n definitions: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n enabled: true,\n name: '{{name}}',\n },\n enums: 'enum',\n fieldStyle: 'field',\n includeInEntry: false,\n modelType: 'BaseModel',\n requests: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n body: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n enabled: true,\n name: '{{name}}Body',\n },\n enabled: true,\n headers: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n enabled: true,\n name: '{{name}}Headers',\n },\n name: '{{name}}Request',\n path: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n enabled: true,\n name: '{{name}}Path',\n },\n query: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n enabled: true,\n name: '{{name}}Query',\n },\n },\n responses: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n enabled: true,\n name: '{{name}}Response',\n },\n strict: false,\n webhooks: {\n $coerceAny: ({ type, value }) => ({\n enabled: Boolean(value),\n ...(type === 'string' || type === 'function' ? { name: value } : {}),\n }),\n enabled: true,\n name: '{{name}}Webhook',\n },\n },\n handler,\n imports: pydanticImports,\n name: 'pydantic',\n symbolMeta() {\n return {\n artifact: 'pydantic',\n };\n },\n tags: ['validator'],\n};\n\n/**\n * Type helper for Pydantic plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import type { Plugin, PluginConfigMap, PluginNames } from '@hey-api/shared';\n\nimport { defaultConfig as heyApiClientAiohttp } from './@hey-api/client-aiohttp';\nimport { defaultConfig as heyApiClientHttpx } from './@hey-api/client-httpx';\nimport { defaultConfig as heyApiClientRequests } from './@hey-api/client-requests';\nimport { defaultConfig as heyApiClientUrllib3 } from './@hey-api/client-urllib3';\nimport { defaultConfig as heyApiSdk } from './@hey-api/sdk';\nimport { defaultConfig as pydantic } from './pydantic';\n\n/**\n * Default plugins used to generate artifacts if plugins aren't specified.\n */\nexport const defaultPlugins = ['@hey-api/python-sdk'] as const satisfies ReadonlyArray<PluginNames>;\n\nexport const defaultPluginConfigs: {\n [K in PluginNames]: Plugin.Config<PluginConfigMap[K]>;\n} = {\n '@hey-api/client-aiohttp': heyApiClientAiohttp,\n '@hey-api/client-httpx': heyApiClientHttpx,\n '@hey-api/client-requests': heyApiClientRequests,\n '@hey-api/client-urllib3': heyApiClientUrllib3,\n '@hey-api/python-sdk': heyApiSdk,\n pydantic,\n};\n","import type { PostProcessor } from '@hey-api/shared';\n\nexport const postProcessors = {\n autopep8: {\n args: ['--in-place', '{{path}}'],\n command: 'autopep8',\n name: 'autopep8',\n },\n black: {\n args: ['{{path}}'],\n command: 'black',\n name: 'Black',\n },\n isort: {\n args: ['{{path}}'],\n command: 'isort',\n name: 'isort',\n },\n 'ruff:format': {\n args: ['format', '{{path}}'],\n command: 'ruff',\n name: 'Ruff (Format)',\n },\n 'ruff:lint': {\n args: ['check', '--fix', '{{path}}'],\n command: 'ruff',\n name: 'Ruff (Lint)',\n },\n yapf: {\n args: ['-i', '{{path}}'],\n command: 'yapf',\n name: 'YAPF',\n },\n} as const satisfies Record<string, PostProcessor>;\n\nexport type PostProcessorPreset = keyof typeof postProcessors;\n","import path from 'node:path';\n\nimport type { PostProcessor } from '@hey-api/shared';\nimport { coerce, defineConfig, sourceConfig } from '@hey-api/shared';\nimport type { MaybeArray } from '@hey-api/types';\n\nimport { postProcessors } from './postprocess';\nimport type { Output, UserOutput } from './types';\n\nfunction normalizePostProcessItem(\n item: NonNullable<UserOutput['postProcess']>[number],\n): PostProcessor {\n if (typeof item === 'string') {\n const preset = postProcessors[item];\n if (!preset) {\n throw new Error(`Unknown post-processor preset: \"${item}\"`);\n }\n return preset;\n }\n return {\n name: item.name ?? item.command,\n ...item,\n };\n}\n\nexport const outputConfig = defineConfig<UserOutput, Output>({\n $finalize(config) {\n if (config.module.extension && !config.module.extension.startsWith('.')) {\n config.module.extension = `.${config.module.extension}`;\n }\n config.path = path.resolve(process.cwd(), config.path);\n },\n clean: true,\n entryFile: true,\n fileName: {\n $coerce: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n case: 'preserve',\n name: '{{name}}',\n suffix: '_gen',\n },\n module: {},\n path: '',\n postProcess: coerce((value) => (Array.isArray(value) ? value.map(normalizePostProcessItem) : [])),\n preferExportAll: false,\n pythonVersion: '3.9',\n source: sourceConfig,\n});\n\nexport function getOutput(input: { output: MaybeArray<string | UserOutput> }): Output {\n if (Array.isArray(input.output)) {\n throw new Error(\n 'Unexpected array of outputs in user configuration. This should have been expanded already.',\n );\n }\n\n const output = input.output as string | UserOutput;\n const userOutput = typeof output === 'string' ? { path: output } : output;\n\n return outputConfig(userOutput);\n}\n","import { detectInteractiveSession } from '@hey-api/codegen-core';\nimport { ConfigError, getInput, getLogs, getParser, resolvePlugins } from '@hey-api/shared';\nimport colors from 'ansi-colors';\n\nimport { defaultPluginConfigs, defaultPlugins } from '../plugins/config';\nimport { getOutput } from './output/config';\nimport type { Config } from './types';\nimport type { ValidationResult } from './validate';\n\nexport type ResolvedJob = {\n config: Config;\n errors: Array<Error>;\n index: number;\n};\n\nexport function resolveConfig(\n validated: ValidationResult,\n dependencies: Record<string, string>,\n): ResolvedJob {\n const logs = getLogs(validated.job.config.logs);\n const input = getInput(validated.job.config);\n const output = getOutput(validated.job.config);\n const parser = getParser(validated.job.config);\n\n let plugins: Pick<Config, 'plugins' | 'pluginOrder'>;\n\n try {\n plugins = resolvePlugins({\n defaultPluginConfigs,\n defaultPlugins,\n dependencies,\n userConfig: validated.job.config,\n });\n } catch (error) {\n if (error instanceof ConfigError) {\n validated.errors.push(error);\n }\n plugins = {\n pluginOrder: [],\n plugins: {},\n };\n }\n\n const config: Config = {\n configFile: validated.job.config.configFile ?? '',\n dryRun: validated.job.config.dryRun ?? false,\n input,\n interactive: validated.job.config.interactive ?? detectInteractiveSession(),\n logs,\n output,\n parser,\n pluginOrder: plugins.pluginOrder,\n plugins: plugins.plugins,\n presets: validated.job.config.presets ?? [],\n };\n\n if (logs.level === 'debug') {\n const jobPrefix = colors.gray(`[Job ${validated.job.index}] `);\n console.warn(`${jobPrefix}${colors.cyan('config:')}`, config);\n }\n\n return {\n config,\n errors: validated.errors,\n index: validated.job.index,\n };\n}\n","import { ConfigError, getInput } from '@hey-api/shared';\n\nimport type { Job } from './expand';\nimport { getOutput } from './output/config';\n\nexport type ValidationResult = {\n errors: Array<ConfigError>;\n job: Job;\n};\n\nexport function validateJobs(jobs: ReadonlyArray<Job>): ReadonlyArray<ValidationResult> {\n return jobs.map((job) => {\n const errors: Array<ConfigError> = [];\n const { config } = job;\n\n const inputs = getInput(config);\n if (!inputs.length) {\n errors.push(\n new ConfigError(\n 'missing input - which OpenAPI specification should we use to generate your output?',\n ),\n );\n }\n\n const output = getOutput(config);\n if (!output.path) {\n errors.push(new ConfigError('missing output - where should we generate your output?'));\n }\n\n return { errors, job };\n });\n}\n","import type { Logger } from '@hey-api/codegen-core';\nimport { loadConfigFile } from '@hey-api/codegen-core';\n\nimport { expandToJobs } from './expand';\n// import { getProjectDependencies } from './packages';\nimport type { ResolvedJob } from './resolve';\nimport { resolveConfig } from './resolve';\nimport type { UserConfig } from './types';\nimport { validateJobs } from './validate';\n\nexport type Configs = {\n dependencies: Record<string, string>;\n jobs: ReadonlyArray<ResolvedJob>;\n};\n\n/**\n * @internal\n */\nexport async function resolveJobs({\n logger,\n userConfigs,\n}: {\n logger: Logger;\n userConfigs: ReadonlyArray<UserConfig>;\n}): Promise<Configs> {\n const configs: Array<UserConfig> = [];\n const dependencies: Record<string, string> = {};\n // let dependencies: Record<string, string> = {};\n\n const eventLoad = logger.timeEvent('load');\n for (const userConfig of userConfigs) {\n let configFile: string | undefined;\n if (userConfig.configFile) {\n const parts = userConfig.configFile.split('.');\n configFile = parts.slice(0, parts.length - 1).join('.');\n }\n\n const loaded = await loadConfigFile<UserConfig>({\n configFile,\n logger,\n name: 'openapi-python',\n userConfig,\n });\n\n if (!Object.keys(dependencies).length) {\n // TODO: handle dependencies for multiple configs properly?\n // TODO: collect Python dependencies\n // dependencies = getProjectDependencies(\n // loaded.foundConfig ? loaded.configFile : undefined,\n // );\n }\n\n configs.push(...loaded.configs);\n }\n eventLoad.timeEnd();\n\n const eventBuild = logger.timeEvent('build');\n const jobs = validateJobs(expandToJobs(configs));\n const resolvedJobs = jobs.map((validated) => resolveConfig(validated, dependencies));\n eventBuild.timeEnd();\n\n return {\n dependencies,\n jobs: resolvedJobs,\n };\n}\n","import fsPromises from 'node:fs/promises';\nimport path from 'node:path';\n\nimport type { Context } from '@hey-api/shared';\nimport { IntentContext } from '@hey-api/shared';\n\nimport { getTypedConfig } from '../config/utils';\nimport { getClientPlugin } from '../plugins/@hey-api/client-core/utils';\nimport { generateClientBundle } from './client';\n\nexport async function generateOutput(context: Context): Promise<{ fileCount: number }> {\n const outputPath = path.resolve(context.config.output.path);\n\n if (context.config.output.clean) {\n if (\n await fsPromises\n .access(outputPath)\n .then(() => true)\n .catch(() => false)\n ) {\n await fsPromises.rm(outputPath, { force: true, recursive: true });\n }\n }\n\n const config = getTypedConfig(context);\n\n const client = getClientPlugin(config);\n if ('bundle' in client.config && client.config.bundle && !config.dryRun) {\n // not proud of this one\n // @ts-expect-error\n config._FRAGILE_CLIENT_BUNDLE_RENAMED = generateClientBundle({\n header: config.output.header,\n outputPath,\n // @ts-expect-error\n plugin: client,\n project: context.gen,\n });\n }\n\n for (const plugin of context.registerPlugins()) {\n await plugin.run();\n }\n\n context.gen.plan();\n\n const ctx = new IntentContext(context.spec);\n for (const intent of context.intents) {\n await intent.run(ctx);\n }\n\n let fileCount = 0;\n const writes: Promise<void>[] = [];\n for (const file of context.gen.render()) {\n const filePath = path.resolve(outputPath, file.path);\n const dir = path.dirname(filePath);\n if (!context.config.dryRun) {\n writes.push(\n fsPromises\n .mkdir(dir, { recursive: true })\n .then(() => fsPromises.writeFile(filePath, file.content, { encoding: 'utf8' })),\n );\n }\n fileCount++;\n }\n await Promise.all(writes);\n\n const { source } = context.config.output;\n if (source.enabled) {\n const sourcePath = source.path === null ? undefined : path.resolve(outputPath, source.path);\n if (!context.config.dryRun && sourcePath && sourcePath !== outputPath) {\n await fsPromises.mkdir(sourcePath, { recursive: true });\n }\n const serialized = await source.serialize(context.spec);\n // TODO: handle yaml (convert before writing)\n if (!context.config.dryRun && sourcePath) {\n await fsPromises.writeFile(\n path.resolve(sourcePath, `${source.fileName}.${source.extension}`),\n serialized,\n { encoding: 'utf8' },\n );\n fileCount++;\n }\n if (source.callback) {\n await source.callback(serialized);\n }\n }\n\n return { fileCount };\n}\n","import path from 'node:path';\n\nimport { type Logger, Project, Version } from '@hey-api/codegen-core';\nimport { $RefParser, ResolverError } from '@hey-api/json-schema-ref-parser';\nimport type { Input, OpenApi, WatchValues } from '@hey-api/shared';\nimport {\n applyNaming,\n buildGraph,\n compileInputPath,\n Context,\n getSpec,\n InputError,\n logInputPaths,\n parseOpenApiSpec,\n patchOpenApiSpec,\n postprocessOutput,\n SymbolFactory,\n} from '@hey-api/shared';\nimport { format as ms } from '@lukeed/ms';\nimport colors from 'ansi-colors';\n\nimport { postProcessors } from './config/output/postprocess';\nimport type { Config } from './config/types';\nimport { generateOutput } from './generate/output';\nimport { PythonRenderer } from './py-dsl';\nimport { ENUM, TYPING } from './symbols';\n\nexport async function createClient({\n config,\n dependencies,\n jobIndex,\n logger,\n watches: _watches,\n}: {\n config: Config;\n dependencies: Record<string, string>;\n jobIndex: number;\n logger: Logger;\n /**\n * Always undefined on the first run, defined on subsequent runs.\n */\n watches?: ReadonlyArray<WatchValues>;\n}): Promise<Context | undefined> {\n const watches: ReadonlyArray<WatchValues> =\n _watches ||\n Array.from({ length: config.input.length }, () => ({\n headers: new Headers(),\n }));\n\n const jobStart = Date.now();\n const inputPaths = config.input.map((input) => compileInputPath(input));\n\n // on first run, print the message as soon as possible\n if (!_watches) {\n logInputPaths(inputPaths, jobIndex, config.logs.level);\n }\n\n const getSpecData = async (input: Input, index: number) => {\n const eventSpec = logger.timeEvent('spec');\n const { arrayBuffer, error, resolvedInput, response } = await getSpec({\n fetchOptions: input.fetch,\n inputPath: inputPaths[index]!.path,\n timeout: input.watch.timeout,\n watch: watches[index]!,\n });\n eventSpec.timeEnd();\n\n // throw on first run if there's an error to preserve user experience\n // if in watch mode, subsequent errors won't throw to gracefully handle\n // cases where server might be reloading\n if (error && !_watches) {\n const text = await response.text().catch((): string => '');\n const message = `Request failed with status ${response.status}: ${text || response.statusText}`;\n // Handle 4xx client errors as input errors (bad URL, bad API key, etc.)\n if (response.status >= 400 && response.status < 500) {\n const statusText = response.statusText || 'Unknown';\n const originalError = new Error(message) as Error & { source?: string };\n originalError.source = String(inputPaths[index]!.path);\n throw new InputError(\n `Input request failed: ${response.status} ${statusText}`,\n originalError,\n );\n }\n // For 5xx server errors, keep the generic error (could be a bug)\n throw new Error(message);\n }\n\n return { arrayBuffer, resolvedInput };\n };\n const specData = (\n await Promise.all(config.input.map((input, index) => getSpecData(input, index)))\n ).filter((data) => data.arrayBuffer || data.resolvedInput);\n\n let context: Context | undefined;\n\n if (specData.length) {\n const refParser = new $RefParser();\n let data: unknown;\n try {\n data =\n specData.length > 1\n ? await refParser.bundleMany({\n arrayBuffer: specData.map((data) => data.arrayBuffer!),\n pathOrUrlOrSchemas: [],\n resolvedInputs: specData.map((data) => data.resolvedInput!),\n })\n : await refParser.bundle({\n arrayBuffer: specData[0]!.arrayBuffer,\n pathOrUrlOrSchema: undefined,\n resolvedInput: specData[0]!.resolvedInput!,\n });\n } catch (err) {\n if (err instanceof ResolverError && err.ioErrorCode === 'ENOENT') {\n throw new InputError('Input file not found', err);\n }\n throw err;\n }\n\n // on subsequent runs in watch mode, print the message only if we know we're\n // generating the output\n if (_watches) {\n console.clear();\n logInputPaths(inputPaths, jobIndex, config.logs.level);\n }\n\n const eventInputPatch = logger.timeEvent('input.patch');\n await patchOpenApiSpec({ patchOptions: config.parser.patch, spec: data });\n eventInputPatch.timeEnd();\n\n const eventParser = logger.timeEvent('parser');\n const header = config.output.header;\n // TODO: allow overriding via config\n const project = new Project({\n defaultFileName: '__init__',\n fileName: (base) => {\n const name = applyNaming(base, config.output.fileName);\n const { suffix } = config.output.fileName;\n if (!suffix) {\n return name;\n }\n return name === '__init__' || name.endsWith(suffix) ? name : `${name}${suffix}`;\n },\n nameConflictResolvers: config.output.nameConflictResolver\n ? {\n python: config.output.nameConflictResolver,\n }\n : undefined,\n renderers: [\n new PythonRenderer({\n header: (ctx) => {\n const defaultValue = ['# This file is auto-generated by @hey-api/openapi-python'];\n const result = typeof header === 'function' ? header({ ...ctx, defaultValue }) : header;\n return result === undefined ? defaultValue : result;\n },\n module: config.output.module,\n preferExportAll: config.output.preferExportAll,\n }),\n ],\n root: config.output.path,\n });\n context = new Context<OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X, Config>({\n config,\n dependencies,\n logger,\n project,\n spec: data as OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X,\n });\n const symbolFactory = new SymbolFactory({\n eventHooks: SymbolFactory.buildEventHooks([context.config.parser.hooks.events]),\n project,\n });\n project.meta.python = {\n Version: new Version(config.output.pythonVersion),\n symbols: {\n enum: ENUM(symbolFactory),\n typing: TYPING(symbolFactory),\n },\n version: config.output.pythonVersion,\n };\n parseOpenApiSpec(context);\n context.graph = buildGraph(context.ir, logger).graph;\n eventParser.timeEnd();\n\n const eventGenerator = logger.timeEvent('generator');\n const { fileCount } = await generateOutput(context);\n eventGenerator.timeEnd();\n\n const totalMs = Date.now() - jobStart;\n\n const eventPostprocess = logger.timeEvent('postprocess');\n if (!config.dryRun) {\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n postprocessOutput(config.output, postProcessors, jobPrefix);\n\n if (config.logs.level !== 'silent') {\n const outputPath = process.env.INIT_CWD\n ? `./${path.relative(process.env.INIT_CWD, config.output.path)}`\n : config.output.path;\n console.log(\n `${jobPrefix}${colors.green('✓')} ${colors.cyanBright(outputPath)} ${colors.gray(`· ${fileCount} ${fileCount === 1 ? 'file' : 'files'} · ${ms(totalMs)}`)}`,\n );\n }\n }\n eventPostprocess.timeEnd();\n }\n\n const watchedInput = config.input.find(\n (input, index) => input.watch.enabled && typeof inputPaths[index]!.path === 'string',\n );\n\n if (watchedInput) {\n setTimeout(() => {\n createClient({\n config,\n dependencies,\n jobIndex,\n logger,\n watches,\n });\n }, watchedInput.watch.interval);\n }\n\n return context;\n}\n","import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { Logger } from '@hey-api/codegen-core';\nimport type { Context } from '@hey-api/shared';\nimport {\n checkNodeVersion,\n ConfigValidationError,\n getInputError,\n getLogs,\n JobError,\n logCrashReport,\n openGitHubIssueWithCrashReport,\n printCliIntro,\n printCrashReport,\n shouldReportCrash,\n} from '@hey-api/shared';\nimport type { LazyOrAsync, MaybeArray } from '@hey-api/types';\n\nimport type { Configs } from './config/init';\nimport { resolveJobs } from './config/init';\nimport type { UserConfig } from './config/types';\nimport { createClient as pCreateClient } from './create-client';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n/**\n * Generate a client from the provided configuration.\n *\n * @param userConfig User provided {@link UserConfig} configuration(s).\n */\nexport async function createClient(\n userConfig?: LazyOrAsync<MaybeArray<UserConfig>>,\n logger = new Logger(),\n): Promise<ReadonlyArray<Context>> {\n const resolvedConfig = typeof userConfig === 'function' ? await userConfig() : userConfig;\n const userConfigs = resolvedConfig\n ? resolvedConfig instanceof Array\n ? resolvedConfig\n : [resolvedConfig]\n : [];\n\n let rawLogs = userConfigs.find((config) => getLogs(config.logs).level !== 'silent')?.logs;\n if (typeof rawLogs === 'string') {\n rawLogs = getLogs(rawLogs);\n }\n\n let jobs: Configs['jobs'] = [];\n\n try {\n checkNodeVersion();\n\n const eventCreateClient = logger.timeEvent('createClient');\n\n const eventConfig = logger.timeEvent('config');\n const resolved = await resolveJobs({ logger, userConfigs });\n const dependencies = resolved.dependencies;\n jobs = resolved.jobs;\n const printIntro = jobs.some((job) => job.config.logs.level !== 'silent');\n if (printIntro) printCliIntro(__dirname);\n eventConfig.timeEnd();\n\n const configErrors = jobs.flatMap((job) =>\n job.errors.map((error) => ({ error, jobIndex: job.index })),\n );\n if (configErrors.length) {\n throw new ConfigValidationError(configErrors);\n }\n\n const outputs = await Promise.all(\n jobs.map(async (job) => {\n try {\n return await pCreateClient({\n config: job.config,\n dependencies,\n jobIndex: job.index,\n logger,\n });\n } catch (error) {\n if (error instanceof Error) {\n throw new JobError('', {\n error,\n jobIndex: job.index,\n });\n }\n }\n }),\n );\n const contexts = outputs.filter((ctx): ctx is Context => ctx !== undefined);\n\n eventCreateClient.timeEnd();\n\n logger.report(jobs.some((job) => job.config.logs.level === 'debug'));\n\n return contexts;\n } catch (error) {\n const logs =\n jobs.find((job) => job.config.logs.level !== 'silent')?.config.logs ??\n jobs[0]?.config.logs ??\n rawLogs;\n const dryRun =\n jobs.some((job) => job.config.dryRun) ?? userConfigs.some((config) => config.dryRun) ?? false;\n\n const inputError = getInputError(error);\n const normalizedError = inputError ?? error;\n\n const logPath =\n logs?.file && !dryRun ? logCrashReport(normalizedError, logs.path ?? '') : undefined;\n if (!logs || logs.level !== 'silent') {\n printCrashReport({ error, logPath });\n const isInteractive =\n jobs.some((job) => job.config.interactive) ??\n userConfigs.some((config) => config.interactive) ??\n false;\n if (await shouldReportCrash({ error: normalizedError, isInteractive })) {\n await openGitHubIssueWithCrashReport(error, __dirname);\n }\n }\n\n if (inputError) return [];\n\n throw error;\n }\n}\n","/* eslint-disable @typescript-eslint/no-namespace */\n// OVERRIDES\n// hard-coded here because build process doesn't pick up overrides from separate files\nimport '@hey-api/codegen-core';\nimport '@hey-api/shared';\n\ndeclare module '@hey-api/codegen-core' {\n interface ProjectMeta {\n python: {\n Version: Version<PythonVersion>;\n symbols: {\n enum: EnumSymbols;\n typing: TypingSymbols;\n };\n version: PythonVersion;\n };\n }\n\n interface SymbolMeta {\n artifact?: 'pydantic' | 'sdk' | AnyString;\n category?:\n | 'client'\n | 'external'\n | 'hook'\n | 'schema'\n | 'sdk'\n | 'transform'\n | 'type'\n | 'utility'\n | AnyString;\n /** Path to the resource this symbol represents. */\n path?: ReadonlyArray<string | number>;\n /** Name of the plugin that registered this symbol. */\n plugin?: string;\n resource?: 'client' | 'definition' | 'operation' | 'webhook' | AnyString;\n resourceId?: string;\n role?: 'data' | 'error' | 'errors' | 'options' | 'response' | 'responses' | AnyString;\n /** Tags associated with this symbol. */\n tags?: ReadonlyArray<string>;\n variant?: 'container' | AnyString;\n }\n}\n\ndeclare module '@hey-api/shared' {\n interface PluginConfigMap {\n '@hey-api/client-aiohttp': Plugins.HeyApiClientAiohttp.Types['Types'];\n '@hey-api/client-httpx': Plugins.HeyApiClientHttpx.Types['Types'];\n '@hey-api/client-requests': Plugins.HeyApiClientRequests.Types['Types'];\n '@hey-api/client-urllib3': Plugins.HeyApiClientUrllib3.Types['Types'];\n '@hey-api/python-sdk': Plugins.HeyApiSdk.Types['Types'];\n pydantic: Plugins.Pydantic.Types['Types'];\n }\n}\n// END OVERRIDES\n\nimport type { Version } from '@hey-api/codegen-core';\nimport type { AnyString, LazyOrAsync, MaybeArray } from '@hey-api/types';\nimport colors from 'ansi-colors';\n// @ts-expect-error\nimport colorSupport from 'color-support';\n\nimport type { PythonVersion } from './config/output/types';\nimport type { UserConfig } from './config/types';\nimport type { HeyApiClientAiohttpPlugin } from './plugins/@hey-api/client-aiohttp';\nimport type { HeyApiClientHttpxPlugin } from './plugins/@hey-api/client-httpx';\nimport type { HeyApiClientRequestsPlugin } from './plugins/@hey-api/client-requests';\nimport type { HeyApiClientUrllib3Plugin } from './plugins/@hey-api/client-urllib3';\nimport type { HeyApiSdkPlugin } from './plugins/@hey-api/sdk';\nimport type { PydanticPlugin, PydanticResolvers } from './plugins/pydantic';\nimport type { EnumSymbols } from './symbols/enum';\nimport type { TypingSymbols } from './symbols/typing';\n\ncolors.enabled = colorSupport().hasBasic;\n\nexport { createClient } from './generate';\n\n/**\n * Type helper for configuration object, returns {@link MaybeArray<UserConfig>} object(s)\n */\nexport function defineConfig(\n config: LazyOrAsync<ReadonlyArray<UserConfig>>,\n): Promise<ReadonlyArray<UserConfig>>;\nexport function defineConfig(config: LazyOrAsync<UserConfig>): Promise<UserConfig>;\nexport async function defineConfig<T extends MaybeArray<UserConfig>>(\n config: LazyOrAsync<T>,\n): Promise<T> {\n return typeof config === 'function' ? await config() : config;\n}\n\nexport type { UserConfig } from './config/types';\nexport * as plugins from './plugins';\nexport { defaultPlugins } from './plugins/config';\nexport * from './py-dsl';\nexport { Logger } from '@hey-api/codegen-core';\nexport type {\n AnyPluginName,\n Coercer,\n CoercerMap,\n ConfigTable,\n DefinePlugin,\n IR,\n OpenApi,\n OpenApiMetaObject,\n OpenApiOperationObject,\n OpenApiParameterObject,\n OpenApiRequestBodyObject,\n OpenApiResponseObject,\n OpenApiSchemaObject,\n Plugin,\n PluginContext,\n PluginInstance,\n TableDirectives,\n} from '@hey-api/shared';\nexport {\n applyNaming,\n coerce,\n defaultPaginationKeywords,\n defineConfig as defineConfigTable,\n definePluginConfig,\n OperationPath,\n OperationStrategy,\n toCase,\n utils,\n} from '@hey-api/shared';\n\nexport namespace Plugins {\n export namespace HeyApiClientAiohttp {\n export type Types = HeyApiClientAiohttpPlugin;\n }\n\n export namespace HeyApiClientHttpx {\n export type Types = HeyApiClientHttpxPlugin;\n }\n\n export namespace HeyApiClientRequests {\n export type Types = HeyApiClientRequestsPlugin;\n }\n\n export namespace HeyApiClientUrllib3 {\n export type Types = HeyApiClientUrllib3Plugin;\n }\n\n export namespace HeyApiSdk {\n export type Types = HeyApiSdkPlugin;\n }\n\n export namespace Pydantic {\n export type Resolvers = Required<PydanticResolvers>['$resolvers'];\n export type Types = PydanticPlugin;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,SAAgB,aAAa,SAAwD;CACnF,MAAM,OAAmB,CAAC;CAC1B,IAAI,WAAW;CAEf,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,SAAS,SAAS,MAAM;EAC9B,MAAM,UAAU,OAAO,kBAAkB,QAAQ,OAAO,SAAS,CAAC,OAAO,MAAM;EAE/E,IAAI,QAAQ,WAAW,GACrB,KAAK,KAAK;GACR,QAAQ;IACN,GAAG;IACH,OAAO;IACP,QAAQ,QAAQ;GAClB;GACA,OAAO;EACT,CAAC;OACI,IAAI,QAAQ,SAAS,KAAK,OAAO,WAAW,QAAQ,QAAQ;GAEjE,QAAQ,KACN,MAAM,OAAO,OAAO,UAAU,EAAE,gBAAgB,OAAO,KAAK,OAAO,OAAO,MAAM,CAAC,EAAE,GAAG,OAAO,KAAK,OAAO,WAAW,IAAI,UAAU,QAAQ,EAAE,OAAO,OAAO,OAAO,OAAO,QAAQ,MAAM,CAAC,EAAE,GAAG,OAAO,OAAO,SAAS,EAAE,gJACvN;GACA,KAAK,MAAM,UAAU,SACnB,KAAK,KAAK;IACR,QAAQ;KAAE,GAAG;KAAQ,OAAO;KAAQ;IAAO;IAC3C,OAAO;GACT,CAAC;EAEL,OAAO,IAAI,QAAQ,SAAS,GAE1B,QAAQ,SAAS,QAAQ,UAAU;GACjC,KAAK,KAAK;IACR,QAAQ;KAAE,GAAG;KAAQ,OAAO,OAAO;KAAS;IAAO;IACnD,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OAAO;EACL,MAAM,QAAQ,SAAS,QAAQ,EAAE,UAAU,OAAO,CAAC;EACnD,SAAS,QAAQ,SAAS,WAAW,EAAE,UAAU,OAAO,CAAC;EACzD,SAAS,QAAQ,SAAS,WAAW,EAAE,UAAU,OAAO,CAAC;CAC3D;AACF;;;ACNA,SAAgB,WAAW,SAAwB;CACjD,OAAO,EACL,gBAAgB,QAAQ,SAAS,mBAAmB,EAClD,UAAU,YACZ,CAAC,EACH;AACF;;;ACLA,SAAgB,SAAS,SAAwB;CAC/C,MAAM,sBAAsB;EAE1B;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EAEA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;EACA;GACE,MAAM;GACN,MAAM;EACR;CACF;CAEA,OAAO;EACL,QAAQ,QAAQ,SAA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;CACA,WAAA,yBAAA;CACA,WAAA,uBAAA;CACA,WAAA,yBAAA;CACA,WAAA,gBAAA;CACA,WAAA,iBAAA;CACA,WAAA,qBAAA;CACA,WAAA,qBAAA;CACA,WAAA,sBAAA;CACA,WAAA,uBAAA;CACA,WAAA,oBAAA;CACA,WAAA,aAAA;CACA,WAAA,sBAAA;CACA,WAAA,uBAAA;CACA,WAAA,oBAAA;CACA,WAAA,qBAAA;CACA,WAAA,sBAAA;CACA,WAAA,mBAAA;CACA,WAAA,gBAAA;CACA,WAAA,yBAAA;CACA,WAAA,oBAAA;CACA,WAAA,kBAAA;CACA,WAAA,qBAAA;CACA,WAAA,oBAAA;CACA,WAAA,cAAA;CACA,WAAA,mBAAA;CACA,WAAA,qBAAA;CACA,WAAA,yBAAA;;AACF,EAAA,CAAA,CAAA;;;ACrCA,SAAgB,YACd,YACA,iBACA,kBACS;CACT,OAAO;EACL,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACJA,SAAgB,uBACd,MACA,MACA,YACA,aACA,WACA,iBACA,kBACoB;CACpB,OAAO;EACL;EACA,MAAM,YAAY,IAAI;EACtB;EACA;EACA,MAAA;EACA;EACA;EACA;CACF;AACF;;;AChBA,SAAgB,0BACd,MACA,YACA,YACA,MACA,YACA,WACA,WACA,iBACA,kBACuB;CACvB,OAAO;EACL,MAAM,YAAY,IAAI;EACtB;EACA;EACA,MAAA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;AC/BA,SAAgB,wBACd,MACA,MACA,cACA,iBACA,kBACqB;CACrB,OAAO;EACL;EACA,MAAA;EACA;EACA;EACA;EACA;CACF;AACF;;;ACjBA,SAAgB,sBAAsB,YAA6C;CACjF,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACLA,SAAgB,sBAAsB,YAA6C;CACjF,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACuBA,SAAgB,uBACd,MACA,UACA,OACA,iBACA,kBACoB;CACpB,OAAO;EACL,MAAA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;AC1CA,SAAgB,qBACd,QACA,MACA,iBACA,kBACkB;CAClB,OAAO;EACL;EACA;EACA,MAAA;EACA;EACA;CACF;AACF;;;ACbA,SAAgB,wBACd,KACA,OACA,QACA,UACA,KACA,SACqB;CACrB,OAAO;EACL;EACA;EACA;EACA;EACA,MAAA;EACA;EACA;CACF;AACF;;;AClBA,SAAgB,wBACd,SACA,QACA,UACA,KACA,SACqB;CACrB,OAAO;EACL;EACA;EACA;EACA;EACA,MAAA;EACA;CACF;AACF;;;ACfA,SAAgB,uBACd,SACA,QACA,UACA,KACA,SACoB;CACpB,OAAO;EACL;EACA;EACA;EACA;EACA,MAAA;EACA;CACF;AACF;;;ACZA,SAAgB,qBACd,SACkB;CAClB,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACVA,SAAgB,wBACd,OACA,iBACA,kBACqB;CACrB,OAAO;EACL,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACPA,SAAgB,0BACd,SACA,QACA,UACA,KACA,SACA,iBACA,kBACuB;CACvB,OAAO;EACL;EACA;EACA;EACA;EACA,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACxBA,SAAgB,iBACd,MACA,iBACA,kBACc;CACd,OAAO;EACL,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACTA,SAAgB,sBACd,MACA,OACA,iBACA,kBACmB;CACnB,OAAO;EACL,MAAA;EACA;EACA;EACA;EACA;CACF;AACF;;;ACZA,SAAgB,uBACd,YACA,YACoB;CACpB,OAAO;EACL;EACA,MAAA;EACA;CACF;AACF;;;ACZA,SAAgB,qBAAqB,UAAmD;CACtF,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACHA,SAAgB,cACd,OACA,iBACA,kBACW;CACX,OAAO;EACL,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACVA,SAAgB,uBACd,QACA,QACA,iBACA,kBACoB;CACpB,OAAO;EACL,MAAA;EACA;EACA;EACA;EACA;CACF;AACF;;;AChBA,SAAgB,wBACd,OACA,iBACA,kBACqB;CACrB,OAAO;EACL,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACVA,SAAgB,oBAAoB,UAAwD;CAC1F,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACJA,SAAgB,0BACd,OACA,OACuB;CACvB,OAAO;EACL,MAAA;EACA;EACA;CACF;AACF;;;ACVA,SAAgB,qBAAqB,UAAyD;CAC5F,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACLA,SAAgB,sBAAsB,UAA0D;CAC9F,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACLA,SAAgB,sBAAsB,OAAyC;CAC7E,OAAO;EACL,MAAA;EACA;CACF;AACF;;;ACLA,SAAgB,0BAA0B,YAAiD;CACzF,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACHA,SAAgB,iBACd,QACA,MACA,OACA,iBACA,kBACc;CACd,IAAI,CAAC,QAAQ,CAAC,OACZ,MAAM,IAAI,MAAM,4CAA4C;CAG9D,OAAO;EACL,MAAA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;ACLA,SAAgB,0BACd,QACA,UACA,OACuB;CACvB,OAAO;EACL,MAAA;EACA;EACA;EACA;CACF;AACF;;;AC7BA,SAAgB,uBAAyC;CACvD,OAAO,EACL,MAAA,iBACF;AACF;;;ACJA,SAAgB,0BAA+C;CAC7D,OAAO,EACL,MAAA,oBACF;AACF;;;ACJA,SAAgB,uBAAyC;CACvD,OAAO,EACL,MAAA,iBACF;AACF;;;ACGA,SAAgB,mBACd,OACA,eACA,eACgB;CAChB,OAAO;EACL,OAAO,YAAY,KAAK;EACxB;EACA;EACA,MAAA;CACF;AACF;;;AChBA,SAAgB,0BAA0B,YAAiD;CACzF,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACCA,SAAgB,mBACd,QACA,UACA,MACA,WACgB;CAChB,OAAO;EACL,MAAM,YAAY,IAAI;EACtB,WAAW,YAAY,YAAY,SAAS,IAAI,KAAA;EAChD;EACA,MAAA;EACA;CACF;AACF;;;ACfA,SAAgB,kBACd,WACA,WACA,WACA,iBACA,kBACe;CACf,OAAO;EACL;EACA,WAAW,qBAAqB,QAAQ,YAAY,SAAS,IAAI;EACjE,MAAA;EACA;EACA,WAAW,YAAY,SAAS;EAChC;CACF;AACF;;;AClBA,SAAgB,sBACd,QACA,OACA,SAAkB,OACC;CACnB,OAAO;EACL;EACA,MAAA;EACA;EACA;CACF;AACF;;;ACZA,SAAgB,qBAAqB,YAA6C;CAChF,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACLA,SAAgB,sBAAsB,YAA8C;CAClF,OAAO;EACL;EACA,MAAA;CACF;AACF;;;ACAA,SAAgB,mBACd,UACA,eACA,WACA,cACgB;CAChB,OAAO;EACL,WAAW,YAAY,YAAY,SAAS,IAAI,KAAA;EAChD;EACA,cAAc,eAAe,YAAY,YAAY,IAAI,KAAA;EACzD,MAAA;EACA,UAAU,YAAY,QAAQ;CAChC;AACF;;;ACbA,SAAgB,qBACd,WACA,MACA,WACkB;CAClB,OAAO;EACL,MAAM,YAAY,IAAI;EACtB;EACA,WAAW,YAAY,YAAY,SAAS,IAAI,KAAA;EAChD,MAAA;CACF;AACF;;;ACXA,SAAgB,oBACd,OACA,MACA,WACA,iBACA,kBACiB;CACjB,OAAO;EACL,MAAM,YAAY,IAAI;EACtB;EACA,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACnBA,SAAgB,eACd,aACA,OACA,iBACA,kBACY;CACZ,OAAO;EACL;EACA;EACA,MAAA;EACA;EACA;CACF;AACF;;;ACfA,SAAgB,cAAc,MAAyB;CACrD,OAAO;EACL,MAAA;EACA;CACF;AACF;;;ACJA,SAAgB,iBACd,YACA,WACA,iBACA,kBACc;CACd,OAAO;EACL;EACA,MAAA;EACA;EACA;EACA;CACF;AACF;;;ACwBA,MAAa,UAAU;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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AAO,YAAY,IAAI;GAC7C,OAAO;EACT;CACF;CAEA,OAAO;AACT;ACjGA,MAAa,SAAS;;;;CAIpB,wBAAwB;;;;CAIxB,qBAAqB;;;;CAIrB,QAAQ;;;;CAIR,kBAAkB;AACpB;ACuEA,MAAa,WAAW;CACtB;EAzEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAIA;CACA;EAhHA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CA8EA;AACF;;;AC9GA,IAAa,eAAb,MAA0B;CACxB;CACA;CAEA,YAAY,QAAc;EACxB,KAAK,SAAS;EACd,KAAK,OAAO,IAAI,IAAI,MAAM;CAC5B;CAEA,IAAI,YAAY;EACd,OAAO,KAAK;CACd;;;;;;;CAQA,IAAI,QAA6C;EAC/C,MAAM,OAAO,OAAO,WAAW,aAAa,OAAO,KAAK,MAAM,IAAI;EAClE,KAAK,SAAS;EACd,KAAK,OAAO,IAAI,IAAI,IAAI;CAC1B;AACF;AAEA,MAAM,kBAAkB,IAAI,aAAa,CAAC,GAAG,SAAS,gBAAgB,GAAG,SAAS,cAAc,CAAC;;;;;AAOjG,MAAa,WAAW;;;;;CAKtB,UAAU,IAXgB,aAAa,CAAC,GAAG,SAAS,cAAc,CAWxD;;;;;;CAMV,SAAS;AACX;;;AChCA,MAAM,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SAAS,GAAG,IAAI,CAAC;CAC7C;CAEA,YAA0B;EACxB,IAAI,KAAK,cAAc,KAAA,GACrB,MAAM,IAAI,MAAM,sCAAsC;CAE1D;CAEA,SAAiB,OAA+C;EAC9D,OAAO,MAAM,KAAK,MAAM,KAAK,MAAM,CAAC,CAAC;CACvC;CAEA,aAAqB,OAA2C;EAC9D,OAAO;CACT;AACF;;;AC7EA,IAAa,YAAb,cAA4D,MAAS;CACnE,SAAkB;CAElB;CACA;CAEA,YAAY,OAAqB;EAC/B,MAAM;EACN,KAAK,SAAS;CAChB;CAEA,QAAiB,KAA4B;EAC3C,MAAM,QAAQ,GAAG;EACjB,IAAI,QAAQ,KAAK,SAAS,CAAC;CAC7B;CAEA,WAAqB;EACnB,KAAK,YAAY,KAAK,OAAO,GAAG;EAChC,OAAO,KAAK;CACd;CAEA,QAAiB;EACf,OAAO,KAAK,SAAS,CAAC,CAAC,MAAM;CAC/B;AACF;;;AC3BA,MAAM,UAAU,GAAG,cAAc,EAC/B,YAAY,EACd,CAAC;;AAGD,SAAgB,YAAY,MAAuB;CAEjD,OADe,QAAQ,UAAU,IACrB;AACd;AAiBA,MAAa,+BAAe,IAAI,IAAI;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,cAAc,EAC5B,MACA,UACA,QAMU;CACV,MAAM,WAAW,KAAK,UAAW,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACzD,IAAI,aAAa,SAAS,UAAW,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CAE7D,IAAI,SAAS,YAAY,CAAC,KAAK,WAAW,UAAU,GAAG;EAErD,IAAI,eAAe,cACjB,OAAO;GAAC;GAAG;GAAG;EAAU;EAI1B,MAAM,WAAW,WAAW,MAAM,GAAG,CAAC,CAAC;EACvC,IAAI,aAAa,IAAI,QAAQ,GAC3B,OAAO;GAAC;GAAG;GAAG;EAAU;EAI1B,OAAO;GAAC;GAAG;GAAG;EAAU;CAC1B;CAGA,IAAI,CAAC,WAAW,WAAW,KAAK,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,GACvD,OAAO;EAAC;EAAG;EAAG;CAAU;CAI1B,MAAM,MAAM,KACT,SAAS,KAAK,QAAQ,QAAQ,GAAG,KAAK,QAAQ,UAAU,CAAC,CA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