import { jsx, jsxs } from "react/jsx-runtime";
import { IconChevronLeft } from "../../icons/index.mjs";
/* empty css                                                                                                                                                                                       */
/* empty css                                                                                                                                                                                        */
/* empty css                                                                                                                                                                                                */
/* empty css                                                                                                                                                                                           */
/* empty css                                                                                                                                                                                           */
import "clsx";
import { mergeSxList } from "../../utils/styles.mjs";
import { PageShellBaseBody } from "../PageShellBase/PageShellBaseBody.mjs";
import { PageShellBaseHeader } from "../PageShellBase/PageShellBaseHeader.mjs";
import { PageShellBaseRoot } from "../PageShellBase/PageShellBaseRoot.mjs";
import { PageShellBaseTitle } from "../PageShellBase/PageShellBaseTitle.mjs";
import { ExpandNavbarButtonPlaceholder } from "./navbar/ExpandNavbarButtonPlaceholder.mjs";
import { Group } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Group/Group.mjs";
import { ActionIcon } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.mjs";
const DEFAULT_PAGE_MAX_WIDTH = 1920;
const AppPageShell = ({
  withHeader = true,
  headerProps,
  bodyProps,
  wrapperProps,
  maxWidth = `${DEFAULT_PAGE_MAX_WIDTH}px`,
  ...rest
}) => {
  if (!withHeader) {
    return /* @__PURE__ */ jsx(
      PageShellBaseRoot,
      {
        ...bodyProps,
        sx: mergeSxList([
          {
            "--app-shell-page-max-width": maxWidth
          },
          {
            height: "100%",
            maxWidth: `min(100%, ${maxWidth})`,
            margin: "0 auto",
            padding: 24
          },
          bodyProps == null ? void 0 : bodyProps.sx
        ]),
        children: rest.children
      }
    );
  }
  return /* @__PURE__ */ jsxs(
    PageShellBaseRoot,
    {
      ...wrapperProps,
      sx: mergeSxList([
        {
          "--app-shell-page-max-width": maxWidth
        },
        (theme) => ({
          display: "flex",
          flexDirection: "column",
          height: "100%",
          maxWidth: `min(100%, ${maxWidth})`,
          margin: "0 auto",
          minWidth: `calc(${theme.breakpoints.md} - var(--app-shell-navbar-offset))`
        }),
        wrapperProps == null ? void 0 : wrapperProps.sx
      ]),
      children: [
        /* @__PURE__ */ jsx(
          PageShellBaseHeader,
          {
            ...headerProps,
            leftSection: /* @__PURE__ */ jsxs(Group, { wrap: "nowrap", gap: 0, children: [
              /* @__PURE__ */ jsx(ExpandNavbarButtonPlaceholder, {}),
              (headerProps == null ? void 0 : headerProps.withBack) && /* @__PURE__ */ jsx(
                ActionIcon,
                {
                  variant: "default",
                  onClick: () => {
                    if (headerProps == null ? void 0 : headerProps.onBackClick) {
                      headerProps.onBackClick();
                    } else {
                      history.back();
                    }
                  },
                  mr: "md",
                  "aria-label": "Navigate Back",
                  children: /* @__PURE__ */ jsx(IconChevronLeft, { size: 20 })
                }
              )
            ] }),
            sx: mergeSxList([
              (theme) => ({
                backgroundColor: theme.colors.carbon[1],
                flexShrink: 0
              }),
              headerProps == null ? void 0 : headerProps.sx
            ]),
            children: /* @__PURE__ */ jsx(PageShellBaseTitle, { children: rest.title })
          }
        ),
        /* @__PURE__ */ jsx(
          PageShellBaseBody,
          {
            ...bodyProps,
            sx: mergeSxList([
              {
                paddingTop: 0,
                paddingBottom: 64,
                flex: 1
              },
              bodyProps == null ? void 0 : bodyProps.sx
            ]),
            children: rest.children
          }
        )
      ]
    }
  );
};
export {
  AppPageShell
};
