wcz-layout 10.2.2 → 11.0.0

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.
Files changed (115) hide show
  1. package/dist/{ChatLayout-CkS9oyPp.mjs → ChatLayout-B0MBrI-Y.mjs} +839 -371
  2. package/dist/ChatLayout-B0MBrI-Y.mjs.map +1 -0
  3. package/dist/{ExtractFile-ClTc-e1H.d.mts → ExtractFile-BQUXpuBS.d.mts} +27 -3
  4. package/dist/FileMeta-B5VU-eCi.d.mts +55 -0
  5. package/dist/FileMeta-BexXC_45.mjs +35 -0
  6. package/dist/FileMeta-BexXC_45.mjs.map +1 -0
  7. package/dist/QueryClientParam-BG9Q_9XU.d.mts +6 -0
  8. package/dist/{Translate-BiCjnlyx.mjs → Translate-C43AmXYW.mjs} +25 -37
  9. package/dist/Translate-C43AmXYW.mjs.map +1 -0
  10. package/dist/User-CvLutatT.d.mts +10 -0
  11. package/dist/ai.d.mts +1 -1
  12. package/dist/ai.mjs +2 -2
  13. package/dist/ai.mjs.map +1 -1
  14. package/dist/auth.d.mts +6 -14
  15. package/dist/auth.mjs +15 -38
  16. package/dist/auth.mjs.map +1 -1
  17. package/dist/{authMiddleware-D4GSt7m9.mjs → authMiddleware-ANa9Tlmp.mjs} +10 -15
  18. package/dist/authMiddleware-ANa9Tlmp.mjs.map +1 -0
  19. package/dist/{ChatLayout-BmLySLXy.d.mts → components-2HKj8GpC.d.mts} +219 -255
  20. package/dist/components.d.mts +2 -126
  21. package/dist/components.mjs +871 -919
  22. package/dist/components.mjs.map +1 -1
  23. package/dist/data/client.d.mts +299 -57
  24. package/dist/data/client.mjs +5 -6
  25. package/dist/data/client.mjs.map +1 -1
  26. package/dist/data/server.d.mts +6 -5
  27. package/dist/data/server.mjs +3 -5
  28. package/dist/data/server.mjs.map +1 -1
  29. package/dist/env-C4WLVJMm.mjs +32 -0
  30. package/dist/env-C4WLVJMm.mjs.map +1 -0
  31. package/dist/file-DBqTibcr.mjs +176 -0
  32. package/dist/file-DBqTibcr.mjs.map +1 -0
  33. package/dist/file-hecCQszp.mjs +114 -0
  34. package/dist/file-hecCQszp.mjs.map +1 -0
  35. package/dist/hooks.d.mts +11 -91
  36. package/dist/hooks.mjs +152 -960
  37. package/dist/hooks.mjs.map +1 -1
  38. package/dist/i18n-ZRiIIdpb.mjs +563 -0
  39. package/dist/i18n-ZRiIIdpb.mjs.map +1 -0
  40. package/dist/index.d.mts +3 -35
  41. package/dist/index.mjs +409 -510
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/layout-DeTB6Ai1.mjs +224 -0
  44. package/dist/layout-DeTB6Ai1.mjs.map +1 -0
  45. package/dist/middleware.d.mts +1 -1
  46. package/dist/middleware.mjs +2 -2
  47. package/dist/models.d.mts +34 -42
  48. package/dist/models.mjs +4 -6
  49. package/dist/models.mjs.map +1 -1
  50. package/dist/oidc--D2ox365.mjs +97 -0
  51. package/dist/oidc--D2ox365.mjs.map +1 -0
  52. package/dist/peoplesoft-DhwB8jrM.d.mts +204 -0
  53. package/dist/tokens-C4djIAhl.mjs +97 -0
  54. package/dist/tokens-C4djIAhl.mjs.map +1 -0
  55. package/dist/useDialogs-QER-2rVG.mjs +297 -0
  56. package/dist/useDialogs-QER-2rVG.mjs.map +1 -0
  57. package/dist/{user-Bc2nLjAG.mjs → user-DQx1BanQ.mjs} +4 -20
  58. package/dist/user-DQx1BanQ.mjs.map +1 -0
  59. package/dist/{utils-CNYCSgip.d.mts → utils-BnyAEKW7.d.mts} +7 -9
  60. package/dist/{utils-CgabUlDD.mjs → utils-H4BskGF8.mjs} +21 -20
  61. package/dist/utils-H4BskGF8.mjs.map +1 -0
  62. package/dist/utils.d.mts +21 -4
  63. package/dist/utils.mjs +5 -4
  64. package/dist/vite.mjs +98 -32
  65. package/dist/vite.mjs.map +1 -1
  66. package/package.json +16 -43
  67. package/skills/ai/SKILL.md +1 -4
  68. package/skills/general/SKILL.md +15 -8
  69. package/skills/general/references/auth.md +10 -16
  70. package/skills/general/references/languages.md +56 -0
  71. package/skills/migrations/versions/migrate-v10-to-v11.md +98 -22
  72. package/skills/migrations/versions/migrate-v9-to-v10.md +22 -22
  73. package/skills/services/SKILL.md +1 -1
  74. package/skills/services/docs/email.md +2 -2
  75. package/skills/services/docs/file.md +100 -85
  76. package/skills/services/docs/layout.md +2 -3
  77. package/skills/start/steps/02-project-name-setup.md +1 -1
  78. package/skills/start/steps/06-entra-setup.md +1 -1
  79. package/skills/start/steps/08-generate-favicon.md +1 -1
  80. package/skills/table/SKILL.md +18 -5
  81. package/src/lib/locales/cs.json +120 -0
  82. package/src/lib/locales/en.json +119 -0
  83. package/src/lib/locales/uk.json +121 -0
  84. package/src/lib/locales/zh-TW.json +118 -0
  85. package/dist/ChatLayout-CkS9oyPp.mjs.map +0 -1
  86. package/dist/DialogsContext-D23fJjYR.mjs +0 -6
  87. package/dist/DialogsContext-D23fJjYR.mjs.map +0 -1
  88. package/dist/FileMeta-B39e2FLC.d.mts +0 -17
  89. package/dist/FileMeta-CPBWI_jA.mjs +0 -18
  90. package/dist/FileMeta-CPBWI_jA.mjs.map +0 -1
  91. package/dist/QueryClientParam-CTV1vj76.d.mts +0 -8
  92. package/dist/RouterListItemButton-CF-8w-08.mjs +0 -62
  93. package/dist/RouterListItemButton-CF-8w-08.mjs.map +0 -1
  94. package/dist/Translate-BiCjnlyx.mjs.map +0 -1
  95. package/dist/User-aJksXItw.d.mts +0 -12
  96. package/dist/authMiddleware-D4GSt7m9.mjs.map +0 -1
  97. package/dist/createApi-CF4ZL82B.mjs +0 -24
  98. package/dist/createApi-CF4ZL82B.mjs.map +0 -1
  99. package/dist/env-Cddts_dn.mjs +0 -49
  100. package/dist/env-Cddts_dn.mjs.map +0 -1
  101. package/dist/file-D4kSR_lC.mjs +0 -149
  102. package/dist/file-D4kSR_lC.mjs.map +0 -1
  103. package/dist/file-DcwYjofa.mjs +0 -150
  104. package/dist/file-DcwYjofa.mjs.map +0 -1
  105. package/dist/layout-6We_KFgN.mjs +0 -107
  106. package/dist/layout-6We_KFgN.mjs.map +0 -1
  107. package/dist/peoplesoft-DH31FCMC.mjs +0 -125
  108. package/dist/peoplesoft-DH31FCMC.mjs.map +0 -1
  109. package/dist/peoplesoft-DXukeeFr.d.mts +0 -161
  110. package/dist/providers-DOFje2P6.mjs +0 -56
  111. package/dist/providers-DOFje2P6.mjs.map +0 -1
  112. package/dist/tokens-DNe_Qifk.mjs +0 -204
  113. package/dist/tokens-DNe_Qifk.mjs.map +0 -1
  114. package/dist/user-Bc2nLjAG.mjs.map +0 -1
  115. package/dist/utils-CgabUlDD.mjs.map +0 -1
@@ -1,263 +1,29 @@
1
- import { r as loginProvidersQueryOptions } from "./user-Bc2nLjAG.mjs";
2
- import { d as sanitizeReturnTo } from "./utils-CgabUlDD.mjs";
3
- import { a as fileQueryOptions, i as fileMetasQueryOptions, n as deleteFileMutationOptions, o as fileThumbnailQueryOptions, r as downloadFileMutationOptions, s as openFileMutationOptions } from "./file-D4kSR_lC.mjs";
4
- import { D as RouterLink, O as useDialogs, _ as toClipboardText, a as cellSelectionSx, c as columnFlex, d as layoutTableClasses, f as lookaheadRange, h as pinnedSx, m as pinnedClass, o as classNames, r as AggregatedCell, s as columnAlign, t as ChatLayout, u as hasColumnLabel, v as DEFAULT_PAGE_SIZE_OPTIONS } from "./ChatLayout-CkS9oyPp.mjs";
5
- import { n as RouterIconButton, t as RouterListItemButton } from "./RouterListItemButton-CF-8w-08.mjs";
1
+ import { i as fileMetasQueryOptions, n as deleteFileMutationOptions } from "./file-hecCQszp.mjs";
2
+ import { a as RouterFab, c as RouterListItemButton, i as RouterButton, l as RouterTab, n as useDialogs, o as RouterIconButton, s as RouterLink } from "./useDialogs-QER-2rVG.mjs";
3
+ import { D as useLayoutForm, S as pinnedSx, _ as hasColumnLabel, f as cellSelectionSx, h as columnFlex, m as columnAlign, p as classNames, r as AggregatedCell, t as ChatLayout, v as layoutTableClasses, w as toClipboardText, x as pinnedClass, y as lookaheadRange } from "./ChatLayout-B0MBrI-Y.mjs";
4
+ import { o as getFieldStatus } from "./utils-H4BskGF8.mjs";
6
5
  import { c } from "react/compiler-runtime";
