import { jsxs as b, jsx as I } from "react/jsx-runtime";
import { useState as f } from "react";
import { createRecipeContext as N } from "@chakra-ui/react";
import { a as h } from "./avatar.recipe-BEdxgo-r.es.js";
import { n as e, u as A } from "./normalize-messages-D5T4I93D.es.js";
import { I as M } from "./image-DRigLU80.es.js";
const { withContext: $ } = /* @__PURE__ */ N({ recipe: h }), x = /* @__PURE__ */ $(
  "figure"
), R = {
  avatarLabel: (a) => `Avatar image for ${a.fullName}`
}, S = {
  avatarLabel: (a) => `Avatarbild für ${a.fullName}`
}, _ = {
  avatarLabel: (a) => `Imagen de avatar para ${a.fullName}`
}, C = {
  avatarLabel: (a) => `Image d'avatar pour ${a.fullName}`
}, w = {
  avatarLabel: (a) => `Avatar para ${a.fullName}`
}, E = {
  en: /* @__PURE__ */ e(R),
  de: /* @__PURE__ */ e(S),
  es: /* @__PURE__ */ e(_),
  "fr-FR": /* @__PURE__ */ e(C),
  "pt-BR": /* @__PURE__ */ e(w)
};
function j(a, t) {
  return a.split("")[0].toUpperCase() + t.split("")[0].toUpperCase();
}
const y = (a) => {
  const t = A(E), { ref: p, firstName: s, lastName: o, src: r, alt: v, ...g } = a, [l, n] = f(!1), [i, m] = f(!1), c = `${s} ${o}`, u = {
    "aria-label": t.format("avatarLabel", {
      fullName: c
    }),
    ref: p,
    ...g
  }, d = () => {
    n(!0), m(!1);
  }, L = () => {
    n(!1), m(!0);
  };
  return /* @__PURE__ */ b(x, { ...u, children: [
    !r || !l || i ? j(s, o) : null,
    r && /* @__PURE__ */ I(
      M,
      {
        src: r,
        alt: v || c,
        onLoad: d,
        onError: L,
        display: l && !i ? "block" : "none"
      }
    )
  ] });
};
y.displayName = "Avatar";
export {
  y as A
};
//# sourceMappingURL=avatar-1Y7cLjZT.es.js.map
