---
import fs from 'node:fs';

// cwd is www/ — public/js/ is synced from ../dist/ by the prebuild/predev script
const distPath = 'public/js/htmx.min.js.br';
const stats = fs.statSync(distPath);
const bundleSize = `~${Math.round(stats.size / 1024)}k`;

// Auto-calculate extension count
const extensionDocs = import.meta.glob('../content/docs/06-extensions/*.md', { eager: true }) as Record<string, any>;
const extensionCount = Object.keys(extensionDocs).filter(file => {
    const slug = file.split('/').pop() || '';
    return !slug.includes('overview') && !slug.startsWith('01-');
}).length;
---

<p class="flex items-center gap-3 sm:gap-4 text-xs font-mono font-light text-neutral-650 dark:text-neutral-350">
    <a href="/docs/get-started/installation" class="group interact:text-blue-600 dark:interact:text-blue-300 interact:underline transition">
        <b class="font-chicago group-interact:text-blue-600 dark:group-interact:text-blue-300">{bundleSize}</b> min.br'd</a>
    <span class="text-neutral-300 dark:text-neutral-700" aria-hidden="true">·</span>
    <a href="https://github.com/bigskysoftware/htmx/blob/master/package.json" target="_blank" rel="noopener noreferrer" class="group interact:text-blue-600 dark:interact:text-blue-300 interact:underline transition">
        <b class="font-chicago group-interact:text-blue-600 dark:group-interact:text-blue-300">0</b> dep<span class="max-sm:hidden">endencie</span>s</a>
    <span class="text-neutral-300 dark:text-neutral-700" aria-hidden="true">·</span>
    <a href="/docs/extensions" class="group interact:text-blue-600 dark:interact:text-blue-300 interact:underline transition">
        <b class="font-chicago group-interact:text-blue-600 dark:group-interact:text-blue-300">{extensionCount}</b> extension<span class="max-sm:hidden">s</span></a>
</p>
