wcz-test 4.3.0 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1850,1129 +1850,497 @@ var RouterError = ({ error }) => {
1850
1850
  ] }) });
1851
1851
  };
1852
1852
 
1853
- // src/components/core/Layout.tsx
1854
- import Menu3 from "@mui/icons-material/Menu";
1855
- import MenuOpen from "@mui/icons-material/MenuOpen";
1856
- import { AppBar, Box as Box9, CssBaseline, IconButton as IconButton5, InitColorSchemeScript, LinearProgress, Toolbar } from "@mui/material";
1857
- import { ThemeProvider, styled as styled2 } from "@mui/material/styles";
1858
- import { useIsFetching, useIsMutating } from "@tanstack/react-query";
1859
- import useLocalStorageState from "use-local-storage-state";
1860
-
1861
- // src/components/core/navigation/NavigationRail.tsx
1862
- import { useMediaQuery } from "@mui/material";
1863
- import Box7 from "@mui/material/Box";
1864
- import Drawer from "@mui/material/Drawer";
1865
- import { useTheme as useTheme2 } from "@mui/material/styles";
1866
- import { useNavigate, useRouterState as useRouterState2 } from "@tanstack/react-router";
1853
+ // node_modules/@babel/runtime/helpers/esm/extends.js
1854
+ function _extends() {
1855
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
1856
+ for (var e = 1; e < arguments.length; e++) {
1857
+ var t2 = arguments[e];
1858
+ for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
1859
+ }
1860
+ return n;
1861
+ }, _extends.apply(null, arguments);
1862
+ }
1867
1863
 
1868
- // src/components/core/navigation/NavigationList.tsx
1869
- import Divider3 from "@mui/material/Divider";
1870
- import List3 from "@mui/material/List";
1871
- import ListSubheader from "@mui/material/ListSubheader";
1872
- import { Fragment as Fragment5, useEffect as useEffect5, useState as useState7 } from "react";
1864
+ // node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
1865
+ function _objectWithoutPropertiesLoose(r, e) {
1866
+ if (null == r) return {};
1867
+ var t2 = {};
1868
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1869
+ if (-1 !== e.indexOf(n)) continue;
1870
+ t2[n] = r[n];
1871
+ }
1872
+ return t2;
1873
+ }
1873
1874
 
