'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
 * Shared status / type / SEO indicators for the Posts admin area.
 * Colors use semantic theme tokens only.
 */
const PALETTE = {
    purple: {
        bg: 'bg-brand/10',
        text: 'text-brand',
        ring: 'ring-brand/20',
        border: 'border-brand',
    },
    green: {
        bg: 'bg-success/10',
        text: 'text-success',
        ring: 'ring-success/20',
        border: 'border-success',
    },
    orange: {
        bg: 'bg-warning/10',
        text: 'text-warning',
        ring: 'ring-warning/20',
        border: 'border-warning',
    },
    red: {
        bg: 'bg-destructive/10',
        text: 'text-destructive',
        ring: 'ring-destructive/20',
        border: 'border-destructive',
    },
    blue: {
        bg: 'bg-info/10',
        text: 'text-info',
        ring: 'ring-info/20',
        border: 'border-info',
    },
    pink: {
        bg: 'bg-chart-4/15',
        text: 'text-chart-4',
        ring: 'ring-chart-4/20',
        border: 'border-chart-4',
    },
    gray: {
        bg: 'bg-muted',
        text: 'text-muted-foreground',
        ring: 'ring-border',
        border: 'border-border',
    },
};
export function paletteFor(color) {
    if (!color)
        return PALETTE.gray;
    return PALETTE[color] ?? PALETTE.gray;
}
const STATUS_LABEL = {
    PUBLISHED: 'Published',
    DRAFT: 'Draft',
    SCHEDULED: 'Scheduled',
    ARCHIVED: 'Archived',
};
const STATUS_PALETTE = {
    PUBLISHED: 'green',
    DRAFT: 'gray',
    SCHEDULED: 'orange',
    ARCHIVED: 'gray',
};
const STATUS_GLYPH = {
    PUBLISHED: '●',
    DRAFT: '○',
    SCHEDULED: '◐',
    ARCHIVED: '◌',
};
export function PostStatusBadge({ status }) {
    const p = paletteFor(STATUS_PALETTE[status]);
    return (_jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium ${p.bg} ${p.text}`, "aria-label": `Status: ${STATUS_LABEL[status]}`, children: [_jsx("span", { "aria-hidden": true, className: "text-[10px] leading-none", children: STATUS_GLYPH[status] }), STATUS_LABEL[status]] }));
}
export function PostTypeBadge({ label, color, onClick, }) {
    const p = paletteFor(color);
    const className = `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${p.bg} ${p.text}`;
    if (onClick) {
        return (_jsx("button", { type: "button", onClick: onClick, className: `${className} hover:opacity-80`, children: label }));
    }
    return _jsx("span", { className: className, children: label });
}
export function seoScorePalette(score) {
    if (score === null || Number.isNaN(score))
        return 'gray';
    if (score >= 80)
        return 'green';
    if (score >= 60)
        return 'orange';
    if (score >= 1)
        return 'red';
    return 'gray';
}
export function SeoScoreIndicator({ score }) {
    const colorKey = seoScorePalette(score);
    const p = paletteFor(colorKey);
    if (score === null) {
        return (_jsxs("span", { className: "text-muted-foreground inline-flex items-center gap-1.5 text-xs", children: [_jsx("span", { "aria-hidden": true, className: `h-2 w-2 rounded-full ${p.bg.split(' ')[0]}` }), _jsx("span", { className: "tabular-nums", children: "\u2014" })] }));
    }
    return (_jsxs("span", { className: "text-foreground inline-flex items-center gap-1.5 text-xs", children: [_jsx("span", { "aria-hidden": true, className: `h-2 w-2 rounded-full ${colorKey === 'green'
                    ? 'bg-success'
                    : colorKey === 'orange'
                        ? 'bg-warning'
                        : 'bg-destructive'}` }), _jsx("span", { className: "tabular-nums", children: score })] }));
}
//# sourceMappingURL=badges.js.map