wcz-layout
Version:
1,842 lines • 52 kB
JavaScript
import { t as clientEnv } from "./env-Bm6rrgwT.mjs";
import { r as getUser, t as getAccessToken } from "./user-BQiWoQk1.mjs";
import { c as rootRouteHead, n as WISTRON_PRIMARY_COLOR, r as WISTRON_SECONDARY_COLOR, t as Platform } from "./utils-DpcYsXTK.mjs";
import { n as RouterIconButton, t as RouterListItemButton } from "./RouterListItemButton-owZVvuC_.mjs";
import { t as DialogsContext } from "./DialogsContext-DLqA8RJ_.mjs";
import { t as NotificationContext } from "./NotificationContext-CgwUOeW0.mjs";
import { c } from "react/compiler-runtime";
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
import { AppBar, Avatar, Box, Chip, Collapse, CssBaseline, Grow, IconButton, InitColorSchemeScript, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Menu, Stack, ThemeProvider, Toolbar, Typography, useColorScheme } from "@mui/material";
import { LocalizationProvider } from "@mui/x-date-pickers-pro";
import { AdapterDayjs } from "@mui/x-date-pickers-pro/AdapterDayjs";
import dayjs from "dayjs";
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import { Fragment, useEffect, useId, useRef, useState } from "react";
import { I18nextProvider, initReactI18next, useTranslation } from "react-i18next";
import { resources } from "virtual:wcz-layout";
import z$1 from "zod";
import Menu$1 from "@mui/icons-material/Menu";
import MenuOpen from "@mui/icons-material/MenuOpen";
import { styled } from "@mui/material/styles";
import { rootRouteId, useLocation, useMatch, useRouter } from "@tanstack/react-router";
import { createServerFn } from "@tanstack/react-start";
import { useQuery } from "@tanstack/react-query";
import AccountCircle from "@mui/icons-material/AccountCircle";
import ArrowBack from "@mui/icons-material/ArrowBack";
import Brightness4 from "@mui/icons-material/Brightness4";
import ChevronRight from "@mui/icons-material/ChevronRight";
import DarkMode from "@mui/icons-material/DarkMode";
import Done from "@mui/icons-material/Done";
import LightMode from "@mui/icons-material/LightMode";
import Login from "@mui/icons-material/Login";
import Logout from "@mui/icons-material/Logout";
import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
import Translate from "@mui/icons-material/Translate";
import axios from "axios";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
import Drawer from "@mui/material/Drawer";
import Box$1 from "@mui/material/Box";
import Divider$1 from "@mui/material/Divider";
import List$1 from "@mui/material/List";
import ListSubheader$1 from "@mui/material/ListSubheader";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import Avatar$1 from "@mui/material/Avatar";
import ListItem$1 from "@mui/material/ListItem";
import ListItemButton$1 from "@mui/material/ListItemButton";
import ListItemIcon$1 from "@mui/material/ListItemIcon";
import ListItemText$1 from "@mui/material/ListItemText";
import Paper from "@mui/material/Paper";
import Typography$1 from "@mui/material/Typography";
import useEventCallback$1 from "@mui/utils/useEventCallback";
import Alert from "@mui/material/Alert";
import Snackbar from "@mui/material/Snackbar";
//#region src/components/core/account/UserAvatar.tsx
const getProfilePhoto = createServerFn({ method: "GET" }).handler(async () => {
try {
const accessToken = await getAccessToken("graph");
const response = await axios.get("https://graph.microsoft.com/v1.0/me/photo/$value", {
responseType: "arraybuffer",
headers: { Authorization: `Bearer ${accessToken}` }
});
return `data:image/jpeg;base64,${Buffer.from(response.data).toString("base64")}`;
} catch {
return "";
}
});
const UserAvatar = () => {
const $ = c(5);
if ($[0] !== "dbc52df414bd95c9dfedd517241f8f56ad1f1434ee4daf14887176a7a8a3ea7f") {
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "dbc52df414bd95c9dfedd517241f8f56ad1f1434ee4daf14887176a7a8a3ea7f";
}
let t0;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {
queryKey: [
"graph",
"me",
"photo"
],
queryFn: _temp$5,
staleTime: Infinity,
gcTime: Infinity
};
$[1] = t0;
} else t0 = $[1];
const { data: photoUrl } = useQuery(t0);
const t1 = photoUrl || void 0;
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = {
width: {
xs: 32,
sm: 40
},
height: {
xs: 32,
sm: 40
}
};
$[2] = t2;
} else t2 = $[2];
let t3;
if ($[3] !== t1) {
t3 = /* @__PURE__ */ jsx(Avatar, {
src: t1,
sx: t2
});
$[3] = t1;
$[4] = t3;
} else t3 = $[4];
return t3;
};
function _temp$5() {
return getProfilePhoto();
}
//#endregion
//#region src/components/core/account/UserMenu.tsx
const capitalize = (value) => value && value.charAt(0).toUpperCase() + value.slice(1);
const ToolbarAccount = () => {
const $ = c(111);
if ($[0] !== "676f46e6f24c38ef4300c9dd88652ceb82b9848ccee5f2e2c9230717f4f69584") {
for (let $i = 0; $i < 111; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "676f46e6f24c38ef4300c9dd88652ceb82b9848ccee5f2e2c9230717f4f69584";
}
const [anchorElement, setAnchorElement] = useState();
const [tab, setTab] = useState("settings");
const open = Boolean(anchorElement);
const { t, i18n } = useTranslation();
const { mode, setMode } = useColorScheme();
let t0;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t0 = { from: rootRouteId };
$[1] = t0;
} else t0 = $[1];
const user = useMatch(t0).context.user;
let T0;
let closeMenu;
let openMenu;
let settings;
let t1;
let t2;
let theme;
if ($[2] !== i18n || $[3] !== mode || $[4] !== setMode || $[5] !== t) {
const supportedLanguages = (Array.isArray(i18n.options.supportedLngs) ? i18n.options.supportedLngs : []).filter(_temp$4);
const languageDisplayNames = new Intl.DisplayNames([i18n.language], { type: "language" });
let t3;
if ($[13] !== t) {
t3 = t("Layout.Light");
$[13] = t;
$[14] = t3;
} else t3 = $[14];
let t4;
if ($[15] !== t3) {
t4 = {
mode: "light",
icon: LightMode,
label: t3
};
$[15] = t3;
$[16] = t4;
} else t4 = $[16];
let t5;
if ($[17] !== t) {
t5 = t("Layout.Dark");
$[17] = t;
$[18] = t5;
} else t5 = $[18];
let t6;
if ($[19] !== t5) {
t6 = {
mode: "dark",
icon: DarkMode,
label: t5
};
$[19] = t5;
$[20] = t6;
} else t6 = $[20];
let t7;
if ($[21] !== t) {
t7 = t("Layout.System");
$[21] = t;
$[22] = t7;
} else t7 = $[22];
let t8;
if ($[23] !== t7) {
t8 = {
mode: "system",
icon: SettingsBrightness,
label: t7
};
$[23] = t7;
$[24] = t8;
} else t8 = $[24];
let t9;
if ($[25] !== t4 || $[26] !== t6 || $[27] !== t8) {
t9 = [
t4,
t6,
t8
];
$[25] = t4;
$[26] = t6;
$[27] = t8;
$[28] = t9;
} else t9 = $[28];
const colorModes = t9;
let t10;
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
t10 = (event) => setAnchorElement(event.currentTarget);
$[29] = t10;
} else t10 = $[29];
openMenu = t10;
let t11;
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
t11 = () => {
setAnchorElement(void 0);
setTimeout(() => setTab("settings"), 300);
};
$[30] = t11;
} else t11 = $[30];
closeMenu = t11;
let t12;
if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
t12 = (newTab) => () => setTab(newTab);
$[31] = t12;
} else t12 = $[31];
const changeTab = t12;
let t13;
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
t13 = { backgroundColor: "transparent" };
$[32] = t13;
} else t13 = $[32];
let t14;
if ($[33] !== t) {
t14 = t("Layout.Settings");
$[33] = t;
$[34] = t14;
} else t14 = $[34];
let t15;
if ($[35] !== t14) {
t15 = /* @__PURE__ */ jsx(ListSubheader, {
sx: t13,
children: t14
});
$[35] = t14;
$[36] = t15;
} else t15 = $[36];
let t16;
let t17;
if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
t16 = changeTab("theme");
t17 = { py: .3 };
$[37] = t16;
$[38] = t17;
} else {
t16 = $[37];
t17 = $[38];
}
let t18;
if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
t18 = /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Brightness4, {}) });
$[39] = t18;
} else t18 = $[39];
let t19;
if ($[40] !== t) {
t19 = t("Layout.Appearance");
$[40] = t;
$[41] = t19;
} else t19 = $[41];
let t20;
if ($[42] !== colorModes || $[43] !== mode || $[44] !== t) {
t20 = colorModes.find((m) => m.mode === mode)?.label ?? t("Layout.System");
$[42] = colorModes;
$[43] = mode;
$[44] = t;
$[45] = t20;
} else t20 = $[45];
let t21;
if ($[46] !== t19 || $[47] !== t20) {
t21 = /* @__PURE__ */ jsx(ListItemText, {
primary: t19,
secondary: t20
});
$[46] = t19;
$[47] = t20;
$[48] = t21;
} else t21 = $[48];
let t22;
if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
t22 = /* @__PURE__ */ jsx(ChevronRight, {});
$[49] = t22;
} else t22 = $[49];
let t23;
if ($[50] !== t21) {
t23 = /* @__PURE__ */ jsxs(ListItemButton, {
onClick: t16,
sx: t17,
children: [
t18,
t21,
t22
]
});
$[50] = t21;
$[51] = t23;
} else t23 = $[51];
let t24;
let t25;
if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
t24 = changeTab("language");
t25 = { py: .3 };
$[52] = t24;
$[53] = t25;
} else {
t24 = $[52];
t25 = $[53];
}
let t26;
if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
t26 = /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Translate, {}) });
$[54] = t26;
} else t26 = $[54];
let t27;
if ($[55] !== t) {
t27 = t("Layout.Language");
$[55] = t;
$[56] = t27;
} else t27 = $[56];
let t28;
if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
t28 = /* @__PURE__ */ jsx(ChevronRight, {});
$[57] = t28;
} else t28 = $[57];
const t29 = /* @__PURE__ */ jsxs(ListItemButton, {
onClick: t24,
sx: t25,
children: [
t26,
/* @__PURE__ */ jsx(ListItemText, {
primary: t27,
secondary: capitalize(languageDisplayNames.of(i18n.language))
}),
t28
]
});
let t30;
if ($[58] !== t15 || $[59] !== t23 || $[60] !== t29) {
t30 = /* @__PURE__ */ jsxs(List, {
component: "nav",
subheader: t15,
children: [t23, t29]
});
$[58] = t15;
$[59] = t23;
$[60] = t29;
$[61] = t30;
} else t30 = $[61];
settings = t30;
let t31;
let t32;
if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
t31 = changeTab("settings");
t32 = {
backgroundColor: "transparent",
display: "flex",
alignItems: "center",
px: 1,
cursor: "pointer"
};
$[62] = t31;
$[63] = t32;
} else {
t31 = $[62];
t32 = $[63];
}
let t33;
if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
t33 = { mr: .5 };
$[64] = t33;
} else t33 = $[64];
let t34;
if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
t34 = /* @__PURE__ */ jsx(IconButton, {
size: "small",
sx: t33,
"aria-label": "Back",
children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
});
$[65] = t34;
} else t34 = $[65];
let t35;
if ($[66] !== t) {
t35 = t("Layout.Appearance");
$[66] = t;
$[67] = t35;
} else t35 = $[67];
let t36;
if ($[68] !== t35) {
t36 = /* @__PURE__ */ jsxs(ListSubheader, {
onClick: t31,
sx: t32,
children: [
t34,
" ",
t35
]
});
$[68] = t35;
$[69] = t36;
} else t36 = $[69];
let t37;
if ($[70] !== colorModes || $[71] !== mode || $[72] !== setMode) {
t37 = colorModes.map((t38) => {
const { mode: modeValue, icon: Icon, label } = t38;
return /* @__PURE__ */ jsxs(ListItemButton, {
onClick: () => {
setMode(modeValue);
closeMenu();
},
selected: mode === modeValue,
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Icon, {}) }), /* @__PURE__ */ jsx(ListItemText, { primary: label })]
}, modeValue);
});
$[70] = colorModes;
$[71] = mode;
$[72] = setMode;
$[73] = t37;
} else t37 = $[73];
let t38;
if ($[74] !== t36 || $[75] !== t37) {
t38 = /* @__PURE__ */ jsx(List, {
subheader: t36,
children: t37
});
$[74] = t36;
$[75] = t37;
$[76] = t38;
} else t38 = $[76];
theme = t38;
T0 = List;
let t39;
let t40;
if ($[77] === Symbol.for("react.memo_cache_sentinel")) {
t39 = changeTab("settings");
t40 = {
backgroundColor: "transparent",
display: "flex",
alignItems: "center",
px: 1,
cursor: "pointer"
};
$[77] = t39;
$[78] = t40;
} else {
t39 = $[77];
t40 = $[78];
}
let t41;
if ($[79] === Symbol.for("react.memo_cache_sentinel")) {
t41 = { mr: .5 };
$[79] = t41;
} else t41 = $[79];
let t42;
if ($[80] === Symbol.for("react.memo_cache_sentinel")) {
t42 = /* @__PURE__ */ jsx(IconButton, {
size: "small",
sx: t41,
"aria-label": "Back",
children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
});
$[80] = t42;
} else t42 = $[80];
let t43;
if ($[81] !== t) {
t43 = t("Layout.Language");
$[81] = t;
$[82] = t43;
} else t43 = $[82];
if ($[83] !== t43) {
t1 = /* @__PURE__ */ jsxs(ListSubheader, {
onClick: t39,
sx: t40,
children: [
t42,
" ",
t43
]
});
$[83] = t43;
$[84] = t1;
} else t1 = $[84];
t2 = supportedLanguages.map((languageCode) => /* @__PURE__ */ jsxs(ListItemButton, {
onClick: () => i18n.changeLanguage(languageCode).finally(() => closeMenu()),
selected: i18n.resolvedLanguage === languageCode,
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: i18n.resolvedLanguage === languageCode && /* @__PURE__ */ jsx(Done, {}) }), /* @__PURE__ */ jsx(ListItemText, { primary: capitalize(languageDisplayNames.of(languageCode)) })]
}, languageCode));
$[2] = i18n;
$[3] = mode;
$[4] = setMode;
$[5] = t;
$[6] = T0;
$[7] = closeMenu;
$[8] = openMenu;
$[9] = settings;
$[10] = t1;
$[11] = t2;
$[12] = theme;
} else {
T0 = $[6];
closeMenu = $[7];
openMenu = $[8];
settings = $[9];
t1 = $[10];
t2 = $[11];
theme = $[12];
}
let t3;
if ($[85] !== T0 || $[86] !== t1 || $[87] !== t2) {
t3 = /* @__PURE__ */ jsx(T0, {
subheader: t1,
children: t2
});
$[85] = T0;
$[86] = t1;
$[87] = t2;
$[88] = t3;
} else t3 = $[88];
const language = t3;
let t4;
if ($[89] !== user) {
t4 = user ? /* @__PURE__ */ jsx(UserAvatar, {}) : /* @__PURE__ */ jsx(AccountCircle, { sx: {
width: {
xs: 32,
sm: 40
},
height: {
xs: 32,
sm: 40
}
} });
$[89] = user;
$[90] = t4;
} else t4 = $[90];
let t5;
if ($[91] !== openMenu || $[92] !== t4) {
t5 = /* @__PURE__ */ jsx(IconButton, {
size: "small",
edge: "end",
onClick: openMenu,
"aria-label": "Account",
children: t4
});
$[91] = openMenu;
$[92] = t4;
$[93] = t5;
} else t5 = $[93];
let t6;
if ($[94] === Symbol.for("react.memo_cache_sentinel")) {
t6 = { width: 240 };
$[94] = t6;
} else t6 = $[94];
let t7;
if ($[95] !== t || $[96] !== user) {
t7 = /* @__PURE__ */ jsx(List, {
disablePadding: true,
children: user ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(ListItemText, {
primary: user.name,
secondary: /* @__PURE__ */ jsxs("span", { children: [
user.employeeId && /* @__PURE__ */ jsx("span", { children: user.employeeId }),
user.employeeId && /* @__PURE__ */ jsx("br", {}),
user.department && /* @__PURE__ */ jsx("span", { children: user.department })
] })
}) }), /* @__PURE__ */ jsxs(ListItemButton, {
onClick: _temp2$1,
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Logout, { color: "error" }) }), /* @__PURE__ */ jsx(ListItemText, { primary: t("Layout.Logout") })]
})] }) : /* @__PURE__ */ jsxs(ListItemButton, {
onClick: _temp3,
children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Login, { color: "success" }) }), /* @__PURE__ */ jsx(ListItemText, { primary: t("Layout.LogIn") })]
})
});
$[95] = t;
$[96] = user;
$[97] = t7;
} else t7 = $[97];
const t8 = tab === "settings" && settings;
const t9 = tab === "theme" && theme;
const t10 = tab === "language" && language;
let t11;
if ($[98] !== t10 || $[99] !== t7 || $[100] !== t8 || $[101] !== t9) {
t11 = /* @__PURE__ */ jsxs(Box, {
sx: t6,
children: [
t7,
t8,
t9,
t10
]
});
$[98] = t10;
$[99] = t7;
$[100] = t8;
$[101] = t9;
$[102] = t11;
} else t11 = $[102];
let t12;
if ($[103] !== anchorElement || $[104] !== closeMenu || $[105] !== open || $[106] !== t11) {
t12 = /* @__PURE__ */ jsx(Menu, {
anchorEl: anchorElement,
open,
onClose: closeMenu,
children: t11
});
$[103] = anchorElement;
$[104] = closeMenu;
$[105] = open;
$[106] = t11;
$[107] = t12;
} else t12 = $[107];
let t13;
if ($[108] !== t12 || $[109] !== t5) {
t13 = /* @__PURE__ */ jsxs(Fragment, { children: [t5, t12] });
$[108] = t12;
$[109] = t5;
$[110] = t13;
} else t13 = $[110];
return t13;
};
function _temp$4(lng) {
return lng !== "cimode";
}
function _temp2$1() {
location.href = "/auth/logout";
}
function _temp3() {
const returnTo = location.pathname + location.search;
location.href = `/auth/login?returnTo=${encodeURIComponent(returnTo)}`;
}
//#endregion
//#region src/components/core/AppTitle.tsx
const PRODUCTION_ENV = "PRD";
const getEnv = (url) => z$1.string().refine((u) => u.split("-").length > 2).transform((u) => u.split("-")[2].toUpperCase()).catch("LOCALHOST").parse(url);
const AppTitle = () => {
const $ = c(11);
if ($[0] !== "bd3c5946448524a870dd72716719eb2a5d917534df698ee34ab3e1e82fc695e4") {
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "bd3c5946448524a870dd72716719eb2a5d917534df698ee34ab3e1e82fc695e4";
}
const router = useRouter();
let t0;
if ($[1] !== router.origin) {
t0 = getEnv(router.origin);
$[1] = router.origin;
$[2] = t0;
} else t0 = $[2];
const env = t0;
const isProduction = env === PRODUCTION_ENV;
let t1;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t1 = {
alignItems: "center",
flexGrow: 1
};
$[3] = t1;
} else t1 = $[3];
let t2;
let t3;
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
t2 = /* @__PURE__ */ jsx(RouterIconButton, {
to: "/",
size: "small",
children: /* @__PURE__ */ jsx("img", {
src: "/favicon-32x32.png",
alt: clientEnv.VITE_APP_TITLE,
loading: "lazy"
})
});
t3 = /* @__PURE__ */ jsx(Typography, {
variant: "h6",
children: clientEnv.VITE_APP_TITLE
});
$[4] = t2;
$[5] = t3;
} else {
t2 = $[4];
t3 = $[5];
}
let t4;
if ($[6] !== env || $[7] !== isProduction) {
t4 = !isProduction && /* @__PURE__ */ jsx(Chip, {
size: "small",
label: env,
color: "primary"
});
$[6] = env;
$[7] = isProduction;
$[8] = t4;
} else t4 = $[8];
let t5;
if ($[9] !== t4) {
t5 = /* @__PURE__ */ jsxs(Stack, {
direction: "row",
spacing: 1,
sx: t1,
children: [
t2,
t3,
t4
]
});
$[9] = t4;
$[10] = t5;
} else t5 = $[10];
return t5;
};
//#endregion
//#region src/models/Navigation.ts
const isPageItem = (item) => item.kind === "item";
const isPageGroup = (item) => item.kind === "group";
const isDivider = (item) => item.kind === "divider";
const isHeader = (item) => item.kind === "header";
//#endregion
//#region src/components/core/navigation/NavigationListItem.tsx
const ICON_SIZE = 34;
const getSelectedColor = (theme) => theme.vars?.palette.primary.dark ?? theme.palette.primary.dark;
const getActionActiveColor = (theme) => theme.vars?.palette.action.active ?? theme.palette.action.active;
const StyledNavButton = styled(ListItemButton$1)(({ theme }) => ({
borderRadius: Number(theme.shape.borderRadius) * 2,
"&.Mui-selected": {
"& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": { color: getSelectedColor(theme) },
"& .MuiAvatar-root": { backgroundColor: getSelectedColor(theme) },
"& .MuiTouchRipple-child": { backgroundColor: getSelectedColor(theme) }
},
"& .MuiSvgIcon-root": { color: getActionActiveColor(theme) },
"& .MuiAvatar-root": { backgroundColor: getActionActiveColor(theme) }
}));
const routerButtonSx = (theme) => ({
borderRadius: 2,
"&.Mui-selected": {
"& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": { color: getSelectedColor(theme) },
"& .MuiAvatar-root": { backgroundColor: getSelectedColor(theme) },
"& .MuiTouchRipple-child": { backgroundColor: getSelectedColor(theme) }
},
"& .MuiSvgIcon-root": { color: getActionActiveColor(theme) },
"& .MuiAvatar-root": { backgroundColor: getActionActiveColor(theme) }
});
const IconOrAvatar = (t0) => {
const $ = c(18);
if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
}
const { item, collapsed } = t0;
if (item.icon || collapsed) {
let t1;
if ($[1] !== collapsed) {
t1 = collapsed ? {
position: "absolute",
left: "50%",
top: "calc(50% - 6px)",
transform: "translate(-50%, -50%)"
} : {};
$[1] = collapsed;
$[2] = t1;
} else t1 = $[2];
let t2;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t2 = {
display: "flex",
alignItems: "center",
justifyContent: "center",
minWidth: ICON_SIZE
};
$[3] = t2;
} else t2 = $[3];
const t3 = item.icon ?? null;
let t4;
if ($[4] !== collapsed || $[5] !== item.icon || $[6] !== item.title) {
t4 = !item.icon && collapsed ? /* @__PURE__ */ jsx(Avatar$1, {
sx: {
width: ICON_SIZE - 7,
height: ICON_SIZE - 7,
fontSize: 12
},
children: item.title.split(" ").slice(0, 2).map(_temp$3).join("")
}) : null;
$[4] = collapsed;
$[5] = item.icon;
$[6] = item.title;
$[7] = t4;
} else t4 = $[7];
let t5;
if ($[8] !== t3 || $[9] !== t4) {
t5 = /* @__PURE__ */ jsxs(ListItemIcon$1, {
sx: t2,
children: [t3, t4]
});
$[8] = t3;
$[9] = t4;
$[10] = t5;
} else t5 = $[10];
let t6;
if ($[11] !== collapsed || $[12] !== item.title) {
t6 = collapsed ? /* @__PURE__ */ jsx(Typography$1, {
variant: "caption",
sx: {
position: "absolute",
bottom: -18,
left: "50%",
transform: "translateX(-50%)",
fontSize: 10,
fontWeight: 500,
textAlign: "center",
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
maxWidth: 56
},
children: item.title
}) : null;
$[11] = collapsed;
$[12] = item.title;
$[13] = t6;
} else t6 = $[13];
let t7;
if ($[14] !== t1 || $[15] !== t5 || $[16] !== t6) {
t7 = /* @__PURE__ */ jsxs(Box$1, {
sx: t1,
children: [t5, t6]
});
$[14] = t1;
$[15] = t5;
$[16] = t6;
$[17] = t7;
} else t7 = $[17];
return t7;
}
return null;
};
const MiniPopover = (t0) => {
const $ = c(8);
if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
}
const { open, children } = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = {
position: "fixed",
left: 84,
pl: "2px",
pb: "10px"
};
$[1] = t1;
} else t1 = $[1];
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = {
pt: .5,
pb: .5,
transform: "translateY(calc(50% - 30px))",
maxHeight: "min(calc(100vh - 100px), 560px)",
overflowY: "auto",
overscrollBehavior: "contain"
};
$[2] = t2;
} else t2 = $[2];
let t3;
if ($[3] !== children) {
t3 = /* @__PURE__ */ jsx(Box$1, {
sx: t1,
children: /* @__PURE__ */ jsx(Paper, {
sx: t2,
children
})
});
$[3] = children;
$[4] = t3;
} else t3 = $[4];
let t4;
if ($[5] !== open || $[6] !== t3) {
t4 = /* @__PURE__ */ jsx(Grow, {
in: open,
children: t3
});
$[5] = open;
$[6] = t3;
$[7] = t4;
} else t4 = $[7];
return t4;
};
const NavigationListItem = (t0) => {
const $ = c(62);
if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
for (let $i = 0; $i < 62; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
}
const { item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded: t1, isSidebarFullyCollapsed, onClick, renderNested, onClose } = t0;
const isSidebarFullyExpanded = t1 === void 0 ? true : t1;
const [hoveredMiniItemId, setHoveredMiniItemId] = useState(null);
let t2;
if ($[1] !== item) {
t2 = isPageGroup(item);
$[1] = item;
$[2] = t2;
} else t2 = $[2];
const groupItem = t2;
const itemId = groupItem ? `group-${item.title}` : `item-${item.to ?? item.href ?? item.title}`;
let t3;
if ($[3] !== collapsed || $[4] !== groupItem || $[5] !== isOpen || $[6] !== isSidebarFullyCollapsed || $[7] !== isSidebarFullyExpanded) {
t3 = (theme) => {
if (collapsed && isSidebarFullyCollapsed && groupItem) return {
fontSize: 18,
position: "absolute",
top: "41.5%",
right: "2px",
transform: "translateY(-50%) rotate(-90deg)"
};
if (!collapsed && isSidebarFullyExpanded && groupItem) return {
ml: .5,
transform: `rotate(${isOpen ? 0 : -90}deg)`,
transition: theme.transitions.create("transform", {
easing: theme.transitions.easing.sharp,
duration: 100
})
};
return { display: "none" };
};
$[3] = collapsed;
$[4] = groupItem;
$[5] = isOpen;
$[6] = isSidebarFullyCollapsed;
$[7] = isSidebarFullyExpanded;
$[8] = t3;
} else t3 = $[8];
const chevronSx = t3;
const shouldJustExpand = groupItem && !collapsed;
const t4 = collapsed ? 60 : 48;
let t5;
if ($[9] !== t4) {
t5 = {
px: 1.4,
height: t4
};
$[9] = t4;
$[10] = t5;
} else t5 = $[10];
let t6;
if ($[11] !== disabled || $[12] !== selected || $[13] !== t5) {
t6 = {
selected,
disabled,
sx: t5
};
$[11] = disabled;
$[12] = selected;
$[13] = t5;
$[14] = t6;
} else t6 = $[14];
const buttonProps = t6;
let t7;
if ($[15] !== collapsed || $[16] !== item) {
t7 = /* @__PURE__ */ jsx(IconOrAvatar, {
item,
collapsed
});
$[15] = collapsed;
$[16] = item;
$[17] = t7;
} else t7 = $[17];
let t8;
if ($[18] !== collapsed || $[19] !== item.title) {
t8 = !collapsed && /* @__PURE__ */ jsx(ListItemText$1, {
primary: item.title,
slotProps: { primary: {
noWrap: true,
title: item.title
} },
sx: {
ml: 1.2,
flex: 1,
minWidth: 0,
"& .MuiTypography-root": {
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis"
}
}
});
$[18] = collapsed;
$[19] = item.title;
$[20] = t8;
} else t8 = $[20];
let t9;
if ($[21] !== chevronSx || $[22] !== groupItem) {
t9 = groupItem ? /* @__PURE__ */ jsx(ExpandMoreIcon, { sx: chevronSx }) : null;
$[21] = chevronSx;
$[22] = groupItem;
$[23] = t9;
} else t9 = $[23];
let t10;
if ($[24] !== t7 || $[25] !== t8 || $[26] !== t9) {
t10 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
t7,
t8,
t9
] });
$[24] = t7;
$[25] = t8;
$[26] = t9;
$[27] = t10;
} else t10 = $[27];
const buttonContent = t10;
let t11;
if ($[28] !== collapsed || $[29] !== groupItem || $[30] !== itemId) {
t11 = groupItem && collapsed ? {
onMouseEnter: () => {
setHoveredMiniItemId(itemId);
},
onMouseLeave: () => {
setHoveredMiniItemId(null);
}
} : {};
$[28] = collapsed;
$[29] = groupItem;
$[30] = itemId;
$[31] = t11;
} else t11 = $[31];
let t12;
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
t12 = {
py: 0,
px: 1,
overflowX: "hidden"
};
$[32] = t12;
} else t12 = $[32];
let t13;
if ($[33] !== buttonContent || $[34] !== buttonProps || $[35] !== groupItem || $[36] !== item || $[37] !== onClick || $[38] !== onClose || $[39] !== shouldJustExpand) {
t13 = groupItem ? /* @__PURE__ */ jsx(StyledNavButton, {
...buttonProps,
onClick: shouldJustExpand ? () => onClick?.(item) : void 0,
children: buttonContent
}) : /* @__PURE__ */ jsx(RouterListItemButton, {
...buttonProps,
to: item.to,
href: item.href,
params: item.params,
search: item.search,
onClick: onClose,
sx: [buttonProps.sx, routerButtonSx],
children: buttonContent
});
$[33] = buttonContent;
$[34] = buttonProps;
$[35] = groupItem;
$[36] = item;
$[37] = onClick;
$[38] = onClose;
$[39] = shouldJustExpand;
$[40] = t13;
} else t13 = $[40];
let t14;
if ($[41] !== collapsed || $[42] !== groupItem || $[43] !== hoveredMiniItemId || $[44] !== item.children || $[45] !== itemId || $[46] !== renderNested) {
t14 = groupItem && collapsed ? /* @__PURE__ */ jsx(MiniPopover, {
open: itemId === hoveredMiniItemId,
children: renderNested?.(item.children)
}) : null;
$[41] = collapsed;
$[42] = groupItem;
$[43] = hoveredMiniItemId;
$[44] = item.children;
$[45] = itemId;
$[46] = renderNested;
$[47] = t14;
} else t14 = $[47];
let t15;
if ($[48] !== t11 || $[49] !== t13 || $[50] !== t14) {
t15 = /* @__PURE__ */ jsxs(ListItem$1, {
...t11,
sx: t12,
children: [t13, t14]
});
$[48] = t11;
$[49] = t13;
$[50] = t14;
$[51] = t15;
} else t15 = $[51];
const listItem = t15;
let t16;
if ($[52] !== collapsed || $[53] !== groupItem || $[54] !== isOpen || $[55] !== item.children || $[56] !== renderNested) {
t16 = groupItem && !collapsed ? /* @__PURE__ */ jsx(Collapse, {
in: isOpen,
timeout: "auto",
unmountOnExit: true,
children: renderNested?.(item.children)
}) : null;
$[52] = collapsed;
$[53] = groupItem;
$[54] = isOpen;
$[55] = item.children;
$[56] = renderNested;
$[57] = t16;
} else t16 = $[57];
let t17;
if ($[58] !== itemId || $[59] !== listItem || $[60] !== t16) {
t17 = /* @__PURE__ */ jsxs(Fragment, { children: [listItem, t16] }, itemId);
$[58] = itemId;
$[59] = listItem;
$[60] = t16;
$[61] = t17;
} else t17 = $[61];
return t17;
};
function _temp$3(word) {
return word.charAt(0).toUpperCase();
}
//#endregion
//#region src/components/core/navigation/NavigationList.tsx
const NavigationList = (t0) => {
const $ = c(29);
if ($[0] !== "4dbd114545118530db002b7c781f97683277f7b721a30074e8778a8e4ea56119") {
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "4dbd114545118530db002b7c781f97683277f7b721a30074e8778a8e4ea56119";
}
const { subNavigation, depth: t1, collapsed, isPopover, isSidebarFullyExpanded: t2, isSidebarFullyCollapsed, renderItem, activePath, onClose } = t0;
const depth = t1 === void 0 ? 0 : t1;
const isSidebarFullyExpanded = t2 === void 0 ? true : t2;
let t3;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t3 = [];
$[1] = t3;
} else t3 = $[1];
const [openKeys, setOpenKeys] = useState(t3);
let t4;
let t5;
if ($[2] !== collapsed) {
t4 = () => {
if (collapsed) setOpenKeys([]);
};
t5 = [collapsed];
$[2] = collapsed;
$[3] = t4;
$[4] = t5;
} else {
t4 = $[3];
t5 = $[4];
}
useEffect(t4, t5);
let t6;
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
t6 = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
$[5] = t6;
} else t6 = $[5];
const toggleKey = t6;
let t7;
if ($[6] !== activePath || $[7] !== collapsed || $[8] !== depth || $[9] !== onClose) {
t7 = (children) => /* @__PURE__ */ jsx(NavigationList, {
subNavigation: children,
depth: depth + 1,
isPopover: collapsed,
activePath,
onClose
});
$[6] = activePath;
$[7] = collapsed;
$[8] = depth;
$[9] = onClose;
$[10] = t7;
} else t7 = $[10];
const renderNested = t7;
let t8;
if ($[11] !== activePath || $[12] !== collapsed || $[13] !== depth || $[14] !== isPopover || $[15] !== isSidebarFullyCollapsed || $[16] !== isSidebarFullyExpanded || $[17] !== onClose || $[18] !== openKeys || $[19] !== renderItem || $[20] !== renderNested || $[21] !== subNavigation) {
const filteredNavigation = subNavigation.filter(_temp$2);
const t9 = isPopover && depth === 1 ? .5 : 0;
const t10 = depth === 0 && !isPopover ? 4 : .5;
const t11 = (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth);
const t12 = isPopover && depth === 1 ? 240 : "auto";
const t13 = collapsed ? 84 : "auto";
let t14;
if ($[23] !== t10 || $[24] !== t11 || $[25] !== t12 || $[26] !== t13 || $[27] !== t9) {
t14 = {
padding: 0,
mt: t9,
mb: t10,
pl: t11,
minWidth: t12,
width: t13
};
$[23] = t10;
$[24] = t11;
$[25] = t12;
$[26] = t13;
$[27] = t9;
$[28] = t14;
} else t14 = $[28];
t8 = /* @__PURE__ */ jsx(List$1, {
sx: t14,
children: filteredNavigation.map((navItem, index) => {
if (isHeader(navItem)) return /* @__PURE__ */ jsx(ListSubheader$1, {
sx: {
fontSize: 12,
fontWeight: "700",
height: collapsed ? 0 : 40,
px: 2,
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
zIndex: 2,
bgcolor: "transparent",
position: "static"
},
children: navItem.title
}, `subheader-${depth}-${index}`);
if (isDivider(navItem)) {
const nextItem = filteredNavigation[index + 1];
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Divider$1, { sx: {
mx: 1,
mt: 1,
mb: nextItem && isHeader(nextItem) && !collapsed ? 0 : 1
} }) }, `divider-${depth}-${index}`);
}
if (!isPageItem(navItem) && !isPageGroup(navItem)) return null;
const key_0 = `item-${depth}-${index}`;
const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
const selected = isPageItem(navItem) && navItem.to === activePath;
if (renderItem) return /* @__PURE__ */ jsx(Fragment, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key_0);
return /* @__PURE__ */ jsx(NavigationListItem, {
item: navItem,
isOpen: openKeys.includes(uniqueItemKey),
selected,
collapsed,
isSidebarFullyExpanded,
isSidebarFullyCollapsed,
onClick: isPageGroup(navItem) && !collapsed ? () => toggleKey(uniqueItemKey) : void 0,
renderNested,
onClose
}, key_0);
})
});
$[11] = activePath;
$[12] = collapsed;
$[13] = depth;
$[14] = isPopover;
$[15] = isSidebarFullyCollapsed;
$[16] = isSidebarFullyExpanded;
$[17] = onClose;
$[18] = openKeys;
$[19] = renderItem;
$[20] = renderNested;
$[21] = subNavigation;
$[22] = t8;
} else t8 = $[22];
return t8;
};
function _temp$2(nav) {
return !nav.hidden;
}
//#endregion
//#region src/components/core/navigation/NavigationContent.tsx
const NavigationContent = (t0) => {
const $ = c(17);
if ($[0] !== "8e18ca51999228f0bb12ab188e0dd8177eed75d44b84d25a0355fb537f5fdbd1") {
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "8e18ca51999228f0bb12ab188e0dd8177eed75d44b84d25a0355fb537f5fdbd1";
}
const { navigation, collapsed, expanded, setExpanded, showPermanent } = t0;
const location = useLocation();
const t1 = collapsed ? "stable" : "auto";
const t2 = navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2;
let t3;
if ($[1] !== t1 || $[2] !== t2) {
t3 = {
height: "100%",
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
overflow: "auto",
scrollbarGutter: t1,
overflowX: "hidden",
pt: t2
};
$[1] = t1;
$[2] = t2;
$[3] = t3;
} else t3 = $[3];
const t4 = !expanded;
let t5;
if ($[4] !== setExpanded || $[5] !== showPermanent) {
t5 = showPermanent ? void 0 : () => setExpanded(false);
$[4] = setExpanded;
$[5] = showPermanent;
$[6] = t5;
} else t5 = $[6];
let t6;
if ($[7] !== collapsed || $[8] !== expanded || $[9] !== location.pathname || $[10] !== navigation || $[11] !== t4 || $[12] !== t5) {
t6 = /* @__PURE__ */ jsx(NavigationList, {
subNavigation: navigation,
collapsed,
isSidebarFullyExpanded: expanded,
isSidebarFullyCollapsed: t4,
activePath: location.pathname,
onClose: t5
});
$[7] = collapsed;
$[8] = expanded;
$[9] = location.pathname;
$[10] = navigation;
$[11] = t4;
$[12] = t5;
$[13] = t6;
} else t6 = $[13];
let t7;
if ($[14] !== t3 || $[15] !== t6) {
t7 = /* @__PURE__ */ jsx(Box$1, {
component: "nav",
sx: t3,
children: t6
});
$[14] = t3;
$[15] = t6;
$[16] = t7;
} else t7 = $[16];
return t7;
};
const NavigationRail = (t0) => {
const $ = c(29);
if ($[0] !== "49d079c05318eb36fa341a571be66f2c7d983f06018386e081b42f162f58e4e6") {
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "49d079c05318eb36fa341a571be66f2c7d983f06018386e081b42f162f58e4e6";
}
const { navigation, expanded, setExpanded } = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = {
xs: "none",
sm: "block"
};
$[1] = t1;
} else t1 = $[1];
const t2 = expanded ? 320 : 84;
let t3;
if ($[2] !== expanded) {
t3 = (theme) => ({
position: "absolute",
top: `64px`,
height: `calc(100% - 64px)`,
width: expanded ? 320 : 84,
background: "transparent",
borderTop: "1px solid",
borderColor: theme.vars?.palette.divider ?? theme.palette.divider,
boxShadow: "none"
});
$[2] = expanded;
$[3] = t3;
} else t3 = $[3];
let t4;
if ($[4] !== t2 || $[5] !== t3) {
t4 = {
display: t1,
width: t2,
"& .MuiDrawer-paper": t3
};
$[4] = t2;
$[5] = t3;
$[6] = t4;
} else t4 = $[6];
const t5 = !expanded;
let t6;
if ($[7] !== expanded || $[8] !== navigation || $[9] !== setExpanded || $[10] !== t5) {
t6 = /* @__PURE__ */ jsx(NavigationContent, {
navigation,
collapsed: t5,
expanded,
setExpanded,
showPermanent: true
});
$[7] = expanded;
$[8] = navigation;
$[9] = setExpanded;
$[10] = t5;
$[11] = t6;
} else t6 = $[11];
let t7;
if ($[12] !== t4 || $[13] !== t6) {
t7 = /* @__PURE__ */ jsx(Drawer, {
variant: "permanent",
sx: t4,
children: t6
});
$[12] = t4;
$[13] = t6;
$[14] = t7;
} else t7 = $[14];
let t8;
if ($[15] !== setExpanded) {
t8 = () => setExpanded(false);
$[15] = setExpanded;
$[16] = t8;
} else t8 = $[16];
let t9;
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
t9 = {
display: {
xs: "block",
sm: "none"
},
"& .MuiDrawer-paper": { width: "min(280px, calc(100vw - 56px))" }
};
$[17] = t9;
} else t9 = $[17];
let t10;
if ($[18] !== expanded || $[19] !== navigation || $[20] !== setExpanded) {
t10 = /* @__PURE__ */ jsx(NavigationContent, {
navigation,
collapsed: false,
expanded,
setExpanded,
showPermanent: false
});
$[18] = expanded;
$[19] = navigation;
$[20] = setExpanded;
$[21] = t10;
} else t10 = $[21];
let t11;
if ($[22] !== expanded || $[23] !== t10 || $[24] !== t8) {
t11 = /* @__PURE__ */ jsx(Drawer, {
open: expanded,
onClose: t8,
sx: t9,
children: t10
});
$[22] = expanded;
$[23] = t10;
$[24] = t8;
$[25] = t11;
} else t11 = $[25];
let t12;
if ($[26] !== t11 || $[27] !== t7) {
t12 = /* @__PURE__ */ jsxs(Fragment, { children: [t7, t11] });
$[26] = t11;
$[27] = t7;
$[28] = t12;
} else t12 = $[28];
return t12;
};
//#endregion
//#region src/components/core/Layout.tsx
const NAVIGATION_STORAGE_KEY = "navigation-open";
const getInitialNavigationOpen = () => {
if (Platform.isWindows || Platform.isMacOS) return localStorage.getItem(NAVIGATION_STORAGE_KEY) === "true";
return false;
};
const saveNavigationState = (value) => {
if (Platform.isWindows || Platform.isMacOS) localStorage.setItem(NAVIGATION_STORAGE_KEY, String(value));
};
const DrawerHeader = styled("div")(({ theme }) => ({
display: "flex",
alignItems: "center",
justifyContent: "flex-end",
padding: theme.spacing(0, 1),
...theme.mixins.toolbar
}));
const Layout = (t0) => {
const $ = c(30);
if ($[0] !== "762fd30288141ebde9b222f2752e7a1ea9ea2b557ae18d6fd43b2c8be06efd53") {
for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "762fd30288141ebde9b222f2752e7a1ea9ea2b557ae18d6fd43b2c8be06efd53";
}
const { navigation, options, children } = t0;
const [navigationOpen, setNavigationOpen] = useState(false);
let t1;
if ($[1] !== navigation) {
t1 = navigation?.some(_temp$1);
$[1] = navigation;
$[2] = t1;
} else t1 = $[2];
const showNavigation = t1;
const showShell = options?.showShell ?? true;
let t2;
let t3;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t2 = () => {
if (getInitialNavigationOpen()) setNavigationOpen(true);
};
t3 = [];
$[3] = t2;
$[4] = t3;
} else {
t2 = $[3];
t3 = $[4];
}
useEffect(t2, t3);
let t4;
let t5;
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
t4 = /* @__PURE__ */ jsx(InitColorSchemeScript, {});
t5 = /* @__PURE__ */ jsx(CssBaseline, {});
$[5] = t4;
$[6] = t5;
} else {
t4 = $[5];
t5 = $[6];
}
let t6;
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
t6 = {
display: "flex",
height: "100dvh",
maxHeight: "100dvh",
overflow: "hidden",
width: "100%"
};
$[7] = t6;
} else t6 = $[7];
let t7;
if ($[8] !== navigationOpen || $[9] !== showNavigation || $[10] !== showShell) {
t7 = showShell && /* @__PURE__ */ jsx(AppBar, {
color: "transparent",
position: "fixed",
sx: {
borderBottom: "1px solid",
borderColor: "var(--mui-palette-divider)",
boxShadow: "none"
},
children: /* @__PURE__ */ jsxs(Toolbar, { children: [
showNavigation && /* @__PURE__ */ jsx(IconButton, {
"aria-label": "Toggle navigation",
onClick: () => {
setNavigationOpen(_temp2);
},
sx: { marginRight: 2 },
children: navigationOpen ? /* @__PURE__ */ jsx(MenuOpen, {}) : /* @__PURE__ */ jsx(Menu$1, {})
}),
/* @__PURE__ */ jsx(AppTitle, {}),
/* @__PURE__ */ jsx(ToolbarAccount, {})
] })
});
$[8] = navigationOpen;
$[9] = showNavigation;
$[10] = showShell;
$[11] = t7;
} else t7 = $[11];
let t8;
if ($[12] !== navigation || $[13] !== navigationOpen || $[14] !== showNavigation || $[15] !== showShell) {
t8 = showNavigation && showShell && /* @__PURE__ */ jsx(NavigationRail, {
navigation,
expanded: navigationOpen,
setExpanded: (newValue_0) => {
setNavigationOpen(newValue_0);
saveNavigationState(newValue_0);
}
});
$[12] = navigation;
$[13] = navigationOpen;
$[14] = showNavigation;
$[15] = showShell;
$[16] = t8;
} else t8 = $[16];
let t9;
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
t9 = {
flexGrow: 1,
display: "flex",
flexDirection: "column",
minWidth: 0,
height: "100%",
overflow: "hidden"
};
$[17] = t9;
} else t9 = $[17];
let t10;
if ($[18] !== showShell) {
t10 = showShell && /* @__PURE__ */ jsx(DrawerHeader, {});
$[18] = showShell;
$[19] = t10;
} else t10 = $[19];
let t11;
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
t11 = {
flex: 1,
overflow: "auto",
position: "relative"
};
$[20] = t11;
} else t11 = $[20];
let t12;
if ($[21] !== children) {
t12 = /* @__PURE__ */ jsx(Box, {
sx: t11,
children
});
$[21] = children;
$[22] = t12;
} else t12 = $[22];
let t13;
if ($[23] !== t10 || $[24] !== t12) {
t13 = /* @__PURE__ */ jsxs(Box, {
component: "main",
sx: t9,
children: [t10, t12]
});
$[23] = t10;
$[24] = t12;
$[25] = t13;
} else t13 = $[25];
let t14;
if ($[26] !== t13 || $[27] !== t7 || $[28] !== t8) {
t14 = /* @__PURE__ */ jsxs(Fragment, { children: [
t4,
t5,
/* @__PURE__ */ jsxs(Box, {
sx: t6,
children: [
t7,
t8,
t13
]
})
] });
$[26] = t13;
$[27] = t7;
$[28] = t8;
$[29] = t14;
} else t14 = $[29];
return t14;
};
function _temp$1(item) {
return item.hidden !== true;
}
function _temp2(previous) {
const newValue = !previous;
saveNavigationState(newValue);
return newValue;
}
//#endregion
//#region src/providers/DialogsProvider.tsx
function DialogsProvider({ children }) {
const [stack, setStack] = useState([]);
const keyPrefix = useId();
const nextId = useRef(0);
const dialogMetadata = useRef(/* @__PURE__ */ new WeakMap());
const requestDialog = useEventCallback$1(function open(Component, payload, options = {}) {
const { onClose = async () => {} } = options;
let resolve;
const promise = new Promise((resolveImpl) => {
resolve = resolveImpl;
});
const key = `${keyPrefix}-${nextId.current}`;
nextId.current += 1;
const newEntry = {
key,
open: true,
promise,
Component,
payload,
onClose,
resolve
};
dialogMetadata.current.set(promise, newEntry);
setStack((previousStack) => [...previousStack, newEntry]);
return promise;
});
const removeDialogFromStack = (dialog) => {
setStack((previousStack_0) => previousStack_0.filter((entry) => entry.promise !== dialog));
dialogMetadata.current.delete(dialog);
};
const closeDialogUi = useEventCallback$1(function closeDialogUi(dialog_0) {
setStack((previousStack_1) => previousStack_1.map((entry_0) => entry_0.promise === dialog_0 ? {
...entry_0,
open: false
} : entry_0));
setTimeout(() => removeDialogFromStack(dialog_0), 1e3);
});
const closeDialog = useEventCallback$1(async function closeDialog(dialog_1, result) {
const entryToClose = dialogMetadata.current.get(dialog_1);
if (!entryToClose) throw new Error("Dialog not found in stack");
try {
await entryToClose.onClose(result);
} finally {
entryToClose.resolve(result);
closeDialogUi(dialog_1);
}
return dialog_1;
});
return /* @__PURE__ */ jsxs(DialogsContext.Provider, {
value: {
open: requestDialog,
close: closeDialog
},
children: [children, stack.map(({ key: key_0, open, Component: Component_0, payload: payload_0, promise: promise_0 }) => /* @__PURE__ */ jsx(Component_0, {
payload: payload_0,
open,
onClose: async (result_0) => {
await closeDialog(promise_0, result_0);
}
}, key_0))]
});
}
//#endregion
//#region src/providers/NotificationProvider.tsx
const STACK_INTERVAL = 1e3;
const NotificationProvider = (t0) => {
const $ = c(22);
if ($[0] !== "aeeb800673c818aa8dd113658f5d8c31d4fe124c64515dc70b2cce8523de5a50") {
for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "aeeb800673c818aa8dd113658f5d8c31d4fe124c64515dc70b2cce8523de5a50";
}
const { children, snackbarOrigin } = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = [];
$[1] = t1;
} else t1 = $[1];
const [queue, setQueue] = useState(t1);
const [current, setCurrent] = useState(null);
const open = Boolean(current);
const processingTimeout = useRef(null);
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = () => {
setQueue((prevQueue) => {
if (prevQueue.length === 0) return prevQueue;
const [next, ...rest] = prevQueue;
setCurrent(next);
return rest;
});
};
$[2] = t2;
} else t2 = $[2];
const processQueue = t2;
let t3;
let t4;
if ($[3] !== current || $[4] !== open || $[5] !== queue.length) {
t3 = () => {
if (!open && queue.length > 0) processingTimeout.current = setTimeout(processQueue, current ? STACK_INTERVAL : 0);
return () => {
if (processingTimeout.current) clearTimeout(processingTimeout.current);
};
};
t4 = [
open,
queue.length,
current
];
$[3] = current;
$[4] = open;
$[5] = queue.length;
$[6] = t3;
$[7] = t4;
} else {
t3 = $[6];
t4 = $[7];
}
useEffect(t3, t4);
let t5;
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
t5 = (message, options) => {
const notification = {
message,
severity: options?.severity,
autoHideDuration: options?.autoHideDuration ?? 5e3
};
setQueue((prev) => [...prev, notification]);
};
$[8] = t5;
} else t5 = $[8];
const notify = t5;
let t6;
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
t6 = { notify };
$[9] = t6;
} else t6 = $[9];
const t7 = current?.autoHideDuration;
let t8;
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
t8 = (_event, reason) => {
if (reason === "clickaway") return;
setCurrent(null);
};
$[10] = t8;
} else t8 = $[10];
const t9 = current?.message;
let t10;
if ($[11] !== current) {
t10 = current?.severity ? /* @__PURE__ */ jsx(Alert, {
onClose: () => setCurrent(null),
severity: current.severity,
variant: "filled",
children: current.message
}) : void 0;
$[11] = current;
$[12] = t10;
} else t10 = $[12];
let t11;
if ($[13] !== open || $[14] !== snackbarOrigin || $[15] !== t10 || $[16] !== t7 || $[17] !== t9) {
t11 = /* @__PURE__ */ jsx(Snackbar, {
open,
autoHideDuration: t7,
onClose: t8,
anchorOrigin: snackbarOrigin,
message: t9,
children: t10
});
$[13] = open;
$[14] = snackbarOrigin;
$[15] = t10;
$[16] = t7;
$[17] = t9;
$[18] = t11;
} else t11 = $[18];
let t12;
if ($[19] !== children || $[20] !== t11) {
t12 = /* @__PURE__ */ jsxs(NotificationContext, {
value: t6,
children: [children, t11]
});
$[19] = children;
$[20] = t11;
$[21] = t12;
} else t12 = $[21];
return t12;
};
//#endregion
//#region src/providers/LayoutProvider.tsx
const YEAR_IN_MINUTES = 1440 * 365;
const setLocale = (language) => {
z$1.config(z$1.core.locales[language]());
dayjs.locale(language);
};
await i18n.use(LanguageDetector).use(initReactI18next).init({
resources,
fallbackLng: "en",
supportedLngs: Object.keys(resources),
detection: {
caches: ["cookie"],
cookieMinutes: YEAR_IN_MINUTES
},
interpolation: { escapeValue: fals