import React__default from 'react';
import { L as Label, a as LabelTypography, b as LabelColors } from '../index-4372fcec.js';
import Icon, { IconTypes, IconColors } from './Icon.js';
import TextButton from './TextButton.js';
import { h as getClassName, L as getUIKitFileType, t as truncateString } from '../index-eefb44ba.js';
import { C as Colors } from '../color-9519a526.js';
import { u as useMediaQueryContext } from '../MediaQueryContext-b4904a2e.js';
import 'prop-types';
import '../stringSet-eefbc798.js';
import '../_rollupPluginBabelHelpers-4f8ebde4.js';
import '../utils/message/getOutgoingMessageState.js';

function FileMessageItemBody(_ref) {
  var _message$reactions;
  let {
    className,
    message,
    isByMe = false,
    mouseHover = false,
    isReactionEnabled = false,
    truncateLimit = null
  } = _ref;
  const {
    isMobile
  } = useMediaQueryContext();
  const truncateMaxNum = truncateLimit || (isMobile ? 20 : null);
  return /*#__PURE__*/React__default.createElement("div", {
    className: getClassName([className, 'sendbird-file-message-item-body', isByMe ? 'outgoing' : 'incoming', mouseHover ? 'mouse-hover' : '', isReactionEnabled && (message === null || message === void 0 ? void 0 : (_message$reactions = message.reactions) === null || _message$reactions === void 0 ? void 0 : _message$reactions.length) > 0 ? 'reactions' : ''])
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-file-message-item-body__file-icon"
  }, /*#__PURE__*/React__default.createElement(Icon, {
    className: "sendbird-file-message-item-body__file-icon__icon",
    type: {
      IMAGE: IconTypes.PHOTO,
      VIDEO: IconTypes.PLAY,
      AUDIO: IconTypes.FILE_AUDIO,
      GIF: IconTypes.GIF,
      OTHERS: IconTypes.FILE_DOCUMENT
    }[getUIKitFileType(message === null || message === void 0 ? void 0 : message.type)],
    fillColor: IconColors.PRIMARY,
    width: "24px",
    height: "24px"
  })), /*#__PURE__*/React__default.createElement(TextButton, {
    className: "sendbird-file-message-item-body__file-name",
    onClick: () => {
      window.open(message === null || message === void 0 ? void 0 : message.url);
    },
    color: isByMe ? Colors.ONCONTENT_1 : Colors.ONBACKGROUND_1
  }, /*#__PURE__*/React__default.createElement(Label, {
    className: "sendbird-file-message-item-body__file-name__text",
    type: LabelTypography.BODY_1,
    color: isByMe ? LabelColors.ONCONTENT_1 : LabelColors.ONBACKGROUND_1
  }, truncateString((message === null || message === void 0 ? void 0 : message.name) || (message === null || message === void 0 ? void 0 : message.url), truncateMaxNum))));
}

export { FileMessageItemBody as default };
//# sourceMappingURL=FileMessageItemBody.js.map
