import { jsx, jsxs } from "react/jsx-runtime";
import { useState, useCallback, Suspense } from "react";
import { NotificationBody } from "./NotificationBody/index.js";
import { NotificationFooter } from "./NotificationFooter.js";
import { NotificationHeader } from "./NotificationHeader.js";
/* empty css                         */
import Drawer from "../../node_modules/@mui/material/Drawer/Drawer.js";
function Notification({
  title,
  anchor = "right",
  isOpen,
  setIsOpen,
  className,
  handleClose,
  secondaryButtonLabel,
  onSecondaryButtonClick,
  primaryButtonLabel,
  onPrimaryButtonClick,
  onSettingButtonClick,
  handleSelectAll,
  handleMarkReadAll,
  handleMoveAllPending,
  handleNotificationDeleteAll,
  badgesList,
  notificationTabs,
  notificationPanels,
  setNotificationPanels,
  handleTabChange = () => {
  },
  moveToPendingDropdownOptions,
  activeNotiTab,
  activeBadge,
  showBadgeLoader,
  showNotificationListLoader,
  displayFormat = "MM/DD/YYYY",
  onNotificationScrollToBottom,
  scrollThreshold,
  isWithSearch = true,
  isHoverOnCard = false,
  isChipsExpandable = false,
  isDeleteAlwaysVisible = false,
  isEmptyState,
  emptyStateTitle,
  emptyStateDescription,
  customNotificationJsx,
  NotificationBodyComponent
}) {
  const [expand, setExpand] = useState(false);
  const BodyComponent = NotificationBodyComponent ?? NotificationBody;
  const toggleDrawer = useCallback(
    (_anchor, _open) => (event) => {
      if (event.type === "keydown" && event.key !== "Tab" && event.key !== "Shift") {
        return;
      }
      if (handleClose) {
        handleClose();
      } else {
        setIsOpen == null ? void 0 : setIsOpen(!isOpen);
      }
    },
    [handleClose, isOpen, setIsOpen]
  );
  return /* @__PURE__ */ jsx(Drawer, { anchor, open: isOpen, onClose: toggleDrawer(anchor, false), children: /* @__PURE__ */ jsxs(
    "div",
    {
      className: `impact-notification-container ${expand ? "impact-notification-container-expand" : ""} ${className ?? ""}`.trim(),
      children: [
        /* @__PURE__ */ jsx(
          NotificationHeader,
          {
            anchor,
            expand,
            setExpand,
            showBadgeLoader,
            title,
            toggleDrawer
          }
        ),
        /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { className: "impact-notification-body-container" }), children: /* @__PURE__ */ jsx(
          BodyComponent,
          {
            activeBadge,
            activeNotiTab,
            badgesList,
            customNotificationJsx,
            displayFormat,
            emptyStateDescription,
            emptyStateTitle,
            expand: !primaryButtonLabel && !secondaryButtonLabel,
            handleMarkReadAll,
            handleMoveAllPending,
            handleNotificationDeleteAll,
            handleSelectAll,
            handleTabChange,
            isChipsExpandable,
            isDeleteAlwaysVisible,
            isEmptyState,
            isHoverOnCard,
            isWithSearch,
            moveToPendingDropdownOptions,
            notificationPanels: notificationPanels ?? [],
            notificationTabs: notificationTabs ?? [],
            scrollThreshold,
            setNotificationPanels,
            showBadgeLoader,
            showNotificationListLoader,
            onNotificationScrollToBottom,
            onSettingButtonClick
          }
        ) }),
        /* @__PURE__ */ jsx(
          NotificationFooter,
          {
            primaryButtonLabel,
            secondaryButtonLabel,
            onPrimaryButtonClick,
            onSecondaryButtonClick
          }
        )
      ]
    }
  ) });
}
Notification.displayName = "Notification";
export {
  Notification,
  NotificationFooter,
  NotificationHeader
};