1874
- // src/components/core/navigation/NavigationListItem.tsx
1875
- import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
1876
- import Avatar from "@mui/material/Avatar";
1877
- import Box6 from "@mui/material/Box";
1878
- import Popper from "@mui/material/Popper";
1879
- import ListItem from "@mui/material/ListItem";
1880
- import ListItemButton4 from "@mui/material/ListItemButton";
1881
- import ListItemIcon3 from "@mui/material/ListItemIcon";
1882
- import ListItemText3 from "@mui/material/ListItemText";
1883
- import Paper2 from "@mui/material/Paper";
1884
- import { styled } from "@mui/material/styles";
1885
- import Typography7 from "@mui/material/Typography";
1886
- import { Fragment as Fragment3, useMemo as useMemo2, useState as useState6 } from "react";
1887
- import { Collapse } from "@mui/material";
1888
- import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1889
- var ICON_SIZE = 34;
1890
- var StyledNavButton = styled(ListItemButton4)(({ theme }) => ({
1891
- borderRadius: 8,
1892
- "&.Mui-selected": {
1893
- "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
1894
- color: (theme.vars ?? theme).palette.primary.dark
1895
- },
1896
- "& .MuiAvatar-root": {
1897
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
1898
- },
1899
- "& .MuiTouchRipple-child": {
1900
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
1875
+ // node_modules/@mui/x-date-pickers/esm/LocalizationProvider/LocalizationProvider.js
1876
+ var import_prop_types = __toESM(require_prop_types(), 1);
1877
+ import * as React11 from "react";
1878
+ import { useThemeProps } from "@mui/material/styles";
1879
+ import { jsx as _jsx } from "react/jsx-runtime";
1880
+ var _excluded = ["localeText"];
1881
+ var PickerAdapterContext = /* @__PURE__ */ React11.createContext(null);
1882
+ if (process.env.NODE_ENV !== "production") PickerAdapterContext.displayName = "PickerAdapterContext";
1883
+ var LocalizationProvider = function LocalizationProvider2(inProps) {
1884
+ const {
1885
+ localeText: inLocaleText
1886
+ } = inProps, otherInProps = _objectWithoutPropertiesLoose(inProps, _excluded);
1887
+ const {
1888
+ adapter: parentAdapter,
1889
+ localeText: parentLocaleText
1890
+ } = React11.useContext(PickerAdapterContext) ?? {
1891
+ utils: void 0,
1892
+ adapter: void 0,
1893
+ localeText: void 0
1894
+ };
1895
+ const props = useThemeProps({
1896
+ // We don't want to pass the `localeText` prop to the theme, that way it will always return the theme value,
1897
+ // We will then merge this theme value with our value manually
1898
+ props: otherInProps,
1899
+ name: "MuiLocalizationProvider"
1900
+ });
1901
+ const {
1902
+ children,
1903
+ dateAdapter: DateAdapter,
1904
+ dateFormats,
1905
+ dateLibInstance,
1906
+ adapterLocale,
1907
+ localeText: themeLocaleText
1908
+ } = props;
1909
+ const localeText = React11.useMemo(() => _extends({}, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
1910
+ const adapter = React11.useMemo(() => {
1911
+ if (!DateAdapter) {
1912
+ if (parentAdapter) {
1913
+ return parentAdapter;
1914
+ }
1915
+ return null;
1901
1916
  }
1902
- },
1903
- "& .MuiSvgIcon-root": {
1904
- color: (theme.vars ?? theme).palette.action.active
1905
- },
1906
- "& .MuiAvatar-root": {
1907
- backgroundColor: (theme.vars ?? theme).palette.action.active
1917
+ const dateAdapter = new DateAdapter({
1918
+ locale: adapterLocale,
1919
+ formats: dateFormats,
1920
+ instance: dateLibInstance
1921
+ });
1922
+ if (!dateAdapter.isMUIAdapter) {
1923
+ throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`", "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", "More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join(`
1924
+ `));
1925
+ }
1926
+ return dateAdapter;
1927
+ }, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentAdapter]);
1928
+ const defaultDates = React11.useMemo(() => {
1929
+ if (!adapter) {
1930
+ return null;
1931
+ }
1932
+ return {
1933
+ minDate: adapter.date("1900-01-01T00:00:00.000"),
1934
+ maxDate: adapter.date("2099-12-31T00:00:00.000")
1935
+ };
1936
+ }, [adapter]);
1937
+ const contextValue = React11.useMemo(() => {
1938
+ return {
1939
+ utils: adapter,
1940
+ adapter,
1941
+ defaultDates,
1942
+ localeText
1943
+ };
1944
+ }, [defaultDates, adapter, localeText]);
1945
+ return /* @__PURE__ */ _jsx(PickerAdapterContext.Provider, {
1946
+ value: contextValue,
1947
+ children
1948
+ });
1949
+ };
1950
+ if (process.env.NODE_ENV !== "production") LocalizationProvider.displayName = "LocalizationProvider";
1951
+ process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
1952
+ // ----------------------------- Warning --------------------------------
1953
+ // | These PropTypes are generated from the TypeScript type definitions |
1954
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
1955
+ // ----------------------------------------------------------------------
1956
+ /**
1957
+ * Locale for the date library you are using
1958
+ */
1959
+ adapterLocale: import_prop_types.default.any,
1960
+ children: import_prop_types.default.node,
1961
+ /**
1962
+ * Date library adapter class function.
1963
+ * @see See the localization provider {@link https://mui.com/x/react-date-pickers/quickstart/#integrate-provider-and-adapter date adapter setup section} for more details.
1964
+ */
1965
+ dateAdapter: import_prop_types.default.func,
1966
+ /**
1967
+ * Formats that are used for any child pickers
1968
+ */
1969
+ dateFormats: import_prop_types.default.shape({
1970
+ dayOfMonth: import_prop_types.default.string,
1971
+ dayOfMonthFull: import_prop_types.default.string,
1972
+ fullDate: import_prop_types.default.string,
1973
+ fullTime12h: import_prop_types.default.string,
1974
+ fullTime24h: import_prop_types.default.string,
1975
+ hours12h: import_prop_types.default.string,
1976
+ hours24h: import_prop_types.default.string,
1977
+ keyboardDate: import_prop_types.default.string,
1978
+ keyboardDateTime12h: import_prop_types.default.string,
1979
+ keyboardDateTime24h: import_prop_types.default.string,
1980
+ meridiem: import_prop_types.default.string,
1981
+ minutes: import_prop_types.default.string,
1982
+ month: import_prop_types.default.string,
1983
+ monthShort: import_prop_types.default.string,
1984
+ normalDate: import_prop_types.default.string,
1985
+ normalDateWithWeekday: import_prop_types.default.string,
1986
+ seconds: import_prop_types.default.string,
1987
+ shortDate: import_prop_types.default.string,
1988
+ weekday: import_prop_types.default.string,
1989
+ weekdayShort: import_prop_types.default.string,
1990
+ year: import_prop_types.default.string
1991
+ }),
1992
+ /**
1993
+ * Date library instance you are using, if it has some global overrides
1994
+ * ```jsx
1995
+ * dateLibInstance={momentTimeZone}
1996
+ * ```
1997
+ */
1998
+ dateLibInstance: import_prop_types.default.any,
1999
+ /**
2000
+ * Locale for components texts
2001
+ */
2002
+ localeText: import_prop_types.default.object
2003
+ } : void 0;
2004
+
2005
+ // node_modules/@mui/x-internals/esm/warning/warning.js
2006
+ var warnedOnceCache = /* @__PURE__ */ new Set();
2007
+ function warnOnce(message, gravity = "warning") {
2008
+ if (process.env.NODE_ENV === "production") {
2009
+ return;
1908
2010
  }
1909
- }));
1910
- var StyledRouterButton = styled(RouterListItemButton)(({ theme }) => ({
1911
- borderRadius: 8,
1912
- "&.Mui-selected": {
1913
- "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
1914
- color: (theme.vars ?? theme).palette.primary.dark
1915
- },
1916
- "& .MuiAvatar-root": {
1917
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
1918
- },
1919
- "& .MuiTouchRipple-child": {
1920
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
2011
+ const cleanMessage = Array.isArray(message) ? message.join("\n") : message;
2012
+ if (!warnedOnceCache.has(cleanMessage)) {
2013
+ warnedOnceCache.add(cleanMessage);
2014
+ if (gravity === "error") {
2015
+ console.error(cleanMessage);
2016
+ } else {
2017
+ console.warn(cleanMessage);
1921
2018
  }
2019
+ }
2020
+ }
2021
+
2022
+ // node_modules/@mui/x-date-pickers/esm/AdapterDayjs/AdapterDayjs.js
2023
+ import dayjs from "dayjs";
2024
+ import weekOfYearPlugin from "dayjs/plugin/weekOfYear.js";
2025
+ import customParseFormatPlugin from "dayjs/plugin/customParseFormat.js";
2026
+ import localizedFormatPlugin from "dayjs/plugin/localizedFormat.js";
2027
+ import isBetweenPlugin from "dayjs/plugin/isBetween.js";
2028
+ import advancedFormatPlugin from "dayjs/plugin/advancedFormat.js";
2029
+ dayjs.extend(localizedFormatPlugin);
2030
+ dayjs.extend(weekOfYearPlugin);
2031
+ dayjs.extend(isBetweenPlugin);
2032
+ dayjs.extend(advancedFormatPlugin);
2033
+ var formatTokenMap = {
2034
+ // Year
2035
+ YY: "year",
2036
+ YYYY: {
2037
+ sectionType: "year",
2038
+ contentType: "digit",
2039
+ maxLength: 4
1922
2040
  },
1923
- "& .MuiSvgIcon-root": {
1924
- color: (theme.vars ?? theme).palette.action.active
2041
+ // Month
2042
+ M: {
2043
+ sectionType: "month",
2044
+ contentType: "digit",
2045
+ maxLength: 2
1925
2046
  },
1926
- "& .MuiAvatar-root": {
1927
- backgroundColor: (theme.vars ?? theme).palette.action.active
1928
- }
1929
- }));
1930
- var IconOrAvatar = ({ item, collapsed }) => {
1931
- if (item.icon || collapsed) {
1932
- return /* @__PURE__ */ jsxs12(Box6, { sx: collapsed ? { position: "absolute", left: "50%", top: "calc(50% - 6px)", transform: "translate(-50%, -50%)" } : {}, children: [
1933
- /* @__PURE__ */ jsxs12(ListItemIcon3, { sx: { display: "flex", alignItems: "center", justifyContent: "center", minWidth: ICON_SIZE }, children: [
1934
- item.icon ?? null,
1935
- !item.icon && collapsed ? /* @__PURE__ */ jsx22(Avatar, { sx: { width: ICON_SIZE - 7, height: ICON_SIZE - 7, fontSize: 12 }, children: item.title }) : null
1936
- ] }),
1937
- collapsed ? /* @__PURE__ */ jsx22(
1938
- Typography7,
1939
- {
1940
- variant: "caption",
1941
- sx: {
1942
- position: "absolute",
1943
- bottom: -18,
1944
- left: "50%",
1945
- transform: "translateX(-50%)",
1946
- fontSize: 10,
1947
- fontWeight: 500,
1948
- textAlign: "center",
1949
- whiteSpace: "nowrap",
1950
- overflow: "hidden",
1951
- textOverflow: "ellipsis",
1952
- maxWidth: MINI_WIDTH - 28
1953
- },
1954
- children: item.title
1955
- }
1956
- ) : null
1957
- ] });
1958
- }
1959
- return null;
2047
+ MM: "month",
2048
+ MMM: {
2049
+ sectionType: "month",
2050
+ contentType: "letter"
2051
+ },
2052
+ MMMM: {
2053
+ sectionType: "month",
2054
+ contentType: "letter"
2055
+ },
2056
+ // Day of the month
2057
+ D: {
2058
+ sectionType: "day",
2059
+ contentType: "digit",
2060
+ maxLength: 2
2061
+ },
2062
+ DD: "day",
2063
+ Do: {
2064
+ sectionType: "day",
2065
+ contentType: "digit-with-letter"
2066
+ },
2067
+ // Day of the week
2068
+ d: {
2069
+ sectionType: "weekDay",
2070
+ contentType: "digit",
2071
+ maxLength: 2
2072
+ },
2073
+ dd: {
2074
+ sectionType: "weekDay",
2075
+ contentType: "letter"
2076
+ },
2077
+ ddd: {
2078
+ sectionType: "weekDay",
2079
+ contentType: "letter"
2080
+ },
2081
+ dddd: {
2082
+ sectionType: "weekDay",
2083
+ contentType: "letter"
2084
+ },
2085
+ // Meridiem
2086
+ A: "meridiem",
2087
+ a: "meridiem",
2088
+ // Hours
2089
+ H: {
2090
+ sectionType: "hours",
2091
+ contentType: "digit",
2092
+ maxLength: 2
2093
+ },
2094
+ HH: "hours",
2095
+ h: {
2096
+ sectionType: "hours",
2097
+ contentType: "digit",
2098
+ maxLength: 2
2099
+ },
2100
+ hh: "hours",
2101
+ // Minutes
2102
+ m: {
2103
+ sectionType: "minutes",
2104
+ contentType: "digit",
2105
+ maxLength: 2
2106
+ },
2107
+ mm: "minutes",
2108
+ // Seconds
2109
+ s: {
2110
+ sectionType: "seconds",
2111
+ contentType: "digit",
2112
+ maxLength: 2
2113
+ },
2114
+ ss: "seconds"
1960
2115
  };
1961
- var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx22(
1962
- Popper,
1963
- {
1964
- open,
1965
- anchorEl,
1966
- placement: "right-start",
1967
- modifiers: [
1968
- { name: "offset", options: { offset: [6, 0] } },
1969
- { name: "preventOverflow", options: { padding: 8 } },
1970
- { name: "flip", options: { fallbackPlacements: ["right-end", "left-start"] } }
1971
- ],
1972
- children: /* @__PURE__ */ jsx22(
1973
- Paper2,
1974
- {
1975
- sx: {
1976
- pt: 0.5,
1977
- pb: 0.5,
1978
- maxHeight: "min(calc(100vh - 100px), 560px)",
1979
- overflowY: "auto",
1980
- overscrollBehavior: "contain"
1981
- },
1982
- children
1983
- }
1984
- )
2116
+ var defaultFormats = {
2117
+ year: "YYYY",
2118
+ month: "MMMM",
2119
+ monthShort: "MMM",
2120
+ dayOfMonth: "D",
2121
+ dayOfMonthFull: "Do",
2122
+ weekday: "dddd",
2123
+ weekdayShort: "dd",
2124
+ hours24h: "HH",
2125
+ hours12h: "hh",
2126
+ meridiem: "A",
2127
+ minutes: "mm",
2128
+ seconds: "ss",
2129
+ fullDate: "ll",
2130
+ keyboardDate: "L",
2131
+ shortDate: "MMM D",
2132
+ normalDate: "D MMMM",
2133
+ normalDateWithWeekday: "ddd, MMM D",
2134
+ fullTime12h: "hh:mm A",
2135
+ fullTime24h: "HH:mm",
2136
+ keyboardDateTime12h: "L hh:mm A",
2137
+ keyboardDateTime24h: "L HH:mm"
2138
+ };
2139
+ var MISSING_UTC_PLUGIN = ["Missing UTC plugin", "To be able to use UTC or timezones, you have to enable the `utc` plugin", "Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join("\n");
2140
+ var MISSING_TIMEZONE_PLUGIN = ["Missing timezone plugin", "To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin", "Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join("\n");
2141
+ var AdapterDayjs = class {
2142
+ isMUIAdapter = true;
2143
+ isTimezoneCompatible = true;
2144
+ lib = "dayjs";
2145
+ escapedCharacters = {
2146
+ start: "[",
2147
+ end: "]"
2148
+ };
2149
+ formatTokenMap = /* @__PURE__ */ (() => formatTokenMap)();
2150
+ constructor({
2151
+ locale,
2152
+ formats
2153
+ } = {}) {
2154
+ this.locale = locale;
2155
+ this.formats = _extends({}, defaultFormats, formats);
2156
+ dayjs.extend(customParseFormatPlugin);
1985
2157
  }
1986
- );
1987
- var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, onClick, renderNested }) => {
1988
- const [hoveredPopoverItem, setHoveredPopoverItem] = useState6(null);
1989
- const [anchorElement, setAnchorElement] = useState6(null);
1990
- const chevronSx = useMemo2(() => {
1991
- if (collapsed && isSidebarFullyCollapsed && item.children) {
1992
- return {
1993
- fontSize: 18,
1994
- position: "absolute",
1995
- top: "41.5%",
1996
- right: "2px",
1997
- transform: "translateY(-50%) rotate(-90deg)"
1998
- };
2158
+ setLocaleToValue = (value) => {
2159
+ const expectedLocale = this.getCurrentLocaleCode();
2160
+ if (expectedLocale === value.locale()) {
2161
+ return value;
1999
2162
  }
2000
- if (!collapsed && isSidebarFullyExpanded && item.children) {
2001
- return {
2002
- ml: 0.5,
2003
- transform: `rotate(${isOpen ? 0 : -90}deg)`
2004
- };
2163
+ return value.locale(expectedLocale);
2164
+ };
2165
+ hasUTCPlugin = () => typeof dayjs.utc !== "undefined";
2166
+ hasTimezonePlugin = () => typeof dayjs.tz !== "undefined";
2167
+ isSame = (value, comparing, comparisonTemplate) => {
2168
+ const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
2169
+ return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
2170
+ };
2171
+ /**
2172
+ * Replaces "default" by undefined and "system" by the system timezone before passing it to `dayjs`.
2173
+ */
2174
+ cleanTimezone = (timezone) => {
2175
+ switch (timezone) {
2176
+ case "default": {
2177
+ return void 0;
2178
+ }
2179
+ case "system": {
2180
+ return dayjs.tz.guess();
2181
+ }
2182
+ default: {
2183
+ return timezone;
2184
+ }
2005
2185
  }
2006
- return { display: "none" };
2007
- }, [collapsed, isSidebarFullyExpanded, isSidebarFullyCollapsed, isOpen, item.children]);
2008
- const shouldJustExpand = item.children && !collapsed;
2009
- const buttonProps = {
2010
- selected,
2011
- disabled,
2012
- sx: { px: 1.4, height: collapsed ? 60 : 48 }
2013
2186
  };
2014
- const buttonContent = /* @__PURE__ */ jsxs12(Fragment4, { children: [
2015
- /* @__PURE__ */ jsx22(IconOrAvatar, { item, collapsed }),
2016
- !collapsed && /* @__PURE__ */ jsx22(
2017
- ListItemText3,
2018
- {
2019
- primary: item.title,
2020
- slotProps: { primary: { noWrap: true, title: item.title } },
2021
- sx: { ml: 1.2, flex: 1, minWidth: 0, "& .MuiTypography-root": { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }
2187
+ createSystemDate = (value) => {
2188
+ let date;
2189
+ if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
2190
+ const timezone = dayjs.tz.guess();
2191
+ if (timezone === "UTC") {
2192
+ date = dayjs(value);
2193
+ } else {
2194
+ date = dayjs.tz(value, timezone);
2022
2195
  }
2023
- ),
2024
- item.children ? /* @__PURE__ */ jsx22(ExpandMoreIcon, { sx: chevronSx }) : null
2025
- ] });
2026
- const listItem = /* @__PURE__ */ jsxs12(
2027
- ListItem,
2028
- {
2029
- ...item.children && collapsed ? {
2030
- onMouseEnter: (event) => {
2031
- setAnchorElement(event.currentTarget);
2032
- setHoveredPopoverItem(item.title);
2033
- },
2034
- onMouseLeave: () => {
2035
- setHoveredPopoverItem(null);
2036
- }
2037
- } : {},
2038
- sx: { py: 0, px: 1, overflowX: "hidden" },
2039
- children: [
2040
- shouldJustExpand ? /* @__PURE__ */ jsx22(StyledNavButton, { ...buttonProps, onClick: () => onClick?.(item), children: buttonContent }) : /* @__PURE__ */ jsx22(
2041
- StyledRouterButton,
2042
- {
2043
- ...buttonProps,
2044
- to: item.to,
2045
- href: item.href,
2046
- params: item.params,
2047
- search: item.search,
2048
- children: buttonContent
2049
- }
2050
- ),
2051
- item.children && collapsed ? /* @__PURE__ */ jsx22(MiniPopover, { open: item.title === hoveredPopoverItem, anchorEl: anchorElement, children: renderNested?.(item.children) }) : null
2052
- ]
2196
+ } else {
2197
+ date = dayjs(value);
2053
2198
  }
2054
- );
2055
- return /* @__PURE__ */ jsxs12(Fragment3, { children: [
2056
- listItem,
2057
- item.children && !collapsed ? /* @__PURE__ */ jsx22(Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true, children: renderNested?.(item.children) }) : null
2058
- ] }, item.to);
2059
- };
2060
-
2061
- // src/components/core/navigation/NavigationList.tsx
2062
- import { jsx as jsx23 } from "react/jsx-runtime";
2063
- var isPageItem = (item) => !("kind" in item);
2064
- var isDivider = (item) => "kind" in item && item.kind === "divider";
2065
- var isHeader = (item) => "kind" in item && item.kind === "header";
2066
- var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, expandedWidth, renderItem, activePath, onNavigate }) => {
2067
- const [openKeys, setOpenKeys] = useState7([]);
2068
- useEffect5(() => {
2069
- if (collapsed) setOpenKeys([]);
2070
- }, [collapsed]);
2071
- const toggleKey = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
2072
- const renderNested = (children) => /* @__PURE__ */ jsx23(
2073
- NavigationList,
2074
- {
2075
- subNavigation: children,
2076
- depth: depth + 1,
2077
- isPopover: collapsed,
2078
- expandedWidth,
2079
- activePath,
2080
- onNavigate
2199
+ return this.setLocaleToValue(date);
2200
+ };
2201
+ createUTCDate = (value) => {
2202
+ if (!this.hasUTCPlugin()) {
2203
+ throw new Error(MISSING_UTC_PLUGIN);
2081
2204
  }
2082
- );
2083
- const filteredNavigation = subNavigation.filter((nav) => !nav.hidden);
2084
- return /* @__PURE__ */ jsx23(
2085
- List3,
2086
- {
2087
- sx: {
2088
- padding: 0,
2089
- mt: isPopover && depth === 1 ? 0.5 : 0,
2090
- mb: depth === 0 && !isPopover ? 4 : 0.5,
2091
- pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
2092
- minWidth: isPopover && depth === 1 ? EXPANDED_WIDTH : "auto",
2093
- width: collapsed ? MINI_WIDTH : "auto"
2094
- },
2095
- children: filteredNavigation.map((navItem, index) => {
2096
- if (isHeader(navItem)) {
2097
- return /* @__PURE__ */ jsx23(
2098
- ListSubheader,
2099
- {
2100
- sx: {
2101
- fontSize: 12,
2102
- fontWeight: "700",
2103
- height: collapsed ? 0 : 40,
2104
- px: 2,
2105
- minWidth: expandedWidth,
2106
- overflow: "hidden",
2107
- textOverflow: "ellipsis",
2108
- whiteSpace: "nowrap",
2109
- zIndex: 2,
2110
- bgcolor: "transparent",
2111
- position: "static"
2112
- },
2113
- children: navItem.title
2114
- },
2115
- `subheader-${depth}-${index}`
2116
- );
2117
- }
2118
- if (isDivider(navItem)) {
2119
- const nextItem = filteredNavigation[index + 1];
2120
- return /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsx23(Divider3, { sx: { mx: 1, mt: 1, mb: isHeader(nextItem) && !collapsed ? 0 : 1 } }) }, `divider-${depth}-${index}`);
2121
- }
2122
- if (!isPageItem(navItem)) return null;
2123
- const key = `item-${depth}-${index}`;
2124
- const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
2125
- if (renderItem) return /* @__PURE__ */ jsx23(Fragment5, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key);
2126
- return /* @__PURE__ */ jsx23(
2127
- NavigationListItem,
2128
- {
2129
- item: navItem,
2130
- isOpen: openKeys.includes(uniqueItemKey),
2131
- selected: activePath === navItem.to,
2132
- collapsed,
2133
- isSidebarFullyExpanded,
2134
- isSidebarFullyCollapsed,
2135
- onClick: navItem.children && !collapsed ? () => toggleKey(uniqueItemKey) : void 0,
2136
- renderNested
2137
- },
2138
- key
2139
- );
2140
- })
2205
+ return this.setLocaleToValue(dayjs.utc(value));
2206
+ };
2207
+ createTZDate = (value, timezone) => {
2208
+ if (!this.hasUTCPlugin()) {
2209
+ throw new Error(MISSING_UTC_PLUGIN);
2141
2210
  }
2142
- );
2143
- };
2144
-
2145
- // src/components/core/navigation/NavigationRail.tsx
2146
- import { jsx as jsx24 } from "react/jsx-runtime";
2147
- var MINI_WIDTH = 84;
2148
- var EXPANDED_WIDTH = 320;
2149
- var TOOLBAR_HEIGHT = 65;
2150
- var NavigationRail = ({ navigation, expanded, setExpanded }) => {
2151
- const navigate = useNavigate();
2152
- const routerState = useRouterState2();
2153
- const theme = useTheme2();
2154
- const showPermanent = useMediaQuery(theme.breakpoints.up("sm"));
2155
- const drawerContent = (collapsed) => /* @__PURE__ */ jsx24(
2156
- Box7,
2157
- {
2158
- component: "nav",
2159
- sx: {
2160
- height: "100%",
2161
- display: "flex",
2162
- flexDirection: "column",
2163
- justifyContent: "space-between",
2164
- overflow: "auto",
2165
- scrollbarGutter: collapsed ? "stable" : "auto",
2166
- overflowX: "hidden",
2167
- pt: navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2
2168
- },
2169
- children: /* @__PURE__ */ jsx24(
2170
- NavigationList,
2171
- {
2172
- subNavigation: navigation,
2173
- collapsed,
2174
- isSidebarFullyExpanded: expanded,
2175
- isSidebarFullyCollapsed: !expanded,
2176
- expandedWidth: EXPANDED_WIDTH,
2177
- activePath: routerState.location.pathname,
2178
- onNavigate: navigate
2179
- }
2180
- )
2211
+ if (!this.hasTimezonePlugin()) {
2212
+ throw new Error(MISSING_TIMEZONE_PLUGIN);
2181
2213
  }
2182
- );
2183
- if (showPermanent)
2184
- return /* @__PURE__ */ jsx24(
2185
- Drawer,
2186
- {
2187
- variant: "permanent",
2188
- sx: {
2189
- width: expanded ? EXPANDED_WIDTH : MINI_WIDTH,
2190
- ["& .MuiDrawer-paper"]: {
2191
- position: "absolute",
2192
- top: `${TOOLBAR_HEIGHT}px`,
2193
- height: `calc(100% - ${TOOLBAR_HEIGHT}px)`,
2194
- width: expanded ? EXPANDED_WIDTH : MINI_WIDTH
2195
- }
2196
- },
2197
- children: drawerContent(!expanded)
2214
+ const keepLocalTime = value !== void 0 && !value.endsWith("Z");
2215
+ return this.setLocaleToValue(dayjs(value).tz(this.cleanTimezone(timezone), keepLocalTime));
2216
+ };
2217
+ getLocaleFormats = () => {
2218
+ const locales = dayjs.Ls;
2219
+ const locale = this.locale || "en";
2220
+ let localeObject = locales[locale];
2221
+ if (localeObject === void 0) {
2222
+ if (process.env.NODE_ENV !== "production") {
2223
+ warnOnce(["MUI X: Your locale has not been found.", "Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.", "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", "fallback on English locale."]);
2198
2224
  }
2199
- );
2200
- return /* @__PURE__ */ jsx24(Drawer, { open: expanded, onClose: () => setExpanded(false), children: drawerContent(!expanded) });
2201
- };
2202
-
2203
- // src/components/core/ToolbarAccount.tsx
2204
- import AccountCircle from "@mui/icons-material/AccountCircle";
2205
- import ArrowBack from "@mui/icons-material/ArrowBack";
2206
- import Brightness4 from "@mui/icons-material/Brightness4";
2207
- import ChevronRight from "@mui/icons-material/ChevronRight";
2208
- import DarkMode from "@mui/icons-material/DarkMode";
2209
- import LightMode from "@mui/icons-material/LightMode";
2210
- import Login from "@mui/icons-material/Login";
2211
- import Logout from "@mui/icons-material/Logout";
2212
- import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
2213
- import Translate from "@mui/icons-material/Translate";
2214
- import { Avatar as Avatar2, Box as Box8, IconButton as IconButton4, List as List4, ListItem as ListItem2, ListItemButton as ListItemButton5, ListItemIcon as ListItemIcon4, ListItemText as ListItemText4, ListSubheader as ListSubheader2, Menu as Menu2, Typography as Typography8, useColorScheme } from "@mui/material";
2215
- import { Fragment as Fragment6, useState as useState8 } from "react";
2216
- import { useTranslation as useTranslation5 } from "react-i18next";
2217
-
2218
- // src/auth-test/keycloak.ts
2219
- import { useRouter } from "@tanstack/react-router";
2220
- import Keycloak from "keycloak-js";
2221
- var keycloakConfig = {
2222
- url: import.meta.env.VITE_KEYCLOAK_URL,
2223
- realm: import.meta.env.VITE_KEYCLOAK_REALM,
2224
- clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
2225
- idpHint: import.meta.env.VITE_KEYCLOAK_IDP_HINT,
2226
- confidentialClientId: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
2227
- confidentialClientSecret: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET
2228
- };
2229
- function useKeycloak() {
2230
- const routerContext = useRouter();
2231
- const keycloak = routerContext.options.context.keycloak;
2232
- return keycloak;
2233
- }
2234
-
2235
- // src/components/core/ToolbarAccount.tsx
2236
- import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
2237
- var ToolbarAccount = () => {
2238
- const [anchorElement, setAnchorElement] = useState8();
2239
- const [tab, setTab] = useState8("settings");
2240
- const open = Boolean(anchorElement);
2241
- const { t: t2, i18n: i18n2 } = useTranslation5();
2242
- const { mode, setMode } = useColorScheme();
2243
- const changeLanguage = (newLanguage) => () => {
2244
- i18n2.changeLanguage(newLanguage).finally(() => closeMenu());
2225
+ localeObject = locales.en;
2226
+ }
2227
+ return localeObject.formats;
2245
2228
  };
2246
- const changeMode = (newMode) => () => {
2247
- setMode(newMode);
2248
- closeMenu();
2229
+ /**
2230
+ * If the new day does not have the same offset as the old one (when switching to summer day time for example),
2231
+ * Then dayjs will not automatically adjust the offset (moment does).
2232
+ * We have to parse again the value to make sure the `fixOffset` method is applied.
2233
+ * See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
2234
+ */
2235
+ adjustOffset = (value) => {
2236
+ if (!this.hasTimezonePlugin()) {
2237
+ return value;
2238
+ }
2239
+ const timezone = this.getTimezone(value);
2240
+ if (timezone !== "UTC") {
2241
+ const fixedValue = value.tz(this.cleanTimezone(timezone), true);
2242
+ if (fixedValue.$offset === (value.$offset ?? 0)) {
2243
+ return value;
2244
+ }
2245
+ value.$offset = fixedValue.$offset;
2246
+ }
2247
+ return value;
2249
2248
  };
2250
- const keycloak = useKeycloak();
2251
- const user = keycloak.user;
2252
- const getModeText = () => {
2253
- switch (mode) {
2254
- case "light": {
2255
- return t2("Layout.Light");
2249
+ date = (value, timezone = "default") => {
2250
+ if (value === null) {
2251
+ return null;
2252
+ }
2253
+ if (timezone === "UTC") {
2254
+ return this.createUTCDate(value);
2255
+ }
2256
+ if (timezone === "system" || timezone === "default" && !this.hasTimezonePlugin()) {
2257
+ return this.createSystemDate(value);
2258
+ }
2259
+ return this.createTZDate(value, timezone);
2260
+ };
2261
+ getInvalidDate = () => dayjs(/* @__PURE__ */ new Date("Invalid date"));
2262
+ getTimezone = (value) => {
2263
+ if (this.hasTimezonePlugin()) {
2264
+ const zone = value.$x?.$timezone;
2265
+ if (zone) {
2266
+ return zone;
2256
2267
  }
2257
- case "dark": {
2258
- return t2("Layout.Dark");
2268
+ }
2269
+ if (this.hasUTCPlugin() && value.isUTC()) {
2270
+ return "UTC";
2271
+ }
2272
+ return "system";
2273
+ };
2274
+ setTimezone = (value, timezone) => {
2275
+ if (this.getTimezone(value) === timezone) {
2276
+ return value;
2277
+ }
2278
+ if (timezone === "UTC") {
2279
+ if (!this.hasUTCPlugin()) {
2280
+ throw new Error(MISSING_UTC_PLUGIN);
2259
2281
  }
2260
- default: {
2261
- return t2("Layout.System");
2282
+ return value.utc();
2283
+ }
2284
+ if (timezone === "system") {
2285
+ return value.local();
2286
+ }
2287
+ if (!this.hasTimezonePlugin()) {
2288
+ if (timezone === "default") {
2289
+ return value;
2262
2290
  }
2291
+ throw new Error(MISSING_TIMEZONE_PLUGIN);
2263
2292
  }
2293
+ return this.setLocaleToValue(dayjs.tz(value, this.cleanTimezone(timezone)));
2264
2294
  };
2265
- const usernameInitials = () => {
2266
- if (!user?.name) return "";
2267
- const splittedName = user.name.split(" ");
2268
- return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
2269
- };
2270
- const openMenu = (event) => setAnchorElement(event.currentTarget);
2271
- const closeMenu = () => {
2272
- setAnchorElement(void 0);
2273
- setTimeout(() => setTab("settings"), 300);
2274
- };
2275
- const changeTab = (newTab) => () => setTab(newTab);
2276
- const settings = /* @__PURE__ */ jsxs13(List4, { component: "nav", subheader: /* @__PURE__ */ jsx25(ListSubheader2, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
2277
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
2278
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Brightness4, {}) }),
2279
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
2280
- /* @__PURE__ */ jsx25(ChevronRight, {})
2281
- ] }),
2282
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
2283
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Translate, {}) }),
2284
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Language"), secondary: i18n2.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
2285
- /* @__PURE__ */ jsx25(ChevronRight, {})
2286
- ] })
2287
- ] });
2288
- const theme = /* @__PURE__ */ jsxs13(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
2289
- /* @__PURE__ */ jsx25(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx25(ArrowBack, { fontSize: "small" }) }),
2290
- " ",
2291
- t2("Layout.Appearance")
2292
- ] }), children: [
2293
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("light"), disabled: mode === "light", children: [
2294
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(LightMode, {}) }),
2295
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Light") })
2296
- ] }),
2297
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
2298
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(DarkMode, {}) }),
2299
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Dark") })
2300
- ] }),
2301
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("system"), disabled: mode === "system", children: [
2302
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(SettingsBrightness, {}) }),
2303
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.System") })
2304
- ] })
2305
- ] });
2306
- const language = /* @__PURE__ */ jsxs13(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
2307
- /* @__PURE__ */ jsx25(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx25(ArrowBack, { fontSize: "small" }) }),
2308
- " ",
2309
- t2("Layout.Language")
2310
- ] }), children: [
2311
- /* @__PURE__ */ jsx25(ListItemButton5, { onClick: changeLanguage("en"), disabled: i18n2.resolvedLanguage === "en", children: /* @__PURE__ */ jsx25(ListItemText4, { primary: "English" }) }),
2312
- /* @__PURE__ */ jsx25(ListItemButton5, { onClick: changeLanguage("cs"), disabled: i18n2.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx25(ListItemText4, { primary: "\u010Ce\u0161tina" }) })
2313
- ] });
2314
- return /* @__PURE__ */ jsxs13(Fragment6, { children: [
2315
- /* @__PURE__ */ jsx25(IconButton4, { size: "small", edge: "end", onClick: openMenu, children: user?.name ? /* @__PURE__ */ jsx25(Avatar2, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx25(Typography8, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx25(AccountCircle, { fontSize: "large" }) }),
2316
- /* @__PURE__ */ jsx25(Menu2, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs13(Box8, { sx: { width: 240 }, children: [
2317
- /* @__PURE__ */ jsx25(List4, { children: user?.name ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
2318
- /* @__PURE__ */ jsx25(ListItem2, { children: /* @__PURE__ */ jsx25(ListItemText4, { primary: user.name, secondary: /* @__PURE__ */ jsxs13("span", { children: [
2319
- /* @__PURE__ */ jsx25("span", { children: user.employeeId }),
2320
- /* @__PURE__ */ jsx25("br", {}),
2321
- /* @__PURE__ */ jsx25("span", { children: user.department })
2322
- ] }) }) }),
2323
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: () => keycloak.logout(), children: [
2324
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Logout, { color: "error" }) }),
2325
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Logout") })
2326
- ] })
2327
- ] }) : /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: () => keycloak.login(), children: [
2328
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Login, { color: "success" }) }),
2329
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.LogIn") })
2330
- ] }) }),
2331
- tab === "settings" && settings,
2332
- tab === "theme" && theme,
2333
- tab === "language" && language
2334
- ] }) })
2335
- ] });
2336
- };
2337
-
2338
- // src/hooks/ThemeHook.ts
2339
- import { createTheme, darken, lighten } from "@mui/material";
2340
- import { grey as grey2 } from "@mui/material/colors";
2341
- import { csCZ, enUS } from "@mui/material/locale";
2342
- import { csCZ as dataGridCsCz, enUS as dataGridEnUs } from "@mui/x-data-grid-premium/locales";
2343
- import { csCZ as datePickersCsCz, enUS as datePickersEnUs } from "@mui/x-date-pickers-pro/locales";
2344
- import { useTranslation as useTranslation6 } from "react-i18next";
2345
- var WISTRON_PRIMARY_COLOR = "#00506E";
2346
- var WISTRON_SECONDARY_COLOR = "#64DC00";
2347
- var useGetTheme = (theme) => {
2348
- const { i18n: i18n2 } = useTranslation6();
2349
- return createTheme(
2350
- {
2351
- cssVariables: {
2352
- colorSchemeSelector: "data-mui-color-scheme"
2353
- },
2354
- colorSchemes: {
2355
- light: {
2356
- palette: {
2357
- primary: { main: WISTRON_PRIMARY_COLOR },
2358
- secondary: { main: WISTRON_SECONDARY_COLOR }
2359
- }
2360
- },
2361
- dark: {
2362
- palette: {
2363
- primary: { main: lighten(WISTRON_PRIMARY_COLOR, 0.5) },
2364
- secondary: { main: darken(WISTRON_SECONDARY_COLOR, 0.5) }
2365
- }
2366
- },
2367
- ...theme?.colorSchemes
2368
- },
2369
- components: {
2370
- MuiCssBaseline: {
2371
- styleOverrides: ({ palette }) => {
2372
- return {
2373
- body: {
2374
- "&::-webkit-scrollbar, & *::-webkit-scrollbar": {
2375
- width: "0.7em",
2376
- height: "0.7em"
2377
- },
2378
- "&::-webkit-scrollbar-track, & *::-webkit-scrollbar-track": {
2379
- backgroundColor: palette.mode === "dark" ? grey2[900] : grey2[200],
2380
- borderRadius: "5px"
2381
- },
2382
- "&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb": {
2383
- backgroundColor: palette.mode === "dark" ? grey2[800] : grey2[400],
2384
- borderRadius: "10px"
2385
- },
2386
- "&::-webkit-scrollbar-thumb:hover, & *::-webkit-scrollbar-thumb:hover": {
2387
- backgroundColor: palette.mode === "dark" ? grey2[700] : grey2[500]
2388
- },
2389
- "&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": {
2390
- backgroundColor: "transparent"
2391
- }
2392
- }
2393
- };
2394
- }
2395
- },
2396
- ...theme?.components
2397
- }
2398
- },
2399
- i18n2.resolvedLanguage === "cs" ? datePickersCsCz : datePickersEnUs,
2400
- i18n2.resolvedLanguage === "cs" ? dataGridCsCz : dataGridEnUs,
2401
- i18n2.resolvedLanguage === "cs" ? csCZ : enUS
2402
- );
2403
- };
2404
-
2405
- // src/components/core/Layout.tsx
2406
- import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
2407
- var DrawerHeader = styled2("div")(({ theme }) => ({
2408
- display: "flex",
2409
- alignItems: "center",
2410
- justifyContent: "flex-end",
2411
- padding: theme.spacing(0, 1),
2412
- ...theme.mixins.toolbar
2413
- }));
2414
- var Layout = (props) => {
2415
- const theme = useGetTheme(props.theme);
2416
- const [navigationOpen, setNavigationOpen] = useLocalStorageState("navigationOpen", { defaultServerValue: false });
2417
- const isFetching = !!useIsFetching();
2418
- const isMutating = !!useIsMutating();
2419
- return /* @__PURE__ */ jsxs14(ThemeProvider, { theme, children: [
2420
- /* @__PURE__ */ jsx26(InitColorSchemeScript, {}),
2421
- /* @__PURE__ */ jsx26(CssBaseline, {}),
2422
- /* @__PURE__ */ jsxs14(Box9, { sx: { display: "flex", height: "100dvh", maxHeight: "100dvh", overflow: "hidden", width: "100%" }, children: [
2423
- /* @__PURE__ */ jsx26(
2424
- AppBar,
2425
- {
2426
- color: "transparent",
2427
- position: "fixed",
2428
- sx: {
2429
- borderBottom: "1px solid",
2430
- borderColor: theme.vars?.palette.divider,
2431
- boxShadow: "none"
2432
- },
2433
- children: /* @__PURE__ */ jsxs14(Toolbar, { children: [
2434
- props.navigation && /* @__PURE__ */ jsx26(
2435
- IconButton5,
2436
- {
2437
- onClick: () => setNavigationOpen((previous) => !previous),
2438
- sx: { marginRight: 2 },
2439
- children: navigationOpen ? /* @__PURE__ */ jsx26(MenuOpen, {}) : /* @__PURE__ */ jsx26(Menu3, {})
2440
- }
2441
- ),
2442
- /* @__PURE__ */ jsx26(AppTitle, {}),
2443
- /* @__PURE__ */ jsx26(ToolbarAccount, {})
2444
- ] })
2445
- }
2446
- ),
2447
- props.navigation && /* @__PURE__ */ jsx26(NavigationRail, { navigation: props.navigation, expanded: navigationOpen ?? false, setExpanded: setNavigationOpen }),
2448
- /* @__PURE__ */ jsxs14(Box9, { component: "main", sx: { flexGrow: 1, display: "flex", flexDirection: "column", minWidth: 0, height: "100%", overflow: "hidden" }, children: [
2449
- /* @__PURE__ */ jsx26(DrawerHeader, {}),
2450
- /* @__PURE__ */ jsx26(Box9, { sx: { flex: 1, overflow: "auto", position: "relative" }, children: props.children })
2451
- ] })
2452
- ] }),
2453
- (isFetching || isMutating) && /* @__PURE__ */ jsx26(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
2454
- ] });
2455
- };
2456
-
2457
- // src/contexts/LayoutContext.ts
2458
- import { createContext as createContext3, useContext as useContext3 } from "react";
2459
- var LayoutContext = createContext3(null);
2460
-
2461
- // src/utils/i18n.ts
2462
- import { createIsomorphicFn } from "@tanstack/react-start";
2463
- import { getCookie } from "@tanstack/react-start/server";
2464
- import i18n from "i18next";
2465
- import LanguageDetector from "i18next-browser-languagedetector";
2466
- import HttpBackend from "i18next-http-backend";
2467
- import { initReactI18next } from "react-i18next";
2468
- import { default as default2 } from "i18next";
2469
- var i18nCookieName = "i18nextLng";
2470
- i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
2471
- fallbackLng: "en",
2472
- detection: {
2473
- order: ["cookie"],
2474
- lookupCookie: i18nCookieName,
2475
- caches: ["cookie"],
2476
- cookieMinutes: 60 * 24 * 365
2477
- },
2478
- interpolation: { escapeValue: false }
2479
- });
2480
- var setSSRLanguage = createIsomorphicFn().server(async () => {
2481
- const language = getCookie(i18nCookieName);
2482
- await i18n.changeLanguage(language || "en");
2483
- });
2484
-
2485
- // node_modules/@babel/runtime/helpers/esm/extends.js
2486
- function _extends() {
2487
- return _extends = Object.assign ? Object.assign.bind() : function(n) {
2488
- for (var e = 1; e < arguments.length; e++) {
2489
- var t2 = arguments[e];
2490
- for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
2491
- }
2492
- return n;
2493
- }, _extends.apply(null, arguments);
2494
- }
2495
-
2496
- // node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
2497
- function _objectWithoutPropertiesLoose(r, e) {
2498
- if (null == r) return {};
2499
- var t2 = {};
2500
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
2501
- if (-1 !== e.indexOf(n)) continue;
2502
- t2[n] = r[n];
2503
- }
2504
- return t2;
2505
- }
2506
-
2507
- // node_modules/@mui/x-date-pickers/esm/LocalizationProvider/LocalizationProvider.js
2508
- var import_prop_types = __toESM(require_prop_types(), 1);
2509
- import * as React11 from "react";
2510
- import { useThemeProps } from "@mui/material/styles";
2511
- import { jsx as _jsx } from "react/jsx-runtime";
2512
- var _excluded = ["localeText"];
2513
- var PickerAdapterContext = /* @__PURE__ */ React11.createContext(null);
2514
- if (process.env.NODE_ENV !== "production") PickerAdapterContext.displayName = "PickerAdapterContext";
2515
- var LocalizationProvider = function LocalizationProvider2(inProps) {
2516
- const {
2517
- localeText: inLocaleText
2518
- } = inProps, otherInProps = _objectWithoutPropertiesLoose(inProps, _excluded);
2519
- const {
2520
- adapter: parentAdapter,
2521
- localeText: parentLocaleText
2522
- } = React11.useContext(PickerAdapterContext) ?? {
2523
- utils: void 0,
2524
- adapter: void 0,
2525
- localeText: void 0
2295
+ toJsDate = (value) => {
2296
+ return value.toDate();
2526
2297
  };
2527
- const props = useThemeProps({
2528
- // We don't want to pass the `localeText` prop to the theme, that way it will always return the theme value,
2529
- // We will then merge this theme value with our value manually
2530
- props: otherInProps,
2531
- name: "MuiLocalizationProvider"
2532
- });
2533
- const {
2534
- children,
2535
- dateAdapter: DateAdapter,
2536
- dateFormats,
2537
- dateLibInstance,
2538
- adapterLocale,
2539
- localeText: themeLocaleText
2540
- } = props;
2541
- const localeText = React11.useMemo(() => _extends({}, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
2542
- const adapter = React11.useMemo(() => {
2543
- if (!DateAdapter) {
2544
- if (parentAdapter) {
2545
- return parentAdapter;
2546
- }
2298
+ parse = (value, format) => {
2299
+ if (value === "") {
2547
2300
  return null;
2548
2301
  }
2549
- const dateAdapter = new DateAdapter({
2550
- locale: adapterLocale,
2551
- formats: dateFormats,
2552
- instance: dateLibInstance
2302
+ return dayjs(value, format, this.locale, true);
2303
+ };
2304
+ getCurrentLocaleCode = () => {
2305
+ return this.locale || "en";
2306
+ };
2307
+ is12HourCycleInCurrentLocale = () => {
2308
+ return /A|a/.test(this.getLocaleFormats().LT || "");
2309
+ };
2310
+ expandFormat = (format) => {
2311
+ const localeFormats = this.getLocaleFormats();
2312
+ const t2 = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
2313
+ return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
2314
+ const B = b && b.toUpperCase();
2315
+ return a || localeFormats[b] || t2(localeFormats[B]);
2553
2316
  });
2554
- if (!dateAdapter.isMUIAdapter) {
2555
- throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`", "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", "More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join(`
2556
- `));
2317
+ };
2318
+ isValid = (value) => {
2319
+ if (value == null) {
2320
+ return false;
2557
2321
  }
2558
- return dateAdapter;
2559
- }, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentAdapter]);
2560
- const defaultDates = React11.useMemo(() => {
2561
- if (!adapter) {
2562
- return null;
2322
+ return value.isValid();
2323
+ };
2324
+ format = (value, formatKey) => {
2325
+ return this.formatByString(value, this.formats[formatKey]);
2326
+ };
2327
+ formatByString = (value, formatString) => {
2328
+ return this.setLocaleToValue(value).format(formatString);
2329
+ };
2330
+ formatNumber = (numberToFormat) => {
2331
+ return numberToFormat;
2332
+ };
2333
+ isEqual = (value, comparing) => {
2334
+ if (value === null && comparing === null) {
2335
+ return true;
2563
2336
  }
2564
- return {
2565
- minDate: adapter.date("1900-01-01T00:00:00.000"),
2566
- maxDate: adapter.date("2099-12-31T00:00:00.000")
2567
- };
2568
- }, [adapter]);
2569
- const contextValue = React11.useMemo(() => {
2570
- return {
2571
- utils: adapter,
2572
- adapter,
2573
- defaultDates,
2574
- localeText
2575
- };
2576
- }, [defaultDates, adapter, localeText]);
2577
- return /* @__PURE__ */ _jsx(PickerAdapterContext.Provider, {
2578
- value: contextValue,
2579
- children
2580
- });
2581
- };
2582
- if (process.env.NODE_ENV !== "production") LocalizationProvider.displayName = "LocalizationProvider";
2583
- process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
2584
- // ----------------------------- Warning --------------------------------
2585
- // | These PropTypes are generated from the TypeScript type definitions |
2586
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
2587
- // ----------------------------------------------------------------------
2588
- /**
2589
- * Locale for the date library you are using
2590
- */
2591
- adapterLocale: import_prop_types.default.any,
2592
- children: import_prop_types.default.node,
2593
- /**
2594
- * Date library adapter class function.
2595
- * @see See the localization provider {@link https://mui.com/x/react-date-pickers/quickstart/#integrate-provider-and-adapter date adapter setup section} for more details.
2596
- */
2597
- dateAdapter: import_prop_types.default.func,
2598
- /**
2599
- * Formats that are used for any child pickers
2600
- */
2601
- dateFormats: import_prop_types.default.shape({
2602
- dayOfMonth: import_prop_types.default.string,
2603
- dayOfMonthFull: import_prop_types.default.string,
2604
- fullDate: import_prop_types.default.string,
2605
- fullTime12h: import_prop_types.default.string,
2606
- fullTime24h: import_prop_types.default.string,
2607
- hours12h: import_prop_types.default.string,
2608
- hours24h: import_prop_types.default.string,
2609
- keyboardDate: import_prop_types.default.string,
2610
- keyboardDateTime12h: import_prop_types.default.string,
2611
- keyboardDateTime24h: import_prop_types.default.string,
2612
- meridiem: import_prop_types.default.string,
2613
- minutes: import_prop_types.default.string,
2614
- month: import_prop_types.default.string,
2615
- monthShort: import_prop_types.default.string,
2616
- normalDate: import_prop_types.default.string,
2617
- normalDateWithWeekday: import_prop_types.default.string,
2618
- seconds: import_prop_types.default.string,
2619
- shortDate: import_prop_types.default.string,
2620
- weekday: import_prop_types.default.string,
2621
- weekdayShort: import_prop_types.default.string,
2622
- year: import_prop_types.default.string
2623
- }),
2624
- /**
2625
- * Date library instance you are using, if it has some global overrides
2626
- * ```jsx
2627
- * dateLibInstance={momentTimeZone}
2628
- * ```
2629
- */
2630
- dateLibInstance: import_prop_types.default.any,
2631
- /**
2632
- * Locale for components texts
2633
- */
2634
- localeText: import_prop_types.default.object
2635
- } : void 0;
2636
-
2637
- // node_modules/@mui/x-internals/esm/warning/warning.js
2638
- var warnedOnceCache = /* @__PURE__ */ new Set();
2639
- function warnOnce(message, gravity = "warning") {
2640
- if (process.env.NODE_ENV === "production") {
2641
- return;
2642
- }
2643
- const cleanMessage = Array.isArray(message) ? message.join("\n") : message;
2644
- if (!warnedOnceCache.has(cleanMessage)) {
2645
- warnedOnceCache.add(cleanMessage);
2646
- if (gravity === "error") {
2647
- console.error(cleanMessage);
2648
- } else {
2649
- console.warn(cleanMessage);
2337
+ if (value === null || comparing === null) {
2338
+ return false;
2650
2339
  }
2651
- }
2652
- }
2653
-
2654
- // node_modules/@mui/x-date-pickers/esm/AdapterDayjs/AdapterDayjs.js
2655
- import dayjs from "dayjs";
2656
- import weekOfYearPlugin from "dayjs/plugin/weekOfYear.js";
2657
- import customParseFormatPlugin from "dayjs/plugin/customParseFormat.js";
2658
- import localizedFormatPlugin from "dayjs/plugin/localizedFormat.js";
2659
- import isBetweenPlugin from "dayjs/plugin/isBetween.js";
2660
- import advancedFormatPlugin from "dayjs/plugin/advancedFormat.js";
2661
- dayjs.extend(localizedFormatPlugin);
2662
- dayjs.extend(weekOfYearPlugin);
2663
- dayjs.extend(isBetweenPlugin);
2664
- dayjs.extend(advancedFormatPlugin);
2665
- var formatTokenMap = {
2666
- // Year
2667
- YY: "year",
2668
- YYYY: {
2669
- sectionType: "year",
2670
- contentType: "digit",
2671
- maxLength: 4
2672
- },
2673
- // Month
2674
- M: {
2675
- sectionType: "month",
2676
- contentType: "digit",
2677
- maxLength: 2
2678
- },
2679
- MM: "month",
2680
- MMM: {
2681
- sectionType: "month",
2682
- contentType: "letter"
2683
- },
2684
- MMMM: {
2685
- sectionType: "month",
2686
- contentType: "letter"
2687
- },
2688
- // Day of the month
2689
- D: {
2690
- sectionType: "day",
2691
- contentType: "digit",
2692
- maxLength: 2
2693
- },
2694
- DD: "day",
2695
- Do: {
2696
- sectionType: "day",
2697
- contentType: "digit-with-letter"
2698
- },
2699
- // Day of the week
2700
- d: {
2701
- sectionType: "weekDay",
2702
- contentType: "digit",
2703
- maxLength: 2
2704
- },
2705
- dd: {
2706
- sectionType: "weekDay",
2707
- contentType: "letter"
2708
- },
2709
- ddd: {
2710
- sectionType: "weekDay",
2711
- contentType: "letter"
2712
- },
2713
- dddd: {
2714
- sectionType: "weekDay",
2715
- contentType: "letter"
2716
- },
2717
- // Meridiem
2718
- A: "meridiem",
2719
- a: "meridiem",
2720
- // Hours
2721
- H: {
2722
- sectionType: "hours",
2723
- contentType: "digit",
2724
- maxLength: 2
2725
- },
2726
- HH: "hours",
2727
- h: {
2728
- sectionType: "hours",
2729
- contentType: "digit",
2730
- maxLength: 2
2731
- },
2732
- hh: "hours",
2733
- // Minutes
2734
- m: {
2735
- sectionType: "minutes",
2736
- contentType: "digit",
2737
- maxLength: 2
2738
- },
2739
- mm: "minutes",
2740
- // Seconds
2741
- s: {
2742
- sectionType: "seconds",
2743
- contentType: "digit",
2744
- maxLength: 2
2745
- },
2746
- ss: "seconds"
2747
- };
2748
- var defaultFormats = {
2749
- year: "YYYY",
2750
- month: "MMMM",
2751
- monthShort: "MMM",
2752
- dayOfMonth: "D",
2753
- dayOfMonthFull: "Do",
2754
- weekday: "dddd",
2755
- weekdayShort: "dd",
2756
- hours24h: "HH",
2757
- hours12h: "hh",
2758
- meridiem: "A",
2759
- minutes: "mm",
2760
- seconds: "ss",
2761
- fullDate: "ll",
2762
- keyboardDate: "L",
2763
- shortDate: "MMM D",
2764
- normalDate: "D MMMM",
2765
- normalDateWithWeekday: "ddd, MMM D",
2766
- fullTime12h: "hh:mm A",
2767
- fullTime24h: "HH:mm",
2768
- keyboardDateTime12h: "L hh:mm A",
2769
- keyboardDateTime24h: "L HH:mm"
2770
- };
2771
- var MISSING_UTC_PLUGIN = ["Missing UTC plugin", "To be able to use UTC or timezones, you have to enable the `utc` plugin", "Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join("\n");
2772
- var MISSING_TIMEZONE_PLUGIN = ["Missing timezone plugin", "To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin", "Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join("\n");
2773
- var AdapterDayjs = class {
2774
- isMUIAdapter = true;
2775
- isTimezoneCompatible = true;
2776
- lib = "dayjs";
2777
- escapedCharacters = {
2778
- start: "[",
2779
- end: "]"
2340
+ return value.toDate().getTime() === comparing.toDate().getTime();
2780
2341
  };
2781
- formatTokenMap = /* @__PURE__ */ (() => formatTokenMap)();
2782
- constructor({
2783
- locale,
2784
- formats
2785
- } = {}) {
2786
- this.locale = locale;
2787
- this.formats = _extends({}, defaultFormats, formats);
2788
- dayjs.extend(customParseFormatPlugin);
2789
- }
2790
- setLocaleToValue = (value) => {
2791
- const expectedLocale = this.getCurrentLocaleCode();
2792
- if (expectedLocale === value.locale()) {
2793
- return value;
2794
- }
2795
- return value.locale(expectedLocale);
2796
- };
2797
- hasUTCPlugin = () => typeof dayjs.utc !== "undefined";
2798
- hasTimezonePlugin = () => typeof dayjs.tz !== "undefined";
2799
- isSame = (value, comparing, comparisonTemplate) => {
2800
- const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
2801
- return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
2802
- };
2803
- /**
2804
- * Replaces "default" by undefined and "system" by the system timezone before passing it to `dayjs`.
2805
- */
2806
- cleanTimezone = (timezone) => {
2807
- switch (timezone) {
2808
- case "default": {
2809
- return void 0;
2810
- }
2811
- case "system": {
2812
- return dayjs.tz.guess();
2813
- }
2814
- default: {
2815
- return timezone;
2816
- }
2817
- }
2818
- };
2819
- createSystemDate = (value) => {
2820
- let date;
2821
- if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
2822
- const timezone = dayjs.tz.guess();
2823
- if (timezone === "UTC") {
2824
- date = dayjs(value);
2825
- } else {
2826
- date = dayjs.tz(value, timezone);
2827
- }
2828
- } else {
2829
- date = dayjs(value);
2830
- }
2831
- return this.setLocaleToValue(date);
2832
- };
2833
- createUTCDate = (value) => {
2834
- if (!this.hasUTCPlugin()) {
2835
- throw new Error(MISSING_UTC_PLUGIN);
2836
- }
2837
- return this.setLocaleToValue(dayjs.utc(value));
2838
- };
2839
- createTZDate = (value, timezone) => {
2840
- if (!this.hasUTCPlugin()) {
2841
- throw new Error(MISSING_UTC_PLUGIN);
2842
- }
2843
- if (!this.hasTimezonePlugin()) {
2844
- throw new Error(MISSING_TIMEZONE_PLUGIN);
2845
- }
2846
- const keepLocalTime = value !== void 0 && !value.endsWith("Z");
2847
- return this.setLocaleToValue(dayjs(value).tz(this.cleanTimezone(timezone), keepLocalTime));
2848
- };
2849
- getLocaleFormats = () => {
2850
- const locales = dayjs.Ls;
2851
- const locale = this.locale || "en";
2852
- let localeObject = locales[locale];
2853
- if (localeObject === void 0) {
2854
- if (process.env.NODE_ENV !== "production") {
2855
- warnOnce(["MUI X: Your locale has not been found.", "Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.", "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", "fallback on English locale."]);
2856
- }
2857
- localeObject = locales.en;
2858
- }
2859
- return localeObject.formats;
2860
- };
2861
- /**
2862
- * If the new day does not have the same offset as the old one (when switching to summer day time for example),
2863
- * Then dayjs will not automatically adjust the offset (moment does).
2864
- * We have to parse again the value to make sure the `fixOffset` method is applied.
2865
- * See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
2866
- */
2867
- adjustOffset = (value) => {
2868
- if (!this.hasTimezonePlugin()) {
2869
- return value;
2870
- }
2871
- const timezone = this.getTimezone(value);
2872
- if (timezone !== "UTC") {
2873
- const fixedValue = value.tz(this.cleanTimezone(timezone), true);
2874
- if (fixedValue.$offset === (value.$offset ?? 0)) {
2875
- return value;
2876
- }
2877
- value.$offset = fixedValue.$offset;
2878
- }
2879
- return value;
2880
- };
2881
- date = (value, timezone = "default") => {
2882
- if (value === null) {
2883
- return null;
2884
- }
2885
- if (timezone === "UTC") {
2886
- return this.createUTCDate(value);
2887
- }
2888
- if (timezone === "system" || timezone === "default" && !this.hasTimezonePlugin()) {
2889
- return this.createSystemDate(value);
2890
- }
2891
- return this.createTZDate(value, timezone);
2892
- };
2893
- getInvalidDate = () => dayjs(/* @__PURE__ */ new Date("Invalid date"));
2894
- getTimezone = (value) => {
2895
- if (this.hasTimezonePlugin()) {
2896
- const zone = value.$x?.$timezone;
2897
- if (zone) {
2898
- return zone;
2899
- }
2900
- }
2901
- if (this.hasUTCPlugin() && value.isUTC()) {
2902
- return "UTC";
2903
- }
2904
- return "system";
2905
- };
2906
- setTimezone = (value, timezone) => {
2907
- if (this.getTimezone(value) === timezone) {
2908
- return value;
2909
- }
2910
- if (timezone === "UTC") {
2911
- if (!this.hasUTCPlugin()) {
2912
- throw new Error(MISSING_UTC_PLUGIN);
2913
- }
2914
- return value.utc();
2915
- }
2916
- if (timezone === "system") {
2917
- return value.local();
2918
- }
2919
- if (!this.hasTimezonePlugin()) {
2920
- if (timezone === "default") {
2921
- return value;
2922
- }
2923
- throw new Error(MISSING_TIMEZONE_PLUGIN);
2924
- }
2925
- return this.setLocaleToValue(dayjs.tz(value, this.cleanTimezone(timezone)));
2926
- };
2927
- toJsDate = (value) => {
2928
- return value.toDate();
2929
- };
2930
- parse = (value, format) => {
2931
- if (value === "") {
2932
- return null;
2933
- }
2934
- return dayjs(value, format, this.locale, true);
2935
- };
2936
- getCurrentLocaleCode = () => {
2937
- return this.locale || "en";
2938
- };
2939
- is12HourCycleInCurrentLocale = () => {
2940
- return /A|a/.test(this.getLocaleFormats().LT || "");
2941
- };
2942
- expandFormat = (format) => {
2943
- const localeFormats = this.getLocaleFormats();
2944
- const t2 = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
2945
- return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
2946
- const B = b && b.toUpperCase();
2947
- return a || localeFormats[b] || t2(localeFormats[B]);
2948
- });
2949
- };
2950
- isValid = (value) => {
2951
- if (value == null) {
2952
- return false;
2953
- }
2954
- return value.isValid();
2955
- };
2956
- format = (value, formatKey) => {
2957
- return this.formatByString(value, this.formats[formatKey]);
2958
- };
2959
- formatByString = (value, formatString) => {
2960
- return this.setLocaleToValue(value).format(formatString);
2961
- };
2962
- formatNumber = (numberToFormat) => {
2963
- return numberToFormat;
2964
- };
2965
- isEqual = (value, comparing) => {
2966
- if (value === null && comparing === null) {
2967
- return true;
2968
- }
2969
- if (value === null || comparing === null) {
2970
- return false;
2971
- }
2972
- return value.toDate().getTime() === comparing.toDate().getTime();
2973
- };
2974
- isSameYear = (value, comparing) => {
2975
- return this.isSame(value, comparing, "YYYY");
2342
+ isSameYear = (value, comparing) => {
2343
+ return this.isSame(value, comparing, "YYYY");
2976
2344
  };
2977
2345
  isSameMonth = (value, comparing) => {
2978
2346
  return this.isSame(value, comparing, "YYYY-MM");
@@ -3103,118 +2471,750 @@ var AdapterDayjs = class {
3103
2471
  setMilliseconds = (value, milliseconds) => {
3104
2472
  return this.adjustOffset(value.set("millisecond", milliseconds));
3105
2473
  };
3106
- getDaysInMonth = (value) => {
3107
- return value.daysInMonth();
2474
+ getDaysInMonth = (value) => {
2475
+ return value.daysInMonth();
2476
+ };
2477
+ getWeekArray = (value) => {
2478
+ const start = this.startOfWeek(this.startOfMonth(value));
2479
+ const end = this.endOfWeek(this.endOfMonth(value));
2480
+ let count = 0;
2481
+ let current = start;
2482
+ const nestedWeeks = [];
2483
+ while (current < end) {
2484
+ const weekNumber = Math.floor(count / 7);
2485
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
2486
+ nestedWeeks[weekNumber].push(current);
2487
+ current = this.addDays(current, 1);
2488
+ count += 1;
2489
+ }
2490
+ return nestedWeeks;
2491
+ };
2492
+ getWeekNumber = (value) => {
2493
+ return value.week();
2494
+ };
2495
+ getDayOfWeek(value) {
2496
+ return value.day() + 1;
2497
+ }
2498
+ getYearRange = ([start, end]) => {
2499
+ const startDate = this.startOfYear(start);
2500
+ const endDate = this.endOfYear(end);
2501
+ const years = [];
2502
+ let current = startDate;
2503
+ while (this.isBefore(current, endDate)) {
2504
+ years.push(current);
2505
+ current = this.addYears(current, 1);
2506
+ }
2507
+ return years;
2508
+ };
2509
+ };
2510
+
2511
+ // src/providers/LayoutProvider.tsx
2512
+ import { useEffect as useEffect6, useState as useState10 } from "react";
2513
+ import { useTranslation as useTranslation7 } from "react-i18next";
2514
+ import * as z from "zod";
2515
+ import { cs, en } from "zod/locales";
2516
+
2517
+ // src/providers/DialogsProvider.tsx
2518
+ import { useCallback, useId, useMemo as useMemo3, useRef as useRef3, useState as useState6 } from "react";
2519
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
2520
+ function DialogsProvider({ children, unmountAfter = 1e3 }) {
2521
+ const [stack, setStack] = useState6([]);
2522
+ const keyPrefix = useId();
2523
+ const nextId = useRef3(0);
2524
+ const dialogMetadata = useRef3(/* @__PURE__ */ new WeakMap());
2525
+ const requestDialog = useEventCallback_default(function open(Component7, payload, options = {}) {
2526
+ const { onClose = async () => {
2527
+ } } = options;
2528
+ let resolve;
2529
+ const promise = new Promise((resolveImpl) => {
2530
+ resolve = resolveImpl;
2531
+ });
2532
+ const key = `${keyPrefix}-${nextId.current}`;
2533
+ nextId.current += 1;
2534
+ const newEntry = {
2535
+ key,
2536
+ open: true,
2537
+ promise,
2538
+ Component: Component7,
2539
+ payload,
2540
+ onClose,
2541
+ resolve
2542
+ };
2543
+ dialogMetadata.current.set(promise, newEntry);
2544
+ setStack((previousStack) => [...previousStack, newEntry]);
2545
+ return promise;
2546
+ });
2547
+ const removeDialogFromStack = useCallback((dialog) => {
2548
+ setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
2549
+ dialogMetadata.current.delete(dialog);
2550
+ }, []);
2551
+ const closeDialogUi = useEventCallback_default(function closeDialogUi2(dialog) {
2552
+ setStack(
2553
+ (previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
2554
+ );
2555
+ setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
2556
+ });
2557
+ const closeDialog = useEventCallback_default(async function closeDialog2(dialog, result) {
2558
+ const entryToClose = dialogMetadata.current.get(dialog);
2559
+ if (!entryToClose) {
2560
+ throw new Error("Dialog not found in stack");
2561
+ }
2562
+ try {
2563
+ await entryToClose.onClose(result);
2564
+ } finally {
2565
+ entryToClose.resolve(result);
2566
+ closeDialogUi(dialog);
2567
+ }
2568
+ return dialog;
2569
+ });
2570
+ const contextValue = useMemo3(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
2571
+ return /* @__PURE__ */ jsxs12(DialogsContext.Provider, { value: contextValue, children: [
2572
+ children,
2573
+ stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx22(
2574
+ Component7,
2575
+ {
2576
+ payload,
2577
+ open,
2578
+ onClose: async (result) => {
2579
+ await closeDialog(promise, result);
2580
+ }
2581
+ },
2582
+ key
2583
+ ))
2584
+ ] });
2585
+ }
2586
+
2587
+ // src/utils/i18n.ts
2588
+ import { createIsomorphicFn } from "@tanstack/react-start";
2589
+ import { getCookie } from "@tanstack/react-start/server";
2590
+ import i18n from "i18next";
2591
+ import LanguageDetector from "i18next-browser-languagedetector";
2592
+ import HttpBackend from "i18next-http-backend";
2593
+ import { initReactI18next } from "react-i18next";
2594
+ import { default as default2 } from "i18next";
2595
+ var i18nCookieName = "i18nextLng";
2596
+ i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
2597
+ fallbackLng: "en",
2598
+ detection: {
2599
+ order: ["cookie"],
2600
+ lookupCookie: i18nCookieName,
2601
+ caches: ["cookie"],
2602
+ cookieMinutes: 60 * 24 * 365
2603
+ },
2604
+ interpolation: { escapeValue: false }
2605
+ });
2606
+ var setSSRLanguage = createIsomorphicFn().server(async () => {
2607
+ const language = getCookie(i18nCookieName);
2608
+ await i18n.changeLanguage(language || "en");
2609
+ });
2610
+
2611
+ // src/contexts/LayoutContext.ts
2612
+ import { createContext as createContext4, useContext as useContext4 } from "react";
2613
+ var LayoutContext = createContext4(null);
2614
+
2615
+ // src/components/core/Layout.tsx
2616
+ import Menu3 from "@mui/icons-material/Menu";
2617
+ import MenuOpen from "@mui/icons-material/MenuOpen";
2618
+ import { AppBar, Box as Box9, CssBaseline, IconButton as IconButton5, InitColorSchemeScript, LinearProgress, Toolbar } from "@mui/material";
2619
+ import { ThemeProvider, styled as styled2 } from "@mui/material/styles";
2620
+ import { useIsFetching, useIsMutating } from "@tanstack/react-query";
2621
+ import useLocalStorageState from "use-local-storage-state";
2622
+
2623
+ // src/components/core/navigation/NavigationRail.tsx
2624
+ import { useMediaQuery } from "@mui/material";
2625
+ import Box7 from "@mui/material/Box";
2626
+ import Drawer from "@mui/material/Drawer";
2627
+ import { useTheme as useTheme2 } from "@mui/material/styles";
2628
+ import { useNavigate, useRouterState as useRouterState2 } from "@tanstack/react-router";
2629
+
2630
+ // src/components/core/navigation/NavigationList.tsx
2631
+ import Divider3 from "@mui/material/Divider";
2632
+ import List3 from "@mui/material/List";
2633
+ import ListSubheader from "@mui/material/ListSubheader";
2634
+ import { Fragment as Fragment5, useEffect as useEffect5, useState as useState8 } from "react";
2635
+
2636
+ // src/components/core/navigation/NavigationListItem.tsx
2637
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
2638
+ import Avatar from "@mui/material/Avatar";
2639
+ import Box6 from "@mui/material/Box";
2640
+ import Popper from "@mui/material/Popper";
2641
+ import ListItem from "@mui/material/ListItem";
2642
+ import ListItemButton4 from "@mui/material/ListItemButton";
2643
+ import ListItemIcon3 from "@mui/material/ListItemIcon";
2644
+ import ListItemText3 from "@mui/material/ListItemText";
2645
+ import Paper2 from "@mui/material/Paper";
2646
+ import { styled } from "@mui/material/styles";
2647
+ import Typography7 from "@mui/material/Typography";
2648
+ import { Fragment as Fragment3, useMemo as useMemo4, useState as useState7 } from "react";
2649
+ import { Collapse } from "@mui/material";
2650
+ import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
2651
+ var ICON_SIZE = 34;
2652
+ var StyledNavButton = styled(ListItemButton4)(({ theme }) => ({
2653
+ borderRadius: 8,
2654
+ "&.Mui-selected": {
2655
+ "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
2656
+ color: (theme.vars ?? theme).palette.primary.dark
2657
+ },
2658
+ "& .MuiAvatar-root": {
2659
+ backgroundColor: (theme.vars ?? theme).palette.primary.dark
2660
+ },
2661
+ "& .MuiTouchRipple-child": {
2662
+ backgroundColor: (theme.vars ?? theme).palette.primary.dark
2663
+ }
2664
+ },
2665
+ "& .MuiSvgIcon-root": {
2666
+ color: (theme.vars ?? theme).palette.action.active
2667
+ },
2668
+ "& .MuiAvatar-root": {
2669
+ backgroundColor: (theme.vars ?? theme).palette.action.active
2670
+ }
2671
+ }));
2672
+ var StyledRouterButton = styled(RouterListItemButton)(({ theme }) => ({
2673
+ borderRadius: 8,
2674
+ "&.Mui-selected": {
2675
+ "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
2676
+ color: (theme.vars ?? theme).palette.primary.dark
2677
+ },
2678
+ "& .MuiAvatar-root": {
2679
+ backgroundColor: (theme.vars ?? theme).palette.primary.dark
2680
+ },
2681
+ "& .MuiTouchRipple-child": {
2682
+ backgroundColor: (theme.vars ?? theme).palette.primary.dark
2683
+ }
2684
+ },
2685
+ "& .MuiSvgIcon-root": {
2686
+ color: (theme.vars ?? theme).palette.action.active
2687
+ },
2688
+ "& .MuiAvatar-root": {
2689
+ backgroundColor: (theme.vars ?? theme).palette.action.active
2690
+ }
2691
+ }));
2692
+ var IconOrAvatar = ({ item, collapsed }) => {
2693
+ if (item.icon || collapsed) {
2694
+ return /* @__PURE__ */ jsxs13(Box6, { sx: collapsed ? { position: "absolute", left: "50%", top: "calc(50% - 6px)", transform: "translate(-50%, -50%)" } : {}, children: [
2695
+ /* @__PURE__ */ jsxs13(ListItemIcon3, { sx: { display: "flex", alignItems: "center", justifyContent: "center", minWidth: ICON_SIZE }, children: [
2696
+ item.icon ?? null,
2697
+ !item.icon && collapsed ? /* @__PURE__ */ jsx23(Avatar, { sx: { width: ICON_SIZE - 7, height: ICON_SIZE - 7, fontSize: 12 }, children: item.title }) : null
2698
+ ] }),
2699
+ collapsed ? /* @__PURE__ */ jsx23(
2700
+ Typography7,
2701
+ {
2702
+ variant: "caption",
2703
+ sx: {
2704
+ position: "absolute",
2705
+ bottom: -18,
2706
+ left: "50%",
2707
+ transform: "translateX(-50%)",
2708
+ fontSize: 10,
2709
+ fontWeight: 500,
2710
+ textAlign: "center",
2711
+ whiteSpace: "nowrap",
2712
+ overflow: "hidden",
2713
+ textOverflow: "ellipsis",
2714
+ maxWidth: MINI_WIDTH - 28
2715
+ },
2716
+ children: item.title
2717
+ }
2718
+ ) : null
2719
+ ] });
2720
+ }
2721
+ return null;
2722
+ };
2723
+ var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx23(
2724
+ Popper,
2725
+ {
2726
+ open,
2727
+ anchorEl,
2728
+ placement: "right-start",
2729
+ modifiers: [
2730
+ { name: "offset", options: { offset: [6, 0] } },
2731
+ { name: "preventOverflow", options: { padding: 8 } },
2732
+ { name: "flip", options: { fallbackPlacements: ["right-end", "left-start"] } }
2733
+ ],
2734
+ children: /* @__PURE__ */ jsx23(
2735
+ Paper2,
2736
+ {
2737
+ sx: {
2738
+ pt: 0.5,
2739
+ pb: 0.5,
2740
+ maxHeight: "min(calc(100vh - 100px), 560px)",
2741
+ overflowY: "auto",
2742
+ overscrollBehavior: "contain"
2743
+ },
2744
+ children
2745
+ }
2746
+ )
2747
+ }
2748
+ );
2749
+ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, onClick, renderNested }) => {
2750
+ const [hoveredPopoverItem, setHoveredPopoverItem] = useState7(null);
2751
+ const [anchorElement, setAnchorElement] = useState7(null);
2752
+ const chevronSx = useMemo4(() => {
2753
+ if (collapsed && isSidebarFullyCollapsed && item.children) {
2754
+ return {
2755
+ fontSize: 18,
2756
+ position: "absolute",
2757
+ top: "41.5%",
2758
+ right: "2px",
2759
+ transform: "translateY(-50%) rotate(-90deg)"
2760
+ };
2761
+ }
2762
+ if (!collapsed && isSidebarFullyExpanded && item.children) {
2763
+ return {
2764
+ ml: 0.5,
2765
+ transform: `rotate(${isOpen ? 0 : -90}deg)`
2766
+ };
2767
+ }
2768
+ return { display: "none" };
2769
+ }, [collapsed, isSidebarFullyExpanded, isSidebarFullyCollapsed, isOpen, item.children]);
2770
+ const shouldJustExpand = item.children && !collapsed;
2771
+ const buttonProps = {
2772
+ selected,
2773
+ disabled,
2774
+ sx: { px: 1.4, height: collapsed ? 60 : 48 }
2775
+ };
2776
+ const buttonContent = /* @__PURE__ */ jsxs13(Fragment4, { children: [
2777
+ /* @__PURE__ */ jsx23(IconOrAvatar, { item, collapsed }),
2778
+ !collapsed && /* @__PURE__ */ jsx23(
2779
+ ListItemText3,
2780
+ {
2781
+ primary: item.title,
2782
+ slotProps: { primary: { noWrap: true, title: item.title } },
2783
+ sx: { ml: 1.2, flex: 1, minWidth: 0, "& .MuiTypography-root": { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }
2784
+ }
2785
+ ),
2786
+ item.children ? /* @__PURE__ */ jsx23(ExpandMoreIcon, { sx: chevronSx }) : null
2787
+ ] });
2788
+ const listItem = /* @__PURE__ */ jsxs13(
2789
+ ListItem,
2790
+ {
2791
+ ...item.children && collapsed ? {
2792
+ onMouseEnter: (event) => {
2793
+ setAnchorElement(event.currentTarget);
2794
+ setHoveredPopoverItem(item.title);
2795
+ },
2796
+ onMouseLeave: () => {
2797
+ setHoveredPopoverItem(null);
2798
+ }
2799
+ } : {},
2800
+ sx: { py: 0, px: 1, overflowX: "hidden" },
2801
+ children: [
2802
+ shouldJustExpand ? /* @__PURE__ */ jsx23(StyledNavButton, { ...buttonProps, onClick: () => onClick?.(item), children: buttonContent }) : /* @__PURE__ */ jsx23(
2803
+ StyledRouterButton,
2804
+ {
2805
+ ...buttonProps,
2806
+ to: item.to,
2807
+ href: item.href,
2808
+ params: item.params,
2809
+ search: item.search,
2810
+ children: buttonContent
2811
+ }
2812
+ ),
2813
+ item.children && collapsed ? /* @__PURE__ */ jsx23(MiniPopover, { open: item.title === hoveredPopoverItem, anchorEl: anchorElement, children: renderNested?.(item.children) }) : null
2814
+ ]
2815
+ }
2816
+ );
2817
+ return /* @__PURE__ */ jsxs13(Fragment3, { children: [
2818
+ listItem,
2819
+ item.children && !collapsed ? /* @__PURE__ */ jsx23(Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true, children: renderNested?.(item.children) }) : null
2820
+ ] }, item.to);
2821
+ };
2822
+
2823
+ // src/components/core/navigation/NavigationList.tsx
2824
+ import { jsx as jsx24 } from "react/jsx-runtime";
2825
+ var isPageItem = (item) => !("kind" in item);
2826
+ var isDivider = (item) => "kind" in item && item.kind === "divider";
2827
+ var isHeader = (item) => "kind" in item && item.kind === "header";
2828
+ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, expandedWidth, renderItem, activePath, onNavigate }) => {
2829
+ const [openKeys, setOpenKeys] = useState8([]);
2830
+ useEffect5(() => {
2831
+ if (collapsed) setOpenKeys([]);
2832
+ }, [collapsed]);
2833
+ const toggleKey = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
2834
+ const renderNested = (children) => /* @__PURE__ */ jsx24(
2835
+ NavigationList,
2836
+ {
2837
+ subNavigation: children,
2838
+ depth: depth + 1,
2839
+ isPopover: collapsed,
2840
+ expandedWidth,
2841
+ activePath,
2842
+ onNavigate
2843
+ }
2844
+ );
2845
+ const filteredNavigation = subNavigation.filter((nav) => !nav.hidden);
2846
+ return /* @__PURE__ */ jsx24(
2847
+ List3,
2848
+ {
2849
+ sx: {
2850
+ padding: 0,
2851
+ mt: isPopover && depth === 1 ? 0.5 : 0,
2852
+ mb: depth === 0 && !isPopover ? 4 : 0.5,
2853
+ pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
2854
+ minWidth: isPopover && depth === 1 ? EXPANDED_WIDTH : "auto",
2855
+ width: collapsed ? MINI_WIDTH : "auto"
2856
+ },
2857
+ children: filteredNavigation.map((navItem, index) => {
2858
+ if (isHeader(navItem)) {
2859
+ return /* @__PURE__ */ jsx24(
2860
+ ListSubheader,
2861
+ {
2862
+ sx: {
2863
+ fontSize: 12,
2864
+ fontWeight: "700",
2865
+ height: collapsed ? 0 : 40,
2866
+ px: 2,
2867
+ minWidth: expandedWidth,
2868
+ overflow: "hidden",
2869
+ textOverflow: "ellipsis",
2870
+ whiteSpace: "nowrap",
2871
+ zIndex: 2,
2872
+ bgcolor: "transparent",
2873
+ position: "static"
2874
+ },
2875
+ children: navItem.title
2876
+ },
2877
+ `subheader-${depth}-${index}`
2878
+ );
2879
+ }
2880
+ if (isDivider(navItem)) {
2881
+ const nextItem = filteredNavigation[index + 1];
2882
+ return /* @__PURE__ */ jsx24("li", { children: /* @__PURE__ */ jsx24(Divider3, { sx: { mx: 1, mt: 1, mb: isHeader(nextItem) && !collapsed ? 0 : 1 } }) }, `divider-${depth}-${index}`);
2883
+ }
2884
+ if (!isPageItem(navItem)) return null;
2885
+ const key = `item-${depth}-${index}`;
2886
+ const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
2887
+ if (renderItem) return /* @__PURE__ */ jsx24(Fragment5, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key);
2888
+ return /* @__PURE__ */ jsx24(
2889
+ NavigationListItem,
2890
+ {
2891
+ item: navItem,
2892
+ isOpen: openKeys.includes(uniqueItemKey),
2893
+ selected: activePath === navItem.to,
2894
+ collapsed,
2895
+ isSidebarFullyExpanded,
2896
+ isSidebarFullyCollapsed,
2897
+ onClick: navItem.children && !collapsed ? () => toggleKey(uniqueItemKey) : void 0,
2898
+ renderNested
2899
+ },
2900
+ key
2901
+ );
2902
+ })
2903
+ }
2904
+ );
2905
+ };
2906
+
2907
+ // src/components/core/navigation/NavigationRail.tsx
2908
+ import { jsx as jsx25 } from "react/jsx-runtime";
2909
+ var MINI_WIDTH = 84;
2910
+ var EXPANDED_WIDTH = 320;
2911
+ var TOOLBAR_HEIGHT = 65;
2912
+ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
2913
+ const navigate = useNavigate();
2914
+ const routerState = useRouterState2();
2915
+ const theme = useTheme2();
2916
+ const showPermanent = useMediaQuery(theme.breakpoints.up("sm"));
2917
+ const drawerContent = (collapsed) => /* @__PURE__ */ jsx25(
2918
+ Box7,
2919
+ {
2920
+ component: "nav",
2921
+ sx: {
2922
+ height: "100%",
2923
+ display: "flex",
2924
+ flexDirection: "column",
2925
+ justifyContent: "space-between",
2926
+ overflow: "auto",
2927
+ scrollbarGutter: collapsed ? "stable" : "auto",
2928
+ overflowX: "hidden",
2929
+ pt: navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2
2930
+ },
2931
+ children: /* @__PURE__ */ jsx25(
2932
+ NavigationList,
2933
+ {
2934
+ subNavigation: navigation,
2935
+ collapsed,
2936
+ isSidebarFullyExpanded: expanded,
2937
+ isSidebarFullyCollapsed: !expanded,
2938
+ expandedWidth: EXPANDED_WIDTH,
2939
+ activePath: routerState.location.pathname,
2940
+ onNavigate: navigate
2941
+ }
2942
+ )
2943
+ }
2944
+ );
2945
+ if (showPermanent)
2946
+ return /* @__PURE__ */ jsx25(
2947
+ Drawer,
2948
+ {
2949
+ variant: "permanent",
2950
+ sx: {
2951
+ width: expanded ? EXPANDED_WIDTH : MINI_WIDTH,
2952
+ ["& .MuiDrawer-paper"]: {
2953
+ position: "absolute",
2954
+ top: `${TOOLBAR_HEIGHT}px`,
2955
+ height: `calc(100% - ${TOOLBAR_HEIGHT}px)`,
2956
+ width: expanded ? EXPANDED_WIDTH : MINI_WIDTH
2957
+ }
2958
+ },
2959
+ children: drawerContent(!expanded)
2960
+ }
2961
+ );
2962
+ return /* @__PURE__ */ jsx25(Drawer, { open: expanded, onClose: () => setExpanded(false), children: drawerContent(!expanded) });
2963
+ };
2964
+
2965
+ // src/components/core/ToolbarAccount.tsx
2966
+ import AccountCircle from "@mui/icons-material/AccountCircle";
2967
+ import ArrowBack from "@mui/icons-material/ArrowBack";
2968
+ import Brightness4 from "@mui/icons-material/Brightness4";
2969
+ import ChevronRight from "@mui/icons-material/ChevronRight";
2970
+ import DarkMode from "@mui/icons-material/DarkMode";
2971
+ import LightMode from "@mui/icons-material/LightMode";
2972
+ import Login from "@mui/icons-material/Login";
2973
+ import Logout from "@mui/icons-material/Logout";
2974
+ import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
2975
+ import Translate from "@mui/icons-material/Translate";
2976
+ import { Avatar as Avatar2, Box as Box8, IconButton as IconButton4, List as List4, ListItem as ListItem2, ListItemButton as ListItemButton5, ListItemIcon as ListItemIcon4, ListItemText as ListItemText4, ListSubheader as ListSubheader2, Menu as Menu2, Typography as Typography8, useColorScheme } from "@mui/material";
2977
+ import { Fragment as Fragment6, useState as useState9 } from "react";
2978
+ import { useTranslation as useTranslation5 } from "react-i18next";
2979
+
2980
+ // src/auth-test/keycloak.ts
2981
+ import { useRouter } from "@tanstack/react-router";
2982
+ import Keycloak from "keycloak-js";
2983
+ var keycloakConfig = {
2984
+ url: import.meta.env.VITE_KEYCLOAK_URL,
2985
+ realm: import.meta.env.VITE_KEYCLOAK_REALM,
2986
+ clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
2987
+ idpHint: import.meta.env.VITE_KEYCLOAK_IDP_HINT,
2988
+ confidentialClientId: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
2989
+ confidentialClientSecret: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET
2990
+ };
2991
+ function useKeycloak() {
2992
+ const routerContext = useRouter();
2993
+ const keycloak = routerContext.options.context.keycloak;
2994
+ return keycloak;
2995
+ }
2996
+
2997
+ // src/components/core/ToolbarAccount.tsx
2998
+ import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
2999
+ var ToolbarAccount = () => {
3000
+ const [anchorElement, setAnchorElement] = useState9();
3001
+ const [tab, setTab] = useState9("settings");
3002
+ const open = Boolean(anchorElement);
3003
+ const { t: t2, i18n: i18n2 } = useTranslation5();
3004
+ const { mode, setMode } = useColorScheme();
3005
+ const changeLanguage = (newLanguage) => () => {
3006
+ i18n2.changeLanguage(newLanguage).finally(() => closeMenu());
3007
+ };
3008
+ const changeMode = (newMode) => () => {
3009
+ setMode(newMode);
3010
+ closeMenu();
3108
3011
  };
3109
- getWeekArray = (value) => {
3110
- const start = this.startOfWeek(this.startOfMonth(value));
3111
- const end = this.endOfWeek(this.endOfMonth(value));
3112
- let count = 0;
3113
- let current = start;
3114
- const nestedWeeks = [];
3115
- while (current < end) {
3116
- const weekNumber = Math.floor(count / 7);
3117
- nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
3118
- nestedWeeks[weekNumber].push(current);
3119
- current = this.addDays(current, 1);
3120
- count += 1;
3012
+ const keycloak = useKeycloak();
3013
+ const user = keycloak.user;
3014
+ const getModeText = () => {
3015
+ switch (mode) {
3016
+ case "light": {
3017
+ return t2("Layout.Light");
3018
+ }
3019
+ case "dark": {
3020
+ return t2("Layout.Dark");
3021
+ }
3022
+ default: {
3023
+ return t2("Layout.System");
3024
+ }
3121
3025
  }
3122
- return nestedWeeks;
3123
3026
  };
3124
- getWeekNumber = (value) => {
3125
- return value.week();
3027
+ const usernameInitials = () => {
3028
+ if (!user?.name) return "";
3029
+ const splittedName = user.name.split(" ");
3030
+ return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
3126
3031
  };
3127
- getDayOfWeek(value) {
3128
- return value.day() + 1;
3129
- }
3130
- getYearRange = ([start, end]) => {
3131
- const startDate = this.startOfYear(start);
3132
- const endDate = this.endOfYear(end);
3133
- const years = [];
3134
- let current = startDate;
3135
- while (this.isBefore(current, endDate)) {
3136
- years.push(current);
3137
- current = this.addYears(current, 1);
3138
- }
3139
- return years;
3032
+ const openMenu = (event) => setAnchorElement(event.currentTarget);
3033
+ const closeMenu = () => {
3034
+ setAnchorElement(void 0);
3035
+ setTimeout(() => setTab("settings"), 300);
3140
3036
  };
3037
+ const changeTab = (newTab) => () => setTab(newTab);
3038
+ const settings = /* @__PURE__ */ jsxs14(List4, { component: "nav", subheader: /* @__PURE__ */ jsx26(ListSubheader2, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
3039
+ /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
3040
+ /* @__PURE__ */ jsx26(ListItemIcon4, { children: /* @__PURE__ */ jsx26(Brightness4, {}) }),
3041
+ /* @__PURE__ */ jsx26(ListItemText4, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
3042
+ /* @__PURE__ */ jsx26(ChevronRight, {})
3043
+ ] }),
3044
+ /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
3045
+ /* @__PURE__ */ jsx26(ListItemIcon4, { children: /* @__PURE__ */ jsx26(Translate, {}) }),
3046
+ /* @__PURE__ */ jsx26(ListItemText4, { primary: t2("Layout.Language"), secondary: i18n2.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
3047
+ /* @__PURE__ */ jsx26(ChevronRight, {})
3048
+ ] })
3049
+ ] });
3050
+ const theme = /* @__PURE__ */ jsxs14(List4, { subheader: /* @__PURE__ */ jsxs14(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
3051
+ /* @__PURE__ */ jsx26(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx26(ArrowBack, { fontSize: "small" }) }),
3052
+ " ",
3053
+ t2("Layout.Appearance")
3054
+ ] }), children: [
3055
+ /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeMode("light"), disabled: mode === "light", children: [
3056
+ /* @__PURE__ */ jsx26(ListItemIcon4, { children: /* @__PURE__ */ jsx26(LightMode, {}) }),
3057
+ /* @__PURE__ */ jsx26(ListItemText4, { primary: t2("Layout.Light") })
3058
+ ] }),
3059
+ /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
3060
+ /* @__PURE__ */ jsx26(ListItemIcon4, { children: /* @__PURE__ */ jsx26(DarkMode, {}) }),
3061
+ /* @__PURE__ */ jsx26(ListItemText4, { primary: t2("Layout.Dark") })
3062
+ ] }),
3063
+ /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeMode("system"), disabled: mode === "system", children: [
3064
+ /* @__PURE__ */ jsx26(ListItemIcon4, { children: /* @__PURE__ */ jsx26(SettingsBrightness, {}) }),
3065
+ /* @__PURE__ */ jsx26(ListItemText4, { primary: t2("Layout.System") })
3066
+ ] })
3067
+ ] });
3068
+ const language = /* @__PURE__ */ jsxs14(List4, { subheader: /* @__PURE__ */ jsxs14(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
3069
+ /* @__PURE__ */ jsx26(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx26(ArrowBack, { fontSize: "small" }) }),
3070
+ " ",
3071
+ t2("Layout.Language")
3072
+ ] }), children: [
3073
+ /* @__PURE__ */ jsx26(ListItemButton5, { onClick: changeLanguage("en"), disabled: i18n2.resolvedLanguage === "en", children: /* @__PURE__ */ jsx26(ListItemText4, { primary: "English" }) }),
3074
+ /* @__PURE__ */ jsx26(ListItemButton5, { onClick: changeLanguage("cs"), disabled: i18n2.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx26(ListItemText4, { primary: "\u010Ce\u0161tina" }) })
3075
+ ] });
3076
+ return /* @__PURE__ */ jsxs14(Fragment6, { children: [
3077
+ /* @__PURE__ */ jsx26(IconButton4, { size: "small", edge: "end", onClick: openMenu, children: user?.name ? /* @__PURE__ */ jsx26(Avatar2, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx26(Typography8, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx26(AccountCircle, { fontSize: "large" }) }),
3078
+ /* @__PURE__ */ jsx26(Menu2, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs14(Box8, { sx: { width: 240 }, children: [
3079
+ /* @__PURE__ */ jsx26(List4, { children: user?.name ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
3080
+ /* @__PURE__ */ jsx26(ListItem2, { children: /* @__PURE__ */ jsx26(ListItemText4, { primary: user.name, secondary: /* @__PURE__ */ jsxs14("span", { children: [
3081
+ /* @__PURE__ */ jsx26("span", { children: user.employeeId }),
3082
+ /* @__PURE__ */ jsx26("br", {}),
3083
+ /* @__PURE__ */ jsx26("span", { children: user.department })
3084
+ ] }) }) }),
3085
+ /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: () => keycloak.logout(), children: [
3086
+ /* @__PURE__ */ jsx26(ListItemIcon4, { children: /* @__PURE__ */ jsx26(Logout, { color: "error" }) }),
3087
+ /* @__PURE__ */ jsx26(ListItemText4, { primary: t2("Layout.Logout") })
3088
+ ] })
3089
+ ] }) : /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: () => keycloak.login(), children: [
3090
+ /* @__PURE__ */ jsx26(ListItemIcon4, { children: /* @__PURE__ */ jsx26(Login, { color: "success" }) }),
3091
+ /* @__PURE__ */ jsx26(ListItemText4, { primary: t2("Layout.LogIn") })
3092
+ ] }) }),
3093
+ tab === "settings" && settings,
3094
+ tab === "theme" && theme,
3095
+ tab === "language" && language
3096
+ ] }) })
3097
+ ] });
3141
3098
  };
