"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const index = require("../../icons/index.cjs");
;/* empty css                                                                                                                                                                                        */
;/* empty css                                                                                                                                                                                         */
;/* empty css                                                                                                                                                                                                 */
;/* empty css                                                                                                                                                                                            */
;/* empty css                                                                                                                                                                                            */
require("clsx");
const styles = require("../../utils/styles.cjs");
const PageShellBaseBody = require("../PageShellBase/PageShellBaseBody.cjs");
const PageShellBaseHeader = require("../PageShellBase/PageShellBaseHeader.cjs");
const PageShellBaseRoot = require("../PageShellBase/PageShellBaseRoot.cjs");
const PageShellBaseTitle = require("../PageShellBase/PageShellBaseTitle.cjs");
const ExpandNavbarButtonPlaceholder = require("./navbar/ExpandNavbarButtonPlaceholder.cjs");
const Group = require("../../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.cjs");
const ActionIcon = require("../../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.cjs");
const DEFAULT_PAGE_MAX_WIDTH = 1920;
const AppPageShell = ({
  withHeader = true,
  headerProps,
  bodyProps,
  wrapperProps,
  maxWidth = `${DEFAULT_PAGE_MAX_WIDTH}px`,
  ...rest
}) => {
  if (!withHeader) {
    return /* @__PURE__ */ jsxRuntime.jsx(
      PageShellBaseRoot.PageShellBaseRoot,
      {
        ...bodyProps,
        sx: styles.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__ */ jsxRuntime.jsxs(
    PageShellBaseRoot.PageShellBaseRoot,
    {
      ...wrapperProps,
      sx: styles.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__ */ jsxRuntime.jsx(
          PageShellBaseHeader.PageShellBaseHeader,
          {
            ...headerProps,
            leftSection: /* @__PURE__ */ jsxRuntime.jsxs(Group.Group, { wrap: "nowrap", gap: 0, children: [
              /* @__PURE__ */ jsxRuntime.jsx(ExpandNavbarButtonPlaceholder.ExpandNavbarButtonPlaceholder, {}),
              (headerProps == null ? void 0 : headerProps.withBack) && /* @__PURE__ */ jsxRuntime.jsx(
                ActionIcon.ActionIcon,
                {
                  variant: "default",
                  onClick: () => {
                    if (headerProps == null ? void 0 : headerProps.onBackClick) {
                      headerProps.onBackClick();
                    } else {
                      history.back();
                    }
                  },
                  mr: "md",
                  "aria-label": "Navigate Back",
                  children: /* @__PURE__ */ jsxRuntime.jsx(index.IconChevronLeft, { size: 20 })
                }
              )
            ] }),
            sx: styles.mergeSxList([
              (theme) => ({
                backgroundColor: theme.colors.carbon[1],
                flexShrink: 0
              }),
              headerProps == null ? void 0 : headerProps.sx
            ]),
            children: /* @__PURE__ */ jsxRuntime.jsx(PageShellBaseTitle.PageShellBaseTitle, { children: rest.title })
          }
        ),
        /* @__PURE__ */ jsxRuntime.jsx(
          PageShellBaseBody.PageShellBaseBody,
          {
            ...bodyProps,
            sx: styles.mergeSxList([
              {
                paddingTop: 0,
                paddingBottom: 64,
                flex: 1
              },
              bodyProps == null ? void 0 : bodyProps.sx
            ]),
            children: rest.children
          }
        )
      ]
    }
  );
};
exports.AppPageShell = AppPageShell;
