"use strict";

import React from 'react';
import LastMessageVideo from './styled/LastMessageVideo';
import LastTextMessage from './styled/LastTextMessage';
import LastMessagePhoto from './styled/LastMessagePhoto';
import LastMessageEmoji from './styled/LastMessageEmoji';
import LastMessageFile from './styled/LastMessageFile';
import LastAudioMessage from './styled/LastAudioMessage';
import { jsx as _jsx } from "react/jsx-runtime";
const LastMessageItem = ({
  lastMessage
}) => {
  const {
    body,
    emoji,
    mimetype
  } = lastMessage;
  if (mimetype) {
    if (mimetype.startsWith('image/')) {
      return /*#__PURE__*/_jsx(LastMessagePhoto, {
        ...lastMessage
      });
    }
    if (mimetype.startsWith('video/')) {
      return /*#__PURE__*/_jsx(LastMessageVideo, {
        ...lastMessage
      });
    }
    if (mimetype.startsWith('audio/') || mimetype.includes('application/octet-stream')) {
      return /*#__PURE__*/_jsx(LastAudioMessage, {
        ...lastMessage
      });
    }
    return /*#__PURE__*/_jsx(LastMessageFile, {
      ...lastMessage
    });
  }
  if (emoji) {
    return /*#__PURE__*/_jsx(LastMessageEmoji, {
      ...lastMessage
    });
  }
  if (body) {
    return /*#__PURE__*/_jsx(LastTextMessage, {
      ...lastMessage
    });
  }
  return undefined;
};
export default LastMessageItem;
//# sourceMappingURL=LastMessageItem.js.map