import { clsx, type ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; export const cn = (...i: ClassValue[]) => twMerge(clsx(i)); export const fmtDate = (d: Date | string | null | undefined) => (d ? new Intl.DateTimeFormat("en-CA", { dateStyle: "medium", timeZone: "America/Toronto" }).format(new Date(d)) : "—"); export const fmtDateTime = (d: Date | string | null | undefined) => (d ? new Intl.DateTimeFormat("en-CA", { dateStyle: "medium", timeStyle: "short", timeZone: "America/Toronto" }).format(new Date(d)) : "—"); export const LABELS: Record = { macos: "macOS", windows: "Windows", linux: "Linux", ios: "iOS", android: "Android", web: "Web", any: "Any", cloud: "Cloud", "self-hosted": "Self-hosted", local: "Local", desktop: "Desktop", mobile: "Mobile", cli: "CLI", api: "API", sdk: "SDK", library: "Library", "ide-extension": "IDE extension", "browser-extension": "Browser extension", "mcp-server": "MCP server", "open-source": "Open source", proprietary: "Proprietary", "source-available": "Source-available", mixed: "Mixed", free: "Free", freemium: "Freemium", paid: "Paid", enterprise: "Enterprise", "usage-based": "Usage-based", academic: "Academic", unknown: "Unknown", active: "Active", maintenance: "Maintenance", deprecated: "Deprecated", discontinued: "Discontinued", renamed: "Renamed", deep: "In-depth", standard: "Standard", saas: "SaaS", "on-premises": "On-premises", hybrid: "Hybrid", embedded: "Embedded", "managed-cloud": "Managed cloud", application: "Application", framework: "Framework", "api-service": "API service", platform: "Platform", "cli-tool": "CLI tool", language: "Language", database: "Database", model: "Model", "data-service": "Data service", extension: "Extension", specification: "Specification", service: "Service", high: "High", medium: "Medium", low: "Low", ok: "Verified", redirected: "Redirected", broken: "Broken", unchecked: "Unchecked", official_site: "Official site", official_docs: "Official documentation", repository: "Repository", release_notes: "Release notes", pricing_page: "Pricing page", policy_page: "Policy page", license_page: "License", package_registry: "Package registry", academic_paper: "Paper", third_party_directory: "Directory", news: "News", other: "Other", }; export const label = (v: string) => LABELS[v] ?? v.replace(/-/g, " ").replace(/^\w/, (c) => c.toUpperCase());