wcz-test 3.4.2 → 3.4.4

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
@@ -1,977 +1,3 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- // If the importer is in node compatibility mode or this is not an ESM
20
- // file that has been converted to a CommonJS file using a Babel-
21
- // compatible transform (i.e. "__esModule" has not been set), then set
22
- // "default" to the CommonJS "module.exports" for node compatibility.
23
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
- mod
25
- ));
26
-
27
- // node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
28
- var require_react_is_production_min = __commonJS({
29
- "node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
30
- "use strict";
31
- var b = "function" === typeof Symbol && Symbol.for;
32
- var c = b ? Symbol.for("react.element") : 60103;
33
- var d = b ? Symbol.for("react.portal") : 60106;
34
- var e = b ? Symbol.for("react.fragment") : 60107;
35
- var f = b ? Symbol.for("react.strict_mode") : 60108;
36
- var g = b ? Symbol.for("react.profiler") : 60114;
37
- var h = b ? Symbol.for("react.provider") : 60109;
38
- var k = b ? Symbol.for("react.context") : 60110;
39
- var l = b ? Symbol.for("react.async_mode") : 60111;
40
- var m = b ? Symbol.for("react.concurrent_mode") : 60111;
41
- var n = b ? Symbol.for("react.forward_ref") : 60112;
42
- var p = b ? Symbol.for("react.suspense") : 60113;
43
- var q = b ? Symbol.for("react.suspense_list") : 60120;
44
- var r = b ? Symbol.for("react.memo") : 60115;
45
- var t2 = b ? Symbol.for("react.lazy") : 60116;
46
- var v = b ? Symbol.for("react.block") : 60121;
47
- var w = b ? Symbol.for("react.fundamental") : 60117;
48
- var x = b ? Symbol.for("react.responder") : 60118;
49
- var y = b ? Symbol.for("react.scope") : 60119;
50
- function z2(a) {
51
- if ("object" === typeof a && null !== a) {
52
- var u = a.$$typeof;
53
- switch (u) {
54
- case c:
55
- switch (a = a.type, a) {
56
- case l:
57
- case m:
58
- case e:
59
- case g:
60
- case f:
61
- case p:
62
- return a;
63
- default:
64
- switch (a = a && a.$$typeof, a) {
65
- case k:
66
- case n:
67
- case t2:
68
- case r:
69
- case h:
70
- return a;
71
- default:
72
- return u;
73
- }
74
- }
75
- case d:
76
- return u;
77
- }
78
- }
79
- }
80
- function A(a) {
81
- return z2(a) === m;
82
- }
83
- exports.AsyncMode = l;
84
- exports.ConcurrentMode = m;
85
- exports.ContextConsumer = k;
86
- exports.ContextProvider = h;
87
- exports.Element = c;
88
- exports.ForwardRef = n;
89
- exports.Fragment = e;
90
- exports.Lazy = t2;
91
- exports.Memo = r;
92
- exports.Portal = d;
93
- exports.Profiler = g;
94
- exports.StrictMode = f;
95
- exports.Suspense = p;
96
- exports.isAsyncMode = function(a) {
97
- return A(a) || z2(a) === l;
98
- };
99
- exports.isConcurrentMode = A;
100
- exports.isContextConsumer = function(a) {
101
- return z2(a) === k;
102
- };
103
- exports.isContextProvider = function(a) {
104
- return z2(a) === h;
105
- };
106
- exports.isElement = function(a) {
107
- return "object" === typeof a && null !== a && a.$$typeof === c;
108
- };
109
- exports.isForwardRef = function(a) {
110
- return z2(a) === n;
111
- };
112
- exports.isFragment = function(a) {
113
- return z2(a) === e;
114
- };
115
- exports.isLazy = function(a) {
116
- return z2(a) === t2;
117
- };
118
- exports.isMemo = function(a) {
119
- return z2(a) === r;
120
- };
121
- exports.isPortal = function(a) {
122
- return z2(a) === d;
123
- };
124
- exports.isProfiler = function(a) {
125
- return z2(a) === g;
126
- };
127
- exports.isStrictMode = function(a) {
128
- return z2(a) === f;
129
- };
130
- exports.isSuspense = function(a) {
131
- return z2(a) === p;
132
- };
133
- exports.isValidElementType = function(a) {
134
- return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t2 || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
135
- };
136
- exports.typeOf = z2;
137
- }
138
- });
139
-
140
- // node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
141
- var require_react_is_development = __commonJS({
142
- "node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js"(exports) {
143
- "use strict";
144
- if (process.env.NODE_ENV !== "production") {
145
- (function() {
146
- "use strict";
147
- var hasSymbol = typeof Symbol === "function" && Symbol.for;
148
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
149
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
150
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
151
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
152
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
153
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
154
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
155
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
156
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
157
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
158
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
159
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
160
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
161
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
162
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
163
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
164
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
165
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
166
- function isValidElementType(type) {
167
- return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
168
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
169
- }
170
- function typeOf(object) {
171
- if (typeof object === "object" && object !== null) {
172
- var $$typeof = object.$$typeof;
173
- switch ($$typeof) {
174
- case REACT_ELEMENT_TYPE:
175
- var type = object.type;
176
- switch (type) {
177
- case REACT_ASYNC_MODE_TYPE:
178
- case REACT_CONCURRENT_MODE_TYPE:
179
- case REACT_FRAGMENT_TYPE:
180
- case REACT_PROFILER_TYPE:
181
- case REACT_STRICT_MODE_TYPE:
182
- case REACT_SUSPENSE_TYPE:
183
- return type;
184
- default:
185
- var $$typeofType = type && type.$$typeof;
186
- switch ($$typeofType) {
187
- case REACT_CONTEXT_TYPE:
188
- case REACT_FORWARD_REF_TYPE:
189
- case REACT_LAZY_TYPE:
190
- case REACT_MEMO_TYPE:
191
- case REACT_PROVIDER_TYPE:
192
- return $$typeofType;
193
- default:
194
- return $$typeof;
195
- }
196
- }
197
- case REACT_PORTAL_TYPE:
198
- return $$typeof;
199
- }
200
- }
201
- return void 0;
202
- }
203
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
204
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
205
- var ContextConsumer = REACT_CONTEXT_TYPE;
206
- var ContextProvider = REACT_PROVIDER_TYPE;
207
- var Element = REACT_ELEMENT_TYPE;
208
- var ForwardRef = REACT_FORWARD_REF_TYPE;
209
- var Fragment7 = REACT_FRAGMENT_TYPE;
210
- var Lazy = REACT_LAZY_TYPE;
211
- var Memo = REACT_MEMO_TYPE;
212
- var Portal = REACT_PORTAL_TYPE;
213
- var Profiler = REACT_PROFILER_TYPE;
214
- var StrictMode = REACT_STRICT_MODE_TYPE;
215
- var Suspense = REACT_SUSPENSE_TYPE;
216
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
217
- function isAsyncMode(object) {
218
- {
219
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
220
- hasWarnedAboutDeprecatedIsAsyncMode = true;
221
- console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
222
- }
223
- }
224
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
225
- }
226
- function isConcurrentMode(object) {
227
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
228
- }
229
- function isContextConsumer(object) {
230
- return typeOf(object) === REACT_CONTEXT_TYPE;
231
- }
232
- function isContextProvider(object) {
233
- return typeOf(object) === REACT_PROVIDER_TYPE;
234
- }
235
- function isElement(object) {
236
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
237
- }
238
- function isForwardRef(object) {
239
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
240
- }
241
- function isFragment(object) {
242
- return typeOf(object) === REACT_FRAGMENT_TYPE;
243
- }
244
- function isLazy(object) {
245
- return typeOf(object) === REACT_LAZY_TYPE;
246
- }
247
- function isMemo(object) {
248
- return typeOf(object) === REACT_MEMO_TYPE;
249
- }
250
- function isPortal(object) {
251
- return typeOf(object) === REACT_PORTAL_TYPE;
252
- }
253
- function isProfiler(object) {
254
- return typeOf(object) === REACT_PROFILER_TYPE;
255
- }
256
- function isStrictMode(object) {
257
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
258
- }
259
- function isSuspense(object) {
260
- return typeOf(object) === REACT_SUSPENSE_TYPE;
261
- }
262
- exports.AsyncMode = AsyncMode;
263
- exports.ConcurrentMode = ConcurrentMode;
264
- exports.ContextConsumer = ContextConsumer;
265
- exports.ContextProvider = ContextProvider;
266
- exports.Element = Element;
267
- exports.ForwardRef = ForwardRef;
268
- exports.Fragment = Fragment7;
269
- exports.Lazy = Lazy;
270
- exports.Memo = Memo;
271
- exports.Portal = Portal;
272
- exports.Profiler = Profiler;
273
- exports.StrictMode = StrictMode;
274
- exports.Suspense = Suspense;
275
- exports.isAsyncMode = isAsyncMode;
276
- exports.isConcurrentMode = isConcurrentMode;
277
- exports.isContextConsumer = isContextConsumer;
278
- exports.isContextProvider = isContextProvider;
279
- exports.isElement = isElement;
280
- exports.isForwardRef = isForwardRef;
281
- exports.isFragment = isFragment;
282
- exports.isLazy = isLazy;
283
- exports.isMemo = isMemo;
284
- exports.isPortal = isPortal;
285
- exports.isProfiler = isProfiler;
286
- exports.isStrictMode = isStrictMode;
287
- exports.isSuspense = isSuspense;
288
- exports.isValidElementType = isValidElementType;
289
- exports.typeOf = typeOf;
290
- })();
291
- }
292
- }
293
- });
294
-
295
- // node_modules/prop-types/node_modules/react-is/index.js
296
- var require_react_is = __commonJS({
297
- "node_modules/prop-types/node_modules/react-is/index.js"(exports, module) {
298
- "use strict";
299
- if (process.env.NODE_ENV === "production") {
300
- module.exports = require_react_is_production_min();
301
- } else {
302
- module.exports = require_react_is_development();
303
- }
304
- }
305
- });
306
-
307
- // node_modules/object-assign/index.js
308
- var require_object_assign = __commonJS({
309
- "node_modules/object-assign/index.js"(exports, module) {
310
- "use strict";
311
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
312
- var hasOwnProperty = Object.prototype.hasOwnProperty;
313
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
314
- function toObject(val) {
315
- if (val === null || val === void 0) {
316
- throw new TypeError("Object.assign cannot be called with null or undefined");
317
- }
318
- return Object(val);
319
- }
320
- function shouldUseNative() {
321
- try {
322
- if (!Object.assign) {
323
- return false;
324
- }
325
- var test1 = new String("abc");
326
- test1[5] = "de";
327
- if (Object.getOwnPropertyNames(test1)[0] === "5") {
328
- return false;
329
- }
330
- var test2 = {};
331
- for (var i = 0; i < 10; i++) {
332
- test2["_" + String.fromCharCode(i)] = i;
333
- }
334
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
335
- return test2[n];
336
- });
337
- if (order2.join("") !== "0123456789") {
338
- return false;
339
- }
340
- var test3 = {};
341
- "abcdefghijklmnopqrst".split("").forEach(function(letter) {
342
- test3[letter] = letter;
343
- });
344
- if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
345
- return false;
346
- }
347
- return true;
348
- } catch (err) {
349
- return false;
350
- }
351
- }
352
- module.exports = shouldUseNative() ? Object.assign : function(target, source) {
353
- var from;
354
- var to = toObject(target);
355
- var symbols;
356
- for (var s = 1; s < arguments.length; s++) {
357
- from = Object(arguments[s]);
358
- for (var key in from) {
359
- if (hasOwnProperty.call(from, key)) {
360
- to[key] = from[key];
361
- }
362
- }
363
- if (getOwnPropertySymbols) {
364
- symbols = getOwnPropertySymbols(from);
365
- for (var i = 0; i < symbols.length; i++) {
366
- if (propIsEnumerable.call(from, symbols[i])) {
367
- to[symbols[i]] = from[symbols[i]];
368
- }
369
- }
370
- }
371
- }
372
- return to;
373
- };
374
- }
375
- });
376
-
377
- // node_modules/prop-types/lib/ReactPropTypesSecret.js
378
- var require_ReactPropTypesSecret = __commonJS({
379
- "node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
380
- "use strict";
381
- var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
382
- module.exports = ReactPropTypesSecret;
383
- }
384
- });
385
-
386
- // node_modules/prop-types/lib/has.js
387
- var require_has = __commonJS({
388
- "node_modules/prop-types/lib/has.js"(exports, module) {
389
- "use strict";
390
- module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
391
- }
392
- });
393
-
394
- // node_modules/prop-types/checkPropTypes.js
395
- var require_checkPropTypes = __commonJS({
396
- "node_modules/prop-types/checkPropTypes.js"(exports, module) {
397
- "use strict";
398
- var printWarning = function() {
399
- };
400
- if (process.env.NODE_ENV !== "production") {
401
- ReactPropTypesSecret = require_ReactPropTypesSecret();
402
- loggedTypeFailures = {};
403
- has = require_has();
404
- printWarning = function(text) {
405
- var message = "Warning: " + text;
406
- if (typeof console !== "undefined") {
407
- console.error(message);
408
- }
409
- try {
410
- throw new Error(message);
411
- } catch (x) {
412
- }
413
- };
414
- }
415
- var ReactPropTypesSecret;
416
- var loggedTypeFailures;
417
- var has;
418
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
419
- if (process.env.NODE_ENV !== "production") {
420
- for (var typeSpecName in typeSpecs) {
421
- if (has(typeSpecs, typeSpecName)) {
422
- var error;
423
- try {
424
- if (typeof typeSpecs[typeSpecName] !== "function") {
425
- var err = Error(
426
- (componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
427
- );
428
- err.name = "Invariant Violation";
429
- throw err;
430
- }
431
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
432
- } catch (ex) {
433
- error = ex;
434
- }
435
- if (error && !(error instanceof Error)) {
436
- printWarning(
437
- (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
438
- );
439
- }
440
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
441
- loggedTypeFailures[error.message] = true;
442
- var stack = getStack ? getStack() : "";
443
- printWarning(
444
- "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
445
- );
446
- }
447
- }
448
- }
449
- }
450
- }
451
- checkPropTypes.resetWarningCache = function() {
452
- if (process.env.NODE_ENV !== "production") {
453
- loggedTypeFailures = {};
454
- }
455
- };
456
- module.exports = checkPropTypes;
457
- }
458
- });
459
-
460
- // node_modules/prop-types/factoryWithTypeCheckers.js
461
- var require_factoryWithTypeCheckers = __commonJS({
462
- "node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
463
- "use strict";
464
- var ReactIs = require_react_is();
465
- var assign = require_object_assign();
466
- var ReactPropTypesSecret = require_ReactPropTypesSecret();
467
- var has = require_has();
468
- var checkPropTypes = require_checkPropTypes();
469
- var printWarning = function() {
470
- };
471
- if (process.env.NODE_ENV !== "production") {
472
- printWarning = function(text) {
473
- var message = "Warning: " + text;
474
- if (typeof console !== "undefined") {
475
- console.error(message);
476
- }
477
- try {
478
- throw new Error(message);
479
- } catch (x) {
480
- }
481
- };
482
- }
483
- function emptyFunctionThatReturnsNull() {
484
- return null;
485
- }
486
- module.exports = function(isValidElement, throwOnDirectAccess) {
487
- var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
488
- var FAUX_ITERATOR_SYMBOL = "@@iterator";
489
- function getIteratorFn(maybeIterable) {
490
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
491
- if (typeof iteratorFn === "function") {
492
- return iteratorFn;
493
- }
494
- }
495
- var ANONYMOUS = "<<anonymous>>";
496
- var ReactPropTypes = {
497
- array: createPrimitiveTypeChecker("array"),
498
- bigint: createPrimitiveTypeChecker("bigint"),
499
- bool: createPrimitiveTypeChecker("boolean"),
500
- func: createPrimitiveTypeChecker("function"),
501
- number: createPrimitiveTypeChecker("number"),
502
- object: createPrimitiveTypeChecker("object"),
503
- string: createPrimitiveTypeChecker("string"),
504
- symbol: createPrimitiveTypeChecker("symbol"),
505
- any: createAnyTypeChecker(),
506
- arrayOf: createArrayOfTypeChecker,
507
- element: createElementTypeChecker(),
508
- elementType: createElementTypeTypeChecker(),
509
- instanceOf: createInstanceTypeChecker,
510
- node: createNodeChecker(),
511
- objectOf: createObjectOfTypeChecker,
512
- oneOf: createEnumTypeChecker,
513
- oneOfType: createUnionTypeChecker,
514
- shape: createShapeTypeChecker,
515
- exact: createStrictShapeTypeChecker
516
- };
517
- function is(x, y) {
518
- if (x === y) {
519
- return x !== 0 || 1 / x === 1 / y;
520
- } else {
521
- return x !== x && y !== y;
522
- }
523
- }
524
- function PropTypeError(message, data) {
525
- this.message = message;
526
- this.data = data && typeof data === "object" ? data : {};
527
- this.stack = "";
528
- }
529
- PropTypeError.prototype = Error.prototype;
530
- function createChainableTypeChecker(validate) {
531
- if (process.env.NODE_ENV !== "production") {
532
- var manualPropTypeCallCache = {};
533
- var manualPropTypeWarningCount = 0;
534
- }
535
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
536
- componentName = componentName || ANONYMOUS;
537
- propFullName = propFullName || propName;
538
- if (secret !== ReactPropTypesSecret) {
539
- if (throwOnDirectAccess) {
540
- var err = new Error(
541
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
542
- );
543
- err.name = "Invariant Violation";
544
- throw err;
545
- } else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
546
- var cacheKey = componentName + ":" + propName;
547
- if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
548
- manualPropTypeWarningCount < 3) {
549
- printWarning(
550
- "You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
551
- );
552
- manualPropTypeCallCache[cacheKey] = true;
553
- manualPropTypeWarningCount++;
554
- }
555
- }
556
- }
557
- if (props[propName] == null) {
558
- if (isRequired) {
559
- if (props[propName] === null) {
560
- return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
561
- }
562
- return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
563
- }
564
- return null;
565
- } else {
566
- return validate(props, propName, componentName, location, propFullName);
567
- }
568
- }
569
- var chainedCheckType = checkType.bind(null, false);
570
- chainedCheckType.isRequired = checkType.bind(null, true);
571
- return chainedCheckType;
572
- }
573
- function createPrimitiveTypeChecker(expectedType) {
574
- function validate(props, propName, componentName, location, propFullName, secret) {
575
- var propValue = props[propName];
576
- var propType = getPropType(propValue);
577
- if (propType !== expectedType) {
578
- var preciseType = getPreciseType(propValue);
579
- return new PropTypeError(
580
- "Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
581
- { expectedType }
582
- );
583
- }
584
- return null;
585
- }
586
- return createChainableTypeChecker(validate);
587
- }
588
- function createAnyTypeChecker() {
589
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
590
- }
591
- function createArrayOfTypeChecker(typeChecker) {
592
- function validate(props, propName, componentName, location, propFullName) {
593
- if (typeof typeChecker !== "function") {
594
- return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
595
- }
596
- var propValue = props[propName];
597
- if (!Array.isArray(propValue)) {
598
- var propType = getPropType(propValue);
599
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
600
- }
601
- for (var i = 0; i < propValue.length; i++) {
602
- var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
603
- if (error instanceof Error) {
604
- return error;
605
- }
606
- }
607
- return null;
608
- }
609
- return createChainableTypeChecker(validate);
610
- }
611
- function createElementTypeChecker() {
612
- function validate(props, propName, componentName, location, propFullName) {
613
- var propValue = props[propName];
614
- if (!isValidElement(propValue)) {
615
- var propType = getPropType(propValue);
616
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
617
- }
618
- return null;
619
- }
620
- return createChainableTypeChecker(validate);
621
- }
622
- function createElementTypeTypeChecker() {
623
- function validate(props, propName, componentName, location, propFullName) {
624
- var propValue = props[propName];
625
- if (!ReactIs.isValidElementType(propValue)) {
626
- var propType = getPropType(propValue);
627
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
628
- }
629
- return null;
630
- }
631
- return createChainableTypeChecker(validate);
632
- }
633
- function createInstanceTypeChecker(expectedClass) {
634
- function validate(props, propName, componentName, location, propFullName) {
635
- if (!(props[propName] instanceof expectedClass)) {
636
- var expectedClassName = expectedClass.name || ANONYMOUS;
637
- var actualClassName = getClassName(props[propName]);
638
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
639
- }
640
- return null;
641
- }
642
- return createChainableTypeChecker(validate);
643
- }
644
- function createEnumTypeChecker(expectedValues) {
645
- if (!Array.isArray(expectedValues)) {
646
- if (process.env.NODE_ENV !== "production") {
647
- if (arguments.length > 1) {
648
- printWarning(
649
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
650
- );
651
- } else {
652
- printWarning("Invalid argument supplied to oneOf, expected an array.");
653
- }
654
- }
655
- return emptyFunctionThatReturnsNull;
656
- }
657
- function validate(props, propName, componentName, location, propFullName) {
658
- var propValue = props[propName];
659
- for (var i = 0; i < expectedValues.length; i++) {
660
- if (is(propValue, expectedValues[i])) {
661
- return null;
662
- }
663
- }
664
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
665
- var type = getPreciseType(value);
666
- if (type === "symbol") {
667
- return String(value);
668
- }
669
- return value;
670
- });
671
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
672
- }
673
- return createChainableTypeChecker(validate);
674
- }
675
- function createObjectOfTypeChecker(typeChecker) {
676
- function validate(props, propName, componentName, location, propFullName) {
677
- if (typeof typeChecker !== "function") {
678
- return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
679
- }
680
- var propValue = props[propName];
681
- var propType = getPropType(propValue);
682
- if (propType !== "object") {
683
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
684
- }
685
- for (var key in propValue) {
686
- if (has(propValue, key)) {
687
- var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
688
- if (error instanceof Error) {
689
- return error;
690
- }
691
- }
692
- }
693
- return null;
694
- }
695
- return createChainableTypeChecker(validate);
696
- }
697
- function createUnionTypeChecker(arrayOfTypeCheckers) {
698
- if (!Array.isArray(arrayOfTypeCheckers)) {
699
- process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
700
- return emptyFunctionThatReturnsNull;
701
- }
702
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
703
- var checker = arrayOfTypeCheckers[i];
704
- if (typeof checker !== "function") {
705
- printWarning(
706
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
707
- );
708
- return emptyFunctionThatReturnsNull;
709
- }
710
- }
711
- function validate(props, propName, componentName, location, propFullName) {
712
- var expectedTypes = [];
713
- for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
714
- var checker2 = arrayOfTypeCheckers[i2];
715
- var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
716
- if (checkerResult == null) {
717
- return null;
718
- }
719
- if (checkerResult.data && has(checkerResult.data, "expectedType")) {
720
- expectedTypes.push(checkerResult.data.expectedType);
721
- }
722
- }
723
- var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
724
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
725
- }
726
- return createChainableTypeChecker(validate);
727
- }
728
- function createNodeChecker() {
729
- function validate(props, propName, componentName, location, propFullName) {
730
- if (!isNode(props[propName])) {
731
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
732
- }
733
- return null;
734
- }
735
- return createChainableTypeChecker(validate);
736
- }
737
- function invalidValidatorError(componentName, location, propFullName, key, type) {
738
- return new PropTypeError(
739
- (componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
740
- );
741
- }
742
- function createShapeTypeChecker(shapeTypes) {
743
- function validate(props, propName, componentName, location, propFullName) {
744
- var propValue = props[propName];
745
- var propType = getPropType(propValue);
746
- if (propType !== "object") {
747
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
748
- }
749
- for (var key in shapeTypes) {
750
- var checker = shapeTypes[key];
751
- if (typeof checker !== "function") {
752
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
753
- }
754
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
755
- if (error) {
756
- return error;
757
- }
758
- }
759
- return null;
760
- }
761
- return createChainableTypeChecker(validate);
762
- }
763
- function createStrictShapeTypeChecker(shapeTypes) {
764
- function validate(props, propName, componentName, location, propFullName) {
765
- var propValue = props[propName];
766
- var propType = getPropType(propValue);
767
- if (propType !== "object") {
768
- return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
769
- }
770
- var allKeys = assign({}, props[propName], shapeTypes);
771
- for (var key in allKeys) {
772
- var checker = shapeTypes[key];
773
- if (has(shapeTypes, key) && typeof checker !== "function") {
774
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
775
- }
776
- if (!checker) {
777
- return new PropTypeError(
778
- "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
779
- );
780
- }
781
- var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
782
- if (error) {
783
- return error;
784
- }
785
- }
786
- return null;
787
- }
788
- return createChainableTypeChecker(validate);
789
- }
790
- function isNode(propValue) {
791
- switch (typeof propValue) {
792
- case "number":
793
- case "string":
794
- case "undefined":
795
- return true;
796
- case "boolean":
797
- return !propValue;
798
- case "object":
799
- if (Array.isArray(propValue)) {
800
- return propValue.every(isNode);
801
- }
802
- if (propValue === null || isValidElement(propValue)) {
803
- return true;
804
- }
805
- var iteratorFn = getIteratorFn(propValue);
806
- if (iteratorFn) {
807
- var iterator = iteratorFn.call(propValue);
808
- var step;
809
- if (iteratorFn !== propValue.entries) {
810
- while (!(step = iterator.next()).done) {
811
- if (!isNode(step.value)) {
812
- return false;
813
- }
814
- }
815
- } else {
816
- while (!(step = iterator.next()).done) {
817
- var entry = step.value;
818
- if (entry) {
819
- if (!isNode(entry[1])) {
820
- return false;
821
- }
822
- }
823
- }
824
- }
825
- } else {
826
- return false;
827
- }
828
- return true;
829
- default:
830
- return false;
831
- }
832
- }
833
- function isSymbol(propType, propValue) {
834
- if (propType === "symbol") {
835
- return true;
836
- }
837
- if (!propValue) {
838
- return false;
839
- }
840
- if (propValue["@@toStringTag"] === "Symbol") {
841
- return true;
842
- }
843
- if (typeof Symbol === "function" && propValue instanceof Symbol) {
844
- return true;
845
- }
846
- return false;
847
- }
848
- function getPropType(propValue) {
849
- var propType = typeof propValue;
850
- if (Array.isArray(propValue)) {
851
- return "array";
852
- }
853
- if (propValue instanceof RegExp) {
854
- return "object";
855
- }
856
- if (isSymbol(propType, propValue)) {
857
- return "symbol";
858
- }
859
- return propType;
860
- }
861
- function getPreciseType(propValue) {
862
- if (typeof propValue === "undefined" || propValue === null) {
863
- return "" + propValue;
864
- }
865
- var propType = getPropType(propValue);
866
- if (propType === "object") {
867
- if (propValue instanceof Date) {
868
- return "date";
869
- } else if (propValue instanceof RegExp) {
870
- return "regexp";
871
- }
872
- }
873
- return propType;
874
- }
875
- function getPostfixForTypeWarning(value) {
876
- var type = getPreciseType(value);
877
- switch (type) {
878
- case "array":
879
- case "object":
880
- return "an " + type;
881
- case "boolean":
882
- case "date":
883
- case "regexp":
884
- return "a " + type;
885
- default:
886
- return type;
887
- }
888
- }
889
- function getClassName(propValue) {
890
- if (!propValue.constructor || !propValue.constructor.name) {
891
- return ANONYMOUS;
892
- }
893
- return propValue.constructor.name;
894
- }
895
- ReactPropTypes.checkPropTypes = checkPropTypes;
896
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
897
- ReactPropTypes.PropTypes = ReactPropTypes;
898
- return ReactPropTypes;
899
- };
900
- }
901
- });
902
-
903
- // node_modules/prop-types/factoryWithThrowingShims.js
904
- var require_factoryWithThrowingShims = __commonJS({
905
- "node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
906
- "use strict";
907
- var ReactPropTypesSecret = require_ReactPropTypesSecret();
908
- function emptyFunction() {
909
- }
910
- function emptyFunctionWithReset() {
911
- }
912
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
913
- module.exports = function() {
914
- function shim(props, propName, componentName, location, propFullName, secret) {
915
- if (secret === ReactPropTypesSecret) {
916
- return;
917
- }
918
- var err = new Error(
919
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
920
- );
921
- err.name = "Invariant Violation";
922
- throw err;
923
- }
924
- ;
925
- shim.isRequired = shim;
926
- function getShim() {
927
- return shim;
928
- }
929
- ;
930
- var ReactPropTypes = {
931
- array: shim,
932
- bigint: shim,
933
- bool: shim,
934
- func: shim,
935
- number: shim,
936
- object: shim,
937
- string: shim,
938
- symbol: shim,
939
- any: shim,
940
- arrayOf: getShim,
941
- element: shim,
942
- elementType: shim,
943
- instanceOf: getShim,
944
- node: shim,
945
- objectOf: getShim,
946
- oneOf: getShim,
947
- oneOfType: getShim,
948
- shape: getShim,
949
- exact: getShim,
950
- checkPropTypes: emptyFunctionWithReset,
951
- resetWarningCache: emptyFunction
952
- };
953
- ReactPropTypes.PropTypes = ReactPropTypes;
954
- return ReactPropTypes;
955
- };
956
- }
957
- });
958
-
959
- // node_modules/prop-types/index.js
960
- var require_prop_types = __commonJS({
961
- "node_modules/prop-types/index.js"(exports, module) {
962
- "use strict";
963
- if (process.env.NODE_ENV !== "production") {
964
- ReactIs = require_react_is();
965
- throwOnDirectAccess = true;
966
- module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
967
- } else {
968
- module.exports = require_factoryWithThrowingShims()();
969
- }
970
- var ReactIs;
971
- var throwOnDirectAccess;
972
- }
973
- });
974
-
975
1
  // src/components/core/TypographyWithIcon.tsx
