// Chat Switchers Module - Manages format switchers (tables, infographic, cards, etc.) // This module handles both UI rendering and state management for switchers var activeSwitchers = new Set(); var switcherDefinitions = []; function renderBotSwitchers(switchers) { if (!switchers || switchers.length === 0) return; var existingIds = {}; switcherDefinitions.forEach(function(sw) { existingIds[sw.id] = true; }); switchers.forEach(function(sw) { if (!existingIds[sw.id]) { switcherDefinitions.push({ id: sw.id, label: sw.label || sw.id, icon: sw.icon || '🔀', color: sw.color || '#666' }); existingIds[sw.id] = true; } }); renderSwitchers(); var container = document.getElementById("switchers"); if (container && switcherDefinitions.length > 0) { container.style.display = ''; } } function renderSwitchers() { var container = document.getElementById("switcherChips"); if (!container) return; container.innerHTML = switcherDefinitions.map(function(sw) { var isActive = activeSwitchers.has(sw.id); return ( '