import{z as e}from"zod";const t=e.object({name:e.string().min(1,`Provider name cannot be empty`).describe(`Provider name (unique identifier)`),baseUrl:e.string().url(`Base URL must be a valid URL`).describe(`API base URL`),apiKey:e.string().min(1,`API key cannot be empty`).describe(`API authentication key`),models:e.array(e.string().min(1)).min(1,`Provider must support at least one model`).describe(`List of supported models`),priority:e.number().int().positive().optional().describe(`Provider priority (lower = higher priority)`),timeout:e.number().int().positive().optional().describe(`Request timeout in milliseconds`),headers:e.record(e.string(),e.string()).optional().describe(`Custom headers to include in requests`)}),n=e.object({maxRetries:e.number().int().min(0).max(10).default(2).describe(`Maximum number of retries`),backoffMs:e.number().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds (exponential)`)}),r=e.object({providers:e.array(t).min(1,`At least one provider must be configured`).refine(e=>{let t=e.map(e=>e.name);return t.length===new Set(t).size},{message:`Provider names must be unique`}).describe(`List of API providers`),defaultModel:e.string().optional().describe(`Default model to use when not specified`),retryPolicy:n.optional().describe(`Retry policy for failed requests`)}),i=e.object({win32:e.string().min(1).optional().describe(`Windows-specific command`),darwin:e.string().min(1).optional().describe(`macOS-specific command`),linux:e.string().min(1).optional().describe(`Linux-specific command`),default:e.string().min(1).describe(`Default command for all platforms`)}),a=e.object({win32:e.array(e.string()).optional().describe(`Windows-specific args`),darwin:e.array(e.string()).optional().describe(`macOS-specific args`),linux:e.array(e.string()).optional().describe(`Linux-specific args`),default:e.array(e.string()).describe(`Default args for all platforms`)}),o=e.object({command:e.union([e.string().min(1),i]).describe(`Command to execute (string or platform-specific object)`),args:e.union([e.array(e.string()),a]).optional().describe(`Command arguments (array or platform-specific object)`)}),s=e.object({win32:e.string().min(1).optional().describe(`Windows-specific shell command`),darwin:e.string().min(1).optional().describe(`macOS-specific shell command`),linux:e.string().min(1).optional().describe(`Linux-specific shell command`),default:e.string().min(1).describe(`Default shell command for all platforms`)}),c=e.object({win32:e.array(o).min(1).optional().describe(`Windows-specific pipeline`),darwin:e.array(o).min(1).optional().describe(`macOS-specific pipeline`),linux:e.array(o).min(1).optional().describe(`Linux-specific pipeline`),default:e.array(o).min(1).describe(`Default pipeline for all platforms`)}),l=e.object({command:e.string().min(1).optional().describe(`Xling command to execute`),args:e.array(e.string()).optional().describe(`Command arguments`),shell:e.union([e.string().min(1),s]).optional().describe(`Shell command to execute (string or platform-specific object)`),pipeline:e.union([e.array(o).min(1),c]).optional().describe(`Pipeline of commands to execute (array or platform-specific object)`),description:e.string().optional().describe(`Human-readable description`)}).refine(e=>[!!e.command,!!e.shell,!!e.pipeline].filter(Boolean).length===1,{message:`Exactly one of 'command', 'shell', or 'pipeline' must be specified`}).refine(e=>!(e.args&&(e.shell||e.pipeline)),{message:`'args' can only be used with 'command', not with 'shell' or 'pipeline'`}),u=e.object({prompt:r.describe(`AI prompt configuration`),shortcuts:e.record(e.string(),l).optional().describe(`Command shortcuts/aliases`)});function d(e){if(typeof e!=`object`||!e)return u.parse(e);let t=e;if(`providers`in t&&!(`prompt`in t)){let e={prompt:{providers:t.providers,defaultModel:t.defaultModel,retryPolicy:t.retryPolicy},shortcuts:t.shortcuts};return u.parse(e)}return u.parse(e)}function f(e){return new Set(e.models).size===e.models.length?null:e.models.filter((t,n)=>e.models.indexOf(t)!==n)}function p(e){return e??2**53-1}export{s as a,n as c,p as d,f,c as i,l,a as n,r as o,d as p,i as r,t as s,o as t,u};