976
2
  import { Stack, Typography } from "@mui/material";
977
3
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1151,379 +177,78 @@ var Dropzone = ({ sx, ...props }) => {
1151
177
  };
1152
178
 
1153
179
  // src/components/file/FileViewer.tsx
1154
- import { useState as useState5 } from "react";
1155
-
1156
- // src/contexts/FileContext.ts
1157
- import { createContext, useContext } from "react";
1158
- var FileContext = createContext(null);
1159
- var useFile = () => {
1160
- const context = useContext(FileContext);
1161
- if (!context) {
1162
- throw new Error("FileViewer components must be used within FileViewer");
1163
- }
1164
- return context;
1165
- };
180
+ import { useState as useState4 } from "react";
181
+ import { FileContext } from "~/contexts/FileContext";
182
+ import { useGetFileMetas } from "~/hooks/FileHooks";
1166
183
 
1167
- // src/hooks/FileHooks.ts
1168
- import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
1169
- import saveAs from "file-saver";
1170
- import { useState as useState2 } from "react";
1171
- import { Upload as TusUpload } from "tus-js-client";
1172
- import { uuidv7 } from "uuidv7";
184
+ // src/components/file/fileViewer/FileViewerGrid.tsx
185
+ import MoreVert from "@mui/icons-material/MoreVert";
186
+ import { Box as Box2, IconButton, ImageListItem, ImageListItemBar, Stack as Stack2, Tooltip } from "@mui/material";
187
+ import { grey } from "@mui/material/colors";
188
+ import { Fragment, useEffect as useEffect2, useState as useState2 } from "react";
189
+ import { useFile as useFile2 } from "~/contexts/FileContext";
190
+ import { useDownloadFile as useDownloadFile2, useGetFileThumbnail, useOpenFile } from "~/hooks/FileHooks";
1173
191
 