7
- import { Box, Button, ButtonBase, Card, CardContent, CircularProgress, Dialog, Divider, Fab, IconButton, ImageListItem, ImageListItemBar, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Menu, MenuItem, Paper, Skeleton, Stack, Tab, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TableRow, Tooltip, Typography, alpha, useTheme } from "@mui/material";
8
- import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
9
- import React, { Fragment, createContext, useContext, useEffect, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
6
+ import { Box, ButtonBase, ClickAwayListener, Dialog, Divider, Fab, IconButton, ImageListItem, ImageListItemBar, LinearProgress, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Menu, MenuItem, Paper, Skeleton, Stack, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TableRow, Tooltip, Typography, useTheme } from "@mui/material";
7
+ import { useMutation, useQuery } from "@tanstack/react-query";
8
+ import { Fragment, createContext, useCallback, useContext, useEffect, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
10
9
  import { useTranslation } from "react-i18next";
11
- import { manifest } from "virtual:wcz-layout";
12
- import { createLink, rootRouteId, useLocation, useMatch } from "@tanstack/react-router";
10
+ import { rootRouteId, useMatch } from "@tanstack/react-router";
13
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
12
  import ChevronRight from "@mui/icons-material/ChevronRight";
15
13
  import Close from "@mui/icons-material/Close";
16
- import CloudQueue from "@mui/icons-material/CloudQueue";
17
- import Microsoft from "@mui/icons-material/Microsoft";
18
14
  import CloudUpload from "@mui/icons-material/CloudUpload";
19
15
  import { useDropzone } from "react-dropzone";
20
16
  import MoreVert from "@mui/icons-material/MoreVert";
21
17
  import { grey } from "@mui/material/colors";
22
- import { useInView } from "react-intersection-observer";
23
18
  import Delete from "@mui/icons-material/Delete";
24
19
  import FileDownload from "@mui/icons-material/FileDownload";
25
20
  import AttachFile from "@mui/icons-material/AttachFile";
26
- import Image from "@mui/icons-material/Image";
21
+ import Image$1 from "@mui/icons-material/Image";
27
22
  import SmartDisplay from "@mui/icons-material/SmartDisplay";
28
23
  import ChevronLeft from "@mui/icons-material/ChevronLeft";
24
+ import EditOutlined from "@mui/icons-material/EditOutlined";
29
25
  import { useHotkeys } from "@tanstack/react-hotkeys";
30
26
  import { useVirtualizer } from "@tanstack/react-virtual";
31
- // src/components/core/account/LoginForm.tsx
32
- const LAST_PROVIDER_KEY = "auth-provider";
33
- const PROVIDER_ICON = {
34
- entra: /* @__PURE__ */ jsx(Microsoft, {}),
35
- aws: /* @__PURE__ */ jsx(CloudQueue, {})
36
- };
37
- /**
38
- * The provider chooser card. Mount it at `/login` — `requireAuth` redirects there,
39
- * and it reads `?returnTo` from the URL itself, so it takes no props.
40
- */
41
- const LoginForm = () => {
42
- const $ = c(35);
43
- const { data: t0 } = useQuery(loginProvidersQueryOptions);
44
- let t1;
45
- if ($[0] !== t0) {
46
- t1 = t0 === void 0 ? [] : t0;
47
- $[0] = t0;
48
- $[1] = t1;
49
- } else t1 = $[1];
50
- const providers = t1;
51
- let t2;
52
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
53
- t2 = { select: _temp$2 };
54
- $[2] = t2;
55
- } else t2 = $[2];
56
- const search = useLocation(t2);
57
- let t3;
58
- if ($[3] !== search.returnTo) {
59
- t3 = sanitizeReturnTo(search.returnTo);
60
- $[3] = search.returnTo;
61
- $[4] = t3;
62
- } else t3 = $[4];
63
- const returnTo = t3;
64
- const { t } = useTranslation();
65
- const [lastProvider, setLastProvider] = useState(null);
66
- let t4;
67
- let t5;
68
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
69
- t4 = () => setLastProvider(localStorage.getItem(LAST_PROVIDER_KEY));
70
- t5 = [];
71
- $[5] = t4;
72
- $[6] = t5;
73
- } else {
74
- t4 = $[5];
75
- t5 = $[6];
76
- }
77
- useEffect(t4, t5);
78
- const preferred = lastProvider ?? (providers.length === 1 ? providers[0].id : null);
79
- let t6;
80
- if ($[7] !== returnTo) {
81
- t6 = (provider) => () => {
82
- localStorage.setItem(LAST_PROVIDER_KEY, provider);
83
- location.href = `/auth/login?provider=${provider}&returnTo=${encodeURIComponent(returnTo)}`;
84
- };
85
- $[7] = returnTo;
86
- $[8] = t6;
87
- } else t6 = $[8];
88
- const signIn = t6;
89
- let t7;
90
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
91
- t7 = {
92
- minHeight: "100%",
93
- display: "flex",
94
- alignItems: "center",
95
- justifyContent: "center",
96
- px: 2,
97
- py: 6
98
- };
99
- $[9] = t7;
100
- } else t7 = $[9];
101
- let t8;
102
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
103
- t8 = [_temp2, _temp3];
104
- $[10] = t8;
105
- } else t8 = $[10];
106
- let t9;
107
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
108
- t9 = { p: {
109
- xs: 3,
110
- sm: 4
111
- } };
112
- $[11] = t9;
113
- } else t9 = $[11];
114
- let t10;
115
- let t11;
116
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
117
- t10 = { alignItems: "center" };
118
- t11 = /* @__PURE__ */ jsx(Box, {
119
- component: "img",
120
- src: "/android-chrome-192x192.png",
121
- alt: "",
122
- width: 48,
123
- height: 48
124
- });
125
- $[12] = t10;
126
- $[13] = t11;
127
- } else {
128
- t10 = $[12];
129
- t11 = $[13];
130
- }
131
- let t12;
132
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
133
- t12 = /* @__PURE__ */ jsx(Typography, {
134
- variant: "body2",
135
- color: "text.secondary",
136
- sx: { fontWeight: 600 },
137
- children: manifest.name
138
- });
139
- $[14] = t12;
140
- } else t12 = $[14];
141
- let t13;
142
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
143
- t13 = { fontWeight: 700 };
144
- $[15] = t13;
145
- } else t13 = $[15];
146
- let t14;
147
- if ($[16] !== t) {
148
- t14 = t("Layout.LogIn");
149
- $[16] = t;
150
- $[17] = t14;
151
- } else t14 = $[17];
152
- let t15;
153
- if ($[18] !== t14) {
154
- t15 = /* @__PURE__ */ jsxs(Stack, {
155
- direction: "row",
156
- spacing: 2,
157
- sx: t10,
158
- children: [t11, /* @__PURE__ */ jsxs(Stack, {
159
- spacing: .25,
160
- children: [t12, /* @__PURE__ */ jsx(Typography, {
161
- variant: "h5",
162
- component: "h1",
163
- sx: t13,
164
- children: t14
165
- })]
166
- })]
167
- });
168
- $[18] = t14;
169
- $[19] = t15;
170
- } else t15 = $[19];
171
- let t16;
172
- if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
173
- t16 = /* @__PURE__ */ jsx(Divider, { sx: { my: 3 } });
174
- $[20] = t16;
175
- } else t16 = $[20];
176
- let t17;
177
- if ($[21] !== preferred || $[22] !== providers || $[23] !== signIn || $[24] !== t) {
178
- let t18;
179
- if ($[26] !== preferred || $[27] !== signIn || $[28] !== t) {
180
- t18 = (t19) => {
181
- const { id, label } = t19;
182
- return /* @__PURE__ */ jsx(Button, {
183
- fullWidth: true,
184
- size: "large",
185
- startIcon: PROVIDER_ICON[id],
186
- variant: id === preferred ? "contained" : "outlined",
187
- onClick: signIn(id),
188
- sx: {
189
- minHeight: 52,
190
- px: 2,
191
- borderRadius: 1,
192
- fontWeight: 600,
193
- textTransform: "none",
194
- boxShadow: "none"
195
- },
196
- children: t("Layout.ContinueWith", { provider: label })
197
- }, id);
198
- };
199
- $[26] = preferred;
200
- $[27] = signIn;
201
- $[28] = t;
202
- $[29] = t18;
203
- } else t18 = $[29];
204
- t17 = providers.map(t18);
205
- $[21] = preferred;
206
- $[22] = providers;
207
- $[23] = signIn;
208
- $[24] = t;
209
- $[25] = t17;
210
- } else t17 = $[25];
211
- let t18;
212
- if ($[30] !== t17) {
213
- t18 = /* @__PURE__ */ jsx(Stack, {
214
- spacing: 1.5,
215
- children: t17
216
- });
217
- $[30] = t17;
218
- $[31] = t18;
219
- } else t18 = $[31];
220
- let t19;
221
- if ($[32] !== t15 || $[33] !== t18) {
222
- t19 = /* @__PURE__ */ jsx(Box, {
223
- sx: t7,
224
- children: /* @__PURE__ */ jsx(Card, {
225
- variant: "outlined",
226
- sx: t8,
227
- children: /* @__PURE__ */ jsxs(CardContent, {
228
- sx: t9,
229
- children: [
230
- t15,
231
- t16,
232
- t18
233
- ]
234
- })
235
- })
236
- });
237
- $[32] = t15;
238
- $[33] = t18;
239
- $[34] = t19;
240
- } else t19 = $[34];
241
- return t19;
242
- };
243
- function _temp$2(location) {
244
- return location.search;
245
- }
246
- function _temp2(theme) {
247
- return {
248
- width: "100%",
249
- maxWidth: 440,
250
- borderColor: alpha(theme.palette.primary.main, .2),
251
- borderRadius: 1,
252
- boxShadow: `0 20px 50px ${alpha(theme.palette.common.black, .08)}`
253
- };
254
- }
255
- function _temp3(theme_0) {
256
- return theme_0.applyStyles("dark", {
257
- borderColor: alpha(theme_0.palette.primary.main, .28),
258
- boxShadow: `0 20px 50px ${alpha(theme_0.palette.common.black, .28)}`
259
- });
260
- }
261
27
  // src/components/core/Fullscreen.tsx
262
28
  const isScrollContainer = (element) => /auto|scroll|overlay/.test(getComputedStyle(element).overflowY);
263
29
  /** Ancestors up to and including the nearest scroll container (or the root element). */
@@ -385,7 +151,7 @@ const baseStyle = {
385
151
  cursor: "pointer"
386
152
  };
387
153
  const Dropzone = (t0) => {
388
- const $ = c(32);
154
+ const $ = c(36);
389
155
  let progress;
390
156
  let props;
391
157
  let sx;
@@ -457,48 +223,75 @@ const Dropzone = (t0) => {
457
223
  $[18] = t6;
458
224
  } else t6 = $[18];
459
225
  let t7;
460
- if ($[19] !== progress) {
461
- t7 = progress ? /* @__PURE__ */ jsx(CircularProgress, {
462
- size: 24,
463
- variant: "determinate",
464
- value: progress,
465
- "aria-label": "Uploading"
466
- }) : /* @__PURE__ */ jsx(CloudUpload, {});
467
- $[19] = progress;
468
- $[20] = t7;
469
- } else t7 = $[20];
226
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
227
+ t7 = {
228
+ display: "flex",
229
+ flexDirection: "column",
230
+ alignItems: "center"
231
+ };
232
+ $[19] = t7;
233
+ } else t7 = $[19];
470
234
  let t8;
471
- if ($[21] !== t) {
472
- t8 = t("Layout.File.DragSomeFilesHereOrClickToSelectThem");
473
- $[21] = t;
474
- $[22] = t8;
475
- } else t8 = $[22];
235
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
236
+ t8 = {
237
+ display: "flex",
238
+ alignItems: "center",
239
+ width: "100%",
240
+ height: "1.5rem"
241
+ };
242
+ $[20] = t8;
243
+ } else t8 = $[20];
476
244
  let t9;
477
- if ($[23] !== t8) {
478
- t9 = /* @__PURE__ */ jsx(Typography, { children: t8 });
479
- $[23] = t8;
480
- $[24] = t9;
481
- } else t9 = $[24];
245
+ if ($[21] !== progress) {
246
+ t9 = /* @__PURE__ */ jsx(Box, {
247
+ sx: t8,
248
+ children: progress ? /* @__PURE__ */ jsx(LinearProgress, {
249
+ variant: "determinate",
250
+ value: progress,
251
+ "aria-label": "Uploading",
252
+ sx: { width: "100%" }
253
+ }) : /* @__PURE__ */ jsx(CloudUpload, { sx: { mx: "auto" } })
254
+ });
255
+ $[21] = progress;
256
+ $[22] = t9;
257
+ } else t9 = $[22];
482
258
  let t10;
