mal-ui 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +244 -0
  2. package/dist/carousel/extensions.d.ts +1 -0
  3. package/dist/carousel/index.d.ts +2 -0
  4. package/dist/carousel/index.js +424 -0
  5. package/dist/carousel/index.js.map +15 -0
  6. package/dist/charts/extensions.d.ts +1 -0
  7. package/dist/charts/index.d.ts +2 -0
  8. package/dist/charts/index.js +3499 -0
  9. package/dist/charts/index.js.map +53 -0
  10. package/dist/chunks/index-3ffbn0gc.js +29976 -0
  11. package/dist/chunks/index-3ffbn0gc.js.map +637 -0
  12. package/dist/chunks/index-6b5mapr4.js +2 -0
  13. package/dist/chunks/index-6b5mapr4.js.map +9 -0
  14. package/dist/chunks/index-6tm93gww.js +38 -0
  15. package/dist/chunks/index-6tm93gww.js.map +10 -0
  16. package/dist/chunks/index-cg10ezdx.js +2 -0
  17. package/dist/chunks/index-cg10ezdx.js.map +9 -0
  18. package/dist/chunks/index-mc01z7m9.js +48 -0
  19. package/dist/chunks/index-mc01z7m9.js.map +9 -0
  20. package/dist/chunks/index-rz8zh7g4.js +5015 -0
  21. package/dist/chunks/index-rz8zh7g4.js.map +113 -0
  22. package/dist/chunks/index-syjq3515.js +4893 -0
  23. package/dist/chunks/index-syjq3515.js.map +101 -0
  24. package/dist/chunks/index-w9ekv5h5.js +733 -0
  25. package/dist/chunks/index-w9ekv5h5.js.map +17 -0
  26. package/dist/code-highlight/extensions.d.ts +1 -0
  27. package/dist/code-highlight/index.d.ts +2 -0
  28. package/dist/code-highlight/index.js +1685 -0
  29. package/dist/code-highlight/index.js.map +25 -0
  30. package/dist/core/extensions.d.ts +2 -0
  31. package/dist/core/index.d.ts +2 -0
  32. package/dist/core/index.js +844 -0
  33. package/dist/core/index.js.map +9 -0
  34. package/dist/dates/extensions.d.ts +1 -0
  35. package/dist/dates/index.d.ts +2 -0
  36. package/dist/dates/index.js +107 -0
  37. package/dist/dates/index.js.map +9 -0
  38. package/dist/dropzone/extensions.d.ts +1 -0
  39. package/dist/dropzone/index.d.ts +2 -0
  40. package/dist/dropzone/index.js +2681 -0
  41. package/dist/dropzone/index.js.map +21 -0
  42. package/dist/form/extensions.d.ts +1 -0
  43. package/dist/form/index.d.ts +2 -0
  44. package/dist/form/index.js +1605 -0
  45. package/dist/form/index.js.map +51 -0
  46. package/dist/hooks/extensions.d.ts +1 -0
  47. package/dist/hooks/index.d.ts +2 -0
  48. package/dist/hooks/index.js +214 -0
  49. package/dist/hooks/index.js.map +9 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +1052 -0
  52. package/dist/index.js.map +9 -0
  53. package/dist/modals/extensions.d.ts +1 -0
  54. package/dist/modals/index.d.ts +2 -0
  55. package/dist/modals/index.js +387 -0
  56. package/dist/modals/index.js.map +15 -0
  57. package/dist/notifications/extensions.d.ts +1 -0
  58. package/dist/notifications/index.d.ts +2 -0
  59. package/dist/notifications/index.js +1122 -0
  60. package/dist/notifications/index.js.map +28 -0
  61. package/dist/nprogress/extensions.d.ts +1 -0
  62. package/dist/nprogress/index.d.ts +2 -0
  63. package/dist/nprogress/index.js +207 -0
  64. package/dist/nprogress/index.js.map +12 -0
  65. package/dist/schedule/extensions.d.ts +1 -0
  66. package/dist/schedule/index.d.ts +2 -0
  67. package/dist/schedule/index.js +8569 -0
  68. package/dist/schedule/index.js.map +135 -0
  69. package/dist/spotlight/extensions.d.ts +1 -0
  70. package/dist/spotlight/index.d.ts +2 -0
  71. package/dist/spotlight/index.js +666 -0
  72. package/dist/spotlight/index.js.map +24 -0
  73. package/dist/styles.css +1 -0
  74. package/dist/theme/index.d.ts +13 -0
  75. package/dist/theme/index.js +202 -0
  76. package/dist/theme/index.js.map +11 -0
  77. package/dist/theme/tokens.d.ts +65 -0
  78. package/dist/tiptap/extensions.d.ts +1 -0
  79. package/dist/tiptap/index.d.ts +2 -0
  80. package/dist/tiptap/index.js +1549 -0
  81. package/dist/tiptap/index.js.map +25 -0
  82. package/package.json +163 -0
