import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{isNil as t,camelCase as o}from"es-toolkit";import{getStyle as a}from"../../helpers/typesciptCssModulesHelper.js";import{getTestId as r,ComponentDefaultTestId as s}from"../../tests/testIds.js";import i from"classnames";import l,{useMemo as n,useCallback as c}from"react";import{ElementAllowedColor as m}from"../../utils/colors-vars-map.js";import{getElementColor as d}from"../../types/Colors.js";import{AvatarType as p,AvatarSize as u}from"./AvatarConstants.js";import b from"./AvatarBadge.js";import g from"./AvatarContent.js";import f from"../Tooltip/Tooltip.js";import{withStaticPropsWithoutForwardRef as v}from"../../types/withStaticProps.js";import h from"./Avatar.module.scss.js";import{ComponentVibeId as j}from"../../tests/constants.js";import k from"../../../components/clickable/dist/Clickable/ClickableWrapper.js";var C=v((function(m){var p=m.id,u=m.type,v=void 0===u?"text":u,C=m.className,E=m.avatarContentWrapperClassName,y=m.textClassName,N=void 0===y?"":y,B=m.size,A=void 0===B?"large":B,x=m.src,P=m.icon,T=m.text,z=m.tooltipProps,O=m.ariaLabel,w=m.withoutTooltip,L=void 0!==w&&w,R=m.role,I=m.backgroundColor,H=void 0===I?"chili-blue":I,W=m.square,q=m.disabled,S=m.tabIndex,V=m.ariaHidden,_=void 0!==V&&V,D=m.topLeftBadgeProps,M=m.topRightBadgeProps,F=m.bottomLeftBadgeProps,G=m.bottomRightBadgeProps,J=m.withoutBorder,K=void 0!==J&&J,Q=m.customSize,U=void 0===Q?null:Q,X=m.customBackgroundColor,Y=void 0===X?null:X,Z=m.onClick,$=m["data-testid"],ee=n((function(){return Y?{backgroundColor:Y}:x?{}:{backgroundColor:d(H)}}),[x,H,Y]),te=n((function(){return U?{height:U,width:U}:{}}),[U]),oe=n((function(){if(!L)return z?Object.assign({content:O},z):{content:O}}),[O,z,L]),ae=n((function(){var e=[];return t(D)||e.push(l.createElement("div",{key:"top-left-badge",className:i(h.badge,h.badgeTopLeft)},l.createElement(b,Object.assign({size:A},D)))),t(M)||e.push(l.createElement("div",{key:"top-right-badge",className:i(h.badge,h.badgeTopRight)},l.createElement(b,Object.assign({size:A},M)))),t(F)||e.push(l.createElement("div",{key:"bottom-left-badge",className:i(h.badge,h.badgeBottomLeft)},l.createElement(b,Object.assign({size:A},F)))),t(G)||e.push(l.createElement("div",{key:"bottom-right-bade",className:i(h.badge,h.badgeBottomRight)},l.createElement(b,Object.assign({size:A},G)))),e.length>0?l.createElement("div",{className:i(h.badges)},e):null}),[A,D,M,F,G]),re=n((function(){return q||!Z&&!(null==oe?void 0:oe.content)?-1:0}),[q,Z,null==oe?void 0:oe.content]),se=null!=S?S:re,ie=c((function(e){e.preventDefault(),Z&&Z(e,p)}),[Z,p]);return l.createElement("div",{id:p,"data-testid":$||r(s.AVATAR,p),className:i(h.avatar,h[A],C),style:te,"data-vibe":j.AVATAR},l.createElement(k,{isClickable:!!Z,clickableProps:{onClick:ie,tabIndex:"-1",className:h.clickableWrapper}},l.createElement(f,Object.assign({showTrigger:["focus","mouseenter"],hideTrigger:["blur","mouseleave"]},oe),l.createElement("div",{className:i(h.circle,a(h,o("circle--"+v)),e(e(e({},h.disabled,q),h.square,W),h.withoutBorder,K),E),"aria-hidden":_,tabIndex:se,style:Object.assign({},ee)},l.createElement(g,{type:v,size:A,src:x,icon:P,text:T,ariaLabel:O,role:R,textClassName:N})),ae)))}),{types:p,sizes:u,colors:m,backgroundColors:m});export{C as default};
//# sourceMappingURL=Avatar.js.map
