wcz-layout
Version:
1,830 lines • 56.6 kB
JavaScript
import { d as getUser, f as pca, l as TanStackNavigationClient, n as WISTRON_PRIMARY_COLOR, p as clientEnv, r as WISTRON_SECONDARY_COLOR, s as rootRouteHead, t as Platform, u as getAccessToken } from "./utils-CqQKSaSs.js";
import { t as queryClient } from "./queryClient-CAJR3qjE.js";
import { n as RouterIconButton, t as RouterListItemButton } from "./RouterListItemButton-rcdkgOXQ.js";
import { t as DialogsContext } from "./DialogsContext-D5A8xncJ.js";
import { t as NotificationContext } from "./NotificationContext-DBTYc5z-.js";
import { c } from "react/compiler-runtime";
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";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import dayjs from "dayjs";
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import { Fragment, useEffect, useId, useRef, useState } from "react";
import { initReactI18next, useTranslation } from "react-i18next";
import { resources } from "virtual:wcz-layout";
import * as z$2 from "zod";
import z$1 from "zod";
import { EventType, InteractionStatus, InteractionType } from "@azure/msal-browser";
import { AuthenticatedTemplate, MsalAuthenticationTemplate, MsalProvider, UnauthenticatedTemplate, useMsal } from "@azure/msal-react";
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, useMatches, useNavigate, useRouter } from "@tanstack/react-router";
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 { createCollection, useLiveSuspenseQuery } from "@tanstack/react-db";
import { queryCollectionOptions } from "@tanstack/query-db-collection";
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/lib/db/collections/userCollection.ts
const api = axios.create({ baseURL: "https://graph.microsoft.com/v1.0" });
api.interceptors.request.use(async (config) => {
const accessToken = await getAccessToken("graph");
config.headers.set("Authorization", `Bearer ${accessToken}`);
return config;
});
const userPhotoSchema = z$2.object({
id: z$2.string(),
photoUrl: z$2.string()
});
const fetchProfilePhoto = async () => {
const response = await api.get("/me/photo/$value", { responseType: "arraybuffer" });
return [{
id: "me",
photoUrl: `data:image/jpeg;base64,${btoa(new Uint8Array(response.data).reduce((data, byte) => data + String.fromCodePoint(byte), ""))}`
}];
};
const userPhotoCollection = createCollection(queryCollectionOptions({
queryKey: [
"graph",
"me",
"photo"
],
schema: userPhotoSchema,
queryFn: fetchProfilePhoto,
getKey: (item) => item.id,
queryClient,
staleTime: Infinity,
gcTime: Infinity
}));
//#endregion
//#region src/components/core/account/UserAvatar.tsx
const UserAvatar = () => {
const $ = c(4);
if ($[0] !== "fe87d0a8f8e6330656e92b7b39ef1fd103fc722be844f8e953943b9b908d05c3") {
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "fe87d0a8f8e6330656e92b7b39ef1fd103fc722be844f8e953943b9b908d05c3";
}
const { data } = useLiveSuspenseQuery(_temp$5);
const t0 = data?.photoUrl;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = {
width: {
xs: 32,
sm: 40
},
height: {
xs: 32,
sm: 40
}
};
$[1] = t1;
} else t1 = $[1];
let t2;
if ($[2] !== t0) {
t2 = /* @__PURE__ */ jsx(Avatar, {
src: t0,
sx: t1
});
$[2] = t0;
$[3] = t2;
} else t2 = $[3];
return t2;
};
function _temp$5(q) {
return q.from({ todo: userPhotoCollection }).findOne();
}
//#endregion
//#region src/components/core/account/UserMenu.tsx
const capitalize = (value) => value && value.charAt(0).toUpperCase() + value.slice(1);
const ToolbarAccount = () => {
const $ = c(144);
if ($[0] !== "84c87a6825af128ab10aa41db6c5cf025ed10410a455a71c2f9541b09b66a67c") {
for (let $i = 0; $i < 144; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "84c87a6825af128ab10aa41db6c5cf025ed10410a455a71c2f9541b09b66a67c";
}
const [anchorElement, setAnchorElement] = useState();
const [tab, setTab] = useState("settings");
const open = Boolean(anchorElement);
const { t, i18n } = useTranslation();
const { mode, setMode } = useColorScheme();
const { instance } = useMsal();
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 = /* @__PURE__ */ jsx(IconButton, {
size: "small",
sx: { mr: .5 },
children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
});
$[64] = t33;
} else t33 = $[64];
let t34;
if ($[65] !== t) {
t34 = t("Layout.Appearance");
$[65] = t;
$[66] = t34;
} else t34 = $[66];
let t35;
if ($[67] !== t34) {
t35 = /* @__PURE__ */ jsxs(ListSubheader, {
onClick: t31,
sx: t32,
children: [
t33,
" ",
t34
]
});
$[67] = t34;
$[68] = t35;
} else t35 = $[68];
let t36;
if ($[69] !== colorModes || $[70] !== mode || $[71] !== setMode) {
t36 = colorModes.map((t37) => {
const { mode: modeValue, icon: Icon, label } = t37;
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);
});
$[69] = colorModes;
$[70] = mode;
$[71] = setMode;
$[72] = t36;
} else t36 = $[72];
let t37;
if ($[73] !== t35 || $[74] !== t36) {
t37 = /* @__PURE__ */ jsx(List, {
subheader: t35,
children: t36
});
$[73] = t35;
$[74] = t36;
$[75] = t37;
} else t37 = $[75];
theme = t37;
T0 = List;
let t38;
let t39;
if ($[76] === Symbol.for("react.memo_cache_sentinel")) {
t38 = changeTab("settings");
t39 = {
backgroundColor: "transparent",
display: "flex",
alignItems: "center",
px: 1,
cursor: "pointer"
};
$[76] = t38;
$[77] = t39;
} else {
t38 = $[76];
t39 = $[77];
}
let t40;
if ($[78] === Symbol.for("react.memo_cache_sentinel")) {
t40 = /* @__PURE__ */ jsx(IconButton, {
size: "small",
sx: { mr: .5 },
children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
});
$[78] = t40;
} else t40 = $[78];
let t41;
if ($[79] !== t) {
t41 = t("Layout.Language");
$[79] = t;
$[80] = t41;
} else t41 = $[80];
if ($[81] !== t41) {
t1 = /* @__PURE__ */ jsxs(ListSubheader, {
onClick: t38,
sx: t39,
children: [
t40,
" ",
t41
]
});
$[81] = t41;
$[82] = t1;
} else t1 = $[82];
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 ($[83] !== T0 || $[84] !== t1 || $[85] !== t2) {
t3 = /* @__PURE__ */ jsx(T0, {
subheader: t1,
children: t2
});
$[83] = T0;
$[84] = t1;
$[85] = t2;
$[86] = t3;
} else t3 = $[86];
const language = t3;
let t4;
if ($[87] === Symbol.for("react.memo_cache_sentinel")) {
t4 = /* @__PURE__ */ jsx(AuthenticatedTemplate, { children: /* @__PURE__ */ jsx(UserAvatar, {}) });
$[87] = t4;
} else t4 = $[87];
let t5;
if ($[88] === Symbol.for("react.memo_cache_sentinel")) {
t5 = /* @__PURE__ */ jsx(UnauthenticatedTemplate, { children: /* @__PURE__ */ jsx(AccountCircle, { sx: {
width: {
xs: 32,
sm: 40
},
height: {
xs: 32,
sm: 40
}
} }) });
$[88] = t5;
} else t5 = $[88];
let t6;
if ($[89] !== openMenu) {
t6 = /* @__PURE__ */ jsxs(IconButton, {
size: "small",
edge: "end",
onClick: openMenu,
children: [t4, t5]
});
$[89] = openMenu;
$[90] = t6;
} else t6 = $[90];
let t7;
if ($[91] === Symbol.for("react.memo_cache_sentinel")) {
t7 = { width: 240 };
$[91] = t7;
} else t7 = $[91];
const t8 = user?.name;
let t9;
if ($[92] !== user) {
t9 = user?.employeeId && /* @__PURE__ */ jsx("span", { children: user.employeeId });
$[92] = user;
$[93] = t9;
} else t9 = $[93];
let t10;
if ($[94] !== user?.employeeId) {
t10 = user?.employeeId && /* @__PURE__ */ jsx("br", {});
$[94] = user?.employeeId;
$[95] = t10;
} else t10 = $[95];
let t11;
if ($[96] !== user) {
t11 = user?.department && /* @__PURE__ */ jsx("span", { children: user.department });
$[96] = user;
$[97] = t11;
} else t11 = $[97];
let t12;
if ($[98] !== t10 || $[99] !== t11 || $[100] !== t9) {
t12 = /* @__PURE__ */ jsxs("span", { children: [
t9,
t10,
t11
] });
$[98] = t10;
$[99] = t11;
$[100] = t9;
$[101] = t12;
} else t12 = $[101];
let t13;
if ($[102] !== t12 || $[103] !== t8) {
t13 = /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(ListItemText, {
primary: t8,
secondary: t12
}) });
$[102] = t12;
$[103] = t8;
$[104] = t13;
} else t13 = $[104];
let t14;
if ($[105] !== instance) {
t14 = () => instance.logoutRedirect({ postLogoutRedirectUri: "/" });
$[105] = instance;
$[106] = t14;
} else t14 = $[106];
let t15;
if ($[107] === Symbol.for("react.memo_cache_sentinel")) {
t15 = /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Logout, { color: "error" }) });
$[107] = t15;
} else t15 = $[107];
let t16;
if ($[108] !== t) {
t16 = t("Layout.Logout");
$[108] = t;
$[109] = t16;
} else t16 = $[109];
let t17;
if ($[110] !== t16) {
t17 = /* @__PURE__ */ jsx(ListItemText, { primary: t16 });
$[110] = t16;
$[111] = t17;
} else t17 = $[111];
let t18;
if ($[112] !== t14 || $[113] !== t17) {
t18 = /* @__PURE__ */ jsxs(ListItemButton, {
onClick: t14,
children: [t15, t17]
});
$[112] = t14;
$[113] = t17;
$[114] = t18;
} else t18 = $[114];
let t19;
if ($[115] !== t13 || $[116] !== t18) {
t19 = /* @__PURE__ */ jsxs(AuthenticatedTemplate, { children: [t13, t18] });
$[115] = t13;
$[116] = t18;
$[117] = t19;
} else t19 = $[117];
let t20;
if ($[118] !== instance) {
t20 = () => instance.loginRedirect();
$[118] = instance;
$[119] = t20;
} else t20 = $[119];
let t21;
if ($[120] === Symbol.for("react.memo_cache_sentinel")) {
t21 = /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Login, { color: "success" }) });
$[120] = t21;
} else t21 = $[120];
let t22;
if ($[121] !== t) {
t22 = t("Layout.LogIn");
$[121] = t;
$[122] = t22;
} else t22 = $[122];
let t23;
if ($[123] !== t22) {
t23 = /* @__PURE__ */ jsx(ListItemText, { primary: t22 });
$[123] = t22;
$[124] = t23;
} else t23 = $[124];
let t24;
if ($[125] !== t20 || $[126] !== t23) {
t24 = /* @__PURE__ */ jsx(UnauthenticatedTemplate, { children: /* @__PURE__ */ jsxs(ListItemButton, {
onClick: t20,
children: [t21, t23]
}) });
$[125] = t20;
$[126] = t23;
$[127] = t24;
} else t24 = $[127];
let t25;
if ($[128] !== t19 || $[129] !== t24) {
t25 = /* @__PURE__ */ jsxs(List, {
disablePadding: true,
children: [t19, t24]
});
$[128] = t19;
$[129] = t24;
$[130] = t25;
} else t25 = $[130];
const t26 = tab === "settings" && settings;
const t27 = tab === "theme" && theme;
const t28 = tab === "language" && language;
let t29;
if ($[131] !== t25 || $[132] !== t26 || $[133] !== t27 || $[134] !== t28) {
t29 = /* @__PURE__ */ jsxs(Box, {
sx: t7,
children: [
t25,
t26,
t27,
t28
]
});
$[131] = t25;
$[132] = t26;
$[133] = t27;
$[134] = t28;
$[135] = t29;
} else t29 = $[135];
let t30;
if ($[136] !== anchorElement || $[137] !== closeMenu || $[138] !== open || $[139] !== t29) {
t30 = /* @__PURE__ */ jsx(Menu, {
anchorEl: anchorElement,
open,
onClose: closeMenu,
children: t29
});
$[136] = anchorElement;
$[137] = closeMenu;
$[138] = open;
$[139] = t29;
$[140] = t30;
} else t30 = $[140];
let t31;
if ($[141] !== t30 || $[142] !== t6) {
t31 = /* @__PURE__ */ jsxs(Fragment, { children: [t6, t30] });
$[141] = t30;
$[142] = t6;
$[143] = t31;
} else t31 = $[143];
return t31;
};
function _temp$4(lng) {
return lng !== "cimode";
}
//#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] !== "e6e033280dc7acffefe12faaa57be31c45d47ad2cb19f709755e27b07998830a") {
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "e6e033280dc7acffefe12faaa57be31c45d47ad2cb19f709755e27b07998830a";
}
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: "app-logo",
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] !== "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88") {
for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88";
}
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] !== "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88") {
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88";
}
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] !== "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88") {
for (let $i = 0; $i < 62; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88";
}
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] !== "54b4ebd58dbce1d2924089c3a4b49d010b8b2d08b36cb8fffffa71372840d7c7") {
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "54b4ebd58dbce1d2924089c3a4b49d010b8b2d08b36cb8fffffa71372840d7c7";
}
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(31);
if ($[0] !== "7dcd172e531b7aa4805dc0eb6c1b2e6a46bb5f43a7ddebbb7b8ed1fe874792c0") {
for (let $i = 0; $i < 31; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "7dcd172e531b7aa4805dc0eb6c1b2e6a46bb5f43a7ddebbb7b8ed1fe874792c0";
}
const { navigation, options, children } = t0;
const [navigationOpen, setNavigationOpen] = useState(getInitialNavigationOpen);
const matches = useMatches();
let t1;
if ($[1] !== matches || $[2] !== options?.publicRoutes) {
const currentRoutePath = matches.at(-1)?.fullPath;
t1 = options?.publicRoutes?.includes(currentRoutePath) ?? false;
$[1] = matches;
$[2] = options?.publicRoutes;
$[3] = t1;
} else t1 = $[3];
const isPublicRoute = t1;
const showShell = options?.showShell ?? true;
let t2;
let t3;
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
t2 = /* @__PURE__ */ jsx(InitColorSchemeScript, {});
t3 = /* @__PURE__ */ jsx(CssBaseline, {});
$[4] = t2;
$[5] = t3;
} else {
t2 = $[4];
t3 = $[5];
}
let t4;
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
t4 = {
display: "flex",
height: "100dvh",
maxHeight: "100dvh",
overflow: "hidden",
width: "100%"
};
$[6] = t4;
} else t4 = $[6];
let t5;
if ($[7] !== navigation || $[8] !== navigationOpen || $[9] !== showShell) {
t5 = showShell && /* @__PURE__ */ jsx(AppBar, {
color: "transparent",
position: "fixed",
sx: {
borderBottom: "1px solid",
borderColor: "var(--mui-palette-divider)",
boxShadow: "none"
},
children: /* @__PURE__ */ jsxs(Toolbar, { children: [
navigation && /* @__PURE__ */ jsx(IconButton, {
onClick: () => {
setNavigationOpen(_temp$1);
},
sx: { marginRight: 2 },
children: navigationOpen ? /* @__PURE__ */ jsx(MenuOpen, {}) : /* @__PURE__ */ jsx(Menu$1, {})
}),
/* @__PURE__ */ jsx(AppTitle, {}),
/* @__PURE__ */ jsx(ToolbarAccount, {})
] })
});
$[7] = navigation;
$[8] = navigationOpen;
$[9] = showShell;
$[10] = t5;
} else t5 = $[10];
let t6;
if ($[11] !== navigation || $[12] !== navigationOpen || $[13] !== showShell) {
t6 = navigation && showShell && /* @__PURE__ */ jsx(NavigationRail, {
navigation,
expanded: navigationOpen,
setExpanded: (newValue_0) => {
setNavigationOpen(newValue_0);
saveNavigationState(newValue_0);
}
});
$[11] = navigation;
$[12] = navigationOpen;
$[13] = showShell;
$[14] = t6;
} else t6 = $[14];
let t7;
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
t7 = {
flexGrow: 1,
display: "flex",
flexDirection: "column",
minWidth: 0,
height: "100%",
overflow: "hidden"
};
$[15] = t7;
} else t7 = $[15];
let t8;
if ($[16] !== showShell) {
t8 = showShell && /* @__PURE__ */ jsx(DrawerHeader, {});
$[16] = showShell;
$[17] = t8;
} else t8 = $[17];
let t9;
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
t9 = {
flex: 1,
overflow: "auto",
position: "relative"
};
$[18] = t9;
} else t9 = $[18];
let t10;
if ($[19] !== children || $[20] !== isPublicRoute) {
t10 = isPublicRoute ? children : /* @__PURE__ */ jsx(MsalAuthenticationTemplate, {
interactionType: InteractionType.Redirect,
children
});
$[19] = children;
$[20] = isPublicRoute;
$[21] = t10;
} else t10 = $[21];
let t11;
if ($[22] !== t10) {
t11 = /* @__PURE__ */ jsx(Box, {
sx: t9,
children: t10
});
$[22] = t10;
$[23] = t11;
} else t11 = $[23];
let t12;
if ($[24] !== t11 || $[25] !== t8) {
t12 = /* @__PURE__ */ jsxs(Box, {
component: "main",
sx: t7,
children: [t8, t11]
});
$[24] = t11;
$[25] = t8;
$[26] = t12;
} else t12 = $[26];
let t13;
if ($[27] !== t12 || $[28] !== t5 || $[29] !== t6) {
t13 = /* @__PURE__ */ jsxs(Fragment, { children: [
t2,
t3,
/* @__PURE__ */ jsxs(Box, {
sx: t4,
children: [
t5,
t6,
t12
]
})
] });
$[27] = t12;
$[28] = t5;
$[29] = t6;
$[30] = t13;
} else t13 = $[30];
return t13;
};
function _temp$1(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/MsalAuthProvider.tsx
const MsalAuthEffects = () => {
const $ = c(12);
if ($[0] !== "67cb9b81df44ca8f126c014d72bff33c094a5c91732f1ddb4102b3b19a004f84") {
for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "67cb9b81df44ca8f126c014d72bff33c094a5c91732f1ddb4102b3b19a004f84";
}
const { inProgress, instance } = useMsal();
const router = useRouter();
const previousInProgress = useRef(inProgress);
const navigate = useNavigate();
let t0;
let t1;
if ($[1] !== navigate) {
t0 = () => {
pca.setNavigationClient(new TanStackNavigationClient(navigate));
};
t1 = [navigate];
$[1] = navigate;
$[2] = t0;
$[3] = t1;
} else {
t0 = $[2];
t1 = $[3];
}
useEffect(t0, t1);
let t2;
let t3;
if ($[4] !== instance || $[5] !== router) {
t2 = () => {
const callbackId = instance.addEventCallback((event) => {
if (event.eventType === EventType.LOGIN_SUCCESS || event.eventType === EventType.ACQUIRE_TOKEN_SUCCESS || event.eventType === EventType.LOGOUT_SUCCESS) router.invalidate();
});
return () => {
if (callbackId) instance.removeEventCallback(callbackId);
};
};
t3 = [instance, router];
$[4] = instance;
$[5] = router;
$[6] = t2;
$[