483
- if ($[25] !== T0 || $[26] !== sx || $[27] !== t3 || $[28] !== t6 || $[29] !== t7 || $[30] !== t9) {
484
- t10 = /* @__PURE__ */ jsxs(T0, {
259
+ if ($[23] !== t) {
260
+ t10 = t("Layout.File.DragSomeFilesHereOrClickToSelectThem");
261
+ $[23] = t;
262
+ $[24] = t10;
263
+ } else t10 = $[24];
264
+ let t11;
265
+ if ($[25] !== t10) {
266
+ t11 = /* @__PURE__ */ jsx(Typography, { children: t10 });
267
+ $[25] = t10;
268
+ $[26] = t11;
269
+ } else t11 = $[26];
270
+ let t12;
271
+ if ($[27] !== t11 || $[28] !== t9) {
272
+ t12 = /* @__PURE__ */ jsxs(Box, {
273
+ sx: t7,
274
+ children: [t9, t11]
275
+ });
276
+ $[27] = t11;
277
+ $[28] = t9;
278
+ $[29] = t12;
279
+ } else t12 = $[29];
280
+ let t13;
281
+ if ($[30] !== T0 || $[31] !== sx || $[32] !== t12 || $[33] !== t3 || $[34] !== t6) {
282
+ t13 = /* @__PURE__ */ jsxs(T0, {
485
283
  ...t3,
486
284
  sx,
487
- children: [
488
- t6,
489
- t7,
490
- t9
491
- ]
285
+ children: [t6, t12]
492
286
  });
493
- $[25] = T0;
494
- $[26] = sx;
495
- $[27] = t3;
496
- $[28] = t6;
497
- $[29] = t7;
498
- $[30] = t9;
499
- $[31] = t10;
500
- } else t10 = $[31];
501
- return t10;
287
+ $[30] = T0;
288
+ $[31] = sx;
289
+ $[32] = t12;
290
+ $[33] = t3;
291
+ $[34] = t6;
292
+ $[35] = t13;
293
+ } else t13 = $[35];
294
+ return t13;
502
295
  };
503
296
  // src/contexts/FileContext.ts
504
297
  const FileContext = createContext(null);
@@ -507,12 +300,61 @@ const useFile = () => {
507
300
  if (!context) throw new Error("FileViewer components must be used within FileViewer");
508
301
  return context;
509
302
  };
303
+ /**
304
+ * Opening a file: an image in the viewer, anything else in a new tab. The file service shows
305
+ * what the browser can (Office files as PDF) and downloads the rest.
306
+ */
307
+ const useOpenFile = (meta) => {
308
+ const $ = c(13);
309
+ const { setImageId, actions } = useFile();
310
+ let t0;
311
+ if ($[0] !== meta.id || $[1] !== meta.mediaType || $[2] !== meta.urls || $[3] !== setImageId) {
312
+ t0 = () => {
313
+ if (meta.mediaType === "image") return setImageId(meta.id);
314
+ window.open(meta.urls.view, "_blank", "noopener");
315
+ };
316
+ $[0] = meta.id;
317
+ $[1] = meta.mediaType;
318
+ $[2] = meta.urls;
319
+ $[3] = setImageId;
320
+ $[4] = t0;
321
+ } else t0 = $[4];
322
+ const open = t0;
323
+ let t1;
324
+ if ($[5] !== meta.fileSize || $[6] !== meta.urls) {
325
+ t1 = () => {
326
+ if (meta.fileSize <= 20971520) fetch(meta.urls.view, { mode: "no-cors" }).catch(_temp$2);
327
+ };
328
+ $[5] = meta.fileSize;
329
+ $[6] = meta.urls;
330
+ $[7] = t1;
331
+ } else t1 = $[7];
332
+ const prefetch = t1;
333
+ const t2 = `${meta.fileName}.${meta.fileExtension}`;
334
+ const t3 = actions?.download !== false || actions.delete !== false && meta.canWrite;
335
+ let t4;
336
+ if ($[8] !== open || $[9] !== prefetch || $[10] !== t2 || $[11] !== t3) {
337
+ t4 = {
338
+ open,
339
+ prefetch,
340
+ fileName: t2,
341
+ hasActions: t3
342
+ };
343
+ $[8] = open;
344
+ $[9] = prefetch;
345
+ $[10] = t2;
346
+ $[11] = t3;
347
+ $[12] = t4;
348
+ } else t4 = $[12];
349
+ return t4;
350
+ };
351
+ function _temp$2() {}
510
352
  // src/components/file/fileViewer/common/ActionsMenu.tsx
511
353
  const ActionsMenu = (t0) => {
512
- const $ = c(37);
354
+ const $ = c(29);
513
355
  const { meta, anchorEl, onClose } = t0;
514
356
  const { t } = useTranslation();
515
- const { fileMetas, onDelete, actions, appName } = useFile();
357
+ const { fileMetas, onDelete, actions } = useFile();
516
358
  const { alert, confirm } = useDialogs();
517
359
  let t1;
518
360
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -521,53 +363,24 @@ const ActionsMenu = (t0) => {
521
363
  } else t1 = $[0];
522
364
  const queryClient = useMatch(t1).context.queryClient;
523
365
  let t2;
524
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
525
- t2 = downloadFileMutationOptions();
526
- $[1] = t2;
527
- } else t2 = $[1];
528
- const { mutate: download, isPending: isDownloading } = useMutation(t2);
366
+ if ($[1] !== queryClient) {
367
+ t2 = deleteFileMutationOptions({ queryClient });
368
+ $[1] = queryClient;
369
+ $[2] = t2;
370
+ } else t2 = $[2];
371
+ const { mutateAsync: deleteFile, isPending: isDeleting } = useMutation(t2);
529
372
  let t3;
530
- if ($[2] !== queryClient) {
531
- t3 = deleteFileMutationOptions({ queryClient });
532
- $[2] = queryClient;
533
- $[3] = t3;
534
- } else t3 = $[3];
535
- const { mutateAsync: deleteFile, isPending: isDeleting } = useMutation(t3);
536
- let t4;
537
- if ($[4] !== appName || $[5] !== download || $[6] !== meta.fileExtension || $[7] !== meta.fileName || $[8] !== meta.id || $[9] !== onClose) {
538
- t4 = () => {
539
- onClose();
540
- download({
541
- id: meta.id,
542
- appName,
543
- fileName: meta.fileName,
544
- fileExtension: meta.fileExtension
545
- });
546
- };
547
- $[4] = appName;
548
- $[5] = download;
549
- $[6] = meta.fileExtension;
550
- $[7] = meta.fileName;
551
- $[8] = meta.id;
552
- $[9] = onClose;
553
- $[10] = t4;
554
- } else t4 = $[10];
555
- const handleOnDownload = t4;
556
- let t5;
557
- if ($[11] !== alert || $[12] !== appName || $[13] !== confirm || $[14] !== deleteFile || $[15] !== fileMetas || $[16] !== meta || $[17] !== onClose || $[18] !== onDelete || $[19] !== t) {
558
- t5 = async () => {
373
+ if ($[3] !== alert || $[4] !== confirm || $[5] !== deleteFile || $[6] !== fileMetas || $[7] !== meta || $[8] !== onClose || $[9] !== onDelete || $[10] !== t) {
374
+ t3 = async () => {
559
375
  onClose();
560
376
  if (!await confirm(t("Layout.File.AreYouSureYouWantToDelete", { name: meta.fileName }), {
561
377
  title: t("Layout.File.Delete"),
562
378
  confirmText: t("Layout.File.Delete")
563
379
  })) return;
564
380
  try {
565
- await deleteFile({
566
- id: meta.id,
567
- appName
568
- });
569
- } catch (t6) {
570
- const error = t6;
381
+ await deleteFile({ id: meta.id });
382
+ } catch (t4) {
383
+ const error = t4;
571
384
  await alert(error instanceof Error ? error.message : String(error));
572
385
  return;
573
386
  }
@@ -576,61 +389,62 @@ const ActionsMenu = (t0) => {
576
389
  deletedFileMeta: meta
577
390
  });
578
391
  };
579
- $[11] = alert;
580
- $[12] = appName;
581
- $[13] = confirm;
582
- $[14] = deleteFile;
583
- $[15] = fileMetas;
584
- $[16] = meta;
585
- $[17] = onClose;
586
- $[18] = onDelete;
587
- $[19] = t;
588
- $[20] = t5;
589
- } else t5 = $[20];
590
- const handleOnDelete = t5;
591
- const t6 = !!anchorEl;
592
- let t7;
593
- if ($[21] !== actions?.download || $[22] !== handleOnDownload || $[23] !== isDownloading || $[24] !== t) {
594
- t7 = actions?.download !== false && /* @__PURE__ */ jsxs(MenuItem, {
595
- onClick: handleOnDownload,
596
- disabled: isDownloading,
392
+ $[3] = alert;
393
+ $[4] = confirm;
394
+ $[5] = deleteFile;
395
+ $[6] = fileMetas;
396
+ $[7] = meta;
397
+ $[8] = onClose;
398
+ $[9] = onDelete;
399
+ $[10] = t;
400
+ $[11] = t3;
401
+ } else t3 = $[11];
402
+ const handleOnDelete = t3;
403
+ const t4 = !!anchorEl;
404
+ let t5;
405
+ if ($[12] !== actions?.download || $[13] !== meta.urls || $[14] !== onClose || $[15] !== t) {
406
+ t5 = actions?.download !== false && /* @__PURE__ */ jsxs(MenuItem, {
407
+ component: "a",
408
+ href: meta.urls.download,
409
+ onClick: onClose,
597
410
  children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(FileDownload, {}) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.File.Download") })]
598
411
  });
599
- $[21] = actions?.download;
600
- $[22] = handleOnDownload;
601
- $[23] = isDownloading;
602
- $[24] = t;
603
- $[25] = t7;
604
- } else t7 = $[25];
605
- let t8;
606
- if ($[26] !== actions?.delete || $[27] !== handleOnDelete || $[28] !== isDeleting || $[29] !== t) {
607
- t8 = actions?.delete !== false && /* @__PURE__ */ jsxs(MenuItem, {
412
+ $[12] = actions?.download;
413
+ $[13] = meta.urls;
414
+ $[14] = onClose;
415
+ $[15] = t;
416
+ $[16] = t5;
417
+ } else t5 = $[16];
418
+ let t6;
419
+ if ($[17] !== actions?.delete || $[18] !== handleOnDelete || $[19] !== isDeleting || $[20] !== meta.canWrite || $[21] !== t) {
420
+ t6 = actions?.delete !== false && meta.canWrite && /* @__PURE__ */ jsxs(MenuItem, {
608
421
  onClick: handleOnDelete,
609
422
  disabled: isDeleting,
610
423
  children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Delete, {}) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.File.Delete") })]
611
424
  });
612
- $[26] = actions?.delete;
613
- $[27] = handleOnDelete;
614
- $[28] = isDeleting;
615
- $[29] = t;
616
- $[30] = t8;
617
- } else t8 = $[30];
618
- let t9;
619
- if ($[31] !== anchorEl || $[32] !== onClose || $[33] !== t6 || $[34] !== t7 || $[35] !== t8) {
620
- t9 = /* @__PURE__ */ jsxs(Menu, {
425
+ $[17] = actions?.delete;
426
+ $[18] = handleOnDelete;
427
+ $[19] = isDeleting;
428
+ $[20] = meta.canWrite;
429
+ $[21] = t;
430
+ $[22] = t6;
431
+ } else t6 = $[22];
432
+ let t7;
433
+ if ($[23] !== anchorEl || $[24] !== onClose || $[25] !== t4 || $[26] !== t5 || $[27] !== t6) {
434
+ t7 = /* @__PURE__ */ jsxs(Menu, {
621
435
  anchorEl,
622
- open: t6,
436
+ open: t4,
623
437
  onClose,
624
- children: [t7, t8]
438
+ children: [t5, t6]
625
439
  });
626
- $[31] = anchorEl;
627
- $[32] = onClose;
628
- $[33] = t6;
629
- $[34] = t7;
630
- $[35] = t8;
631
- $[36] = t9;
632
- } else t9 = $[36];
633
- return t9;
440
+ $[23] = anchorEl;
441
+ $[24] = onClose;
442
+ $[25] = t4;
443
+ $[26] = t5;
444
+ $[27] = t6;
445
+ $[28] = t7;
446
+ } else t7 = $[28];
447
+ return t7;
634
448
  };
635
449
  // src/components/file/fileViewer/FileViewerGrid.tsx
636
450
  const IMAGE_SIZE = 150;
@@ -680,108 +494,161 @@ const FileViewerGrid = (t0) => {
680
494
  } else t3 = $[11];
681
495
  return t3;
682
496
  };
683
- const GridFileViewerItem = ({ meta, size, itemBar }) => {
684
- const { setImageId, actions, appName } = useFile();
497
+ const GridFileViewerItem = (t0) => {
498
+ const $ = c(36);
499
+ const { meta, size, itemBar } = t0;
500
+ const { open, prefetch, fileName, hasActions } = useOpenFile(meta);
685
501
  const [hovered, setHovered] = useState(false);
686
502
  const [focused, setFocused] = useState(false);
687
503
  const [menuAnchor, setMenuAnchor] = useState(null);
688
- const { ref, inView } = useInView({ triggerOnce: true });
689
- const queryClient = useQueryClient();
690
- const target = useRef(null);
691
504
  const side = size ?? IMAGE_SIZE;
692
- const fileName = `${meta.fileName}.${meta.fileExtension}`;
693
- const hasActions = actions?.download !== false || actions.delete !== false;
694
505
  const showItemBar = itemBar === "always" || itemBar !== "hidden" && (hovered || focused || !!menuAnchor);
695
- const { data: source, isPending } = useQuery({
696
- ...fileThumbnailQueryOptions({
697
- id: meta.id,
698
- appName
699
- }),
700
- enabled: inView
701
- });
702
- const { mutate: openFile } = useMutation(openFileMutationOptions({ target }));
703
- const { mutate: download } = useMutation(downloadFileMutationOptions());
704
- const prefetch = () => queryClient.prefetchQuery(fileQueryOptions({
705
- id: meta.id,
706
- appName
707
- }));
708
- const onClick = () => {
709
- switch (meta.mediaType) {
710
- case "image": return setImageId(meta.id);
711
- case "application":
712
- case "video":
713
- target.current = window.open("about:blank", "_blank");
714
- return openFile({
715
- id: meta.id,
716
- appName
717
- });
718
- default: return download({
719
- id: meta.id,
720
- appName,
721
- fileName: meta.fileName,
722
- fileExtension: meta.fileExtension
723
- });
724
- }
725
- };
726
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(ImageListItem, {
727
- sx: {
506
+ let t1;
507
+ if ($[0] !== side) {
508
+ t1 = {
728
509
  width: side,
729
510
  height: side
730
- },
731
- onMouseEnter: () => setHovered(true),
732
- onMouseLeave: () => setHovered(false),
733
- onFocus: () => setFocused(true),
734
- onBlur: (event) => {
511
+ };
512
+ $[0] = side;
513
+ $[1] = t1;
514
+ } else t1 = $[1];
515
+ let t2;
516
+ let t3;
517
+ let t4;
518
+ let t5;
519
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
520
+ t2 = () => setHovered(true);
521
+ t3 = () => setHovered(false);
522
+ t4 = () => setFocused(true);
523
+ t5 = (event) => {
735
524
  if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
736
- },
737
- ref,
738
- children: [isPending ? /* @__PURE__ */ jsx(Skeleton, {
739
- variant: "rectangular",
525
+ };
526
+ $[2] = t2;
527
+ $[3] = t3;
528
+ $[4] = t4;
529
+ $[5] = t5;
530
+ } else {
531
+ t2 = $[2];
532
+ t3 = $[3];
533
+ t4 = $[4];
534
+ t5 = $[5];
535
+ }
536
+ const t6 = `Open ${fileName}`;
537
+ let t7;
538
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
539
+ t7 = {
540
+ outline: "2px solid",
541
+ outlineColor: "primary.main",
542
+ outlineOffset: -2
543
+ };
544
+ $[6] = t7;
545
+ } else t7 = $[6];
546
+ let t8;
547
+ if ($[7] !== side) {
548
+ t8 = {
549
+ width: side,
550
+ height: side,
551
+ "&.Mui-focusVisible": t7
552
+ };
553
+ $[7] = side;
554
+ $[8] = t8;
555
+ } else t8 = $[8];
556
+ let t9;
557
+ if ($[9] !== side) {
558
+ t9 = {
559
+ objectFit: "contain",
740
560
  width: side,
741
561
  height: side
742
- }) : /* @__PURE__ */ jsx(ButtonBase, {
743
- onClick,
562
+ };
563
+ $[9] = side;
564
+ $[10] = t9;
565
+ } else t9 = $[10];
566
+ let t10;
567
+ if ($[11] !== meta.urls.thumbnail || $[12] !== t9) {
568
+ t10 = /* @__PURE__ */ jsx(Box, {
569
+ component: "img",
570
+ src: meta.urls.thumbnail,
571
+ loading: "lazy",
572
+ alt: "",
573
+ sx: t9
574
+ });
575
+ $[11] = meta.urls.thumbnail;
576
+ $[12] = t9;
577
+ $[13] = t10;
578
+ } else t10 = $[13];
579
+ let t11;
580
+ if ($[14] !== open || $[15] !== prefetch || $[16] !== t10 || $[17] !== t6 || $[18] !== t8) {
581
+ t11 = /* @__PURE__ */ jsx(ButtonBase, {
582
+ onClick: open,
744
583
  onMouseEnter: prefetch,
745
584
  onFocus: prefetch,
746
- "aria-label": `Open ${fileName}`,
747
- sx: {
748
- width: side,
749
- height: side,
750
- "&.Mui-focusVisible": {
751
- outline: "2px solid",
752
- outlineColor: "primary.main",
753
- outlineOffset: -2
754
- }
755
- },
756
- children: /* @__PURE__ */ jsx(Box, {
757
- component: "img",
758
- src: source,
759
- loading: "lazy",
760
- alt: "",
761
- sx: {
762
- objectFit: "contain",
763
- width: side,
764
- height: side
765
- }
766
- })
767
- }), showItemBar && /* @__PURE__ */ jsx(ImageListItemBar, {
585
+ "aria-label": t6,
586
+ sx: t8,
587
+ children: t10
588
+ });
589
+ $[14] = open;
590
+ $[15] = prefetch;
591
+ $[16] = t10;
592
+ $[17] = t6;
593
+ $[18] = t8;
594
+ $[19] = t11;
595
+ } else t11 = $[19];
596
+ let t12;
597
+ if ($[20] !== fileName || $[21] !== hasActions || $[22] !== meta.fileName || $[23] !== showItemBar) {
598
+ t12 = showItemBar && /* @__PURE__ */ jsx(ImageListItemBar, {
768
599
  title: /* @__PURE__ */ jsx(Tooltip, {
769
600
  title: fileName,
770
601
  children: /* @__PURE__ */ jsx(Box, { children: meta.fileName })
771
602
  }),
772
603
  actionIcon: hasActions && /* @__PURE__ */ jsx(IconButton, {
773
604
  sx: { color: grey[100] },
774
- onClick: (event) => setMenuAnchor(event.currentTarget),
605
+ onClick: (event_0) => setMenuAnchor(event_0.currentTarget),
775
606
  "aria-label": `Actions for ${fileName}`,
776
607
  "aria-haspopup": "menu",
777
608
  children: /* @__PURE__ */ jsx(MoreVert, {})
778
609
  })
779
- })]
780
- }), hasActions && /* @__PURE__ */ jsx(ActionsMenu, {
781
- meta,
782
- anchorEl: menuAnchor,
783
- onClose: () => setMenuAnchor(null)
784
- })] });
610
+ });
611
+ $[20] = fileName;
612
+ $[21] = hasActions;
613
+ $[22] = meta.fileName;
614
+ $[23] = showItemBar;
615
+ $[24] = t12;
616
+ } else t12 = $[24];
617
+ let t13;
618
+ if ($[25] !== t1 || $[26] !== t11 || $[27] !== t12) {
619
+ t13 = /* @__PURE__ */ jsxs(ImageListItem, {
620
+ sx: t1,
621
+ onMouseEnter: t2,
622
+ onMouseLeave: t3,
623
+ onFocus: t4,
624
+ onBlur: t5,
625
+ children: [t11, t12]
626
+ });
627
+ $[25] = t1;
628
+ $[26] = t11;
629
+ $[27] = t12;
630
+ $[28] = t13;
631
+ } else t13 = $[28];
632
+ let t14;
633
+ if ($[29] !== hasActions || $[30] !== menuAnchor || $[31] !== meta) {
634
+ t14 = hasActions && /* @__PURE__ */ jsx(ActionsMenu, {
635
+ meta,
636
+ anchorEl: menuAnchor,
637
+ onClose: () => setMenuAnchor(null)
638
+ });
639
+ $[29] = hasActions;
640
+ $[30] = menuAnchor;
641
+ $[31] = meta;
642
+ $[32] = t14;
643
+ } else t14 = $[32];
644
+ let t15;
645
+ if ($[33] !== t13 || $[34] !== t14) {
646
+ t15 = /* @__PURE__ */ jsxs(Fragment, { children: [t13, t14] });
647
+ $[33] = t13;
648
+ $[34] = t14;
649
+ $[35] = t15;
650
+ } else t15 = $[35];
651
+ return t15;
785
652
  };