@@ -0,0 +1,4893 @@
1
+ "use client";
2
+ // node_modules/@mantine/hooks/esm/utils/clamp/clamp.mjs
3
+
4
+ function clamp(value, min, max) {
5
+ if (min === undefined && max === undefined)
6
+ return value;
7
+ if (min !== undefined && max === undefined)
8
+ return Math.max(value, min);
9
+ if (min === undefined && max !== undefined)
10
+ return Math.min(value, max);
11
+ return Math.min(Math.max(value, min), max);
12
+ }
13
+
14
+ // node_modules/@mantine/hooks/esm/utils/lower-first/lower-first.mjs
15
+
16
+ function lowerFirst(value) {
17
+ return typeof value !== "string" ? "" : value.charAt(0).toLowerCase() + value.slice(1);
18
+ }
19
+
20
+ // node_modules/@mantine/hooks/esm/utils/random-id/random-id.mjs
21
+
22
+ function randomId(prefix = "mantine-") {
23
+ return `${prefix}${Math.random().toString(36).slice(2, 11)}`;
24
+ }
25
+
26
+ // node_modules/@mantine/hooks/esm/utils/range/range.mjs
27
+
28
+ function range(start, end) {
29
+ const length = Math.abs(end - start) + 1;
30
+ if (!(start > end))
31
+ return Array.from({ length }, (_, index) => index + start);
32
+ return Array.from({ length }, (_, index) => start - index);
33
+ }
34
+
35
+ // node_modules/@mantine/hooks/esm/utils/shallow-equal/shallow-equal.mjs
36
+
37
+ function shallowEqual(a, b) {
38
+ if (a === b)
39
+ return true;
40
+ if (Number.isNaN(a) && Number.isNaN(b))
41
+ return true;
42
+ if (!(a instanceof Object) || !(b instanceof Object))
43
+ return false;
44
+ const keys = Object.keys(a);
45
+ const { length } = keys;
46
+ if (length !== Object.keys(b).length)
47
+ return false;
48
+ for (let i = 0;i < length; i += 1) {
49
+ const key = keys[i];
50
+ if (!(key in b))
51
+ return false;
52
+ if (a[key] !== b[key] && !(Number.isNaN(a[key]) && Number.isNaN(b[key])))
53
+ return false;
54
+ }
55
+ return true;
56
+ }
57
+
58
+ // node_modules/@mantine/hooks/esm/utils/upper-first/upper-first.mjs
59
+
60
+ function upperFirst(value) {
61
+ return typeof value !== "string" ? "" : value.charAt(0).toUpperCase() + value.slice(1);
62
+ }
63
+
64
+ // node_modules/@mantine/hooks/esm/utils/use-callback-ref/use-callback-ref.mjs
65
+ import { useEffect, useMemo, useRef } from "react";
66
+
67
+ function useCallbackRef(callback) {
68
+ const callbackRef = useRef(callback);
69
+ useEffect(() => {
70
+ callbackRef.current = callback;
71
+ });
72
+ return useMemo(() => (...args) => callbackRef.current?.(...args), []);
73
+ }
74
+
75
+ // node_modules/@mantine/hooks/esm/use-debounced-callback/use-debounced-callback.mjs
76
+ import { useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
77
+
78
+ function useDebouncedCallback(callback, options) {
79
+ const { delay, flushOnUnmount, leading, maxWait } = typeof options === "number" ? {
80
+ delay: options,
81
+ flushOnUnmount: false,
82
+ leading: false,
83
+ maxWait: undefined
84
+ } : options;
85
+ const handleCallback = useCallbackRef(callback);
86
+ const debounceTimerRef = useRef2(0);
87
+ const maxWaitTimerRef = useRef2(0);
88
+ const latestArgsRef = useRef2(null);
89
+ const lastCallback = useMemo2(() => {
90
+ const currentCallback = Object.assign((...args) => {
91
+ window.clearTimeout(debounceTimerRef.current);
92
+ latestArgsRef.current = args;
93
+ const isFirstCall = currentCallback._isFirstCall;
94
+ currentCallback._isFirstCall = false;
95
+ function clearTimeoutAndLeadingRef() {
96
+ window.clearTimeout(debounceTimerRef.current);
97
+ window.clearTimeout(maxWaitTimerRef.current);
98
+ debounceTimerRef.current = 0;
99
+ maxWaitTimerRef.current = 0;
100
+ currentCallback._isFirstCall = true;
101
+ currentCallback._hasPendingCallback = false;
102
+ }
103
+ function startMaxWaitTimer() {
104
+ if (maxWait !== undefined && maxWaitTimerRef.current === 0)
105
+ maxWaitTimerRef.current = window.setTimeout(() => {
106
+ if (debounceTimerRef.current !== 0) {
107
+ const latestArgs = latestArgsRef.current;
108
+ clearTimeoutAndLeadingRef();
109
+ handleCallback(...latestArgs);
110
+ }
111
+ }, maxWait);
112
+ }
113
+ if (leading && isFirstCall) {
114
+ handleCallback(...args);
115
+ const resetLeadingState = () => {
116
+ clearTimeoutAndLeadingRef();
117
+ };
118
+ const flush2 = () => {
119
+ if (debounceTimerRef.current !== 0) {
120
+ clearTimeoutAndLeadingRef();
121
+ handleCallback(...args);
122
+ }
123
+ };
124
+ const cancel2 = () => {
125
+ clearTimeoutAndLeadingRef();
126
+ };
127
+ currentCallback.flush = flush2;
128
+ currentCallback.cancel = cancel2;
129
+ debounceTimerRef.current = window.setTimeout(resetLeadingState, delay);
130
+ startMaxWaitTimer();
131
+ return;
132
+ }
133
+ if (leading && !isFirstCall) {
134
+ currentCallback._hasPendingCallback = true;
135
+ const flush2 = () => {
136
+ if (debounceTimerRef.current !== 0) {
137
+ clearTimeoutAndLeadingRef();
138
+ handleCallback(...args);
139
+ }
140
+ };
141
+ const cancel2 = () => {
142
+ clearTimeoutAndLeadingRef();
143
+ };
144
+ currentCallback.flush = flush2;
145
+ currentCallback.cancel = cancel2;
146
+ const resetLeadingState = () => {
147
+ clearTimeoutAndLeadingRef();
148
+ };
149
+ debounceTimerRef.current = window.setTimeout(resetLeadingState, delay);
150
+ startMaxWaitTimer();
151
+ return;
152
+ }
153
+ currentCallback._hasPendingCallback = true;
154
+ const flush = () => {
155
+ if (debounceTimerRef.current !== 0) {
156
+ clearTimeoutAndLeadingRef();
157
+ handleCallback(...args);
158
+ }
159
+ };
160
+ const cancel = () => {
161
+ clearTimeoutAndLeadingRef();
162
+ };
163
+ currentCallback.flush = flush;
164
+ currentCallback.cancel = cancel;
165
+ debounceTimerRef.current = window.setTimeout(flush, delay);
166
+ startMaxWaitTimer();
167
+ }, {
168
+ flush: () => {},
169
+ cancel: () => {},
170
+ isPending: () => currentCallback._hasPendingCallback,
171
+ _isFirstCall: true,
172
+ _hasPendingCallback: false
173
+ });
174
+ return currentCallback;
175
+ }, [
176
+ handleCallback,
177
+ delay,
178
+ leading,
179
+ maxWait
180
+ ]);
181
+ useEffect2(() => () => {
182
+ if (flushOnUnmount)
183
+ lastCallback.flush();
184
+ else
185
+ lastCallback.cancel();
186
+ }, [lastCallback, flushOnUnmount]);
187
+ return lastCallback;
188
+ }
189
+
190
+ // node_modules/@mantine/hooks/esm/use-click-outside/use-click-outside.mjs
191
+ import { useEffect as useEffect3, useEffectEvent, useRef as useRef3 } from "react";
192
+
193
+ var DEFAULT_EVENTS = ["mousedown", "touchstart"];
194
+ function useClickOutside(callback, events, nodes, enabled = true) {
195
+ const ref = useRef3(null);
196
+ const eventsList = events || DEFAULT_EVENTS;
197
+ const listener = useEffectEvent((event) => {
198
+ const { target } = event ?? {};
199
+ if (!document.body.contains(target) && target?.tagName !== "HTML")
200
+ return;
201
+ const path = event.composedPath();
202
+ if (Array.isArray(nodes))
203
+ nodes.every((node) => !!node && !path.includes(node)) && callback(event);
204
+ else if (ref.current && !path.includes(ref.current))
205
+ callback(event);
206
+ });
207
+ const eventsKey = eventsList.join(",");
208
+ useEffect3(() => {
209
+ if (!enabled)
210
+ return;
211
+ const events2 = eventsKey.split(",");
212
+ events2.forEach((fn) => document.addEventListener(fn, listener));
213
+ return () => {
214
+ events2.forEach((fn) => document.removeEventListener(fn, listener));
215
+ };
216
+ }, [eventsKey, enabled]);
217
+ return ref;
218
+ }
219
+
220
+ // node_modules/@mantine/hooks/esm/use-clipboard/use-clipboard.mjs
221
+ import { useEffect as useEffect4, useRef as useRef4, useState } from "react";
222
+
223
+ function useClipboard(options = {}) {
224
+ const timeout = options.timeout ?? 2000;
225
+ const [error, setError] = useState(null);
226
+ const [copied, setCopied] = useState(false);
227
+ const timeoutRef = useRef4(null);
228
+ useEffect4(() => () => {
229
+ window.clearTimeout(timeoutRef.current);
230
+ }, []);
231
+ const handleCopyResult = (value) => {
232
+ window.clearTimeout(timeoutRef.current);
233
+ timeoutRef.current = window.setTimeout(() => setCopied(false), timeout);
234
+ setCopied(value);
235
+ };
236
+ const copy = (value) => {
237
+ if ("clipboard" in navigator)
238
+ navigator.clipboard.writeText(value).then(() => {
239
+ setError(null);
240
+ handleCopyResult(true);
241
+ }).catch((err) => setError(err));
242
+ else
243
+ setError(/* @__PURE__ */ new Error("useClipboard: navigator.clipboard is not supported"));
244
+ };
245
+ const reset = () => {
246
+ setCopied(false);
247
+ setError(null);
248
+ window.clearTimeout(timeoutRef.current);
249
+ };
250
+ return {
251
+ copy,
252
+ reset,
253
+ error,
254
+ copied
255
+ };
256
+ }
257
+
258
+ // node_modules/@mantine/hooks/esm/use-media-query/use-media-query.mjs
259
+ import { useEffect as useEffect5, useState as useState2 } from "react";
260
+
261
+ function getInitialValue(query, initialValue) {
262
+ if (typeof initialValue === "boolean")
263
+ return initialValue;
264
+ if (typeof window !== "undefined" && "matchMedia" in window)
265
+ return window.matchMedia(query).matches;
266
+ return false;
267
+ }
268
+ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = { getInitialValueInEffect: true }) {
269
+ const [matches, setMatches] = useState2(getInitialValueInEffect ? initialValue : getInitialValue(query));
270
+ useEffect5(() => {
271
+ try {
272
+ if ("matchMedia" in window) {
273
+ const mediaQuery = window.matchMedia(query);
274
+ setMatches(mediaQuery.matches);
275
+ const callback = (event) => setMatches(event.matches);
276
+ mediaQuery.addEventListener("change", callback);
277
+ return () => {
278
+ mediaQuery.removeEventListener("change", callback);
279
+ };
280
+ }
281
+ } catch (e) {
282
+ return;
283
+ }
284
+ }, [query]);
285
+ return matches || false;
286
+ }
287
+
288
+ // node_modules/@mantine/hooks/esm/use-color-scheme/use-color-scheme.mjs
289
+
290
+ function useColorScheme(initialValue, options) {
291
+ return useMediaQuery("(prefers-color-scheme: dark)", initialValue === "dark", options) ? "dark" : "light";
292
+ }
293
+
294
+ // node_modules/@mantine/hooks/esm/use-counter/use-counter.mjs
295
+ import { useCallback, useState as useState3 } from "react";
296
+
297
+ var DEFAULT_OPTIONS = {
298
+ min: -Infinity,
299
+ max: Infinity
300
+ };
301
+ function useCounter(initialValue = 0, options) {
302
+ const { min, max, step: _step = 1 } = {
303
+ ...DEFAULT_OPTIONS,
304
+ ...options
305
+ };
306
+ const step = Math.abs(_step);
307
+ const [count, setCount] = useState3(clamp(initialValue, min, max));
308
+ return [count, {
309
+ increment: useCallback(() => setCount((current) => clamp(current + step, min, max)), [
310
+ min,
311
+ max,
312
+ step
313
+ ]),
314
+ decrement: useCallback(() => setCount((current) => clamp(current - step, min, max)), [
315
+ min,
316
+ max,
317
+ step
318
+ ]),
319
+ set: useCallback((value) => setCount(clamp(value, min, max)), [min, max]),
320
+ reset: useCallback(() => setCount(clamp(initialValue, min, max)), [
321
+ initialValue,
322
+ min,
323
+ max
324
+ ])
325
+ }];
326
+ }
327
+
328
+ // node_modules/@mantine/hooks/esm/use-debounced-state/use-debounced-state.mjs
329
+ import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef5, useState as useState4 } from "react";
330
+
331
+ function useDebouncedState(defaultValue, wait, options = { leading: false }) {
332
+ const [value, setValue] = useState4(defaultValue);
333
+ const timeoutRef = useRef5(null);
334
+ const leadingRef = useRef5(true);
335
+ const clearTimeout2 = () => window.clearTimeout(timeoutRef.current);
336
+ useEffect6(() => clearTimeout2, []);
337
+ return [value, useCallback2((newValue) => {
338
+ clearTimeout2();
339
+ if (leadingRef.current && options.leading)
340
+ setValue(newValue);
341
+ else
342
+ timeoutRef.current = window.setTimeout(() => {
343
+ leadingRef.current = true;
344
+ setValue(newValue);
345
+ }, wait);
346
+ leadingRef.current = false;
347
+ }, [options.leading, wait])];
348
+ }
349
+
350
+ // node_modules/@mantine/hooks/esm/use-debounced-value/use-debounced-value.mjs
351
+ import { useCallback as useCallback3, useEffect as useEffect7, useRef as useRef6, useState as useState5 } from "react";
352
+
353
+ function useDebouncedValue(value, wait, options = { leading: false }) {
354
+ const [_value, setValue] = useState5(value);
355
+ const mountedRef = useRef6(false);
356
+ const timeoutRef = useRef6(null);
357
+ const cooldownRef = useRef6(false);
358
+ const latestValueRef = useRef6(value);
359
+ latestValueRef.current = value;
360
+ const cancel = useCallback3(() => {
361
+ window.clearTimeout(timeoutRef.current);
362
+ timeoutRef.current = null;
363
+ cooldownRef.current = false;
364
+ }, []);
365
+ const flush = useCallback3(() => {
366
+ if (timeoutRef.current) {
367
+ cancel();
368
+ cooldownRef.current = false;
369
+ setValue(latestValueRef.current);
370
+ }
371
+ }, []);
372
+ useEffect7(() => {
373
+ if (mountedRef.current)
374
+ if (!cooldownRef.current && options.leading) {
375
+ cooldownRef.current = true;
376
+ setValue(value);
377
+ timeoutRef.current = window.setTimeout(() => {
378
+ cooldownRef.current = false;
379
+ }, wait);
380
+ } else {
381
+ cancel();
382
+ timeoutRef.current = window.setTimeout(() => {
383
+ cooldownRef.current = false;
384
+ setValue(value);
385
+ }, wait);
386
+ }
387
+ }, [
388
+ value,
389
+ options.leading,
390
+ wait
391
+ ]);
392
+ useEffect7(() => {
393
+ mountedRef.current = true;
394
+ return cancel;
395
+ }, []);
396
+ return [
397
+ _value,
398
+ cancel,
399
+ {
400
+ cancel,
401
+ flush
402
+ }
403
+ ];
404
+ }
405
+
406
+ // node_modules/@mantine/hooks/esm/use-isomorphic-effect/use-isomorphic-effect.mjs
407
+ import { useEffect as useEffect8, useLayoutEffect } from "react";
408
+
409
+ var useIsomorphicEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect8;
410
+
411
+ // node_modules/@mantine/hooks/esm/use-document-title/use-document-title.mjs
412
+
413
+ function useDocumentTitle(title) {
414
+ useIsomorphicEffect(() => {
415
+ if (typeof title === "string" && title.trim().length > 0)
416
+ document.title = title.trim();
417
+ }, [title]);
418
+ }
419
+
420
+ // node_modules/@mantine/hooks/esm/use-document-visibility/use-document-visibility.mjs
421
+ import { useEffect as useEffect9, useState as useState6 } from "react";
422
+
423
+ function useDocumentVisibility() {
424
+ const [documentVisibility, setDocumentVisibility] = useState6("visible");
425
+ useEffect9(() => {
426
+ setDocumentVisibility(document.visibilityState);
427
+ const listener = () => setDocumentVisibility(document.visibilityState);
428
+ document.addEventListener("visibilitychange", listener);
429
+ return () => document.removeEventListener("visibilitychange", listener);
430
+ }, []);
431
+ return documentVisibility;
432
+ }
433
+
434
+ // node_modules/@mantine/hooks/esm/use-did-update/use-did-update.mjs
435
+ import { useEffect as useEffect10, useRef as useRef7 } from "react";
436
+
437
+ function useDidUpdate(fn, dependencies) {
438
+ const mounted = useRef7(false);
439
+ useEffect10(() => () => {
440
+ mounted.current = false;
441
+ }, []);
442
+ useEffect10(() => {
443
+ if (mounted.current)
444
+ return fn();
445
+ mounted.current = true;
446
+ }, dependencies);
447
+ }
448
+
449
+ // node_modules/@mantine/hooks/esm/use-focus-return/use-focus-return.mjs
450
+ import { useRef as useRef8 } from "react";
451
+
452
+ function useFocusReturn({ opened, shouldReturnFocus = true }) {
453
+ const lastActiveElement = useRef8(null);
454
+ const returnFocus = () => {
455
+ if (lastActiveElement.current && "focus" in lastActiveElement.current && typeof lastActiveElement.current.focus === "function")
456
+ lastActiveElement.current?.focus({ preventScroll: true });
457
+ };
458
+ useDidUpdate(() => {
459
+ let timeout = -1;
460
+ const clearFocusTimeout = (event) => {
461
+ if (event.key === "Tab")
462
+ window.clearTimeout(timeout);
463
+ };
464
+ document.addEventListener("keydown", clearFocusTimeout);
465
+ if (opened)
466
+ lastActiveElement.current = document.activeElement;
467
+ else if (shouldReturnFocus) {
468
+ const activeElementAtClose = document.activeElement;
469
+ timeout = window.setTimeout(() => {
470
+ const currentActiveElement = document.activeElement;
471
+ if (currentActiveElement === null || currentActiveElement === document.body || currentActiveElement === activeElementAtClose)
472
+ returnFocus();
473
+ }, 10);
474
+ }
475
+ return () => {
476
+ window.clearTimeout(timeout);
477
+ document.removeEventListener("keydown", clearFocusTimeout);
478
+ };
479
+ }, [opened, shouldReturnFocus]);
480
+ return returnFocus;
481
+ }
482
+
483
+ // node_modules/@mantine/hooks/esm/use-focus-trap/tabbable.mjs
484
+
485
+ var TABBABLE_NODES = /input|select|textarea|button|object/;
486
+ var FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]";
487
+ function hidden(element) {
488
+ return element.style.display === "none";
489
+ }
490
+ function visible(element) {
491
+ if (element.getAttribute("aria-hidden") || element.getAttribute("hidden") || element.getAttribute("type") === "hidden")
492
+ return false;
493
+ let parentElement = element;
494
+ while (parentElement) {
495
+ if (parentElement === document.body || parentElement.nodeType === 11)
496
+ break;
497
+ if (hidden(parentElement))
498
+ return false;
499
+ parentElement = parentElement.parentNode;
500
+ }
501
+ return true;
502
+ }
503
+ function getElementTabIndex(element) {
504
+ let tabIndex = element.getAttribute("tabindex");
505
+ if (tabIndex === null)
506
+ tabIndex = undefined;
507
+ return parseInt(tabIndex, 10);
508
+ }
509
+ function focusable(element) {
510
+ const nodeName = element.nodeName.toLowerCase();
511
+ const isTabIndexNotNaN = !Number.isNaN(getElementTabIndex(element));
512
+ return (TABBABLE_NODES.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)) && visible(element);
513
+ }
514
+ function tabbable(element) {
515
+ const tabIndex = getElementTabIndex(element);
516
+ return (Number.isNaN(tabIndex) || tabIndex >= 0) && focusable(element);
517
+ }
518
+ function findTabbableDescendants(element) {
519
+ return Array.from(element.querySelectorAll(FOCUS_SELECTOR)).filter(tabbable);
520
+ }
521
+
522
+ // node_modules/@mantine/hooks/esm/use-focus-trap/scope-tab.mjs
523
+
524
+ function scopeTab(node, event) {
525
+ const tabbable2 = findTabbableDescendants(node);
526
+ if (!tabbable2.length) {
527
+ event.preventDefault();
528
+ return;
529
+ }
530
+ const finalTabbable = tabbable2[event.shiftKey ? 0 : tabbable2.length - 1];
531
+ const root = node.getRootNode();
532
+ let leavingFinalTabbable = finalTabbable === root.activeElement || node === root.activeElement;
533
+ const activeElement = root.activeElement;
534
+ if (activeElement.tagName === "INPUT" && activeElement.getAttribute("type") === "radio")
535
+ leavingFinalTabbable = tabbable2.filter((element) => element.getAttribute("type") === "radio" && element.getAttribute("name") === activeElement.getAttribute("name")).includes(finalTabbable);
536
+ if (!leavingFinalTabbable)
537
+ return;
538
+ event.preventDefault();
539
+ const target = tabbable2[event.shiftKey ? tabbable2.length - 1 : 0];
540
+ if (target)
541
+ target.focus();
542
+ }
543
+
544
+ // node_modules/@mantine/hooks/esm/use-focus-trap/use-focus-trap.mjs
545
+ import { useCallback as useCallback4, useEffect as useEffect11, useRef as useRef9 } from "react";
546
+
547
+ function useFocusTrap(active = true) {
548
+ const ref = useRef9(null);
549
+ const focusNode = (node) => {
550
+ let focusElement = node.querySelector("[data-autofocus]");
551
+ if (!focusElement) {
552
+ const children = Array.from(node.querySelectorAll(FOCUS_SELECTOR));
553
+ focusElement = children.find(tabbable) || children.find(focusable) || null;
554
+ if (!focusElement && focusable(node))
555
+ focusElement = node;
556
+ }
557
+ if (focusElement)
558
+ focusElement.focus({ preventScroll: true });
559
+ else
560
+ console.warn("[@mantine/hooks/use-focus-trap] Failed to find focusable element within provided node", node);
561
+ };
562
+ const setRef = useCallback4((node) => {
563
+ if (!active)
564
+ return;
565
+ if (node === null) {
566
+ ref.current = null;
567
+ return;
568
+ }
569
+ if (ref.current === node)
570
+ return;
571
+ setTimeout(() => {
572
+ if (node.getRootNode())
573
+ focusNode(node);
574
+ else
575
+ console.warn("[@mantine/hooks/use-focus-trap] Ref node is not part of the dom", node);
576
+ });
577
+ ref.current = node;
578
+ }, [active]);
579
+ useEffect11(() => {
580
+ if (!active)
581
+ return;
582
+ if (ref.current)
583
+ setTimeout(() => {
584
+ if (ref.current)
585
+ focusNode(ref.current);
586
+ });
587
+ const handleKeyDown = (event) => {
588
+ if (event.key === "Tab" && ref.current)
589
+ scopeTab(ref.current, event);
590
+ };
591
+ document.addEventListener("keydown", handleKeyDown);
592
+ return () => document.removeEventListener("keydown", handleKeyDown);
593
+ }, [active]);
594
+ return setRef;
595
+ }
596
+
597
+ // node_modules/@mantine/hooks/esm/use-force-update/use-force-update.mjs
598
+ import { useReducer } from "react";
599
+
600
+ var reducer = (value) => (value + 1) % 1e6;
601
+ function useForceUpdate() {
602
+ const [, update] = useReducer(reducer, 0);
603
+ return update;
604
+ }
605
+
606
+ // node_modules/@mantine/hooks/esm/use-id/use-id.mjs
607
+ import { useId, useState as useState7 } from "react";
608
+
609
+ function useId$1(staticId) {
610
+ const [uuid, setUuid] = useState7(`mantine-${useId().replace(/:/g, "")}`);
611
+ useIsomorphicEffect(() => {
612
+ setUuid(randomId());
613
+ }, []);
614
+ if (typeof staticId === "string")
615
+ return staticId;
616
+ return uuid;
617
+ }
618
+
619
+ // node_modules/@mantine/hooks/esm/use-idle/use-idle.mjs
620
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState8 } from "react";
621
+
622
+ var DEFAULT_OPTIONS2 = {
623
+ events: [
624
+ "keydown",
625
+ "mousemove",
626
+ "touchmove",
627
+ "click",
628
+ "scroll",
629
+ "wheel"
630
+ ],
631
+ initialState: true
632
+ };
633
+ function useIdle(timeout, options) {
634
+ const { events, initialState } = {
635
+ ...DEFAULT_OPTIONS2,
636
+ ...options
637
+ };
638
+ const [idle, setIdle] = useState8(initialState);
639
+ const timer = useRef10(-1);
640
+ useEffect12(() => {
641
+ const handleEvents = () => {
642
+ setIdle(false);
643
+ if (timer.current)
644
+ window.clearTimeout(timer.current);
645
+ timer.current = window.setTimeout(() => {
646
+ setIdle(true);
647
+ }, timeout);
648
+ };
649
+ events.forEach((event) => document.addEventListener(event, handleEvents));
650
+ timer.current = window.setTimeout(() => {
651
+ setIdle(true);
652
+ }, timeout);
653
+ return () => {
654
+ events.forEach((event) => document.removeEventListener(event, handleEvents));
655
+ window.clearTimeout(timer.current);
656
+ timer.current = -1;
657
+ };
658
+ }, [timeout]);
659
+ return idle;
660
+ }
661
+
662
+ // node_modules/@mantine/hooks/esm/use-interval/use-interval.mjs
663
+ import { useCallback as useCallback5, useEffect as useEffect13, useRef as useRef11, useState as useState9 } from "react";
664
+
665
+ function useInterval(fn, interval, { autoInvoke = false } = {}) {
666
+ const [active, setActive] = useState9(false);
667
+ const intervalRef = useRef11(null);
668
+ const fnRef = useRef11(null);
669
+ const intervalValueRef = useRef11(interval);
670
+ intervalValueRef.current = interval;
671
+ const start = useCallback5(() => {
672
+ setActive((old) => {
673
+ if (!old && !intervalRef.current)
674
+ intervalRef.current = window.setInterval(fnRef.current, intervalValueRef.current);
675
+ return true;
676
+ });
677
+ }, []);
678
+ const stop = useCallback5(() => {
679
+ setActive(false);
680
+ if (intervalRef.current)
681
+ window.clearInterval(intervalRef.current);
682
+ intervalRef.current = null;
683
+ }, []);
684
+ const toggle = useCallback5(() => {
685
+ setActive((current) => {
686
+ if (current) {
687
+ if (intervalRef.current)
688
+ window.clearInterval(intervalRef.current);
689
+ intervalRef.current = null;
690
+ return false;
691
+ }
692
+ if (!intervalRef.current)
693
+ intervalRef.current = window.setInterval(fnRef.current, intervalValueRef.current);
694
+ return true;
695
+ });
696
+ }, []);
697
+ useEffect13(() => {
698
+ fnRef.current = fn;
699
+ active && start();
700
+ return stop;
701
+ }, [
702
+ fn,
703
+ active,
704
+ interval
705
+ ]);
706
+ useEffect13(() => {
707
+ if (autoInvoke)
708
+ start();
709
+ }, []);
710
+ return {
711
+ start,
712
+ stop,
713
+ toggle,
714
+ active
715
+ };
716
+ }
717
+
718
+ // node_modules/@mantine/hooks/esm/use-list-state/use-list-state.mjs
719
+ import { useCallback as useCallback6, useMemo as useMemo3, useState as useState10 } from "react";
720
+
721
+ function useListState(initialValue = []) {
722
+ const [state, setState] = useState10(initialValue);
723
+ const append = useCallback6((...items) => setState((current) => [...current, ...items]), []);
724
+ const prepend = useCallback6((...items) => setState((current) => [...items, ...current]), []);
725
+ const insert = useCallback6((index, ...items) => setState((current) => [
726
+ ...current.slice(0, index),
727
+ ...items,
728
+ ...current.slice(index)
729
+ ]), []);
730
+ const apply = useCallback6((fn) => setState((current) => current.map((item, index) => fn(item, index))), []);
731
+ const remove = useCallback6((...indices) => setState((current) => current.filter((_, index) => !indices.includes(index))), []);
732
+ const pop = useCallback6(() => setState((current) => {
733
+ const cloned = [...current];
734
+ cloned.pop();
735
+ return cloned;
736
+ }), []);
737
+ const shift = useCallback6(() => setState((current) => {
738
+ const cloned = [...current];
739
+ cloned.shift();
740
+ return cloned;
741
+ }), []);
742
+ const reorder = useCallback6(({ from, to }) => setState((current) => {
743
+ const cloned = [...current];
744
+ const item = current[from];
745
+ cloned.splice(from, 1);
746
+ cloned.splice(to, 0, item);
747
+ return cloned;
748
+ }), []);
749
+ const swap = useCallback6(({ from, to }) => setState((current) => {
750
+ const cloned = [...current];
751
+ const fromItem = cloned[from];
752
+ const toItem = cloned[to];
753
+ cloned.splice(to, 1, fromItem);
754
+ cloned.splice(from, 1, toItem);
755
+ return cloned;
756
+ }), []);
757
+ const setItem = useCallback6((index, item) => setState((current) => {
758
+ const cloned = [...current];
759
+ cloned[index] = item;
760
+ return cloned;
761
+ }), []);
762
+ const setItemProp = useCallback6((index, prop, value) => setState((current) => {
763
+ const cloned = [...current];
764
+ cloned[index] = {
765
+ ...cloned[index],
766
+ [prop]: value
767
+ };
768
+ return cloned;
769
+ }), []);
770
+ const applyWhere = useCallback6((condition, fn) => setState((current) => current.map((item, index) => condition(item, index) ? fn(item, index) : item)), []);
771
+ const filter = useCallback6((fn) => {
772
+ setState((current) => current.filter(fn));
773
+ }, []);
774
+ return [state, useMemo3(() => ({
775
+ setState,
776
+ append,
777
+ prepend,
778
+ insert,
779
+ pop,
780
+ shift,
781
+ apply,
782
+ applyWhere,
783
+ remove,
784
+ reorder,
785
+ swap,
786
+ setItem,
787
+ setItemProp,
788
+ filter
789
+ }), [])];
790
+ }
791
+
792
+ // node_modules/@mantine/hooks/esm/use-window-event/use-window-event.mjs
793
+ import { useEffect as useEffect14, useEffectEvent as useEffectEvent2 } from "react";
794
+
795
+ function useWindowEvent(type, listener, options) {
796
+ const stableListener = useEffectEvent2(listener);
797
+ useEffect14(() => {
798
+ window.addEventListener(type, stableListener, options);
799
+ return () => window.removeEventListener(type, stableListener, options);
800
+ }, [type]);
801
+ }
802
+
803
+ // node_modules/@mantine/hooks/esm/use-local-storage/create-storage.mjs
804
+ import { useCallback as useCallback7, useEffect as useEffect15, useState as useState11 } from "react";
805
+
806
+ function serializeJSON(value, hookName = "use-local-storage") {
807
+ try {
808
+ return JSON.stringify(value);
809
+ } catch (error) {
810
+ throw new Error(`@mantine/hooks ${hookName}: Failed to serialize the value`);
811
+ }
812
+ }
813
+ function deserializeJSON(value) {
814
+ try {
815
+ return value && JSON.parse(value);
816
+ } catch {
817
+ return value;
818
+ }
819
+ }
820
+ function createStorageHandler(type) {
821
+ const getItem = (key) => {
822
+ try {
823
+ return window[type].getItem(key);
824
+ } catch (error) {
825
+ console.warn("use-local-storage: Failed to get value from storage, localStorage is blocked");
826
+ return null;
827
+ }
828
+ };
829
+ const setItem = (key, value) => {
830
+ try {
831
+ window[type].setItem(key, value);
832
+ } catch (error) {
833
+ console.warn("use-local-storage: Failed to set value to storage, localStorage is blocked");
834
+ }
835
+ };
836
+ const removeItem = (key) => {
837
+ try {
838
+ window[type].removeItem(key);
839
+ } catch (error) {
840
+ console.warn("use-local-storage: Failed to remove value from storage, localStorage is blocked");
841
+ }
842
+ };
843
+ return {
844
+ getItem,
845
+ setItem,
846
+ removeItem
847
+ };
848
+ }
849
+ function createStorage(type, hookName) {
850
+ const eventName = type === "localStorage" ? "mantine-local-storage" : "mantine-session-storage";
851
+ const { getItem, setItem, removeItem } = createStorageHandler(type);
852
+ return function useStorage({ key, defaultValue, getInitialValueInEffect = true, sync = true, deserialize = deserializeJSON, serialize = (value) => serializeJSON(value, hookName) }) {
853
+ const readStorageValue = useCallback7((skipStorage) => {
854
+ let storageBlockedOrSkipped;
855
+ try {
856
+ storageBlockedOrSkipped = typeof window === "undefined" || !(type in window) || window[type] === null || !!skipStorage;
857
+ } catch (_e) {
858
+ storageBlockedOrSkipped = true;
859
+ }
860
+ if (storageBlockedOrSkipped)
861
+ return defaultValue;
862
+ const storageValue = getItem(key);
863
+ return storageValue !== null ? deserialize(storageValue) : defaultValue;
864
+ }, [key, defaultValue]);
865
+ const [value, setValue] = useState11(readStorageValue(getInitialValueInEffect));
866
+ const setStorageValue = useCallback7((val) => {
867
+ if (val instanceof Function)
868
+ setValue((current) => {
869
+ const result = val(current);
870
+ setItem(key, serialize(result));
871
+ queueMicrotask(() => {
872
+ window.dispatchEvent(new CustomEvent(eventName, { detail: {
873
+ key,
874
+ value: result
875
+ } }));
876
+ });
877
+ return result;
878
+ });
879
+ else {
880
+ setItem(key, serialize(val));
881
+ window.dispatchEvent(new CustomEvent(eventName, { detail: {
882
+ key,
883
+ value: val
884
+ } }));
885
+ setValue(val);
886
+ }
887
+ }, [key]);
888
+ const removeStorageValue = useCallback7(() => {
889
+ removeItem(key);
890
+ setValue(defaultValue);
891
+ window.dispatchEvent(new CustomEvent(eventName, { detail: {
892
+ key,
893
+ value: defaultValue
894
+ } }));
895
+ }, [key, defaultValue]);
896
+ useWindowEvent("storage", (event) => {
897
+ if (sync) {
898
+ if (event.storageArea === window[type] && event.key === key)
899
+ setValue(deserialize(event.newValue ?? undefined));
900
+ }
901
+ });
902
+ useWindowEvent(eventName, (event) => {
903
+ if (sync) {
904
+ if (event.detail.key === key)
905
+ setValue(event.detail.value);
906
+ }
907
+ });
908
+ useEffect15(() => {
909
+ if (defaultValue !== undefined && value === undefined)
910
+ setStorageValue(defaultValue);
911
+ }, [
912
+ defaultValue,
913
+ value,
914
+ setStorageValue
915
+ ]);
916
+ useEffect15(() => {
917
+ const val = readStorageValue();
918
+ val !== undefined && setStorageValue(val);
919
+ }, [key]);
920
+ return [
921
+ value === undefined ? defaultValue : value,
922
+ setStorageValue,
923
+ removeStorageValue
924
+ ];
925
+ };
926
+ }
927
+ function readValue(type) {
928
+ const { getItem } = createStorageHandler(type);
929
+ return function read({ key, defaultValue, deserialize = deserializeJSON }) {
930
+ let storageBlockedOrSkipped;
931
+ try {
932
+ storageBlockedOrSkipped = typeof window === "undefined" || !(type in window) || window[type] === null;
933
+ } catch (_e) {
934
+ storageBlockedOrSkipped = true;
935
+ }
936
+ if (storageBlockedOrSkipped)
937
+ return defaultValue;
938
+ const storageValue = getItem(key);
939
+ return storageValue !== null ? deserialize(storageValue) : defaultValue;
940
+ };
941
+ }
942
+
943
+ // node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.mjs
944
+
945
+ function useLocalStorage(props) {
946
+ return createStorage("localStorage", "use-local-storage")(props);
947
+ }
948
+ var readLocalStorageValue = readValue("localStorage");
949
+
950
+ // node_modules/@mantine/hooks/esm/use-session-storage/use-session-storage.mjs
951
+
952
+ function useSessionStorage(props) {
953
+ return createStorage("sessionStorage", "use-session-storage")(props);
954
+ }
955
+ var readSessionStorageValue = readValue("sessionStorage");
956
+
957
+ // node_modules/@mantine/hooks/esm/use-merged-ref/use-merged-ref.mjs
958
+ import { useCallback as useCallback8 } from "react";
959
+
960
+ function assignRef(ref, value) {
961
+ if (typeof ref === "function")
962
+ return ref(value);
963
+ else if (typeof ref === "object" && ref !== null && "current" in ref)
964
+ ref.current = value;
965
+ }
966
+ function mergeRefs(...refs) {
967
+ const cleanupMap = /* @__PURE__ */ new Map;
968
+ return (node) => {
969
+ refs.forEach((ref) => {
970
+ const cleanup = assignRef(ref, node);
971
+ if (cleanup)
972
+ cleanupMap.set(ref, cleanup);
973
+ });
974
+ if (cleanupMap.size > 0)
975
+ return () => {
976
+ refs.forEach((ref) => {
977
+ const cleanup = cleanupMap.get(ref);
978
+ if (cleanup && typeof cleanup === "function")
979
+ cleanup();
980
+ else
981
+ assignRef(ref, null);
982
+ });
983
+ cleanupMap.clear();
984
+ };
985
+ };
986
+ }
987
+ function useMergedRef(...refs) {
988
+ return useCallback8(mergeRefs(...refs), refs);
989
+ }
990
+
991
+ // node_modules/@mantine/hooks/esm/use-mouse/use-mouse.mjs
992
+ import { useCallback as useCallback9, useEffect as useEffect16, useState as useState12 } from "react";
993
+
994
+ function useMouse(options = { resetOnExit: false }) {
995
+ const [position, setPosition] = useState12({
996
+ x: 0,
997
+ y: 0
998
+ });
999
+ return {
1000
+ ref: useCallback9((node) => {
1001
+ const setMousePosition = (event) => {
1002
+ const mouseEvent = event;
1003
+ if (node) {
1004
+ const rect = node.getBoundingClientRect();
1005
+ setPosition({
1006
+ x: Math.max(0, Math.round(mouseEvent.clientX - rect.left)),
1007
+ y: Math.max(0, Math.round(mouseEvent.clientY - rect.top))
1008
+ });
1009
+ } else
1010
+ setPosition({
1011
+ x: mouseEvent.clientX,
1012
+ y: mouseEvent.clientY
1013
+ });
1014
+ };
1015
+ const resetMousePosition = () => setPosition({
1016
+ x: 0,
1017
+ y: 0
1018
+ });
1019
+ node?.addEventListener("mousemove", setMousePosition);
1020
+ if (options.resetOnExit)
1021
+ node?.addEventListener("mouseleave", resetMousePosition);
1022
+ return () => {
1023
+ node?.removeEventListener("mousemove", setMousePosition);
1024
+ if (options.resetOnExit)
1025
+ node?.removeEventListener("mouseleave", resetMousePosition);
1026
+ };
1027
+ }, [options.resetOnExit]),
1028
+ ...position
1029
+ };
1030
+ }
1031
+ function useMousePosition() {
1032
+ const [position, setPosition] = useState12({
1033
+ x: 0,
1034
+ y: 0
1035
+ });
1036
+ useEffect16(() => {
1037
+ const setMousePosition = (event) => {
1038
+ setPosition({
1039
+ x: event.clientX,
1040
+ y: event.clientY
1041
+ });
1042
+ };
1043
+ document.addEventListener("mousemove", setMousePosition);
1044
+ return () => {
1045
+ document.removeEventListener("mousemove", setMousePosition);
1046
+ };
1047
+ }, []);
1048
+ return position;
1049
+ }
1050
+
1051
+ // node_modules/@mantine/hooks/esm/use-move/use-move.mjs
1052
+ import { useCallback as useCallback10, useEffect as useEffect17, useRef as useRef12, useState as useState13 } from "react";
1053
+
1054
+ function clampUseMovePosition(position) {
1055
+ return {
1056
+ x: clamp(position.x, 0, 1),
1057
+ y: clamp(position.y, 0, 1)
1058
+ };
1059
+ }
1060
+ function useMove(onChange, handlers, dir = "ltr") {
1061
+ const mounted = useRef12(false);
1062
+ const isSliding = useRef12(false);
1063
+ const frame = useRef12(0);
1064
+ const cleanupRef = useRef12(null);
1065
+ const [active, setActive] = useState13(false);
1066
+ useEffect17(() => {
1067
+ mounted.current = true;
1068
+ return () => {
1069
+ cleanupRef.current?.();
1070
+ };
1071
+ }, []);
1072
+ return {
1073
+ ref: useCallback10((node) => {
1074
+ const onScrub = ({ x, y }) => {
1075
+ cancelAnimationFrame(frame.current);
1076
+ frame.current = requestAnimationFrame(() => {
1077
+ if (mounted.current && node) {
1078
+ node.style.userSelect = "none";
1079
+ const rect = node.getBoundingClientRect();
1080
+ if (rect.width && rect.height) {
1081
+ const _x = clamp((x - rect.left) / rect.width, 0, 1);
1082
+ onChange({
1083
+ x: dir === "ltr" ? _x : 1 - _x,
1084
+ y: clamp((y - rect.top) / rect.height, 0, 1)
1085
+ });
1086
+ }
1087
+ }
1088
+ });
1089
+ };
1090
+ const bindEvents = () => {
1091
+ document.addEventListener("mousemove", onMouseMove);
1092
+ document.addEventListener("mouseup", stopScrubbing);
1093
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
1094
+ document.addEventListener("touchend", stopScrubbing);
1095
+ };
1096
+ const unbindEvents = () => {
1097
+ document.removeEventListener("mousemove", onMouseMove);
1098
+ document.removeEventListener("mouseup", stopScrubbing);
1099
+ document.removeEventListener("touchmove", onTouchMove);
1100
+ document.removeEventListener("touchend", stopScrubbing);
1101
+ };
1102
+ const startScrubbing = () => {
1103
+ if (!isSliding.current && mounted.current) {
1104
+ isSliding.current = true;
1105
+ typeof handlers?.onScrubStart === "function" && handlers.onScrubStart();
1106
+ setActive(true);
1107
+ bindEvents();
1108
+ }
1109
+ };
1110
+ const stopScrubbing = () => {
1111
+ if (isSliding.current && mounted.current) {
1112
+ isSliding.current = false;
1113
+ setActive(false);
1114
+ unbindEvents();
1115
+ setTimeout(() => {
1116
+ typeof handlers?.onScrubEnd === "function" && handlers.onScrubEnd();
1117
+ }, 0);
1118
+ }
1119
+ };
1120
+ const onMouseDown = (event) => {
1121
+ startScrubbing();
1122
+ event.preventDefault();
1123
+ onMouseMove(event);
1124
+ };
1125
+ const onMouseMove = (event) => onScrub({
1126
+ x: event.clientX,
1127
+ y: event.clientY
1128
+ });
1129
+ const onTouchStart = (event) => {
1130
+ if (event.cancelable)
1131
+ event.preventDefault();
1132
+ startScrubbing();
1133
+ onTouchMove(event);
1134
+ };
1135
+ const onTouchMove = (event) => {
1136
+ if (event.cancelable)
1137
+ event.preventDefault();
1138
+ onScrub({
1139
+ x: event.changedTouches[0].clientX,
1140
+ y: event.changedTouches[0].clientY
1141
+ });
1142
+ };
1143
+ node?.addEventListener("mousedown", onMouseDown);
1144
+ node?.addEventListener("touchstart", onTouchStart, { passive: false });
1145
+ cleanupRef.current = () => {
1146
+ unbindEvents();
1147
+ cancelAnimationFrame(frame.current);
1148
+ };
1149
+ return () => {
1150
+ if (node) {
1151
+ node.removeEventListener("mousedown", onMouseDown);
1152
+ node.removeEventListener("touchstart", onTouchStart);
1153
+ }
1154
+ };
1155
+ }, [dir, onChange]),
1156
+ active
1157
+ };
1158
+ }
1159
+
1160
+ // node_modules/@mantine/hooks/esm/use-uncontrolled/use-uncontrolled.mjs
1161
+ import { useState as useState14 } from "react";
1162
+
1163
+ function useUncontrolled({ value, defaultValue, finalValue, onChange = () => {} }) {
1164
+ const [uncontrolledValue, setUncontrolledValue] = useState14(defaultValue !== undefined ? defaultValue : finalValue);
1165
+ const handleUncontrolledChange = (val, ...payload) => {
1166
+ setUncontrolledValue(val);
1167
+ onChange?.(val, ...payload);
1168
+ };
1169
+ if (value !== undefined)
1170
+ return [
1171
+ value,
1172
+ onChange,
1173
+ true
1174
+ ];
1175
+ return [
1176
+ uncontrolledValue,
1177
+ handleUncontrolledChange,
1178
+ false
1179
+ ];
1180
+ }
1181
+
1182
+ // node_modules/@mantine/hooks/esm/use-pagination/use-pagination.mjs
1183
+ import { useCallback as useCallback11, useMemo as useMemo4 } from "react";
1184
+
1185
+ function range2(start, end) {
1186
+ const length = end - start + 1;
1187
+ return Array.from({ length }, (_, index) => index + start);
1188
+ }
1189
+ var DOTS = "dots";
1190
+ function usePagination({ total, siblings = 1, boundaries = 1, page, initialPage, onChange, startValue = 1 }) {
1191
+ const _startValue = Math.max(Math.trunc(startValue), 1);
1192
+ const _endValue = Math.max(Math.trunc(total), _startValue);
1193
+ const _total = _endValue - _startValue + 1;
1194
+ const _initialPage = initialPage ?? _startValue;
1195
+ const [activePage, setActivePage] = useUncontrolled({
1196
+ value: page,
1197
+ onChange,
1198
+ defaultValue: _initialPage,
1199
+ finalValue: _initialPage
1200
+ });
1201
+ const setPage = useCallback11((pageNumber) => {
1202
+ if (pageNumber < _startValue)
1203
+ setActivePage(_startValue);
1204
+ else if (pageNumber > _endValue)
1205
+ setActivePage(_endValue);
1206
+ else
1207
+ setActivePage(pageNumber);
1208
+ }, [
1209
+ _startValue,
1210
+ _endValue,
1211
+ setActivePage
1212
+ ]);
1213
+ const next = useCallback11(() => setPage(activePage + 1), [activePage, setPage]);
1214
+ const previous = useCallback11(() => setPage(activePage - 1), [activePage, setPage]);
1215
+ const first = useCallback11(() => setPage(_startValue), [setPage, _startValue]);
1216
+ const last = useCallback11(() => setPage(_endValue), [_endValue, setPage]);
1217
+ return {
1218
+ range: useMemo4(() => {
1219
+ if (siblings * 2 + 3 + boundaries * 2 >= _total)
1220
+ return range2(_startValue, _endValue);
1221
+ const leftSiblingIndex = Math.max(activePage - siblings, _startValue + boundaries - 1);
1222
+ const rightSiblingIndex = Math.min(activePage + siblings, _endValue - boundaries);
1223
+ const shouldShowLeftDots = leftSiblingIndex > _startValue + boundaries + 1;
1224
+ const shouldShowRightDots = rightSiblingIndex < _endValue - boundaries;
1225
+ if (!shouldShowLeftDots && shouldShowRightDots)
1226
+ return [
1227
+ ...range2(_startValue, _startValue + (siblings * 2 + boundaries + 2) - 1),
1228
+ DOTS,
1229
+ ...range2(_endValue - (boundaries - 1), _endValue)
1230
+ ];
1231
+ if (shouldShowLeftDots && !shouldShowRightDots) {
1232
+ const rightItemCount = boundaries + 1 + 2 * siblings;
1233
+ return [
1234
+ ...range2(_startValue, _startValue + boundaries - 1),
1235
+ DOTS,
1236
+ ...range2(_endValue - rightItemCount, _endValue)
1237
+ ];
1238
+ }
1239
+ return [
1240
+ ...range2(_startValue, _startValue + boundaries - 1),
1241
+ DOTS,
1242
+ ...range2(leftSiblingIndex, rightSiblingIndex),
1243
+ DOTS,
1244
+ ...range2(_endValue - boundaries + 1, _endValue)
1245
+ ];
1246
+ }, [
1247
+ _total,
1248
+ siblings,
1249
+ activePage,
1250
+ _startValue,
1251
+ _endValue,
1252
+ boundaries
1253
+ ]),
1254
+ active: activePage,
1255
+ setPage,
1256
+ next,
1257
+ previous,
1258
+ first,
1259
+ last
1260
+ };
1261
+ }
1262
+
1263
+ // node_modules/@mantine/hooks/esm/use-queue/use-queue.mjs
1264
+ import { useState as useState15 } from "react";
1265
+
1266
+ function useQueue({ initialValues = [], limit }) {
1267
+ const [state, setState] = useState15({
1268
+ state: initialValues.slice(0, limit),
1269
+ queue: initialValues.slice(limit)
1270
+ });
1271
+ const add = (...items) => setState((current) => {
1272
+ const results = [
1273
+ ...current.state,
1274
+ ...current.queue,
1275
+ ...items
1276
+ ];
1277
+ return {
1278
+ state: results.slice(0, limit),
1279
+ queue: results.slice(limit)
1280
+ };
1281
+ });
1282
+ const update = (fn) => setState((current) => {
1283
+ const results = fn([...current.state, ...current.queue]);
1284
+ return {
1285
+ state: results.slice(0, limit),
1286
+ queue: results.slice(limit)
1287
+ };
1288
+ });
1289
+ const cleanQueue = () => setState((current) => ({
1290
+ state: current.state,
1291
+ queue: []
1292
+ }));
1293
+ return {
1294
+ state: state.state,
1295
+ queue: state.queue,
1296
+ add,
1297
+ update,
1298
+ cleanQueue
1299
+ };
1300
+ }
1301
+
1302
+ // node_modules/@mantine/hooks/esm/use-page-leave/use-page-leave.mjs
1303
+ import { useEffect as useEffect18, useEffectEvent as useEffectEvent3 } from "react";
1304
+
1305
+ function usePageLeave(onPageLeave) {
1306
+ const onPageLeaveEvent = useEffectEvent3(onPageLeave);
1307
+ useEffect18(() => {
1308
+ document.documentElement.addEventListener("mouseleave", onPageLeaveEvent);
1309
+ return () => document.documentElement.removeEventListener("mouseleave", onPageLeaveEvent);
1310
+ }, []);
1311
+ }
1312
+
1313
+ // node_modules/@mantine/hooks/esm/use-reduced-motion/use-reduced-motion.mjs
1314
+
1315
+ function useReducedMotion(initialValue, options) {
1316
+ return useMediaQuery("(prefers-reduced-motion: reduce)", initialValue, options);
1317
+ }
1318
+
1319
+ // node_modules/@mantine/hooks/esm/use-scroll-into-view/use-scroll-into-view.mjs
1320
+ import { useCallback as useCallback12, useEffect as useEffect19, useRef as useRef13, useState as useState16 } from "react";
1321
+
1322
+ function useScrollIntoView({ duration = 1250, axis = "y", onScrollFinish, onScrollCancel, easing = easeInOutQuad, offset = 0, cancelable = true, isList = false } = {}) {
1323
+ const frameID = useRef13(0);
1324
+ const startTime = useRef13(0);
1325
+ const shouldStop = useRef13(false);
1326
+ const [scrolling, setScrolling] = useState16(false);
1327
+ const scrollableRef = useRef13(null);
1328
+ const targetRef = useRef13(null);
1329
+ const reducedMotion = useReducedMotion();
1330
+ const cancel = () => {
1331
+ if (frameID.current) {
1332
+ cancelAnimationFrame(frameID.current);
1333
+ frameID.current = 0;
1334
+ setScrolling(false);
1335
+ }
1336
+ };
1337
+ const scrollIntoView = useCallback12(({ alignment = "start" } = {}) => {
1338
+ shouldStop.current = false;
1339
+ if (frameID.current)
1340
+ cancel();
1341
+ const start = getScrollStart({
1342
+ parent: scrollableRef.current,
1343
+ axis
1344
+ }) ?? 0;
1345
+ const change = getRelativePosition({
1346
+ parent: scrollableRef.current,
1347
+ target: targetRef.current,
1348
+ axis,
1349
+ alignment,
1350
+ offset,
1351
+ isList
1352
+ }) - (scrollableRef.current ? 0 : start);
1353
+ setScrolling(true);
1354
+ function animateScroll() {
1355
+ if (startTime.current === 0)
1356
+ startTime.current = performance.now();
1357
+ const elapsed = performance.now() - startTime.current;
1358
+ const t = reducedMotion || duration === 0 ? 1 : elapsed / duration;
1359
+ const distance = start + change * easing(t);
1360
+ setScrollParam({
1361
+ parent: scrollableRef.current,
1362
+ axis,
1363
+ distance
1364
+ });
1365
+ if (!shouldStop.current && t < 1)
1366
+ frameID.current = requestAnimationFrame(animateScroll);
1367
+ else {
1368
+ if (shouldStop.current)
1369
+ typeof onScrollCancel === "function" && onScrollCancel();
1370
+ else
1371
+ typeof onScrollFinish === "function" && onScrollFinish();
1372
+ startTime.current = 0;
1373
+ frameID.current = 0;
1374
+ setScrolling(false);
1375
+ cancel();
1376
+ }
1377
+ }
1378
+ animateScroll();
1379
+ }, [
1380
+ axis,
1381
+ duration,
1382
+ easing,
1383
+ isList,
1384
+ offset,
1385
+ onScrollFinish,
1386
+ onScrollCancel,
1387
+ reducedMotion
1388
+ ]);
1389
+ const handleStop = () => {
1390
+ if (cancelable)
1391
+ shouldStop.current = true;
1392
+ };
1393
+ useWindowEvent("wheel", handleStop, { passive: true });
1394
+ useWindowEvent("touchmove", handleStop, { passive: true });
1395
+ useEffect19(() => cancel, []);
1396
+ return {
1397
+ scrollableRef,
1398
+ targetRef,
1399
+ scrollIntoView,
1400
+ cancel,
1401
+ scrolling
1402
+ };
1403
+ }
1404
+ function easeInOutQuad(t) {
1405
+ return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
1406
+ }
1407
+ function getRelativePosition({ axis, target, parent, alignment, offset, isList }) {
1408
+ if (!target || !parent && typeof document === "undefined")
1409
+ return 0;
1410
+ const isCustomParent = !!parent;
1411
+ const parentPosition = (parent || document.body).getBoundingClientRect();
1412
+ const targetPosition = target.getBoundingClientRect();
1413
+ const getDiff = (property) => targetPosition[property] - parentPosition[property];
1414
+ if (axis === "y") {
1415
+ const diff = getDiff("top");
1416
+ if (diff === 0)
1417
+ return 0;
1418
+ if (alignment === "start") {
1419
+ const distance = diff - offset;
1420
+ return distance <= targetPosition.height * (isList ? 0 : 1) || !isList ? distance : 0;
1421
+ }
1422
+ const parentHeight = isCustomParent ? parentPosition.height : window.innerHeight;
1423
+ if (alignment === "end") {
1424
+ const distance = diff + offset - parentHeight + targetPosition.height;
1425
+ return distance >= -targetPosition.height * (isList ? 0 : 1) || !isList ? distance : 0;
1426
+ }
1427
+ if (alignment === "center")
1428
+ return diff - parentHeight / 2 + targetPosition.height / 2;
1429
+ return 0;
1430
+ }
1431
+ if (axis === "x") {
1432
+ const diff = getDiff("left");
1433
+ if (diff === 0)
1434
+ return 0;
1435
+ if (alignment === "start") {
1436
+ const distance = diff - offset;
1437
+ return distance <= targetPosition.width || !isList ? distance : 0;
1438
+ }
1439
+ const parentWidth = isCustomParent ? parentPosition.width : window.innerWidth;
1440
+ if (alignment === "end") {
1441
+ const distance = diff + offset - parentWidth + targetPosition.width;
1442
+ return distance >= -targetPosition.width || !isList ? distance : 0;
1443
+ }
1444
+ if (alignment === "center")
1445
+ return diff - parentWidth / 2 + targetPosition.width / 2;
1446
+ return 0;
1447
+ }
1448
+ return 0;
1449
+ }
1450
+ function getScrollStart({ axis, parent }) {
1451
+ if (!parent && typeof document === "undefined")
1452
+ return 0;
1453
+ const method = axis === "y" ? "scrollTop" : "scrollLeft";
1454
+ if (parent)
1455
+ return parent[method];
1456
+ const { body, documentElement } = document;
1457
+ return body[method] + documentElement[method];
1458
+ }
1459
+ function setScrollParam({ axis, parent, distance }) {
1460
+ if (!parent && typeof document === "undefined")
1461
+ return;
1462
+ const method = axis === "y" ? "scrollTop" : "scrollLeft";
1463
+ if (parent)
1464
+ parent[method] = distance;
1465
+ else {
1466
+ const { body, documentElement } = document;
1467
+ body[method] = distance;
1468
+ documentElement[method] = distance;
1469
+ }
1470
+ }
1471
+
1472
+ // node_modules/@mantine/hooks/esm/use-resize-observer/use-resize-observer.mjs
1473
+ import { useCallback as useCallback13, useRef as useRef14, useState as useState17 } from "react";
1474
+
1475
+ var defaultState = {
1476
+ x: 0,
1477
+ y: 0,
1478
+ width: 0,
1479
+ height: 0,
1480
+ top: 0,
1481
+ left: 0,
1482
+ bottom: 0,
1483
+ right: 0
1484
+ };
1485
+ function useResizeObserver(options) {
1486
+ const frameID = useRef14(0);
1487
+ const [rect, setRect] = useState17(defaultState);
1488
+ const observerRef = useRef14(null);
1489
+ return [useCallback13((node) => {
1490
+ if (observerRef.current) {
1491
+ observerRef.current.disconnect();
1492
+ observerRef.current = null;
1493
+ }
1494
+ if (frameID.current)
1495
+ cancelAnimationFrame(frameID.current);
1496
+ if (!node)
1497
+ return;
1498
+ observerRef.current = new ResizeObserver((entries) => {
1499
+ const entry = entries[0];
1500
+ if (entry) {
1501
+ cancelAnimationFrame(frameID.current);
1502
+ frameID.current = requestAnimationFrame(() => {
1503
+ const boxSize = entry.borderBoxSize?.[0] || entry.contentBoxSize?.[0];
1504
+ if (boxSize) {
1505
+ const width = boxSize.inlineSize;
1506
+ const height = boxSize.blockSize;
1507
+ setRect({
1508
+ width,
1509
+ height,
1510
+ x: entry.contentRect.x,
1511
+ y: entry.contentRect.y,
1512
+ top: entry.contentRect.top,
1513
+ left: entry.contentRect.left,
1514
+ bottom: entry.contentRect.bottom,
1515
+ right: entry.contentRect.right
1516
+ });
1517
+ } else
1518
+ setRect(entry.contentRect);
1519
+ });
1520
+ }
1521
+ });
1522
+ observerRef.current.observe(node, options);
1523
+ }, [options]), rect];
1524
+ }
1525
+ function useElementSize(options) {
1526
+ const [ref, { width, height }] = useResizeObserver(options);
1527
+ return {
1528
+ ref,
1529
+ width,
1530
+ height
1531
+ };
1532
+ }
1533
+
1534
+ // node_modules/@mantine/hooks/esm/use-shallow-effect/use-shallow-effect.mjs
1535
+ import { useEffect as useEffect20, useRef as useRef15 } from "react";
1536
+
1537
+ function shallowCompare(prevValue, currValue) {
1538
+ if (!prevValue || !currValue)
1539
+ return false;
1540
+ if (prevValue === currValue)
1541
+ return true;
1542
+ if (prevValue.length !== currValue.length)
1543
+ return false;
1544
+ for (let i = 0;i < prevValue.length; i += 1)
1545
+ if (!shallowEqual(prevValue[i], currValue[i]))
1546
+ return false;
1547
+ return true;
1548
+ }
1549
+ function useShallowCompare(dependencies) {
1550
+ const ref = useRef15([]);
1551
+ const updateRef = useRef15(0);
1552
+ if (!shallowCompare(ref.current, dependencies)) {
1553
+ ref.current = dependencies;
1554
+ updateRef.current += 1;
1555
+ }
1556
+ return [updateRef.current];
1557
+ }
1558
+ function useShallowEffect(cb, dependencies) {
1559
+ useEffect20(cb, useShallowCompare(dependencies));
1560
+ }
1561
+
1562
+ // node_modules/@mantine/hooks/esm/use-toggle/use-toggle.mjs
1563
+ import { useReducer as useReducer2 } from "react";
1564
+
1565
+ function useToggle(options = [false, true]) {
1566
+ const [[option], toggle] = useReducer2((state, action) => {
1567
+ const value = action instanceof Function ? action(state[0]) : action;
1568
+ const index = Math.abs(state.indexOf(value));
1569
+ return state.slice(index).concat(state.slice(0, index));
1570
+ }, options);
1571
+ return [option, toggle];
1572
+ }
1573
+
1574
+ // node_modules/@mantine/hooks/esm/use-viewport-size/use-viewport-size.mjs
1575
+ import { useCallback as useCallback14, useEffect as useEffect21, useState as useState18 } from "react";
1576
+
1577
+ var eventListenerOptions = { passive: true };
1578
+ function useViewportSize() {
1579
+ const [windowSize, setWindowSize] = useState18({
1580
+ width: 0,
1581
+ height: 0
1582
+ });
1583
+ const setSize = useCallback14(() => {
1584
+ setWindowSize({
1585
+ width: window.innerWidth || 0,
1586
+ height: window.innerHeight || 0
1587
+ });
1588
+ }, []);
1589
+ useWindowEvent("resize", setSize, eventListenerOptions);
1590
+ useWindowEvent("orientationchange", setSize, eventListenerOptions);
1591
+ useEffect21(setSize, []);
1592
+ return windowSize;
1593
+ }
1594
+
1595
+ // node_modules/@mantine/hooks/esm/use-window-scroll/use-window-scroll.mjs
1596
+ import { useEffect as useEffect22, useState as useState19 } from "react";
1597
+
1598
+ function getScrollPosition() {
1599
+ return typeof window !== "undefined" ? {
1600
+ x: window.scrollX,
1601
+ y: window.scrollY
1602
+ } : {
1603
+ x: 0,
1604
+ y: 0
1605
+ };
1606
+ }
1607
+ function scrollTo({ x, y }) {
1608
+ if (typeof window !== "undefined") {
1609
+ const scrollOptions = { behavior: "smooth" };
1610
+ if (typeof x === "number")
1611
+ scrollOptions.left = x;
1612
+ if (typeof y === "number")
1613
+ scrollOptions.top = y;
1614
+ window.scrollTo(scrollOptions);
1615
+ }
1616
+ }
1617
+ function useWindowScroll() {
1618
+ const [position, setPosition] = useState19({
1619
+ x: 0,
1620
+ y: 0
1621
+ });
1622
+ useWindowEvent("scroll", () => setPosition(getScrollPosition()), { passive: true });
1623
+ useWindowEvent("resize", () => setPosition(getScrollPosition()), { passive: true });
1624
+ useEffect22(() => {
1625
+ setPosition(getScrollPosition());
1626
+ }, []);
1627
+ return [position, scrollTo];
1628
+ }
1629
+
1630
+ // node_modules/@mantine/hooks/esm/use-intersection/use-intersection.mjs
1631
+ import { useCallback as useCallback15, useRef as useRef16, useState as useState20 } from "react";
1632
+
1633
+ function useIntersection(options) {
1634
+ const [entry, setEntry] = useState20(null);
1635
+ const observer = useRef16(null);
1636
+ return {
1637
+ ref: useCallback15((element) => {
1638
+ if (observer.current) {
1639
+ observer.current.disconnect();
1640
+ observer.current = null;
1641
+ }
1642
+ if (element === null) {
1643
+ setEntry(null);
1644
+ return;
1645
+ }
1646
+ observer.current = new IntersectionObserver(([_entry]) => {
1647
+ setEntry(_entry);
1648
+ }, options);
1649
+ observer.current.observe(element);
1650
+ }, [
1651
+ options?.rootMargin,
1652
+ options?.root,
1653
+ options?.threshold
1654
+ ]),
1655
+ entry
1656
+ };
1657
+ }
1658
+
1659
+ // node_modules/@mantine/hooks/esm/use-hash/use-hash.mjs
1660
+ import { useEffect as useEffect23, useState as useState21 } from "react";
1661
+
1662
+ function useHash({ getInitialValueInEffect = true } = {}) {
1663
+ const [hash, setHash] = useState21(getInitialValueInEffect ? "" : window.location.hash || "");
1664
+ const setHashHandler = (value) => {
1665
+ const valueWithHash = value.startsWith("#") ? value : `#${value}`;
1666
+ window.location.hash = valueWithHash;
1667
+ setHash(valueWithHash);
1668
+ };
1669
+ useWindowEvent("hashchange", () => {
1670
+ const newHash = window.location.hash;
1671
+ if (hash !== newHash)
1672
+ setHash(newHash);
1673
+ });
1674
+ useEffect23(() => {
1675
+ if (getInitialValueInEffect)
1676
+ setHash(window.location.hash);
1677
+ }, []);
1678
+ return [hash, setHashHandler];
1679
+ }
1680
+
1681
+ // node_modules/@mantine/hooks/esm/use-hotkeys/parse-hotkey.mjs
1682
+
1683
+ var keyNameMap = {
1684
+ " ": "space",
1685
+ ArrowLeft: "arrowleft",
1686
+ ArrowRight: "arrowright",
1687
+ ArrowUp: "arrowup",
1688
+ ArrowDown: "arrowdown",
1689
+ Escape: "escape",
1690
+ Esc: "escape",
1691
+ esc: "escape",
1692
+ Enter: "enter",
1693
+ Tab: "tab",
1694
+ Backspace: "backspace",
1695
+ Delete: "delete",
1696
+ Insert: "insert",
1697
+ Home: "home",
1698
+ End: "end",
1699
+ PageUp: "pageup",
1700
+ PageDown: "pagedown",
1701
+ "+": "plus",
1702
+ "-": "minus",
1703
+ "*": "asterisk",
1704
+ "/": "slash"
1705
+ };
1706
+ function normalizeKey(key) {
1707
+ const lowerKey = key.replace("Key", "").toLowerCase();
1708
+ return keyNameMap[key] || lowerKey;
1709
+ }
1710
+ function parseHotkey(hotkey) {
1711
+ const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
1712
+ const modifiers = {
1713
+ alt: keys.includes("alt"),
1714
+ ctrl: keys.includes("ctrl"),
1715
+ meta: keys.includes("meta"),
1716
+ mod: keys.includes("mod"),
1717
+ shift: keys.includes("shift")
1718
+ };
1719
+ const reservedKeys = [
1720
+ "alt",
1721
+ "ctrl",
1722
+ "meta",
1723
+ "shift",
1724
+ "mod"
1725
+ ];
1726
+ const freeKey = keys.find((key) => !reservedKeys.includes(key));
1727
+ return {
1728
+ ...modifiers,
1729
+ key: freeKey === "[plus]" ? "+" : freeKey
1730
+ };
1731
+ }
1732
+ function isExactHotkey(hotkey, event, usePhysicalKeys) {
1733
+ const { alt, ctrl, meta, mod, shift, key } = hotkey;
1734
+ const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey, code: pressedCode } = event;
1735
+ if (alt !== altKey)
1736
+ return false;
1737
+ if (mod) {
1738
+ if (!ctrlKey && !metaKey)
1739
+ return false;
1740
+ } else {
1741
+ if (ctrl !== ctrlKey)
1742
+ return false;
1743
+ if (meta !== metaKey)
1744
+ return false;
1745
+ }
1746
+ if (shift !== shiftKey)
1747
+ return false;
1748
+ if (key && (usePhysicalKeys ? normalizeKey(pressedCode) === normalizeKey(key) : normalizeKey(pressedKey ?? pressedCode) === normalizeKey(key)))
1749
+ return true;
1750
+ return false;
1751
+ }
1752
+ function getHotkeyMatcher(hotkey, usePhysicalKeys) {
1753
+ return (event) => isExactHotkey(parseHotkey(hotkey), event, usePhysicalKeys);
1754
+ }
1755
+ function getHotkeyHandler(hotkeys) {
1756
+ return (event) => {
1757
+ const _event = "nativeEvent" in event ? event.nativeEvent : event;
1758
+ hotkeys.forEach(([hotkey, handler, options = {
1759
+ preventDefault: true,
1760
+ usePhysicalKeys: false
1761
+ }]) => {
1762
+ if (getHotkeyMatcher(hotkey, options.usePhysicalKeys)(_event)) {
1763
+ if (options.preventDefault)
1764
+ event.preventDefault();
1765
+ handler(_event);
1766
+ }
1767
+ });
1768
+ };
1769
+ }
1770
+
1771
+ // node_modules/@mantine/hooks/esm/use-hotkeys/use-hotkeys.mjs
1772
+ import { useEffect as useEffect24, useEffectEvent as useEffectEvent4 } from "react";
1773
+
1774
+ function shouldFireEvent(event, tagsToIgnore, triggerOnContentEditable = false) {
1775
+ if (event.target instanceof HTMLElement) {
1776
+ if (triggerOnContentEditable)
1777
+ return !tagsToIgnore.includes(event.target.tagName);
1778
+ return !event.target.isContentEditable && !tagsToIgnore.includes(event.target.tagName);
1779
+ }
1780
+ return true;
1781
+ }
1782
+ function useHotkeys(hotkeys, tagsToIgnore = [
1783
+ "INPUT",
1784
+ "TEXTAREA",
1785
+ "SELECT"
1786
+ ], triggerOnContentEditable = false) {
1787
+ const handleKeydown = useEffectEvent4((event) => {
1788
+ hotkeys.forEach(([hotkey, handler, options = {
1789
+ preventDefault: true,
1790
+ usePhysicalKeys: false
1791
+ }]) => {
1792
+ if (getHotkeyMatcher(hotkey, options.usePhysicalKeys)(event) && shouldFireEvent(event, tagsToIgnore, triggerOnContentEditable)) {
1793
+ if (options.preventDefault)
1794
+ event.preventDefault();
1795
+ handler(event);
1796
+ }
1797
+ });
1798
+ });
1799
+ useEffect24(() => {
1800
+ document.documentElement.addEventListener("keydown", handleKeydown);
1801
+ return () => document.documentElement.removeEventListener("keydown", handleKeydown);
1802
+ }, []);
1803
+ }
1804
+
1805
+ // node_modules/@mantine/hooks/esm/use-fullscreen/use-fullscreen.mjs
1806
+ import { useCallback as useCallback16, useEffect as useEffect25, useRef as useRef17, useState as useState22 } from "react";
1807
+
1808
+ function getFullscreenElement() {
1809
+ const _document = window.document;
1810
+ return _document.fullscreenElement || _document.webkitFullscreenElement || _document.mozFullScreenElement || _document.msFullscreenElement;
1811
+ }
1812
+ function exitFullscreen() {
1813
+ const _document = window.document;
1814
+ if (typeof _document.exitFullscreen === "function")
1815
+ return _document.exitFullscreen();
1816
+ if (typeof _document.msExitFullscreen === "function")
1817
+ return _document.msExitFullscreen();
1818
+ if (typeof _document.webkitExitFullscreen === "function")
1819
+ return _document.webkitExitFullscreen();
1820
+ if (typeof _document.mozCancelFullScreen === "function")
1821
+ return _document.mozCancelFullScreen();
1822
+ return null;
1823
+ }
1824
+ function enterFullScreen(element) {
1825
+ const _element = element;
1826
+ return _element.requestFullscreen?.() || _element.msRequestFullscreen?.() || _element.webkitEnterFullscreen?.() || _element.webkitRequestFullscreen?.() || _element.mozRequestFullscreen?.();
1827
+ }
1828
+ var prefixes = [
1829
+ "",
1830
+ "webkit",
1831
+ "moz",
1832
+ "ms"
1833
+ ];
1834
+ function addEvents(element, events) {
1835
+ const { onFullScreen, onError } = events;
1836
+ prefixes.forEach((prefix) => {
1837
+ element.addEventListener(`${prefix}fullscreenchange`, onFullScreen);
1838
+ element.addEventListener(`${prefix}fullscreenerror`, onError);
1839
+ });
1840
+ return () => removeEvents(element, events);
1841
+ }
1842
+ function removeEvents(element, { onFullScreen, onError }) {
1843
+ prefixes.forEach((prefix) => {
1844
+ element.removeEventListener(`${prefix}fullscreenchange`, onFullScreen);
1845
+ element.removeEventListener(`${prefix}fullscreenerror`, onError);
1846
+ });
1847
+ }
1848
+ function useFullscreenElement() {
1849
+ const [fullscreen, setFullscreen] = useState22(false);
1850
+ const refElement = useRef17(null);
1851
+ const prevNodeRef = useRef17(null);
1852
+ const handleFullscreenChange = useCallback16(() => {
1853
+ setFullscreen(refElement.current === getFullscreenElement());
1854
+ }, []);
1855
+ const handleFullscreenError = useCallback16(() => {
1856
+ setFullscreen(false);
1857
+ }, []);
1858
+ const toggle = useCallback16(async () => {
1859
+ if (!getFullscreenElement() && refElement.current)
1860
+ await enterFullScreen(refElement.current);
1861
+ else
1862
+ await exitFullscreen();
1863
+ }, []);
1864
+ return {
1865
+ ref: useCallback16((node) => {
1866
+ if (prevNodeRef.current && prevNodeRef.current !== node)
1867
+ removeEvents(prevNodeRef.current, {
1868
+ onFullScreen: handleFullscreenChange,
1869
+ onError: handleFullscreenError
1870
+ });
1871
+ if (node)
1872
+ addEvents(node, {
1873
+ onFullScreen: handleFullscreenChange,
1874
+ onError: handleFullscreenError
1875
+ });
1876
+ refElement.current = node;
1877
+ prevNodeRef.current = node;
1878
+ }, []),
1879
+ toggle,
1880
+ fullscreen
1881
+ };
1882
+ }
1883
+ function useFullscreenDocument() {
1884
+ const [fullscreen, setFullscreen] = useState22(false);
1885
+ const handleFullscreenChange = useCallback16(() => {
1886
+ setFullscreen(getFullscreenElement() === window.document.documentElement);
1887
+ }, []);
1888
+ const handleFullscreenError = useCallback16(() => {
1889
+ setFullscreen(false);
1890
+ }, []);
1891
+ const toggle = useCallback16(async () => {
1892
+ if (!getFullscreenElement())
1893
+ await enterFullScreen(window.document.documentElement);
1894
+ else
1895
+ await exitFullscreen();
1896
+ }, []);
1897
+ useEffect25(() => {
1898
+ return addEvents(window.document.documentElement, {
1899
+ onFullScreen: handleFullscreenChange,
1900
+ onError: handleFullscreenError
1901
+ });
1902
+ }, []);
1903
+ return {
1904
+ toggle,
1905
+ fullscreen
1906
+ };
1907
+ }
1908
+
1909
+ // node_modules/@mantine/hooks/esm/use-logger/use-logger.mjs
1910
+ import { useEffect as useEffect26 } from "react";
1911
+
1912
+ function useLogger(componentName, props) {
1913
+ useEffect26(() => {
1914
+ console.log(`${componentName} mounted`, ...props);
1915
+ return () => console.log(`${componentName} unmounted`);
1916
+ }, []);
1917
+ useDidUpdate(() => {
1918
+ console.log(`${componentName} updated`, ...props);
1919
+ }, props);
1920
+ return null;
1921
+ }
1922
+
1923
+ // node_modules/@mantine/hooks/esm/use-hover/use-hover.mjs
1924
+ import { useCallback as useCallback17, useRef as useRef18, useState as useState23 } from "react";
1925
+
1926
+ function useHover() {
1927
+ const [hovered, setHovered] = useState23(false);
1928
+ const previousNode = useRef18(null);
1929
+ const handleMouseEnter = useCallback17(() => {
1930
+ setHovered(true);
1931
+ }, []);
1932
+ const handleMouseLeave = useCallback17(() => {
1933
+ setHovered(false);
1934
+ }, []);
1935
+ return {
1936
+ ref: useCallback17((node) => {
1937
+ if (previousNode.current) {
1938
+ previousNode.current.removeEventListener("mouseenter", handleMouseEnter);
1939
+ previousNode.current.removeEventListener("mouseleave", handleMouseLeave);
1940
+ }
1941
+ if (node) {
1942
+ node.addEventListener("mouseenter", handleMouseEnter);
1943
+ node.addEventListener("mouseleave", handleMouseLeave);
1944
+ }
1945
+ previousNode.current = node;
1946
+ return () => {
1947
+ previousNode.current = null;
1948
+ setHovered(false);
1949
+ };
1950
+ }, [handleMouseEnter, handleMouseLeave]),
1951
+ hovered
1952
+ };
1953
+ }
1954
+
1955
+ // node_modules/@mantine/hooks/esm/use-validated-state/use-validated-state.mjs
1956
+ import { useState as useState24 } from "react";
1957
+
1958
+ function useValidatedState(initialValue, validate, initialValidationState) {
1959
+ const [value, setValue] = useState24(initialValue);
1960
+ const [lastValidValue, setLastValidValue] = useState24(validate(initialValue) ? initialValue : undefined);
1961
+ const [valid, setValid] = useState24(typeof initialValidationState === "boolean" ? initialValidationState : validate(initialValue));
1962
+ const onChange = (val) => {
1963
+ if (validate(val)) {
1964
+ setLastValidValue(val);
1965
+ setValid(true);
1966
+ } else
1967
+ setValid(false);
1968
+ setValue(val);
1969
+ };
1970
+ return [{
1971
+ value,
1972
+ lastValidValue,
1973
+ valid
1974
+ }, onChange];
1975
+ }
1976
+
1977
+ // node_modules/@mantine/hooks/esm/use-os/use-os.mjs
1978
+ import { useState as useState25 } from "react";
1979
+
1980
+ function isMacOS(userAgent) {
1981
+ return /(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i.test(userAgent);
1982
+ }
1983
+ function isIOS(userAgent) {
1984
+ return /(iPhone)|(iPad)|(iPod)/i.test(userAgent);
1985
+ }
1986
+ function isWindows(userAgent) {
1987
+ return /(Win32)|(Win64)|(Windows)|(WinCE)/i.test(userAgent);
1988
+ }
1989
+ function isAndroid(userAgent) {
1990
+ return /Android/i.test(userAgent);
1991
+ }
1992
+ function isLinux(userAgent) {
1993
+ return /Linux/i.test(userAgent);
1994
+ }
1995
+ function isChromeOS(userAgent) {
1996
+ return /CrOS/i.test(userAgent);
1997
+ }
1998
+ function getOS() {
1999
+ if (typeof window === "undefined")
2000
+ return "undetermined";
2001
+ const { userAgent } = window.navigator;
2002
+ if (isIOS(userAgent) || isMacOS(userAgent) && "ontouchend" in document)
2003
+ return "ios";
2004
+ if (isMacOS(userAgent))
2005
+ return "macos";
2006
+ if (isWindows(userAgent))
2007
+ return "windows";
2008
+ if (isAndroid(userAgent))
2009
+ return "android";
2010
+ if (isChromeOS(userAgent))
2011
+ return "chromeos";
2012
+ if (isLinux(userAgent))
2013
+ return "linux";
2014
+ return "undetermined";
2015
+ }
2016
+ function useOs(options = { getValueInEffect: true }) {
2017
+ const [value, setValue] = useState25(options.getValueInEffect ? "undetermined" : getOS());
2018
+ useIsomorphicEffect(() => {
2019
+ if (options.getValueInEffect)
2020
+ setValue(getOS);
2021
+ }, []);
2022
+ return value;
2023
+ }
2024
+
2025
+ // node_modules/@mantine/hooks/esm/use-set-state/use-set-state.mjs
2026
+ import { useCallback as useCallback18, useState as useState26 } from "react";
2027
+
2028
+ function useSetState(initialState) {
2029
+ const [state, setState] = useState26(initialState);
2030
+ return [state, useCallback18((statePartial) => setState((current) => ({
2031
+ ...current,
2032
+ ...typeof statePartial === "function" ? statePartial(current) : statePartial
2033
+ })), [])];
2034
+ }
2035
+
2036
+ // node_modules/@mantine/hooks/esm/use-input-state/use-input-state.mjs
2037
+ import { useState as useState27 } from "react";
2038
+
2039
+ function getInputOnChange(setValue) {
2040
+ return (val) => {
2041
+ if (!val)
2042
+ setValue(val);
2043
+ else if (typeof val === "function")
2044
+ setValue(val);
2045
+ else if (typeof val === "object" && "nativeEvent" in val) {
2046
+ const { currentTarget } = val;
2047
+ if (currentTarget.type === "checkbox")
2048
+ setValue(currentTarget.checked);
2049
+ else
2050
+ setValue(currentTarget.value);
2051
+ } else
2052
+ setValue(val);
2053
+ };
2054
+ }
2055
+ function useInputState(initialState) {
2056
+ const [value, setValue] = useState27(initialState);
2057
+ return [value, getInputOnChange(setValue)];
2058
+ }
2059
+
2060
+ // node_modules/@mantine/hooks/esm/use-event-listener/use-event-listener.mjs
2061
+ import { useCallback as useCallback19, useEffect as useEffect27, useRef as useRef19 } from "react";
2062
+
2063
+ function useEventListener(type, listener, options) {
2064
+ const previousListener = useRef19(null);
2065
+ const previousNode = useRef19(null);
2066
+ const callbackRef = useCallback19((node) => {
2067
+ if (!node)
2068
+ return;
2069
+ if (previousNode.current && previousListener.current)
2070
+ previousNode.current.removeEventListener(type, previousListener.current, options);
2071
+ node.addEventListener(type, listener, options);
2072
+ previousNode.current = node;
2073
+ previousListener.current = listener;
2074
+ }, [
2075
+ type,
2076
+ listener,
2077
+ options
2078
+ ]);
2079
+ useEffect27(() => () => {
2080
+ if (previousNode.current && previousListener.current)
2081
+ previousNode.current.removeEventListener(type, previousListener.current, options);
2082
+ }, [type, options]);
2083
+ return callbackRef;
2084
+ }
2085
+
2086
+ // node_modules/@mantine/hooks/esm/use-disclosure/use-disclosure.mjs
2087
+ import { useCallback as useCallback20, useState as useState28 } from "react";
2088
+
2089
+ function useDisclosure(initialState = false, options = {}) {
2090
+ const [opened, setOpened] = useState28(initialState);
2091
+ const open = useCallback20(() => {
2092
+ setOpened((isOpened) => {
2093
+ if (!isOpened) {
2094
+ options.onOpen?.();
2095
+ return true;
2096
+ }
2097
+ return isOpened;
2098
+ });
2099
+ }, [options.onOpen]);
2100
+ const close = useCallback20(() => {
2101
+ setOpened((isOpened) => {
2102
+ if (isOpened) {
2103
+ options.onClose?.();
2104
+ return false;
2105
+ }
2106
+ return isOpened;
2107
+ });
2108
+ }, [options.onClose]);
2109
+ return [opened, {
2110
+ open,
2111
+ close,
2112
+ toggle: useCallback20(() => {
2113
+ opened ? close() : open();
2114
+ }, [
2115
+ close,
2116
+ open,
2117
+ opened
2118
+ ]),
2119
+ set: setOpened
2120
+ }];
2121
+ }
2122
+
2123
+ // node_modules/@mantine/hooks/esm/use-focus-within/use-focus-within.mjs
2124
+ import { useCallback as useCallback21, useEffect as useEffect28, useRef as useRef20, useState as useState29 } from "react";
2125
+
2126
+ function containsRelatedTarget(event) {
2127
+ if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement)
2128
+ return event.currentTarget.contains(event.relatedTarget);
2129
+ return false;
2130
+ }
2131
+ function useFocusWithin({ onBlur, onFocus } = {}) {
2132
+ const [focused, setFocused] = useState29(false);
2133
+ const focusedRef = useRef20(false);
2134
+ const previousNode = useRef20(null);
2135
+ const onFocusRef = useCallbackRef(onFocus);
2136
+ const onBlurRef = useCallbackRef(onBlur);
2137
+ const _setFocused = useCallback21((value) => {
2138
+ setFocused(value);
2139
+ focusedRef.current = value;
2140
+ }, []);
2141
+ const handleFocusIn = useCallback21((event) => {
2142
+ if (!focusedRef.current) {
2143
+ _setFocused(true);
2144
+ onFocusRef(event);
2145
+ }
2146
+ }, []);
2147
+ const handleFocusOut = useCallback21((event) => {
2148
+ if (focusedRef.current && !containsRelatedTarget(event)) {
2149
+ _setFocused(false);
2150
+ onBlurRef(event);
2151
+ }
2152
+ }, []);
2153
+ const callbackRef = useCallback21((node) => {
2154
+ if (!node)
2155
+ return;
2156
+ if (previousNode.current) {
2157
+ previousNode.current.removeEventListener("focusin", handleFocusIn);
2158
+ previousNode.current.removeEventListener("focusout", handleFocusOut);
2159
+ }
2160
+ node.addEventListener("focusin", handleFocusIn);
2161
+ node.addEventListener("focusout", handleFocusOut);
2162
+ previousNode.current = node;
2163
+ }, [handleFocusIn, handleFocusOut]);
2164
+ useEffect28(() => () => {
2165
+ if (previousNode.current) {
2166
+ previousNode.current.removeEventListener("focusin", handleFocusIn);
2167
+ previousNode.current.removeEventListener("focusout", handleFocusOut);
2168
+ }
2169
+ }, []);
2170
+ return {
2171
+ ref: callbackRef,
2172
+ focused
2173
+ };
2174
+ }
2175
+
2176
+ // node_modules/@mantine/hooks/esm/use-network/use-network.mjs
2177
+ import { useCallback as useCallback22, useEffect as useEffect29, useState as useState30 } from "react";
2178
+
2179
+ function getConnection() {
2180
+ if (typeof navigator === "undefined")
2181
+ return {};
2182
+ const _navigator = navigator;
2183
+ const connection = _navigator.connection || _navigator.mozConnection || _navigator.webkitConnection;
2184
+ if (!connection)
2185
+ return {};
2186
+ return {
2187
+ downlink: connection?.downlink,
2188
+ downlinkMax: connection?.downlinkMax,
2189
+ effectiveType: connection?.effectiveType,
2190
+ rtt: connection?.rtt,
2191
+ saveData: connection?.saveData,
2192
+ type: connection?.type
2193
+ };
2194
+ }
2195
+ function useNetwork() {
2196
+ const [status, setStatus] = useState30({ online: true });
2197
+ const handleConnectionChange = useCallback22(() => setStatus((current) => ({
2198
+ ...current,
2199
+ ...getConnection()
2200
+ })), []);
2201
+ useWindowEvent("online", () => setStatus({
2202
+ online: true,
2203
+ ...getConnection()
2204
+ }));
2205
+ useWindowEvent("offline", () => setStatus({
2206
+ online: false,
2207
+ ...getConnection()
2208
+ }));
2209
+ useEffect29(() => {
2210
+ const _navigator = navigator;
2211
+ if (_navigator.connection) {
2212
+ setStatus({
2213
+ online: _navigator.onLine,
2214
+ ...getConnection()
2215
+ });
2216
+ _navigator.connection.addEventListener("change", handleConnectionChange);
2217
+ return () => _navigator.connection.removeEventListener("change", handleConnectionChange);
2218
+ }
2219
+ if (typeof _navigator.onLine === "boolean")
2220
+ setStatus((current) => ({
2221
+ ...current,
2222
+ online: _navigator.onLine
2223
+ }));
2224
+ }, []);
2225
+ return status;
2226
+ }
2227
+
2228
+ // node_modules/@mantine/hooks/esm/use-timeout/use-timeout.mjs
2229
+ import { useCallback as useCallback23, useEffect as useEffect30, useRef as useRef21 } from "react";
2230
+
2231
+ function useTimeout(callback, delay, options = { autoInvoke: false }) {
2232
+ const timeoutRef = useRef21(null);
2233
+ const handleCallback = useCallbackRef(callback);
2234
+ const start = useCallback23((...args) => {
2235
+ if (!timeoutRef.current)
2236
+ timeoutRef.current = window.setTimeout(() => {
2237
+ handleCallback(...args);
2238
+ timeoutRef.current = null;
2239
+ }, delay);
2240
+ }, [delay]);
2241
+ const clear = useCallback23(() => {
2242
+ if (timeoutRef.current) {
2243
+ window.clearTimeout(timeoutRef.current);
2244
+ timeoutRef.current = null;
2245
+ }
2246
+ }, []);
2247
+ useEffect30(() => {
2248
+ if (options.autoInvoke)
2249
+ start();
2250
+ return clear;
2251
+ }, [clear, start]);
2252
+ return {
2253
+ start,
2254
+ clear
2255
+ };
2256
+ }
2257
+
2258
+ // node_modules/@mantine/hooks/esm/use-text-selection/use-text-selection.mjs
2259
+ import { useEffect as useEffect31, useEffectEvent as useEffectEvent5, useState as useState31 } from "react";
2260
+
2261
+ function useTextSelection() {
2262
+ const forceUpdate = useForceUpdate();
2263
+ const [selection, setSelection] = useState31(null);
2264
+ const handleSelectionChange = useEffectEvent5(() => {
2265
+ setSelection(document.getSelection());
2266
+ forceUpdate();
2267
+ });
2268
+ useEffect31(() => {
2269
+ setSelection(document.getSelection());
2270
+ document.addEventListener("selectionchange", handleSelectionChange);
2271
+ return () => document.removeEventListener("selectionchange", handleSelectionChange);
2272
+ }, []);
2273
+ return selection;
2274
+ }
2275
+
2276
+ // node_modules/@mantine/hooks/esm/use-previous/use-previous.mjs
2277
+ import { useEffect as useEffect32, useRef as useRef22 } from "react";
2278
+
2279
+ function usePrevious(value) {
2280
+ const ref = useRef22(undefined);
2281
+ useEffect32(() => {
2282
+ ref.current = value;
2283
+ }, [value]);
2284
+ return ref.current;
2285
+ }
2286
+
2287
+ // node_modules/@mantine/hooks/esm/use-favicon/use-favicon.mjs
2288
+ import { useRef as useRef23 } from "react";
2289
+
2290
+ var MIME_TYPES = {
2291
+ ico: "image/x-icon",
2292
+ png: "image/png",
2293
+ svg: "image/svg+xml",
2294
+ gif: "image/gif"
2295
+ };
2296
+ function useFavicon(url) {
2297
+ const link = useRef23(null);
2298
+ useIsomorphicEffect(() => {
2299
+ if (!url)
2300
+ return;
2301
+ if (!link.current) {
2302
+ document.querySelectorAll('link[rel*="icon"]').forEach((element2) => document.head.removeChild(element2));
2303
+ const element = document.createElement("link");
2304
+ element.rel = "shortcut icon";
2305
+ link.current = element;
2306
+ document.querySelector("head").appendChild(element);
2307
+ }
2308
+ const splittedUrl = url.split(".");
2309
+ const mimeType = MIME_TYPES[splittedUrl[splittedUrl.length - 1].toLowerCase()];
2310
+ if (mimeType)
2311
+ link.current.setAttribute("type", mimeType);
2312
+ else
2313
+ link.current.removeAttribute("type");
2314
+ link.current.setAttribute("href", url);
2315
+ }, [url]);
2316
+ }
2317
+
2318
+ // node_modules/@mantine/hooks/esm/use-scroll-direction/use-scroll-direction.mjs
2319
+ import { useEffect as useEffect33, useEffectEvent as useEffectEvent6, useRef as useRef24, useState as useState32 } from "react";
2320
+
2321
+ function useScrollDirection() {
2322
+ const lastScrollTopRef = useRef24(0);
2323
+ const [scrollDirection, setScrollDirection] = useState32("unknown");
2324
+ const isResizingRef = useRef24(false);
2325
+ const resizeTimerRef = useRef24(undefined);
2326
+ const handleScroll = useEffectEvent6(() => {
2327
+ if (isResizingRef.current)
2328
+ return;
2329
+ const currentScrollTop = window.scrollY || document.documentElement.scrollTop;
2330
+ setScrollDirection(currentScrollTop < lastScrollTopRef.current ? "up" : "down");
2331
+ lastScrollTopRef.current = currentScrollTop;
2332
+ });
2333
+ useEffect33(() => {
2334
+ const handleResize = () => {
2335
+ isResizingRef.current = true;
2336
+ window.clearTimeout(resizeTimerRef.current);
2337
+ resizeTimerRef.current = window.setTimeout(() => {
2338
+ isResizingRef.current = false;
2339
+ }, 300);
2340
+ };
2341
+ window.addEventListener("scroll", handleScroll);
2342
+ window.addEventListener("resize", handleResize);
2343
+ return () => {
2344
+ window.removeEventListener("scroll", handleScroll);
2345
+ window.removeEventListener("resize", handleResize);
2346
+ clearTimeout(resizeTimerRef.current);
2347
+ };
2348
+ }, []);
2349
+ return scrollDirection;
2350
+ }
2351
+
2352
+ // node_modules/@mantine/hooks/esm/use-headroom/use-headroom.mjs
2353
+ import { useEffectEvent as useEffectEvent7, useRef as useRef25 } from "react";
2354
+
2355
+ var isFixed = (current, fixedAt) => current <= fixedAt;
2356
+ var isPinnedOrReleased = (current, fixedAt, isCurrentlyPinnedRef, isScrollingUp, onPin, onRelease) => {
2357
+ const isInFixedPosition = isFixed(current, fixedAt);
2358
+ if (isInFixedPosition && !isCurrentlyPinnedRef.current) {
2359
+ isCurrentlyPinnedRef.current = true;
2360
+ onPin?.();
2361
+ } else if (!isInFixedPosition && isScrollingUp && !isCurrentlyPinnedRef.current) {
2362
+ isCurrentlyPinnedRef.current = true;
2363
+ onPin?.();
2364
+ } else if (!isInFixedPosition && !isScrollingUp && isCurrentlyPinnedRef.current) {
2365
+ isCurrentlyPinnedRef.current = false;
2366
+ onRelease?.();
2367
+ }
2368
+ };
2369
+ function useHeadroom({ fixedAt = 0, scrollDistance = 100, onPin, onFix, onRelease } = {}) {
2370
+ const isCurrentlyPinnedRef = useRef25(false);
2371
+ const isScrollingUp = useScrollDirection() === "up";
2372
+ const [{ y: scrollPosition }] = useWindowScroll();
2373
+ const onPinEvent = useEffectEvent7(() => onPin?.());
2374
+ const onReleaseEvent = useEffectEvent7(() => onRelease?.());
2375
+ const onFixEvent = useEffectEvent7(() => onFix?.());
2376
+ useIsomorphicEffect(() => {
2377
+ isPinnedOrReleased(scrollPosition, fixedAt, isCurrentlyPinnedRef, isScrollingUp, onPinEvent, onReleaseEvent);
2378
+ }, [
2379
+ scrollPosition,
2380
+ fixedAt,
2381
+ isScrollingUp
2382
+ ]);
2383
+ const wasFixedRef = useRef25(false);
2384
+ useIsomorphicEffect(() => {
2385
+ const currentlyInFixedZone = isFixed(scrollPosition, fixedAt);
2386
+ if (currentlyInFixedZone && !wasFixedRef.current)
2387
+ onFixEvent();
2388
+ wasFixedRef.current = currentlyInFixedZone;
2389
+ }, [scrollPosition, fixedAt]);
2390
+ const currentlyFixed = isFixed(scrollPosition, fixedAt);
2391
+ const prevIsFixedRef = useRef25(currentlyFixed);
2392
+ const directionChangeScrollYRef = useRef25(scrollPosition);
2393
+ const progressAtDirectionChangeRef = useRef25(currentlyFixed ? 1 : 0);
2394
+ const prevIsScrollingUpRef = useRef25(isScrollingUp);
2395
+ if (prevIsFixedRef.current !== currentlyFixed) {
2396
+ prevIsFixedRef.current = currentlyFixed;
2397
+ if (!currentlyFixed) {
2398
+ directionChangeScrollYRef.current = fixedAt;
2399
+ progressAtDirectionChangeRef.current = 1;
2400
+ } else {
2401
+ directionChangeScrollYRef.current = scrollPosition;
2402
+ progressAtDirectionChangeRef.current = 1;
2403
+ }
2404
+ prevIsScrollingUpRef.current = isScrollingUp;
2405
+ }
2406
+ if (!currentlyFixed && prevIsScrollingUpRef.current !== isScrollingUp) {
2407
+ const transitionDelta = Math.abs(scrollPosition - directionChangeScrollYRef.current);
2408
+ const transitionProgress = prevIsScrollingUpRef.current ? Math.min(progressAtDirectionChangeRef.current + transitionDelta / scrollDistance, 1) : Math.max(progressAtDirectionChangeRef.current - transitionDelta / scrollDistance, 0);
2409
+ prevIsScrollingUpRef.current = isScrollingUp;
2410
+ directionChangeScrollYRef.current = scrollPosition;
2411
+ progressAtDirectionChangeRef.current = transitionProgress;
2412
+ }
2413
+ let scrollProgress;
2414
+ if (currentlyFixed)
2415
+ scrollProgress = 1;
2416
+ else {
2417
+ const scrollDelta = Math.abs(scrollPosition - directionChangeScrollYRef.current);
2418
+ if (isScrollingUp)
2419
+ scrollProgress = Math.min(progressAtDirectionChangeRef.current + scrollDelta / scrollDistance, 1);
2420
+ else
2421
+ scrollProgress = Math.max(progressAtDirectionChangeRef.current - scrollDelta / scrollDistance, 0);
2422
+ }
2423
+ return {
2424
+ pinned: scrollProgress > 0,
2425
+ scrollProgress
2426
+ };
2427
+ }
2428
+
2429
+ // node_modules/@mantine/hooks/esm/use-eye-dropper/use-eye-dropper.mjs
2430
+ import { useCallback as useCallback24, useState as useState33 } from "react";
2431
+
2432
+ function useEyeDropper() {
2433
+ const [supported, setSupported] = useState33(false);
2434
+ useIsomorphicEffect(() => {
2435
+ setSupported(typeof window !== "undefined" && !isOpera() && "EyeDropper" in window);
2436
+ }, []);
2437
+ return {
2438
+ supported,
2439
+ open: useCallback24((options = {}) => {
2440
+ if (supported)
2441
+ return new window.EyeDropper().open(options);
2442
+ return Promise.resolve(undefined);
2443
+ }, [supported])
2444
+ };
2445
+ }
2446
+ function isOpera() {
2447
+ return navigator.userAgent.includes("OPR");
2448
+ }
2449
+
2450
+ // node_modules/@mantine/hooks/esm/use-in-viewport/use-in-viewport.mjs
2451
+ import { useCallback as useCallback25, useRef as useRef26, useState as useState34 } from "react";
2452
+
2453
+ function useInViewport() {
2454
+ const observer = useRef26(null);
2455
+ const [inViewport, setInViewport] = useState34(false);
2456
+ return {
2457
+ ref: useCallback25((node) => {
2458
+ if (typeof IntersectionObserver !== "undefined") {
2459
+ observer.current?.disconnect();
2460
+ if (node) {
2461
+ observer.current = new IntersectionObserver((entries) => {
2462
+ const lastEntry = entries[entries.length - 1];
2463
+ setInViewport(lastEntry.isIntersecting);
2464
+ });
2465
+ observer.current.observe(node);
2466
+ } else {
2467
+ observer.current = null;
2468
+ setInViewport(false);
2469
+ }
2470
+ }
2471
+ }, []),
2472
+ inViewport
2473
+ };
2474
+ }
2475
+
2476
+ // node_modules/@mantine/hooks/esm/use-mutation-observer/use-mutation-observer.mjs
2477
+ import { useCallback as useCallback26, useEffect as useEffect34, useRef as useRef27 } from "react";
2478
+
2479
+ function useMutationObserver(callback, options) {
2480
+ const observer = useRef27(null);
2481
+ return useCallback26((node) => {
2482
+ if (observer.current) {
2483
+ observer.current.disconnect();
2484
+ observer.current = null;
2485
+ }
2486
+ if (node) {
2487
+ observer.current = new MutationObserver(callback);
2488
+ observer.current.observe(node, options);
2489
+ }
2490
+ return () => {
2491
+ if (observer.current) {
2492
+ observer.current.disconnect();
2493
+ observer.current = null;
2494
+ }
2495
+ };
2496
+ }, [callback, options]);
2497
+ }
2498
+ function useMutationObserverTarget(callback, options, target) {
2499
+ const observer = useRef27(null);
2500
+ useEffect34(() => {
2501
+ if (observer.current) {
2502
+ observer.current.disconnect();
2503
+ observer.current = null;
2504
+ }
2505
+ const targetElement = typeof target === "function" ? target() : target;
2506
+ if (targetElement) {
2507
+ observer.current = new MutationObserver(callback);
2508
+ observer.current.observe(targetElement, options);
2509
+ }
2510
+ return () => {
2511
+ if (observer.current) {
2512
+ observer.current.disconnect();
2513
+ observer.current = null;
2514
+ }
2515
+ };
2516
+ }, [
2517
+ callback,
2518
+ options,
2519
+ target
2520
+ ]);
2521
+ }
2522
+
2523
+ // node_modules/@mantine/hooks/esm/use-mounted/use-mounted.mjs
2524
+ import { useEffect as useEffect35, useState as useState35 } from "react";
2525
+
2526
+ function useMounted() {
2527
+ const [mounted, setMounted] = useState35(false);
2528
+ useEffect35(() => setMounted(true), []);
2529
+ return mounted;
2530
+ }
2531
+
2532
+ // node_modules/@mantine/hooks/esm/use-state-history/use-state-history.mjs
2533
+ import { useCallback as useCallback27, useMemo as useMemo5, useState as useState36 } from "react";
2534
+
2535
+ function useStateHistory(initialValue) {
2536
+ const [state, setState] = useState36({
2537
+ history: [initialValue],
2538
+ current: 0
2539
+ });
2540
+ const set = useCallback27((val) => setState((currentState) => {
2541
+ const nextState = [...currentState.history.slice(0, currentState.current + 1), val];
2542
+ return {
2543
+ history: nextState,
2544
+ current: nextState.length - 1
2545
+ };
2546
+ }), []);
2547
+ const back = useCallback27((steps = 1) => setState((currentState) => ({
2548
+ history: currentState.history,
2549
+ current: Math.max(0, currentState.current - steps)
2550
+ })), []);
2551
+ const forward = useCallback27((steps = 1) => setState((currentState) => ({
2552
+ history: currentState.history,
2553
+ current: Math.min(currentState.history.length - 1, currentState.current + steps)
2554
+ })), []);
2555
+ const reset = useCallback27(() => {
2556
+ setState({
2557
+ history: [initialValue],
2558
+ current: 0
2559
+ });
2560
+ }, [initialValue]);
2561
+ const handlers = useMemo5(() => ({
2562
+ back,
2563
+ forward,
2564
+ reset,
2565
+ set
2566
+ }), [
2567
+ back,
2568
+ forward,
2569
+ reset,
2570
+ set
2571
+ ]);
2572
+ return [
2573
+ state.history[state.current],
2574
+ handlers,
2575
+ state
2576
+ ];
2577
+ }
2578
+
2579
+ // node_modules/@mantine/hooks/esm/use-map/use-map.mjs
2580
+ import { useRef as useRef28 } from "react";
2581
+
2582
+ function useMap(initialState) {
2583
+ const mapRef = useRef28(new Map(initialState));
2584
+ const forceUpdate = useForceUpdate();
2585
+ mapRef.current.set = (...args) => {
2586
+ Map.prototype.set.apply(mapRef.current, args);
2587
+ forceUpdate();
2588
+ return mapRef.current;
2589
+ };
2590
+ mapRef.current.clear = (...args) => {
2591
+ Map.prototype.clear.apply(mapRef.current, args);
2592
+ forceUpdate();
2593
+ };
2594
+ mapRef.current.delete = (...args) => {
2595
+ const res = Map.prototype.delete.apply(mapRef.current, args);
2596
+ forceUpdate();
2597
+ return res;
2598
+ };
2599
+ return mapRef.current;
2600
+ }
2601
+
2602
+ // node_modules/@mantine/hooks/esm/use-set/use-set.mjs
2603
+ import { useRef as useRef29 } from "react";
2604
+
2605
+ function readonlySetLikeToSet(input) {
2606
+ if (input instanceof Set)
2607
+ return input;
2608
+ const result = /* @__PURE__ */ new Set;
2609
+ const iterator = input.keys();
2610
+ let next = iterator.next();
2611
+ while (!next.done) {
2612
+ result.add(next.value);
2613
+ next = iterator.next();
2614
+ }
2615
+ return result;
2616
+ }
2617
+ function useSet(values) {
2618
+ const setRef = useRef29(new Set(values));
2619
+ const forceUpdate = useForceUpdate();
2620
+ setRef.current.add = (...args) => {
2621
+ const res = Set.prototype.add.apply(setRef.current, args);
2622
+ forceUpdate();
2623
+ return res;
2624
+ };
2625
+ setRef.current.clear = (...args) => {
2626
+ Set.prototype.clear.apply(setRef.current, args);
2627
+ forceUpdate();
2628
+ };
2629
+ setRef.current.delete = (...args) => {
2630
+ const res = Set.prototype.delete.apply(setRef.current, args);
2631
+ forceUpdate();
2632
+ return res;
2633
+ };
2634
+ setRef.current.union = (other) => {
2635
+ const result = new Set(setRef.current);
2636
+ readonlySetLikeToSet(other).forEach((item) => result.add(item));
2637
+ return result;
2638
+ };
2639
+ setRef.current.intersection = (other) => {
2640
+ const result = /* @__PURE__ */ new Set;
2641
+ const otherSet = readonlySetLikeToSet(other);
2642
+ setRef.current.forEach((item) => {
2643
+ if (otherSet.has(item))
2644
+ result.add(item);
2645
+ });
2646
+ return result;
2647
+ };
2648
+ setRef.current.difference = (other) => {
2649
+ const result = /* @__PURE__ */ new Set;
2650
+ const otherSet = readonlySetLikeToSet(other);
2651
+ setRef.current.forEach((item) => {
2652
+ if (!otherSet.has(item))
2653
+ result.add(item);
2654
+ });
2655
+ return result;
2656
+ };
2657
+ setRef.current.symmetricDifference = (other) => {
2658
+ const result = /* @__PURE__ */ new Set;
2659
+ const otherSet = readonlySetLikeToSet(other);
2660
+ setRef.current.forEach((item) => {
2661
+ if (!otherSet.has(item))
2662
+ result.add(item);
2663
+ });
2664
+ otherSet.forEach((item) => {
2665
+ if (!setRef.current.has(item))
2666
+ result.add(item);
2667
+ });
2668
+ return result;
2669
+ };
2670
+ return setRef.current;
2671
+ }
2672
+
2673
+ // node_modules/@mantine/hooks/esm/use-throttled-callback/use-throttled-callback.mjs
2674
+ import { useCallback as useCallback28, useEffect as useEffect36, useRef as useRef30 } from "react";
2675
+
2676
+ function useThrottledCallbackWithClearTimeout(callback, wait) {
2677
+ const handleCallback = useCallbackRef(callback);
2678
+ const latestInArgsRef = useRef30(null);
2679
+ const latestOutArgsRef = useRef30(null);
2680
+ const active = useRef30(true);
2681
+ const waitRef = useRef30(wait);
2682
+ const timeoutRef = useRef30(-1);
2683
+ const clearTimeout2 = () => window.clearTimeout(timeoutRef.current);
2684
+ const callThrottledCallback = useCallback28((...args) => {
2685
+ handleCallback(...args);
2686
+ latestInArgsRef.current = args;
2687
+ latestOutArgsRef.current = args;
2688
+ active.current = false;
2689
+ }, [handleCallback]);
2690
+ const timerCallback = useCallback28(() => {
2691
+ if (latestInArgsRef.current && latestInArgsRef.current !== latestOutArgsRef.current) {
2692
+ callThrottledCallback(...latestInArgsRef.current);
2693
+ timeoutRef.current = window.setTimeout(timerCallback, waitRef.current);
2694
+ } else
2695
+ active.current = true;
2696
+ }, [callThrottledCallback]);
2697
+ const throttled = useCallback28((...args) => {
2698
+ if (active.current) {
2699
+ callThrottledCallback(...args);
2700
+ timeoutRef.current = window.setTimeout(timerCallback, waitRef.current);
2701
+ } else
2702
+ latestInArgsRef.current = args;
2703
+ }, [callThrottledCallback, timerCallback]);
2704
+ useEffect36(() => {
2705
+ waitRef.current = wait;
2706
+ }, [wait]);
2707
+ return [throttled, clearTimeout2];
2708
+ }
2709
+ function useThrottledCallback(callback, wait) {
2710
+ const [throttled, clearTimeout2] = useThrottledCallbackWithClearTimeout(callback, wait);
2711
+ useEffect36(() => clearTimeout2, []);
2712
+ return throttled;
2713
+ }
2714
+
2715
+ // node_modules/@mantine/hooks/esm/use-throttled-state/use-throttled-state.mjs
2716
+ import { useEffect as useEffect37, useState as useState37 } from "react";
2717
+
2718
+ function useThrottledState(defaultValue, wait) {
2719
+ const [value, setValue] = useState37(defaultValue);
2720
+ const [setThrottledValue, clearTimeout2] = useThrottledCallbackWithClearTimeout(setValue, wait);
2721
+ useEffect37(() => clearTimeout2, []);
2722
+ return [value, setThrottledValue];
2723
+ }
2724
+
2725
+ // node_modules/@mantine/hooks/esm/use-throttled-value/use-throttled-value.mjs
2726
+ import { useEffect as useEffect38, useRef as useRef31, useState as useState38 } from "react";
2727
+
2728
+ function useThrottledValue(value, wait) {
2729
+ const [throttledValue, setThrottledValue] = useState38(value);
2730
+ const valueRef = useRef31(value);
2731
+ const [throttledSetValue, clearTimeout2] = useThrottledCallbackWithClearTimeout(setThrottledValue, wait);
2732
+ useEffect38(() => {
2733
+ if (value !== valueRef.current) {
2734
+ valueRef.current = value;
2735
+ throttledSetValue(value);
2736
+ }
2737
+ }, [throttledSetValue, value]);
2738
+ useEffect38(() => clearTimeout2, []);
2739
+ return throttledValue;
2740
+ }
2741
+
2742
+ // node_modules/@mantine/hooks/esm/use-is-first-render/use-is-first-render.mjs
2743
+ import { useRef as useRef32 } from "react";
2744
+
2745
+ function useIsFirstRender() {
2746
+ const renderRef = useRef32(true);
2747
+ if (renderRef.current === true) {
2748
+ renderRef.current = false;
2749
+ return true;
2750
+ }
2751
+ return renderRef.current;
2752
+ }
2753
+
2754
+ // node_modules/@mantine/hooks/esm/use-orientation/use-orientation.mjs
2755
+ import { useState as useState39 } from "react";
2756
+
2757
+ function getInitialValue2(initialValue, getInitialValueInEffect) {
2758
+ if (getInitialValueInEffect)
2759
+ return initialValue;
2760
+ if (typeof window !== "undefined" && "screen" in window)
2761
+ return {
2762
+ angle: window.screen.orientation?.angle ?? initialValue.angle,
2763
+ type: window.screen.orientation?.type ?? initialValue.type
2764
+ };
2765
+ return initialValue;
2766
+ }
2767
+ function useOrientation({ defaultAngle = 0, defaultType = "landscape-primary", getInitialValueInEffect = true } = {}) {
2768
+ const [orientation, setOrientation] = useState39(getInitialValue2({
2769
+ angle: defaultAngle,
2770
+ type: defaultType
2771
+ }, getInitialValueInEffect));
2772
+ const handleOrientationChange = (event) => {
2773
+ const target = event.currentTarget;
2774
+ setOrientation({
2775
+ angle: target?.angle || 0,
2776
+ type: target?.type || "landscape-primary"
2777
+ });
2778
+ };
2779
+ useIsomorphicEffect(() => {
2780
+ if (window.screen.orientation) {
2781
+ setOrientation({
2782
+ angle: window.screen.orientation.angle,
2783
+ type: window.screen.orientation.type
2784
+ });
2785
+ window.screen.orientation.addEventListener("change", handleOrientationChange);
2786
+ return () => window.screen.orientation?.removeEventListener("change", handleOrientationChange);
2787
+ }
2788
+ }, []);
2789
+ return orientation;
2790
+ }
2791
+
2792
+ // node_modules/@mantine/hooks/esm/use-fetch/use-fetch.mjs
2793
+ import { useCallback as useCallback29, useEffect as useEffect39, useRef as useRef33, useState as useState40 } from "react";
2794
+
2795
+ function useFetch(url, { autoInvoke = true, ...options } = {}) {
2796
+ const [data, setData] = useState40(null);
2797
+ const [loading, setLoading] = useState40(false);
2798
+ const [error, setError] = useState40(null);
2799
+ const controller = useRef33(null);
2800
+ const refetch = useCallback29(() => {
2801
+ if (controller.current)
2802
+ controller.current.abort();
2803
+ controller.current = new AbortController;
2804
+ setLoading(true);
2805
+ return fetch(url, {
2806
+ ...options,
2807
+ signal: controller.current.signal
2808
+ }).then((res) => {
2809
+ if (!res.ok)
2810
+ throw new Error(`Request failed with status ${res.status}`);
2811
+ return res.json();
2812
+ }).then((res) => {
2813
+ setData(res);
2814
+ setLoading(false);
2815
+ return res;
2816
+ }).catch((err) => {
2817
+ setLoading(false);
2818
+ if (err.name !== "AbortError")
2819
+ setError(err);
2820
+ return err;
2821
+ });
2822
+ }, [url, JSON.stringify(options)]);
2823
+ const abort = useCallback29(() => {
2824
+ if (controller.current)
2825
+ controller.current?.abort("");
2826
+ }, []);
2827
+ useEffect39(() => {
2828
+ if (autoInvoke)
2829
+ refetch();
2830
+ return () => {
2831
+ if (controller.current)
2832
+ controller.current.abort("");
2833
+ };
2834
+ }, [refetch, autoInvoke]);
2835
+ return {
2836
+ data,
2837
+ loading,
2838
+ error,
2839
+ refetch,
2840
+ abort
2841
+ };
2842
+ }
2843
+
2844
+ // node_modules/@mantine/hooks/esm/use-radial-move/use-radial-move.mjs
2845
+ import { useCallback as useCallback30, useEffect as useEffect40, useRef as useRef34, useState as useState41 } from "react";
2846
+
2847
+ function radiansToDegrees(radians) {
2848
+ return radians * (180 / Math.PI);
2849
+ }
2850
+ function getElementCenter(element) {
2851
+ const rect = element.getBoundingClientRect();
2852
+ return [rect.left + rect.width / 2, rect.top + rect.height / 2];
2853
+ }
2854
+ function getAngle(coordinates, element) {
2855
+ const center = getElementCenter(element);
2856
+ const x = coordinates[0] - center[0];
2857
+ const y = coordinates[1] - center[1];
2858
+ return 360 - (radiansToDegrees(Math.atan2(x, y)) + 180);
2859
+ }
2860
+ function toFixed(value, digits) {
2861
+ return parseFloat(value.toFixed(digits));
2862
+ }
2863
+ function getDigitsAfterDot(value) {
2864
+ return value.toString().split(".")[1]?.length || 0;
2865
+ }
2866
+ function normalizeRadialValue(degree, step) {
2867
+ const clamped = clamp(degree, 0, 360);
2868
+ const high = Math.ceil(clamped / step);
2869
+ const low = Math.round(clamped / step);
2870
+ return toFixed(high >= clamped / step ? high * step === 360 ? 0 : high * step : low * step, getDigitsAfterDot(step));
2871
+ }
2872
+ function useRadialMove(onChange, { step = 0.01, onChangeEnd, onScrubStart, onScrubEnd } = {}) {
2873
+ const [active, setActive] = useState41(false);
2874
+ const cleanupRef = useRef34(null);
2875
+ useEffect40(() => {
2876
+ return () => {
2877
+ cleanupRef.current?.();
2878
+ };
2879
+ }, []);
2880
+ return {
2881
+ ref: useCallback30((node) => {
2882
+ const update = (event, done = false) => {
2883
+ if (node) {
2884
+ node.style.userSelect = "none";
2885
+ const newValue = normalizeRadialValue(getAngle([event.clientX, event.clientY], node), step || 1);
2886
+ onChange(newValue);
2887
+ done && onChangeEnd?.(newValue);
2888
+ }
2889
+ };
2890
+ const beginTracking = () => {
2891
+ onScrubStart?.();
2892
+ setActive(true);
2893
+ document.addEventListener("mousemove", handleMouseMove, false);
2894
+ document.addEventListener("mouseup", handleMouseUp, false);
2895
+ document.addEventListener("touchmove", handleTouchMove, { passive: false });
2896
+ document.addEventListener("touchend", handleTouchEnd, false);
2897
+ };
2898
+ const endTracking = () => {
2899
+ onScrubEnd?.();
2900
+ setActive(false);
2901
+ document.removeEventListener("mousemove", handleMouseMove, false);
2902
+ document.removeEventListener("mouseup", handleMouseUp, false);
2903
+ document.removeEventListener("touchmove", handleTouchMove, false);
2904
+ document.removeEventListener("touchend", handleTouchEnd, false);
2905
+ };
2906
+ const onMouseDown = (event) => {
2907
+ beginTracking();
2908
+ update(event);
2909
+ };
2910
+ const handleMouseMove = (event) => {
2911
+ update(event);
2912
+ };
2913
+ const handleMouseUp = (event) => {
2914
+ update(event, true);
2915
+ endTracking();
2916
+ };
2917
+ const handleTouchMove = (event) => {
2918
+ event.preventDefault();
2919
+ update(event.touches[0]);
2920
+ };
2921
+ const handleTouchEnd = (event) => {
2922
+ update(event.changedTouches[0], true);
2923
+ endTracking();
2924
+ };
2925
+ const handleTouchStart = (event) => {
2926
+ event.preventDefault();
2927
+ beginTracking();
2928
+ update(event.touches[0]);
2929
+ };
2930
+ node?.addEventListener("mousedown", onMouseDown);
2931
+ node?.addEventListener("touchstart", handleTouchStart, { passive: false });
2932
+ cleanupRef.current = () => {
2933
+ document.removeEventListener("mousemove", handleMouseMove, false);
2934
+ document.removeEventListener("mouseup", handleMouseUp, false);
2935
+ document.removeEventListener("touchmove", handleTouchMove, false);
2936
+ document.removeEventListener("touchend", handleTouchEnd, false);
2937
+ };
2938
+ return () => {
2939
+ if (node) {
2940
+ node.removeEventListener("mousedown", onMouseDown);
2941
+ node.removeEventListener("touchstart", handleTouchStart);
2942
+ }
2943
+ };
2944
+ }, [onChange]),
2945
+ active
2946
+ };
2947
+ }
2948
+
2949
+ // node_modules/@mantine/hooks/esm/use-scroll-spy/use-scroll-spy.mjs
2950
+ import { useEffect as useEffect41, useEffectEvent as useEffectEvent8, useRef as useRef35, useState as useState42 } from "react";
2951
+
2952
+ function getHeadingsData(headings, getDepth, getValue) {
2953
+ const result = [];
2954
+ for (let i = 0;i < headings.length; i += 1) {
2955
+ const heading = headings[i];
2956
+ result.push({
2957
+ depth: getDepth(heading),
2958
+ value: getValue(heading),
2959
+ id: heading.id || randomId(),
2960
+ getNode: () => heading.id ? document.getElementById(heading.id) : heading
2961
+ });
2962
+ }
2963
+ return result;
2964
+ }
2965
+ function getActiveElement(rects, offset = 0) {
2966
+ if (rects.length === 0)
2967
+ return -1;
2968
+ return rects.reduce((acc, item, index) => {
2969
+ if (Math.abs(acc.position - offset) < Math.abs(item.y - offset))
2970
+ return acc;
2971
+ return {
2972
+ index,
2973
+ position: item.y
2974
+ };
2975
+ }, {
2976
+ index: 0,
2977
+ position: rects[0].y
2978
+ }).index;
2979
+ }
2980
+ function getDefaultDepth(element) {
2981
+ return Number(element.tagName[1]);
2982
+ }
2983
+ function getDefaultValue(element) {
2984
+ return element.textContent || "";
2985
+ }
2986
+ function useScrollSpy({ selector = "h1, h2, h3, h4, h5, h6", getDepth = getDefaultDepth, getValue = getDefaultValue, offset = 0, scrollHost } = {}) {
2987
+ const [active, setActive] = useState42(-1);
2988
+ const [initialized, setInitialized] = useState42(false);
2989
+ const [data, setData] = useState42([]);
2990
+ const headingsRef = useRef35([]);
2991
+ const handleScroll = useEffectEvent8(() => {
2992
+ setActive(getActiveElement(headingsRef.current.map((d) => d.getNode().getBoundingClientRect()), offset));
2993
+ });
2994
+ const initialize = () => {
2995
+ const headings = getHeadingsData(Array.from(document.querySelectorAll(selector)), getDepth, getValue);
2996
+ headingsRef.current = headings;
2997
+ setInitialized(true);
2998
+ setData(headings);
2999
+ setActive(getActiveElement(headings.map((d) => d.getNode().getBoundingClientRect()), offset));
3000
+ };
3001
+ useEffect41(() => {
3002
+ initialize();
3003
+ const _scrollHost = scrollHost || window;
3004
+ _scrollHost.addEventListener("scroll", handleScroll);
3005
+ return () => _scrollHost.removeEventListener("scroll", handleScroll);
3006
+ }, [
3007
+ scrollHost,
3008
+ selector,
3009
+ offset
3010
+ ]);
3011
+ return {
3012
+ reinitialize: initialize,
3013
+ active,
3014
+ initialized,
3015
+ data
3016
+ };
3017
+ }
3018
+
3019
+ // node_modules/@mantine/hooks/esm/use-scroller/use-scroller.mjs
3020
+ import { useCallback as useCallback31, useEffect as useEffect42, useRef as useRef36, useState as useState43 } from "react";
3021
+
3022
+ function useScroller(options = {}) {
3023
+ const { scrollAmount = 200, draggable = true, onScrollStateChange } = options;
3024
+ const containerRef = useRef36(null);
3025
+ const [canScrollStart, setCanScrollStart] = useState43(false);
3026
+ const [canScrollEnd, setCanScrollEnd] = useState43(false);
3027
+ const [isDragging, setIsDragging] = useState43(false);
3028
+ const isDraggingRef = useRef36(false);
3029
+ const hasDraggedRef = useRef36(false);
3030
+ const startX = useRef36(0);
3031
+ const scrollLeftStart = useRef36(0);
3032
+ const onScrollStateChangeRef = useRef36(onScrollStateChange);
3033
+ onScrollStateChangeRef.current = onScrollStateChange;
3034
+ const updateScrollState = useCallback31(() => {
3035
+ const container = containerRef.current;
3036
+ if (container) {
3037
+ const { scrollLeft, scrollWidth, clientWidth } = container;
3038
+ const isRtl = getComputedStyle(container).direction === "rtl";
3039
+ let newCanScrollStart;
3040
+ let newCanScrollEnd;
3041
+ if (isRtl) {
3042
+ newCanScrollStart = scrollLeft < -1;
3043
+ newCanScrollEnd = scrollLeft > -(scrollWidth - clientWidth) + 1;
3044
+ } else {
3045
+ newCanScrollStart = scrollLeft > 1;
3046
+ newCanScrollEnd = scrollLeft < scrollWidth - clientWidth - 1;
3047
+ }
3048
+ setCanScrollStart(newCanScrollStart);
3049
+ setCanScrollEnd(newCanScrollEnd);
3050
+ onScrollStateChangeRef.current?.({
3051
+ canScrollStart: newCanScrollStart,
3052
+ canScrollEnd: newCanScrollEnd
3053
+ });
3054
+ }
3055
+ }, []);
3056
+ useEffect42(() => {
3057
+ updateScrollState();
3058
+ const container = containerRef.current;
3059
+ if (container) {
3060
+ container.addEventListener("scroll", updateScrollState);
3061
+ const resizeObserver = new ResizeObserver(updateScrollState);
3062
+ resizeObserver.observe(container);
3063
+ return () => {
3064
+ container.removeEventListener("scroll", updateScrollState);
3065
+ resizeObserver.disconnect();
3066
+ };
3067
+ }
3068
+ }, [updateScrollState]);
3069
+ const scroll = useCallback31((direction) => {
3070
+ const container = containerRef.current;
3071
+ if (container) {
3072
+ const isRtl = getComputedStyle(container).direction === "rtl";
3073
+ const amount = scrollAmount;
3074
+ const scrollBy = direction === "end" ? amount : -amount;
3075
+ const adjustedScrollBy = isRtl ? -scrollBy : scrollBy;
3076
+ container.scrollBy({
3077
+ left: adjustedScrollBy,
3078
+ behavior: "smooth"
3079
+ });
3080
+ }
3081
+ }, [scrollAmount]);
3082
+ const scrollStart = useCallback31(() => scroll("start"), [scroll]);
3083
+ const scrollEnd = useCallback31(() => scroll("end"), [scroll]);
3084
+ const handleMouseDown = useCallback31((event) => {
3085
+ if (!draggable)
3086
+ return;
3087
+ const container = containerRef.current;
3088
+ if (container) {
3089
+ isDraggingRef.current = true;
3090
+ hasDraggedRef.current = false;
3091
+ setIsDragging(true);
3092
+ startX.current = event.pageX - container.offsetLeft;
3093
+ scrollLeftStart.current = container.scrollLeft;
3094
+ container.style.cursor = "grabbing";
3095
+ container.style.userSelect = "none";
3096
+ }
3097
+ }, [draggable]);
3098
+ const handleMouseMove = useCallback31((event) => {
3099
+ if (!isDraggingRef.current)
3100
+ return;
3101
+ event.preventDefault();
3102
+ const container = containerRef.current;
3103
+ if (container) {
3104
+ const walk = event.pageX - container.offsetLeft - startX.current;
3105
+ if (Math.abs(walk) > 5)
3106
+ hasDraggedRef.current = true;
3107
+ container.scrollLeft = scrollLeftStart.current - walk;
3108
+ }
3109
+ }, []);
3110
+ const handleMouseUp = useCallback31(() => {
3111
+ const wasDragged = hasDraggedRef.current;
3112
+ isDraggingRef.current = false;
3113
+ hasDraggedRef.current = false;
3114
+ setIsDragging(false);
3115
+ const container = containerRef.current;
3116
+ if (container) {
3117
+ container.style.cursor = "";
3118
+ container.style.userSelect = "";
3119
+ if (wasDragged) {
3120
+ const suppressClick = (event) => {
3121
+ event.stopPropagation();
3122
+ event.preventDefault();
3123
+ container.removeEventListener("click", suppressClick, true);
3124
+ };
3125
+ container.addEventListener("click", suppressClick, true);
3126
+ }
3127
+ }
3128
+ }, []);
3129
+ const handleMouseLeave = useCallback31(() => {
3130
+ if (isDraggingRef.current)
3131
+ handleMouseUp();
3132
+ }, [handleMouseUp]);
3133
+ return {
3134
+ ref: useCallback31((node) => {
3135
+ containerRef.current = node;
3136
+ if (node)
3137
+ updateScrollState();
3138
+ }, [updateScrollState]),
3139
+ canScrollStart,
3140
+ canScrollEnd,
3141
+ scrollStart,
3142
+ scrollEnd,
3143
+ isDragging,
3144
+ dragHandlers: {
3145
+ onMouseDown: handleMouseDown,
3146
+ onMouseMove: handleMouseMove,
3147
+ onMouseUp: handleMouseUp,
3148
+ onMouseLeave: handleMouseLeave
3149
+ }
3150
+ };
3151
+ }
3152
+
3153
+ // node_modules/@mantine/hooks/esm/use-file-dialog/use-file-dialog.mjs
3154
+ import { useCallback as useCallback32, useRef as useRef37, useState as useState44 } from "react";
3155
+
3156
+ var defaultOptions = {
3157
+ multiple: true,
3158
+ accept: "*"
3159
+ };
3160
+ function getInitialFilesList(files) {
3161
+ if (!files)
3162
+ return null;
3163
+ if (files instanceof FileList)
3164
+ return files;
3165
+ const result = new DataTransfer;
3166
+ for (const file of files)
3167
+ result.items.add(file);
3168
+ return result.files;
3169
+ }
3170
+ function createInput(options) {
3171
+ if (typeof document === "undefined")
3172
+ return null;
3173
+ const input = document.createElement("input");
3174
+ input.type = "file";
3175
+ if (options.accept)
3176
+ input.accept = options.accept;
3177
+ if (options.multiple)
3178
+ input.multiple = options.multiple;
3179
+ if (options.capture)
3180
+ input.capture = options.capture;
3181
+ if (options.directory)
3182
+ input.webkitdirectory = options.directory;
3183
+ input.style.display = "none";
3184
+ return input;
3185
+ }
3186
+ function useFileDialog(input = {}) {
3187
+ const options = {
3188
+ ...defaultOptions,
3189
+ ...input
3190
+ };
3191
+ const [files, setFiles] = useState44(getInitialFilesList(options.initialFiles));
3192
+ const inputRef = useRef37(null);
3193
+ const handleChange = useCallback32((event) => {
3194
+ const target = event.target;
3195
+ if (target?.files) {
3196
+ setFiles(target.files);
3197
+ options.onChange?.(target.files);
3198
+ }
3199
+ }, [options.onChange]);
3200
+ const createAndSetupInput = useCallback32(() => {
3201
+ inputRef.current?.remove();
3202
+ inputRef.current = createInput(options);
3203
+ if (inputRef.current) {
3204
+ inputRef.current.addEventListener("change", handleChange, { once: true });
3205
+ if (options.onCancel)
3206
+ inputRef.current.addEventListener("cancel", options.onCancel, { once: true });
3207
+ document.body.appendChild(inputRef.current);
3208
+ }
3209
+ }, [options, handleChange]);
3210
+ useIsomorphicEffect(() => {
3211
+ createAndSetupInput();
3212
+ return () => inputRef.current?.remove();
3213
+ }, []);
3214
+ const reset = useCallback32(() => {
3215
+ setFiles(null);
3216
+ options.onChange?.(null);
3217
+ }, [options.onChange]);
3218
+ return {
3219
+ files,
3220
+ open: useCallback32(() => {
3221
+ if (options.resetOnOpen)
3222
+ reset();
3223
+ createAndSetupInput();
3224
+ inputRef.current?.click();
3225
+ }, [
3226
+ options.resetOnOpen,
3227
+ reset,
3228
+ createAndSetupInput
3229
+ ]),
3230
+ reset
3231
+ };
3232
+ }
3233
+
3234
+ // node_modules/@mantine/hooks/esm/use-long-press/use-long-press.mjs
3235
+ import { useEffect as useEffect43, useMemo as useMemo6, useRef as useRef38 } from "react";
3236
+
3237
+ function useLongPress(onLongPress, options = {}) {
3238
+ const { threshold = 400, onStart, onFinish, onCancel } = options;
3239
+ const isLongPressActive = useRef38(false);
3240
+ const isPressed = useRef38(false);
3241
+ const timeout = useRef38(-1);
3242
+ useEffect43(() => () => window.clearTimeout(timeout.current), []);
3243
+ return useMemo6(() => {
3244
+ if (typeof onLongPress !== "function")
3245
+ return {};
3246
+ const start = (event) => {
3247
+ if (!isMouseEvent(event) && !isTouchEvent(event))
3248
+ return;
3249
+ if (onStart)
3250
+ onStart(event);
3251
+ isPressed.current = true;
3252
+ timeout.current = window.setTimeout(() => {
3253
+ onLongPress(event);
3254
+ isLongPressActive.current = true;
3255
+ }, threshold);
3256
+ };
3257
+ const cancel = (event) => {
3258
+ if (!isMouseEvent(event) && !isTouchEvent(event))
3259
+ return;
3260
+ if (isLongPressActive.current) {
3261
+ if (onFinish)
3262
+ onFinish(event);
3263
+ } else if (isPressed.current) {
3264
+ if (onCancel)
3265
+ onCancel(event);
3266
+ }
3267
+ isLongPressActive.current = false;
3268
+ isPressed.current = false;
3269
+ if (timeout.current !== -1) {
3270
+ window.clearTimeout(timeout.current);
3271
+ timeout.current = -1;
3272
+ }
3273
+ };
3274
+ return {
3275
+ onMouseDown: start,
3276
+ onMouseUp: cancel,
3277
+ onMouseLeave: cancel,
3278
+ onTouchStart: start,
3279
+ onTouchEnd: cancel,
3280
+ onTouchCancel: cancel
3281
+ };
3282
+ }, [
3283
+ onLongPress,
3284
+ threshold,
3285
+ onCancel,
3286
+ onFinish,
3287
+ onStart
3288
+ ]);
3289
+ }
3290
+ function isTouchEvent(event) {
3291
+ return window.TouchEvent ? event.nativeEvent instanceof TouchEvent : ("touches" in event.nativeEvent);
3292
+ }
3293
+ function isMouseEvent(event) {
3294
+ return event.nativeEvent instanceof MouseEvent;
3295
+ }
3296
+
3297
+ // node_modules/@mantine/hooks/esm/use-selection/use-selection.mjs
3298
+ import { useCallback as useCallback33, useState as useState45 } from "react";
3299
+
3300
+ function useSelection(input) {
3301
+ const [selectionSet, setSelectionSet] = useState45(new Set(input.defaultSelection || []));
3302
+ useDidUpdate(() => {
3303
+ if (input.resetSelectionOnDataChange)
3304
+ setSelectionSet(/* @__PURE__ */ new Set);
3305
+ }, [input.data, input.resetSelectionOnDataChange]);
3306
+ const select = useCallback33((selected) => {
3307
+ setSelectionSet((state) => {
3308
+ if (!state.has(selected)) {
3309
+ const newSet = new Set(state);
3310
+ newSet.add(selected);
3311
+ return newSet;
3312
+ }
3313
+ return state;
3314
+ });
3315
+ }, []);
3316
+ const deselect = useCallback33((deselected) => {
3317
+ setSelectionSet((state) => {
3318
+ if (state.has(deselected)) {
3319
+ const newSet = new Set(state);
3320
+ newSet.delete(deselected);
3321
+ return newSet;
3322
+ }
3323
+ return state;
3324
+ });
3325
+ }, []);
3326
+ const toggle = useCallback33((toggled) => {
3327
+ setSelectionSet((state) => {
3328
+ const newSet = new Set(state);
3329
+ if (state.has(toggled))
3330
+ newSet.delete(toggled);
3331
+ else
3332
+ newSet.add(toggled);
3333
+ return newSet;
3334
+ });
3335
+ }, []);
3336
+ const resetSelection = useCallback33(() => {
3337
+ setSelectionSet(/* @__PURE__ */ new Set);
3338
+ }, []);
3339
+ const setSelection = useCallback33((selection) => {
3340
+ setSelectionSet(new Set(selection));
3341
+ }, []);
3342
+ const isAllSelected = useCallback33(() => {
3343
+ if (input.data.length === 0)
3344
+ return false;
3345
+ return input.data.every((item) => selectionSet.has(item));
3346
+ }, [selectionSet, input.data]);
3347
+ const isSomeSelected = useCallback33(() => {
3348
+ return input.data.some((item) => selectionSet.has(item));
3349
+ }, [selectionSet, input.data]);
3350
+ return [Array.from(selectionSet), {
3351
+ select,
3352
+ deselect,
3353
+ toggle,
3354
+ isAllSelected,
3355
+ isSomeSelected,
3356
+ setSelection,
3357
+ resetSelection
3358
+ }];
3359
+ }
3360
+
3361
+ // node_modules/@mantine/hooks/esm/use-floating-window/use-floating-window.mjs
3362
+ import { useCallback as useCallback34, useEffect as useEffect44, useRef as useRef39, useState as useState46 } from "react";
3363
+
3364
+ function useRefValue(value) {
3365
+ const ref = useRef39(value);
3366
+ ref.current = value;
3367
+ return ref;
3368
+ }
3369
+ function useFloatingWindow(options = {}) {
3370
+ const [element, setElement] = useState46(null);
3371
+ const ref = useRef39(null);
3372
+ const pos = useRef39({
3373
+ x: 0,
3374
+ y: 0
3375
+ });
3376
+ const offset = useRef39({
3377
+ x: 0,
3378
+ y: 0
3379
+ });
3380
+ const [isDragging, setIsDragging] = useState46(false);
3381
+ const isDraggingRef = useRef39(false);
3382
+ const initialized = useRef39(false);
3383
+ const enabledRef = useRefValue(options.enabled);
3384
+ const setDragging = useCallback34((value) => {
3385
+ setIsDragging(value);
3386
+ isDraggingRef.current = value;
3387
+ }, []);
3388
+ const assignRef2 = useCallback34((node) => {
3389
+ if (node) {
3390
+ ref.current = node;
3391
+ setElement(node);
3392
+ } else {
3393
+ ref.current = null;
3394
+ setElement(null);
3395
+ }
3396
+ }, []);
3397
+ useEffect44(() => {
3398
+ const el = ref.current;
3399
+ if (!initialized.current && el) {
3400
+ initialized.current = true;
3401
+ pos.current = calculateInitialPosition(el, options);
3402
+ el.style.left = `${pos.current.x}px`;
3403
+ el.style.top = `${pos.current.y}px`;
3404
+ el.style.right = "unset";
3405
+ el.style.bottom = "unset";
3406
+ }
3407
+ return () => {
3408
+ initialized.current = false;
3409
+ };
3410
+ }, [
3411
+ element,
3412
+ options.constrainOffset,
3413
+ options.initialPosition?.top,
3414
+ options.initialPosition?.left,
3415
+ options.initialPosition?.right,
3416
+ options.initialPosition?.bottom,
3417
+ options.constrainToViewport
3418
+ ]);
3419
+ useEffect44(() => {
3420
+ const el = ref.current;
3421
+ if (!el)
3422
+ return;
3423
+ const controller = new AbortController;
3424
+ const signal = controller.signal;
3425
+ const onStart = (e) => {
3426
+ if (enabledRef.current === false)
3427
+ return;
3428
+ const point = "touches" in e ? e.touches[0] : e;
3429
+ if ("button" in e && e.button !== 0)
3430
+ return;
3431
+ if (!getHandle(el, e.target, options))
3432
+ return;
3433
+ setDragging(true);
3434
+ document.body.style.userSelect = "none";
3435
+ document.body.style.webkitUserSelect = "none";
3436
+ const rect = el.getBoundingClientRect();
3437
+ offset.current = {
3438
+ x: point.clientX - rect.left,
3439
+ y: point.clientY - rect.top
3440
+ };
3441
+ options.onDragStart?.();
3442
+ document.addEventListener("mousemove", onMove, { signal });
3443
+ document.addEventListener("mouseup", onEnd, { signal });
3444
+ document.addEventListener("touchmove", onMove, {
3445
+ signal,
3446
+ passive: false
3447
+ });
3448
+ document.addEventListener("touchend", onEnd, { signal });
3449
+ };
3450
+ const onMove = (e) => {
3451
+ if (!isDraggingRef.current)
3452
+ return;
3453
+ const point = "touches" in e ? e.touches[0] : e;
3454
+ e.preventDefault();
3455
+ let x = point.clientX - offset.current.x;
3456
+ let y = point.clientY - offset.current.y;
3457
+ const constrained = getConstrainedPosition(el, {
3458
+ x,
3459
+ y
3460
+ }, options);
3461
+ if (options.axis === "x") {
3462
+ x = constrained.x;
3463
+ y = pos.current.y;
3464
+ } else if (options.axis === "y") {
3465
+ x = pos.current.x;
3466
+ y = constrained.y;
3467
+ } else {
3468
+ x = constrained.x;
3469
+ y = constrained.y;
3470
+ }
3471
+ pos.current = {
3472
+ x,
3473
+ y
3474
+ };
3475
+ if (ref.current) {
3476
+ ref.current.style.left = `${x}px`;
3477
+ ref.current.style.top = `${y}px`;
3478
+ }
3479
+ options.onPositionChange?.({
3480
+ x,
3481
+ y
3482
+ });
3483
+ };
3484
+ const onEnd = () => {
3485
+ if (isDraggingRef.current) {
3486
+ setDragging(false);
3487
+ document.body.style.userSelect = "";
3488
+ document.body.style.webkitUserSelect = "";
3489
+ options.onDragEnd?.();
3490
+ }
3491
+ };
3492
+ el.addEventListener("mousedown", onStart, { signal });
3493
+ el.addEventListener("touchstart", onStart, {
3494
+ signal,
3495
+ passive: false
3496
+ });
3497
+ return () => {
3498
+ controller.abort();
3499
+ };
3500
+ }, [
3501
+ options.constrainToViewport,
3502
+ options.constrainOffset,
3503
+ options.dragHandleSelector,
3504
+ options.axis,
3505
+ options.onPositionChange,
3506
+ options.onDragStart,
3507
+ options.onDragEnd,
3508
+ options.initialPosition?.top,
3509
+ options.initialPosition?.left,
3510
+ options.initialPosition?.right,
3511
+ options.initialPosition?.bottom,
3512
+ element
3513
+ ]);
3514
+ useEffect44(() => {
3515
+ const el = ref.current;
3516
+ if (!el)
3517
+ return;
3518
+ const observer = new ResizeObserver(() => {
3519
+ const constrained = getConstrainedPosition(el, pos.current, options);
3520
+ pos.current = constrained;
3521
+ el.style.left = `${constrained.x}px`;
3522
+ el.style.top = `${constrained.y}px`;
3523
+ });
3524
+ observer.observe(el);
3525
+ return () => {
3526
+ observer.disconnect();
3527
+ };
3528
+ }, [options.constrainToViewport, options.constrainOffset]);
3529
+ return {
3530
+ ref: assignRef2,
3531
+ setPosition: useCallback34((position) => {
3532
+ const el = ref.current;
3533
+ if (!el)
3534
+ return;
3535
+ const offset2 = options.constrainOffset ?? 0;
3536
+ const rect = el.getBoundingClientRect();
3537
+ let x;
3538
+ let y;
3539
+ if (position.left != null)
3540
+ x = position.left;
3541
+ else if (position.right != null)
3542
+ x = window.innerWidth - rect.width - position.right;
3543
+ if (position.top != null)
3544
+ y = position.top;
3545
+ else if (position.bottom != null)
3546
+ y = window.innerHeight - rect.height - position.bottom;
3547
+ x = x ?? pos.current.x;
3548
+ y = y ?? pos.current.y;
3549
+ if (options.constrainToViewport) {
3550
+ const clamped = clampToViewport(x, y, el, offset2);
3551
+ x = clamped.x;
3552
+ y = clamped.y;
3553
+ }
3554
+ pos.current = {
3555
+ x,
3556
+ y
3557
+ };
3558
+ el.style.left = `${x}px`;
3559
+ el.style.top = `${y}px`;
3560
+ options.onPositionChange?.({
3561
+ x,
3562
+ y
3563
+ });
3564
+ }, [
3565
+ options.constrainToViewport,
3566
+ options.constrainOffset,
3567
+ options.onPositionChange
3568
+ ]),
3569
+ isDragging
3570
+ };
3571
+ }
3572
+ function px(v) {
3573
+ return v.endsWith("px") ? parseFloat(v) : 0;
3574
+ }
3575
+ function calculateInitialPosition(el, options) {
3576
+ const rect = el.getBoundingClientRect();
3577
+ const offset = options.constrainOffset ?? 0;
3578
+ const winW = window.innerWidth;
3579
+ const winH = window.innerHeight;
3580
+ const style = window.getComputedStyle(el);
3581
+ const top = options.initialPosition?.top;
3582
+ const left = options.initialPosition?.left;
3583
+ const right = options.initialPosition?.right;
3584
+ const bottom = options.initialPosition?.bottom;
3585
+ let x = offset;
3586
+ let y = offset;
3587
+ if (left != null)
3588
+ x = left;
3589
+ else if (right != null)
3590
+ x = winW - rect.width - right;
3591
+ else
3592
+ x = px(style.left) || winW - rect.width - px(style.right) || offset;
3593
+ if (top != null)
3594
+ y = top;
3595
+ else if (bottom != null)
3596
+ y = winH - rect.height - bottom;
3597
+ else
3598
+ y = px(style.top) || winH - rect.height - px(style.bottom) || offset;
3599
+ return options.constrainToViewport ? clampToViewport(x, y, el, options.constrainOffset) : {
3600
+ x,
3601
+ y
3602
+ };
3603
+ }
3604
+ function getConstrainedPosition(el, pos, options) {
3605
+ if (!options.constrainToViewport || !el)
3606
+ return pos;
3607
+ const rect = el.getBoundingClientRect();
3608
+ const offset = options.constrainOffset ?? 0;
3609
+ const maxX = window.innerWidth - rect.width - offset;
3610
+ const maxY = window.innerHeight - rect.height - offset;
3611
+ return {
3612
+ x: Math.min(Math.max(offset, pos.x), maxX),
3613
+ y: Math.min(Math.max(offset, pos.y), maxY)
3614
+ };
3615
+ }
3616
+ function matchesExcludeSelector(target, excludeSelector) {
3617
+ if (!excludeSelector)
3618
+ return false;
3619
+ if (!(target instanceof Element))
3620
+ return false;
3621
+ return Boolean(target.closest(excludeSelector));
3622
+ }
3623
+ function getHandle(el, target, options) {
3624
+ if (!(target instanceof Node))
3625
+ return false;
3626
+ if (!options.dragHandleSelector)
3627
+ return !matchesExcludeSelector(target, options.excludeDragHandleSelector);
3628
+ return Array.from(el.querySelectorAll(options.dragHandleSelector)).some((handle) => handle.contains(target) && !matchesExcludeSelector(target, options.excludeDragHandleSelector));
3629
+ }
3630
+ function clampToViewport(x, y, el, offset = 0) {
3631
+ const rect = el.getBoundingClientRect();
3632
+ const maxX = window.innerWidth - rect.width - offset;
3633
+ const maxY = window.innerHeight - rect.height - offset;
3634
+ return {
3635
+ x: Math.min(Math.max(offset, x), maxX),
3636
+ y: Math.min(Math.max(offset, y), maxY)
3637
+ };
3638
+ }
3639
+
3640
+ // node_modules/@mantine/hooks/esm/use-collapse/use-collapse.mjs
3641
+ import { useEffectEvent as useEffectEvent9, useRef as useRef40, useState as useState47 } from "react";
3642
+ import { flushSync } from "react-dom";
3643
+
3644
+ function getAutoHeightDuration(height) {
3645
+ if (!height || typeof height === "string")
3646
+ return 0;
3647
+ const constant = height / 36;
3648
+ return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
3649
+ }
3650
+ function getElementHeight(elementRef) {
3651
+ return elementRef.current ? elementRef.current.scrollHeight : "auto";
3652
+ }
3653
+ function useCollapse({ transitionDuration, transitionTimingFunction = "ease", onTransitionEnd, onTransitionStart, expanded, keepMounted }) {
3654
+ const collapsedStyles = {
3655
+ height: 0,
3656
+ overflow: "hidden",
3657
+ ...keepMounted ? {} : { display: "none" }
3658
+ };
3659
+ const onTransitionStartEvent = useEffectEvent9(() => onTransitionStart?.());
3660
+ const elementRef = useRef40(null);
3661
+ const [styles, setStylesRaw] = useState47(expanded ? {} : collapsedStyles);
3662
+ const [state, setState] = useState47(expanded ? "entered" : "exited");
3663
+ const setStyles = (newStyles) => {
3664
+ flushSync(() => setStylesRaw(newStyles));
3665
+ };
3666
+ const mergeStyles = (newStyles) => {
3667
+ setStyles((oldStyles) => ({
3668
+ ...oldStyles,
3669
+ ...newStyles
3670
+ }));
3671
+ };
3672
+ const getTransitionStyles = (height) => {
3673
+ const duration = transitionDuration ?? getAutoHeightDuration(height);
3674
+ return { transition: `height ${duration}ms ${transitionTimingFunction}, opacity ${duration}ms ${transitionTimingFunction}` };
3675
+ };
3676
+ useDidUpdate(() => {
3677
+ if (transitionDuration !== 0)
3678
+ onTransitionStartEvent();
3679
+ if (expanded)
3680
+ window.requestAnimationFrame(() => {
3681
+ flushSync(() => setState("entering"));
3682
+ mergeStyles({
3683
+ willChange: "height",
3684
+ display: "block",
3685
+ overflow: "hidden"
3686
+ });
3687
+ window.requestAnimationFrame(() => {
3688
+ const height = getElementHeight(elementRef);
3689
+ mergeStyles({
3690
+ ...getTransitionStyles(height),
3691
+ height
3692
+ });
3693
+ });
3694
+ });
3695
+ else
3696
+ window.requestAnimationFrame(() => {
3697
+ flushSync(() => setState("exiting"));
3698
+ const height = getElementHeight(elementRef);
3699
+ mergeStyles({
3700
+ ...getTransitionStyles(height),
3701
+ willChange: "height",
3702
+ height
3703
+ });
3704
+ window.requestAnimationFrame(() => mergeStyles({
3705
+ height: 0,
3706
+ overflow: "hidden"
3707
+ }));
3708
+ });
3709
+ }, [expanded]);
3710
+ const handleTransitionEnd = (event) => {
3711
+ if (event.target !== elementRef.current || event.propertyName !== "height")
3712
+ return;
3713
+ if (expanded) {
3714
+ const height = getElementHeight(elementRef);
3715
+ if (height === styles.height)
3716
+ setStyles({});
3717
+ else
3718
+ mergeStyles({ height });
3719
+ setState("entered");
3720
+ onTransitionEnd?.();
3721
+ } else if (styles.height === 0) {
3722
+ setStyles(collapsedStyles);
3723
+ setState("exited");
3724
+ onTransitionEnd?.();
3725
+ }
3726
+ };
3727
+ return {
3728
+ state,
3729
+ getCollapseProps: (input) => ({
3730
+ "aria-hidden": !expanded,
3731
+ inert: !expanded,
3732
+ ref: mergeRefs(elementRef, input?.ref),
3733
+ onTransitionEnd: handleTransitionEnd,
3734
+ style: {
3735
+ boxSizing: "border-box",
3736
+ ...input?.style,
3737
+ ...styles
3738
+ }
3739
+ })
3740
+ };
3741
+ }
3742
+
3743
+ // node_modules/@mantine/hooks/esm/use-collapse/use-horizontal-collapse.mjs
3744
+ import { useEffectEvent as useEffectEvent10, useRef as useRef41, useState as useState48 } from "react";
3745
+ import { flushSync as flushSync2 } from "react-dom";
3746
+
3747
+ function getAutoWidthDuration(width) {
3748
+ if (!width || typeof width === "string")
3749
+ return 0;
3750
+ const constant = width / 36;
3751
+ return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
3752
+ }
3753
+ function getElementWidth(elementRef) {
3754
+ return elementRef.current ? elementRef.current.scrollWidth : "auto";
3755
+ }
3756
+ function useHorizontalCollapse({ transitionDuration, transitionTimingFunction = "ease", onTransitionEnd, onTransitionStart, expanded, keepMounted }) {
3757
+ const collapsedStyles = {
3758
+ width: 0,
3759
+ overflow: "hidden",
3760
+ ...keepMounted ? {} : { display: "none" }
3761
+ };
3762
+ const onTransitionStartEvent = useEffectEvent10(() => onTransitionStart?.());
3763
+ const elementRef = useRef41(null);
3764
+ const [styles, setStylesRaw] = useState48(expanded ? {} : collapsedStyles);
3765
+ const [state, setState] = useState48(expanded ? "entered" : "exited");
3766
+ const setStyles = (newStyles) => {
3767
+ flushSync2(() => setStylesRaw(newStyles));
3768
+ };
3769
+ const mergeStyles = (newStyles) => {
3770
+ setStyles((oldStyles) => ({
3771
+ ...oldStyles,
3772
+ ...newStyles
3773
+ }));
3774
+ };
3775
+ const getTransitionStyles = (width) => {
3776
+ const duration = transitionDuration ?? getAutoWidthDuration(width);
3777
+ return { transition: `width ${duration}ms ${transitionTimingFunction}, opacity ${duration}ms ${transitionTimingFunction}` };
3778
+ };
3779
+ useDidUpdate(() => {
3780
+ if (transitionDuration !== 0)
3781
+ onTransitionStartEvent();
3782
+ if (expanded)
3783
+ window.requestAnimationFrame(() => {
3784
+ flushSync2(() => setState("entering"));
3785
+ mergeStyles({
3786
+ willChange: "width",
3787
+ display: "block",
3788
+ overflow: "hidden"
3789
+ });
3790
+ window.requestAnimationFrame(() => {
3791
+ const width = getElementWidth(elementRef);
3792
+ mergeStyles({
3793
+ ...getTransitionStyles(width),
3794
+ width
3795
+ });
3796
+ });
3797
+ });
3798
+ else
3799
+ window.requestAnimationFrame(() => {
3800
+ flushSync2(() => setState("exiting"));
3801
+ const width = getElementWidth(elementRef);
3802
+ mergeStyles({
3803
+ ...getTransitionStyles(width),
3804
+ willChange: "width",
3805
+ width
3806
+ });
3807
+ window.requestAnimationFrame(() => mergeStyles({
3808
+ width: 0,
3809
+ overflow: "hidden"
3810
+ }));
3811
+ });
3812
+ }, [expanded]);
3813
+ const handleTransitionEnd = (event) => {
3814
+ if (event.target !== elementRef.current || event.propertyName !== "width")
3815
+ return;
3816
+ if (expanded) {
3817
+ const width = getElementWidth(elementRef);
3818
+ if (width === styles.width)
3819
+ setStyles({});
3820
+ else
3821
+ mergeStyles({ width });
3822
+ setState("entered");
3823
+ onTransitionEnd?.();
3824
+ } else if (styles.width === 0) {
3825
+ setStyles(collapsedStyles);
3826
+ setState("exited");
3827
+ onTransitionEnd?.();
3828
+ }
3829
+ };
3830
+ return {
3831
+ state,
3832
+ getCollapseProps: (input) => ({
3833
+ "aria-hidden": !expanded,
3834
+ inert: !expanded,
3835
+ ref: mergeRefs(elementRef, input?.ref),
3836
+ onTransitionEnd: handleTransitionEnd,
3837
+ style: {
3838
+ boxSizing: "border-box",
3839
+ ...input?.style,
3840
+ ...styles
3841
+ }
3842
+ })
3843
+ };
3844
+ }
3845
+
3846
+ // node_modules/@mantine/hooks/esm/use-mask/use-mask.mjs
3847
+ import { useCallback as useCallback35, useEffect as useEffect45, useRef as useRef42, useState as useState49 } from "react";
3848
+
3849
+ var DEFAULT_TOKENS = {
3850
+ "9": /[0-9]/,
3851
+ a: /[A-Za-z]/,
3852
+ A: /[A-Z]/,
3853
+ "*": /[A-Za-z0-9]/,
3854
+ "#": /[-+0-9]/
3855
+ };
3856
+ function parseMask(mask, tokens) {
3857
+ if (Array.isArray(mask))
3858
+ return mask.map((item) => {
3859
+ if (item instanceof RegExp)
3860
+ return {
3861
+ type: "token",
3862
+ char: "_",
3863
+ pattern: item
3864
+ };
3865
+ return {
3866
+ type: "literal",
3867
+ char: item
3868
+ };
3869
+ });
3870
+ const slots = [];
3871
+ let optional = false;
3872
+ for (let i = 0;i < mask.length; i++) {
3873
+ const char = mask[i];
3874
+ if (char === "\\" && i + 1 < mask.length) {
3875
+ i++;
3876
+ slots.push({
3877
+ type: "literal",
3878
+ char: mask[i]
3879
+ });
3880
+ continue;
3881
+ }
3882
+ if (char === "?") {
3883
+ optional = true;
3884
+ continue;
3885
+ }
3886
+ if (tokens[char])
3887
+ slots.push({
3888
+ type: "token",
3889
+ char,
3890
+ pattern: tokens[char],
3891
+ optional
3892
+ });
3893
+ else
3894
+ slots.push({
3895
+ type: "literal",
3896
+ char,
3897
+ optional
3898
+ });
3899
+ }
3900
+ return slots;
3901
+ }
3902
+ function getSlotChar(slotCharOption, index) {
3903
+ if (slotCharOption === null || slotCharOption === "" || slotCharOption === undefined)
3904
+ return "";
3905
+ if (slotCharOption.length > 1)
3906
+ return slotCharOption[index] || "_";
3907
+ return slotCharOption;
3908
+ }
3909
+ function applyMaskToRaw(raw, slots, _slotCharOption, transform) {
3910
+ let result = "";
3911
+ let rawIndex = 0;
3912
+ let slotIndex = 0;
3913
+ for (slotIndex = 0;slotIndex < slots.length; slotIndex++) {
3914
+ const slot = slots[slotIndex];
3915
+ if (slot.type === "literal")
3916
+ result += slot.char;
3917
+ else if (rawIndex < raw.length) {
3918
+ const ch = transform ? transform(raw[rawIndex]) : raw[rawIndex];
3919
+ if (slot.pattern && slot.pattern.test(ch)) {
3920
+ result += ch;
3921
+ rawIndex++;
3922
+ } else {
3923
+ rawIndex++;
3924
+ slotIndex--;
3925
+ }
3926
+ } else
3927
+ break;
3928
+ }
3929
+ return result;
3930
+ }
3931
+ function buildDisplayValue(value, slots, slotCharOption, showSlots) {
3932
+ if (!showSlots)
3933
+ return value;
3934
+ let display = value;
3935
+ for (let i = value.length;i < slots.length; i++) {
3936
+ const slot = slots[i];
3937
+ if (slot.type === "literal")
3938
+ display += slot.char;
3939
+ else {
3940
+ const sc = getSlotChar(slotCharOption, i);
3941
+ if (!sc)
3942
+ break;
3943
+ display += sc;
3944
+ }
3945
+ }
3946
+ return display;
3947
+ }
3948
+ function extractRaw(masked, slots) {
3949
+ let raw = "";
3950
+ for (let i = 0;i < masked.length && i < slots.length; i++)
3951
+ if (slots[i].type === "token")
3952
+ raw += masked[i];
3953
+ return raw;
3954
+ }
3955
+ function checkComplete(masked, slots) {
3956
+ for (let i = 0;i < slots.length; i++)
3957
+ if (slots[i].type === "token" && !slots[i].optional) {
3958
+ if (i >= masked.length)
3959
+ return false;
3960
+ if (!slots[i].pattern.test(masked[i]))
3961
+ return false;
3962
+ }
3963
+ return true;
3964
+ }
3965
+ function findNextTokenIndex(slots, from) {
3966
+ for (let i = from;i < slots.length; i++)
3967
+ if (slots[i].type === "token")
3968
+ return i;
3969
+ return slots.length;
3970
+ }
3971
+ function findPrevTokenIndex(slots, from) {
3972
+ for (let i = from;i >= 0; i--)
3973
+ if (slots[i].type === "token")
3974
+ return i;
3975
+ return -1;
3976
+ }
3977
+ function processInput(inputValue, slots, _slotCharOption) {
3978
+ let result = "";
3979
+ let inputIndex = 0;
3980
+ for (let slotIndex = 0;slotIndex < slots.length && inputIndex <= inputValue.length; slotIndex++) {
3981
+ const slot = slots[slotIndex];
3982
+ if (slot.type === "literal") {
3983
+ result += slot.char;
3984
+ if (inputIndex < inputValue.length && inputValue[inputIndex] === slot.char)
3985
+ inputIndex++;
3986
+ continue;
3987
+ }
3988
+ if (inputIndex >= inputValue.length)
3989
+ break;
3990
+ while (inputIndex < inputValue.length) {
3991
+ const ch = inputValue[inputIndex];
3992
+ inputIndex++;
3993
+ if (slot.pattern.test(ch)) {
3994
+ result += ch;
3995
+ break;
3996
+ }
3997
+ }
3998
+ if (result.length <= slotIndex)
3999
+ break;
4000
+ }
4001
+ return result;
4002
+ }
4003
+ function getResolvedOptions(options, rawValue) {
4004
+ const tokens = {
4005
+ ...DEFAULT_TOKENS,
4006
+ ...options.tokens
4007
+ };
4008
+ let mask = options.mask;
4009
+ let slotChar = options.slotChar === undefined ? "_" : options.slotChar;
4010
+ let separate = options.separate ?? false;
4011
+ if (options.modify) {
4012
+ const overrides = options.modify(rawValue);
4013
+ if (overrides) {
4014
+ if (overrides.mask !== undefined)
4015
+ mask = overrides.mask;
4016
+ if (overrides.tokens !== undefined)
4017
+ Object.assign(tokens, overrides.tokens);
4018
+ if (overrides.slotChar !== undefined)
4019
+ slotChar = overrides.slotChar;
4020
+ if (overrides.separate !== undefined)
4021
+ separate = overrides.separate;
4022
+ }
4023
+ }
4024
+ return {
4025
+ slots: parseMask(mask, tokens),
4026
+ slotChar,
4027
+ separate,
4028
+ tokens,
4029
+ transform: options.transform
4030
+ };
4031
+ }
4032
+ function formatMask(raw, options) {
4033
+ const { slots, slotChar, transform } = getResolvedOptions(options, raw);
4034
+ return applyMaskToRaw(raw, slots, slotChar, transform);
4035
+ }
4036
+ function unformatMask(masked, options) {
4037
+ const { slots } = getResolvedOptions(options, "");
4038
+ return extractRaw(masked, slots);
4039
+ }
4040
+ function isMaskComplete(masked, options) {
4041
+ const { slots } = getResolvedOptions(options, "");
4042
+ return checkComplete(masked, slots);
4043
+ }
4044
+ function generatePattern(mode, options) {
4045
+ const { slots } = getResolvedOptions(options, "");
4046
+ let pattern = "";
4047
+ for (const slot of slots)
4048
+ if (slot.type === "literal")
4049
+ pattern += slot.char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4050
+ else {
4051
+ const src = slot.pattern.source;
4052
+ if (mode === "full-inexact")
4053
+ pattern += slot.optional ? `${src}?` : src;
4054
+ else
4055
+ pattern += slot.optional ? `(${src})?` : `(${src})`;
4056
+ }
4057
+ return pattern;
4058
+ }
4059
+ function useMask(options) {
4060
+ const optionsRef = useRef42(options);
4061
+ optionsRef.current = options;
4062
+ const inputRef = useRef42(null);
4063
+ const [maskedValue, setMaskedValue] = useState49("");
4064
+ const [rawValue, setRawValue] = useState49("");
4065
+ const processedRef = useRef42("");
4066
+ const wasCompleteRef = useRef42(false);
4067
+ const isFocusedRef = useRef42(false);
4068
+ const getOptions = useCallback35(() => {
4069
+ const opts = optionsRef.current;
4070
+ return getResolvedOptions(opts, rawValue);
4071
+ }, [rawValue]);
4072
+ const updateValue = useCallback35((newMasked, cursorPos) => {
4073
+ const opts = optionsRef.current;
4074
+ const { slots } = getResolvedOptions(opts, extractRaw(newMasked, getResolvedOptions(opts, "").slots));
4075
+ const { slots: resolvedSlots, slotChar } = getResolvedOptions(opts, extractRaw(newMasked, slots));
4076
+ const reprocessed = processInput(newMasked, resolvedSlots, slotChar);
4077
+ const newRaw = extractRaw(reprocessed, resolvedSlots);
4078
+ const showSlots = opts.alwaysShowMask || isFocusedRef.current;
4079
+ const showOnFocus = opts.showMaskOnFocus !== false;
4080
+ const displayValue = buildDisplayValue(reprocessed, resolvedSlots, slotChar, showSlots && (showOnFocus || reprocessed.length > 0));
4081
+ processedRef.current = reprocessed;
4082
+ setMaskedValue(displayValue);
4083
+ setRawValue(newRaw);
4084
+ if (inputRef.current) {
4085
+ inputRef.current.value = displayValue;
4086
+ if (cursorPos !== undefined && document.activeElement === inputRef.current) {
4087
+ const pos = Math.min(cursorPos, reprocessed.length);
4088
+ inputRef.current.setSelectionRange(pos, pos);
4089
+ }
4090
+ }
4091
+ if (opts.onChangeRaw)
4092
+ opts.onChangeRaw(newRaw, displayValue);
4093
+ const complete = checkComplete(reprocessed, resolvedSlots);
4094
+ if (complete && !wasCompleteRef.current && opts.onComplete)
4095
+ opts.onComplete(displayValue, newRaw);
4096
+ wasCompleteRef.current = complete;
4097
+ return {
4098
+ displayValue,
4099
+ newRaw,
4100
+ reprocessed,
4101
+ resolvedSlots
4102
+ };
4103
+ }, [getOptions]);
4104
+ const handleInput = useCallback35((e) => {
4105
+ const input = e.target;
4106
+ const opts = optionsRef.current;
4107
+ const { slots: resolvedSlots, slotChar, transform } = getResolvedOptions(opts, "");
4108
+ const reformatted = applyMaskToRaw(extractRaw(input.value, resolvedSlots), resolvedSlots, slotChar, transform);
4109
+ updateValue(reformatted, reformatted.length);
4110
+ }, [updateValue]);
4111
+ const clampCursorToProcessed = useCallback35((input) => {
4112
+ const start = input.selectionStart ?? 0;
4113
+ if (start !== (input.selectionEnd ?? 0))
4114
+ return;
4115
+ const opts = optionsRef.current;
4116
+ const { slots } = getResolvedOptions(opts, "");
4117
+ const processed = processedRef.current;
4118
+ const endPos = processed.length > 0 ? findNextEditablePosition(processed.length, slots, processed) : findNextTokenIndex(slots, 0);
4119
+ const startPos = findNextTokenIndex(slots, 0);
4120
+ if (start > endPos || start < startPos)
4121
+ input.setSelectionRange(endPos, endPos);
4122
+ }, []);
4123
+ const handleFocus = useCallback35(() => {
4124
+ isFocusedRef.current = true;
4125
+ const opts = optionsRef.current;
4126
+ const input = inputRef.current;
4127
+ if (!input)
4128
+ return;
4129
+ const { slots, slotChar } = getResolvedOptions(opts, "");
4130
+ const showOnFocus = opts.showMaskOnFocus !== false;
4131
+ const processed = processedRef.current;
4132
+ if (showOnFocus || opts.alwaysShowMask) {
4133
+ const display = buildDisplayValue(processed, slots, slotChar, true);
4134
+ input.value = display;
4135
+ setMaskedValue(display);
4136
+ }
4137
+ requestAnimationFrame(() => {
4138
+ if (input === document.activeElement)
4139
+ clampCursorToProcessed(input);
4140
+ });
4141
+ }, [clampCursorToProcessed]);
4142
+ const handleMouseUp = useCallback35(() => {
4143
+ const input = inputRef.current;
4144
+ if (!input || input !== document.activeElement)
4145
+ return;
4146
+ clampCursorToProcessed(input);
4147
+ }, [clampCursorToProcessed]);
4148
+ const handleMouseDown = useCallback35(() => {
4149
+ const input = inputRef.current;
4150
+ if (!input)
4151
+ return;
4152
+ requestAnimationFrame(() => {
4153
+ if (input !== document.activeElement)
4154
+ return;
4155
+ const start = input.selectionStart ?? 0;
4156
+ if (start !== (input.selectionEnd ?? 0))
4157
+ return;
4158
+ const opts = optionsRef.current;
4159
+ const { slots } = getResolvedOptions(opts, "");
4160
+ const processed = processedRef.current;
4161
+ const endPos = processed.length > 0 ? findNextEditablePosition(processed.length, slots, processed) : findNextTokenIndex(slots, 0);
4162
+ if (start > endPos)
4163
+ input.setSelectionRange(endPos, endPos);
4164
+ });
4165
+ }, []);
4166
+ const handleBlur = useCallback35(() => {
4167
+ isFocusedRef.current = false;
4168
+ const opts = optionsRef.current;
4169
+ const input = inputRef.current;
4170
+ if (!input)
4171
+ return;
4172
+ const { slots, slotChar } = getResolvedOptions(opts, rawValue);
4173
+ const expectedFocusDisplay = buildDisplayValue(processedRef.current, slots, slotChar, true);
4174
+ const processed = input.value === expectedFocusDisplay ? processedRef.current : processInput(input.value, slots, slotChar);
4175
+ const complete = checkComplete(processed, slots);
4176
+ if (opts.autoClear && !complete && processed.length > 0) {
4177
+ input.value = "";
4178
+ processedRef.current = "";
4179
+ setMaskedValue("");
4180
+ setRawValue("");
4181
+ wasCompleteRef.current = false;
4182
+ if (opts.onChangeRaw)
4183
+ opts.onChangeRaw("", "");
4184
+ if (opts.alwaysShowMask) {
4185
+ const emptyDisplay = buildDisplayValue("", slots, slotChar, true);
4186
+ input.value = emptyDisplay;
4187
+ setMaskedValue(emptyDisplay);
4188
+ }
4189
+ return;
4190
+ }
4191
+ if (!opts.alwaysShowMask && !complete) {
4192
+ if (extractRaw(processed, slots).length === 0) {
4193
+ input.value = "";
4194
+ processedRef.current = "";
4195
+ setMaskedValue("");
4196
+ setRawValue("");
4197
+ wasCompleteRef.current = false;
4198
+ if (opts.onChangeRaw)
4199
+ opts.onChangeRaw("", "");
4200
+ return;
4201
+ }
4202
+ const display = buildDisplayValue(processed, slots, slotChar, false);
4203
+ input.value = display;
4204
+ setMaskedValue(display);
4205
+ }
4206
+ }, [rawValue]);
4207
+ const handleKeyDown = useCallback35((e) => {
4208
+ const input = e.target;
4209
+ const opts = optionsRef.current;
4210
+ const { slots, slotChar, transform } = getResolvedOptions(opts, rawValue);
4211
+ const start = input.selectionStart ?? 0;
4212
+ const end = input.selectionEnd ?? 0;
4213
+ const processed = processedRef.current;
4214
+ if (e.key === "Backspace") {
4215
+ e.preventDefault();
4216
+ if (e.metaKey || e.ctrlKey && !e.altKey) {
4217
+ const clampedStart = Math.min(start, processed.length);
4218
+ updateValue(applyMaskToRaw(extractRaw(processed.slice(clampedStart), slots.slice(clampedStart)), slots, slotChar, transform), 0);
4219
+ return;
4220
+ }
4221
+ if (start !== end) {
4222
+ const clampedEnd = Math.min(end, processed.length);
4223
+ const before = processed.slice(0, start);
4224
+ const afterRaw = extractRaw(processed.slice(clampedEnd), slots.slice(clampedEnd));
4225
+ updateValue(applyMaskToRaw(extractRaw(before, slots) + afterRaw, slots, slotChar, transform), start);
4226
+ return;
4227
+ }
4228
+ if (start === 0)
4229
+ return;
4230
+ let deletePos = start - 1;
4231
+ while (deletePos >= 0 && slots[deletePos] && slots[deletePos].type === "literal")
4232
+ deletePos--;
4233
+ if (deletePos < 0)
4234
+ return;
4235
+ updateValue(applyMaskToRaw(extractRaw(processed.slice(0, deletePos), slots.slice(0, deletePos)) + extractRaw(processed.slice(deletePos + 1), slots.slice(deletePos + 1)), slots, slotChar, transform), deletePos);
4236
+ } else if (e.key === "Delete") {
4237
+ e.preventDefault();
4238
+ if (start !== end) {
4239
+ const clampedEnd = Math.min(end, processed.length);
4240
+ const before = processed.slice(0, start);
4241
+ const afterRaw = extractRaw(processed.slice(clampedEnd), slots.slice(clampedEnd));
4242
+ updateValue(applyMaskToRaw(extractRaw(before, slots) + afterRaw, slots, slotChar, transform), start);
4243
+ return;
4244
+ }
4245
+ let deletePos = start;
4246
+ while (deletePos < slots.length && slots[deletePos] && slots[deletePos].type === "literal")
4247
+ deletePos++;
4248
+ if (deletePos >= processed.length)
4249
+ return;
4250
+ updateValue(applyMaskToRaw(extractRaw(processed.slice(0, start), slots.slice(0, start)) + extractRaw(processed.slice(deletePos + 1), slots.slice(deletePos + 1)), slots, slotChar, transform), start);
4251
+ } else if (e.key === "ArrowRight" && !e.shiftKey) {
4252
+ const nextPos = findNextEditablePosition(start + 1, slots, input.value);
4253
+ if (nextPos !== start + 1) {
4254
+ e.preventDefault();
4255
+ input.setSelectionRange(nextPos, nextPos);
4256
+ }
4257
+ } else if (e.key === "ArrowLeft" && !e.shiftKey) {
4258
+ if (start > 0) {
4259
+ const prevToken = findPrevTokenIndex(slots, start - 1);
4260
+ if (prevToken >= 0 && prevToken !== start - 1) {
4261
+ e.preventDefault();
4262
+ input.setSelectionRange(prevToken + 1, prevToken + 1);
4263
+ }
4264
+ }
4265
+ } else if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
4266
+ e.preventDefault();
4267
+ let insertPos = Math.min(start, processed.length);
4268
+ while (insertPos < slots.length && slots[insertPos] && slots[insertPos].type === "literal")
4269
+ insertPos++;
4270
+ if (insertPos >= slots.length)
4271
+ return;
4272
+ const slot = slots[insertPos];
4273
+ const ch = transform ? transform(e.key) : e.key;
4274
+ if (!slot.pattern.test(ch))
4275
+ return;
4276
+ const beforeRaw = extractRaw(processed.slice(0, insertPos), slots.slice(0, insertPos));
4277
+ const afterRaw = start < end ? extractRaw(processed.slice(Math.min(end, processed.length)), slots.slice(Math.min(end, processed.length))) : extractRaw(processed.slice(insertPos), slots.slice(insertPos));
4278
+ const newValue = applyMaskToRaw(beforeRaw + ch + afterRaw, slots, slotChar, transform);
4279
+ updateValue(newValue, findNextEditablePosition(insertPos + 1, slots, newValue));
4280
+ }
4281
+ }, [rawValue, updateValue]);
4282
+ const handlePaste = useCallback35((e) => {
4283
+ e.preventDefault();
4284
+ const input = e.target;
4285
+ const opts = optionsRef.current;
4286
+ const pastedText = e.clipboardData?.getData("text") ?? "";
4287
+ const start = input.selectionStart ?? 0;
4288
+ const end = input.selectionEnd ?? 0;
4289
+ const processed = processedRef.current;
4290
+ const { slots, slotChar, transform } = getResolvedOptions(opts, "");
4291
+ const clampedEnd = Math.min(end, processed.length);
4292
+ const beforeRaw = extractRaw(processed.slice(0, start), slots.slice(0, start));
4293
+ const afterRaw = extractRaw(processed.slice(clampedEnd), slots.slice(clampedEnd));
4294
+ const newValue = applyMaskToRaw(beforeRaw + pastedText + afterRaw, slots, slotChar, transform);
4295
+ const { reprocessed } = updateValue(newValue);
4296
+ const pasteEndPos = Math.min((reprocessed || newValue).length, slots.length);
4297
+ if (input === document.activeElement)
4298
+ input.setSelectionRange(pasteEndPos, pasteEndPos);
4299
+ }, [updateValue]);
4300
+ const setAriaAttributes = useCallback35((input) => {
4301
+ if (optionsRef.current.invalid)
4302
+ input.setAttribute("aria-invalid", "true");
4303
+ else
4304
+ input.removeAttribute("aria-invalid");
4305
+ }, []);
4306
+ const refCallback = useCallback35((node) => {
4307
+ const prevInput = inputRef.current;
4308
+ if (prevInput) {
4309
+ prevInput.removeEventListener("input", handleInput);
4310
+ prevInput.removeEventListener("focus", handleFocus);
4311
+ prevInput.removeEventListener("blur", handleBlur);
4312
+ prevInput.removeEventListener("mousedown", handleMouseDown);
4313
+ prevInput.removeEventListener("mouseup", handleMouseUp);
4314
+ prevInput.removeEventListener("keydown", handleKeyDown);
4315
+ prevInput.removeEventListener("paste", handlePaste);
4316
+ }
4317
+ inputRef.current = node;
4318
+ if (node) {
4319
+ node.addEventListener("input", handleInput);
4320
+ node.addEventListener("focus", handleFocus);
4321
+ node.addEventListener("blur", handleBlur);
4322
+ node.addEventListener("mousedown", handleMouseDown);
4323
+ node.addEventListener("mouseup", handleMouseUp);
4324
+ node.addEventListener("keydown", handleKeyDown);
4325
+ node.addEventListener("paste", handlePaste);
4326
+ setAriaAttributes(node);
4327
+ if (options.alwaysShowMask && !node.value) {
4328
+ const { slots, slotChar } = getResolvedOptions(options, "");
4329
+ const display = buildDisplayValue("", slots, slotChar, true);
4330
+ node.value = display;
4331
+ setMaskedValue(display);
4332
+ }
4333
+ }
4334
+ }, [
4335
+ handleInput,
4336
+ handleFocus,
4337
+ handleBlur,
4338
+ handleMouseDown,
4339
+ handleMouseUp,
4340
+ handleKeyDown,
4341
+ handlePaste,
4342
+ setAriaAttributes,
4343
+ options
4344
+ ]);
4345
+ useEffect45(() => {
4346
+ const input = inputRef.current;
4347
+ if (!input)
4348
+ return;
4349
+ setAriaAttributes(input);
4350
+ }, [options.invalid, setAriaAttributes]);
4351
+ return {
4352
+ ref: refCallback,
4353
+ value: maskedValue,
4354
+ rawValue,
4355
+ isComplete: (() => {
4356
+ const { slots } = getOptions();
4357
+ return checkComplete(processedRef.current, slots);
4358
+ })(),
4359
+ reset: useCallback35(() => {
4360
+ const opts = optionsRef.current;
4361
+ const input = inputRef.current;
4362
+ processedRef.current = "";
4363
+ setMaskedValue("");
4364
+ setRawValue("");
4365
+ wasCompleteRef.current = false;
4366
+ if (input)
4367
+ if (opts.alwaysShowMask) {
4368
+ const { slots, slotChar } = getResolvedOptions(opts, "");
4369
+ const display = buildDisplayValue("", slots, slotChar, true);
4370
+ input.value = display;
4371
+ setMaskedValue(display);
4372
+ } else
4373
+ input.value = "";
4374
+ if (opts.onChangeRaw)
4375
+ opts.onChangeRaw("", "");
4376
+ }, [])
4377
+ };
4378
+ }
4379
+ function findNextEditablePosition(from, slots, value) {
4380
+ let pos = from;
4381
+ while (pos < slots.length && pos < value.length && slots[pos] && slots[pos].type === "literal")
4382
+ pos++;
4383
+ return pos;
4384
+ }
4385
+
4386
+ // node_modules/@mantine/hooks/esm/use-roving-index/use-roving-index.mjs
4387
+ import { useCallback as useCallback36, useEffect as useEffect46, useRef as useRef43 } from "react";
4388
+
4389
+ function findNextEnabled(current, total, isItemDisabled, loop) {
4390
+ for (let i = current + 1;i < total; i += 1)
4391
+ if (!isItemDisabled(i))
4392
+ return i;
4393
+ if (loop) {
4394
+ for (let i = 0;i < current; i += 1)
4395
+ if (!isItemDisabled(i))
4396
+ return i;
4397
+ }
4398
+ return current;
4399
+ }
4400
+ function findPreviousEnabled(current, total, isItemDisabled, loop) {
4401
+ for (let i = current - 1;i >= 0; i -= 1)
4402
+ if (!isItemDisabled(i))
4403
+ return i;
4404
+ if (loop) {
4405
+ for (let i = total - 1;i > current; i -= 1)
4406
+ if (!isItemDisabled(i))
4407
+ return i;
4408
+ }
4409
+ return current;
4410
+ }
4411
+ function findFirstEnabled(total, isItemDisabled) {
4412
+ for (let i = 0;i < total; i += 1)
4413
+ if (!isItemDisabled(i))
4414
+ return i;
4415
+ return 0;
4416
+ }
4417
+ function findLastEnabled(total, isItemDisabled) {
4418
+ for (let i = total - 1;i >= 0; i -= 1)
4419
+ if (!isItemDisabled(i))
4420
+ return i;
4421
+ return 0;
4422
+ }
4423
+ var defaultIsItemDisabled = () => false;
4424
+ function useRovingIndex(input) {
4425
+ const { total, orientation = "horizontal", loop = true, dir = "ltr", activateOnFocus = false, columns, focusedIndex, initialIndex, onFocusChange, isItemDisabled = defaultIsItemDisabled } = input;
4426
+ const itemRefs = useRef43(/* @__PURE__ */ new Map);
4427
+ const isGrid = typeof columns === "number" && columns > 0;
4428
+ const [activeIndex, setActiveIndex] = useUncontrolled({
4429
+ value: focusedIndex,
4430
+ defaultValue: initialIndex !== undefined ? initialIndex : findFirstEnabled(total, isItemDisabled),
4431
+ finalValue: 0,
4432
+ onChange: onFocusChange
4433
+ });
4434
+ useEffect46(() => {
4435
+ if (total === 0)
4436
+ return;
4437
+ if (activeIndex >= total)
4438
+ setActiveIndex(findLastEnabled(total, isItemDisabled));
4439
+ else if (isItemDisabled(activeIndex))
4440
+ setActiveIndex(findFirstEnabled(total, isItemDisabled));
4441
+ }, [
4442
+ total,
4443
+ activeIndex,
4444
+ isItemDisabled
4445
+ ]);
4446
+ const focusItem = useCallback36((index) => {
4447
+ setActiveIndex(index);
4448
+ const element = itemRefs.current.get(index);
4449
+ if (element) {
4450
+ element.focus();
4451
+ if (activateOnFocus)
4452
+ element.click();
4453
+ }
4454
+ }, [activateOnFocus, setActiveIndex]);
4455
+ const handleGridKeyDown = useCallback36((event, currentIndex) => {
4456
+ const row = Math.floor(currentIndex / columns);
4457
+ const col = currentIndex % columns;
4458
+ const totalRows = Math.ceil(total / columns);
4459
+ let nextIndex = null;
4460
+ const isRtl = dir === "rtl";
4461
+ switch (event.key) {
4462
+ case "ArrowRight": {
4463
+ const targetCol = isRtl ? col - 1 : col + 1;
4464
+ if (targetCol >= 0 && targetCol < columns && row * columns + targetCol < total) {
4465
+ const candidate = row * columns + targetCol;
4466
+ if (!isItemDisabled(candidate))
4467
+ nextIndex = candidate;
4468
+ }
4469
+ break;
4470
+ }
4471
+ case "ArrowLeft": {
4472
+ const targetCol = isRtl ? col + 1 : col - 1;
4473
+ if (targetCol >= 0 && targetCol < columns && row * columns + targetCol < total) {
4474
+ const candidate = row * columns + targetCol;
4475
+ if (!isItemDisabled(candidate))
4476
+ nextIndex = candidate;
4477
+ }
4478
+ break;
4479
+ }
4480
+ case "ArrowDown":
4481
+ for (let r = row + 1;r < totalRows; r += 1) {
4482
+ const candidate = r * columns + col;
4483
+ if (candidate < total && !isItemDisabled(candidate)) {
4484
+ nextIndex = candidate;
4485
+ break;
4486
+ }
4487
+ }
4488
+ break;
4489
+ case "ArrowUp":
4490
+ for (let r = row - 1;r >= 0; r -= 1) {
4491
+ const candidate = r * columns + col;
4492
+ if (candidate < total && !isItemDisabled(candidate)) {
4493
+ nextIndex = candidate;
4494
+ break;
4495
+ }
4496
+ }
4497
+ break;
4498
+ case "Home":
4499
+ if (event.ctrlKey)
4500
+ nextIndex = findFirstEnabled(total, isItemDisabled);
4501
+ else {
4502
+ const rowStart = row * columns;
4503
+ for (let i = rowStart;i < rowStart + columns && i < total; i += 1)
4504
+ if (!isItemDisabled(i)) {
4505
+ nextIndex = i;
4506
+ break;
4507
+ }
4508
+ }
4509
+ break;
4510
+ case "End":
4511
+ if (event.ctrlKey)
4512
+ nextIndex = findLastEnabled(total, isItemDisabled);
4513
+ else {
4514
+ const rowStart = row * columns;
4515
+ const rowEnd = Math.min(rowStart + columns, total) - 1;
4516
+ for (let i = rowEnd;i >= rowStart; i -= 1)
4517
+ if (!isItemDisabled(i)) {
4518
+ nextIndex = i;
4519
+ break;
4520
+ }
4521
+ }
4522
+ break;
4523
+ }
4524
+ if (nextIndex !== null && nextIndex !== currentIndex) {
4525
+ event.preventDefault();
4526
+ event.stopPropagation();
4527
+ focusItem(nextIndex);
4528
+ }
4529
+ }, [
4530
+ total,
4531
+ columns,
4532
+ dir,
4533
+ isItemDisabled,
4534
+ focusItem
4535
+ ]);
4536
+ const handleListKeyDown = useCallback36((event, currentIndex) => {
4537
+ const isRtl = dir === "rtl";
4538
+ let nextIndex = null;
4539
+ switch (event.key) {
4540
+ case "ArrowRight":
4541
+ if (orientation === "horizontal" || orientation === "both")
4542
+ nextIndex = isRtl ? findPreviousEnabled(currentIndex, total, isItemDisabled, loop) : findNextEnabled(currentIndex, total, isItemDisabled, loop);
4543
+ break;
4544
+ case "ArrowLeft":
4545
+ if (orientation === "horizontal" || orientation === "both")
4546
+ nextIndex = isRtl ? findNextEnabled(currentIndex, total, isItemDisabled, loop) : findPreviousEnabled(currentIndex, total, isItemDisabled, loop);
4547
+ break;
4548
+ case "ArrowDown":
4549
+ if (orientation === "vertical" || orientation === "both")
4550
+ nextIndex = findNextEnabled(currentIndex, total, isItemDisabled, loop);
4551
+ break;
4552
+ case "ArrowUp":
4553
+ if (orientation === "vertical" || orientation === "both")
4554
+ nextIndex = findPreviousEnabled(currentIndex, total, isItemDisabled, loop);
4555
+ break;
4556
+ case "Home":
4557
+ nextIndex = findFirstEnabled(total, isItemDisabled);
4558
+ break;
4559
+ case "End":
4560
+ nextIndex = findLastEnabled(total, isItemDisabled);
4561
+ break;
4562
+ }
4563
+ if (nextIndex !== null && nextIndex !== currentIndex) {
4564
+ event.preventDefault();
4565
+ event.stopPropagation();
4566
+ focusItem(nextIndex);
4567
+ }
4568
+ }, [
4569
+ total,
4570
+ orientation,
4571
+ loop,
4572
+ dir,
4573
+ isItemDisabled,
4574
+ focusItem
4575
+ ]);
4576
+ return {
4577
+ getItemProps: useCallback36((options) => {
4578
+ const { index, onClick, onKeyDown } = options;
4579
+ return {
4580
+ tabIndex: index === activeIndex ? 0 : -1,
4581
+ ref: (node) => {
4582
+ if (node)
4583
+ itemRefs.current.set(index, node);
4584
+ else
4585
+ itemRefs.current.delete(index);
4586
+ },
4587
+ onKeyDown: (event) => {
4588
+ onKeyDown?.(event);
4589
+ if (event.defaultPrevented)
4590
+ return;
4591
+ if (isGrid)
4592
+ handleGridKeyDown(event, index);
4593
+ else
4594
+ handleListKeyDown(event, index);
4595
+ },
4596
+ onClick: (event) => {
4597
+ onClick?.(event);
4598
+ setActiveIndex(index);
4599
+ }
4600
+ };
4601
+ }, [
4602
+ activeIndex,
4603
+ isGrid,
4604
+ handleGridKeyDown,
4605
+ handleListKeyDown,
4606
+ setActiveIndex
4607
+ ]),
4608
+ focusedIndex: activeIndex,
4609
+ setFocusedIndex: setActiveIndex
4610
+ };
4611
+ }
4612
+
4613
+ // node_modules/@mantine/hooks/esm/use-drag/use-drag.mjs
4614
+ import { useCallback as useCallback37, useRef as useRef44, useState as useState50 } from "react";
4615
+
4616
+ var VELOCITY_DECAY_MS = 100;
4617
+ function sign(n) {
4618
+ if (n > 0)
4619
+ return 1;
4620
+ if (n < 0)
4621
+ return -1;
4622
+ return 0;
4623
+ }
4624
+ function getThresholdVector(threshold) {
4625
+ const t = threshold ?? 0;
4626
+ if (typeof t === "number")
4627
+ return [t, t];
4628
+ return t;
4629
+ }
4630
+ function createInitialState() {
4631
+ return {
4632
+ isActive: false,
4633
+ pointerId: -1,
4634
+ startXY: [0, 0],
4635
+ prevXY: [0, 0],
4636
+ startTimestamp: 0,
4637
+ prevTimestamp: 0,
4638
+ thresholdMet: false,
4639
+ firstFired: false,
4640
+ lockedAxis: null,
4641
+ canceled: false,
4642
+ lastVelocity: [0, 0]
4643
+ };
4644
+ }
4645
+ function useDrag(handler, options = {}) {
4646
+ const [active, setActive] = useState50(false);
4647
+ const handlerRef = useRef44(handler);
4648
+ handlerRef.current = handler;
4649
+ const optionsRef = useRef44(options);
4650
+ optionsRef.current = options;
4651
+ const stateRef = useRef44(createInitialState());
4652
+ const documentControllerRef = useRef44(null);
4653
+ return {
4654
+ ref: useCallback37((node) => {
4655
+ if (!node)
4656
+ return;
4657
+ const elementController = new AbortController;
4658
+ const applyAxisConstraint = (v) => {
4659
+ const opts = optionsRef.current;
4660
+ const s = stateRef.current;
4661
+ if (opts.axis === "x")
4662
+ return [v[0], 0];
4663
+ if (opts.axis === "y")
4664
+ return [0, v[1]];
4665
+ if (opts.axis === "lock") {
4666
+ if (s.lockedAxis === null) {
4667
+ const t = opts.axisThreshold ?? 1;
4668
+ if (Math.abs(v[0]) > t || Math.abs(v[1]) > t)
4669
+ s.lockedAxis = Math.abs(v[0]) >= Math.abs(v[1]) ? "x" : "y";
4670
+ }
4671
+ if (s.lockedAxis === "x")
4672
+ return [v[0], 0];
4673
+ if (s.lockedAxis === "y")
4674
+ return [0, v[1]];
4675
+ }
4676
+ return v;
4677
+ };
4678
+ const resetDrag = () => {
4679
+ const s = stateRef.current;
4680
+ s.isActive = false;
4681
+ s.pointerId = -1;
4682
+ s.thresholdMet = false;
4683
+ s.firstFired = false;
4684
+ s.lockedAxis = null;
4685
+ s.canceled = false;
4686
+ setActive(false);
4687
+ document.body.style.userSelect = "";
4688
+ document.body.style.webkitUserSelect = "";
4689
+ documentControllerRef.current?.abort();
4690
+ documentControllerRef.current = null;
4691
+ };
4692
+ const cancel = () => {
4693
+ if (stateRef.current.isActive) {
4694
+ stateRef.current.canceled = true;
4695
+ resetDrag();
4696
+ }
4697
+ };
4698
+ const activateDrag = () => {
4699
+ setActive(true);
4700
+ document.body.style.userSelect = "none";
4701
+ document.body.style.webkitUserSelect = "none";
4702
+ };
4703
+ const onPointerDown = (event) => {
4704
+ if (optionsRef.current.enabled === false)
4705
+ return;
4706
+ if (event.button !== 0)
4707
+ return;
4708
+ if (stateRef.current.isActive)
4709
+ return;
4710
+ const s = stateRef.current;
4711
+ s.isActive = true;
4712
+ s.pointerId = event.pointerId;
4713
+ s.startXY = [event.clientX, event.clientY];
4714
+ s.prevXY = [event.clientX, event.clientY];
4715
+ s.startTimestamp = event.timeStamp;
4716
+ s.prevTimestamp = event.timeStamp;
4717
+ s.thresholdMet = false;
4718
+ s.firstFired = false;
4719
+ s.lockedAxis = null;
4720
+ s.canceled = false;
4721
+ s.lastVelocity = [0, 0];
4722
+ const [tx, ty] = getThresholdVector(optionsRef.current.threshold);
4723
+ if (tx === 0 && ty === 0) {
4724
+ s.thresholdMet = true;
4725
+ s.firstFired = true;
4726
+ activateDrag();
4727
+ handlerRef.current({
4728
+ xy: [event.clientX, event.clientY],
4729
+ initial: [event.clientX, event.clientY],
4730
+ movement: [0, 0],
4731
+ delta: [0, 0],
4732
+ distance: [0, 0],
4733
+ direction: [0, 0],
4734
+ velocity: [0, 0],
4735
+ elapsedTime: 0,
4736
+ first: true,
4737
+ last: false,
4738
+ active: true,
4739
+ tap: false,
4740
+ canceled: false,
4741
+ cancel,
4742
+ event
4743
+ });
4744
+ }
4745
+ documentControllerRef.current?.abort();
4746
+ documentControllerRef.current = new AbortController;
4747
+ const sig = documentControllerRef.current.signal;
4748
+ document.addEventListener("pointermove", onPointerMove, { signal: sig });
4749
+ document.addEventListener("pointerup", onPointerUp, { signal: sig });
4750
+ document.addEventListener("pointercancel", onPointerCancel, { signal: sig });
4751
+ };
4752
+ const onPointerMove = (event) => {
4753
+ const s = stateRef.current;
4754
+ if (!s.isActive || event.pointerId !== s.pointerId)
4755
+ return;
4756
+ const rawMovement = [event.clientX - s.startXY[0], event.clientY - s.startXY[1]];
4757
+ if (!s.thresholdMet) {
4758
+ const [tx, ty] = getThresholdVector(optionsRef.current.threshold);
4759
+ if (Math.abs(rawMovement[0]) < tx && Math.abs(rawMovement[1]) < ty) {
4760
+ s.prevXY = [event.clientX, event.clientY];
4761
+ s.prevTimestamp = event.timeStamp;
4762
+ return;
4763
+ }
4764
+ s.thresholdMet = true;
4765
+ activateDrag();
4766
+ }
4767
+ const movement = applyAxisConstraint(rawMovement);
4768
+ const delta = applyAxisConstraint([event.clientX - s.prevXY[0], event.clientY - s.prevXY[1]]);
4769
+ const timeDelta = event.timeStamp - s.prevTimestamp;
4770
+ const velocity = timeDelta > 0 ? [Math.abs(delta[0]) / timeDelta, Math.abs(delta[1]) / timeDelta] : s.lastVelocity;
4771
+ s.lastVelocity = velocity;
4772
+ const isFirst = !s.firstFired;
4773
+ s.firstFired = true;
4774
+ s.prevXY = [event.clientX, event.clientY];
4775
+ s.prevTimestamp = event.timeStamp;
4776
+ handlerRef.current({
4777
+ xy: [event.clientX, event.clientY],
4778
+ initial: [...s.startXY],
4779
+ movement,
4780
+ delta,
4781
+ distance: [Math.abs(movement[0]), Math.abs(movement[1])],
4782
+ direction: [sign(delta[0]), sign(delta[1])],
4783
+ velocity,
4784
+ elapsedTime: event.timeStamp - s.startTimestamp,
4785
+ first: isFirst,
4786
+ last: false,
4787
+ active: true,
4788
+ tap: false,
4789
+ canceled: false,
4790
+ cancel,
4791
+ event
4792
+ });
4793
+ };
4794
+ const onPointerUp = (event) => {
4795
+ const s = stateRef.current;
4796
+ if (!s.isActive || event.pointerId !== s.pointerId)
4797
+ return;
4798
+ const opts = optionsRef.current;
4799
+ if (!s.thresholdMet) {
4800
+ if (opts.filterTaps) {
4801
+ const mov = applyAxisConstraint([event.clientX - s.startXY[0], event.clientY - s.startXY[1]]);
4802
+ const dist = [Math.abs(mov[0]), Math.abs(mov[1])];
4803
+ const isTap = Math.max(dist[0], dist[1]) < (opts.tapThreshold ?? 3);
4804
+ handlerRef.current({
4805
+ xy: [event.clientX, event.clientY],
4806
+ initial: [...s.startXY],
4807
+ movement: mov,
4808
+ delta: mov,
4809
+ distance: dist,
4810
+ direction: [sign(mov[0]), sign(mov[1])],
4811
+ velocity: [0, 0],
4812
+ elapsedTime: event.timeStamp - s.startTimestamp,
4813
+ first: true,
4814
+ last: true,
4815
+ active: false,
4816
+ tap: isTap,
4817
+ canceled: false,
4818
+ cancel,
4819
+ event
4820
+ });
4821
+ }
4822
+ resetDrag();
4823
+ return;
4824
+ }
4825
+ const movement = applyAxisConstraint([event.clientX - s.startXY[0], event.clientY - s.startXY[1]]);
4826
+ const distance = [Math.abs(movement[0]), Math.abs(movement[1])];
4827
+ const delta = applyAxisConstraint([event.clientX - s.prevXY[0], event.clientY - s.prevXY[1]]);
4828
+ const velocity = event.timeStamp - s.prevTimestamp > VELOCITY_DECAY_MS ? [0, 0] : s.lastVelocity;
4829
+ const maxDistance = Math.max(distance[0], distance[1]);
4830
+ const tap = opts.filterTaps === true && maxDistance < (opts.tapThreshold ?? 3);
4831
+ handlerRef.current({
4832
+ xy: [event.clientX, event.clientY],
4833
+ initial: [...s.startXY],
4834
+ movement,
4835
+ delta,
4836
+ distance,
4837
+ direction: [sign(delta[0]), sign(delta[1])],
4838
+ velocity,
4839
+ elapsedTime: event.timeStamp - s.startTimestamp,
4840
+ first: !s.firstFired,
4841
+ last: true,
4842
+ active: false,
4843
+ tap,
4844
+ canceled: false,
4845
+ cancel,
4846
+ event
4847
+ });
4848
+ resetDrag();
4849
+ };
4850
+ const onPointerCancel = (event) => {
4851
+ const s = stateRef.current;
4852
+ if (!s.isActive || event.pointerId !== s.pointerId)
4853
+ return;
4854
+ const movement = applyAxisConstraint([event.clientX - s.startXY[0], event.clientY - s.startXY[1]]);
4855
+ handlerRef.current({
4856
+ xy: [event.clientX, event.clientY],
4857
+ initial: [...s.startXY],
4858
+ movement,
4859
+ delta: [0, 0],
4860
+ distance: [Math.abs(movement[0]), Math.abs(movement[1])],
4861
+ direction: [0, 0],
4862
+ velocity: [0, 0],
4863
+ elapsedTime: event.timeStamp - s.startTimestamp,
4864
+ first: !s.firstFired,
4865
+ last: true,
4866
+ active: false,
4867
+ tap: false,
4868
+ canceled: true,
4869
+ cancel,
4870
+ event
4871
+ });
4872
+ resetDrag();
4873
+ };
4874
+ node.addEventListener("pointerdown", onPointerDown, { signal: elementController.signal });
4875
+ return () => {
4876
+ elementController.abort();
4877
+ documentControllerRef.current?.abort();
4878
+ documentControllerRef.current = null;
4879
+ if (stateRef.current.isActive) {
4880
+ stateRef.current.isActive = false;
4881
+ setActive(false);
4882
+ document.body.style.userSelect = "";
4883
+ document.body.style.webkitUserSelect = "";
4884
+ }
4885
+ };
4886
+ }, []),
4887
+ active
4888
+ };
4889
+ }
4890
+
4891
+ export { clamp, lowerFirst, randomId, range, shallowEqual, upperFirst, useCallbackRef, useDebouncedCallback, useClickOutside, useClipboard, useMediaQuery, useColorScheme, useCounter, useDebouncedState, useDebouncedValue, useIsomorphicEffect, useDocumentTitle, useDocumentVisibility, useDidUpdate, useFocusReturn, useFocusTrap, useForceUpdate, useId$1, useIdle, useInterval, useListState, useWindowEvent, useLocalStorage, readLocalStorageValue, useSessionStorage, readSessionStorageValue, assignRef, mergeRefs, useMergedRef, useMouse, useMousePosition, clampUseMovePosition, useMove, useUncontrolled, usePagination, useQueue, usePageLeave, useReducedMotion, useScrollIntoView, useResizeObserver, useElementSize, useShallowEffect, useToggle, useViewportSize, useWindowScroll, useIntersection, useHash, getHotkeyHandler, useHotkeys, useFullscreenElement, useFullscreenDocument, useLogger, useHover, useValidatedState, useOs, useSetState, useInputState, useEventListener, useDisclosure, useFocusWithin, useNetwork, useTimeout, useTextSelection, usePrevious, useFavicon, useScrollDirection, useHeadroom, useEyeDropper, useInViewport, useMutationObserver, useMutationObserverTarget, useMounted, useStateHistory, useMap, useSet, useThrottledCallback, useThrottledState, useThrottledValue, useIsFirstRender, useOrientation, useFetch, normalizeRadialValue, useRadialMove, useScrollSpy, useScroller, useFileDialog, useLongPress, useSelection, useFloatingWindow, useCollapse, useHorizontalCollapse, formatMask, unformatMask, isMaskComplete, generatePattern, useMask, useRovingIndex, useDrag };
4892
+
4893
+ //# debugId=5A5123543A37A21664756E2164756E21