<script>
  import { FileText, File, Image, FileSpreadsheet, Presentation, Mail, FileCode, FileQuestion } from 'lucide-svelte';

  let { format = '', size = 16 } = $props();

  const ICON_MAP = {
    pdf: FileText,
    hwp: FileText,
    hwpx: FileText,
    md: FileCode,
    txt: File,
    csv: FileSpreadsheet,
    json: FileCode,
    xml: FileCode,
    html: FileCode,
    jpg: Image,
    jpeg: Image,
    png: Image,
    gif: Image,
    bmp: Image,
    tiff: Image,
    eml: Mail,
    odoc: FileText,
    osheet: FileSpreadsheet,
    docx: FileText,
    doc: FileText,
    xlsx: FileSpreadsheet,
    xls: FileSpreadsheet,
    pptx: Presentation,
    ppt: Presentation,
    odt: FileText,
    ods: FileSpreadsheet,
    odp: Presentation,
    dwg: FileCode,
    dxf: FileCode,
  };

  let Icon = $derived(ICON_MAP[format?.toLowerCase()] || FileQuestion);
</script>

<svelte:component this={Icon} {size} />
