export function languageLabel(filename: string) { const extension = filename.split('.').pop()?.toUpperCase() return extension && extension.length <= 6 ? extension : 'TEXT' } export function rawSnippetUrl(id: string) { return `http://127.0.0.1:6868/${encodeURIComponent(id)}?mode=raw` } export function snippetUrl(id: string) { if (typeof window === 'undefined') return `/${encodeURIComponent(id)}` return new URL(`/${encodeURIComponent(id)}`, window.location.origin).toString() }