/* Track Detail modal — opens from any track row in the download modal and * shows a rich, status-aware view: cover, title/artist/album, play/listen, * source, quality, AcoustID verdict, file location, expected-vs-downloaded, * and the right actions for the row's state (Accept/Search for quarantined, * Search for failed). Backed by /api/downloads/task//detail. * * Globals it leans on (defined in downloads.js, loaded first): showToast, * showConfirmDialog, showCandidatesModal, escapeHtml. */ const _TD_STATUS = { completed: { label: 'Completed', cls: 'td-badge-ok' }, quarantined: { label: 'Quarantined', cls: 'td-badge-warn' }, failed: { label: 'Failed', cls: 'td-badge-bad' }, not_found: { label: 'Not Found', cls: 'td-badge-muted' }, in_progress: { label: 'In Progress', cls: 'td-badge-info' }, }; const _TD_ACOUSTID = { pass: { label: 'Verified', cls: 'td-aid-ok' }, fail: { label: 'Failed', cls: 'td-aid-bad' }, error: { label: 'Error', cls: 'td-aid-bad' }, skip: { label: 'No match', cls: 'td-aid-muted' }, disabled: { label: 'Off', cls: 'td-aid-muted' }, }; function _tdEsc(s) { if (typeof escapeHtml === 'function') return escapeHtml(s == null ? '' : s); return String(s == null ? '' : s).replace(/&/g, '&').replace(//g, '>'); } function _tdSetText(id, value, fallback = '—') { const el = document.getElementById(id); if (el) el.textContent = (value && String(value).trim()) ? value : fallback; } // Release the preview