TypeScript 97.4%
SQL 1%
JavaScript 0.9%
CSS 0.6%
1export function formatBytes(n: number | null | undefined): string {2 if (n === null || n === undefined || Number.isNaN(n)) return "—";3 if (n < 1024) return `${n} B`;4 if (n < 1024 * 1024) return `${(n / 1024).toFixed(n < 10 * 1024 ? 1 : 0)} KB`;5 return `${(n / (1024 * 1024)).toFixed(1)} MB`;6}78export const FILE_KIND_LABEL: Record<string, string> = { image: "Image", pdf: "PDF", text: "Text", code: "Code", csv: "CSV", json: "JSON", document: "Document" };910export function kindLabel(kind: string): string {11 return FILE_KIND_LABEL[kind] ?? kind;12}1314/** MIME/extension accept list shared by the upload inputs (mirrors /api/attachments + library `kindOf`). */15export const LIBRARY_ACCEPT = "image/png,image/jpeg,image/webp,image/gif,application/pdf,text/*,application/json,.md,.txt,.csv,.json,.js,.ts,.tsx,.jsx,.py,.rb,.go,.rs,.java,.kt,.swift,.c,.cc,.cpp,.h,.hpp,.cs,.php,.sh,.yaml,.yml,.toml,.xml,.html,.css,.sql";16