"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _avatar = _interopRequireDefault(require("@alifd/next/lib/avatar"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
require("./index.less");
var _excluded = ["children", "type", "text", "size", "shape", "icon", "src", "alt", "color", "backgroundColor", "srcSet"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var myAvatar = function myAvatar(_ref) {
  var children = _ref.children,
    type = _ref.type,
    text = _ref.text,
    size = _ref.size,
    shape = _ref.shape,
    icon = _ref.icon,
    src = _ref.src,
    alt = _ref.alt,
    color = _ref.color,
    backgroundColor = _ref.backgroundColor,
    srcSet = _ref.srcSet,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  return type === '图标' ? /*#__PURE__*/React.createElement(_avatar["default"], {
    size: size,
    shape: shape,
    icon: icon,
    style: {
      color: color,
      backgroundColor: backgroundColor
    }
  }) : type === '图片' ? /*#__PURE__*/React.createElement(_avatar["default"], {
    size: size,
    shape: shape,
    src: src,
    style: {
      color: color,
      backgroundColor: backgroundColor
    }
  }) : /*#__PURE__*/React.createElement(_avatar["default"], {
    size: size,
    shape: shape,
    style: {
      color: color,
      backgroundColor: backgroundColor
    }
  }, text);
};
myAvatar.displayName = 'myAvatar';
var _default = myAvatar;
exports["default"] = _default;