{"version":3,"sources":["/home/mkabumattar/work/withrawi/rawi/dist/chunk-AZDGR6RH.cjs","../src/core/configs/managers/display.manager.ts"],"names":["ConfigDisplayManager","credentials","masked","maskApiKey","providerConfig","getProvider","chalk"],"mappings":"AAAA;AACA,wDAAwC,wDAAyC,4ECD/D,IAKLA,CAAAA,CAAN,KAA4D,CACjE,kBAAA,CAAmBC,CAAAA,CAAoC,CACrD,IAAMC,CAAAA,CAAS,CAAC,GAAGD,CAAW,CAAA,CAE1BC,CAAAA,CAAO,MAAA,EAAA,CACTA,CAAAA,CAAO,MAAA,CAASC,iCAAAA,CAAWD,CAAO,MAAM,CAAA,CAAA,CAG1C,IAAME,CAAAA,CAAiBC,iCAAAA,CAAYH,CAAO,QAAQ,CAAA,CAClD,EAAA,CAAI,CAACE,CAAAA,CAAgB,CACnB,OAAA,CAAQ,GAAA,CAAIE,eAAAA,CAAM,GAAA,CAAI,CAAA,kBAAA,EAAqBJ,CAAAA,CAAO,QAAQ,CAAA,CAAA;ADboM","file":"/home/mkabumattar/work/withrawi/rawi/dist/chunk-AZDGR6RH.cjs","sourcesContent":[null,"import chalk from 'chalk';\nimport {getProvider} from '../../providers/index.js';\nimport {maskApiKey, type RawiCredentials} from '../../shared/index.js';\nimport type {IConfigDisplayManager} from '../interfaces/config-manager.interface.js';\n\nexport class ConfigDisplayManager implements IConfigDisplayManager {\n  displayCredentials(credentials: RawiCredentials): void {\n    const masked = {...credentials};\n\n    if (masked.apiKey) {\n      masked.apiKey = maskApiKey(masked.apiKey);\n    }\n\n    const providerConfig = getProvider(masked.provider);\n    if (!providerConfig) {\n      console.log(chalk.red(`Unknown provider: ${masked.provider}`));\n      return;\n    }\n\n    const providerDisplayName = providerConfig.displayName;\n    const modelInfo = providerConfig.models.find(\n      (m) => m.name === masked.model,\n    );\n    const modelDisplayName = modelInfo?.displayName || masked.model;\n\n    console.log(\n      chalk.blue('  Provider:') +\n        chalk.white(` ${providerDisplayName} (${masked.provider})`),\n    );\n    console.log(chalk.blue('  Model:') + chalk.white(` ${modelDisplayName}`));\n\n    let displayApiKey = masked.apiKey;\n    if (\n      !displayApiKey &&\n      masked.providerSettings &&\n      'apiKey' in masked.providerSettings\n    ) {\n      displayApiKey = maskApiKey(masked.providerSettings.apiKey as string);\n    }\n\n    if (\n      displayApiKey ||\n      (masked.providerSettings &&\n        Object.keys(masked.providerSettings).length > 0)\n    ) {\n      console.log(chalk.blue('  Configuration:'));\n\n      if (displayApiKey) {\n        console.log(chalk.gray(`    API Key: ${displayApiKey}`));\n      }\n\n      if (masked.providerSettings) {\n        this.#displayProviderSettings(masked.providerSettings);\n      }\n    }\n\n    if (masked.temperature !== undefined) {\n      console.log(\n        chalk.blue('  Temperature:') + chalk.white(` ${masked.temperature}`),\n      );\n    }\n\n    if (masked.maxTokens !== undefined) {\n      console.log(\n        chalk.blue('  Max Tokens:') + chalk.white(` ${masked.maxTokens}`),\n      );\n    }\n\n    if (masked.language) {\n      console.log(\n        chalk.blue('  Language:') + chalk.white(` ${masked.language}`),\n      );\n    }\n  }\n\n  displayConfigurationSummary(credentials: RawiCredentials): void {\n    console.log(chalk.green('✅ Configuration Summary:'));\n    this.displayCredentials(credentials);\n  }\n\n  displayProfiles(profiles: string[]): void {\n    if (profiles.length === 0) {\n      console.log(chalk.yellow('No profiles found.'));\n      return;\n    }\n\n    console.log(chalk.blue('Available Profiles:'));\n    for (const profile of profiles) {\n      console.log(chalk.white(`  • ${profile}`));\n    }\n  }\n\n  #displayProviderSettings(settings: Record<string, any>): void {\n    for (const [key, value] of Object.entries(settings)) {\n      if (value !== undefined && value !== null) {\n        if (key === 'apiKey') {\n          continue;\n        }\n        const displayKey = this.#formatSettingKey(key);\n        const displayValue = this.#formatSettingValue(key, value);\n        console.log(chalk.gray(`    ${displayKey}: ${displayValue}`));\n      }\n    }\n  }\n\n  #formatSettingKey(key: string): string {\n    return key\n      .replace(/([A-Z])/g, ' $1')\n      .replace(/^./, (str) => str.toUpperCase());\n  }\n\n  #formatSettingValue(key: string, value: any): string {\n    const sensitiveKeys = [\n      'apiKey',\n      'accessKey',\n      'secretKey',\n      'token',\n      'password',\n    ];\n    const lowerKey = key.toLowerCase();\n\n    if (sensitiveKeys.some((sk) => lowerKey.includes(sk))) {\n      return typeof value === 'string' ? maskApiKey(value) : '[MASKED]';\n    }\n\n    return String(value);\n  }\n\n  displayError(message: string, details?: string): void {\n    console.error(chalk.red(`❌ ${message}`));\n    if (details) {\n      console.error(chalk.gray(`   ${details}`));\n    }\n  }\n\n  displayWarning(message: string, details?: string): void {\n    console.warn(chalk.yellow(`⚠️  ${message}`));\n    if (details) {\n      console.warn(chalk.gray(`   ${details}`));\n    }\n  }\n\n  displaySuccess(message: string, details?: string): void {\n    console.log(chalk.green(`✅ ${message}`));\n    if (details) {\n      console.log(chalk.gray(`   ${details}`));\n    }\n  }\n\n  displayInfo(message: string, details?: string): void {\n    console.log(chalk.blue(`ℹ️  ${message}`));\n    if (details) {\n      console.log(chalk.gray(`   ${details}`));\n    }\n  }\n}\n"]}