786
653
  // src/components/file/fileViewer/FileViewerList.tsx
787
654
  const FileViewerList = (t0) => {
@@ -807,149 +674,166 @@ const FileViewerList = (t0) => {
807
674
  } else t2 = $[4];
808
675
  return t2;
809
676
  };
810
- const ListFileViewerItem = ({ meta }) => {
811
- const { setImageId, actions, appName } = useFile();
677
+ const ListFileViewerItem = (t0) => {
678
+ const $ = c(24);
679
+ const { meta } = t0;
680
+ const { open, prefetch, fileName, hasActions } = useOpenFile(meta);
812
681
  const [menuAnchor, setMenuAnchor] = useState(null);
813
- const queryClient = useQueryClient();
814
- const target = useRef(null);
815
- const fileName = `${meta.fileName}.${meta.fileExtension}`;
816
- const hasActions = actions?.download !== false || actions.delete !== false;
817
- const { mutate: openFile } = useMutation(openFileMutationOptions({ target }));
818
- const { mutate: download } = useMutation(downloadFileMutationOptions());
819
- const onClick = () => {
820
- switch (meta.mediaType) {
821
- case "image": return setImageId(meta.id);
822
- case "application":
823
- case "video":
824
- target.current = window.open("about:blank", "_blank");
825
- return openFile({
826
- id: meta.id,
827
- appName
828
- });
829
- default: return download({
830
- id: meta.id,
831
- appName,
832
- fileName: meta.fileName,
833
- fileExtension: meta.fileExtension
834
- });
835
- }
836
- };
837
- const icon = () => {
838
- switch (meta.mediaType) {
839
- case "image": return /* @__PURE__ */ jsx(Image, {});
840
- case "video": return /* @__PURE__ */ jsx(SmartDisplay, {});
841
- default: return /* @__PURE__ */ jsx(AttachFile, {});
842
- }
843
- };
844
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ListItem, {
845
- disablePadding: true,
846
- secondaryAction: hasActions && /* @__PURE__ */ jsx(IconButton, {
682
+ let t1;
683
+ if ($[0] !== meta.mediaType) {
684
+ t1 = () => {
685
+ switch (meta.mediaType) {
686
+ case "image": return /* @__PURE__ */ jsx(Image$1, {});
687
+ case "video": return /* @__PURE__ */ jsx(SmartDisplay, {});
688
+ default: return /* @__PURE__ */ jsx(AttachFile, {});
689
+ }
690
+ };
691
+ $[0] = meta.mediaType;
692
+ $[1] = t1;
693
+ } else t1 = $[1];
694
+ const icon = t1;
695
+ let t2;
696
+ if ($[2] !== fileName || $[3] !== hasActions) {
697
+ t2 = hasActions && /* @__PURE__ */ jsx(IconButton, {
847
698
  edge: "end",
848
699
  onClick: (event) => setMenuAnchor(event.currentTarget),
849
700
  "aria-label": `Actions for ${fileName}`,
850
701
  "aria-haspopup": "menu",
851
702
  children: /* @__PURE__ */ jsx(MoreVert, {})
852
- }),
853
- children: /* @__PURE__ */ jsxs(ListItemButton, {
854
- onClick,
855
- onMouseEnter: () => queryClient.prefetchQuery(fileQueryOptions({
856
- id: meta.id,
857
- appName
858
- })),
859
- children: [/* @__PURE__ */ jsx(ListItemIcon, { children: icon() }), /* @__PURE__ */ jsx(ListItemText, { primary: fileName })]
860
- })
861
- }), hasActions && /* @__PURE__ */ jsx(ActionsMenu, {
862
- meta,
863
- anchorEl: menuAnchor,
864
- onClose: () => setMenuAnchor(null)
865
- })] });
703
+ });
704
+ $[2] = fileName;
705
+ $[3] = hasActions;
706
+ $[4] = t2;
707
+ } else t2 = $[4];
708
+ let t3;
709
+ if ($[5] !== icon) {
710
+ t3 = /* @__PURE__ */ jsx(ListItemIcon, { children: icon() });
711
+ $[5] = icon;
712
+ $[6] = t3;
713
+ } else t3 = $[6];
714
+ let t4;
715
+ if ($[7] !== fileName) {
716
+ t4 = /* @__PURE__ */ jsx(ListItemText, { primary: fileName });
717
+ $[7] = fileName;
718
+ $[8] = t4;
719
+ } else t4 = $[8];
720
+ let t5;
721
+ if ($[9] !== open || $[10] !== prefetch || $[11] !== t3 || $[12] !== t4) {
722
+ t5 = /* @__PURE__ */ jsxs(ListItemButton, {
723
+ onClick: open,
724
+ onMouseEnter: prefetch,
725
+ onFocus: prefetch,
726
+ children: [t3, t4]
727
+ });
728
+ $[9] = open;
729
+ $[10] = prefetch;
730
+ $[11] = t3;
731
+ $[12] = t4;
732
+ $[13] = t5;
733
+ } else t5 = $[13];
734
+ let t6;
735
+ if ($[14] !== t2 || $[15] !== t5) {
736
+ t6 = /* @__PURE__ */ jsx(ListItem, {
737
+ disablePadding: true,
738
+ secondaryAction: t2,
739
+ children: t5
740
+ });
741
+ $[14] = t2;
742
+ $[15] = t5;
743
+ $[16] = t6;
744
+ } else t6 = $[16];
745
+ let t7;
746
+ if ($[17] !== hasActions || $[18] !== menuAnchor || $[19] !== meta) {
747
+ t7 = hasActions && /* @__PURE__ */ jsx(ActionsMenu, {
748
+ meta,
749
+ anchorEl: menuAnchor,
750
+ onClose: () => setMenuAnchor(null)
751
+ });
752
+ $[17] = hasActions;
753
+ $[18] = menuAnchor;
754
+ $[19] = meta;
755
+ $[20] = t7;
756
+ } else t7 = $[20];
757
+ let t8;
758
+ if ($[21] !== t6 || $[22] !== t7) {
759
+ t8 = /* @__PURE__ */ jsxs(Fragment, { children: [t6, t7] });
760
+ $[21] = t6;
761
+ $[22] = t7;
762
+ $[23] = t8;
763
+ } else t8 = $[23];
764
+ return t8;
866
765
  };