1174
- // src/components/core/AppTitle.tsx
1175
- import { Chip, Stack as Stack2, Typography as Typography4 } from "@mui/material";
1176
- import { useRouterState } from "@tanstack/react-router";
192
+ // src/components/file/fileViewer/common/ActionsMenu.tsx
193
+ import Delete from "@mui/icons-material/Delete";
194
+ import FileDownload from "@mui/icons-material/FileDownload";
195
+ import { List, ListItemButton, ListItemIcon, ListItemText, Menu } from "@mui/material";
196
+ import { useTranslation as useTranslation2 } from "react-i18next";
197
+ import { useFile } from "~/contexts/FileContext";
198
+ import { useDialogs } from "~/hooks/DialogsHooks";
199
+ import { useDeleteFile, useDownloadFile } from "~/hooks/FileHooks";
1177
200
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1178
- var AppTitle = () => {
1179
- const title = useAppTitle();
1180
- return /* @__PURE__ */ jsxs3(Stack2, { direction: "row", alignItems: "center", spacing: 2, flexGrow: 1, children: [
1181
- /* @__PURE__ */ jsx5("img", { src: "/favicon-32x32.png", alt: "app-logo", loading: "lazy" }),
1182
- /* @__PURE__ */ jsx5(Typography4, { variant: "h6", children: title }),
1183
- import.meta.env.DEV && /* @__PURE__ */ jsx5(Chip, { size: "small", label: "TEST", color: "info" })
1184
- ] });
1185
- };
1186
- var useAppTitle = () => {
1187
- const rootRouterState = useRouterState({ select: (s) => s.matches[0] });
1188
- return rootRouterState.meta?.find((meta) => meta?.title)?.title;
1189
- };
1190
-
1191
- // src/utils/ClientUtils.ts
1192
- import axios from "axios";
1193
- var Platform = class {
1194
- static get isAndroid() {
1195
- return /android/i.test(this.userAgent);
1196
- }
1197
- static get isIOS() {
1198
- return /iPad|iPhone|iPod/.test(this.userAgent);
1199
- }
1200
- static get isWindows() {
1201
- return /windows/i.test(this.userAgent);
1202
- }
1203
- static get isMacOS() {
1204
- return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);
1205
- }
1206
- static get userAgent() {
1207
- return typeof navigator === "undefined" ? "" : navigator.userAgent;
1208
- }
1209
- };
1210
- var rootRouteHead = ({ title }) => () => ({
1211
- meta: [
1212
- { charSet: "utf-8" },
1213
- { name: "viewport", content: "width=device-width, initial-scale=1" },
1214
- { title },
1215
- { name: "og:type", content: "website" },
1216
- { name: "og:title", content: title },
1217
- { name: "og:image", content: "/favicon-32x32.png" }
1218
- ],
1219
- links: [
1220
- { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
1221
- { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" },
1222
- { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" },
1223
- { rel: "manifest", href: "/site.webmanifest" },
1224
- { rel: "icon", href: "/favicon.ico" }
1225
- ]
1226
- });
1227
- var wczApiClient = axios.create();
1228
-
1229
- // src/hooks/FileHooks.ts
1230
- var BASE_URL = import.meta.env.VITE_FILE_API_BASE_URL;
1231
- var QUERY_KEY = "Files";
1232
- var HOUR = 1e3 * 60 * 60;
1233
- var useGetFileMetas = (subId, options) => {
1234
- const appTitle = useAppTitle();
1235
- return useQuery({
1236
- ...options,
1237
- queryKey: [QUERY_KEY, "meta", subId, appTitle],
1238
- queryFn: ({ signal }) => wczApiClient.request({
1239
- url: `${BASE_URL}/v1/meta?appName=${appTitle}&subId=${subId}`,
1240
- method: "GET",
1241
- signal
1242
- }),
1243
- staleTime: HOUR,
1244
- gcTime: HOUR,
1245
- refetchOnWindowFocus: false
1246
- });
1247
- };
1248
- var useGetFileThumbnail = (meta, options) => {
1249
- const appTitle = useAppTitle();
1250
- return useQuery({
1251
- ...options,
1252
- queryKey: [QUERY_KEY, "thumbnail", meta?.id, appTitle],
1253
- queryFn: ({ signal }) => wczApiClient.request({
1254
- url: `${BASE_URL}/v1/thumbnail?appName=${appTitle}&id=${meta?.id}`,
1255
- method: "GET",
1256
- signal,
1257
- responseType: "blob"
1258
- }),
1259
- select: (data) => URL.createObjectURL(data),
1260
- staleTime: HOUR,
1261
- gcTime: HOUR,
1262
- refetchOnWindowFocus: false,
1263
- enabled: !!meta?.id && options?.enabled
1264
- });
1265
- };
1266
- var useGetFile = (meta, options) => {
1267
- const appTitle = useAppTitle();
1268
- return useQuery({
1269
- ...options,
1270
- queryKey: [QUERY_KEY, meta?.id, appTitle],
1271
- queryFn: ({ signal }) => wczApiClient.request({
1272
- url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta?.id}`,
1273
- method: "GET",
1274
- signal,
1275
- responseType: "blob"
1276
- }),
1277
- select: (data) => URL.createObjectURL(data),
1278
- staleTime: HOUR,
1279
- gcTime: HOUR,
1280
- refetchOnWindowFocus: false,
1281
- enabled: !!meta?.id && options?.enabled
1282
- });
1283
- };
1284
- var useDownloadFile = (options) => {
1285
- const appTitle = useAppTitle();
1286
- return useMutation({
1287
- ...options,
1288
- mutationFn: (meta) => wczApiClient.request({
1289
- url: `${BASE_URL}/v1/download?appName=${appTitle}&id=${meta.id}`,
1290
- method: "GET",
1291
- responseType: "blob"
1292
- }),
1293
- onSuccess: (data, variables) => saveAs(data, `${variables.fileName}.${variables.fileExtension}`)
1294
- });
1295
- };
1296
- var useOpenFile = (options) => {
1297
- const appTitle = useAppTitle();
1298
- return useMutation({
1299
- ...options,
1300
- mutationFn: (meta) => wczApiClient.request({
1301
- url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta.id}`,
1302
- method: "GET",
1303
- responseType: "blob"
1304
- }),
1305
- onSuccess: (data) => {
1306
- window.open(URL.createObjectURL(data));
1307
- }
1308
- });
1309
- };
1310
- var useUpdateFileMeta = (options) => {
1311
- const appTitle = useAppTitle();
1312
- const queryClient = useQueryClient();
1313
- return useMutation({
1314
- ...options,
1315
- mutationFn: (meta) => wczApiClient.request({
1316
- url: `${BASE_URL}/v1/meta?appName=${appTitle}&id=${meta.id}`,
1317
- method: "PUT",
1318
- data: meta
1319
- }),
1320
- onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
1321
- });
1322
- };
1323
- var useDeleteFile = (options) => {
1324
- const appTitle = useAppTitle();
1325
- const queryClient = useQueryClient();
1326
- return useMutation({
1327
- ...options,
1328
- mutationFn: (meta) => wczApiClient.request({
1329
- url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta.id}`,
1330
- method: "DELETE"
1331
- }),
1332
- onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
1333
- });
1334
- };
1335
- var useDeleteFiles = (options) => {
1336
- const appTitle = useAppTitle();
1337
- const queryClient = useQueryClient();
1338
- return useMutation({
1339
- ...options,
1340
- mutationFn: (subId) => wczApiClient.request({
1341
- url: `${BASE_URL}/v1?appName=${appTitle}&subId=${subId}`,
1342
- method: "DELETE"
1343
- }),
1344
- onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
1345
- });
1346
- };
1347
- var useUploadFile = ({ subId, onSuccess, onError }) => {
1348
- const appTitle = useAppTitle();
1349
- const [progress, setProgress] = useState2(0);
1350
- const queryClient = useQueryClient();
1351
- const mutate = async (file) => {
1352
- if (!subId) throw new Error("subId is required for file upload");
1353
- if (!appTitle) throw new Error("appTitle is required for file upload");
1354
- const metadata = {
1355
- id: uuidv7(),
1356
- appName: appTitle,
1357
- subId,
1358
- fileName: file.name
1359
- };
1360
- const upload = new TusUpload(file, {
1361
- endpoint: `${BASE_URL}/v1/upload`,
1362
- chunkSize: 1048576,
1363
- // 1 MB
1364
- metadata: {
1365
- id: metadata.id,
1366
- appName: metadata.appName,
1367
- subId: metadata.subId,
1368
- fileName: metadata.fileName,
1369
- fileExtension: file.type
1370
- },
1371
- //headers: { "Authorization": `Bearer ${await getToken()}` }, //TODO: implement token retrieval
1372
- onError: (error) => {
1373
- setProgress(0);
1374
- onError?.(error);
1375
- },
1376
- onProgress: (bytesUploaded, bytesTotal) => {
1377
- setProgress(bytesUploaded / bytesTotal * 100);
1378
- },
1379
- onSuccess: () => {
1380
- setProgress(0);
1381
- queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta", subId, appTitle], exact: false });
1382
- onSuccess?.(metadata);
1383
- }
1384
- });
1385
- const previousUploads = await upload.findPreviousUploads();
1386
- if (previousUploads.length > 0) {
1387
- upload.resumeFromPreviousUpload(previousUploads[0]);
1388
- }
1389
- upload.start();
1390
- };
1391
- return { mutate, progress };
201
+ var ActionsMenu = ({ meta, menu, setMenu }) => {
202
+ const { t: t2 } = useTranslation2();
203
+ const { fileMetas, onDelete, actions } = useFile();
204
+ const { confirm } = useDialogs();
205
+ const handleMenuClose = () => {
206
+ setMenu(null);
207
+ };
208
+ const { mutate: download, isPending: isDownloading } = useDownloadFile();
209
+ const { mutate: deleteFile, isPending: isDeleting } = useDeleteFile();
210
+ const handleOnDownload = () => {
211
+ handleMenuClose();
212
+ download(meta);
213
+ };
214
+ const handleOnDelete = async () => {
215
+ if (!await confirm(t2("Layout.File.AreYouSureYouWantToDelete", { fileName: meta.fileName })))
216
+ return;
217
+ deleteFile(meta);
218
+ handleMenuClose();
219
+ if (onDelete) {
220
+ const remainingFileMetas = fileMetas.filter((m) => m.id !== meta.id);
221
+ onDelete({ remainingFileMetas, deletedFileMeta: meta });
222
+ }
223
+ };
224
+ return /* @__PURE__ */ jsx5(
225
+ Menu,
226
+ {
227
+ open: menu !== null,
228
+ onClose: handleMenuClose,
229
+ anchorReference: "anchorPosition",
230
+ variant: "menu",
231
+ anchorPosition: menu === null ? void 0 : { top: menu.mouseY, left: menu.mouseX },
232
+ children: /* @__PURE__ */ jsxs3(List, { disablePadding: true, children: [
233
+ actions?.download !== false && /* @__PURE__ */ jsxs3(ListItemButton, { onClick: handleOnDownload, disabled: isDownloading, children: [
234
+ /* @__PURE__ */ jsx5(ListItemIcon, { children: /* @__PURE__ */ jsx5(FileDownload, {}) }),
235
+ /* @__PURE__ */ jsx5(ListItemText, { children: t2("Layout.File.Download") })
236
+ ] }),
237
+ actions?.delete !== false && /* @__PURE__ */ jsxs3(ListItemButton, { onClick: handleOnDelete, disabled: isDeleting, children: [
238
+ /* @__PURE__ */ jsx5(ListItemIcon, { children: /* @__PURE__ */ jsx5(Delete, {}) }),
239
+ /* @__PURE__ */ jsx5(ListItemText, { children: t2("Layout.File.Delete") })
240
+ ] })
241
+ ] })
242
+ }
243
+ );
1392
244
  };
1393
245
 
1394
246
  // src/components/file/fileViewer/FileViewerGrid.tsx
1395
- import MoreVert from "@mui/icons-material/MoreVert";
1396
- import { Box as Box2, IconButton, ImageListItem, ImageListItemBar, Stack as Stack3, Tooltip } from "@mui/material";
1397
- import { grey } from "@mui/material/colors";
1398
- import { Fragment, useEffect as useEffect3, useState as useState3 } from "react";
1399
-
1400
- // src/components/file/fileViewer/common/ActionsMenu.tsx
1401
- import Delete from "@mui/icons-material/Delete";
1402
- import FileDownload from "@mui/icons-material/FileDownload";
1403
- import { List, ListItemButton, ListItemIcon, ListItemText, Menu } from "@mui/material";
1404
- import { useTranslation as useTranslation3 } from "react-i18next";
1405
-
1406
- // src/hooks/DialogsHooks.tsx
1407
- import Button from "@mui/material/Button";
1408
- import Dialog from "@mui/material/Dialog";
1409
- import DialogActions from "@mui/material/DialogActions";
1410
- import DialogContent from "@mui/material/DialogContent";
1411
- import DialogTitle from "@mui/material/DialogTitle";
1412
-
1413
- // node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js
1414
- import * as React2 from "react";
1415
-
1416
- // node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js
1417
- import * as React from "react";
1418
- var useEnhancedEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
1419
- var useEnhancedEffect_default = useEnhancedEffect;
1420
-
1421
- // node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js
1422
- function useEventCallback(fn) {
1423
- const ref = React2.useRef(fn);
1424
- useEnhancedEffect_default(() => {
1425
- ref.current = fn;
1426
- });
1427
- return React2.useRef((...args) => (
1428
- // @ts-expect-error hide `this`
1429
- (0, ref.current)(...args)
1430
- )).current;
1431
- }
1432
- var useEventCallback_default = useEventCallback;
1433
-
1434
- // src/hooks/DialogsHooks.tsx
1435
- import { useContext as useContext2, useMemo } from "react";
1436
- import { useTranslation as useTranslation2 } from "react-i18next";
1437
-
1438
- // src/contexts/DialogsContext.ts
1439
- import { createContext as createContext2 } from "react";
1440
- var DialogsContext = createContext2({});
1441
-
1442
- // src/hooks/DialogsHooks.tsx
1443
247
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1444
- function AlertDialog({ open, payload, onClose }) {
1445
- const { t: t2 } = useTranslation2();
1446
- return /* @__PURE__ */ jsxs4(Dialog, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(), children: [
1447
- /* @__PURE__ */ jsx6(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Alert") }),
1448
- /* @__PURE__ */ jsx6(DialogContent, { children: payload.message }),
1449
- /* @__PURE__ */ jsx6(DialogActions, { children: /* @__PURE__ */ jsx6(Button, { disabled: !open, onClick: () => onClose(), children: t2("Layout.Dialog.Confirm") }) })
1450
- ] });
1451
- }
1452
- function ConfirmDialog({ open, payload, onClose }) {
1453
- const { t: t2 } = useTranslation2();
1454
- return /* @__PURE__ */ jsxs4(Dialog, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(false), children: [
1455
- /* @__PURE__ */ jsx6(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Confirm") }),
1456
- /* @__PURE__ */ jsx6(DialogContent, { children: payload.message }),
1457
- /* @__PURE__ */ jsxs4(DialogActions, { children: [
1458
- /* @__PURE__ */ jsx6(Button, { autoFocus: true, disabled: !open, onClick: () => onClose(false), children: payload.cancelText ?? t2("Layout.Dialog.Cancel") }),
1459
- /* @__PURE__ */ jsx6(Button, { disabled: !open, onClick: () => onClose(true), children: t2("Layout.Dialog.Confirm") })
1460
- ] })
1461
- ] });
1462
- }
1463
- function useDialogs() {
1464
- const { open, close } = useContext2(DialogsContext);
1465
- const alert = useEventCallback_default(
1466
- (message, { ...options } = {}) => open(AlertDialog, { ...options, message })
1467
- );
1468
- const confirm = useEventCallback_default(
1469
- (message, { ...options } = {}) => open(ConfirmDialog, { ...options, message })
1470
- );
1471
- return useMemo(() => ({ alert, confirm, open, close }), [alert, close, confirm, open]);
1472
- }
1473
-
1474
- // src/components/file/fileViewer/common/ActionsMenu.tsx
1475
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1476
- var ActionsMenu = ({ meta, menu, setMenu }) => {
1477
- const { t: t2 } = useTranslation3();
1478
- const { fileMetas, onDelete, actions } = useFile();
1479
- const { confirm } = useDialogs();
1480
- const handleMenuClose = () => {
1481
- setMenu(null);
1482
- };
1483
- const { mutate: download, isPending: isDownloading } = useDownloadFile();
1484
- const { mutate: deleteFile, isPending: isDeleting } = useDeleteFile();
1485
- const handleOnDownload = () => {
1486
- handleMenuClose();
1487
- download(meta);
1488
- };
1489
- const handleOnDelete = async () => {
1490
- if (!await confirm(t2("Layout.File.AreYouSureYouWantToDelete", { fileName: meta.fileName })))
1491
- return;
1492
- deleteFile(meta);
1493
- handleMenuClose();
1494
- if (onDelete) {
1495
- const remainingFileMetas = fileMetas.filter((m) => m.id !== meta.id);
1496
- onDelete({ remainingFileMetas, deletedFileMeta: meta });
1497
- }
1498
- };
1499
- return /* @__PURE__ */ jsx7(
1500
- Menu,
1501
- {
1502
- open: menu !== null,
1503
- onClose: handleMenuClose,
1504
- anchorReference: "anchorPosition",
1505
- variant: "menu",
1506
- anchorPosition: menu === null ? void 0 : { top: menu.mouseY, left: menu.mouseX },
1507
- children: /* @__PURE__ */ jsxs5(List, { disablePadding: true, children: [
1508
- actions?.download !== false && /* @__PURE__ */ jsxs5(ListItemButton, { onClick: handleOnDownload, disabled: isDownloading, children: [
1509
- /* @__PURE__ */ jsx7(ListItemIcon, { children: /* @__PURE__ */ jsx7(FileDownload, {}) }),
1510
- /* @__PURE__ */ jsx7(ListItemText, { children: t2("Layout.File.Download") })
1511
- ] }),
1512
- actions?.delete !== false && /* @__PURE__ */ jsxs5(ListItemButton, { onClick: handleOnDelete, disabled: isDeleting, children: [
1513
- /* @__PURE__ */ jsx7(ListItemIcon, { children: /* @__PURE__ */ jsx7(Delete, {}) }),
1514
- /* @__PURE__ */ jsx7(ListItemText, { children: t2("Layout.File.Delete") })
1515
- ] })
1516
- ] })
1517
- }
1518
- );
1519
- };
1520
-
1521
- // src/components/file/fileViewer/FileViewerGrid.tsx
1522
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1523
248
  var IMAGE_SIZE = 150;
1524
249
  var FileViewerGrid = ({ sx, size, itemBar }) => {
1525
- const { fileMetas } = useFile();
1526
- return /* @__PURE__ */ jsx8(Stack3, { direction: "row", spacing: 1, sx: { overflow: "auto", ...sx }, children: fileMetas.map((fileMeta) => /* @__PURE__ */ jsx8(
250
+ const { fileMetas } = useFile2();
251
+ return /* @__PURE__ */ jsx6(Stack2, { direction: "row", spacing: 1, sx: { overflow: "auto", ...sx }, children: fileMetas.map((fileMeta) => /* @__PURE__ */ jsx6(
1527
252
  GridFileViewerItem,
1528
253
  {
1529
254
  meta: fileMeta,
@@ -1534,10 +259,10 @@ var FileViewerGrid = ({ sx, size, itemBar }) => {
1534
259
  )) });
1535
260
  };
1536
261
  var GridFileViewerItem = ({ meta, size, itemBar }) => {
1537
- const { setImageId, actions } = useFile();
1538
- const [showItemBar, setShowItemBar] = useState3(itemBar === "always");
1539
- const [menu, setMenu] = useState3(null);
1540
- useEffect3(() => {
262
+ const { setImageId, actions } = useFile2();
263
+ const [showItemBar, setShowItemBar] = useState2(itemBar === "always");
264
+ const [menu, setMenu] = useState2(null);
265
+ useEffect2(() => {
1541
266
  setShowItemBar(itemBar === "always");
1542
267
  }, [itemBar]);
1543
268
  const { data: source } = useGetFileThumbnail(meta);
@@ -1548,7 +273,7 @@ var GridFileViewerItem = ({ meta, size, itemBar }) => {
1548
273
  setTimeout(() => setShowItemBar(true));
1549
274
  };
1550
275
  const { mutate: openFile } = useOpenFile();
1551
- const { mutate: download } = useDownloadFile();
276
+ const { mutate: download } = useDownloadFile2();
1552
277
  const onClick = () => {
1553
278
  switch (meta.mediaType) {
1554
279
  case "image": {
@@ -1565,9 +290,9 @@ var GridFileViewerItem = ({ meta, size, itemBar }) => {
1565
290
  }
1566
291
  }
1567
292
  };
1568
- return /* @__PURE__ */ jsxs6(Fragment, { children: [
1569
- /* @__PURE__ */ jsxs6(ImageListItem, { sx: { width: size ?? IMAGE_SIZE, height: size ?? IMAGE_SIZE }, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave, children: [
1570
- /* @__PURE__ */ jsx8(
293
+ return /* @__PURE__ */ jsxs4(Fragment, { children: [
294
+ /* @__PURE__ */ jsxs4(ImageListItem, { sx: { width: size ?? IMAGE_SIZE, height: size ?? IMAGE_SIZE }, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave, children: [
295
+ /* @__PURE__ */ jsx6(
1571
296
  Box2,
1572
297
  {
1573
298
  component: "img",
@@ -1578,15 +303,15 @@ var GridFileViewerItem = ({ meta, size, itemBar }) => {
1578
303
  sx: { cursor: "pointer", objectFit: "contain", width: size ?? IMAGE_SIZE, height: size ?? IMAGE_SIZE }
1579
304
  }
1580
305
  ),
1581
- itemBar !== "hidden" && showItemBar && /* @__PURE__ */ jsx8(
306
+ itemBar !== "hidden" && showItemBar && /* @__PURE__ */ jsx6(
1582
307
  ImageListItemBar,
1583
308
  {
1584
- title: /* @__PURE__ */ jsx8(Tooltip, { title: meta.fileName, children: /* @__PURE__ */ jsx8(Box2, { children: meta.fileName }) }),
1585
- actionIcon: (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx8(IconButton, { sx: { color: grey[100] }, onClick: openMenu, children: /* @__PURE__ */ jsx8(MoreVert, {}) })
309
+ title: /* @__PURE__ */ jsx6(Tooltip, { title: meta.fileName, children: /* @__PURE__ */ jsx6(Box2, { children: meta.fileName }) }),
310
+ actionIcon: (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx6(IconButton, { sx: { color: grey[100] }, onClick: openMenu, children: /* @__PURE__ */ jsx6(MoreVert, {}) })
1586
311
  }
1587
312
  )
1588
313
  ] }),
1589
- (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx8(ActionsMenu, { meta, menu, setMenu })
314
+ (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx6(ActionsMenu, { meta, menu, setMenu })
1590
315
  ] });
1591
316
  };
1592
317
 
@@ -1596,12 +321,14 @@ import Image from "@mui/icons-material/Image";
1596
321
  import MoreVert2 from "@mui/icons-material/MoreVert";
1597
322
  import SmartDisplay from "@mui/icons-material/SmartDisplay";
1598
323
  import { IconButton as IconButton2, List as List2, ListItemButton as ListItemButton2, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2 } from "@mui/material";
1599
- import { Fragment as Fragment2, useState as useState4 } from "react";
1600
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
324
+ import { Fragment as Fragment2, useState as useState3 } from "react";
325
+ import { useFile as useFile3 } from "~/contexts/FileContext";
326
+ import { useDownloadFile as useDownloadFile3, useOpenFile as useOpenFile2 } from "~/hooks/FileHooks";
327
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1601
328
  var FileViewerList = ({ sx }) => {
1602
- const { fileMetas } = useFile();
1603
- return /* @__PURE__ */ jsx9(List2, { dense: true, sx, children: fileMetas.map(
1604
- (fileMeta) => /* @__PURE__ */ jsx9(
329
+ const { fileMetas } = useFile3();
330
+ return /* @__PURE__ */ jsx7(List2, { dense: true, sx, children: fileMetas.map(
331
+ (fileMeta) => /* @__PURE__ */ jsx7(
1605
332
  ListFileViewerItem,
1606
333
  {
1607
334
  meta: fileMeta
@@ -1611,14 +338,14 @@ var FileViewerList = ({ sx }) => {
1611
338
  ) });
1612
339
  };
1613
340
  var ListFileViewerItem = ({ meta }) => {
1614
- const { setImageId, actions } = useFile();
1615
- const [menu, setMenu] = useState4(null);
341
+ const { setImageId, actions } = useFile3();
342
+ const [menu, setMenu] = useState3(null);
1616
343
  const openMenu = (event) => {
1617
344
  event.stopPropagation();
1618
345
  setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY } : null);
1619
346
  };
1620
- const { mutate: openFile } = useOpenFile();
1621
- const { mutate: download } = useDownloadFile();
347
+ const { mutate: openFile } = useOpenFile2();
348
+ const { mutate: download } = useDownloadFile3();
1622
349
  const onClick = () => {
1623
350
  switch (meta.mediaType) {
1624
351
  case "image": {
@@ -1638,36 +365,38 @@ var ListFileViewerItem = ({ meta }) => {
1638
365
  const icon = () => {
1639
366
  switch (meta.mediaType) {
1640
367
  case "image": {
1641
- return /* @__PURE__ */ jsx9(Image, {});
368
+ return /* @__PURE__ */ jsx7(Image, {});
1642
369
  }
1643
370
  case "video": {
1644
- return /* @__PURE__ */ jsx9(SmartDisplay, {});
371
+ return /* @__PURE__ */ jsx7(SmartDisplay, {});
1645
372
  }
1646
373
  default: {
1647
- return /* @__PURE__ */ jsx9(AttachFile, {});
374
+ return /* @__PURE__ */ jsx7(AttachFile, {});
1648
375
  }
1649
376
  }
1650
377
  };
1651
- return /* @__PURE__ */ jsxs7(Fragment2, { children: [
1652
- /* @__PURE__ */ jsxs7(ListItemButton2, { onClick, children: [
1653
- /* @__PURE__ */ jsx9(ListItemIcon2, { children: icon() }),
1654
- /* @__PURE__ */ jsx9(ListItemText2, { primary: `${meta.fileName}.${meta.fileExtension}` }),
1655
- (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx9(IconButton2, { edge: "end", onClick: openMenu, children: /* @__PURE__ */ jsx9(MoreVert2, {}) })
378
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
379
+ /* @__PURE__ */ jsxs5(ListItemButton2, { onClick, children: [
380
+ /* @__PURE__ */ jsx7(ListItemIcon2, { children: icon() }),
381
+ /* @__PURE__ */ jsx7(ListItemText2, { primary: `${meta.fileName}.${meta.fileExtension}` }),
382
+ (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx7(IconButton2, { edge: "end", onClick: openMenu, children: /* @__PURE__ */ jsx7(MoreVert2, {}) })
1656
383
  ] }, meta.id),
1657
- (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx9(ActionsMenu, { meta, menu, setMenu })
384
+ (actions?.download !== false || actions?.delete !== false) && /* @__PURE__ */ jsx7(ActionsMenu, { meta, menu, setMenu })
1658
385
  ] });
1659
386
  };
1660
387
 
1661
388
  // src/components/file/fileViewer/ImageViewer.tsx
1662
389
  import Close from "@mui/icons-material/Close";
1663
- import { Box as Box3, Dialog as Dialog2, Fab } from "@mui/material";
1664
- import { useEffect as useEffect4 } from "react";
1665
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
390
+ import { Box as Box3, Dialog, Fab } from "@mui/material";
391
+ import { useEffect as useEffect3 } from "react";
392
+ import { useFile as useFile4 } from "~/contexts/FileContext";
393
+ import { useGetFile } from "~/hooks/FileHooks";
394
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1666
395
  var ImageViewer = ({ metaId }) => {
1667
- const { fileMetas, setImageId } = useFile();
396
+ const { fileMetas, setImageId } = useFile4();
1668
397
  const meta = fileMetas.find((m) => m.id === metaId);
1669
398
  const { data: source } = useGetFile(meta);
1670
- useEffect4(() => {
399
+ useEffect3(() => {
1671
400
  if (globalThis.window !== void 0 && metaId)
1672
401
  globalThis.addEventListener("keydown", handleOnKeydown);
1673
402
  return () => {
@@ -1705,28 +434,28 @@ var ImageViewer = ({ metaId }) => {
1705
434
  };
1706
435
  const onClose = () => setImageId("");
1707
436
  if (!metaId) return null;
1708
- return /* @__PURE__ */ jsxs8(Dialog2, { open: true, onClose, maxWidth: "xl", children: [
1709
- /* @__PURE__ */ jsx10(Box3, { component: "img", src: source, alt: metaId, sx: { maxWidth: "100vw", maxHeight: { xs: "calc(100vh - 56px)", sm: "calc(100vh - 64px)" } } }),
1710
- /* @__PURE__ */ jsx10(Fab, { size: "medium", onClick: onClose, sx: { position: "fixed", top: 8, right: 8 }, children: /* @__PURE__ */ jsx10(Close, {}) })
437
+ return /* @__PURE__ */ jsxs6(Dialog, { open: true, onClose, maxWidth: "xl", children: [
438
+ /* @__PURE__ */ jsx8(Box3, { component: "img", src: source, alt: metaId, sx: { maxWidth: "100vw", maxHeight: { xs: "calc(100vh - 56px)", sm: "calc(100vh - 64px)" } } }),
439
+ /* @__PURE__ */ jsx8(Fab, { size: "medium", onClick: onClose, sx: { position: "fixed", top: 8, right: 8 }, children: /* @__PURE__ */ jsx8(Close, {}) })
1711
440
  ] });
1712
441
  };
1713
442
 
1714
443
  // src/components/file/FileViewer.tsx
1715
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
444
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1716
445
  var FileViewer = ({ subId, onDelete, actions, children }) => {
1717
446
  const { data: fileMetas = [] } = useGetFileMetas(subId, { enabled: !!subId });
1718
- const [imageId, setImageId] = useState5("");
447
+ const [imageId, setImageId] = useState4("");
1719
448
  const components = { Grid: FileViewerGrid, List: FileViewerList };
1720
449
  if (fileMetas.length === 0) return null;
1721
- return /* @__PURE__ */ jsxs9(FileContext.Provider, { value: { fileMetas, onDelete, actions, setImageId }, children: [
450
+ return /* @__PURE__ */ jsxs7(FileContext.Provider, { value: { fileMetas, onDelete, actions, setImageId }, children: [
1722
451
  children(components),
1723
- /* @__PURE__ */ jsx11(ImageViewer, { metaId: imageId })
452
+ /* @__PURE__ */ jsx9(ImageViewer, { metaId: imageId })
1724
453
  ] });
1725
454
  };
1726
455
 
1727
456
  // src/components/data-grid/ChipInputCell.tsx
1728
- import { Chip as Chip2, Stack as Stack4 } from "@mui/material";
1729
- import { jsx as jsx12 } from "react/jsx-runtime";
457
+ import { Chip, Stack as Stack3 } from "@mui/material";
458
+ import { jsx as jsx10 } from "react/jsx-runtime";
1730
459
  var isArray = (value) => Array.isArray(value);
1731
460
  var ChipInputCell = ({ params, slotProps, getLabel }) => {
1732
461
  if (!params.value) return null;
@@ -1735,1802 +464,515 @@ var ChipInputCell = ({ params, slotProps, getLabel }) => {
1735
464
  return value;
1736
465
  };
1737
466
  if (isArray(params.value))
1738
- return /* @__PURE__ */ jsx12(Stack4, { direction: "row", alignItems: "center", gap: 1, sx: { overflowX: "auto", height: "100%", width: params.colDef.computedWidth }, children: params.value.map(
1739
- (value, index) => /* @__PURE__ */ jsx12(Chip2, { label: getLabelValue(value), ...slotProps }, `${index + 1}-chip-input-cell`)
467
+ return /* @__PURE__ */ jsx10(Stack3, { direction: "row", alignItems: "center", gap: 1, sx: { overflowX: "auto", height: "100%", width: params.colDef.computedWidth }, children: params.value.map(
468
+ (value, index) => /* @__PURE__ */ jsx10(Chip, { label: getLabelValue(value), ...slotProps }, `${index + 1}-chip-input-cell`)
1740
469
  ) });
1741
- return /* @__PURE__ */ jsx12(Chip2, { label: getLabelValue(params.value), ...slotProps });
470
+ return /* @__PURE__ */ jsx10(Chip, { label: getLabelValue(params.value), ...slotProps });
1742
471
  };
1743
472
 
1744
473
  // src/components/data-grid/EditableColumnHeader.tsx
1745
474
  import Edit from "@mui/icons-material/Edit";
1746
- import { jsx as jsx13 } from "react/jsx-runtime";
475
+ import { jsx as jsx11 } from "react/jsx-runtime";
1747
476
  var EditableColumnHeader = ({ colDef }) => {
1748
- return /* @__PURE__ */ jsx13(TypographyWithIcon, { endIcon: /* @__PURE__ */ jsx13(Edit, { color: "disabled", fontSize: "small" }), variant: "body2", className: "MuiDataGrid-columnHeaderTitle", children: colDef.headerName });
477
+ return /* @__PURE__ */ jsx11(TypographyWithIcon, { endIcon: /* @__PURE__ */ jsx11(Edit, { color: "disabled", fontSize: "small" }), variant: "body2", className: "MuiDataGrid-columnHeaderTitle", children: colDef.headerName });
1749
478
  };
1750
479
 
1751
480
  // src/components/router/RouterButton.tsx
1752
- import { Button as Button2 } from "@mui/material";
481
+ import { Button } from "@mui/material";
1753
482
  import { createLink } from "@tanstack/react-router";
1754
- import React5 from "react";
1755
- import { jsx as jsx14 } from "react/jsx-runtime";
1756
- var Component = React5.forwardRef(function ButtonComponent(props, reference) {
1757
- return /* @__PURE__ */ jsx14(Button2, { ref: reference, component: "a", ...props });
483
+ import React3 from "react";
484
+ import { jsx as jsx12 } from "react/jsx-runtime";
485
+ var Component = React3.forwardRef(function ButtonComponent(props, reference) {
486
+ return /* @__PURE__ */ jsx12(Button, { ref: reference, component: "a", ...props });
1758
487
  });
1759
488
  var CreatedComponent = createLink(Component);
1760
489
  var RouterButton = (props) => {
1761
- return /* @__PURE__ */ jsx14(CreatedComponent, { ...props });
490
+ return /* @__PURE__ */ jsx12(CreatedComponent, { ...props });
1762
491
  };
1763
492
 
1764
493
  // src/components/router/RouterGridActionsCellItem.tsx
1765
494
  import { GridActionsCellItem } from "@mui/x-data-grid-premium";
1766
495
  import { createLink as createLink2 } from "@tanstack/react-router";
1767
- import React6 from "react";
1768
- import { jsx as jsx15 } from "react/jsx-runtime";
1769
- var Component2 = React6.forwardRef(
496
+ import React4 from "react";
497
+ import { jsx as jsx13 } from "react/jsx-runtime";
498
+ var Component2 = React4.forwardRef(
1770
499
  function GridActionsCellItemComponent(props, reference) {
1771
- return /* @__PURE__ */ jsx15(GridActionsCellItem, { ref: reference, component: "a", ...props });
500
+ return /* @__PURE__ */ jsx13(GridActionsCellItem, { ref: reference, component: "a", ...props });
1772
501
  }
1773
502
  );
1774
503
  var CreatedComponent2 = createLink2(Component2);
1775
504
  var RouterGridActionsCellItem = (props) => {
1776
- return /* @__PURE__ */ jsx15(CreatedComponent2, { ...props });
505
+ return /* @__PURE__ */ jsx13(CreatedComponent2, { ...props });
1777
506
  };
1778
507
 
1779
508
  // src/components/router/RouterIconButton.tsx
1780
509
  import { IconButton as IconButton3 } from "@mui/material";
1781
510
  import { createLink as createLink3 } from "@tanstack/react-router";
1782
- import React7 from "react";
1783
- import { jsx as jsx16 } from "react/jsx-runtime";
1784
- var Component3 = React7.forwardRef(function IconButtonComponent(props, reference) {
1785
- return /* @__PURE__ */ jsx16(IconButton3, { ref: reference, component: "a", ...props });
511
+ import React5 from "react";
512
+ import { jsx as jsx14 } from "react/jsx-runtime";
513
+ var Component3 = React5.forwardRef(function IconButtonComponent(props, reference) {
514
+ return /* @__PURE__ */ jsx14(IconButton3, { ref: reference, component: "a", ...props });
1786
515
  });
1787
516
  var CreatedComponent3 = createLink3(Component3);
1788
517
  var RouterIconButton = (props) => {
1789
- return /* @__PURE__ */ jsx16(CreatedComponent3, { ...props });
518
+ return /* @__PURE__ */ jsx14(CreatedComponent3, { ...props });
1790
519
  };
1791
520
 
1792
521
  // src/components/router/RouterLink.tsx
1793
522
  import { Link } from "@mui/material";
1794
523
  import { createLink as createLink4 } from "@tanstack/react-router";
1795
- import React8 from "react";
1796
- import { jsx as jsx17 } from "react/jsx-runtime";
1797
- var Component4 = React8.forwardRef(function LinkComponent(props, reference) {
1798
- return /* @__PURE__ */ jsx17(Link, { ref: reference, ...props });
524
+ import React6 from "react";
525
+ import { jsx as jsx15 } from "react/jsx-runtime";
526
+ var Component4 = React6.forwardRef(function LinkComponent(props, reference) {
527
+ return /* @__PURE__ */ jsx15(Link, { ref: reference, ...props });
1799
528
  });
1800
529
  var CreatedComponent4 = createLink4(Component4);
1801
530
  var RouterLink = (props) => {
1802
- return /* @__PURE__ */ jsx17(CreatedComponent4, { ...props });
531
+ return /* @__PURE__ */ jsx15(CreatedComponent4, { ...props });
1803
532
  };
1804
533
 
1805
534
  // src/components/router/RouterTab.tsx
1806
535
  import { Tab } from "@mui/material";
1807
536
  import { createLink as createLink5 } from "@tanstack/react-router";
1808
- import React9 from "react";
1809
- import { jsx as jsx18 } from "react/jsx-runtime";
1810
- var Component5 = React9.forwardRef(function TabComponent(props, reference) {
1811
- return /* @__PURE__ */ jsx18(Tab, { ref: reference, component: "a", ...props });
537
+ import React7 from "react";
538
+ import { jsx as jsx16 } from "react/jsx-runtime";
539
+ var Component5 = React7.forwardRef(function TabComponent(props, reference) {
540
+ return /* @__PURE__ */ jsx16(Tab, { ref: reference, component: "a", ...props });
1812
541
  });
1813
542
  var CreatedComponent5 = createLink5(Component5);
1814
543
  var RouterTab = (props) => {
1815
- return /* @__PURE__ */ jsx18(CreatedComponent5, { ...props });
544
+ return /* @__PURE__ */ jsx16(CreatedComponent5, { ...props });
1816
545
  };
1817
546
 
1818
547
  // src/components/router/RouterListItemButton.tsx
1819
548
  import { ListItemButton as ListItemButton3 } from "@mui/material";
1820
549
  import { createLink as createLink6 } from "@tanstack/react-router";
1821
- import React10 from "react";
1822
- import { jsx as jsx19 } from "react/jsx-runtime";
1823
- var Component6 = React10.forwardRef(function ButtonComponent2(props, reference) {
1824
- return /* @__PURE__ */ jsx19(ListItemButton3, { ref: reference, component: "a", ...props });
550
+ import React8 from "react";
551
+ import { jsx as jsx17 } from "react/jsx-runtime";
552
+ var Component6 = React8.forwardRef(function ButtonComponent2(props, reference) {
553
+ return /* @__PURE__ */ jsx17(ListItemButton3, { ref: reference, component: "a", ...props });
1825
554
  });
1826
555
  var CreatedComponent6 = createLink6(Component6);
1827
556
  var RouterListItemButton = (props) => {
1828
- return /* @__PURE__ */ jsx19(CreatedComponent6, { ...props });
557
+ return /* @__PURE__ */ jsx17(CreatedComponent6, { ...props });
1829
558
  };
1830
559
 
1831
560
  // src/components/router/RouterNotFound.tsx
1832
- import { Box as Box4, Divider, Typography as Typography5 } from "@mui/material";
1833
- import { useTranslation as useTranslation4 } from "react-i18next";
1834
- import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
561
+ import { Box as Box4, Divider, Typography as Typography4 } from "@mui/material";
562
+ import { useTranslation as useTranslation3 } from "react-i18next";
563
+ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
1835
564
  function RouterNotFound() {
1836
- const { t: t2 } = useTranslation4();
1837
- return /* @__PURE__ */ jsx20(Box4, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs10(Box4, { display: "flex", alignItems: "center", mb: 4, children: [
1838
- /* @__PURE__ */ jsx20(Typography5, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: "404" }),
1839
- /* @__PURE__ */ jsx20(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
1840
- /* @__PURE__ */ jsx20(Typography5, { variant: "h5", component: "span", children: t2("Layout.ThisPageCouldNotBeFound") })
565
+ const { t: t2 } = useTranslation3();
566
+ return /* @__PURE__ */ jsx18(Box4, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs8(Box4, { display: "flex", alignItems: "center", mb: 4, children: [
567
+ /* @__PURE__ */ jsx18(Typography4, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: "404" }),
568
+ /* @__PURE__ */ jsx18(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
569
+ /* @__PURE__ */ jsx18(Typography4, { variant: "h5", component: "span", children: t2("Layout.ThisPageCouldNotBeFound") })
1841
570
  ] }) });
1842
571
  }
1843
572
 
1844
573
  // src/components/router/RouterError.tsx
1845
- import { Box as Box5, Divider as Divider2, Typography as Typography6 } from "@mui/material";
1846
- import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
574
+ import { Box as Box5, Divider as Divider2, Typography as Typography5 } from "@mui/material";
575
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
1847
576
  var RouterError = ({ error }) => {
1848
- return /* @__PURE__ */ jsx21(Box5, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs11(Box5, { display: "flex", alignItems: "center", mb: 4, children: [
1849
- /* @__PURE__ */ jsx21(Typography6, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: error.name || "500" }),
1850
- /* @__PURE__ */ jsx21(Divider2, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
1851
- /* @__PURE__ */ jsx21(Typography6, { variant: "h5", component: "span", children: error.message })
577
+ return /* @__PURE__ */ jsx19(Box5, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs9(Box5, { display: "flex", alignItems: "center", mb: 4, children: [
578
+ /* @__PURE__ */ jsx19(Typography5, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: error.name || "500" }),
579
+ /* @__PURE__ */ jsx19(Divider2, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
580
+ /* @__PURE__ */ jsx19(Typography5, { variant: "h5", component: "span", children: error.message })
1852
581
  ] }) });
1853
582
  };
1854
583
 
1855
- // node_modules/@babel/runtime/helpers/esm/extends.js
1856
- function _extends() {
1857
- return _extends = Object.assign ? Object.assign.bind() : function(n) {
1858
- for (var e = 1; e < arguments.length; e++) {
1859
- var t2 = arguments[e];
1860
- for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
1861
- }
1862
- return n;
1863
- }, _extends.apply(null, arguments);
1864
- }
584
+ // src/providers/LayoutProvider.tsx
585
+ import { LocalizationProvider } from "@mui/x-date-pickers";
586
+ import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
587
+ import { useEffect as useEffect4, useState as useState6 } from "react";
588
+ import { I18nextProvider, useTranslation as useTranslation4 } from "react-i18next";
589
+ import * as z from "zod";
590
+ import { cs, en } from "zod/locales";
591
+ import { Layout } from "~/components/core/Layout";
592
+ import { LayoutContext } from "~/contexts/LayoutContext";
593
+ import i18n from "~/utils/i18n";
1865
594
 
1866
- // node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
1867
- function _objectWithoutPropertiesLoose(r, e) {
1868
- if (null == r) return {};
1869
- var t2 = {};
1870
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1871
- if (-1 !== e.indexOf(n)) continue;
1872
- t2[n] = r[n];
1873
- }
1874
- return t2;
1875
- }
595
+ // src/providers/DialogsProvider.tsx
596
+ import useEventCallback from "@mui/utils/useEventCallback";
597
+ import { useCallback, useId, useMemo, useRef as useRef2, useState as useState5 } from "react";
1876
598
 
1877
- // node_modules/@mui/x-date-pickers/esm/LocalizationProvider/LocalizationProvider.js
1878
- var import_prop_types = __toESM(require_prop_types(), 1);
1879
- import * as React11 from "react";
1880
- import { useThemeProps } from "@mui/material/styles";
1881
- import { jsx as _jsx } from "react/jsx-runtime";
1882
- var _excluded = ["localeText"];
1883
- var PickerAdapterContext = /* @__PURE__ */ React11.createContext(null);
1884
- if (process.env.NODE_ENV !== "production") PickerAdapterContext.displayName = "PickerAdapterContext";
1885
- var LocalizationProvider = function LocalizationProvider2(inProps) {
1886
- const {
1887
- localeText: inLocaleText
1888
- } = inProps, otherInProps = _objectWithoutPropertiesLoose(inProps, _excluded);
1889
- const {
1890
- adapter: parentAdapter,
1891
- localeText: parentLocaleText
1892
- } = React11.useContext(PickerAdapterContext) ?? {
1893
- utils: void 0,
1894
- adapter: void 0,
1895
- localeText: void 0
1896
- };
1897
- const props = useThemeProps({
1898
- // We don't want to pass the `localeText` prop to the theme, that way it will always return the theme value,
1899
- // We will then merge this theme value with our value manually
1900
- props: otherInProps,
1901
- name: "MuiLocalizationProvider"
1902
- });
1903
- const {
1904
- children,
1905
- dateAdapter: DateAdapter,
1906
- dateFormats,
1907
- dateLibInstance,
1908
- adapterLocale,
1909
- localeText: themeLocaleText
1910
- } = props;
1911
- const localeText = React11.useMemo(() => _extends({}, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
1912
- const adapter = React11.useMemo(() => {
1913
- if (!DateAdapter) {
1914
- if (parentAdapter) {
1915
- return parentAdapter;
1916
- }
1917
- return null;
1918
- }
1919
- const dateAdapter = new DateAdapter({
1920
- locale: adapterLocale,
1921
- formats: dateFormats,
1922
- instance: dateLibInstance
599
+ // src/contexts/DialogsContext.ts
600
+ import { createContext } from "react";
601
+ var DialogsContext = createContext({});
602
+
603
+ // src/providers/DialogsProvider.tsx
604
+ import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
605
+ function DialogsProvider({ children, unmountAfter = 1e3 }) {
606
+ const [stack, setStack] = useState5([]);
607
+ const keyPrefix = useId();
608
+ const nextId = useRef2(0);
609
+ const dialogMetadata = useRef2(/* @__PURE__ */ new WeakMap());
610
+ const requestDialog = useEventCallback(function open(Component7, payload, options = {}) {
611
+ const { onClose = async () => {
612
+ } } = options;
613
+ let resolve;
614
+ const promise = new Promise((resolveImpl) => {
615
+ resolve = resolveImpl;
1923
616
  });
1924
- if (!dateAdapter.isMUIAdapter) {
1925
- 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(`
1926
- `));
617
+ const key = `${keyPrefix}-${nextId.current}`;
618
+ nextId.current += 1;
619
+ const newEntry = {
620
+ key,
621
+ open: true,
622
+ promise,
623
+ Component: Component7,
624
+ payload,
625
+ onClose,
626
+ resolve
627
+ };
628
+ dialogMetadata.current.set(promise, newEntry);
629
+ setStack((previousStack) => [...previousStack, newEntry]);
630
+ return promise;
631
+ });
632
+ const removeDialogFromStack = useCallback((dialog) => {
633
+ setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
634
+ dialogMetadata.current.delete(dialog);
635
+ }, []);
636
+ const closeDialogUi = useEventCallback(function closeDialogUi2(dialog) {
637
+ setStack(
638
+ (previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
639
+ );
640
+ setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
641
+ });
642
+ const closeDialog = useEventCallback(async function closeDialog2(dialog, result) {
643
+ const entryToClose = dialogMetadata.current.get(dialog);
644
+ if (!entryToClose) {
645
+ throw new Error("Dialog not found in stack");
1927
646
  }
1928
- return dateAdapter;
1929
- }, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentAdapter]);
1930
- const defaultDates = React11.useMemo(() => {
1931
- if (!adapter) {
1932
- return null;
647
+ try {
648
+ await entryToClose.onClose(result);
649
+ } finally {
650
+ entryToClose.resolve(result);
651
+ closeDialogUi(dialog);
1933
652
  }
1934
- return {
1935
- minDate: adapter.date("1900-01-01T00:00:00.000"),
1936
- maxDate: adapter.date("2099-12-31T00:00:00.000")
1937
- };
1938
- }, [adapter]);
1939
- const contextValue = React11.useMemo(() => {
1940
- return {
1941
- utils: adapter,
1942
- adapter,
1943
- defaultDates,
1944
- localeText
1945
- };
1946
- }, [defaultDates, adapter, localeText]);
1947
- return /* @__PURE__ */ _jsx(PickerAdapterContext.Provider, {
1948
- value: contextValue,
1949
- children
653
+ return dialog;
1950
654
  });
655
+ const contextValue = useMemo(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
656
+ return /* @__PURE__ */ jsxs10(DialogsContext.Provider, { value: contextValue, children: [
657
+ children,
658
+ stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx20(
659
+ Component7,
660
+ {
661
+ payload,
662
+ open,
663
+ onClose: async (result) => {
664
+ await closeDialog(promise, result);
665
+ }
666
+ },
667
+ key
668
+ ))
669
+ ] });
670
+ }
671
+
672
+ // src/providers/LayoutProvider.tsx
673
+ import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
674
+ var LayoutProvider = (props) => {
675
+ const [user, setUser] = useState6({ employeeId: "", name: "Unknown", department: "", company: "", category: "" });
676
+ const { t: t2 } = useTranslation4();
677
+ const navigation = props.getNavigation?.({ user, t: t2 });
678
+ useEffect4(() => {
679
+ z.config(i18n.resolvedLanguage === "cs" ? cs() : en());
680
+ }, []);
681
+ return /* @__PURE__ */ jsx21(I18nextProvider, { i18n, children: /* @__PURE__ */ jsx21(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: i18n.resolvedLanguage, children: /* @__PURE__ */ jsx21(LayoutContext.Provider, { value: { user: { get: user, set: setUser } }, children: /* @__PURE__ */ jsxs11(Layout, { navigation, theme: props.theme, children: [
682
+ "\xA8",
683
+ /* @__PURE__ */ jsx21(DialogsProvider, { children: props.children })
684
+ ] }) }) }) });
1951
685
  };
1952
- if (process.env.NODE_ENV !== "production") LocalizationProvider.displayName = "LocalizationProvider";
1953
- process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
1954
- // ----------------------------- Warning --------------------------------
1955
- // | These PropTypes are generated from the TypeScript type definitions |
1956
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
1957
- // ----------------------------------------------------------------------
1958
- /**
1959
- * Locale for the date library you are using
1960
- */
1961
- adapterLocale: import_prop_types.default.any,
1962
- children: import_prop_types.default.node,
1963
- /**
1964
- * Date library adapter class function.
1965
- * @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.
1966
- */
1967
- dateAdapter: import_prop_types.default.func,
1968
- /**
1969
- * Formats that are used for any child pickers
1970
- */
1971
- dateFormats: import_prop_types.default.shape({
1972
- dayOfMonth: import_prop_types.default.string,
1973
- dayOfMonthFull: import_prop_types.default.string,
1974
- fullDate: import_prop_types.default.string,
1975
- fullTime12h: import_prop_types.default.string,
1976
- fullTime24h: import_prop_types.default.string,
1977
- hours12h: import_prop_types.default.string,
1978
- hours24h: import_prop_types.default.string,
1979
- keyboardDate: import_prop_types.default.string,
1980
- keyboardDateTime12h: import_prop_types.default.string,
1981
- keyboardDateTime24h: import_prop_types.default.string,
1982
- meridiem: import_prop_types.default.string,
1983
- minutes: import_prop_types.default.string,
1984
- month: import_prop_types.default.string,
1985
- monthShort: import_prop_types.default.string,
1986
- normalDate: import_prop_types.default.string,
1987
- normalDateWithWeekday: import_prop_types.default.string,
1988
- seconds: import_prop_types.default.string,
1989
- shortDate: import_prop_types.default.string,
1990
- weekday: import_prop_types.default.string,
1991
- weekdayShort: import_prop_types.default.string,
1992
- year: import_prop_types.default.string
1993
- }),
1994
- /**
1995
- * Date library instance you are using, if it has some global overrides
1996
- * ```jsx
1997
- * dateLibInstance={momentTimeZone}
1998
- * ```
1999
- */
2000
- dateLibInstance: import_prop_types.default.any,
2001
- /**
2002
- * Locale for components texts
2003
- */
2004
- localeText: import_prop_types.default.object
2005
- } : void 0;
2006
686
 
2007
- // node_modules/@mui/x-internals/esm/warning/warning.js
2008
- var warnedOnceCache = /* @__PURE__ */ new Set();
2009
- function warnOnce(message, gravity = "warning") {
2010
- if (process.env.NODE_ENV === "production") {
2011
- return;
687
+ // src/index.ts
688
+ import { uuidv7 as uuidv72 } from "uuidv7";
689
+
690
+ // src/utils/ClientUtils.ts
691
+ import axios from "axios";
692
+ var Platform = class {
693
+ static get isAndroid() {
694
+ return /android/i.test(this.userAgent);
2012
695
  }
2013
- const cleanMessage = Array.isArray(message) ? message.join("\n") : message;
2014
- if (!warnedOnceCache.has(cleanMessage)) {
2015
- warnedOnceCache.add(cleanMessage);
2016
- if (gravity === "error") {
2017
- console.error(cleanMessage);
2018
- } else {
2019
- console.warn(cleanMessage);
2020
- }
696
+ static get isIOS() {
697
+ return /iPad|iPhone|iPod/.test(this.userAgent);
2021
698
  }
2022
- }
699
+ static get isWindows() {
700
+ return /windows/i.test(this.userAgent);
701
+ }
702
+ static get isMacOS() {
703
+ return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);
704
+ }
705
+ static get userAgent() {
706
+ return typeof navigator === "undefined" ? "" : navigator.userAgent;
707
+ }
708
+ };
709
+ var rootRouteHead = ({ title }) => () => ({
710
+ meta: [
711
+ { charSet: "utf-8" },
712
+ { name: "viewport", content: "width=device-width, initial-scale=1" },
713
+ { title },
714
+ { name: "og:type", content: "website" },
715
+ { name: "og:title", content: title },
716
+ { name: "og:image", content: "/favicon-32x32.png" }
717
+ ],
718
+ links: [
719
+ { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
720
+ { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" },
721
+ { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" },
722
+ { rel: "manifest", href: "/site.webmanifest" },
723
+ { rel: "icon", href: "/favicon.ico" }
724
+ ]
725
+ });
726
+ var wczApiClient = axios.create();
2023
727
 
2024
- // node_modules/@mui/x-date-pickers/esm/AdapterDayjs/AdapterDayjs.js
2025
- import dayjs from "dayjs";
2026
- import weekOfYearPlugin from "dayjs/plugin/weekOfYear.js";
2027
- import customParseFormatPlugin from "dayjs/plugin/customParseFormat.js";
2028
- import localizedFormatPlugin from "dayjs/plugin/localizedFormat.js";
2029
- import isBetweenPlugin from "dayjs/plugin/isBetween.js";
2030
- import advancedFormatPlugin from "dayjs/plugin/advancedFormat.js";
2031
- dayjs.extend(localizedFormatPlugin);
2032
- dayjs.extend(weekOfYearPlugin);
2033
- dayjs.extend(isBetweenPlugin);
2034
- dayjs.extend(advancedFormatPlugin);
2035
- var formatTokenMap = {
2036
- // Year
2037
- YY: "year",
2038
- YYYY: {
2039
- sectionType: "year",
2040
- contentType: "digit",
2041
- maxLength: 4
2042
- },
2043
- // Month
2044
- M: {
2045
- sectionType: "month",
2046
- contentType: "digit",
2047
- maxLength: 2
2048
- },
2049
- MM: "month",
2050
- MMM: {
2051
- sectionType: "month",
2052
- contentType: "letter"
2053
- },
2054
- MMMM: {
2055
- sectionType: "month",
2056
- contentType: "letter"
2057
- },
2058
- // Day of the month
2059
- D: {
2060
- sectionType: "day",
2061
- contentType: "digit",
2062
- maxLength: 2
2063
- },
2064
- DD: "day",
2065
- Do: {
2066
- sectionType: "day",
2067
- contentType: "digit-with-letter"
2068
- },
2069
- // Day of the week
2070
- d: {
2071
- sectionType: "weekDay",
2072
- contentType: "digit",
2073
- maxLength: 2
2074
- },
2075
- dd: {
2076
- sectionType: "weekDay",
2077
- contentType: "letter"
2078
- },
2079
- ddd: {
2080
- sectionType: "weekDay",
2081
- contentType: "letter"
2082
- },
2083
- dddd: {
2084
- sectionType: "weekDay",
2085
- contentType: "letter"
2086
- },
2087
- // Meridiem
2088
- A: "meridiem",
2089
- a: "meridiem",
2090
- // Hours
2091
- H: {
2092
- sectionType: "hours",
2093
- contentType: "digit",
2094
- maxLength: 2
2095
- },
2096
- HH: "hours",
2097
- h: {
2098
- sectionType: "hours",
2099
- contentType: "digit",
2100
- maxLength: 2
2101
- },
2102
- hh: "hours",
2103
- // Minutes
2104
- m: {
2105
- sectionType: "minutes",
2106
- contentType: "digit",
2107
- maxLength: 2
728
+ // src/hooks/FormHooks.ts
729
+ import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
730
+ import { FormAutocomplete as Autocomplete } from "~/components/form/FormAutocomplete";
731
+ import { FormCheckbox as Checkbox } from "~/components/form/FormCheckbox";
732
+ import { FormDatePicker as DatePicker } from "~/components/form/FormDatePicker";
733
+ import { FormDateTimePicker as DateTimePicker } from "~/components/form/FormDateTimePicker";
734
+ import { FormNumberField as NumberField } from "~/components/form/FormNumberField";
735
+ import { FormRadioGroup as RadioGroup } from "~/components/form/FormRadioGroup";
736
+ import { FormSlider as Slider } from "~/components/form/FormSlider";
737
+ import { FormSubmitButton as SubmitButton } from "~/components/form/FormSubmitButton";
738
+ import { FormSwitch as Switch } from "~/components/form/FormSwitch";
739
+ import { FormTextField as TextField } from "~/components/form/FormTextField";
740
+ var { fieldContext, useFieldContext, formContext, useFormContext } = createFormHookContexts();
741
+ var { useAppForm: useLayoutForm, withForm: withLayoutForm } = createFormHook({
742
+ fieldComponents: {
743
+ TextField,
744
+ NumberField,
745
+ Autocomplete,
746
+ Checkbox,
747
+ Switch,
748
+ RadioGroup,
749
+ Slider,
750
+ DatePicker,
751
+ DateTimePicker
2108
752
  },
2109
- mm: "minutes",
2110
- // Seconds
2111
- s: {
2112
- sectionType: "seconds",
2113
- contentType: "digit",
2114
- maxLength: 2
753
+ formComponents: {
754
+ SubmitButton
2115
755
  },
2116
- ss: "seconds"
756
+ fieldContext,
757
+ formContext
758
+ });
759
+
760
+ // src/hooks/DialogsHooks.tsx
761
+ import Button2 from "@mui/material/Button";
762
+ import Dialog2 from "@mui/material/Dialog";
763
+ import DialogActions from "@mui/material/DialogActions";
764
+ import DialogContent from "@mui/material/DialogContent";
765
+ import DialogTitle from "@mui/material/DialogTitle";
766
+ import useEventCallback2 from "@mui/utils/useEventCallback";
767
+ import { useContext, useMemo as useMemo2 } from "react";
768
+ import { useTranslation as useTranslation5 } from "react-i18next";
769
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
770
+ function AlertDialog({ open, payload, onClose }) {
771
+ const { t: t2 } = useTranslation5();
772
+ return /* @__PURE__ */ jsxs12(Dialog2, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(), children: [
773
+ /* @__PURE__ */ jsx22(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Alert") }),
774
+ /* @__PURE__ */ jsx22(DialogContent, { children: payload.message }),
775
+ /* @__PURE__ */ jsx22(DialogActions, { children: /* @__PURE__ */ jsx22(Button2, { disabled: !open, onClick: () => onClose(), children: t2("Layout.Dialog.Confirm") }) })
776
+ ] });
777
+ }
778
+ function ConfirmDialog({ open, payload, onClose }) {
779
+ const { t: t2 } = useTranslation5();
780
+ return /* @__PURE__ */ jsxs12(Dialog2, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(false), children: [
781
+ /* @__PURE__ */ jsx22(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Confirm") }),
782
+ /* @__PURE__ */ jsx22(DialogContent, { children: payload.message }),
783
+ /* @__PURE__ */ jsxs12(DialogActions, { children: [
784
+ /* @__PURE__ */ jsx22(Button2, { autoFocus: true, disabled: !open, onClick: () => onClose(false), children: payload.cancelText ?? t2("Layout.Dialog.Cancel") }),
785
+ /* @__PURE__ */ jsx22(Button2, { disabled: !open, onClick: () => onClose(true), children: t2("Layout.Dialog.Confirm") })
786
+ ] })
787
+ ] });
788
+ }
789
+ function useDialogs2() {
790
+ const { open, close } = useContext(DialogsContext);
791
+ const alert = useEventCallback2(
792
+ (message, { ...options } = {}) => open(AlertDialog, { ...options, message })
793
+ );
794
+ const confirm = useEventCallback2(
795
+ (message, { ...options } = {}) => open(ConfirmDialog, { ...options, message })
796
+ );
797
+ return useMemo2(() => ({ alert, confirm, open, close }), [alert, close, confirm, open]);
798
+ }
799
+
800
+ // src/index.ts
801
+ import { default as default2 } from "use-local-storage-state";
802
+ import { useTranslation as useTranslation6 } from "react-i18next";
803
+ import { t } from "i18next";
804
+
805
+ // src/hooks/FileHooks.ts
806
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
807
+ import saveAs from "file-saver";
808
+ import { useState as useState7 } from "react";
809
+ import { Upload as TusUpload } from "tus-js-client";
810
+ import { uuidv7 } from "uuidv7";
811
+ import { useAppTitle } from "~/components/core/AppTitle";
812
+ import { wczApiClient as wczApiClient2 } from "~/utils/ClientUtils";
813
+ var BASE_URL = import.meta.env.VITE_FILE_API_BASE_URL;
814
+ var QUERY_KEY = "Files";
815
+ var HOUR = 1e3 * 60 * 60;
816
+ var useGetFileMetas2 = (subId, options) => {
817
+ const appTitle = useAppTitle();
818
+ return useQuery({
819
+ ...options,
820
+ queryKey: [QUERY_KEY, "meta", subId, appTitle],
821
+ queryFn: ({ signal }) => wczApiClient2.request({
822
+ url: `${BASE_URL}/v1/meta?appName=${appTitle}&subId=${subId}`,
823
+ method: "GET",
824
+ signal
825
+ }),
826
+ staleTime: HOUR,
827
+ gcTime: HOUR,
828
+ refetchOnWindowFocus: false
829
+ });
2117
830
  };
2118
- var defaultFormats = {
2119
- year: "YYYY",
2120
- month: "MMMM",
2121
- monthShort: "MMM",
2122
- dayOfMonth: "D",
2123
- dayOfMonthFull: "Do",
2124
- weekday: "dddd",
2125
- weekdayShort: "dd",
2126
- hours24h: "HH",
2127
- hours12h: "hh",
2128
- meridiem: "A",
2129
- minutes: "mm",
2130
- seconds: "ss",
2131
- fullDate: "ll",
2132
- keyboardDate: "L",
2133
- shortDate: "MMM D",
2134
- normalDate: "D MMMM",
2135
- normalDateWithWeekday: "ddd, MMM D",
2136
- fullTime12h: "hh:mm A",
2137
- fullTime24h: "HH:mm",
2138
- keyboardDateTime12h: "L hh:mm A",
2139
- keyboardDateTime24h: "L HH:mm"
831
+ var useGetFileThumbnail2 = (meta, options) => {
832
+ const appTitle = useAppTitle();
833
+ return useQuery({
834
+ ...options,
835
+ queryKey: [QUERY_KEY, "thumbnail", meta?.id, appTitle],
836
+ queryFn: ({ signal }) => wczApiClient2.request({
837
+ url: `${BASE_URL}/v1/thumbnail?appName=${appTitle}&id=${meta?.id}`,
838
+ method: "GET",
839
+ signal,
840
+ responseType: "blob"
841
+ }),
842
+ select: (data) => URL.createObjectURL(data),
843
+ staleTime: HOUR,
844
+ gcTime: HOUR,
845
+ refetchOnWindowFocus: false,
846
+ enabled: !!meta?.id && options?.enabled
847
+ });
2140
848
  };
2141
- 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");
2142
- 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");
2143
- var AdapterDayjs = class {
2144
- isMUIAdapter = true;
2145
- isTimezoneCompatible = true;
2146
- lib = "dayjs";
2147
- escapedCharacters = {
2148
- start: "[",
2149
- end: "]"
2150
- };
2151
- formatTokenMap = /* @__PURE__ */ (() => formatTokenMap)();
2152
- constructor({
2153
- locale,
2154
- formats
2155
- } = {}) {
2156
- this.locale = locale;
2157
- this.formats = _extends({}, defaultFormats, formats);
2158
- dayjs.extend(customParseFormatPlugin);
2159
- }
2160
- setLocaleToValue = (value) => {
2161
- const expectedLocale = this.getCurrentLocaleCode();
2162
- if (expectedLocale === value.locale()) {
2163
- return value;
2164
- }
2165
- return value.locale(expectedLocale);
2166
- };
2167
- hasUTCPlugin = () => typeof dayjs.utc !== "undefined";
2168
- hasTimezonePlugin = () => typeof dayjs.tz !== "undefined";
2169
- isSame = (value, comparing, comparisonTemplate) => {
2170
- const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
2171
- return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
2172
- };
2173
- /**
2174
- * Replaces "default" by undefined and "system" by the system timezone before passing it to `dayjs`.
2175
- */
2176
- cleanTimezone = (timezone) => {
2177
- switch (timezone) {
2178
- case "default": {
2179
- return void 0;
2180
- }
2181
- case "system": {
2182
- return dayjs.tz.guess();
2183
- }
2184
- default: {
2185
- return timezone;
2186
- }
2187
- }
2188
- };
2189
- createSystemDate = (value) => {
2190
- let date;
2191
- if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
2192
- const timezone = dayjs.tz.guess();
2193
- if (timezone === "UTC") {
2194
- date = dayjs(value);
2195
- } else {
2196
- date = dayjs.tz(value, timezone);
2197
- }
2198
- } else {
2199
- date = dayjs(value);
2200
- }
2201
- return this.setLocaleToValue(date);
2202
- };
2203
- createUTCDate = (value) => {
2204
- if (!this.hasUTCPlugin()) {
2205
- throw new Error(MISSING_UTC_PLUGIN);
2206
- }
2207
- return this.setLocaleToValue(dayjs.utc(value));
2208
- };
2209
- createTZDate = (value, timezone) => {
2210
- if (!this.hasUTCPlugin()) {
2211
- throw new Error(MISSING_UTC_PLUGIN);
2212
- }
2213
- if (!this.hasTimezonePlugin()) {
2214
- throw new Error(MISSING_TIMEZONE_PLUGIN);
2215
- }
2216
- const keepLocalTime = value !== void 0 && !value.endsWith("Z");
2217
- return this.setLocaleToValue(dayjs(value).tz(this.cleanTimezone(timezone), keepLocalTime));
2218
- };
2219
- getLocaleFormats = () => {
2220
- const locales = dayjs.Ls;
2221
- const locale = this.locale || "en";
2222
- let localeObject = locales[locale];
2223
- if (localeObject === void 0) {
2224
- if (process.env.NODE_ENV !== "production") {
2225
- 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."]);
2226
- }
2227
- localeObject = locales.en;
2228
- }
2229
- return localeObject.formats;
2230
- };
2231
- /**
2232
- * If the new day does not have the same offset as the old one (when switching to summer day time for example),
2233
- * Then dayjs will not automatically adjust the offset (moment does).
2234
- * We have to parse again the value to make sure the `fixOffset` method is applied.
2235
- * See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
2236
- */
2237
- adjustOffset = (value) => {
2238
- if (!this.hasTimezonePlugin()) {
2239
- return value;
2240
- }
2241
- const timezone = this.getTimezone(value);
2242
- if (timezone !== "UTC") {
2243
- const fixedValue = value.tz(this.cleanTimezone(timezone), true);
2244
- if (fixedValue.$offset === (value.$offset ?? 0)) {
2245
- return value;
2246
- }
2247
- value.$offset = fixedValue.$offset;
2248
- }
2249
- return value;
2250
- };
2251
- date = (value, timezone = "default") => {
2252
- if (value === null) {
2253
- return null;
2254
- }
2255
- if (timezone === "UTC") {
2256
- return this.createUTCDate(value);
2257
- }
2258
- if (timezone === "system" || timezone === "default" && !this.hasTimezonePlugin()) {
2259
- return this.createSystemDate(value);
2260
- }
2261
- return this.createTZDate(value, timezone);
2262
- };
2263
- getInvalidDate = () => dayjs(/* @__PURE__ */ new Date("Invalid date"));
2264
- getTimezone = (value) => {
2265
- if (this.hasTimezonePlugin()) {
2266
- const zone = value.$x?.$timezone;
2267
- if (zone) {
2268
- return zone;
2269
- }
2270
- }
2271
- if (this.hasUTCPlugin() && value.isUTC()) {
2272
- return "UTC";
2273
- }
2274
- return "system";
2275
- };
2276
- setTimezone = (value, timezone) => {
2277
- if (this.getTimezone(value) === timezone) {
2278
- return value;
2279
- }
2280
- if (timezone === "UTC") {
2281
- if (!this.hasUTCPlugin()) {
2282
- throw new Error(MISSING_UTC_PLUGIN);
2283
- }
2284
- return value.utc();
2285
- }
2286
- if (timezone === "system") {
2287
- return value.local();
2288
- }
2289
- if (!this.hasTimezonePlugin()) {
2290
- if (timezone === "default") {
2291
- return value;
2292
- }
2293
- throw new Error(MISSING_TIMEZONE_PLUGIN);
2294
- }
2295
- return this.setLocaleToValue(dayjs.tz(value, this.cleanTimezone(timezone)));
2296
- };
2297
- toJsDate = (value) => {
2298
- return value.toDate();
2299
- };
2300
- parse = (value, format) => {
2301
- if (value === "") {
2302
- return null;
2303
- }
2304
- return dayjs(value, format, this.locale, true);
2305
- };
2306
- getCurrentLocaleCode = () => {
2307
- return this.locale || "en";
2308
- };
2309
- is12HourCycleInCurrentLocale = () => {
2310
- return /A|a/.test(this.getLocaleFormats().LT || "");
2311
- };
2312
- expandFormat = (format) => {
2313
- const localeFormats = this.getLocaleFormats();
2314
- const t2 = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
2315
- return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
2316
- const B = b && b.toUpperCase();
2317
- return a || localeFormats[b] || t2(localeFormats[B]);
2318
- });
2319
- };
2320
- isValid = (value) => {
2321
- if (value == null) {
2322
- return false;
2323
- }
2324
- return value.isValid();
2325
- };
2326
- format = (value, formatKey) => {
2327
- return this.formatByString(value, this.formats[formatKey]);
2328
- };
2329
- formatByString = (value, formatString) => {
2330
- return this.setLocaleToValue(value).format(formatString);
2331
- };
2332
- formatNumber = (numberToFormat) => {
2333
- return numberToFormat;
2334
- };
2335
- isEqual = (value, comparing) => {
2336
- if (value === null && comparing === null) {
2337
- return true;
2338
- }
2339
- if (value === null || comparing === null) {
2340
- return false;
2341
- }
2342
- return value.toDate().getTime() === comparing.toDate().getTime();
2343
- };
2344
- isSameYear = (value, comparing) => {
2345
- return this.isSame(value, comparing, "YYYY");
2346
- };
2347
- isSameMonth = (value, comparing) => {
2348
- return this.isSame(value, comparing, "YYYY-MM");
2349
- };
2350
- isSameDay = (value, comparing) => {
2351
- return this.isSame(value, comparing, "YYYY-MM-DD");
2352
- };
2353
- isSameHour = (value, comparing) => {
2354
- return value.isSame(comparing, "hour");
2355
- };
2356
- isAfter = (value, comparing) => {
2357
- return value > comparing;
2358
- };
2359
- isAfterYear = (value, comparing) => {
2360
- if (!this.hasUTCPlugin()) {
2361
- return value.isAfter(comparing, "year");
2362
- }
2363
- return !this.isSameYear(value, comparing) && value.utc() > comparing.utc();
2364
- };
2365
- isAfterDay = (value, comparing) => {
2366
- if (!this.hasUTCPlugin()) {
2367
- return value.isAfter(comparing, "day");
2368
- }
2369
- return !this.isSameDay(value, comparing) && value.utc() > comparing.utc();
2370
- };
2371
- isBefore = (value, comparing) => {
2372
- return value < comparing;
2373
- };
2374
- isBeforeYear = (value, comparing) => {
2375
- if (!this.hasUTCPlugin()) {
2376
- return value.isBefore(comparing, "year");
2377
- }
2378
- return !this.isSameYear(value, comparing) && value.utc() < comparing.utc();
2379
- };
2380
- isBeforeDay = (value, comparing) => {
2381
- if (!this.hasUTCPlugin()) {
2382
- return value.isBefore(comparing, "day");
2383
- }
2384
- return !this.isSameDay(value, comparing) && value.utc() < comparing.utc();
2385
- };
2386
- isWithinRange = (value, [start, end]) => {
2387
- return value >= start && value <= end;
2388
- };
2389
- startOfYear = (value) => {
2390
- return this.adjustOffset(value.startOf("year"));
2391
- };
2392
- startOfMonth = (value) => {
2393
- return this.adjustOffset(value.startOf("month"));
2394
- };
2395
- startOfWeek = (value) => {
2396
- return this.adjustOffset(this.setLocaleToValue(value).startOf("week"));
2397
- };
2398
- startOfDay = (value) => {
2399
- return this.adjustOffset(value.startOf("day"));
2400
- };
2401
- endOfYear = (value) => {
2402
- return this.adjustOffset(value.endOf("year"));
2403
- };
2404
- endOfMonth = (value) => {
2405
- return this.adjustOffset(value.endOf("month"));
2406
- };
2407
- endOfWeek = (value) => {
2408
- return this.adjustOffset(this.setLocaleToValue(value).endOf("week"));
2409
- };
2410
- endOfDay = (value) => {
2411
- return this.adjustOffset(value.endOf("day"));
2412
- };
2413
- addYears = (value, amount) => {
2414
- return this.adjustOffset(value.add(amount, "year"));
2415
- };
2416
- addMonths = (value, amount) => {
2417
- return this.adjustOffset(value.add(amount, "month"));
2418
- };
2419
- addWeeks = (value, amount) => {
2420
- return this.adjustOffset(value.add(amount, "week"));
2421
- };
2422
- addDays = (value, amount) => {
2423
- return this.adjustOffset(value.add(amount, "day"));
2424
- };
2425
- addHours = (value, amount) => {
2426
- return this.adjustOffset(value.add(amount, "hour"));
2427
- };
2428
- addMinutes = (value, amount) => {
2429
- return this.adjustOffset(value.add(amount, "minute"));
2430
- };
2431
- addSeconds = (value, amount) => {
2432
- return this.adjustOffset(value.add(amount, "second"));
2433
- };
2434
- getYear = (value) => {
2435
- return value.year();
2436
- };
2437
- getMonth = (value) => {
2438
- return value.month();
2439
- };
2440
- getDate = (value) => {
2441
- return value.date();
2442
- };
2443
- getHours = (value) => {
2444
- return value.hour();
2445
- };
2446
- getMinutes = (value) => {
2447
- return value.minute();
2448
- };
2449
- getSeconds = (value) => {
2450
- return value.second();
2451
- };
2452
- getMilliseconds = (value) => {
2453
- return value.millisecond();
2454
- };
2455
- setYear = (value, year) => {
2456
- return this.adjustOffset(value.set("year", year));
2457
- };
2458
- setMonth = (value, month) => {
2459
- return this.adjustOffset(value.set("month", month));
2460
- };
2461
- setDate = (value, date) => {
2462
- return this.adjustOffset(value.set("date", date));
2463
- };
2464
- setHours = (value, hours) => {
2465
- return this.adjustOffset(value.set("hour", hours));
2466
- };
2467
- setMinutes = (value, minutes) => {
2468
- return this.adjustOffset(value.set("minute", minutes));
2469
- };
2470
- setSeconds = (value, seconds) => {
2471
- return this.adjustOffset(value.set("second", seconds));
2472
- };
2473
- setMilliseconds = (value, milliseconds) => {
2474
- return this.adjustOffset(value.set("millisecond", milliseconds));
2475
- };
2476
- getDaysInMonth = (value) => {
2477
- return value.daysInMonth();
2478
- };
2479
- getWeekArray = (value) => {
2480
- const start = this.startOfWeek(this.startOfMonth(value));
2481
- const end = this.endOfWeek(this.endOfMonth(value));
2482
- let count = 0;
2483
- let current = start;
2484
- const nestedWeeks = [];
2485
- while (current < end) {
2486
- const weekNumber = Math.floor(count / 7);
2487
- nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
2488
- nestedWeeks[weekNumber].push(current);
2489
- current = this.addDays(current, 1);
2490
- count += 1;
2491
- }
2492
- return nestedWeeks;
2493
- };
2494
- getWeekNumber = (value) => {
2495
- return value.week();
2496
- };
2497
- getDayOfWeek(value) {
2498
- return value.day() + 1;
2499
- }
2500
- getYearRange = ([start, end]) => {
2501
- const startDate = this.startOfYear(start);
2502
- const endDate = this.endOfYear(end);
2503
- const years = [];
2504
- let current = startDate;
2505
- while (this.isBefore(current, endDate)) {
2506
- years.push(current);
2507
- current = this.addYears(current, 1);
2508
- }
2509
- return years;
2510
- };
2511
- };
2512
-
2513
- // src/providers/LayoutProvider.tsx
2514
- import { useEffect as useEffect6, useState as useState10 } from "react";
2515
- import { I18nextProvider, useTranslation as useTranslation7 } from "react-i18next";
2516
- import * as z from "zod";
2517
- import { cs, en } from "zod/locales";
2518
-
2519
- // src/components/core/Layout.tsx
2520
- import Menu3 from "@mui/icons-material/Menu";
2521
- import MenuOpen from "@mui/icons-material/MenuOpen";
2522
- import { AppBar, Box as Box9, CssBaseline, IconButton as IconButton5, InitColorSchemeScript, LinearProgress, Toolbar } from "@mui/material";
2523
- import { ThemeProvider, styled as styled2 } from "@mui/material/styles";
2524
- import { useIsFetching, useIsMutating } from "@tanstack/react-query";
2525
- import useLocalStorageState from "use-local-storage-state";
2526
-
2527
- // src/hooks/ThemeHook.ts
2528
- import { createTheme, darken, lighten } from "@mui/material";
2529
- import { grey as grey2 } from "@mui/material/colors";
2530
- import { csCZ, enUS } from "@mui/material/locale";
2531
- import { csCZ as dataGridCsCz, enUS as dataGridEnUs } from "@mui/x-data-grid-premium/locales";
2532
- import { csCZ as datePickersCsCz, enUS as datePickersEnUs } from "@mui/x-date-pickers-pro/locales";
2533
- import { useTranslation as useTranslation5 } from "react-i18next";
2534
- var WISTRON_PRIMARY_COLOR = "#00506E";
2535
- var WISTRON_SECONDARY_COLOR = "#64DC00";
2536
- var useGetTheme = (theme) => {
2537
- const { i18n: i18n2 } = useTranslation5();
2538
- return createTheme(
2539
- {
2540
- cssVariables: {
2541
- colorSchemeSelector: "data-mui-color-scheme"
2542
- },
2543
- colorSchemes: {
2544
- light: {
2545
- palette: {
2546
- primary: { main: WISTRON_PRIMARY_COLOR },
2547
- secondary: { main: WISTRON_SECONDARY_COLOR }
2548
- }
2549
- },
2550
- dark: {
2551
- palette: {
2552
- primary: { main: lighten(WISTRON_PRIMARY_COLOR, 0.5) },
2553
- secondary: { main: darken(WISTRON_SECONDARY_COLOR, 0.5) }
2554
- }
2555
- },
2556
- ...theme?.colorSchemes
2557
- },
2558
- components: {
2559
- MuiCssBaseline: {
2560
- styleOverrides: (theme2) => {
2561
- return {
2562
- body: {
2563
- "&::-webkit-scrollbar, & *::-webkit-scrollbar": {
2564
- width: "0.7em",
2565
- height: "0.7em"
2566
- },
2567
- "&::-webkit-scrollbar-track, & *::-webkit-scrollbar-track": {
2568
- backgroundColor: theme2.palette.mode === "dark" ? grey2[900] : grey2[200],
2569
- borderRadius: "5px"
2570
- },
2571
- "&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb": {
2572
- backgroundColor: theme2.palette.mode === "dark" ? grey2[800] : grey2[400],
2573
- borderRadius: "10px"
2574
- },
2575
- "&::-webkit-scrollbar-thumb:hover, & *::-webkit-scrollbar-thumb:hover": {
2576
- backgroundColor: theme2.palette.mode === "dark" ? grey2[700] : grey2[500]
2577
- },
2578
- "&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": {
2579
- backgroundColor: "transparent"
2580
- }
2581
- }
2582
- };
2583
- }
2584
- },
2585
- ...theme?.components
2586
- }
2587
- },
2588
- i18n2.resolvedLanguage === "cs" ? datePickersCsCz : datePickersEnUs,
2589
- i18n2.resolvedLanguage === "cs" ? dataGridCsCz : dataGridEnUs,
2590
- i18n2.resolvedLanguage === "cs" ? csCZ : enUS
2591
- );
2592
- };
2593
-
2594
- // src/components/core/navigation/NavigationRail.tsx
2595
- import { useMediaQuery } from "@mui/material";
2596
- import Box7 from "@mui/material/Box";
2597
- import Drawer from "@mui/material/Drawer";
2598
- import { useTheme as useTheme2 } from "@mui/material/styles";
2599
- import { useNavigate, useRouterState as useRouterState2 } from "@tanstack/react-router";
2600
-
2601
- // src/components/core/navigation/NavigationList.tsx
2602
- import Divider3 from "@mui/material/Divider";
2603
- import List3 from "@mui/material/List";
2604
- import ListSubheader from "@mui/material/ListSubheader";
2605
- import { Fragment as Fragment5, useEffect as useEffect5, useState as useState7 } from "react";
2606
-
2607
- // src/components/core/navigation/NavigationListItem.tsx
2608
- import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
2609
- import Avatar from "@mui/material/Avatar";
2610
- import Box6 from "@mui/material/Box";
2611
- import Popper from "@mui/material/Popper";
2612
- import ListItem from "@mui/material/ListItem";
2613
- import ListItemButton4 from "@mui/material/ListItemButton";
2614
- import ListItemIcon3 from "@mui/material/ListItemIcon";
2615
- import ListItemText3 from "@mui/material/ListItemText";
2616
- import Paper2 from "@mui/material/Paper";
2617
- import { styled } from "@mui/material/styles";
2618
- import Typography7 from "@mui/material/Typography";
2619
- import { Fragment as Fragment3, useMemo as useMemo3, useState as useState6 } from "react";
2620
- import { Collapse } from "@mui/material";
2621
- import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
2622
- var ICON_SIZE = 34;
2623
- var StyledNavButton = styled(ListItemButton4)(({ theme }) => ({
2624
- borderRadius: 8,
2625
- "&.Mui-selected": {
2626
- "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
2627
- color: (theme.vars ?? theme).palette.primary.dark
2628
- },
2629
- "& .MuiAvatar-root": {
2630
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
2631
- },
2632
- "& .MuiTouchRipple-child": {
2633
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
2634
- }
2635
- },
2636
- "& .MuiSvgIcon-root": {
2637
- color: (theme.vars ?? theme).palette.action.active
2638
- },
2639
- "& .MuiAvatar-root": {
2640
- backgroundColor: (theme.vars ?? theme).palette.action.active
2641
- }
2642
- }));
2643
- var StyledRouterButton = styled(RouterListItemButton)(({ theme }) => ({
2644
- borderRadius: 8,
2645
- "&.Mui-selected": {
2646
- "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": {
2647
- color: (theme.vars ?? theme).palette.primary.dark
2648
- },
2649
- "& .MuiAvatar-root": {
2650
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
2651
- },
2652
- "& .MuiTouchRipple-child": {
2653
- backgroundColor: (theme.vars ?? theme).palette.primary.dark
2654
- }
2655
- },
2656
- "& .MuiSvgIcon-root": {
2657
- color: (theme.vars ?? theme).palette.action.active
2658
- },
2659
- "& .MuiAvatar-root": {
2660
- backgroundColor: (theme.vars ?? theme).palette.action.active
2661
- }
2662
- }));
2663
- var IconOrAvatar = ({ item, collapsed }) => {
2664
- if (item.icon || collapsed) {
2665
- return /* @__PURE__ */ jsxs12(Box6, { sx: collapsed ? { position: "absolute", left: "50%", top: "calc(50% - 6px)", transform: "translate(-50%, -50%)" } : {}, children: [
2666
- /* @__PURE__ */ jsxs12(ListItemIcon3, { sx: { display: "flex", alignItems: "center", justifyContent: "center", minWidth: ICON_SIZE }, children: [
2667
- item.icon ?? null,
2668
- !item.icon && collapsed ? /* @__PURE__ */ jsx22(Avatar, { sx: { width: ICON_SIZE - 7, height: ICON_SIZE - 7, fontSize: 12 }, children: item.title }) : null
2669
- ] }),
2670
- collapsed ? /* @__PURE__ */ jsx22(
2671
- Typography7,
2672
- {
2673
- variant: "caption",
2674
- sx: {
2675
- position: "absolute",
2676
- bottom: -18,
2677
- left: "50%",
2678
- transform: "translateX(-50%)",
2679
- fontSize: 10,
2680
- fontWeight: 500,
2681
- textAlign: "center",
2682
- whiteSpace: "nowrap",
2683
- overflow: "hidden",
2684
- textOverflow: "ellipsis",
2685
- maxWidth: MINI_WIDTH - 28
2686
- },
2687
- children: item.title
2688
- }
2689
- ) : null
2690
- ] });
2691
- }
2692
- return null;
2693
- };
2694
- var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx22(
2695
- Popper,
2696
- {
2697
- open,
2698
- anchorEl,
2699
- placement: "right-start",
2700
- modifiers: [
2701
- { name: "offset", options: { offset: [6, 0] } },
2702
- { name: "preventOverflow", options: { padding: 8 } },
2703
- { name: "flip", options: { fallbackPlacements: ["right-end", "left-start"] } }
2704
- ],
2705
- children: /* @__PURE__ */ jsx22(
2706
- Paper2,
2707
- {
2708
- sx: {
2709
- pt: 0.5,
2710
- pb: 0.5,
2711
- maxHeight: "min(calc(100vh - 100px), 560px)",
2712
- overflowY: "auto",
2713
- overscrollBehavior: "contain"
2714
- },
2715
- children
2716
- }
2717
- )
2718
- }
2719
- );
2720
- var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, onClick, renderNested }) => {
2721
- const [hoveredPopoverItem, setHoveredPopoverItem] = useState6(null);
2722
- const [anchorElement, setAnchorElement] = useState6(null);
2723
- const chevronSx = useMemo3(() => {
2724
- if (collapsed && isSidebarFullyCollapsed && item.children) {
2725
- return {
2726
- fontSize: 18,
2727
- position: "absolute",
2728
- top: "41.5%",
2729
- right: "2px",
2730
- transform: "translateY(-50%) rotate(-90deg)"
2731
- };
2732
- }
2733
- if (!collapsed && isSidebarFullyExpanded && item.children) {
2734
- return {
2735
- ml: 0.5,
2736
- transform: `rotate(${isOpen ? 0 : -90}deg)`
2737
- };
2738
- }
2739
- return { display: "none" };
2740
- }, [collapsed, isSidebarFullyExpanded, isSidebarFullyCollapsed, isOpen, item.children]);
2741
- const shouldJustExpand = item.children && !collapsed;
2742
- const buttonProps = {
2743
- selected,
2744
- disabled,
2745
- sx: { px: 1.4, height: collapsed ? 60 : 48 }
2746
- };
2747
- const buttonContent = /* @__PURE__ */ jsxs12(Fragment4, { children: [
2748
- /* @__PURE__ */ jsx22(IconOrAvatar, { item, collapsed }),
2749
- !collapsed && /* @__PURE__ */ jsx22(
2750
- ListItemText3,
2751
- {
2752
- primary: item.title,
2753
- slotProps: { primary: { noWrap: true, title: item.title } },
2754
- sx: { ml: 1.2, flex: 1, minWidth: 0, "& .MuiTypography-root": { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }
2755
- }
2756
- ),
2757
- item.children ? /* @__PURE__ */ jsx22(ExpandMoreIcon, { sx: chevronSx }) : null
2758
- ] });
2759
- const listItem = /* @__PURE__ */ jsxs12(
2760
- ListItem,
2761
- {
2762
- ...item.children && collapsed ? {
2763
- onMouseEnter: (event) => {
2764
- setAnchorElement(event.currentTarget);
2765
- setHoveredPopoverItem(item.title);
2766
- },
2767
- onMouseLeave: () => {
2768
- setHoveredPopoverItem(null);
2769
- }
2770
- } : {},
2771
- sx: { py: 0, px: 1, overflowX: "hidden" },
2772
- children: [
2773
- shouldJustExpand ? /* @__PURE__ */ jsx22(StyledNavButton, { ...buttonProps, onClick: () => onClick?.(item), children: buttonContent }) : /* @__PURE__ */ jsx22(
2774
- StyledRouterButton,
2775
- {
2776
- ...buttonProps,
2777
- to: item.to,
2778
- href: item.href,
2779
- params: item.params,
2780
- search: item.search,
2781
- children: buttonContent
2782
- }
2783
- ),
2784
- item.children && collapsed ? /* @__PURE__ */ jsx22(MiniPopover, { open: item.title === hoveredPopoverItem, anchorEl: anchorElement, children: renderNested?.(item.children) }) : null
2785
- ]
2786
- }
2787
- );
2788
- return /* @__PURE__ */ jsxs12(Fragment3, { children: [
2789
- listItem,
2790
- item.children && !collapsed ? /* @__PURE__ */ jsx22(Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true, children: renderNested?.(item.children) }) : null
2791
- ] }, item.to);
849
+ var useGetFile2 = (meta, options) => {
850
+ const appTitle = useAppTitle();
851
+ return useQuery({
852
+ ...options,
853
+ queryKey: [QUERY_KEY, meta?.id, appTitle],
854
+ queryFn: ({ signal }) => wczApiClient2.request({
855
+ url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta?.id}`,
856
+ method: "GET",
857
+ signal,
858
+ responseType: "blob"
859
+ }),
860
+ select: (data) => URL.createObjectURL(data),
861
+ staleTime: HOUR,
862
+ gcTime: HOUR,
863
+ refetchOnWindowFocus: false,
864
+ enabled: !!meta?.id && options?.enabled
865
+ });
2792
866
  };
2793
-
2794
- // src/components/core/navigation/NavigationList.tsx
2795
- import { jsx as jsx23 } from "react/jsx-runtime";
2796
- var isPageItem = (item) => !("kind" in item);
2797
- var isDivider = (item) => "kind" in item && item.kind === "divider";
2798
- var isHeader = (item) => "kind" in item && item.kind === "header";
2799
- var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, expandedWidth, renderItem, activePath, onNavigate }) => {
2800
- const [openKeys, setOpenKeys] = useState7([]);
2801
- useEffect5(() => {
2802
- if (collapsed) setOpenKeys([]);
2803
- }, [collapsed]);
2804
- const toggleKey = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
2805
- const renderNested = (children) => /* @__PURE__ */ jsx23(
2806
- NavigationList,
2807
- {
2808
- subNavigation: children,
2809
- depth: depth + 1,
2810
- isPopover: collapsed,
2811
- expandedWidth,
2812
- activePath,
2813
- onNavigate
2814
- }
2815
- );
2816
- const filteredNavigation = subNavigation.filter((nav) => !nav.hidden);
2817
- return /* @__PURE__ */ jsx23(
2818
- List3,
2819
- {
2820
- sx: {
2821
- padding: 0,
2822
- mt: isPopover && depth === 1 ? 0.5 : 0,
2823
- mb: depth === 0 && !isPopover ? 4 : 0.5,
2824
- pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
2825
- minWidth: isPopover && depth === 1 ? EXPANDED_WIDTH : "auto",
2826
- width: collapsed ? MINI_WIDTH : "auto"
2827
- },
2828
- children: filteredNavigation.map((navItem, index) => {
2829
- if (isHeader(navItem)) {
2830
- return /* @__PURE__ */ jsx23(
2831
- ListSubheader,
2832
- {
2833
- sx: {
2834
- fontSize: 12,
2835
- fontWeight: "700",
2836
- height: collapsed ? 0 : 40,
2837
- px: 2,
2838
- minWidth: expandedWidth,
2839
- overflow: "hidden",
2840
- textOverflow: "ellipsis",
2841
- whiteSpace: "nowrap",
2842
- zIndex: 2,
2843
- bgcolor: "transparent",
2844
- position: "static"
2845
- },
2846
- children: navItem.title
2847
- },
2848
- `subheader-${depth}-${index}`
2849
- );
2850
- }
2851
- if (isDivider(navItem)) {
2852
- const nextItem = filteredNavigation[index + 1];
2853
- return /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsx23(Divider3, { sx: { mx: 1, mt: 1, mb: nextItem && isHeader(nextItem) && !collapsed ? 0 : 1 } }) }, `divider-${depth}-${index}`);
2854
- }
2855
- if (!isPageItem(navItem)) return null;
2856
- const key = `item-${depth}-${index}`;
2857
- const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
2858
- if (renderItem) return /* @__PURE__ */ jsx23(Fragment5, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key);
2859
- return /* @__PURE__ */ jsx23(
2860
- NavigationListItem,
2861
- {
2862
- item: navItem,
2863
- isOpen: openKeys.includes(uniqueItemKey),
2864
- selected: activePath === navItem.to,
2865
- collapsed,
2866
- isSidebarFullyExpanded,
2867
- isSidebarFullyCollapsed,
2868
- onClick: navItem.children && !collapsed ? () => toggleKey(uniqueItemKey) : void 0,
2869
- renderNested
2870
- },
2871
- key
2872
- );
2873
- })
2874
- }
2875
- );
867
+ var useDownloadFile4 = (options) => {
868
+ const appTitle = useAppTitle();
869
+ return useMutation({
870
+ ...options,
871
+ mutationFn: (meta) => wczApiClient2.request({
872
+ url: `${BASE_URL}/v1/download?appName=${appTitle}&id=${meta.id}`,
873
+ method: "GET",
874
+ responseType: "blob"
875
+ }),
876
+ onSuccess: (data, variables) => saveAs(data, `${variables.fileName}.${variables.fileExtension}`)
877
+ });
2876
878
  };