3142
3099
 
3143
- // src/providers/LayoutProvider.tsx
3144
- import { useEffect as useEffect6, useState as useState10 } from "react";
3145
- import { useTranslation as useTranslation7 } from "react-i18next";
3146
- import * as z from "zod";
3147
- import { cs, en } from "zod/locales";
3100
+ // src/hooks/ThemeHook.ts
3101
+ import { createTheme, darken, lighten } from "@mui/material";
3102
+ import { grey as grey2 } from "@mui/material/colors";
3103
+ import { csCZ, enUS } from "@mui/material/locale";
3104
+ import { csCZ as dataGridCsCz, enUS as dataGridEnUs } from "@mui/x-data-grid-premium/locales";
3105
+ import { csCZ as datePickersCsCz, enUS as datePickersEnUs } from "@mui/x-date-pickers-pro/locales";
3106
+ import { useTranslation as useTranslation6 } from "react-i18next";
3107
+ var WISTRON_PRIMARY_COLOR = "#00506E";
3108
+ var WISTRON_SECONDARY_COLOR = "#64DC00";
3109
+ var useGetTheme = (theme) => {
3110
+ const { i18n: i18n2 } = useTranslation6();
3111
+ return createTheme(
3112
+ {
3113
+ cssVariables: {
3114
+ colorSchemeSelector: "data-mui-color-scheme"
3115
+ },
3116
+ colorSchemes: {
3117
+ light: {
3118
+ palette: {
3119
+ primary: { main: WISTRON_PRIMARY_COLOR },
3120
+ secondary: { main: WISTRON_SECONDARY_COLOR }
3121
+ }
3122
+ },
3123
+ dark: {
3124
+ palette: {
3125
+ primary: { main: lighten(WISTRON_PRIMARY_COLOR, 0.5) },
3126
+ secondary: { main: darken(WISTRON_SECONDARY_COLOR, 0.5) }
3127
+ }
3128
+ },
3129
+ ...theme?.colorSchemes
3130
+ },
3131
+ components: {
3132
+ MuiCssBaseline: {
3133
+ styleOverrides: ({ palette }) => {
3134
+ return {
3135
+ body: {
3136
+ "&::-webkit-scrollbar, & *::-webkit-scrollbar": {
3137
+ width: "0.7em",
3138
+ height: "0.7em"
3139
+ },
3140
+ "&::-webkit-scrollbar-track, & *::-webkit-scrollbar-track": {
3141
+ backgroundColor: palette.mode === "dark" ? grey2[900] : grey2[200],
3142
+ borderRadius: "5px"
3143
+ },
3144
+ "&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb": {
3145
+ backgroundColor: palette.mode === "dark" ? grey2[800] : grey2[400],
3146
+ borderRadius: "10px"
3147
+ },
3148
+ "&::-webkit-scrollbar-thumb:hover, & *::-webkit-scrollbar-thumb:hover": {
3149
+ backgroundColor: palette.mode === "dark" ? grey2[700] : grey2[500]
3150
+ },
3151
+ "&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": {
3152
+ backgroundColor: "transparent"
3153
+ }
3154
+ }
3155
+ };
3156
+ }
3157
+ },
3158
+ ...theme?.components
3159
+ }
3160
+ },
3161
+ i18n2.resolvedLanguage === "cs" ? datePickersCsCz : datePickersEnUs,
3162
+ i18n2.resolvedLanguage === "cs" ? dataGridCsCz : dataGridEnUs,
3163
+ i18n2.resolvedLanguage === "cs" ? csCZ : enUS
3164
+ );
3165
+ };
3148
3166
 
