3`;
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
    URL.revokeObjectURL(a.href);
}
function addHistoryItem(text, voice, blob) {
    const previewText = text.substring(0, 30) + (text.length > 30 ? '...' : '');
    const historyItem = { id: Date.now(), timestamp: new Date(), voice: voice, text: text, previewText: previewText, blob: blob };
    history.unshift(historyItem);
    if (history.length > MAX_HISTORY_ITEMS) history.pop();
    saveHistory();
    updateHistoryUI(h