import { escapeAttr, escapeHtml } from './citations.js'; export function renderSourcesList(sources) { if (!sources || sources.length === 0) return '
No citations returned.
'; return sources.map(function (s, idx) { var n = s.number || idx + 1; var page = s.page || s.page_number || s.pageNumber; var meta = []; if (page) meta.push('page ' + page); if (s.visual_caption_source) meta.push('caption: ' + s.visual_caption_source); if (s.visual_kind || s.source_priority) meta.push(s.visual_kind || s.source_priority); if (s.category) meta.push(s.category); if (s.doc_type || s.type) meta.push(s.doc_type || s.type); if (s.score != null) meta.push('score ' + Number(s.score).toFixed(3)); // Retrieved, but the answer did not lean on it. Worth showing — the panel // is also a view of what the search found — but worth distinguishing from // the numbers the answer actually used. if (s.uncited) meta.unshift('not cited'); return '' + escapeHtml(s.excerpt) + '