867
766
  function _temp$1(fileMeta) {
868
767
  return /* @__PURE__ */ jsx(ListFileViewerItem, { meta: fileMeta }, fileMeta.id);
869
768
  }
870
769
  // src/components/file/fileViewer/ImageViewer.tsx
871
770
  const ImageViewer = (t0) => {
872
- const $ = c(55);
771
+ const $ = c(58);
873
772
  const { metaId } = t0;
874
- const { fileMetas, setImageId, appName } = useFile();
875
- let meta;
876
- let next;
877
- let previous;
773
+ const { fileMetas, setImageId } = useFile();
774
+ const [loaded, setLoaded] = useState(false);
878
775
  let t1;
776
+ if ($[0] !== fileMetas || $[1] !== metaId) {
777
+ let t2;
778
+ if ($[3] !== metaId) {
779
+ t2 = (m) => m.id === metaId;
780
+ $[3] = metaId;
781
+ $[4] = t2;
782
+ } else t2 = $[4];
783
+ t1 = fileMetas.find(t2);
784
+ $[0] = fileMetas;
785
+ $[1] = metaId;
786
+ $[2] = t1;
787
+ } else t1 = $[2];
788
+ const meta = t1;
789
+ let images;
879
790
  let t2;
880
- if ($[0] !== appName || $[1] !== fileMetas || $[2] !== metaId) {
791
+ if ($[5] !== fileMetas || $[6] !== metaId) {
792
+ images = fileMetas.filter(_temp);
881
793
  let t3;
882
- if ($[8] !== metaId) {
883
- t3 = (m) => m.id === metaId;
884
- $[8] = metaId;
885
- $[9] = t3;
886
- } else t3 = $[9];
887
- meta = fileMetas.find(t3);
888
- let images;
889
- let t4;
890
- if ($[10] !== fileMetas || $[11] !== metaId) {
891
- images = fileMetas.filter(_temp);
892
- let t5;
893
- if ($[14] !== metaId) {
894
- t5 = (m_1) => m_1.id === metaId;
895
- $[14] = metaId;
896
- $[15] = t5;
897
- } else t5 = $[15];
898
- t4 = images.findIndex(t5);
899
- $[10] = fileMetas;
900
- $[11] = metaId;
901
- $[12] = images;
902
- $[13] = t4;
903
- } else {
904
- images = $[12];
905
- t4 = $[13];
906
- }
907
- const index = t4;
908
- previous = index > 0 ? images[index - 1] : void 0;
909
- next = index >= 0 && index < images.length - 1 ? images[index + 1] : void 0;
910
- t2 = useQuery;
911
- t1 = fileQueryOptions({
912
- id: meta?.id ?? "",
913
- appName
914
- });
915
- $[0] = appName;
916
- $[1] = fileMetas;
917
- $[2] = metaId;
918
- $[3] = meta;
919
- $[4] = next;
920
- $[5] = previous;
921
- $[6] = t1;
922
- $[7] = t2;
794
+ if ($[9] !== metaId) {
795
+ t3 = (m_1) => m_1.id === metaId;
796
+ $[9] = metaId;
797
+ $[10] = t3;
798
+ } else t3 = $[10];
799
+ t2 = images.findIndex(t3);
800
+ $[5] = fileMetas;
801
+ $[6] = metaId;
802
+ $[7] = images;
803
+ $[8] = t2;
923
804
  } else {
924
- meta = $[3];
925
- next = $[4];
926
- previous = $[5];
927
- t1 = $[6];
928
- t2 = $[7];
805
+ images = $[7];
806
+ t2 = $[8];
929
807
  }
930
- const t3 = !!meta;
808
+ const index = t2;
809
+ const previous = index > 0 ? images[index - 1] : void 0;
810
+ const next = index >= 0 && index < images.length - 1 ? images[index + 1] : void 0;
811
+ let t3;
812
+ if ($[11] !== setImageId) {
813
+ t3 = () => setImageId("");
814
+ $[11] = setImageId;
815
+ $[12] = t3;
816
+ } else t3 = $[12];
817
+ const onClose = t3;
931
818
  let t4;
932
- if ($[16] !== t1 || $[17] !== t3) {
933
- t4 = {
934
- ...t1,
935
- enabled: t3
936
- };
937
- $[16] = t1;
938
- $[17] = t3;
939
- $[18] = t4;
940
- } else t4 = $[18];
941
- const { data: source, isPending } = t2(t4);
942
819
  let t5;
943
- if ($[19] !== setImageId) {
944
- t5 = () => setImageId("");
945
- $[19] = setImageId;
946
- $[20] = t5;
947
- } else t5 = $[20];
948
- const onClose = t5;
820
+ if ($[13] !== next || $[14] !== previous) {
821
+ t4 = () => {
822
+ for (const neighbor of [previous, next]) if (neighbor && neighbor.fileSize <= 20971520) new Image().src = neighbor.urls.view;
823
+ };
824
+ t5 = [previous, next];
825
+ $[13] = next;
826
+ $[14] = previous;
827
+ $[15] = t4;
828
+ $[16] = t5;
829
+ } else {
830
+ t4 = $[15];
831
+ t5 = $[16];
832
+ }
833
+ useEffect(t4, t5);
949
834
  let t6;
950
- if ($[21] !== metaId || $[22] !== next || $[23] !== onClose || $[24] !== previous || $[25] !== setImageId) {
835
+ if ($[17] !== next || $[18] !== onClose || $[19] !== previous || $[20] !== setImageId) {
951
836
  t6 = () => {
952
- if (!metaId) return;
953
837
  const handleOnKeydown = (event) => {
954
838
  switch (event.key) {
955
839
  case "ArrowLeft": return previous && setImageId(previous.id);
@@ -963,46 +847,45 @@ const ImageViewer = (t0) => {
963
847
  globalThis.addEventListener("keydown", handleOnKeydown);
964
848
  return () => globalThis.removeEventListener("keydown", handleOnKeydown);
965
849
  };
966
- $[21] = metaId;
967
- $[22] = next;
968
- $[23] = onClose;
969
- $[24] = previous;
970
- $[25] = setImageId;
971
- $[26] = t6;
972
- } else t6 = $[26];
850
+ $[17] = next;
851
+ $[18] = onClose;
852
+ $[19] = previous;
853
+ $[20] = setImageId;
854
+ $[21] = t6;
855
+ } else t6 = $[21];
973
856
  let t7;
974
- if ($[27] !== metaId || $[28] !== next || $[29] !== previous) {
857
+ if ($[22] !== metaId || $[23] !== next || $[24] !== previous) {
975
858
  t7 = [
976
859
  metaId,
977
860
  previous,
978
861
  next
979
862
  ];
980
- $[27] = metaId;
981
- $[28] = next;
982
- $[29] = previous;
983
- $[30] = t7;
984
- } else t7 = $[30];
863
+ $[22] = metaId;
864
+ $[23] = next;
865
+ $[24] = previous;
866
+ $[25] = t7;
867
+ } else t7 = $[25];
985
868
  useEffect(t6, t7);
986
869
  if (!meta) return null;
987
870
  let t8;
988
- if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
871
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
989
872
  t8 = {
990
873
  position: "fixed",
991
874
  top: "50%",
992
875
  transform: "translateY(-50%)"
993
876
  };
994
- $[31] = t8;
995
- } else t8 = $[31];
877
+ $[26] = t8;
878
+ } else t8 = $[26];
996
879
  const navSx = t8;
997
880
  let t9;
998
- if ($[32] !== meta.fileName) {
881
+ if ($[27] !== meta.fileName) {
999
882
  t9 = { paper: { "aria-label": meta.fileName } };
1000
- $[32] = meta.fileName;
1001
- $[33] = t9;
1002
- } else t9 = $[33];
883
+ $[27] = meta.fileName;
884
+ $[28] = t9;
885
+ } else t9 = $[28];
1003
886
  let t10;
1004
- if ($[34] !== isPending || $[35] !== meta.fileName || $[36] !== source) {
1005
- t10 = isPending ? /* @__PURE__ */ jsx(Skeleton, {
887
+ if ($[29] !== loaded) {
888
+ t10 = !loaded && /* @__PURE__ */ jsx(Skeleton, {
1006
889
  variant: "rectangular",
1007
890
  sx: {
1008
891
  width: {
@@ -1014,26 +897,58 @@ const ImageViewer = (t0) => {
1014
897
  sm: "calc(100vh - 64px)"
1015
898
  }
1016
899
  }
1017
- }) : /* @__PURE__ */ jsx(Box, {
900
+ });
901
+ $[29] = loaded;
902
+ $[30] = t10;
903
+ } else t10 = $[30];
904
+ let t11;
905
+ let t12;
906
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
907
+ t11 = () => setLoaded(true);
908
+ t12 = () => setLoaded(true);
909
+ $[31] = t11;
910
+ $[32] = t12;
911
+ } else {
912
+ t11 = $[31];
913
+ t12 = $[32];
914
+ }
915
+ const t13 = loaded ? "block" : "none";
916
+ let t14;
917
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
918
+ t14 = {
919
+ xs: "calc(100vh - 56px)",
920
+ sm: "calc(100vh - 64px)"
921
+ };
922
+ $[33] = t14;
923
+ } else t14 = $[33];
924
+ let t15;
925
+ if ($[34] !== t13) {
926
+ t15 = {
927
+ display: t13,
928
+ maxWidth: "100vw",
929
+ maxHeight: t14
930
+ };
931
+ $[34] = t13;
932
+ $[35] = t15;
933
+ } else t15 = $[35];
934
+ let t16;
935
+ if ($[36] !== meta.fileName || $[37] !== meta.urls.view || $[38] !== t15) {
936
+ t16 = /* @__PURE__ */ jsx(Box, {
1018
937
  component: "img",
1019
- src: source,
938
+ src: meta.urls.view,
1020
939
  alt: meta.fileName,
1021
- sx: {
1022
- maxWidth: "100vw",
1023
- maxHeight: {
1024
- xs: "calc(100vh - 56px)",
1025
- sm: "calc(100vh - 64px)"
1026
- }
1027
- }
940
+ onLoad: t11,
941
+ onError: t12,
942
+ sx: t15
1028
943
  });
1029
- $[34] = isPending;
1030
- $[35] = meta.fileName;
1031
- $[36] = source;
1032
- $[37] = t10;
1033
- } else t10 = $[37];
1034
- let t11;
1035
- if ($[38] !== previous || $[39] !== setImageId) {
1036
- t11 = previous && /* @__PURE__ */ jsx(Fab, {
944
+ $[36] = meta.fileName;
945
+ $[37] = meta.urls.view;
946
+ $[38] = t15;
947
+ $[39] = t16;
948
+ } else t16 = $[39];
949
+ let t17;
950
+ if ($[40] !== previous || $[41] !== setImageId) {
951
+ t17 = previous && /* @__PURE__ */ jsx(Fab, {
1037
952
  size: "medium",
1038
953
  onClick: () => setImageId(previous.id),
1039
954
  "aria-label": "Previous",
@@ -1043,13 +958,13 @@ const ImageViewer = (t0) => {
1043
958
  },
1044
959
  children: /* @__PURE__ */ jsx(ChevronLeft, {})
1045
960
  });
1046
- $[38] = previous;
1047
- $[39] = setImageId;
1048
- $[40] = t11;
1049
- } else t11 = $[40];
1050
- let t12;
1051
- if ($[41] !== next || $[42] !== setImageId) {
1052
- t12 = next && /* @__PURE__ */ jsx(Fab, {
961
+ $[40] = previous;
962
+ $[41] = setImageId;
963
+ $[42] = t17;
964
+ } else t17 = $[42];
965
+ let t18;
966
+ if ($[43] !== next || $[44] !== setImageId) {
967
+ t18 = next && /* @__PURE__ */ jsx(Fab, {
1053
968
  size: "medium",
1054
969
  onClick: () => setImageId(next.id),
1055
970
  "aria-label": "Next",
@@ -1059,73 +974,75 @@ const ImageViewer = (t0) => {
1059
974
  },
1060
975
  children: /* @__PURE__ */ jsx(ChevronRight, {})
1061
976
  });
1062
- $[41] = next;
1063
- $[42] = setImageId;
1064
- $[43] = t12;
1065
- } else t12 = $[43];
1066
- let t13;
1067
- let t14;
1068
- if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
1069
- t13 = {
977
+ $[43] = next;
978
+ $[44] = setImageId;
979
+ $[45] = t18;
980
+ } else t18 = $[45];
981
+ let t19;
982
+ let t20;
983
+ if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
984
+ t19 = {
1070
985
  position: "fixed",
1071
986
  top: 8,
1072
987
  right: 8
1073
988
  };
1074
- t14 = /* @__PURE__ */ jsx(Close, {});
1075
- $[44] = t13;
1076
- $[45] = t14;
989
+ t20 = /* @__PURE__ */ jsx(Close, {});
990
+ $[46] = t19;
991
+ $[47] = t20;
1077
992
  } else {
1078
- t13 = $[44];
1079
- t14 = $[45];
993
+ t19 = $[46];
994
+ t20 = $[47];
1080
995
  }
1081
- let t15;
1082
- if ($[46] !== onClose) {
1083
- t15 = /* @__PURE__ */ jsx(Fab, {
996
+ let t21;
997
+ if ($[48] !== onClose) {
998
+ t21 = /* @__PURE__ */ jsx(Fab, {
1084
999
  size: "medium",
1085
1000
  onClick: onClose,
1086
1001
  "aria-label": "Close",
1087
- sx: t13,
1088
- children: t14
1002
+ sx: t19,
1003
+ children: t20
1089
1004
  });
1090
- $[46] = onClose;
1091
- $[47] = t15;
1092
- } else t15 = $[47];
1093
- let t16;
1094
- if ($[48] !== onClose || $[49] !== t10 || $[50] !== t11 || $[51] !== t12 || $[52] !== t15 || $[53] !== t9) {
1095
- t16 = /* @__PURE__ */ jsxs(Dialog, {
1005
+ $[48] = onClose;
1006
+ $[49] = t21;
1007
+ } else t21 = $[49];
1008
+ let t22;
1009
+ if ($[50] !== onClose || $[51] !== t10 || $[52] !== t16 || $[53] !== t17 || $[54] !== t18 || $[55] !== t21 || $[56] !== t9) {
1010
+ t22 = /* @__PURE__ */ jsxs(Dialog, {
1096
1011
  open: true,
1097
1012
  onClose,
1098
1013
  maxWidth: "xl",
1099
1014
  slotProps: t9,
1100
1015
  children: [
1101
1016
  t10,
1102
- t11,
1103
- t12,
1104
- t15
1017
+ t16,
1018
+ t17,
1019
+ t18,
1020
+ t21
1105
1021
  ]
1106
1022
  });
1107
- $[48] = onClose;
1108
- $[49] = t10;
1109
- $[50] = t11;
1110
- $[51] = t12;
1111
- $[52] = t15;
1112
- $[53] = t9;
1113
- $[54] = t16;
1114
- } else t16 = $[54];
1115
- return t16;
1023
+ $[50] = onClose;
1024
+ $[51] = t10;
1025
+ $[52] = t16;
1026
+ $[53] = t17;
1027
+ $[54] = t18;
1028
+ $[55] = t21;
1029
+ $[56] = t9;
1030
+ $[57] = t22;
1031
+ } else t22 = $[57];
1032
+ return t22;
1116
1033
  };
1117
1034
  function _temp(m_0) {
1118
1035
  return m_0.mediaType === "image";
1119
1036
  }
1120
1037
  // src/components/file/FileViewer.tsx
1121
1038
  const FileViewer = (t0) => {
1122
- const $ = c(21);
1123
- const { appName, subId, onDelete, actions, children } = t0;
1039
+ const $ = c(20);
1040
+ const { subId, appName, onDelete, actions, children } = t0;
1124
1041
  let t1;
1125
1042
  if ($[0] !== appName || $[1] !== subId) {
1126
1043
  t1 = fileMetasQueryOptions({
1127
- appName,
1128
- subId
1044
+ subId,
1045
+ appName
1129
1046
  });
1130
1047
  $[0] = appName;
1131
1048
  $[1] = subId;
@@ -1153,210 +1070,51 @@ const FileViewer = (t0) => {
1153
1070
  const [imageId, setImageId] = useState("");
1154
1071
  if (fileMetas.length === 0) return null;
1155
1072
  let t6;
1156
- if ($[8] !== actions || $[9] !== appName || $[10] !== fileMetas || $[11] !== onDelete) {
1073
+ if ($[8] !== actions || $[9] !== fileMetas || $[10] !== onDelete) {
1157
1074
  t6 = {
1158
- appName,
1159
1075
  fileMetas,
1160
1076
  onDelete,
1161
1077
  actions,
1162
1078
  setImageId
1163
1079
  };
1164
1080
  $[8] = actions;
1165
- $[9] = appName;
1166
- $[10] = fileMetas;
1167
- $[11] = onDelete;
1168
- $[12] = t6;
1169
- } else t6 = $[12];
1081
+ $[9] = fileMetas;
1082
+ $[10] = onDelete;
1083
+ $[11] = t6;
1084
+ } else t6 = $[11];
1170
1085
  let t7;
1171
- if ($[13] !== children) {
1086
+ if ($[12] !== children) {
1172
1087
  t7 = children({
1173
1088
  Grid: FileViewerGrid,
1174
1089
  List: FileViewerList
1175
1090
  });
1176
- $[13] = children;
1177
- $[14] = t7;
1178
- } else t7 = $[14];
1091
+ $[12] = children;
1092
+ $[13] = t7;
1093
+ } else t7 = $[13];
1179
1094
  let t8;
1180
- if ($[15] !== imageId) {
1181
- t8 = /* @__PURE__ */ jsx(ImageViewer, { metaId: imageId });
1182
- $[15] = imageId;
1183
- $[16] = t8;
1184
- } else t8 = $[16];
1095
+ if ($[14] !== imageId) {
1096
+ t8 = imageId && /* @__PURE__ */ jsx(ImageViewer, { metaId: imageId });
1097
+ $[14] = imageId;
1098
+ $[15] = t8;
1099
+ } else t8 = $[15];
1185
1100
  let t9;
1186
- if ($[17] !== t6 || $[18] !== t7 || $[19] !== t8) {
1101
+ if ($[16] !== t6 || $[17] !== t7 || $[18] !== t8) {
1187
1102
  t9 = /* @__PURE__ */ jsxs(FileContext.Provider, {
1188
1103
  value: t6,
1189
1104
  children: [t7, t8]
1190
1105
  });
1191
- $[17] = t6;
1192
- $[18] = t7;
1193
- $[19] = t8;
1194
- $[20] = t9;
1195
- } else t9 = $[20];
1106
+ $[16] = t6;
1107
+ $[17] = t7;
1108
+ $[18] = t8;
1109
+ $[19] = t9;
1110
+ } else t9 = $[19];
1196
1111
  return t9;
1197
1112
  };
1198
- // src/components/router/RouterButton.tsx
1199
- const Component$2 = React.forwardRef(function ButtonComponent(props, reference) {
1200
- const $ = c(3);
1201
- let t0;
1202
- if ($[0] !== props || $[1] !== reference) {
1203
- t0 = /* @__PURE__ */ jsx(Button, {
1204
- ref: reference,
1205
- component: "a",
1206
- ...props
1207
- });
1208
- $[0] = props;
1209
- $[1] = reference;
1210
- $[2] = t0;
1211
- } else t0 = $[2];
1212
- return t0;
1213
- });
1214
- const CreatedComponent$2 = createLink(Component$2);
1215
- const RouterButton = (props) => {
1216
- const $ = c(2);
1217
- let t0;
1218
- if ($[0] !== props) {
1219
- t0 = /* @__PURE__ */ jsx(CreatedComponent$2, { ...props });
1220
- $[0] = props;
1221
- $[1] = t0;
1222
- } else t0 = $[1];
1223
- return t0;
1224
- };
1225
- // src/components/router/RouterFab.tsx
1226
- const Component$1 = React.forwardRef(function FabComponent(props, reference) {
1227
- const $ = c(3);
1228
- let t0;
1229
- if ($[0] !== props || $[1] !== reference) {
1230
- t0 = /* @__PURE__ */ jsx(Fab, {
1231
- ref: reference,
1232
- component: "a",
1233
- ...props
1234
- });
1235
- $[0] = props;
1236
- $[1] = reference;
1237
- $[2] = t0;
1238
- } else t0 = $[2];
1239
- return t0;
1240
- });
1241
- const CreatedComponent$1 = createLink(Component$1);
1242
- const RouterFab = (props) => {
1243
- const $ = c(2);
1244
- let t0;
1245
- if ($[0] !== props) {
1246
- t0 = /* @__PURE__ */ jsx(CreatedComponent$1, { ...props });
1247
- $[0] = props;
1248
- $[1] = t0;
1249
- } else t0 = $[1];
1250
- return t0;
1251
- };
1252
- // src/components/router/RouterTab.tsx
1253
- const Component = React.forwardRef(function TabComponent(props, reference) {
1254
- const $ = c(3);
1255
- let t0;
1256
- if ($[0] !== props || $[1] !== reference) {
1257
- t0 = /* @__PURE__ */ jsx(Tab, {
1258
- ref: reference,
1259
- component: "a",
1260
- ...props
1261
- });
1262
- $[0] = props;
1263
- $[1] = reference;
1264
- $[2] = t0;
1265
- } else t0 = $[2];
1266
- return t0;
1267
- });
1268
- const CreatedComponent = createLink(Component);
1269
- const RouterTab = (props) => {
1270
- const $ = c(2);
1271
- let t0;
1272
- if ($[0] !== props) {
1273
- t0 = /* @__PURE__ */ jsx(CreatedComponent, { ...props });
1274
- $[0] = props;
1275
- $[1] = t0;
1276
- } else t0 = $[1];
1277
- return t0;
1278
- };
1279
- // src/components/router/RouterNotFound.tsx
1280
- function RouterNotFound() {
1281
- const $ = c(8);
1282
- const { t } = useTranslation();
1283
- let t0;
1284
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1285
- t0 = {
1286
- alignItems: "center",
1287
- justifyContent: "center",
1288
- px: 2
1289
- };
1290
- $[0] = t0;
1291
- } else t0 = $[0];
1292
- let t1;
1293
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1294
- t1 = {
1295
- display: "flex",
1296
- alignItems: "center",
1297
- m: 0,
1298
- mb: 4
1299
- };
1300
- $[1] = t1;
1301
- } else t1 = $[1];
1302
- let t2;
1303
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1304
- t2 = /* @__PURE__ */ jsx(Typography, {
1305
- variant: "h3",
1306
- component: "span",
1307
- sx: {
1308
- fontWeight: 500,
1309
- lineHeight: 1
1310
- },
1311
- children: "404"
1312
- });
1313
- $[2] = t2;
1314
- } else t2 = $[2];
1315
- let t3;
1316
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1317
- t3 = /* @__PURE__ */ jsx(Divider, {
1318
- component: "span",
1319
- role: "presentation",
1320
- orientation: "vertical",
1321
- flexItem: true,
1322
- sx: { mx: 3 }
1323
- });
1324
- $[3] = t3;
1325
- } else t3 = $[3];
1326
- let t4;
1327
- if ($[4] !== t) {
1328
- t4 = t("Layout.ThisPageCouldNotBeFound");
1329
- $[4] = t;
1330
- $[5] = t4;
1331
- } else t4 = $[5];
1332
- let t5;
1333
- if ($[6] !== t4) {
1334
- t5 = /* @__PURE__ */ jsx(Fullscreen, {
1335
- sx: t0,
1336
- children: /* @__PURE__ */ jsxs(Box, {
1337
- component: "h1",
1338
- sx: t1,
1339
- children: [
1340
- t2,
1341
- t3,
1342
- /* @__PURE__ */ jsx(Typography, {
1343
- variant: "h5",
1344
- component: "span",
1345
- children: t4
1346
- })
1347
- ]
1348
- })
1349
- });
1350
- $[6] = t4;
1351
- $[7] = t5;
1352
- } else t5 = $[7];
1353
- return t5;
1354
- }
1355
1113
  // src/components/router/RouterError.tsx
1356
- const RouterError = (t0) => {
1114
+ /** A full-page error: its code, a rule and the message. */
1115
+ const ErrorPage = (t0) => {
1357
1116
  const $ = c(11);
1358
- const { error } = t0;
1359
- const isError = error instanceof Error;
1117
+ const { code, message } = t0;
1360
1118
  let t1;
1361
1119
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1362
1120
  t1 = {
@@ -1384,60 +1142,96 @@ const RouterError = (t0) => {
1384
1142
  };
1385
1143
  $[2] = t3;
1386
1144
  } else t3 = $[2];
1387
- const t4 = isError && error.name || "500";
1388
- let t5;
1389
- if ($[3] !== t4) {
1390
- t5 = /* @__PURE__ */ jsx(Typography, {
1145
+ let t4;
1146
+ if ($[3] !== code) {
1147
+ t4 = /* @__PURE__ */ jsx(Typography, {
1391
1148
  variant: "h3",
1392
1149
  component: "span",
1393
1150
  sx: t3,
1394
- children: t4
1151
+ children: code
1395
1152
  });
1396
- $[3] = t4;
1397
- $[4] = t5;
1398
- } else t5 = $[4];
1399
- let t6;
1153
+ $[3] = code;
1154
+ $[4] = t4;
1155
+ } else t4 = $[4];
1156
+ let t5;
1400
1157
  if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1401
- t6 = /* @__PURE__ */ jsx(Divider, {
1158
+ t5 = /* @__PURE__ */ jsx(Divider, {
1402
1159
  component: "span",
1403
1160
  role: "presentation",
1404
1161
  orientation: "vertical",
1405
1162
  flexItem: true,
1406
1163
  sx: { mx: 3 }
1407
1164
  });
1408
- $[5] = t6;
1409
- } else t6 = $[5];
1410
- const t7 = isError ? error.message : String(error);
1411
- let t8;
1412
- if ($[6] !== t7) {
1413
- t8 = /* @__PURE__ */ jsx(Typography, {
1165
+ $[5] = t5;
1166
+ } else t5 = $[5];
1167
+ let t6;
1168
+ if ($[6] !== message) {
1169
+ t6 = /* @__PURE__ */ jsx(Typography, {
1414
1170
  variant: "h5",
1415
1171
  component: "span",
1416
- children: t7
1172
+ children: message
1417
1173
  });
1418
- $[6] = t7;
1419
- $[7] = t8;
1420
- } else t8 = $[7];
1421
- let t9;
1422
- if ($[8] !== t5 || $[9] !== t8) {
1423
- t9 = /* @__PURE__ */ jsx(Fullscreen, {
1174
+ $[6] = message;
1175
+ $[7] = t6;
1176
+ } else t6 = $[7];
1177
+ let t7;
1178
+ if ($[8] !== t4 || $[9] !== t6) {
1179
+ t7 = /* @__PURE__ */ jsx(Fullscreen, {
1424
1180
  sx: t1,
1425
1181
  children: /* @__PURE__ */ jsxs(Box, {
1426
1182
  component: "h1",
1427
1183
  sx: t2,
1428
1184
  children: [
1185
+ t4,
1429
1186
  t5,
1430
- t6,
1431
- t8
1187
+ t6
1432
1188
  ]
1433
1189
  })
1434
1190
  });
1435
- $[8] = t5;
1436
- $[9] = t8;
1437
- $[10] = t9;
1438
- } else t9 = $[10];
1439
- return t9;
1191
+ $[8] = t4;
1192
+ $[9] = t6;
1193
+ $[10] = t7;
1194
+ } else t7 = $[10];
1195
+ return t7;
1440
1196
  };
1197
+ const RouterError = (t0) => {
1198
+ const $ = c(3);
1199
+ const { error } = t0;
1200
+ const t1 = error instanceof Error && error.name || "500";
1201
+ const t2 = error instanceof Error ? error.message : String(error);
1202
+ let t3;
1203
+ if ($[0] !== t1 || $[1] !== t2) {
1204
+ t3 = /* @__PURE__ */ jsx(ErrorPage, {
1205
+ code: t1,
1206
+ message: t2
1207
+ });
1208
+ $[0] = t1;
1209
+ $[1] = t2;
1210
+ $[2] = t3;
1211
+ } else t3 = $[2];
1212
+ return t3;
1213
+ };
1214
+ // src/components/router/RouterNotFound.tsx
1215
+ function RouterNotFound() {
1216
+ const $ = c(4);
1217
+ const { t } = useTranslation();
1218
+ let t0;
1219
+ if ($[0] !== t) {
1220
+ t0 = t("Layout.ThisPageCouldNotBeFound");
1221
+ $[0] = t;
1222
+ $[1] = t0;
1223
+ } else t0 = $[1];
1224
+ let t1;
1225
+ if ($[2] !== t0) {
1226
+ t1 = /* @__PURE__ */ jsx(ErrorPage, {
1227
+ code: "404",
1228
+ message: t0
1229
+ });
1230
+ $[2] = t0;
1231
+ $[3] = t1;
1232
+ } else t1 = $[3];
1233
+ return t1;
1234
+ }
1441
1235
  // src/components/table/LayoutTable.tsx
1442
1236
  const ROW_HEIGHT = 52;
1443
1237
  const COLUMN_HEADER_HEIGHT = 56;
@@ -1445,6 +1239,7 @@ const COLUMN_HEADER_HEIGHT = 56;
1445
1239
  const ROW_OVERSCAN = 6;
1446
1240
  const ROW_LOOKAHEAD = 15;
1447
1241
  const COLUMN_OVERSCAN = 3;
1242
+ const PAGE_SIZE = 25;
1448
1243
  const JUSTIFY = {
1449
1244
  left: "flex-start",
1450
1245
  center: "center",
@@ -1468,6 +1263,76 @@ const FOOTER_SX = {
1468
1263
  borderTopStyle: "solid",
1469
1264
  borderColor: "divider"
1470
1265
  };
1266
+ /**
1267
+ * The editor covers its cell and the cell is the field: one ring and no outline of the input's
1268
+ * own, its inset the cell's padding, so the text stays exactly where the value was drawn.
1269
+ */
1270
+ const EDITOR_SX = {
1271
+ position: "absolute",
1272
+ inset: 0,
1273
+ display: "flex",
1274
+ alignItems: "center",
1275
+ bgcolor: "background.paper",
1276
+ "& .MuiAutocomplete-root, & .MuiTextField-root": {
1277
+ width: 1,
1278
+ height: 1
1279
+ },
1280
+ "& .MuiInputBase-root": {
1281
+ height: 1,
1282
+ pl: "0 !important",
1283
+ font: "inherit",
1284
+ letterSpacing: "inherit"
1285
+ },
1286
+ "& .MuiInputBase-input": {
1287
+ px: `${CELL_SX.px} !important`,
1288
+ textAlign: "inherit"
1289
+ },
1290
+ "& .MuiOutlinedInput-notchedOutline": { display: "none" },
1291
+ "& .MuiFormControlLabel-root": { m: 0 },
1292
+ "& .MuiFormHelperText-root": { display: "none" }
1293
+ };
1294
+ const editorRing = (color) => (theme) => `inset 0 0 0 2px ${(theme.vars ?? theme).palette[color].main}`;
1295
+ /** The error sits right under the edited cell. */
1296
+ const EDITOR_ERROR_SLOT_PROPS = {
1297
+ popper: { modifiers: [{
1298
+ name: "offset",
1299
+ options: { offset: [0, -10] }
1300
+ }] },
1301
+ tooltip: { sx: {
1302
+ bgcolor: "error.main",
1303
+ color: "error.contrastText"
1304
+ } }
1305
+ };
1306
+ /** A hovered row outlines its editable cells like inputs, the one under the pointer firmer. */
1307
+ const EDITABLE_SX = { "@media (hover: hover) and (pointer: fine)": {
1308
+ ".MuiTableRow-root:hover > &": { boxShadow: (theme) => `inset 0 0 0 1px ${(theme.vars ?? theme).palette.divider}` },
1309
+ ".MuiTableRow-root:hover > &:hover": { boxShadow: (theme) => `inset 0 0 0 1px ${(theme.vars ?? theme).palette.text.disabled}` }
1310
+ } };
1311
+ /**
1312
+ * The pencil a hovered editable cell shows; one click edits. Opaque, so it covers the end of a
1313
+ * long value cleanly. A hidden one takes no clicks, so on a touch screen the first tap selects
1314
+ * the cell and shows it.
1315
+ */
1316
+ const EDIT_BUTTON_SX = {
1317
+ position: "absolute",
1318
+ top: "50%",
1319
+ transform: "translateY(-50%)",
1320
+ p: .5,
1321
+ color: "text.secondary",
1322
+ bgcolor: "background.paper",
1323
+ opacity: 0,
1324
+ pointerEvents: "none",
1325
+ ".MuiTableCell-root:hover > &": {
1326
+ opacity: 1,
1327
+ pointerEvents: "auto"
1328
+ },
1329
+ "&:hover": {
1330
+ color: "text.primary",
1331
+ bgcolor: "background.paper"
1332
+ }
1333
+ };
1334
+ /** A module-level ref, so it runs once when the editor mounts rather than on every render. */
1335
+ const focusEditor = (element) => element?.querySelector("input:not([aria-hidden]), textarea, [tabindex='0']")?.focus();
1471
1336
  const pinnedWidth = (columns) => columns.reduce((total, column) => total + column.getSize(), 0);
1472
1337
  /**
1473
1338
  * Gives an ellipsized value (the cell itself or a noWrap Typography in it) a native
@@ -1478,7 +1343,7 @@ const titleIfTruncated = (event) => {
1478
1343
  if (getComputedStyle(element).textOverflow !== "ellipsis") return;
1479
1344
  element.title = element.scrollWidth > element.clientWidth ? element.textContent ?? "" : "";
1480
1345
  };
1481
- function LayoutTable({ table, loading = false, pagination = false, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, showToolbar = false, disableColumnMenu = false, onRowClick, onRowDoubleClick, sx, ...toolbar }) {
1346
+ function LayoutTable({ table, loading = false, pagination = false, showToolbar = false, disableColumnMenu = false, onRowClick, onRowDoubleClick, onRowUpdate, editSchema, sx, ...toolbar }) {
1482
1347
  "use no memo";
1483
1348
  const { t } = useTranslation();
1484
1349
  const containerRef = useRef(null);
@@ -1496,25 +1361,15 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1496
1361
  ];
1497
1362
  const isEmpty = !loading && !rows.length;
1498
1363
  const pageSize = table.state.pagination.pageSize;
1499
- const pageSizeOffered = pageSizeOptions.includes(pageSize);
1500
- const pagerStarted = useRef(false);
1364
+ const targetPageSize = pagination ? PAGE_SIZE : Math.max(rows.length, 1);
1501
1365
  useLayoutEffect(() => {
1502
- if (!pagination) {
1503
- if (pageSize !== rows.length) table.setPageSize(Math.max(rows.length, 1));
1504
- return;
1505
- }
1506
- const appSetSize = pagerStarted.current || !!(table.options.state?.pagination ?? table.options.initialState?.pagination);
1507
- pagerStarted.current = true;
1508
- if (!appSetSize || !pageSizeOffered) table.setPagination({
1366
+ if (pageSize !== targetPageSize) table.setPagination({
1509
1367
  pageIndex: 0,
1510
- pageSize: Math.min(...pageSizeOptions)
1368
+ pageSize: targetPageSize
1511
1369
  });
1512
1370
  }, [
1513
- pagination,
1514
1371
  pageSize,
1515
- pageSizeOffered,
1516
- pageSizeOptions,
1517
- rows.length,
1372
+ targetPageSize,
1518
1373
  table
1519
1374
  ]);
1520
1375
  const startColumns = table.getStartVisibleLeafColumns();
@@ -1523,13 +1378,16 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1523
1378
  const startPinnedWidth = pinnedWidth(startColumns);
1524
1379
  const endPinnedWidth = pinnedWidth(endColumns);
1525
1380
  const [containerWidth, setContainerWidth] = useState(0);
1526
- useLayoutEffect(() => {
1527
- const container = containerRef.current;
1381
+ const observeContainer = useCallback((container) => {
1382
+ containerRef.current = container;
1528
1383
  if (!container) return;
1529
1384
  setContainerWidth(container.clientWidth - 1);
1530
1385
  const observer = new ResizeObserver(([entry]) => setContainerWidth(Math.floor(entry.contentRect.width)));
1531
1386
  observer.observe(container);
1532
- return () => observer.disconnect();
1387
+ return () => {
1388
+ observer.disconnect();
1389
+ containerRef.current = null;
1390
+ };
1533
1391
  }, []);
1534
1392
  const flexColumns = table.getVisibleLeafColumns().filter((column) => columnFlex(column) > 0);
1535
1393
  const totalFlex = flexColumns.reduce((total, column) => total + columnFlex(column), 0);
@@ -1592,6 +1450,34 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1592
1450
  if (columnIndex >= 0) columnVirtualizer.scrollToIndex(columnIndex);
1593
1451
  }, [focusedRowId, focusedColumnId]);
1594
1452
  const hasCellSelection = table.state.cellSelection.length > 0;
1453
+ const [editing, setEditing] = useState();
1454
+ const form = useLayoutForm({
1455
+ defaultValues: void 0,
1456
+ validators: { onChange: editSchema },
1457
+ onSubmit: async ({ value }) => {
1458
+ await onRowUpdate?.(value);
1459
+ setEditing(void 0);
1460
+ }
1461
+ });
1462
+ const cellEditor = (cell) => onRowUpdate && !cell.row.getIsGrouped() ? cell.column.columnDef.meta?.edit : void 0;
1463
+ const startEditing = async (cell) => {
1464
+ if (form.state.isSubmitting || editing && !await commitEdit()) return;
1465
+ form.reset(cell.row.original);
1466
+ setEditing({
1467
+ rowId: cell.row.id,
1468
+ columnId: cell.column.id
1469
+ });
1470
+ };
1471
+ /** Resolves true once the editor has closed: saved, or nothing changed. */
1472
+ const commitEdit = async () => {
1473
+ if (form.state.isSubmitting) return false;
1474
+ if (!form.state.isDirty) {
1475
+ setEditing(void 0);
1476
+ return true;
1477
+ }
1478
+ await form.handleSubmit();
1479
+ return form.state.isSubmitSuccessful;
1480
+ };
1595
1481
  const copySelection = () => {
1596
1482
  const text = toClipboardText(table.getSelectedCellRangesData());
1597
1483
  if (text) navigator.clipboard.writeText(text);
@@ -1640,11 +1526,11 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1640
1526
  {
1641
1527
  hotkey: "Mod+A",
1642
1528
  callback: () => table.selectAllCells(),
1643
- options: { enabled: true }
1529
+ options: { enabled: !editing }
1644
1530
  }
1645
1531
  ], {
1646
1532
  target: containerRef,
1647
- enabled: hasCellSelection
1533
+ enabled: hasCellSelection && !editing
1648
1534
  });
1649
1535
  const virtualRows = rowVirtualizer.getVirtualItems();
1650
1536
  const paddingTop = virtualRows.length ? virtualRows[0].start - headerHeight : 0;
@@ -1727,29 +1613,95 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1727
1613
  const cellClassName = (cell) => classNames(layoutTableClasses.cell, cell.getIsSelected() && layoutTableClasses["cell--selected"], cell.getIsGrouped() && layoutTableClasses["cell--grouped"], cell.getIsAggregated() && layoutTableClasses["cell--aggregated"], pinnedClass(cell.column, "cell"));
1728
1614
  const renderCell = (c) => /* @__PURE__ */ jsx(table.AppCell, {
1729
1615
  cell: c,
1730
- children: (cell) => cell.getIsCovered() ? null : /* @__PURE__ */ jsx(TableCell, {
1731
- className: cellClassName(cell),
1732
- align: columnAlign(cell.column),
1733
- rowSpan: cell.getRowSpan(),
1734
- colSpan: cell.getColSpan(),
1735
- tabIndex: cell.getCanSelect() ? cell.id === entryCellId ? 0 : cell.getTabIndex() : void 0,
1736
- onFocus: (event) => {
1737
- if (event.target === event.currentTarget && !table.getFocusedCell()) table.setFocusedCell(cell.row.id, cell.column.id);
1738
- },
1739
- onMouseDown: cell.getSelectionStartHandler(),
1740
- onMouseEnter: cell.getSelectionExtendHandler(),
1741
- onMouseOver: titleIfTruncated,
1742
- sx: {
1743
- overflow: "hidden",
1744
- textOverflow: "ellipsis",
1745
- whiteSpace: "nowrap",
1746
- userSelect: cell.getCanSelect() ? "none" : void 0,
1747
- ...hasColumnLabel(cell.column) ? CELL_SX : UTILITY_SX,
1748
- ...pinnedSx(cell.column),
1749
- ...cellSelectionSx(cell)
1750
- },
1751
- children: cell.getIsGrouped() ? /* @__PURE__ */ jsx(cell.GroupCell, {}) : cell.row.getIsGrouped() && !cell.getIsAggregated() ? null : /* @__PURE__ */ jsx(cell.FlexRender, {})
1752
- })
1616
+ children: (cell) => {
1617
+ if (cell.getIsCovered()) return null;
1618
+ const edit = cellEditor(cell);
1619
+ const isEditing = editing?.rowId === cell.row.id && editing.columnId === cell.column.id;
1620
+ const canStartEditing = edit && !isEditing;
1621
+ return /* @__PURE__ */ jsxs(TableCell, {
1622
+ className: cellClassName(cell),
1623
+ align: columnAlign(cell.column),
1624
+ rowSpan: cell.getRowSpan(),
1625
+ colSpan: cell.getColSpan(),
1626
+ tabIndex: cell.getCanSelect() ? cell.id === entryCellId ? 0 : cell.getTabIndex() : void 0,
1627
+ onFocus: (event) => {
1628
+ if (event.target === event.currentTarget && !table.getFocusedCell()) table.setFocusedCell(cell.row.id, cell.column.id);
1629
+ },
1630
+ onDoubleClick: canStartEditing ? (event) => {
1631
+ event.stopPropagation();
1632
+ startEditing(cell);
1633
+ } : void 0,
1634
+ onKeyDown: canStartEditing ? (event) => {
1635
+ if (event.target !== event.currentTarget) return;
1636
+ if (event.key !== "Enter" && event.key !== "F2") return;
1637
+ event.stopPropagation();
1638
+ startEditing(cell);
1639
+ } : void 0,
1640
+ onMouseDown: cell.getSelectionStartHandler(),
1641
+ onMouseEnter: cell.getSelectionExtendHandler(),
1642
+ onMouseOver: titleIfTruncated,
1643
+ sx: {
1644
+ overflow: "hidden",
1645
+ textOverflow: "ellipsis",
1646
+ whiteSpace: "nowrap",
1647
+ userSelect: cell.getCanSelect() ? "none" : void 0,
1648
+ ...hasColumnLabel(cell.column) ? CELL_SX : UTILITY_SX,
1649
+ ...edit && { position: "relative" },
1650
+ ...pinnedSx(cell.column),
1651
+ ...cellSelectionSx(cell),
1652
+ ...canStartEditing && !cell.getIsSelected() && EDITABLE_SX
1653
+ },
1654
+ children: [isEditing && edit ? /* @__PURE__ */ jsx(form.AppField, {
1655
+ name: cell.column.id,
1656
+ children: (field) => {
1657
+ const { error, helperText } = getFieldStatus(field);
1658
+ return /* @__PURE__ */ jsx(ClickAwayListener, {
1659
+ onClickAway: () => void commitEdit(),
1660
+ children: /* @__PURE__ */ jsx(Tooltip, {
1661
+ open: error,
1662
+ title: helperText ?? "",
1663
+ placement: "bottom-start",
1664
+ slotProps: EDITOR_ERROR_SLOT_PROPS,
1665
+ children: /* @__PURE__ */ jsx(Box, {
1666
+ ref: focusEditor,
1667
+ className: layoutTableClasses.cellEditor,
1668
+ sx: [EDITOR_SX, {
1669
+ justifyContent: JUSTIFY[columnAlign(cell.column)],
1670
+ boxShadow: editorRing(error ? "error" : "primary")
1671
+ }],
1672
+ onMouseDown: (event) => {
1673
+ if (event.target === event.currentTarget) event.preventDefault();
1674
+ },
1675
+ onDoubleClick: (event) => event.stopPropagation(),
1676
+ onKeyDown: async (event) => {
1677
+ if (event.defaultPrevented || event.nativeEvent.isComposing) return;
1678
+ if (event.key !== "Enter" && event.key !== "Escape") return;
1679
+ event.preventDefault();
1680
+ event.stopPropagation();
1681
+ const cellElement = event.currentTarget.closest("td");
1682
+ if (event.key === "Escape") setEditing(void 0);
1683
+ else if (!await commitEdit()) return;
1684
+ cellElement?.focus();
1685
+ },
1686
+ children: edit(field)
1687
+ })
1688
+ })
1689
+ });
1690
+ }
1691
+ }) : cell.getIsGrouped() ? /* @__PURE__ */ jsx(cell.GroupCell, {}) : cell.row.getIsGrouped() && !cell.getIsAggregated() ? null : /* @__PURE__ */ jsx(cell.FlexRender, {}), canStartEditing && /* @__PURE__ */ jsx(IconButton, {
1692
+ className: layoutTableClasses.editButton,
1693
+ size: "small",
1694
+ tabIndex: -1,
1695
+ "aria-label": t("Layout.Table.EditCell"),
1696
+ onClick: (event) => {
1697
+ event.stopPropagation();
1698
+ startEditing(cell);
1699
+ },
1700
+ sx: [EDIT_BUTTON_SX, columnAlign(cell.column) === "right" ? { left: 4 } : { right: 4 }],
1701
+ children: /* @__PURE__ */ jsx(EditOutlined, { sx: { fontSize: 16 } })
1702
+ })]
1703
+ });
1704
+ }
1753
1705
  }, c.id);
1754
1706
  const renderFooter = (f) => /* @__PURE__ */ jsx(table.AppFooter, {
1755
1707
  header: f,
@@ -1776,7 +1728,9 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1776
1728
  hover: true,
1777
1729
  selected: row.getIsSelected(),
1778
1730
  tabIndex: rowAction && !focusableCells ? 0 : void 0,
1779
- onClick: onRowClick && (() => onRowClick(row)),
1731
+ onClick: onRowClick && (() => {
1732
+ if (editing?.rowId !== row.id) onRowClick(row);
1733
+ }),
1780
1734
  onDoubleClick: onRowDoubleClick && (() => onRowDoubleClick(row)),
1781
1735
  onKeyDown: rowAction && ((event) => {
1782
1736
  const target = event.target;
@@ -1805,7 +1759,8 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1805
1759
  firstColumn?.index,
1806
1760
  lastColumn?.index,
1807
1761
  paddingStart,
1808
- paddingEnd
1762
+ paddingEnd,
1763
+ editing
1809
1764
  ]);
1810
1765
  const cacheKey = (index) => `${index}:${rows[index].id}`;
1811
1766
  const bodyRows = virtualRows.map(({ index }) => rowCache.current.get(cacheKey(index)) ?? renderRow(rows[index], index));
@@ -1836,7 +1791,7 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1836
1791
  children: [
1837
1792
  showToolbar && /* @__PURE__ */ jsx(table.Toolbar, { ...toolbar }),
1838
1793
  /* @__PURE__ */ jsx(TableContainer, {
1839
- ref: containerRef,
1794
+ ref: observeContainer,
1840
1795
  className: layoutTableClasses.main,
1841
1796
  sx: {
1842
1797
  flex: 1,
@@ -1985,13 +1940,10 @@ function LayoutTable({ table, loading = false, pagination = false, pageSizeOptio
1985
1940
  ]
1986
1941
  })
1987
1942
  }),
1988
- pagination && pageSizeOffered && /* @__PURE__ */ jsx(table.Pagination, {
1989
- className: layoutTableClasses.pagination,
1990
- pageSizeOptions
1991
- })
1943
+ pagination && pageSize === PAGE_SIZE && /* @__PURE__ */ jsx(table.Pagination, { className: layoutTableClasses.pagination })
1992
1944
  ]
1993
1945
  }) });
1994
1946
  }
1995
- export { AggregatedCell, ChatLayout, Dropzone, FileViewer, Fullscreen, LayoutTable, LoginForm, RouterButton, RouterError, RouterFab, RouterIconButton, RouterLink, RouterListItemButton, RouterNotFound, RouterTab, layoutTableClasses };
1947
+ export { AggregatedCell, ChatLayout, Dropzone, FileViewer, Fullscreen, LayoutTable, RouterButton, RouterError, RouterFab, RouterIconButton, RouterLink, RouterListItemButton, RouterNotFound, RouterTab, layoutTableClasses };
1996
1948
 
1997
1949
  //# sourceMappingURL=components.mjs.map