export var IFileInfo;
(function (IFileInfo) {
    function fromFile(file) {
        return {
            fullName: file.name,
            name: getFileName(file.name),
            ext: getFileExtension(file.name),
            current: 0,
            total: file.size,
            state: 'pending',
            blob: file
        };
    }
    IFileInfo.fromFile = fromFile;
    function update(fileInfo, value) {
        if (value.current !== undefined) {
            fileInfo.current = value.current;
        }
        if (value.total !== undefined) {
            fileInfo.total = value.total;
        }
        if (value.state !== undefined) {
            fileInfo.state = value.state;
        }
    }
    IFileInfo.update = update;
    /**
     * Returns the file name of the specified file without the extension.
     *
     * @public
     * @static
     * @param name - The file name
     */
    function getFileName(name) {
        if (name) {
            const i = name.lastIndexOf('.');
            if (i === -1) {
                return name;
            }
            return name.substring(0, i);
        }
        return '';
    }
    /**
     * Returns the file extension of the specified file without the name.
     *
     * @public
     * @static
     * @param name - The file name
     */
    function getFileExtension(name) {
        if (name) {
            const i = name.lastIndexOf('.');
            if (i === -1) {
                return name;
            }
            if (name.length <= i + 1) {
                return '';
            }
            return name.substring(i + 1);
        }
        return '';
    }
})(IFileInfo || (IFileInfo = {}));
//# sourceMappingURL=IFileInfo.js.map