3149
- // src/providers/DialogsProvider.tsx
3150
- import { useCallback, useId, useMemo as useMemo4, useRef as useRef3, useState as useState9 } from "react";
3167
+ // src/components/core/Layout.tsx
3151
3168
  import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
3152
- function DialogsProvider({ children, unmountAfter = 1e3 }) {
3153
- const [stack, setStack] = useState9([]);
3154
- const keyPrefix = useId();
3155
- const nextId = useRef3(0);
3156
- const dialogMetadata = useRef3(/* @__PURE__ */ new WeakMap());
3157
- const requestDialog = useEventCallback_default(function open(Component7, payload, options = {}) {
3158
- const { onClose = async () => {
3159
- } } = options;
3160
- let resolve;
3161
- const promise = new Promise((resolveImpl) => {
3162
- resolve = resolveImpl;
3163
- });
3164
- const key = `${keyPrefix}-${nextId.current}`;
3165
- nextId.current += 1;
3166
- const newEntry = {
3167
- key,
3168
- open: true,
3169
- promise,
3170
- Component: Component7,
3171
- payload,
3172
- onClose,
3173
- resolve
3174
- };
3175
- dialogMetadata.current.set(promise, newEntry);
3176
- setStack((previousStack) => [...previousStack, newEntry]);
3177
- return promise;
3178
- });
3179
- const removeDialogFromStack = useCallback((dialog) => {
3180
- setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
3181
- dialogMetadata.current.delete(dialog);
3182
- }, []);
3183
- const closeDialogUi = useEventCallback_default(function closeDialogUi2(dialog) {
3184
- setStack(
3185
- (previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
3186
- );
3187
- setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
3188
- });
3189
- const closeDialog = useEventCallback_default(async function closeDialog2(dialog, result) {
3190
- const entryToClose = dialogMetadata.current.get(dialog);
3191
- if (!entryToClose) {
3192
- throw new Error("Dialog not found in stack");
3193
- }
3194
- try {
3195
- await entryToClose.onClose(result);
3196
- } finally {
3197
- entryToClose.resolve(result);
3198
- closeDialogUi(dialog);
3199
- }
3200
- return dialog;
3201
- });
3202
- const contextValue = useMemo4(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
3203
- return /* @__PURE__ */ jsxs15(DialogsContext.Provider, { value: contextValue, children: [
3204
- children,
3205
- stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx27(
3206
- Component7,
3207
- {
3208
- payload,
3209
- open,
3210
- onClose: async (result) => {
3211
- await closeDialog(promise, result);
3169
+ var DrawerHeader = styled2("div")(({ theme }) => ({
3170
+ display: "flex",
3171
+ alignItems: "center",
3172
+ justifyContent: "flex-end",
3173
+ padding: theme.spacing(0, 1),
3174
+ ...theme.mixins.toolbar
3175
+ }));
3176
+ var Layout = (props) => {
3177
+ const theme = useGetTheme(props.theme);
3178
+ const [navigationOpen, setNavigationOpen] = useLocalStorageState("navigationOpen", { defaultServerValue: false });
3179
+ const isFetching = !!useIsFetching();
3180
+ const isMutating = !!useIsMutating();
3181
+ return /* @__PURE__ */ jsxs15(ThemeProvider, { theme, children: [
3182
+ /* @__PURE__ */ jsx27(InitColorSchemeScript, {}),
3183
+ /* @__PURE__ */ jsx27(CssBaseline, {}),
3184
+ /* @__PURE__ */ jsxs15(Box9, { sx: { display: "flex", height: "100dvh", maxHeight: "100dvh", overflow: "hidden", width: "100%" }, children: [
3185
+ /* @__PURE__ */ jsx27(
3186
+ AppBar,
3187
+ {
3188
+ color: "transparent",
3189
+ position: "fixed",
3190
+ sx: {
3191
+ borderBottom: "1px solid",
3192
+ borderColor: theme.vars?.palette.divider,
3193
+ boxShadow: "none"
3194
+ },
3195
+ children: /* @__PURE__ */ jsxs15(Toolbar, { children: [
3196
+ props.navigation && /* @__PURE__ */ jsx27(
3197
+ IconButton5,
3198
+ {
3199
+ onClick: () => setNavigationOpen((previous) => !previous),
3200
+ sx: { marginRight: 2 },
3201
+ children: navigationOpen ? /* @__PURE__ */ jsx27(MenuOpen, {}) : /* @__PURE__ */ jsx27(Menu3, {})
3202
+ }
3203
+ ),
3204
+ /* @__PURE__ */ jsx27(AppTitle, {}),
3205
+ /* @__PURE__ */ jsx27(ToolbarAccount, {})
3206
+ ] })
3212
3207
  }
3213
- },
3214
- key
3215
- ))
3208
+ ),
3209
+ props.navigation && /* @__PURE__ */ jsx27(NavigationRail, { navigation: props.navigation, expanded: navigationOpen ?? false, setExpanded: setNavigationOpen }),
3210
+ /* @__PURE__ */ jsxs15(Box9, { component: "main", sx: { flexGrow: 1, display: "flex", flexDirection: "column", minWidth: 0, height: "100%", overflow: "hidden" }, children: [
3211
+ /* @__PURE__ */ jsx27(DrawerHeader, {}),
3212
+ /* @__PURE__ */ jsx27(Box9, { sx: { flex: 1, overflow: "auto", position: "relative" }, children: props.children })
3213
+ ] })
3214
+ ] }),
3215
+ (isFetching || isMutating) && /* @__PURE__ */ jsx27(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
3216
3216
  ] });
3217
- }
3217
+ };
3218
3218
 
3219
3219
  // src/providers/LayoutProvider.tsx
3220
3220
  import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";