"use strict";

require("core-js/modules/es.symbol.js");
require("core-js/modules/es.array.filter.js");
require("core-js/modules/es.array.for-each.js");
require("core-js/modules/es.array.push.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
require("core-js/modules/es.object.get-own-property-descriptor.js");
require("core-js/modules/es.object.get-own-property-descriptors.js");
require("core-js/modules/es.object.keys.js");
require("core-js/modules/es.object.to-string.js");
require("core-js/modules/esnext.iterator.constructor.js");
require("core-js/modules/esnext.iterator.filter.js");
require("core-js/modules/esnext.iterator.for-each.js");
require("core-js/modules/web.dom-collections.for-each.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MessageLabel = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireDefault(require("react"));
require("./index.css");
var _i18n = require("../../i18n");
var _lineCopyButton = require("../line-copy-button");
var _jsxRuntime = require("react/jsx-runtime");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var MessageLabel = exports.MessageLabel = function MessageLabel(_ref) {
  var styles = _ref.styles,
    color = _ref.color,
    avatar = _ref.avatar,
    tag = _ref.tag,
    publisher = _ref.publisher,
    target = _ref.target,
    publisherIsSelf = _ref.publisherIsSelf,
    targetIsSelf = _ref.targetIsSelf,
    time = _ref.time,
    isPrivate = _ref.isPrivate,
    handleClickPrivateChat = _ref.handleClickPrivateChat;
  var cls = (0, _classnames["default"])('fcr-message-label', {
    'fcr-message-label--self': !avatar
  });
  var t = (0, _i18n.useI18n)();
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
    className: cls,
    style: _objectSpread({}, styles),
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lineCopyButton.PrivateButton, {
      onPrivate: function onPrivate() {
        handleClickPrivateChat === null || handleClickPrivateChat === void 0 || handleClickPrivateChat();
      },
      children: avatar
    }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
      className: "fcr-message-label__content",
      children: [publisherIsSelf && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
        className: "fcr-message-label__marginR",
        children: isPrivate ? t('fmt_chat_to_you') : publisher
      }), tag && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        className: "fcr-message-label__tag",
        children: tag
      }), !publisherIsSelf && /*#__PURE__*/(0, _jsxRuntime.jsx)(_lineCopyButton.PrivateButton, {
        onPrivate: function onPrivate() {
          handleClickPrivateChat === null || handleClickPrivateChat === void 0 || handleClickPrivateChat();
        },
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
          className: "fcr-message-label__publisher fcr-message-label__nickname fcr-break-one-line fcr-word-break",
          style: {
            color: color
          },
          children: publisher
        })
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        className: "fcr-message-label__marginR",
        children: t('fmt_chat_send_to')
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        style: {
          color: color
        },
        className: (0, _classnames["default"])('fcr-message-label__marginR fcr-message-label__nickname', {
          'fcr-break-one-line fcr-word-break': target !== 'All'
        }),
        children: target === 'All' ? t('fmt_chat_option_all') : target
      }), isPrivate && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
        className: "fcr-message-label__private fcr-message-label__marginR",
        children: ["(", t('fmt_chats_label_privatechat'), ")"]
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        className: "fcr-message-label__time fcr-break-one-line fcr-word-break",
        children: time
      })]
    })]
  });
};