()
| 94 | // Search |
| 95 | //////////////////// |
| 96 | function parseSearchIndex() { |
| 97 | const index = document.getElementById("search-index")?.textContent; |
| 98 | if (!index) return []; |
| 99 | |
| 100 | try { |
| 101 | const parsed = JSON.parse(index); |
| 102 | return Array.isArray(parsed) ? (parsed as SearchIndexItem[]) : []; |
| 103 | } catch { |
| 104 | return []; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | function normalizeSearchText(value: string) { |
| 109 | return value.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim(); |