"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Root = exports.Initials = exports.Avatar = void 0;

var _index = require("../styles/index.js");

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function getSize(props) {
  var $size = props.$size,
      $theme = props.$theme;
  var defaultSize = $theme.sizing.scale1000;
  var size = $size || defaultSize;
  return $theme.sizing[size] || size;
}

var Avatar = (0, _index.styled)('img', function (props) {
  var themedSize = getSize(props);
  return {
    borderRadius: '50%',
    boxSizing: 'border-box',
    display: 'block',
    height: themedSize,
    width: themedSize
  };
});
exports.Avatar = Avatar;
Avatar.displayName = "Avatar";
var Initials = (0, _index.styled)('div', function (props) {
  return _objectSpread({}, props.$theme.typography.font400, {
    color: props.$theme.colors.mono100,
    alignItems: 'center',
    display: 'flex',
    justifyContent: 'center',
    height: '100%'
  });
});
exports.Initials = Initials;
Initials.displayName = "Initials";
var Root = (0, _index.styled)('div', function (props) {
  var $didImageFailToLoad = props.$didImageFailToLoad;
  var themedSize = getSize(props);
  return {
    backgroundColor: $didImageFailToLoad ? props.$theme.colors.primary : null,
    borderRadius: '50%',
    boxSizing: 'border-box',
    display: 'inline-block',
    // image previously set the root height/width
    // since image is not rendered, set the height/width
    height: $didImageFailToLoad ? themedSize : null,
    width: $didImageFailToLoad ? themedSize : null
  };
});
exports.Root = Root;
Root.displayName = "Root";