"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),a=require("prop-types"),r=require("classnames"),s=require("@material-ui/core/styles"),i=require("@material-ui/core/Avatar"),l=require("../Tooltip/Tooltip.js");require("../Tooltip/ScrollableTooltip.js");var o=require("../../utils/main.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=n(a),d=n(r),c=n(i),f=function(e){switch(e){case 24:return 12;case 32:return 14;case 40:return 16;case 48:return 20;case 128:return 64;case 200:return 80;default:return Math.floor(e/2)}},p=function(e){return{minWidth:e,width:e,height:e,lineHeight:"".concat(e,"px"),fontSize:f(e)}},m=["#5F47A4","#9078C8","#DC74FD","#F695B5","#CB4F4F","#896F65","#F3AE96","#EE7850","#DDAE67","#A6CA72","#62893D","#91C9C4","#38818D","#77B5F1","#3F4C99","#919DA4"],h=function(e){return m[Math.abs(o.hashCode(e)%m.length)]},g=function(a){var r=a.displayName,s=a.showTooltip,i=a.size,n=a.className,u=a.imgSrc,f=a.alt,m=a.classes,g=a["data-testid"];return t.jsx(l.Tooltip,e.__assign({title:r,disableFocusListener:!s,disableHoverListener:!s,disableTouchListener:!s},{children:t.jsx(c.default,e.__assign({"data-testid":g,alt:f,src:u,className:d.default(m.avatar,n),style:e.__assign(e.__assign({},p(Number(i))),{backgroundColor:!!r&&h(r)})},{children:r?o.getNameInitials(r):null}))}))},v={displayName:u.default.string,showTooltip:u.default.bool,size:u.default.number,className:u.default.string,imgSrc:u.default.string,alt:u.default.string,"data-testid":u.default.string,classes:u.default.shape({avatar:u.default.string}).isRequired};g.propTypes=v,g.defaultProps={displayName:"",showTooltip:!1,size:32,className:void 0,imgSrc:void 0,alt:void 0,"data-testid":"generic_avatar"};var b=s.withStyles((function(e){return{avatar:{color:e.palette.common.white,fontWeight:"bold"}}}))(g);exports.AvatarComponent=g,exports.default=b;
