| 1668 | } |
| 1669 | |
| 1670 | function providerLogoSvg(providerId: string) { |
| 1671 | const cached = ProviderLogoSvgs.get(providerId); |
| 1672 | if (cached) return cached; |
| 1673 | |
| 1674 | const logoPath = path.join(root, "providers", providerId, "logo.svg"); |
| 1675 | const defaultLogoPath = path.join(root, "providers", "logo.svg"); |
| 1676 | const rawSvg = readFileSync( |
| 1677 | existsSync(logoPath) ? logoPath : defaultLogoPath, |
| 1678 | "utf8", |
| 1679 | ); |
| 1680 | const svg = rawSvg |
| 1681 | .replace(/<svg\b([^>]*)>/i, (_, attributes: string) => { |
| 1682 | const cleaned = attributes.replace(/\s(width|height)="[^"]*"/gi, ""); |
| 1683 | return `<svg${cleaned} aria-hidden="true" focusable="false">`; |
| 1684 | }) |
| 1685 | .replace(/\sfill="(?!none|currentColor)[^"]*"/gi, ' fill="currentColor"') |
| 1686 | .replace(/\sstroke="(?!none|currentColor)[^"]*"/gi, ' stroke="currentColor"'); |
| 1687 | |
| 1688 | ProviderLogoSvgs.set(providerId, svg); |
| 1689 | return svg; |
| 1690 | } |
| 1691 | |
| 1692 | function labLogoSvg(labId: string) { |
| 1693 | const cached = LabLogoSvgs.get(labId); |