"use strict";const g=require("react/jsx-runtime"),u=require("react"),$=require("@chakra-ui/react"),e=require("./normalize-messages-DtVffO09.cjs.js"),A=require("./image-CGOYoc2s.cjs.js"),{withContext:z}=$.createRecipeContext({key:"nimbusAvatar"}),I=z("figure"),R={avatarLabel:a=>`Avatar image for ${a.fullName}`},S={avatarLabel:a=>`Avatarbild für ${a.fullName}`},h={avatarLabel:a=>`Imagen de avatar para ${a.fullName}`},q={avatarLabel:a=>`Image d'avatar pour ${a.fullName}`},x={avatarLabel:a=>`Avatar para ${a.fullName}`},_={en:e.normalizeMessages(R),de:e.normalizeMessages(S),es:e.normalizeMessages(h),"fr-FR":e.normalizeMessages(q),"pt-BR":e.normalizeMessages(x)};function C(a,s){return a.split("")[0].toUpperCase()+s.split("")[0].toUpperCase()}const v=a=>{const s=e.useLocalizedStringFormatter(_),{ref:f,firstName:r,lastName:o,src:t,alt:d,...p}=a,[n,l]=u.useState(!1),[i,c]=u.useState(!1),m=`${r} ${o}`,b={"aria-label":s.format("avatarLabel",{fullName:m}),ref:f,...p},L=()=>{l(!0),c(!1)},M=()=>{l(!1),c(!0)},N=!t||!n||i;return g.jsxs(I,{...b,children:[N?C(r,o):null,t&&g.jsx(A.Image,{src:t,alt:d||m,onLoad:L,onError:M,display:n&&!i?"block":"none"})]})};v.displayName="Avatar";exports.Avatar=v;
//# sourceMappingURL=avatar-Dxv4iY1T.cjs.js.map
