/** ASIN 数据中心共享国家字典(任务 75):支持国家码与中文标签,纯逻辑。 */ export const ASIN_COUNTRY_CODES = ['DE', 'UK', 'FR', 'IT', 'ES'] as const export type AsinCountryCode = (typeof ASIN_COUNTRY_CODES)[number] export const ASIN_COUNTRY_LABELS: Record = { DE: '德国', UK: '英国', FR: '法国', IT: '意大利', ES: '西班牙', } /** 国家码 → 中文标签;不属白名单原样返回。 */ export function asinCountryLabel(country: string): string { return ASIN_COUNTRY_LABELS[country as AsinCountryCode] || country } /** 国家码归一:大小写不敏感;不属白名单时返回空串。 */ export function normalizeAsinCountry(value: string): string { const upper = (value || '').trim().toUpperCase() return ASIN_COUNTRY_CODES.includes(upper as AsinCountryCode) ? upper : '' }