2877
-
2878
- // src/components/core/navigation/NavigationRail.tsx
2879
- import { jsx as jsx24 } from "react/jsx-runtime";
2880
- var MINI_WIDTH = 84;
2881
- var EXPANDED_WIDTH = 320;
2882
- var TOOLBAR_HEIGHT = 65;
2883
- var NavigationRail = ({ navigation, expanded, setExpanded }) => {
2884
- const navigate = useNavigate();
2885
- const routerState = useRouterState2();
2886
- const theme = useTheme2();
2887
- const showPermanent = useMediaQuery(theme.breakpoints.up("sm"));
2888
- const drawerContent = (collapsed) => /* @__PURE__ */ jsx24(
2889
- Box7,
2890
- {
2891
- component: "nav",
2892
- sx: {
2893
- height: "100%",
2894
- display: "flex",
2895
- flexDirection: "column",
2896
- justifyContent: "space-between",
2897
- overflow: "auto",
2898
- scrollbarGutter: collapsed ? "stable" : "auto",
2899
- overflowX: "hidden",
2900
- pt: navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2
2901
- },
2902
- children: /* @__PURE__ */ jsx24(
2903
- NavigationList,
2904
- {
2905
- subNavigation: navigation,
2906
- collapsed,
2907
- isSidebarFullyExpanded: expanded,
2908
- isSidebarFullyCollapsed: !expanded,
2909
- expandedWidth: EXPANDED_WIDTH,
2910
- activePath: routerState.location.pathname,
2911
- onNavigate: navigate
2912
- }
2913
- )
879
+ var useOpenFile3 = (options) => {
880
+ const appTitle = useAppTitle();
881
+ return useMutation({
882
+ ...options,
883
+ mutationFn: (meta) => wczApiClient2.request({
884
+ url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta.id}`,
885
+ method: "GET",
886
+ responseType: "blob"
887
+ }),
888
+ onSuccess: (data) => {
889
+ window.open(URL.createObjectURL(data));
2914
890
  }
2915
- );
2916
- if (showPermanent)
2917
- return /* @__PURE__ */ jsx24(
2918
- Drawer,
2919
- {
2920
- variant: "permanent",
2921
- sx: {
2922
- width: expanded ? EXPANDED_WIDTH : MINI_WIDTH,
2923
- ["& .MuiDrawer-paper"]: {
2924
- position: "absolute",
2925
- top: `${TOOLBAR_HEIGHT}px`,
2926
- height: `calc(100% - ${TOOLBAR_HEIGHT}px)`,
2927
- width: expanded ? EXPANDED_WIDTH : MINI_WIDTH
2928
- }
2929
- },
2930
- children: drawerContent(!expanded)
2931
- }
2932
- );
2933
- return /* @__PURE__ */ jsx24(Drawer, { open: expanded, onClose: () => setExpanded(false), children: drawerContent(!expanded) });
891
+ });
2934
892
  };
2935
-
2936
- // src/components/core/ToolbarAccount.tsx
2937
- import AccountCircle from "@mui/icons-material/AccountCircle";
2938
- import ArrowBack from "@mui/icons-material/ArrowBack";
2939
- import Brightness4 from "@mui/icons-material/Brightness4";
2940
- import ChevronRight from "@mui/icons-material/ChevronRight";
2941
- import DarkMode from "@mui/icons-material/DarkMode";
2942
- import LightMode from "@mui/icons-material/LightMode";
2943
- import Login from "@mui/icons-material/Login";
2944
- import Logout from "@mui/icons-material/Logout";
2945
- import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
2946
- import Translate from "@mui/icons-material/Translate";
2947
- 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";
2948
- import { Fragment as Fragment6, useState as useState8 } from "react";
2949
- import { useTranslation as useTranslation6 } from "react-i18next";
2950
-
2951
- // src/auth-test/keycloak.ts
2952
- import { useRouter } from "@tanstack/react-router";
2953
- import Keycloak from "keycloak-js";
2954
- var keycloakConfig = {
2955
- url: import.meta.env.VITE_KEYCLOAK_URL,
2956
- realm: import.meta.env.VITE_KEYCLOAK_REALM,
2957
- clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
2958
- idpHint: import.meta.env.VITE_KEYCLOAK_IDP_HINT,
2959
- confidentialClientId: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
2960
- confidentialClientSecret: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET
893
+ var useUpdateFileMeta = (options) => {
894
+ const appTitle = useAppTitle();
895
+ const queryClient = useQueryClient();
896
+ return useMutation({
897
+ ...options,
898
+ mutationFn: (meta) => wczApiClient2.request({
899
+ url: `${BASE_URL}/v1/meta?appName=${appTitle}&id=${meta.id}`,
900
+ method: "PUT",
901
+ data: meta
902
+ }),
903
+ onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
904
+ });
2961
905
  };
2962
- function useKeycloak() {
2963
- const routerContext = useRouter();
2964
- const keycloak = routerContext.options.context.keycloak;
2965
- return keycloak;
2966
- }
2967
-
2968
- // src/components/core/ToolbarAccount.tsx
2969
- import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
2970
- var ToolbarAccount = () => {
2971
- const [anchorElement, setAnchorElement] = useState8();
2972
- const [tab, setTab] = useState8("settings");
2973
- const open = Boolean(anchorElement);
2974
- const { t: t2, i18n: i18n2 } = useTranslation6();
2975
- const { mode, setMode } = useColorScheme();
2976
- const changeLanguage = (newLanguage) => () => {
2977
- i18n2.changeLanguage(newLanguage).finally(() => closeMenu());
2978
- };
2979
- const changeMode = (newMode) => () => {
2980
- setMode(newMode);
2981
- closeMenu();
2982
- };
2983
- const keycloak = useKeycloak();
2984
- const user = keycloak.user;
2985
- const getModeText = () => {
2986
- switch (mode) {
2987
- case "light": {
2988
- return t2("Layout.Light");
2989
- }
2990
- case "dark": {
2991
- return t2("Layout.Dark");
2992
- }
2993
- default: {
2994
- return t2("Layout.System");
2995
- }
2996
- }
2997
- };
2998
- const usernameInitials = () => {
2999
- if (!user?.name) return "";
3000
- const splittedName = user.name.split(" ");
3001
- return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
3002
- };
3003
- const openMenu = (event) => setAnchorElement(event.currentTarget);
3004
- const closeMenu = () => {
3005
- setAnchorElement(void 0);
3006
- setTimeout(() => setTab("settings"), 300);
3007
- };
3008
- const changeTab = (newTab) => () => setTab(newTab);
3009
- const settings = /* @__PURE__ */ jsxs13(List4, { component: "nav", subheader: /* @__PURE__ */ jsx25(ListSubheader2, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
3010
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
3011
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Brightness4, {}) }),
3012
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
3013
- /* @__PURE__ */ jsx25(ChevronRight, {})
3014
- ] }),
3015
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
3016
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Translate, {}) }),
3017
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Language"), secondary: i18n2.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
3018
- /* @__PURE__ */ jsx25(ChevronRight, {})
3019
- ] })
3020
- ] });
3021
- const theme = /* @__PURE__ */ jsxs13(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
3022
- /* @__PURE__ */ jsx25(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx25(ArrowBack, { fontSize: "small" }) }),
3023
- " ",
3024
- t2("Layout.Appearance")
3025
- ] }), children: [
3026
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("light"), disabled: mode === "light", children: [
3027
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(LightMode, {}) }),
3028
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Light") })
3029
- ] }),
3030
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
3031
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(DarkMode, {}) }),
3032
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Dark") })
3033
- ] }),
3034
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("system"), disabled: mode === "system", children: [
3035
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(SettingsBrightness, {}) }),
3036
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.System") })
3037
- ] })
3038
- ] });
3039
- const language = /* @__PURE__ */ jsxs13(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
3040
- /* @__PURE__ */ jsx25(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx25(ArrowBack, { fontSize: "small" }) }),
3041
- " ",
3042
- t2("Layout.Language")
3043
- ] }), children: [
3044
- /* @__PURE__ */ jsx25(ListItemButton5, { onClick: changeLanguage("en"), disabled: i18n2.resolvedLanguage === "en", children: /* @__PURE__ */ jsx25(ListItemText4, { primary: "English" }) }),
3045
- /* @__PURE__ */ jsx25(ListItemButton5, { onClick: changeLanguage("cs"), disabled: i18n2.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx25(ListItemText4, { primary: "\u010Ce\u0161tina" }) })
3046
- ] });
3047
- return /* @__PURE__ */ jsxs13(Fragment6, { children: [
3048
- /* @__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" }) }),
3049
- /* @__PURE__ */ jsx25(Menu2, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs13(Box8, { sx: { width: 240 }, children: [
3050
- /* @__PURE__ */ jsx25(List4, { children: user?.name ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
3051
- /* @__PURE__ */ jsx25(ListItem2, { children: /* @__PURE__ */ jsx25(ListItemText4, { primary: user.name, secondary: /* @__PURE__ */ jsxs13("span", { children: [
3052
- /* @__PURE__ */ jsx25("span", { children: user.employeeId }),
3053
- /* @__PURE__ */ jsx25("br", {}),
3054
- /* @__PURE__ */ jsx25("span", { children: user.department })
3055
- ] }) }) }),
3056
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: () => keycloak.logout(), children: [
3057
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Logout, { color: "error" }) }),
3058
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Logout") })
3059
- ] })
3060
- ] }) : /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: () => keycloak.login(), children: [
3061
- /* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Login, { color: "success" }) }),
3062
- /* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.LogIn") })
3063
- ] }) }),
3064
- tab === "settings" && settings,
3065
- tab === "theme" && theme,
3066
- tab === "language" && language
3067
- ] }) })
3068
- ] });
906
+ var useDeleteFile2 = (options) => {
907
+ const appTitle = useAppTitle();
908
+ const queryClient = useQueryClient();
909
+ return useMutation({
910
+ ...options,
911
+ mutationFn: (meta) => wczApiClient2.request({
912
+ url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta.id}`,
913
+ method: "DELETE"
914
+ }),
915
+ onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
916
+ });
3069
917
  };
3070
-
3071
- // src/components/core/Layout.tsx
3072
- import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
3073
- var DrawerHeader = styled2("div")(({ theme }) => ({
3074
- display: "flex",
3075
- alignItems: "center",
3076
- justifyContent: "flex-end",
3077
- padding: theme.spacing(0, 1),
3078
- ...theme.mixins.toolbar
3079
- }));
3080
- var Layout = (props) => {
3081
- const theme = useGetTheme(props.theme);
3082
- const [navigationOpen, setNavigationOpen] = useLocalStorageState("navigationOpen", { defaultServerValue: false });
3083
- const isFetching = !!useIsFetching();
3084
- const isMutating = !!useIsMutating();
3085
- return /* @__PURE__ */ jsxs14(ThemeProvider, { theme, children: [
3086
- /* @__PURE__ */ jsx26(InitColorSchemeScript, {}),
3087
- /* @__PURE__ */ jsx26(CssBaseline, {}),
3088
- /* @__PURE__ */ jsxs14(Box9, { sx: { display: "flex", height: "100dvh", maxHeight: "100dvh", overflow: "hidden", width: "100%" }, children: [
3089
- /* @__PURE__ */ jsx26(
3090
- AppBar,
3091
- {
3092
- color: "transparent",
3093
- position: "fixed",
3094
- sx: {
3095
- borderBottom: "1px solid",
3096
- borderColor: theme.vars?.palette.divider,
3097
- boxShadow: "none"
3098
- },
3099
- children: /* @__PURE__ */ jsxs14(Toolbar, { children: [
3100
- props.navigation && /* @__PURE__ */ jsx26(
3101
- IconButton5,
3102
- {
3103
- onClick: () => setNavigationOpen((previous) => !previous),
3104
- sx: { marginRight: 2 },
3105
- children: navigationOpen ? /* @__PURE__ */ jsx26(MenuOpen, {}) : /* @__PURE__ */ jsx26(Menu3, {})
3106
- }
3107
- ),
3108
- /* @__PURE__ */ jsx26(AppTitle, {}),
3109
- /* @__PURE__ */ jsx26(ToolbarAccount, {})
3110
- ] })
3111
- }
3112
- ),
3113
- props.navigation && /* @__PURE__ */ jsx26(NavigationRail, { navigation: props.navigation, expanded: navigationOpen ?? false, setExpanded: setNavigationOpen }),
3114
- /* @__PURE__ */ jsxs14(Box9, { component: "main", sx: { flexGrow: 1, display: "flex", flexDirection: "column", minWidth: 0, height: "100%", overflow: "hidden" }, children: [
3115
- /* @__PURE__ */ jsx26(DrawerHeader, {}),
3116
- /* @__PURE__ */ jsx26(Box9, { sx: { flex: 1, overflow: "auto", position: "relative" }, children: props.children })
3117
- ] })
3118
- ] }),
3119
- (isFetching || isMutating) && /* @__PURE__ */ jsx26(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
3120
- ] });
918
+ var useDeleteFiles = (options) => {
919
+ const appTitle = useAppTitle();
920
+ const queryClient = useQueryClient();
921
+ return useMutation({
922
+ ...options,
923
+ mutationFn: (subId) => wczApiClient2.request({
924
+ url: `${BASE_URL}/v1?appName=${appTitle}&subId=${subId}`,
925
+ method: "DELETE"
926
+ }),
927
+ onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false })
928
+ });
3121
929
  };
3122
-
3123
- // src/contexts/LayoutContext.ts
3124
- import { createContext as createContext4, useContext as useContext4 } from "react";
3125
- var LayoutContext = createContext4(null);
3126
-
3127
- // src/utils/i18n.ts
3128
- import i18n from "i18next";
3129
- import LanguageDetector from "i18next-browser-languagedetector";
3130
- import HttpBackend from "i18next-http-backend";
3131
- import { initReactI18next } from "react-i18next";
3132
- import { default as default2 } from "i18next";
3133
- i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
3134
- fallbackLng: "en",
3135
- interpolation: {
3136
- escapeValue: false
3137
- },
3138
- react: {
3139
- useSuspense: false
3140
- }
3141
- });
3142
-
3143
- // src/providers/DialogsProvider.tsx
3144
- import { useCallback, useId, useMemo as useMemo4, useRef as useRef3, useState as useState9 } from "react";
3145
- import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
3146
- function DialogsProvider({ children, unmountAfter = 1e3 }) {
3147
- const [stack, setStack] = useState9([]);
3148
- const keyPrefix = useId();
3149
- const nextId = useRef3(0);
3150
- const dialogMetadata = useRef3(/* @__PURE__ */ new WeakMap());
3151
- const requestDialog = useEventCallback_default(function open(Component7, payload, options = {}) {
3152
- const { onClose = async () => {
3153
- } } = options;
3154
- let resolve;
3155
- const promise = new Promise((resolveImpl) => {
3156
- resolve = resolveImpl;
3157
- });
3158
- const key = `${keyPrefix}-${nextId.current}`;
3159
- nextId.current += 1;
3160
- const newEntry = {
3161
- key,
3162
- open: true,
3163
- promise,
3164
- Component: Component7,
3165
- payload,
3166
- onClose,
3167
- resolve
930
+ var useUploadFile = ({ subId, onSuccess, onError }) => {
931
+ const appTitle = useAppTitle();
932
+ const [progress, setProgress] = useState7(0);
933
+ const queryClient = useQueryClient();
934
+ const mutate = async (file) => {
935
+ if (!subId) throw new Error("subId is required for file upload");
936
+ if (!appTitle) throw new Error("appTitle is required for file upload");
937
+ const metadata = {
938
+ id: uuidv7(),
939
+ appName: appTitle,
940
+ subId,
941
+ fileName: file.name
3168
942
  };
3169
- dialogMetadata.current.set(promise, newEntry);
3170
- setStack((previousStack) => [...previousStack, newEntry]);
3171
- return promise;
3172
- });
3173
- const removeDialogFromStack = useCallback((dialog) => {
3174
- setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
3175
- dialogMetadata.current.delete(dialog);
3176
- }, []);
3177
- const closeDialogUi = useEventCallback_default(function closeDialogUi2(dialog) {
3178
- setStack(
3179
- (previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
3180
- );
3181
- setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
3182
- });
3183
- const closeDialog = useEventCallback_default(async function closeDialog2(dialog, result) {
3184
- const entryToClose = dialogMetadata.current.get(dialog);
3185
- if (!entryToClose) {
3186
- throw new Error("Dialog not found in stack");
3187
- }
3188
- try {
3189
- await entryToClose.onClose(result);
3190
- } finally {
3191
- entryToClose.resolve(result);
3192
- closeDialogUi(dialog);
3193
- }
3194
- return dialog;
3195
- });
3196
- const contextValue = useMemo4(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
3197
- return /* @__PURE__ */ jsxs15(DialogsContext.Provider, { value: contextValue, children: [
3198
- children,
3199
- stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx27(
3200
- Component7,
3201
- {
3202
- payload,
3203
- open,
3204
- onClose: async (result) => {
3205
- await closeDialog(promise, result);
3206
- }
943
+ const upload = new TusUpload(file, {
944
+ endpoint: `${BASE_URL}/v1/upload`,
945
+ chunkSize: 1048576,
946
+ // 1 MB
947
+ metadata: {
948
+ id: metadata.id,
949
+ appName: metadata.appName,
950
+ subId: metadata.subId,
951
+ fileName: metadata.fileName,
952
+ fileExtension: file.type
3207
953
  },
3208
- key
3209
- ))
3210
- ] });
3211
- }
3212
-
3213
- // src/providers/LayoutProvider.tsx
3214
- import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
3215
- var LayoutProvider = (props) => {
3216
- const [user, setUser] = useState10({ employeeId: "", name: "Unknown", department: "", company: "", category: "" });
3217
- const { t: t2 } = useTranslation7();
3218
- const navigation = props.getNavigation?.({ user, t: t2 });
3219
- useEffect6(() => {
3220
- z.config(default2.resolvedLanguage === "cs" ? cs() : en());
3221
- }, []);
3222
- return /* @__PURE__ */ jsx28(I18nextProvider, { i18n: default2, children: /* @__PURE__ */ jsx28(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: default2.resolvedLanguage, children: /* @__PURE__ */ jsx28(LayoutContext.Provider, { value: { user: { get: user, set: setUser } }, children: /* @__PURE__ */ jsxs16(Layout, { navigation, theme: props.theme, children: [
3223
- "\xA8",
3224
- /* @__PURE__ */ jsx28(DialogsProvider, { children: props.children })
3225
- ] }) }) }) });
3226
- };
3227
-
3228
- // src/index.ts
3229
- import { uuidv7 as uuidv72 } from "uuidv7";
3230
-
3231
- // src/hooks/FormHooks.ts
3232
- import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
3233
-
3234
- // src/components/form/FormAutocomplete.tsx
3235
- import { Autocomplete, TextField } from "@mui/material";
3236
-
3237
- // src/utils/FormUtils.ts
3238
- var getFieldStatus = (field) => {
3239
- const { meta } = field.state;
3240
- const isTouched = meta.isTouched;
3241
- const hasError = !!meta.errors?.length;
3242
- const helperText = meta.errors?.[0]?.message;
3243
- return { isTouched, hasError, helperText };
3244
- };
3245
-
3246
- // src/components/form/FormAutocomplete.tsx
3247
- import { jsx as jsx29 } from "react/jsx-runtime";
3248
- var FormAutocomplete = ({ textFieldProps, ...autocompleteProps }) => {
3249
- const field = useFieldContext();
3250
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3251
- return /* @__PURE__ */ jsx29(
3252
- Autocomplete,
3253
- {
3254
- value: field.state.value,
3255
- onChange: (_, value) => !autocompleteProps.freeSolo && field.handleChange(value),
3256
- onInputChange: (_, value, reason) => reason !== "reset" && autocompleteProps.freeSolo && field.handleChange(value),
3257
- onBlur: field.handleBlur,
3258
- "aria-label": field.name,
3259
- ...autocompleteProps,
3260
- renderInput: (parameters) => /* @__PURE__ */ jsx29(
3261
- TextField,
3262
- {
3263
- ...parameters,
3264
- name: field.name,
3265
- error: isTouched && hasError,
3266
- helperText: isTouched && helperText,
3267
- ...textFieldProps
3268
- }
3269
- )
3270
- }
3271
- );
3272
- };
3273
-
3274
- // src/components/form/FormCheckbox.tsx
3275
- import { Checkbox, FormControl, FormControlLabel, FormHelperText } from "@mui/material";
3276
- import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
3277
- var FormCheckbox = (props) => {
3278
- const field = useFieldContext();
3279
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3280
- return /* @__PURE__ */ jsxs17(FormControl, { component: "fieldset", children: [
3281
- /* @__PURE__ */ jsx30(
3282
- FormControlLabel,
3283
- {
3284
- control: /* @__PURE__ */ jsx30(
3285
- Checkbox,
3286
- {
3287
- name: field.name,
3288
- checked: Boolean(field.state.value),
3289
- onChange: (event) => field.handleChange(event.target.checked),
3290
- onBlur: field.handleBlur,
3291
- "aria-label": field.name,
3292
- ...props
3293
- }
3294
- ),
3295
- label: props.label ?? ""
3296
- }
3297
- ),
3298
- isTouched && hasError && /* @__PURE__ */ jsx30(FormHelperText, { error: hasError, children: helperText })
3299
- ] });
3300
- };
3301
-
3302
- // src/components/form/FormDatePicker.tsx
3303
- import { DatePicker } from "@mui/x-date-pickers-pro";
3304
- import dayjs2 from "dayjs";
3305
- import { jsx as jsx31 } from "react/jsx-runtime";
3306
- var FormDatePicker = (props) => {
3307
- const field = useFieldContext();
3308
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3309
- return /* @__PURE__ */ jsx31(
3310
- DatePicker,
3311
- {
3312
- name: field.name,
3313
- value: field.state.value ? dayjs2(field.state.value) : null,
3314
- onChange: (value) => field.handleChange(value ? value.format() : null),
3315
- slotProps: {
3316
- textField: {
3317
- onBlur: field.handleBlur,
3318
- error: isTouched && hasError,
3319
- helperText: isTouched && helperText,
3320
- ...props.textFieldProps
3321
- },
3322
- ...props.slotProps
954
+ //headers: { "Authorization": `Bearer ${await getToken()}` }, //TODO: implement token retrieval
955
+ onError: (error) => {
956
+ setProgress(0);
957
+ onError?.(error);
3323
958
  },
3324
- "aria-label": field.name,
3325
- ...props
3326
- }
3327
- );
3328
- };
3329
-
3330
- // src/components/form/FormDateTimePicker.tsx
3331
- import { DateTimePicker } from "@mui/x-date-pickers-pro";
3332
- import dayjs3 from "dayjs";
3333
- import { jsx as jsx32 } from "react/jsx-runtime";
3334
- var FormDateTimePicker = (props) => {
3335
- const field = useFieldContext();
3336
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3337
- return /* @__PURE__ */ jsx32(
3338
- DateTimePicker,
3339
- {
3340
- name: field.name,
3341
- value: field.state.value ? dayjs3(field.state.value) : null,
3342
- onChange: (value) => field.handleChange(value ? value.format() : null),
3343
- slotProps: {
3344
- textField: {
3345
- onBlur: field.handleBlur,
3346
- error: isTouched && hasError,
3347
- helperText: isTouched && helperText,
3348
- ...props.textFieldProps
3349
- },
3350
- ...props.slotProps
959
+ onProgress: (bytesUploaded, bytesTotal) => {
960
+ setProgress(bytesUploaded / bytesTotal * 100);
3351
961
  },
3352
- "aria-label": field.name,
3353
- ...props
3354
- }
3355
- );
3356
- };
3357
-
3358
- // src/components/form/FormNumberField.tsx
3359
- import { TextField as TextField2 } from "@mui/material";
3360
- import { NumericFormat } from "react-number-format";
3361
- import { jsx as jsx33 } from "react/jsx-runtime";
3362
- var FormNumberField = ({ options, ...props }) => {
3363
- const field = useFieldContext();
3364
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3365
- return /* @__PURE__ */ jsx33(
3366
- NumericFormat,
3367
- {
3368
- customInput: TextField2,
3369
- name: field.name,
3370
- value: field.state.value ?? "",
3371
- onValueChange: ({ floatValue }) => field.handleChange(floatValue),
3372
- onBlur: field.handleBlur,
3373
- error: isTouched && hasError,
3374
- helperText: isTouched && helperText,
3375
- "aria-label": field.name,
3376
- ...props,
3377
- ...options
3378
- }
3379
- );
3380
- };
3381
-
3382
- // src/components/form/FormRadioGroup.tsx
3383
- import { FormControl as FormControl2, FormControlLabel as FormControlLabel2, FormHelperText as FormHelperText2, FormLabel, Radio, RadioGroup } from "@mui/material";
3384
- import { jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
3385
- var FormRadioGroup = ({ label, options, ...props }) => {
3386
- const field = useFieldContext();
3387
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3388
- return /* @__PURE__ */ jsxs18(FormControl2, { component: "fieldset", children: [
3389
- label && /* @__PURE__ */ jsx34(FormLabel, { component: "legend", children: label }),
3390
- /* @__PURE__ */ jsx34(
3391
- RadioGroup,
3392
- {
3393
- name: field.name,
3394
- value: field.state.value ?? "",
3395
- onChange: (event) => field.handleChange(event.target.value),
3396
- onBlur: field.handleBlur,
3397
- "aria-label": field.name,
3398
- ...props,
3399
- children: options.map((option) => /* @__PURE__ */ jsx34(
3400
- FormControlLabel2,
3401
- {
3402
- value: option.value,
3403
- control: /* @__PURE__ */ jsx34(Radio, {}),
3404
- label: option.label
3405
- },
3406
- option.value
3407
- ))
3408
- }
3409
- ),
3410
- isTouched && hasError && /* @__PURE__ */ jsx34(FormHelperText2, { error: hasError, children: helperText })
3411
- ] });
3412
- };
3413
-
3414
- // src/components/form/FormSlider.tsx
3415
- import { FormControl as FormControl3, FormHelperText as FormHelperText3, FormLabel as FormLabel2, Slider } from "@mui/material";
3416
- import { jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
3417
- var FormSlider = ({ label, ...props }) => {
3418
- const field = useFieldContext();
3419
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3420
- return /* @__PURE__ */ jsxs19(FormControl3, { component: "fieldset", children: [
3421
- label && /* @__PURE__ */ jsx35(FormLabel2, { children: label }),
3422
- /* @__PURE__ */ jsx35(
3423
- Slider,
3424
- {
3425
- name: field.name,
3426
- value: field.state.value ?? 0,
3427
- onChange: (_, value) => field.handleChange(Array.isArray(value) ? value[0] : value),
3428
- onBlur: field.handleBlur,
3429
- "aria-label": field.name,
3430
- ...props
3431
- }
3432
- ),
3433
- isTouched && hasError && /* @__PURE__ */ jsx35(FormHelperText3, { error: hasError, children: helperText })
3434
- ] });
3435
- };
3436
-
3437
- // src/components/form/FormSubmitButton.tsx
3438
- import { Button as Button3 } from "@mui/material";
3439
- import { jsx as jsx36 } from "react/jsx-runtime";
3440
- var FormSubmitButton = (props) => {
3441
- const form = useFormContext();
3442
- const handleClick = (event) => {
3443
- event.preventDefault();
3444
- event.stopPropagation();
3445
- form.handleSubmit();
3446
- };
3447
- return /* @__PURE__ */ jsx36(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsx36(
3448
- Button3,
3449
- {
3450
- loading: isSubmitting,
3451
- disabled: !canSubmit,
3452
- onClick: handleClick,
3453
- type: "submit",
3454
- "aria-label": "submit",
3455
- ...props
3456
- }
3457
- ) });
3458
- };
3459
-
3460
- // src/components/form/FormSwitch.tsx
3461
- import { FormControl as FormControl4, FormControlLabel as FormControlLabel3, FormHelperText as FormHelperText4, Switch } from "@mui/material";
3462
- import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
3463
- var FormSwitch = (props) => {
3464
- const field = useFieldContext();
3465
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3466
- return /* @__PURE__ */ jsxs20(FormControl4, { component: "fieldset", children: [
3467
- /* @__PURE__ */ jsx37(
3468
- FormControlLabel3,
3469
- {
3470
- control: /* @__PURE__ */ jsx37(
3471
- Switch,
3472
- {
3473
- name: field.name,
3474
- checked: Boolean(field.state.value),
3475
- onChange: (event) => field.handleChange(event.target.checked),
3476
- onBlur: field.handleBlur,
3477
- "aria-label": field.name,
3478
- ...props
3479
- }
3480
- ),
3481
- label: props.label ?? ""
962
+ onSuccess: () => {
963
+ setProgress(0);
964
+ queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta", subId, appTitle], exact: false });
965
+ onSuccess?.(metadata);
3482
966
  }
3483
- ),
3484
- isTouched && hasError && /* @__PURE__ */ jsx37(FormHelperText4, { error: hasError, children: helperText })
3485
- ] });
3486
- };
3487
-
3488
- // src/components/form/FormTextField.tsx
3489
- import { TextField as TextField3 } from "@mui/material";
3490
- import { jsx as jsx38 } from "react/jsx-runtime";
3491
- var FormTextField = (props) => {
3492
- const field = useFieldContext();
3493
- const { isTouched, hasError, helperText } = getFieldStatus(field);
3494
- return /* @__PURE__ */ jsx38(
3495
- TextField3,
3496
- {
3497
- name: field.name,
3498
- value: field.state.value ?? "",
3499
- onChange: (event) => field.handleChange(event.target.value),
3500
- onBlur: field.handleBlur,
3501
- error: isTouched && hasError,
3502
- helperText: isTouched && helperText,
3503
- "aria-label": field.name,
3504
- ...props
967
+ });
968
+ const previousUploads = await upload.findPreviousUploads();
969
+ if (previousUploads.length > 0) {
970
+ upload.resumeFromPreviousUpload(previousUploads[0]);
3505
971
  }
3506
- );
972
+ upload.start();
973
+ };
974
+ return { mutate, progress };
3507
975
  };
3508
-
3509
- // src/hooks/FormHooks.ts
3510
- var { fieldContext, useFieldContext, formContext, useFormContext } = createFormHookContexts();
3511
- var { useAppForm: useLayoutForm, withForm: withLayoutForm } = createFormHook({
3512
- fieldComponents: {
3513
- TextField: FormTextField,
3514
- NumberField: FormNumberField,
3515
- Autocomplete: FormAutocomplete,
3516
- Checkbox: FormCheckbox,
3517
- Switch: FormSwitch,
3518
- RadioGroup: FormRadioGroup,
3519
- Slider: FormSlider,
3520
- DatePicker: FormDatePicker,
3521
- DateTimePicker: FormDateTimePicker
3522
- },
3523
- formComponents: {
3524
- SubmitButton: FormSubmitButton
3525
- },
3526
- fieldContext,
3527
- formContext
3528
- });
3529
-
3530
- // src/index.ts
3531
- import { default as default3 } from "use-local-storage-state";
3532
- import { useTranslation as useTranslation8 } from "react-i18next";
3533
- import { t } from "i18next";
3534
976
  export {
3535
977
  ChipInputCell,
3536
978
  Dropzone,
@@ -3551,52 +993,23 @@ export {
3551
993
  TypographyWithIcon,
3552
994
  rootRouteHead,
3553
995
  t,
3554
- useDeleteFile,
996
+ useDeleteFile2 as useDeleteFile,
3555
997
  useDeleteFiles,
3556
- useDialogs,
3557
- useDownloadFile,
998
+ useDialogs2 as useDialogs,
999
+ useDownloadFile4 as useDownloadFile,
3558
1000
  useFieldContext,
3559
1001
  useFormContext,
3560
- useGetFile,
3561
- useGetFileMetas,
3562
- useGetFileThumbnail,
1002
+ useGetFile2 as useGetFile,
1003
+ useGetFileMetas2 as useGetFileMetas,
1004
+ useGetFileThumbnail2 as useGetFileThumbnail,
3563
1005
  useLayoutForm,
3564
- default3 as useLocalStorageState,
3565
- useOpenFile,
3566
- useTranslation8 as useTranslation,
1006
+ default2 as useLocalStorageState,
1007
+ useOpenFile3 as useOpenFile,
1008
+ useTranslation6 as useTranslation,
3567
1009
  useUpdateFileMeta,
3568
1010
  useUploadFile,
3569
1011
  uuidv72 as uuidv7,
3570
1012
  wczApiClient,
3571
1013
  withLayoutForm
3572
1014
  };
3573
- /*! Bundled license information:
3574
-
3575
- react-is/cjs/react-is.production.min.js:
3576
- (** @license React v16.13.1
3577
- * react-is.production.min.js
3578
- *
3579
- * Copyright (c) Facebook, Inc. and its affiliates.
3580
- *
3581
- * This source code is licensed under the MIT license found in the
3582
- * LICENSE file in the root directory of this source tree.
3583
- *)
3584
-
3585
- react-is/cjs/react-is.development.js:
3586
- (** @license React v16.13.1
3587
- * react-is.development.js
3588
- *
3589
- * Copyright (c) Facebook, Inc. and its affiliates.
3590
- *
3591
- * This source code is licensed under the MIT license found in the
3592
- * LICENSE file in the root directory of this source tree.
3593
- *)
3594
-
3595
- object-assign/index.js:
3596
- (*
3597
- object-assign
3598
- (c) Sindre Sorhus
3599
- @license MIT
3600
- *)
3601
- */
3602
1015
  //# sourceMappingURL=index.js.map