import { clsx, type ClassValue } from 'clsx'; import { twMerge } from 'tailwind-merge'; /** * Merges class names with clsx and resolves Tailwind conflicts via twMerge. * * @param {ClassValue[]} inputs - Class values (strings, arrays, conditional maps) * @returns {string} Merged, de-conflicted className string */ export function classNames(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } /** * Triggers a browser download for a blob under the given filename, and * releases the object URL afterwards. * * @param {Blob} blob - The file bytes to download * @param {string} filename - Name the browser saves the file under * @returns {void} */ export function downloadBlob(blob: Blob, filename: string): void { const url = URL.createObjectURL(blob); const anchor = document.createElement('a'); anchor.href = url; anchor.download = filename; document.body.appendChild(anchor); anchor.click(); anchor.remove(); URL.revokeObjectURL(url); }