import { jsx as r } from "@emotion/react/jsx-runtime";
import { useMemo as a } from "react";
import { useModuleDictionary as p } from "@m4l/core";
import { Typography as u, Breadcrumbs as f, Box as h } from "@mui/material";
import { LinkItem as i } from "./components/LinkItem/index.js";
function y(n) {
  const { links: t, activeLast: m = !1, ...c } = n, { getLabel: s } = p(), o = a(() => {
    if (t.length === 0)
      return "";
    const { dictionaryField: e } = t[t.length - 1];
    return s(e);
  }, [s, t]), d = a(
    () => t.map((e) => /* @__PURE__ */ r(i, { link: e }, e.name)),
    [t]
  ), l = a(
    () => t.map(
      (e) => e.name !== o ? /* @__PURE__ */ r(i, { link: e }, e.name) : /* @__PURE__ */ r(
        u,
        {
          variant: "body2",
          sx: {
            maxWidth: 260,
            overflow: "hidden",
            whiteSpace: "nowrap",
            color: "text.disabled",
            textOverflow: "ellipsis"
          },
          children: o
        },
        e.name
      )
    ),
    [o, t]
  );
  return /* @__PURE__ */ r(
    f,
    {
      id: "MUIBreadcrumbs",
      separator: /* @__PURE__ */ r(
        h,
        {
          component: "span",
          sx: {
            width: 4,
            height: 4,
            mx: 0.5,
            borderRadius: "50%",
            bgcolor: "text.disabled"
          }
        }
      ),
      ...c,
      children: m ? d : l
    }
  );
}
export {
  y as Breadcrumbs,
  y as default
};
