import { t } from '../i18n/index.js'; // The assistant's name on its card. i18n-ignore: product name const ASSISTANT_NAME = 'GEV'; /** * Short state label for the narrow voice heading. The `voice` context lets * languages use shorter words; unknown states show upper-cased. * @param {string} status machine state (dataset.status) * @returns {string} */ export function voiceStatusLabel(status) { switch (status) { case 'idle': return t('OFF', { context: 'voice' }); case 'connecting': return t('CONNECTING', { context: 'voice' }); case 'listening': return t('LISTENING', { context: 'voice' }); case 'executing': return t('EXECUTING', { context: 'voice' }); case 'error': return t('ERROR', { context: 'voice' }); default: return String(status || '').toUpperCase(); } } /** Build the voice control independently of its connection backend. */ export function createVoiceControl({ reset = false, panel = false } = {}) { let root = document.getElementById('gev-voice-control'); if (root && reset) { root.remove(); root = null; } if (!root) { root = document.createElement('div'); root.id = 'gev-voice-control'; root.dataset.status = 'idle'; root.dataset.speaker = 'idle'; root.innerHTML = ` ${panel ? `` : ''}
${t('Voice replies appear here.')}
` : '' }${t('YOU')}
${t('THIS')}:
${ASSISTANT_NAME}
${t('These preferences stay in this browser.')}