"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Header = void 0;
var _locale = require("@mirai/locale");
var _ui = require("@mirai/ui");
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireDefault(require("react"));
var _Header = require("./Header.l10n");
var style = _interopRequireWildcard(require("./Header.module.css"));
var _helpers = require("../../../helpers");
var _Chat = require("../../Chat.constants");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const Header = _ref => {
  let {
    settings,
    onClose
  } = _ref;
  const {
    ai: {
      name = _Chat.DEFAULT_NAME
    } = {},
    web: {
      avatar
    } = {}
  } = settings || {};
  const {
    translate
  } = (0, _locale.useLocale)();
  return /*#__PURE__*/_react.default.createElement(_ui.View, {
    row: true,
    className: style.header
  }, /*#__PURE__*/_react.default.createElement(_ui.View, {
    row: true
  }, /*#__PURE__*/_react.default.createElement(_ui.Avatar, {
    image: avatar,
    small: true,
    className: style.avatar
  }), /*#__PURE__*/_react.default.createElement(_ui.View, null, /*#__PURE__*/_react.default.createElement(_ui.Text, {
    bold: true,
    headline: true
  }, name), /*#__PURE__*/_react.default.createElement(_ui.Text, {
    light: true,
    small: true
  }, translate(_Header.L10N.LABEL_ASSISTANT)))), /*#__PURE__*/_react.default.createElement(_ui.Button, {
    small: true,
    squared: true,
    tooltip: translate(_Header.L10N.ACTION_CLOSE),
    transparent: true,
    onPress: onClose
  }, /*#__PURE__*/_react.default.createElement(_ui.Icon, {
    value: _helpers.ICON.CLOSE
  })));
};
exports.Header = Header;
Header.propTypes = {
  settings: _propTypes.default.shape({
    ai: _propTypes.default.shape({
      name: _propTypes.default.string
    }),
    web: _propTypes.default.shape({
      avatar: _propTypes.default.string
    })
  }),
  onClose: _propTypes.default.func,
  onRestart: _propTypes.default.func
};
Header.displayName = 'Mirai:Core:Chat.Header';
//# sourceMappingURL=Header.js.map