'use strict';

var jsxRuntime = require('react/jsx-runtime');
var react = require('@chakra-ui/react');
var md = require('react-icons/md');
var reactRouterDom = require('react-router-dom');
var CopyButton = require('../CopyButton/CopyButton.cjs');

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
function Breadcrumbs(props) {
  const { items = [], showHomeIcon = true } = props;
  const alignItems = "flex-end";
  const borderRadius = "sm";
  const px = "1";
  return /* @__PURE__ */ jsxRuntime.jsxs(
    react.Breadcrumb,
    {
      spacing: 3,
      size: "sm",
      separator: /* @__PURE__ */ jsxRuntime.jsx(md.MdChevronRight, { size: "1.2rem" }),
      alignItems,
      sx: { ol: { display: "flex", alignItems } },
      fontSize: "sm",
      children: [
        showHomeIcon && /* @__PURE__ */ jsxRuntime.jsx(react.BreadcrumbItem, { alignItems, children: /* @__PURE__ */ jsxRuntime.jsx(react.BreadcrumbLink, { as: reactRouterDom.NavLink, to: "/", "aria-label": "Home", borderRadius, children: /* @__PURE__ */ jsxRuntime.jsx(md.MdOutlineHome, { size: "1.2rem" }) }) }),
        items.map((item, i) => {
          var _a, _b;
          return /* @__PURE__ */ jsxRuntime.jsxs(react.BreadcrumbItem, { position: "relative", alignItems, children: [
            /* @__PURE__ */ jsxRuntime.jsxs(
              react.BreadcrumbLink,
              {
                as: reactRouterDom.NavLink,
                to: item.to,
                _hover: {
                  textDecoration: "none",
                  ".BreadcrumbHeading": { textDecoration: "none" },
                  ".BreadcrumbText": { textDecoration: "underline" }
                },
                borderRadius,
                px,
                mx: -px,
                children: [
                  item.heading && /* @__PURE__ */ jsxRuntime.jsx(
                    react.Box,
                    {
                      className: "BreadcrumbHeading",
                      fontWeight: "400",
                      textTransform: "lowercase",
                      display: "block",
                      mb: "-0.5",
                      children: item.heading
                    }
                  ),
                  /* @__PURE__ */ jsxRuntime.jsx(
                    react.Box,
                    __spreadProps(__spreadValues({
                      className: "BreadcrumbText",
                      fontWeight: "500"
                    }, ((_a = item.options) == null ? void 0 : _a.canBeTruncated) ? {
                      wordBreak: "break-all",
                      whiteSpace: "break-spaces",
                      noOfLines: 1
                    } : {
                      whiteSpace: "nowrap"
                    }), {
                      children: item.name
                    })
                  )
                ]
              }
            ),
            ((_b = item.options) == null ? void 0 : _b.canBeCopied) && /* @__PURE__ */ jsxRuntime.jsx(react.Box, { pl: 2, children: /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: item.name, variant: "ghost", iconSize: 16 }) })
          ] }, i);
        })
      ]
    }
  );
}

module.exports = Breadcrumbs;
//# sourceMappingURL=Breadcrumbs.cjs.map
