import { __assign, __rest } from "tslib";
import './File.css';
import React from 'react';
import { FileIconDoc } from '../../fileIcons/FileIconDoc/FileIconDoc';
import { FileIconJpg } from '../../fileIcons/FileIconJpg/FileIconJpg';
import { FileIconPdf } from '../../fileIcons/FileIconPdf/FileIconPdf';
import { FileIconPtt } from '../../fileIcons/FileIconPtt/FileIconPtt';
import { FileIconPttx } from '../../fileIcons/FileIconPttx/FileIconPttx';
import { FileIconTxt } from '../../fileIcons/FileIconTxt/FileIconTxt';
import { cn } from '../../utils/bem';
export var cnFile = cn('File');
var mapExtensionToSvg = {
    doc: FileIconDoc,
    docx: FileIconDoc,
    jpg: FileIconJpg,
    jpeg: FileIconJpg,
    pdf: FileIconPdf,
    ptt: FileIconPtt,
    ppt: FileIconPtt,
    pttx: FileIconPttx,
    pptx: FileIconPttx,
    txt: FileIconTxt
};
function getIconByExtension(extension) {
    if (!extension) {
        return FileIconPdf;
    }
    return mapExtensionToSvg[extension.toLowerCase()] || FileIconPdf;
}
export var File = function (props) {
    var extension = props.extension, className = props.className, otherProps = __rest(props, ["extension", "className"]);
    var Icon = getIconByExtension(extension);
    return React.createElement(Icon, __assign({ className: cnFile(null, [className]) }, otherProps));
};
