quix-ui 1.2.1 → 1.2.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.
package/dist/index.js CHANGED
@@ -1,41 +1,2401 @@
1
- import { jsx } from 'react/jsx-runtime';
2
-
3
- function ViewContainer(props) {
4
- const { display, isScrollable, direction, alignItems, justifyContent, width, height, backgroundColor, paddingX, paddingY, textColor, className, rounded } = props;
5
- return jsx("div", { className: className, style: {
6
- display: display || 'block',
7
- overflowY: isScrollable ? 'scroll' : 'hidden',
8
- flexDirection: direction || 'row',
9
- alignItems: alignItems || 'stretch',
10
- justifyContent: justifyContent || 'flex-start',
11
- width: width ? `${width}px` : 'auto',
12
- height: height ? `${height}px` : 'auto',
13
- backgroundColor: backgroundColor || 'transparent',
14
- paddingInline: paddingX ? `${paddingX}px` : undefined,
15
- paddingBlock: paddingY ? `${paddingY}px` : undefined,
16
- color: textColor || 'inherit',
17
- borderTopLeftRadius: typeof rounded === 'number' ? rounded : rounded?.topLeft ?? 4,
18
- borderTopRightRadius: typeof rounded === 'number' ? rounded : rounded?.topRight ?? 4,
19
- borderBottomLeftRadius: typeof rounded === 'number' ? rounded : rounded?.bottomLeft ?? 4,
20
- borderBottomRightRadius: typeof rounded === 'number' ? rounded : rounded?.bottomRight ?? 4,
21
- }, children: props.children });
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import * as React3 from 'react';
3
+ import { useRef, useState } from 'react';
4
+
5
+ function _arrayLikeToArray(r, a) {
6
+ (null == a || a > r.length) && (a = r.length);
7
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
8
+ return n;
9
+ }
10
+ function _arrayWithHoles(r) {
11
+ if (Array.isArray(r)) return r;
12
+ }
13
+ function _defineProperty(e, r, t) {
14
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
15
+ value: t,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ }) : e[r] = t, e;
20
+ }
21
+ function _iterableToArrayLimit(r, l) {
22
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
23
+ if (null != t) {
24
+ var e,
25
+ n,
26
+ i,
27
+ u,
28
+ a = [],
29
+ f = true,
30
+ o = false;
31
+ try {
32
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
33
+ } catch (r) {
34
+ o = true, n = r;
35
+ } finally {
36
+ try {
37
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
38
+ } finally {
39
+ if (o) throw n;
40
+ }
41
+ }
42
+ return a;
43
+ }
44
+ }
45
+ function _nonIterableRest() {
46
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
47
+ }
48
+ function ownKeys(e, r) {
49
+ var t = Object.keys(e);
50
+ if (Object.getOwnPropertySymbols) {
51
+ var o = Object.getOwnPropertySymbols(e);
52
+ r && (o = o.filter(function (r) {
53
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
54
+ })), t.push.apply(t, o);
55
+ }
56
+ return t;
57
+ }
58
+ function _objectSpread2(e) {
59
+ for (var r = 1; r < arguments.length; r++) {
60
+ var t = null != arguments[r] ? arguments[r] : {};
61
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
62
+ _defineProperty(e, r, t[r]);
63
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
64
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
65
+ });
66
+ }
67
+ return e;
68
+ }
69
+ function _slicedToArray(r, e) {
70
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
71
+ }
72
+ function _toPrimitive(t, r) {
73
+ if ("object" != typeof t || !t) return t;
74
+ var e = t[Symbol.toPrimitive];
75
+ if (void 0 !== e) {
76
+ var i = e.call(t, r);
77
+ if ("object" != typeof i) return i;
78
+ throw new TypeError("@@toPrimitive must return a primitive value.");
79
+ }
80
+ return ("string" === r ? String : Number)(t);
81
+ }
82
+ function _toPropertyKey(t) {
83
+ var i = _toPrimitive(t, "string");
84
+ return "symbol" == typeof i ? i : i + "";
85
+ }
86
+ function _unsupportedIterableToArray(r, a) {
87
+ if (r) {
88
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
89
+ var t = {}.toString.call(r).slice(8, -1);
90
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
91
+ }
92
+ }
93
+
94
+ function styleInject(css, ref) {
95
+ if ( ref === void 0 ) ref = {};
96
+ var insertAt = ref.insertAt;
97
+
98
+ if (!css || typeof document === 'undefined') { return; }
99
+
100
+ var head = document.head || document.getElementsByTagName('head')[0];
101
+ var style = document.createElement('style');
102
+ style.type = 'text/css';
103
+
104
+ if (insertAt === 'top') {
105
+ if (head.firstChild) {
106
+ head.insertBefore(style, head.firstChild);
107
+ } else {
108
+ head.appendChild(style);
109
+ }
110
+ } else {
111
+ head.appendChild(style);
112
+ }
113
+
114
+ if (style.styleSheet) {
115
+ style.styleSheet.cssText = css;
116
+ } else {
117
+ style.appendChild(document.createTextNode(css));
118
+ }
119
+ }
120
+
121
+ var css_248z$1 = ":root{border-style:solid}.flex-center{align-items:center;display:flex;justify-content:center}.flex-start{align-items:start;display:flex;justify-content:start}.flex-end{align-items:end;display:flex;justify-content:end}.flex-between{align-items:center;display:flex;justify-content:space-between}";
122
+ styleInject(css_248z$1);
123
+
124
+ /**
125
+ * react-router v7.12.0
126
+ *
127
+ * Copyright (c) Remix Software Inc.
128
+ *
129
+ * This source code is licensed under the MIT license found in the
130
+ * LICENSE.md file in the root directory of this source tree.
131
+ *
132
+ * @license MIT
133
+ */
134
+ function invariant(value, message) {
135
+ if (value === false || value === null || typeof value === "undefined") {
136
+ throw new Error(message);
137
+ }
138
+ }
139
+ function warning(cond, message) {
140
+ if (!cond) {
141
+ if (typeof console !== "undefined") console.warn(message);
142
+ try {
143
+ throw new Error(message);
144
+ } catch (e) {
145
+ }
146
+ }
147
+ }
148
+ function createPath({
149
+ pathname = "/",
150
+ search = "",
151
+ hash = ""
152
+ }) {
153
+ if (search && search !== "?")
154
+ pathname += search.charAt(0) === "?" ? search : "?" + search;
155
+ if (hash && hash !== "#")
156
+ pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
157
+ return pathname;
158
+ }
159
+ function parsePath(path) {
160
+ let parsedPath = {};
161
+ if (path) {
162
+ let hashIndex = path.indexOf("#");
163
+ if (hashIndex >= 0) {
164
+ parsedPath.hash = path.substring(hashIndex);
165
+ path = path.substring(0, hashIndex);
166
+ }
167
+ let searchIndex = path.indexOf("?");
168
+ if (searchIndex >= 0) {
169
+ parsedPath.search = path.substring(searchIndex);
170
+ path = path.substring(0, searchIndex);
171
+ }
172
+ if (path) {
173
+ parsedPath.pathname = path;
174
+ }
175
+ }
176
+ return parsedPath;
177
+ }
178
+ function matchRoutes(routes, locationArg, basename = "/") {
179
+ return matchRoutesImpl(routes, locationArg, basename, false);
180
+ }
181
+ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
182
+ let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
183
+ let pathname = stripBasename(location.pathname || "/", basename);
184
+ if (pathname == null) {
185
+ return null;
186
+ }
187
+ let branches = flattenRoutes(routes);
188
+ rankRouteBranches(branches);
189
+ let matches = null;
190
+ for (let i = 0; matches == null && i < branches.length; ++i) {
191
+ let decoded = decodePath(pathname);
192
+ matches = matchRouteBranch(
193
+ branches[i],
194
+ decoded,
195
+ allowPartial
196
+ );
197
+ }
198
+ return matches;
199
+ }
200
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
201
+ let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
202
+ let meta = {
203
+ relativePath: relativePath === void 0 ? route.path || "" : relativePath,
204
+ caseSensitive: route.caseSensitive === true,
205
+ childrenIndex: index,
206
+ route
207
+ };
208
+ if (meta.relativePath.startsWith("/")) {
209
+ if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
210
+ return;
211
+ }
212
+ invariant(
213
+ meta.relativePath.startsWith(parentPath),
214
+ `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
215
+ );
216
+ meta.relativePath = meta.relativePath.slice(parentPath.length);
217
+ }
218
+ let path = joinPaths([parentPath, meta.relativePath]);
219
+ let routesMeta = parentsMeta.concat(meta);
220
+ if (route.children && route.children.length > 0) {
221
+ invariant(
222
+ // Our types know better, but runtime JS may not!
223
+ // @ts-expect-error
224
+ route.index !== true,
225
+ `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
226
+ );
227
+ flattenRoutes(
228
+ route.children,
229
+ branches,
230
+ routesMeta,
231
+ path,
232
+ hasParentOptionalSegments
233
+ );
234
+ }
235
+ if (route.path == null && !route.index) {
236
+ return;
237
+ }
238
+ branches.push({
239
+ path,
240
+ score: computeScore(path, route.index),
241
+ routesMeta
242
+ });
243
+ };
244
+ routes.forEach((route, index) => {
245
+ if (route.path === "" || !route.path?.includes("?")) {
246
+ flattenRoute(route, index);
247
+ } else {
248
+ for (let exploded of explodeOptionalSegments(route.path)) {
249
+ flattenRoute(route, index, true, exploded);
250
+ }
251
+ }
252
+ });
253
+ return branches;
254
+ }
255
+ function explodeOptionalSegments(path) {
256
+ let segments = path.split("/");
257
+ if (segments.length === 0) return [];
258
+ let [first, ...rest] = segments;
259
+ let isOptional = first.endsWith("?");
260
+ let required = first.replace(/\?$/, "");
261
+ if (rest.length === 0) {
262
+ return isOptional ? [required, ""] : [required];
263
+ }
264
+ let restExploded = explodeOptionalSegments(rest.join("/"));
265
+ let result = [];
266
+ result.push(
267
+ ...restExploded.map(
268
+ (subpath) => subpath === "" ? required : [required, subpath].join("/")
269
+ )
270
+ );
271
+ if (isOptional) {
272
+ result.push(...restExploded);
273
+ }
274
+ return result.map(
275
+ (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
276
+ );
277
+ }
278
+ function rankRouteBranches(branches) {
279
+ branches.sort(
280
+ (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
281
+ a.routesMeta.map((meta) => meta.childrenIndex),
282
+ b.routesMeta.map((meta) => meta.childrenIndex)
283
+ )
284
+ );
285
+ }
286
+ var paramRe = /^:[\w-]+$/;
287
+ var dynamicSegmentValue = 3;
288
+ var indexRouteValue = 2;
289
+ var emptySegmentValue = 1;
290
+ var staticSegmentValue = 10;
291
+ var splatPenalty = -2;
292
+ var isSplat = (s) => s === "*";
293
+ function computeScore(path, index) {
294
+ let segments = path.split("/");
295
+ let initialScore = segments.length;
296
+ if (segments.some(isSplat)) {
297
+ initialScore += splatPenalty;
298
+ }
299
+ if (index) {
300
+ initialScore += indexRouteValue;
301
+ }
302
+ return segments.filter((s) => !isSplat(s)).reduce(
303
+ (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
304
+ initialScore
305
+ );
306
+ }
307
+ function compareIndexes(a, b) {
308
+ let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
309
+ return siblings ? (
310
+ // If two routes are siblings, we should try to match the earlier sibling
311
+ // first. This allows people to have fine-grained control over the matching
312
+ // behavior by simply putting routes with identical paths in the order they
313
+ // want them tried.
314
+ a[a.length - 1] - b[b.length - 1]
315
+ ) : (
316
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
317
+ // so they sort equally.
318
+ 0
319
+ );
320
+ }
321
+ function matchRouteBranch(branch, pathname, allowPartial = false) {
322
+ let { routesMeta } = branch;
323
+ let matchedParams = {};
324
+ let matchedPathname = "/";
325
+ let matches = [];
326
+ for (let i = 0; i < routesMeta.length; ++i) {
327
+ let meta = routesMeta[i];
328
+ let end = i === routesMeta.length - 1;
329
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
330
+ let match = matchPath(
331
+ { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
332
+ remainingPathname
333
+ );
334
+ let route = meta.route;
335
+ if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
336
+ match = matchPath(
337
+ {
338
+ path: meta.relativePath,
339
+ caseSensitive: meta.caseSensitive,
340
+ end: false
341
+ },
342
+ remainingPathname
343
+ );
344
+ }
345
+ if (!match) {
346
+ return null;
347
+ }
348
+ Object.assign(matchedParams, match.params);
349
+ matches.push({
350
+ // TODO: Can this as be avoided?
351
+ params: matchedParams,
352
+ pathname: joinPaths([matchedPathname, match.pathname]),
353
+ pathnameBase: normalizePathname(
354
+ joinPaths([matchedPathname, match.pathnameBase])
355
+ ),
356
+ route
357
+ });
358
+ if (match.pathnameBase !== "/") {
359
+ matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
360
+ }
361
+ }
362
+ return matches;
363
+ }
364
+ function matchPath(pattern, pathname) {
365
+ if (typeof pattern === "string") {
366
+ pattern = { path: pattern, caseSensitive: false, end: true };
367
+ }
368
+ let [matcher, compiledParams] = compilePath(
369
+ pattern.path,
370
+ pattern.caseSensitive,
371
+ pattern.end
372
+ );
373
+ let match = pathname.match(matcher);
374
+ if (!match) return null;
375
+ let matchedPathname = match[0];
376
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
377
+ let captureGroups = match.slice(1);
378
+ let params = compiledParams.reduce(
379
+ (memo2, { paramName, isOptional }, index) => {
380
+ if (paramName === "*") {
381
+ let splatValue = captureGroups[index] || "";
382
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
383
+ }
384
+ const value = captureGroups[index];
385
+ if (isOptional && !value) {
386
+ memo2[paramName] = void 0;
387
+ } else {
388
+ memo2[paramName] = (value || "").replace(/%2F/g, "/");
389
+ }
390
+ return memo2;
391
+ },
392
+ {}
393
+ );
394
+ return {
395
+ params,
396
+ pathname: matchedPathname,
397
+ pathnameBase,
398
+ pattern
399
+ };
400
+ }
401
+ function compilePath(path, caseSensitive = false, end = true) {
402
+ warning(
403
+ path === "*" || !path.endsWith("*") || path.endsWith("/*"),
404
+ `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
405
+ );
406
+ let params = [];
407
+ let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
408
+ /\/:([\w-]+)(\?)?/g,
409
+ (_, paramName, isOptional) => {
410
+ params.push({ paramName, isOptional: isOptional != null });
411
+ return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
412
+ }
413
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
414
+ if (path.endsWith("*")) {
415
+ params.push({ paramName: "*" });
416
+ regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
417
+ } else if (end) {
418
+ regexpSource += "\\/*$";
419
+ } else if (path !== "" && path !== "/") {
420
+ regexpSource += "(?:(?=\\/|$))";
421
+ } else ;
422
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
423
+ return [matcher, params];
424
+ }
425
+ function decodePath(value) {
426
+ try {
427
+ return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
428
+ } catch (error) {
429
+ warning(
430
+ false,
431
+ `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
432
+ );
433
+ return value;
434
+ }
435
+ }
436
+ function stripBasename(pathname, basename) {
437
+ if (basename === "/") return pathname;
438
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
439
+ return null;
440
+ }
441
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
442
+ let nextChar = pathname.charAt(startIndex);
443
+ if (nextChar && nextChar !== "/") {
444
+ return null;
445
+ }
446
+ return pathname.slice(startIndex) || "/";
447
+ }
448
+ var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
449
+ var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
450
+ function resolvePath(to, fromPathname = "/") {
451
+ let {
452
+ pathname: toPathname,
453
+ search = "",
454
+ hash = ""
455
+ } = typeof to === "string" ? parsePath(to) : to;
456
+ let pathname;
457
+ if (toPathname) {
458
+ if (isAbsoluteUrl(toPathname)) {
459
+ pathname = toPathname;
460
+ } else {
461
+ if (toPathname.includes("//")) {
462
+ let oldPathname = toPathname;
463
+ toPathname = toPathname.replace(/\/\/+/g, "/");
464
+ warning(
465
+ false,
466
+ `Pathnames cannot have embedded double slashes - normalizing ${oldPathname} -> ${toPathname}`
467
+ );
468
+ }
469
+ if (toPathname.startsWith("/")) {
470
+ pathname = resolvePathname(toPathname.substring(1), "/");
471
+ } else {
472
+ pathname = resolvePathname(toPathname, fromPathname);
473
+ }
474
+ }
475
+ } else {
476
+ pathname = fromPathname;
477
+ }
478
+ return {
479
+ pathname,
480
+ search: normalizeSearch(search),
481
+ hash: normalizeHash(hash)
482
+ };
483
+ }
484
+ function resolvePathname(relativePath, fromPathname) {
485
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
486
+ let relativeSegments = relativePath.split("/");
487
+ relativeSegments.forEach((segment) => {
488
+ if (segment === "..") {
489
+ if (segments.length > 1) segments.pop();
490
+ } else if (segment !== ".") {
491
+ segments.push(segment);
492
+ }
493
+ });
494
+ return segments.length > 1 ? segments.join("/") : "/";
495
+ }
496
+ function getInvalidPathError(char, field, dest, path) {
497
+ return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
498
+ path
499
+ )}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
500
+ }
501
+ function getPathContributingMatches(matches) {
502
+ return matches.filter(
503
+ (match, index) => index === 0 || match.route.path && match.route.path.length > 0
504
+ );
505
+ }
506
+ function getResolveToMatches(matches) {
507
+ let pathMatches = getPathContributingMatches(matches);
508
+ return pathMatches.map(
509
+ (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
510
+ );
511
+ }
512
+ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
513
+ let to;
514
+ if (typeof toArg === "string") {
515
+ to = parsePath(toArg);
516
+ } else {
517
+ to = { ...toArg };
518
+ invariant(
519
+ !to.pathname || !to.pathname.includes("?"),
520
+ getInvalidPathError("?", "pathname", "search", to)
521
+ );
522
+ invariant(
523
+ !to.pathname || !to.pathname.includes("#"),
524
+ getInvalidPathError("#", "pathname", "hash", to)
525
+ );
526
+ invariant(
527
+ !to.search || !to.search.includes("#"),
528
+ getInvalidPathError("#", "search", "hash", to)
529
+ );
530
+ }
531
+ let isEmptyPath = toArg === "" || to.pathname === "";
532
+ let toPathname = isEmptyPath ? "/" : to.pathname;
533
+ let from;
534
+ if (toPathname == null) {
535
+ from = locationPathname;
536
+ } else {
537
+ let routePathnameIndex = routePathnames.length - 1;
538
+ if (!isPathRelative && toPathname.startsWith("..")) {
539
+ let toSegments = toPathname.split("/");
540
+ while (toSegments[0] === "..") {
541
+ toSegments.shift();
542
+ routePathnameIndex -= 1;
543
+ }
544
+ to.pathname = toSegments.join("/");
545
+ }
546
+ from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
547
+ }
548
+ let path = resolvePath(to, from);
549
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
550
+ let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
551
+ if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
552
+ path.pathname += "/";
553
+ }
554
+ return path;
555
+ }
556
+ var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
557
+ var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
558
+ var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
559
+ var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
560
+ var ErrorResponseImpl = class {
561
+ constructor(status, statusText, data2, internal = false) {
562
+ this.status = status;
563
+ this.statusText = statusText || "";
564
+ this.internal = internal;
565
+ if (data2 instanceof Error) {
566
+ this.data = data2.toString();
567
+ this.error = data2;
568
+ } else {
569
+ this.data = data2;
570
+ }
571
+ }
572
+ };
573
+ function isRouteErrorResponse(error) {
574
+ return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
575
+ }
576
+ function getRoutePattern(matches) {
577
+ return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
578
+ }
579
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
580
+ function parseToInfo(_to, basename) {
581
+ let to = _to;
582
+ if (typeof to !== "string" || !ABSOLUTE_URL_REGEX.test(to)) {
583
+ return {
584
+ absoluteURL: void 0,
585
+ isExternal: false,
586
+ to
587
+ };
588
+ }
589
+ let absoluteURL = to;
590
+ let isExternal = false;
591
+ if (isBrowser) {
592
+ try {
593
+ let currentUrl = new URL(window.location.href);
594
+ let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
595
+ let path = stripBasename(targetUrl.pathname, basename);
596
+ if (targetUrl.origin === currentUrl.origin && path != null) {
597
+ to = path + targetUrl.search + targetUrl.hash;
598
+ } else {
599
+ isExternal = true;
600
+ }
601
+ } catch (e) {
602
+ warning(
603
+ false,
604
+ `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
605
+ );
606
+ }
607
+ }
608
+ return {
609
+ absoluteURL,
610
+ isExternal,
611
+ to
612
+ };
613
+ }
614
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
615
+
616
+ // lib/router/router.ts
617
+ var validMutationMethodsArr = [
618
+ "POST",
619
+ "PUT",
620
+ "PATCH",
621
+ "DELETE"
622
+ ];
623
+ new Set(
624
+ validMutationMethodsArr
625
+ );
626
+ var validRequestMethodsArr = [
627
+ "GET",
628
+ ...validMutationMethodsArr
629
+ ];
630
+ new Set(validRequestMethodsArr);
631
+ var DataRouterContext = React3.createContext(null);
632
+ DataRouterContext.displayName = "DataRouter";
633
+ var DataRouterStateContext = React3.createContext(null);
634
+ DataRouterStateContext.displayName = "DataRouterState";
635
+ var RSCRouterContext = React3.createContext(false);
636
+ var ViewTransitionContext = React3.createContext({
637
+ isTransitioning: false
638
+ });
639
+ ViewTransitionContext.displayName = "ViewTransition";
640
+ var FetchersContext = React3.createContext(
641
+ /* @__PURE__ */ new Map()
642
+ );
643
+ FetchersContext.displayName = "Fetchers";
644
+ var AwaitContext = React3.createContext(null);
645
+ AwaitContext.displayName = "Await";
646
+ var NavigationContext = React3.createContext(
647
+ null
648
+ );
649
+ NavigationContext.displayName = "Navigation";
650
+ var LocationContext = React3.createContext(
651
+ null
652
+ );
653
+ LocationContext.displayName = "Location";
654
+ var RouteContext = React3.createContext({
655
+ outlet: null,
656
+ matches: [],
657
+ isDataRoute: false
658
+ });
659
+ RouteContext.displayName = "Route";
660
+ var RouteErrorContext = React3.createContext(null);
661
+ RouteErrorContext.displayName = "RouteError";
662
+
663
+ // lib/errors.ts
664
+ var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
665
+ var ERROR_DIGEST_REDIRECT = "REDIRECT";
666
+ var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
667
+ function decodeRedirectErrorDigest(digest) {
668
+ if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) {
669
+ try {
670
+ let parsed = JSON.parse(digest.slice(28));
671
+ if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string" && typeof parsed.location === "string" && typeof parsed.reloadDocument === "boolean" && typeof parsed.replace === "boolean") {
672
+ return parsed;
673
+ }
674
+ } catch {
675
+ }
676
+ }
677
+ }
678
+ function decodeRouteErrorResponseDigest(digest) {
679
+ if (digest.startsWith(
680
+ `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{`
681
+ )) {
682
+ try {
683
+ let parsed = JSON.parse(digest.slice(40));
684
+ if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string") {
685
+ return new ErrorResponseImpl(
686
+ parsed.status,
687
+ parsed.statusText,
688
+ parsed.data
689
+ );
690
+ }
691
+ } catch {
692
+ }
693
+ }
694
+ }
695
+
696
+ // lib/hooks.tsx
697
+ function useHref(to, { relative } = {}) {
698
+ invariant(
699
+ useInRouterContext(),
700
+ // TODO: This error is probably because they somehow have 2 versions of the
701
+ // router loaded. We can help them understand how to avoid that.
702
+ `useHref() may be used only in the context of a <Router> component.`
703
+ );
704
+ let { basename, navigator } = React3.useContext(NavigationContext);
705
+ let { hash, pathname, search } = useResolvedPath(to, { relative });
706
+ let joinedPathname = pathname;
707
+ if (basename !== "/") {
708
+ joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
709
+ }
710
+ return navigator.createHref({ pathname: joinedPathname, search, hash });
711
+ }
712
+ function useInRouterContext() {
713
+ return React3.useContext(LocationContext) != null;
714
+ }
715
+ function useLocation() {
716
+ invariant(
717
+ useInRouterContext(),
718
+ // TODO: This error is probably because they somehow have 2 versions of the
719
+ // router loaded. We can help them understand how to avoid that.
720
+ `useLocation() may be used only in the context of a <Router> component.`
721
+ );
722
+ return React3.useContext(LocationContext).location;
723
+ }
724
+ var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
725
+ function useIsomorphicLayoutEffect(cb) {
726
+ let isStatic = React3.useContext(NavigationContext).static;
727
+ if (!isStatic) {
728
+ React3.useLayoutEffect(cb);
729
+ }
730
+ }
731
+ function useNavigate() {
732
+ let { isDataRoute } = React3.useContext(RouteContext);
733
+ return isDataRoute ? useNavigateStable() : useNavigateUnstable();
734
+ }
735
+ function useNavigateUnstable() {
736
+ invariant(
737
+ useInRouterContext(),
738
+ // TODO: This error is probably because they somehow have 2 versions of the
739
+ // router loaded. We can help them understand how to avoid that.
740
+ `useNavigate() may be used only in the context of a <Router> component.`
741
+ );
742
+ let dataRouterContext = React3.useContext(DataRouterContext);
743
+ let { basename, navigator } = React3.useContext(NavigationContext);
744
+ let { matches } = React3.useContext(RouteContext);
745
+ let { pathname: locationPathname } = useLocation();
746
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
747
+ let activeRef = React3.useRef(false);
748
+ useIsomorphicLayoutEffect(() => {
749
+ activeRef.current = true;
750
+ });
751
+ let navigate = React3.useCallback(
752
+ (to, options = {}) => {
753
+ warning(activeRef.current, navigateEffectWarning);
754
+ if (!activeRef.current) return;
755
+ if (typeof to === "number") {
756
+ navigator.go(to);
757
+ return;
758
+ }
759
+ let path = resolveTo(
760
+ to,
761
+ JSON.parse(routePathnamesJson),
762
+ locationPathname,
763
+ options.relative === "path"
764
+ );
765
+ if (dataRouterContext == null && basename !== "/") {
766
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
767
+ }
768
+ (!!options.replace ? navigator.replace : navigator.push)(
769
+ path,
770
+ options.state,
771
+ options
772
+ );
773
+ },
774
+ [
775
+ basename,
776
+ navigator,
777
+ routePathnamesJson,
778
+ locationPathname,
779
+ dataRouterContext
780
+ ]
781
+ );
782
+ return navigate;
783
+ }
784
+ React3.createContext(null);
785
+ function useResolvedPath(to, { relative } = {}) {
786
+ let { matches } = React3.useContext(RouteContext);
787
+ let { pathname: locationPathname } = useLocation();
788
+ let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
789
+ return React3.useMemo(
790
+ () => resolveTo(
791
+ to,
792
+ JSON.parse(routePathnamesJson),
793
+ locationPathname,
794
+ relative === "path"
795
+ ),
796
+ [to, routePathnamesJson, locationPathname, relative]
797
+ );
798
+ }
799
+ function useRoutesImpl(routes, locationArg, dataRouterState, onError, future) {
800
+ invariant(
801
+ useInRouterContext(),
802
+ // TODO: This error is probably because they somehow have 2 versions of the
803
+ // router loaded. We can help them understand how to avoid that.
804
+ `useRoutes() may be used only in the context of a <Router> component.`
805
+ );
806
+ let { navigator } = React3.useContext(NavigationContext);
807
+ let { matches: parentMatches } = React3.useContext(RouteContext);
808
+ let routeMatch = parentMatches[parentMatches.length - 1];
809
+ let parentParams = routeMatch ? routeMatch.params : {};
810
+ let parentPathname = routeMatch ? routeMatch.pathname : "/";
811
+ let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
812
+ let parentRoute = routeMatch && routeMatch.route;
813
+ {
814
+ let parentPath = parentRoute && parentRoute.path || "";
815
+ warningOnce(
816
+ parentPathname,
817
+ !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
818
+ `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
819
+
820
+ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
821
+ );
822
+ }
823
+ let locationFromContext = useLocation();
824
+ let location;
825
+ {
826
+ location = locationFromContext;
827
+ }
828
+ let pathname = location.pathname || "/";
829
+ let remainingPathname = pathname;
830
+ if (parentPathnameBase !== "/") {
831
+ let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
832
+ let segments = pathname.replace(/^\//, "").split("/");
833
+ remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
834
+ }
835
+ let matches = matchRoutes(routes, { pathname: remainingPathname });
836
+ {
837
+ warning(
838
+ parentRoute || matches != null,
839
+ `No routes matched location "${location.pathname}${location.search}${location.hash}" `
840
+ );
841
+ warning(
842
+ matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
843
+ `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
844
+ );
845
+ }
846
+ let renderedMatches = _renderMatches(
847
+ matches && matches.map(
848
+ (match) => Object.assign({}, match, {
849
+ params: Object.assign({}, parentParams, match.params),
850
+ pathname: joinPaths([
851
+ parentPathnameBase,
852
+ // Re-encode pathnames that were decoded inside matchRoutes.
853
+ // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
854
+ // `new URL()` internally and we need to prevent it from treating
855
+ // them as separators
856
+ navigator.encodeLocation ? navigator.encodeLocation(
857
+ match.pathname.replace(/\?/g, "%3F").replace(/#/g, "%23")
858
+ ).pathname : match.pathname
859
+ ]),
860
+ pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
861
+ parentPathnameBase,
862
+ // Re-encode pathnames that were decoded inside matchRoutes
863
+ // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
864
+ // `new URL()` internally and we need to prevent it from treating
865
+ // them as separators
866
+ navigator.encodeLocation ? navigator.encodeLocation(
867
+ match.pathnameBase.replace(/\?/g, "%3F").replace(/#/g, "%23")
868
+ ).pathname : match.pathnameBase
869
+ ])
870
+ })
871
+ ),
872
+ parentMatches,
873
+ dataRouterState,
874
+ onError,
875
+ future
876
+ );
877
+ return renderedMatches;
878
+ }
879
+ function DefaultErrorComponent() {
880
+ let error = useRouteError();
881
+ let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
882
+ let stack = error instanceof Error ? error.stack : null;
883
+ let lightgrey = "rgba(200,200,200, 0.5)";
884
+ let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
885
+ let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
886
+ let devInfo = null;
887
+ {
888
+ console.error(
889
+ "Error handled by React Router default ErrorBoundary:",
890
+ error
891
+ );
892
+ devInfo = /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React3.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React3.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React3.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
893
+ }
894
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React3.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React3.createElement("pre", { style: preStyles }, stack) : null, devInfo);
895
+ }
896
+ var defaultErrorElement = /* @__PURE__ */ React3.createElement(DefaultErrorComponent, null);
897
+ var RenderErrorBoundary = class extends React3.Component {
898
+ constructor(props) {
899
+ super(props);
900
+ this.state = {
901
+ location: props.location,
902
+ revalidation: props.revalidation,
903
+ error: props.error
904
+ };
905
+ }
906
+ static getDerivedStateFromError(error) {
907
+ return { error };
908
+ }
909
+ static getDerivedStateFromProps(props, state) {
910
+ if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
911
+ return {
912
+ error: props.error,
913
+ location: props.location,
914
+ revalidation: props.revalidation
915
+ };
916
+ }
917
+ return {
918
+ error: props.error !== void 0 ? props.error : state.error,
919
+ location: state.location,
920
+ revalidation: props.revalidation || state.revalidation
921
+ };
922
+ }
923
+ componentDidCatch(error, errorInfo) {
924
+ if (this.props.onError) {
925
+ this.props.onError(error, errorInfo);
926
+ } else {
927
+ console.error(
928
+ "React Router caught the following error during render",
929
+ error
930
+ );
931
+ }
932
+ }
933
+ render() {
934
+ let error = this.state.error;
935
+ if (this.context && typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
936
+ const decoded = decodeRouteErrorResponseDigest(error.digest);
937
+ if (decoded) error = decoded;
938
+ }
939
+ let result = error !== void 0 ? /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React3.createElement(
940
+ RouteErrorContext.Provider,
941
+ {
942
+ value: error,
943
+ children: this.props.component
944
+ }
945
+ )) : this.props.children;
946
+ if (this.context) {
947
+ return /* @__PURE__ */ React3.createElement(RSCErrorHandler, { error }, result);
948
+ }
949
+ return result;
950
+ }
951
+ };
952
+ RenderErrorBoundary.contextType = RSCRouterContext;
953
+ var errorRedirectHandledMap = /* @__PURE__ */ new WeakMap();
954
+ function RSCErrorHandler({
955
+ children,
956
+ error
957
+ }) {
958
+ let { basename } = React3.useContext(NavigationContext);
959
+ if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
960
+ let redirect2 = decodeRedirectErrorDigest(error.digest);
961
+ if (redirect2) {
962
+ let existingRedirect = errorRedirectHandledMap.get(error);
963
+ if (existingRedirect) throw existingRedirect;
964
+ let parsed = parseToInfo(redirect2.location, basename);
965
+ if (isBrowser && !errorRedirectHandledMap.get(error)) {
966
+ if (parsed.isExternal || redirect2.reloadDocument) {
967
+ window.location.href = parsed.absoluteURL || parsed.to;
968
+ } else {
969
+ const redirectPromise = Promise.resolve().then(
970
+ () => window.__reactRouterDataRouter.navigate(parsed.to, {
971
+ replace: redirect2.replace
972
+ })
973
+ );
974
+ errorRedirectHandledMap.set(error, redirectPromise);
975
+ throw redirectPromise;
976
+ }
977
+ }
978
+ return /* @__PURE__ */ React3.createElement(
979
+ "meta",
980
+ {
981
+ httpEquiv: "refresh",
982
+ content: `0;url=${parsed.absoluteURL || parsed.to}`
983
+ }
984
+ );
985
+ }
986
+ }
987
+ return children;
988
+ }
989
+ function RenderedRoute({ routeContext, match, children }) {
990
+ let dataRouterContext = React3.useContext(DataRouterContext);
991
+ if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
992
+ dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
993
+ }
994
+ return /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: routeContext }, children);
995
+ }
996
+ function _renderMatches(matches, parentMatches = [], dataRouterState = null, onErrorHandler = null, future = null) {
997
+ if (matches == null) {
998
+ if (!dataRouterState) {
999
+ return null;
1000
+ }
1001
+ if (dataRouterState.errors) {
1002
+ matches = dataRouterState.matches;
1003
+ } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
1004
+ matches = dataRouterState.matches;
1005
+ } else {
1006
+ return null;
1007
+ }
1008
+ }
1009
+ let renderedMatches = matches;
1010
+ let errors = dataRouterState?.errors;
1011
+ if (errors != null) {
1012
+ let errorIndex = renderedMatches.findIndex(
1013
+ (m) => m.route.id && errors?.[m.route.id] !== void 0
1014
+ );
1015
+ invariant(
1016
+ errorIndex >= 0,
1017
+ `Could not find a matching route for errors on route IDs: ${Object.keys(
1018
+ errors
1019
+ ).join(",")}`
1020
+ );
1021
+ renderedMatches = renderedMatches.slice(
1022
+ 0,
1023
+ Math.min(renderedMatches.length, errorIndex + 1)
1024
+ );
1025
+ }
1026
+ let renderFallback = false;
1027
+ let fallbackIndex = -1;
1028
+ if (dataRouterState) {
1029
+ for (let i = 0; i < renderedMatches.length; i++) {
1030
+ let match = renderedMatches[i];
1031
+ if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
1032
+ fallbackIndex = i;
1033
+ }
1034
+ if (match.route.id) {
1035
+ let { loaderData, errors: errors2 } = dataRouterState;
1036
+ let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
1037
+ if (match.route.lazy || needsToRunLoader) {
1038
+ renderFallback = true;
1039
+ if (fallbackIndex >= 0) {
1040
+ renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
1041
+ } else {
1042
+ renderedMatches = [renderedMatches[0]];
1043
+ }
1044
+ break;
1045
+ }
1046
+ }
1047
+ }
1048
+ }
1049
+ let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
1050
+ onErrorHandler(error, {
1051
+ location: dataRouterState.location,
1052
+ params: dataRouterState.matches?.[0]?.params ?? {},
1053
+ unstable_pattern: getRoutePattern(dataRouterState.matches),
1054
+ errorInfo
1055
+ });
1056
+ } : void 0;
1057
+ return renderedMatches.reduceRight(
1058
+ (outlet, match, index) => {
1059
+ let error;
1060
+ let shouldRenderHydrateFallback = false;
1061
+ let errorElement = null;
1062
+ let hydrateFallbackElement = null;
1063
+ if (dataRouterState) {
1064
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
1065
+ errorElement = match.route.errorElement || defaultErrorElement;
1066
+ if (renderFallback) {
1067
+ if (fallbackIndex < 0 && index === 0) {
1068
+ warningOnce(
1069
+ "route-fallback",
1070
+ false,
1071
+ "No `HydrateFallback` element provided to render during initial hydration"
1072
+ );
1073
+ shouldRenderHydrateFallback = true;
1074
+ hydrateFallbackElement = null;
1075
+ } else if (fallbackIndex === index) {
1076
+ shouldRenderHydrateFallback = true;
1077
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
1078
+ }
1079
+ }
1080
+ }
1081
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
1082
+ let getChildren = () => {
1083
+ let children;
1084
+ if (error) {
1085
+ children = errorElement;
1086
+ } else if (shouldRenderHydrateFallback) {
1087
+ children = hydrateFallbackElement;
1088
+ } else if (match.route.Component) {
1089
+ children = /* @__PURE__ */ React3.createElement(match.route.Component, null);
1090
+ } else if (match.route.element) {
1091
+ children = match.route.element;
1092
+ } else {
1093
+ children = outlet;
1094
+ }
1095
+ return /* @__PURE__ */ React3.createElement(
1096
+ RenderedRoute,
1097
+ {
1098
+ match,
1099
+ routeContext: {
1100
+ outlet,
1101
+ matches: matches2,
1102
+ isDataRoute: dataRouterState != null
1103
+ },
1104
+ children
1105
+ }
1106
+ );
1107
+ };
1108
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
1109
+ RenderErrorBoundary,
1110
+ {
1111
+ location: dataRouterState.location,
1112
+ revalidation: dataRouterState.revalidation,
1113
+ component: errorElement,
1114
+ error,
1115
+ children: getChildren(),
1116
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true },
1117
+ onError
1118
+ }
1119
+ ) : getChildren();
1120
+ },
1121
+ null
1122
+ );
1123
+ }
1124
+ function getDataRouterConsoleError(hookName) {
1125
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1126
+ }
1127
+ function useDataRouterContext(hookName) {
1128
+ let ctx = React3.useContext(DataRouterContext);
1129
+ invariant(ctx, getDataRouterConsoleError(hookName));
1130
+ return ctx;
1131
+ }
1132
+ function useDataRouterState(hookName) {
1133
+ let state = React3.useContext(DataRouterStateContext);
1134
+ invariant(state, getDataRouterConsoleError(hookName));
1135
+ return state;
1136
+ }
1137
+ function useRouteContext(hookName) {
1138
+ let route = React3.useContext(RouteContext);
1139
+ invariant(route, getDataRouterConsoleError(hookName));
1140
+ return route;
1141
+ }
1142
+ function useCurrentRouteId(hookName) {
1143
+ let route = useRouteContext(hookName);
1144
+ let thisRoute = route.matches[route.matches.length - 1];
1145
+ invariant(
1146
+ thisRoute.route.id,
1147
+ `${hookName} can only be used on routes that contain a unique "id"`
1148
+ );
1149
+ return thisRoute.route.id;
1150
+ }
1151
+ function useRouteId() {
1152
+ return useCurrentRouteId("useRouteId" /* UseRouteId */);
1153
+ }
1154
+ function useRouteError() {
1155
+ let error = React3.useContext(RouteErrorContext);
1156
+ let state = useDataRouterState("useRouteError" /* UseRouteError */);
1157
+ let routeId = useCurrentRouteId("useRouteError" /* UseRouteError */);
1158
+ if (error !== void 0) {
1159
+ return error;
1160
+ }
1161
+ return state.errors?.[routeId];
1162
+ }
1163
+ function useNavigateStable() {
1164
+ let { router } = useDataRouterContext("useNavigate" /* UseNavigateStable */);
1165
+ let id = useCurrentRouteId("useNavigate" /* UseNavigateStable */);
1166
+ let activeRef = React3.useRef(false);
1167
+ useIsomorphicLayoutEffect(() => {
1168
+ activeRef.current = true;
1169
+ });
1170
+ let navigate = React3.useCallback(
1171
+ async (to, options = {}) => {
1172
+ warning(activeRef.current, navigateEffectWarning);
1173
+ if (!activeRef.current) return;
1174
+ if (typeof to === "number") {
1175
+ await router.navigate(to);
1176
+ } else {
1177
+ await router.navigate(to, { fromRouteId: id, ...options });
1178
+ }
1179
+ },
1180
+ [router, id]
1181
+ );
1182
+ return navigate;
1183
+ }
1184
+ var alreadyWarned = {};
1185
+ function warningOnce(key, cond, message) {
1186
+ if (!cond && !alreadyWarned[key]) {
1187
+ alreadyWarned[key] = true;
1188
+ warning(false, message);
1189
+ }
1190
+ }
1191
+ React3.memo(DataRoutes);
1192
+ function DataRoutes({
1193
+ routes,
1194
+ future,
1195
+ state,
1196
+ onError
1197
+ }) {
1198
+ return useRoutesImpl(routes, void 0, state, onError, future);
1199
+ }
1200
+
1201
+ // lib/dom/dom.ts
1202
+ var defaultMethod = "get";
1203
+ var defaultEncType = "application/x-www-form-urlencoded";
1204
+ function isHtmlElement(object) {
1205
+ return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
1206
+ }
1207
+ function isButtonElement(object) {
1208
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
1209
+ }
1210
+ function isFormElement(object) {
1211
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
1212
+ }
1213
+ function isInputElement(object) {
1214
+ return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
1215
+ }
1216
+ function isModifiedEvent(event) {
1217
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
1218
+ }
1219
+ function shouldProcessLinkClick(event, target) {
1220
+ return event.button === 0 && // Ignore everything but left clicks
1221
+ (!target || target === "_self") && // Let browser handle "target=_blank" etc.
1222
+ !isModifiedEvent(event);
1223
+ }
1224
+ var _formDataSupportsSubmitter = null;
1225
+ function isFormDataSubmitterSupported() {
1226
+ if (_formDataSupportsSubmitter === null) {
1227
+ try {
1228
+ new FormData(
1229
+ document.createElement("form"),
1230
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
1231
+ 0
1232
+ );
1233
+ _formDataSupportsSubmitter = false;
1234
+ } catch (e) {
1235
+ _formDataSupportsSubmitter = true;
1236
+ }
1237
+ }
1238
+ return _formDataSupportsSubmitter;
1239
+ }
1240
+ var supportedFormEncTypes = /* @__PURE__ */ new Set([
1241
+ "application/x-www-form-urlencoded",
1242
+ "multipart/form-data",
1243
+ "text/plain"
1244
+ ]);
1245
+ function getFormEncType(encType) {
1246
+ if (encType != null && !supportedFormEncTypes.has(encType)) {
1247
+ warning(
1248
+ false,
1249
+ `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
1250
+ );
1251
+ return null;
1252
+ }
1253
+ return encType;
1254
+ }
1255
+ function getFormSubmissionInfo(target, basename) {
1256
+ let method;
1257
+ let action;
1258
+ let encType;
1259
+ let formData;
1260
+ let body;
1261
+ if (isFormElement(target)) {
1262
+ let attr = target.getAttribute("action");
1263
+ action = attr ? stripBasename(attr, basename) : null;
1264
+ method = target.getAttribute("method") || defaultMethod;
1265
+ encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
1266
+ formData = new FormData(target);
1267
+ } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
1268
+ let form = target.form;
1269
+ if (form == null) {
1270
+ throw new Error(
1271
+ `Cannot submit a <button> or <input type="submit"> without a <form>`
1272
+ );
1273
+ }
1274
+ let attr = target.getAttribute("formaction") || form.getAttribute("action");
1275
+ action = attr ? stripBasename(attr, basename) : null;
1276
+ method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
1277
+ encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
1278
+ formData = new FormData(form, target);
1279
+ if (!isFormDataSubmitterSupported()) {
1280
+ let { name, type, value } = target;
1281
+ if (type === "image") {
1282
+ let prefix = name ? `${name}.` : "";
1283
+ formData.append(`${prefix}x`, "0");
1284
+ formData.append(`${prefix}y`, "0");
1285
+ } else if (name) {
1286
+ formData.append(name, value);
1287
+ }
1288
+ }
1289
+ } else if (isHtmlElement(target)) {
1290
+ throw new Error(
1291
+ `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
1292
+ );
1293
+ } else {
1294
+ method = defaultMethod;
1295
+ action = null;
1296
+ encType = defaultEncType;
1297
+ body = target;
1298
+ }
1299
+ if (formData && encType === "text/plain") {
1300
+ body = formData;
1301
+ formData = void 0;
1302
+ }
1303
+ return { action, method: method.toLowerCase(), encType, formData, body };
1304
+ }
1305
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
1306
+
1307
+ // lib/dom/ssr/invariant.ts
1308
+ function invariant2(value, message) {
1309
+ if (value === false || value === null || typeof value === "undefined") {
1310
+ throw new Error(message);
1311
+ }
1312
+ }
1313
+ function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
1314
+ let url = typeof reqUrl === "string" ? new URL(
1315
+ reqUrl,
1316
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
1317
+ // don't assume window is available
1318
+ typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
1319
+ ) : reqUrl;
1320
+ if (trailingSlashAware) {
1321
+ if (url.pathname.endsWith("/")) {
1322
+ url.pathname = `${url.pathname}_.${extension}`;
1323
+ } else {
1324
+ url.pathname = `${url.pathname}.${extension}`;
1325
+ }
1326
+ } else {
1327
+ if (url.pathname === "/") {
1328
+ url.pathname = `_root.${extension}`;
1329
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
1330
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
1331
+ } else {
1332
+ url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
1333
+ }
1334
+ }
1335
+ return url;
1336
+ }
1337
+
1338
+ // lib/dom/ssr/routeModules.ts
1339
+ async function loadRouteModule(route, routeModulesCache) {
1340
+ if (route.id in routeModulesCache) {
1341
+ return routeModulesCache[route.id];
1342
+ }
1343
+ try {
1344
+ let routeModule = await import(
1345
+ /* @vite-ignore */
1346
+ /* webpackIgnore: true */
1347
+ route.module
1348
+ );
1349
+ routeModulesCache[route.id] = routeModule;
1350
+ return routeModule;
1351
+ } catch (error) {
1352
+ console.error(
1353
+ `Error loading route module \`${route.module}\`, reloading page...`
1354
+ );
1355
+ console.error(error);
1356
+ if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
1357
+ import.meta.hot) {
1358
+ throw error;
1359
+ }
1360
+ window.location.reload();
1361
+ return new Promise(() => {
1362
+ });
1363
+ }
1364
+ }
1365
+ function isHtmlLinkDescriptor(object) {
1366
+ if (object == null) {
1367
+ return false;
1368
+ }
1369
+ if (object.href == null) {
1370
+ return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
1371
+ }
1372
+ return typeof object.rel === "string" && typeof object.href === "string";
1373
+ }
1374
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
1375
+ let links = await Promise.all(
1376
+ matches.map(async (match) => {
1377
+ let route = manifest.routes[match.route.id];
1378
+ if (route) {
1379
+ let mod = await loadRouteModule(route, routeModules);
1380
+ return mod.links ? mod.links() : [];
1381
+ }
1382
+ return [];
1383
+ })
1384
+ );
1385
+ return dedupeLinkDescriptors(
1386
+ links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
1387
+ (link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
1388
+ )
1389
+ );
1390
+ }
1391
+ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
1392
+ let isNew = (match, index) => {
1393
+ if (!currentMatches[index]) return true;
1394
+ return match.route.id !== currentMatches[index].route.id;
1395
+ };
1396
+ let matchPathChanged = (match, index) => {
1397
+ return (
1398
+ // param change, /users/123 -> /users/456
1399
+ currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
1400
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
1401
+ currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
1402
+ );
1403
+ };
1404
+ if (mode === "assets") {
1405
+ return nextMatches.filter(
1406
+ (match, index) => isNew(match, index) || matchPathChanged(match, index)
1407
+ );
1408
+ }
1409
+ if (mode === "data") {
1410
+ return nextMatches.filter((match, index) => {
1411
+ let manifestRoute = manifest.routes[match.route.id];
1412
+ if (!manifestRoute || !manifestRoute.hasLoader) {
1413
+ return false;
1414
+ }
1415
+ if (isNew(match, index) || matchPathChanged(match, index)) {
1416
+ return true;
1417
+ }
1418
+ if (match.route.shouldRevalidate) {
1419
+ let routeChoice = match.route.shouldRevalidate({
1420
+ currentUrl: new URL(
1421
+ location.pathname + location.search + location.hash,
1422
+ window.origin
1423
+ ),
1424
+ currentParams: currentMatches[0]?.params || {},
1425
+ nextUrl: new URL(page, window.origin),
1426
+ nextParams: match.params,
1427
+ defaultShouldRevalidate: true
1428
+ });
1429
+ if (typeof routeChoice === "boolean") {
1430
+ return routeChoice;
1431
+ }
1432
+ }
1433
+ return true;
1434
+ });
1435
+ }
1436
+ return [];
1437
+ }
1438
+ function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
1439
+ return dedupeHrefs(
1440
+ matches.map((match) => {
1441
+ let route = manifest.routes[match.route.id];
1442
+ if (!route) return [];
1443
+ let hrefs = [route.module];
1444
+ if (route.clientActionModule) {
1445
+ hrefs = hrefs.concat(route.clientActionModule);
1446
+ }
1447
+ if (route.clientLoaderModule) {
1448
+ hrefs = hrefs.concat(route.clientLoaderModule);
1449
+ }
1450
+ if (includeHydrateFallback && route.hydrateFallbackModule) {
1451
+ hrefs = hrefs.concat(route.hydrateFallbackModule);
1452
+ }
1453
+ if (route.imports) {
1454
+ hrefs = hrefs.concat(route.imports);
1455
+ }
1456
+ return hrefs;
1457
+ }).flat(1)
1458
+ );
1459
+ }
1460
+ function dedupeHrefs(hrefs) {
1461
+ return [...new Set(hrefs)];
1462
+ }
1463
+ function sortKeys(obj) {
1464
+ let sorted = {};
1465
+ let keys = Object.keys(obj).sort();
1466
+ for (let key of keys) {
1467
+ sorted[key] = obj[key];
1468
+ }
1469
+ return sorted;
1470
+ }
1471
+ function dedupeLinkDescriptors(descriptors, preloads) {
1472
+ let set = /* @__PURE__ */ new Set();
1473
+ new Set(preloads);
1474
+ return descriptors.reduce((deduped, descriptor) => {
1475
+ let key = JSON.stringify(sortKeys(descriptor));
1476
+ if (!set.has(key)) {
1477
+ set.add(key);
1478
+ deduped.push({ key, link: descriptor });
1479
+ }
1480
+ return deduped;
1481
+ }, []);
1482
+ }
1483
+
1484
+ // lib/dom/ssr/components.tsx
1485
+ function useDataRouterContext2() {
1486
+ let context = React3.useContext(DataRouterContext);
1487
+ invariant2(
1488
+ context,
1489
+ "You must render this element inside a <DataRouterContext.Provider> element"
1490
+ );
1491
+ return context;
1492
+ }
1493
+ function useDataRouterStateContext() {
1494
+ let context = React3.useContext(DataRouterStateContext);
1495
+ invariant2(
1496
+ context,
1497
+ "You must render this element inside a <DataRouterStateContext.Provider> element"
1498
+ );
1499
+ return context;
1500
+ }
1501
+ var FrameworkContext = React3.createContext(void 0);
1502
+ FrameworkContext.displayName = "FrameworkContext";
1503
+ function useFrameworkContext() {
1504
+ let context = React3.useContext(FrameworkContext);
1505
+ invariant2(
1506
+ context,
1507
+ "You must render this element inside a <HydratedRouter> element"
1508
+ );
1509
+ return context;
1510
+ }
1511
+ function usePrefetchBehavior(prefetch, theirElementProps) {
1512
+ let frameworkContext = React3.useContext(FrameworkContext);
1513
+ let [maybePrefetch, setMaybePrefetch] = React3.useState(false);
1514
+ let [shouldPrefetch, setShouldPrefetch] = React3.useState(false);
1515
+ let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
1516
+ let ref = React3.useRef(null);
1517
+ React3.useEffect(() => {
1518
+ if (prefetch === "render") {
1519
+ setShouldPrefetch(true);
1520
+ }
1521
+ if (prefetch === "viewport") {
1522
+ let callback = (entries) => {
1523
+ entries.forEach((entry) => {
1524
+ setShouldPrefetch(entry.isIntersecting);
1525
+ });
1526
+ };
1527
+ let observer = new IntersectionObserver(callback, { threshold: 0.5 });
1528
+ if (ref.current) observer.observe(ref.current);
1529
+ return () => {
1530
+ observer.disconnect();
1531
+ };
1532
+ }
1533
+ }, [prefetch]);
1534
+ React3.useEffect(() => {
1535
+ if (maybePrefetch) {
1536
+ let id = setTimeout(() => {
1537
+ setShouldPrefetch(true);
1538
+ }, 100);
1539
+ return () => {
1540
+ clearTimeout(id);
1541
+ };
1542
+ }
1543
+ }, [maybePrefetch]);
1544
+ let setIntent = () => {
1545
+ setMaybePrefetch(true);
1546
+ };
1547
+ let cancelIntent = () => {
1548
+ setMaybePrefetch(false);
1549
+ setShouldPrefetch(false);
1550
+ };
1551
+ if (!frameworkContext) {
1552
+ return [false, ref, {}];
1553
+ }
1554
+ if (prefetch !== "intent") {
1555
+ return [shouldPrefetch, ref, {}];
1556
+ }
1557
+ return [
1558
+ shouldPrefetch,
1559
+ ref,
1560
+ {
1561
+ onFocus: composeEventHandlers(onFocus, setIntent),
1562
+ onBlur: composeEventHandlers(onBlur, cancelIntent),
1563
+ onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
1564
+ onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
1565
+ onTouchStart: composeEventHandlers(onTouchStart, setIntent)
1566
+ }
1567
+ ];
1568
+ }
1569
+ function composeEventHandlers(theirHandler, ourHandler) {
1570
+ return (event) => {
1571
+ theirHandler && theirHandler(event);
1572
+ if (!event.defaultPrevented) {
1573
+ ourHandler(event);
1574
+ }
1575
+ };
1576
+ }
1577
+ function PrefetchPageLinks({ page, ...linkProps }) {
1578
+ let { router } = useDataRouterContext2();
1579
+ let matches = React3.useMemo(
1580
+ () => matchRoutes(router.routes, page, router.basename),
1581
+ [router.routes, page, router.basename]
1582
+ );
1583
+ if (!matches) {
1584
+ return null;
1585
+ }
1586
+ return /* @__PURE__ */ React3.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
1587
+ }
1588
+ function useKeyedPrefetchLinks(matches) {
1589
+ let { manifest, routeModules } = useFrameworkContext();
1590
+ let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React3.useState([]);
1591
+ React3.useEffect(() => {
1592
+ let interrupted = false;
1593
+ void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
1594
+ (links) => {
1595
+ if (!interrupted) {
1596
+ setKeyedPrefetchLinks(links);
1597
+ }
1598
+ }
1599
+ );
1600
+ return () => {
1601
+ interrupted = true;
1602
+ };
1603
+ }, [matches, manifest, routeModules]);
1604
+ return keyedPrefetchLinks;
1605
+ }
1606
+ function PrefetchPageLinksImpl({
1607
+ page,
1608
+ matches: nextMatches,
1609
+ ...linkProps
1610
+ }) {
1611
+ let location = useLocation();
1612
+ let { future, manifest, routeModules } = useFrameworkContext();
1613
+ let { basename } = useDataRouterContext2();
1614
+ let { loaderData, matches } = useDataRouterStateContext();
1615
+ let newMatchesForData = React3.useMemo(
1616
+ () => getNewMatchesForLinks(
1617
+ page,
1618
+ nextMatches,
1619
+ matches,
1620
+ manifest,
1621
+ location,
1622
+ "data"
1623
+ ),
1624
+ [page, nextMatches, matches, manifest, location]
1625
+ );
1626
+ let newMatchesForAssets = React3.useMemo(
1627
+ () => getNewMatchesForLinks(
1628
+ page,
1629
+ nextMatches,
1630
+ matches,
1631
+ manifest,
1632
+ location,
1633
+ "assets"
1634
+ ),
1635
+ [page, nextMatches, matches, manifest, location]
1636
+ );
1637
+ let dataHrefs = React3.useMemo(() => {
1638
+ if (page === location.pathname + location.search + location.hash) {
1639
+ return [];
1640
+ }
1641
+ let routesParams = /* @__PURE__ */ new Set();
1642
+ let foundOptOutRoute = false;
1643
+ nextMatches.forEach((m) => {
1644
+ let manifestRoute = manifest.routes[m.route.id];
1645
+ if (!manifestRoute || !manifestRoute.hasLoader) {
1646
+ return;
1647
+ }
1648
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
1649
+ foundOptOutRoute = true;
1650
+ } else if (manifestRoute.hasClientLoader) {
1651
+ foundOptOutRoute = true;
1652
+ } else {
1653
+ routesParams.add(m.route.id);
1654
+ }
1655
+ });
1656
+ if (routesParams.size === 0) {
1657
+ return [];
1658
+ }
1659
+ let url = singleFetchUrl(
1660
+ page,
1661
+ basename,
1662
+ future.unstable_trailingSlashAwareDataRequests,
1663
+ "data"
1664
+ );
1665
+ if (foundOptOutRoute && routesParams.size > 0) {
1666
+ url.searchParams.set(
1667
+ "_routes",
1668
+ nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
1669
+ );
1670
+ }
1671
+ return [url.pathname + url.search];
1672
+ }, [
1673
+ basename,
1674
+ future.unstable_trailingSlashAwareDataRequests,
1675
+ loaderData,
1676
+ location,
1677
+ manifest,
1678
+ newMatchesForData,
1679
+ nextMatches,
1680
+ page,
1681
+ routeModules
1682
+ ]);
1683
+ let moduleHrefs = React3.useMemo(
1684
+ () => getModuleLinkHrefs(newMatchesForAssets, manifest),
1685
+ [newMatchesForAssets, manifest]
1686
+ );
1687
+ let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
1688
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React3.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React3.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
1689
+ // these don't spread `linkProps` because they are full link descriptors
1690
+ // already with their own props
1691
+ /* @__PURE__ */ React3.createElement("link", { key, nonce: linkProps.nonce, ...link })
1692
+ )));
1693
+ }
1694
+ function mergeRefs(...refs) {
1695
+ return (value) => {
1696
+ refs.forEach((ref) => {
1697
+ if (typeof ref === "function") {
1698
+ ref(value);
1699
+ } else if (ref != null) {
1700
+ ref.current = value;
1701
+ }
1702
+ });
1703
+ };
1704
+ }
1705
+ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
1706
+ try {
1707
+ if (isBrowser2) {
1708
+ window.__reactRouterVersion = // @ts-expect-error
1709
+ "7.12.0";
1710
+ }
1711
+ } catch (e) {
1712
+ }
1713
+ var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1714
+ var Link = React3.forwardRef(
1715
+ function LinkWithRef({
1716
+ onClick,
1717
+ discover = "render",
1718
+ prefetch = "none",
1719
+ relative,
1720
+ reloadDocument,
1721
+ replace: replace2,
1722
+ state,
1723
+ target,
1724
+ to,
1725
+ preventScrollReset,
1726
+ viewTransition,
1727
+ unstable_defaultShouldRevalidate,
1728
+ ...rest
1729
+ }, forwardedRef) {
1730
+ let { basename, unstable_useTransitions } = React3.useContext(NavigationContext);
1731
+ let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
1732
+ let parsed = parseToInfo(to, basename);
1733
+ to = parsed.to;
1734
+ let href = useHref(to, { relative });
1735
+ let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
1736
+ prefetch,
1737
+ rest
1738
+ );
1739
+ let internalOnClick = useLinkClickHandler(to, {
1740
+ replace: replace2,
1741
+ state,
1742
+ target,
1743
+ preventScrollReset,
1744
+ relative,
1745
+ viewTransition,
1746
+ unstable_defaultShouldRevalidate,
1747
+ unstable_useTransitions
1748
+ });
1749
+ function handleClick(event) {
1750
+ if (onClick) onClick(event);
1751
+ if (!event.defaultPrevented) {
1752
+ internalOnClick(event);
1753
+ }
1754
+ }
1755
+ let link = (
1756
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
1757
+ /* @__PURE__ */ React3.createElement(
1758
+ "a",
1759
+ {
1760
+ ...rest,
1761
+ ...prefetchHandlers,
1762
+ href: parsed.absoluteURL || href,
1763
+ onClick: parsed.isExternal || reloadDocument ? onClick : handleClick,
1764
+ ref: mergeRefs(forwardedRef, prefetchRef),
1765
+ target,
1766
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
1767
+ }
1768
+ )
1769
+ );
1770
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, link, /* @__PURE__ */ React3.createElement(PrefetchPageLinks, { page: href })) : link;
1771
+ }
1772
+ );
1773
+ Link.displayName = "Link";
1774
+ var NavLink = React3.forwardRef(
1775
+ function NavLinkWithRef({
1776
+ "aria-current": ariaCurrentProp = "page",
1777
+ caseSensitive = false,
1778
+ className: classNameProp = "",
1779
+ end = false,
1780
+ style: styleProp,
1781
+ to,
1782
+ viewTransition,
1783
+ children,
1784
+ ...rest
1785
+ }, ref) {
1786
+ let path = useResolvedPath(to, { relative: rest.relative });
1787
+ let location = useLocation();
1788
+ let routerState = React3.useContext(DataRouterStateContext);
1789
+ let { navigator, basename } = React3.useContext(NavigationContext);
1790
+ let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
1791
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1792
+ useViewTransitionState(path) && viewTransition === true;
1793
+ let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
1794
+ let locationPathname = location.pathname;
1795
+ let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
1796
+ if (!caseSensitive) {
1797
+ locationPathname = locationPathname.toLowerCase();
1798
+ nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
1799
+ toPathname = toPathname.toLowerCase();
1800
+ }
1801
+ if (nextLocationPathname && basename) {
1802
+ nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
1803
+ }
1804
+ const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
1805
+ let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
1806
+ let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
1807
+ let renderProps = {
1808
+ isActive,
1809
+ isPending,
1810
+ isTransitioning
1811
+ };
1812
+ let ariaCurrent = isActive ? ariaCurrentProp : void 0;
1813
+ let className;
1814
+ if (typeof classNameProp === "function") {
1815
+ className = classNameProp(renderProps);
1816
+ } else {
1817
+ className = [
1818
+ classNameProp,
1819
+ isActive ? "active" : null,
1820
+ isPending ? "pending" : null,
1821
+ isTransitioning ? "transitioning" : null
1822
+ ].filter(Boolean).join(" ");
1823
+ }
1824
+ let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
1825
+ return /* @__PURE__ */ React3.createElement(
1826
+ Link,
1827
+ {
1828
+ ...rest,
1829
+ "aria-current": ariaCurrent,
1830
+ className,
1831
+ ref,
1832
+ style,
1833
+ to,
1834
+ viewTransition
1835
+ },
1836
+ typeof children === "function" ? children(renderProps) : children
1837
+ );
1838
+ }
1839
+ );
1840
+ NavLink.displayName = "NavLink";
1841
+ var Form = React3.forwardRef(
1842
+ ({
1843
+ discover = "render",
1844
+ fetcherKey,
1845
+ navigate,
1846
+ reloadDocument,
1847
+ replace: replace2,
1848
+ state,
1849
+ method = defaultMethod,
1850
+ action,
1851
+ onSubmit,
1852
+ relative,
1853
+ preventScrollReset,
1854
+ viewTransition,
1855
+ unstable_defaultShouldRevalidate,
1856
+ ...props
1857
+ }, forwardedRef) => {
1858
+ let { unstable_useTransitions } = React3.useContext(NavigationContext);
1859
+ let submit = useSubmit();
1860
+ let formAction = useFormAction(action, { relative });
1861
+ let formMethod = method.toLowerCase() === "get" ? "get" : "post";
1862
+ let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
1863
+ let submitHandler = (event) => {
1864
+ onSubmit && onSubmit(event);
1865
+ if (event.defaultPrevented) return;
1866
+ event.preventDefault();
1867
+ let submitter = event.nativeEvent.submitter;
1868
+ let submitMethod = submitter?.getAttribute("formmethod") || method;
1869
+ let doSubmit = () => submit(submitter || event.currentTarget, {
1870
+ fetcherKey,
1871
+ method: submitMethod,
1872
+ navigate,
1873
+ replace: replace2,
1874
+ state,
1875
+ relative,
1876
+ preventScrollReset,
1877
+ viewTransition,
1878
+ unstable_defaultShouldRevalidate
1879
+ });
1880
+ if (unstable_useTransitions && navigate !== false) {
1881
+ React3.startTransition(() => doSubmit());
1882
+ } else {
1883
+ doSubmit();
1884
+ }
1885
+ };
1886
+ return /* @__PURE__ */ React3.createElement(
1887
+ "form",
1888
+ {
1889
+ ref: forwardedRef,
1890
+ method: formMethod,
1891
+ action: formAction,
1892
+ onSubmit: reloadDocument ? onSubmit : submitHandler,
1893
+ ...props,
1894
+ "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
1895
+ }
1896
+ );
1897
+ }
1898
+ );
1899
+ Form.displayName = "Form";
1900
+ function getDataRouterConsoleError2(hookName) {
1901
+ return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1902
+ }
1903
+ function useDataRouterContext3(hookName) {
1904
+ let ctx = React3.useContext(DataRouterContext);
1905
+ invariant(ctx, getDataRouterConsoleError2(hookName));
1906
+ return ctx;
1907
+ }
1908
+ function useLinkClickHandler(to, {
1909
+ target,
1910
+ replace: replaceProp,
1911
+ state,
1912
+ preventScrollReset,
1913
+ relative,
1914
+ viewTransition,
1915
+ unstable_defaultShouldRevalidate,
1916
+ unstable_useTransitions
1917
+ } = {}) {
1918
+ let navigate = useNavigate();
1919
+ let location = useLocation();
1920
+ let path = useResolvedPath(to, { relative });
1921
+ return React3.useCallback(
1922
+ (event) => {
1923
+ if (shouldProcessLinkClick(event, target)) {
1924
+ event.preventDefault();
1925
+ let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
1926
+ let doNavigate = () => navigate(to, {
1927
+ replace: replace2,
1928
+ state,
1929
+ preventScrollReset,
1930
+ relative,
1931
+ viewTransition,
1932
+ unstable_defaultShouldRevalidate
1933
+ });
1934
+ if (unstable_useTransitions) {
1935
+ React3.startTransition(() => doNavigate());
1936
+ } else {
1937
+ doNavigate();
1938
+ }
1939
+ }
1940
+ },
1941
+ [
1942
+ location,
1943
+ navigate,
1944
+ path,
1945
+ replaceProp,
1946
+ state,
1947
+ target,
1948
+ to,
1949
+ preventScrollReset,
1950
+ relative,
1951
+ viewTransition,
1952
+ unstable_defaultShouldRevalidate,
1953
+ unstable_useTransitions
1954
+ ]
1955
+ );
1956
+ }
1957
+ var fetcherId = 0;
1958
+ var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
1959
+ function useSubmit() {
1960
+ let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
1961
+ let { basename } = React3.useContext(NavigationContext);
1962
+ let currentRouteId = useRouteId();
1963
+ let routerFetch = router.fetch;
1964
+ let routerNavigate = router.navigate;
1965
+ return React3.useCallback(
1966
+ async (target, options = {}) => {
1967
+ let { action, method, encType, formData, body } = getFormSubmissionInfo(
1968
+ target,
1969
+ basename
1970
+ );
1971
+ if (options.navigate === false) {
1972
+ let key = options.fetcherKey || getUniqueFetcherId();
1973
+ await routerFetch(key, currentRouteId, options.action || action, {
1974
+ unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
1975
+ preventScrollReset: options.preventScrollReset,
1976
+ formData,
1977
+ body,
1978
+ formMethod: options.method || method,
1979
+ formEncType: options.encType || encType,
1980
+ flushSync: options.flushSync
1981
+ });
1982
+ } else {
1983
+ await routerNavigate(options.action || action, {
1984
+ unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
1985
+ preventScrollReset: options.preventScrollReset,
1986
+ formData,
1987
+ body,
1988
+ formMethod: options.method || method,
1989
+ formEncType: options.encType || encType,
1990
+ replace: options.replace,
1991
+ state: options.state,
1992
+ fromRouteId: currentRouteId,
1993
+ flushSync: options.flushSync,
1994
+ viewTransition: options.viewTransition
1995
+ });
1996
+ }
1997
+ },
1998
+ [routerFetch, routerNavigate, basename, currentRouteId]
1999
+ );
2000
+ }
2001
+ function useFormAction(action, { relative } = {}) {
2002
+ let { basename } = React3.useContext(NavigationContext);
2003
+ let routeContext = React3.useContext(RouteContext);
2004
+ invariant(routeContext, "useFormAction must be used inside a RouteContext");
2005
+ let [match] = routeContext.matches.slice(-1);
2006
+ let path = { ...useResolvedPath(action ? action : ".", { relative }) };
2007
+ let location = useLocation();
2008
+ if (action == null) {
2009
+ path.search = location.search;
2010
+ let params = new URLSearchParams(path.search);
2011
+ let indexValues = params.getAll("index");
2012
+ let hasNakedIndexParam = indexValues.some((v) => v === "");
2013
+ if (hasNakedIndexParam) {
2014
+ params.delete("index");
2015
+ indexValues.filter((v) => v).forEach((v) => params.append("index", v));
2016
+ let qs = params.toString();
2017
+ path.search = qs ? `?${qs}` : "";
2018
+ }
2019
+ }
2020
+ if ((!action || action === ".") && match.route.index) {
2021
+ path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
2022
+ }
2023
+ if (basename !== "/") {
2024
+ path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
2025
+ }
2026
+ return createPath(path);
2027
+ }
2028
+ function useViewTransitionState(to, { relative } = {}) {
2029
+ let vtContext = React3.useContext(ViewTransitionContext);
2030
+ invariant(
2031
+ vtContext != null,
2032
+ "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
2033
+ );
2034
+ let { basename } = useDataRouterContext3(
2035
+ "useViewTransitionState" /* useViewTransitionState */
2036
+ );
2037
+ let path = useResolvedPath(to, { relative });
2038
+ if (!vtContext.isTransitioning) {
2039
+ return false;
2040
+ }
2041
+ let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
2042
+ let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
2043
+ return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
2044
+ }
2045
+
2046
+ var css_248z = ".quix_side_menu{border-right:1px solid #333;height:88%;.sidemenu_bottom_section{align-items:center;display:flex;height:80%;justify-content:center;position:relative;width:100%;.items{bottom:20px;cursor:pointer;height:auto;position:absolute;width:100%}}}.quix_menu_item{align-items:center;border-radius:4px;display:flex;height:48px;justify-content:space-between;opacity:100%;width:90%}";
2047
+ styleInject(css_248z);
2048
+
2049
+ function Layout(props) {
2050
+ var _header$height, _parentEl$current, _parentEl$current2, _parentEl$current$cli, _parentEl$current3, _sideMenu$width;
2051
+ var backgroundColor = props.backgroundColor,
2052
+ layoutStyle = props.layoutStyle,
2053
+ className = props.className,
2054
+ sideMenu = props.sideMenu,
2055
+ children = props.children,
2056
+ header = props.header;
2057
+ var parentEl = useRef(null);
2058
+ return jsxs("section", {
2059
+ ref: parentEl,
2060
+ className: "".concat(className),
2061
+ style: _objectSpread2({
2062
+ backgroundColor: backgroundColor
2063
+ }, layoutStyle),
2064
+ children: [header && jsx("section", {
2065
+ style: _objectSpread2({
2066
+ height: header.height
2067
+ }, header.style)
2068
+ }), sideMenu && SideMenu({
2069
+ sideMenu: sideMenu,
2070
+ top: (_header$height = header === null || header === void 0 ? void 0 : header.height) !== null && _header$height !== void 0 ? _header$height : 80
2071
+ }), jsx("section", {
2072
+ style: {
2073
+ position: 'absolute',
2074
+ left: sideMenu === null || sideMenu === void 0 ? void 0 : sideMenu.width,
2075
+ top: header === null || header === void 0 ? void 0 : header.height,
2076
+ padding: 10,
2077
+ maxHeight: Number(parentEl === null || parentEl === void 0 || (_parentEl$current = parentEl.current) === null || _parentEl$current === void 0 ? void 0 : _parentEl$current.clientHeight) - (Number(header === null || header === void 0 ? void 0 : header.height) + 20),
2078
+ height: Number(parentEl === null || parentEl === void 0 || (_parentEl$current2 = parentEl.current) === null || _parentEl$current2 === void 0 ? void 0 : _parentEl$current2.clientHeight) - (Number(header === null || header === void 0 ? void 0 : header.height) + 20),
2079
+ overflow: 'scroll',
2080
+ width: ((_parentEl$current$cli = parentEl === null || parentEl === void 0 || (_parentEl$current3 = parentEl.current) === null || _parentEl$current3 === void 0 ? void 0 : _parentEl$current3.clientWidth) !== null && _parentEl$current$cli !== void 0 ? _parentEl$current$cli : 1280) - (Number((_sideMenu$width = sideMenu === null || sideMenu === void 0 ? void 0 : sideMenu.width) !== null && _sideMenu$width !== void 0 ? _sideMenu$width : 270) + 20)
2081
+ },
2082
+ children: children
2083
+ })]
2084
+ });
2085
+ }
2086
+ function SideMenu(props) {
2087
+ var _sideMenuStyle$left, _sideMenuStyle$bottom, _props$top;
2088
+ var _props$sideMenu = props.sideMenu,
2089
+ width = _props$sideMenu.width,
2090
+ sideMenuStyle = _props$sideMenu.sideMenuStyle,
2091
+ menuItems = _props$sideMenu.menuItems,
2092
+ ElementType = _props$sideMenu.ElementType,
2093
+ bottomSection = _props$sideMenu.bottomSection;
2094
+ var bottomNode = function bottomNode() {
2095
+ if (bottomSection) {
2096
+ return bottomSection.map(function (item) {
2097
+ return MenuItem(item);
2098
+ });
2099
+ }
2100
+ };
2101
+ return jsxs("aside", {
2102
+ className: " quix_side_menu ",
2103
+ style: _objectSpread2({
2104
+ position: 'absolute',
2105
+ left: (_sideMenuStyle$left = sideMenuStyle === null || sideMenuStyle === void 0 ? void 0 : sideMenuStyle.left) !== null && _sideMenuStyle$left !== void 0 ? _sideMenuStyle$left : 0,
2106
+ bottom: (_sideMenuStyle$bottom = sideMenuStyle === null || sideMenuStyle === void 0 ? void 0 : sideMenuStyle.bottom) !== null && _sideMenuStyle$bottom !== void 0 ? _sideMenuStyle$bottom : 0,
2107
+ width: width,
2108
+ // height,
2109
+ top: (_props$top = props === null || props === void 0 ? void 0 : props.top) !== null && _props$top !== void 0 ? _props$top : 80
2110
+ }, sideMenuStyle),
2111
+ children: [menuItems && menuItems.map(function (item) {
2112
+ return MenuItem(item, ElementType, item);
2113
+ }), jsx("div", {
2114
+ className: " sidemenu_bottom_section ",
2115
+ children: jsx("div", {
2116
+ className: " items ",
2117
+ children: bottomNode()
2118
+ })
2119
+ })]
2120
+ });
2121
+ }
2122
+ function MenuItem(item, ElementType, menuItemsDynamicStyle) {
2123
+ var _menuItemsDynamicStyl, _menuItemsDynamicStyl2, _menuItemsDynamicStyl3, _menuItemsDynamicStyl4, _menuItemsDynamicStyl5, _menuItemsDynamicStyl6;
2124
+ var _useState = useState(false),
2125
+ _useState2 = _slicedToArray(_useState, 2),
2126
+ isHover = _useState2[0],
2127
+ setIsHover = _useState2[1];
2128
+ var color = {
2129
+ bg: isHover ? (_menuItemsDynamicStyl = menuItemsDynamicStyle === null || menuItemsDynamicStyle === void 0 || (_menuItemsDynamicStyl2 = menuItemsDynamicStyle.activeColor) === null || _menuItemsDynamicStyl2 === void 0 ? void 0 : _menuItemsDynamicStyl2.background) !== null && _menuItemsDynamicStyl !== void 0 ? _menuItemsDynamicStyl : '#d4d4d4' : (_menuItemsDynamicStyl3 = menuItemsDynamicStyle === null || menuItemsDynamicStyle === void 0 ? void 0 : menuItemsDynamicStyle.backgroundColor) !== null && _menuItemsDynamicStyl3 !== void 0 ? _menuItemsDynamicStyl3 : '#d4d4d480',
2130
+ text: isHover ? (_menuItemsDynamicStyl4 = menuItemsDynamicStyle === null || menuItemsDynamicStyle === void 0 || (_menuItemsDynamicStyl5 = menuItemsDynamicStyle.activeColor) === null || _menuItemsDynamicStyl5 === void 0 ? void 0 : _menuItemsDynamicStyl5.text) !== null && _menuItemsDynamicStyl4 !== void 0 ? _menuItemsDynamicStyl4 : "#121212" : (_menuItemsDynamicStyl6 = menuItemsDynamicStyle === null || menuItemsDynamicStyle === void 0 ? void 0 : menuItemsDynamicStyle.textColor) !== null && _menuItemsDynamicStyl6 !== void 0 ? _menuItemsDynamicStyl6 : '#121314 '
2131
+ };
2132
+ function onHover() {
2133
+ if (!isHover) setIsHover(function (prev) {
2134
+ return !prev;
2135
+ });
2136
+ }
2137
+ function onLeave() {
2138
+ if (isHover) setIsHover(function (prev) {
2139
+ return !prev;
2140
+ });
2141
+ }
2142
+ var navigate = function navigate(route) {
2143
+ window.location.replace(route);
2144
+ };
2145
+ var Element = function Element(_ref) {
2146
+ var children = _ref.children;
2147
+ return ElementType === 'NavLink' ? jsx(NavLink, {
2148
+ style: {
2149
+ width: "100%"
2150
+ },
2151
+ to: item.route,
2152
+ children: children
2153
+ }, item.label) : ElementType === 'Link' ? jsx(Link, {
2154
+ style: {
2155
+ width: "100%"
2156
+ },
2157
+ to: item.route,
2158
+ children: children
2159
+ }, item.label) : ElementType === 'a' ? jsx("a", {
2160
+ style: {
2161
+ width: "100%",
2162
+ textDecoration: 'none'
2163
+ },
2164
+ href: item.route,
2165
+ children: children
2166
+ }, item.label) : jsx("div", {
2167
+ style: {
2168
+ width: "100%"
2169
+ },
2170
+ onClick: function onClick() {
2171
+ navigate(item.route);
2172
+ },
2173
+ children: children
2174
+ }, item.label);
2175
+ };
2176
+ return jsx(Element, {
2177
+ children: jsx("div", {
2178
+ style: {
2179
+ padding: 10,
2180
+ width: '100%'
2181
+ },
2182
+ children: jsxs("div", {
2183
+ onMouseEnter: onHover,
2184
+ onMouseLeave: onLeave,
2185
+ className: 'quix_menu_item ',
2186
+ style: {
2187
+ transition: '0.2s all',
2188
+ backgroundColor: color.bg,
2189
+ color: color.text
2190
+ // border: isHover ? '' : '1px solid #121212 '
2191
+ },
2192
+ children: [item.icon && item.icon.position === 'left' && item.icon.component, jsx("p", {
2193
+ className: " quix_menuItem_label ",
2194
+ style: {
2195
+ paddingInline: 10,
2196
+ paddingBlock: 8,
2197
+ color: color.text
2198
+ },
2199
+ children: item === null || item === void 0 ? void 0 : item.label
2200
+ }), item.icon && item.icon.position === 'right' && item.icon.component]
2201
+ })
2202
+ }, item.label)
2203
+ });
2204
+ }
2205
+
2206
+ function FlexView(props) {
2207
+ var _rounded$topLeft, _rounded$topRight, _rounded$bottomLeft, _rounded$bottomRight;
2208
+ var isScrollable = props.isScrollable,
2209
+ direction = props.direction,
2210
+ width = props.width,
2211
+ height = props.height,
2212
+ backgroundColor = props.backgroundColor,
2213
+ paddingX = props.paddingX,
2214
+ paddingY = props.paddingY,
2215
+ textColor = props.textColor,
2216
+ className = props.className,
2217
+ rounded = props.rounded,
2218
+ gap = props.gap,
2219
+ style = props.style,
2220
+ layout = props.layout,
2221
+ onClick = props.onClick,
2222
+ onRightClick = props.onRightClick,
2223
+ tooltip = props.tooltip;
2224
+ return jsxs("div", {
2225
+ onContextMenu: onRightClick,
2226
+ onClick: onClick,
2227
+ className: "".concat(className, " ").concat(layout, " quix_view "),
2228
+ style: _objectSpread2({
2229
+ overflowY: isScrollable ? 'scroll' : 'hidden',
2230
+ flexDirection: direction || 'row',
2231
+ width: width ? width : 'auto',
2232
+ height: height ? height : 'auto',
2233
+ backgroundColor: backgroundColor || 'transparent',
2234
+ paddingInline: paddingX ? "".concat(paddingX, "px") : undefined,
2235
+ paddingBlock: paddingY ? "".concat(paddingY, "px") : undefined,
2236
+ color: textColor || 'inherit',
2237
+ borderTopLeftRadius: typeof rounded === 'number' ? rounded : (_rounded$topLeft = rounded === null || rounded === void 0 ? void 0 : rounded.topLeft) !== null && _rounded$topLeft !== void 0 ? _rounded$topLeft : 4,
2238
+ borderTopRightRadius: typeof rounded === 'number' ? rounded : (_rounded$topRight = rounded === null || rounded === void 0 ? void 0 : rounded.topRight) !== null && _rounded$topRight !== void 0 ? _rounded$topRight : 4,
2239
+ borderBottomLeftRadius: typeof rounded === 'number' ? rounded : (_rounded$bottomLeft = rounded === null || rounded === void 0 ? void 0 : rounded.bottomLeft) !== null && _rounded$bottomLeft !== void 0 ? _rounded$bottomLeft : 4,
2240
+ borderBottomRightRadius: typeof rounded === 'number' ? rounded : (_rounded$bottomRight = rounded === null || rounded === void 0 ? void 0 : rounded.bottomRight) !== null && _rounded$bottomRight !== void 0 ? _rounded$bottomRight : 4,
2241
+ gap: gap,
2242
+ transition: '0.3s all',
2243
+ position: tooltip ? 'relative' : 'unset'
2244
+ }, style),
2245
+ children: [tooltip && jsx("div", {
2246
+ style: {
2247
+ position: 'absolute',
2248
+ width: '100px',
2249
+ height: '200px',
2250
+ padding: 2,
2251
+ top: tooltip.position === 'top' ? -(height !== null && height !== void 0 ? height : 100) + 10 : 0,
2252
+ bottom: tooltip.position === 'bottom' ? -(height !== null && height !== void 0 ? height : 100) + 10 : 0,
2253
+ left: tooltip.position === 'left' ? -(width !== null && width !== void 0 ? width : 100) - 10 : 0,
2254
+ right: tooltip.position === 'right' ? -(width !== null && width !== void 0 ? width : 100) + 10 : 0,
2255
+ backgroundColor: '#d4d4',
2256
+ zIndex: 10
2257
+ },
2258
+ className: "quix_tooltip",
2259
+ children: tooltip.component
2260
+ }), jsx(Layout, {
2261
+ layoutStyle: {
2262
+ width: '100%',
2263
+ height: '100%',
2264
+ position: 'relative',
2265
+ display: 'flex',
2266
+ justifyContent: 'flex-start',
2267
+ alignItems: 'flex-start',
2268
+ flexDirection: 'column',
2269
+ borderRadius: 10
2270
+ },
2271
+ backgroundColor: "#748873",
2272
+ header: {
2273
+ height: 80,
2274
+ style: {
2275
+ width: '100%'
2276
+ }
2277
+ },
2278
+ sideMenu: {
2279
+ menuItems: [{
2280
+ label: 'Home',
2281
+ route: '/',
2282
+ icon: {
2283
+ position: 'right',
2284
+ component: jsx("div", {
2285
+ style: {
2286
+ width: 24,
2287
+ height: 24,
2288
+ border: '1px solid #333333',
2289
+ marginInline: 10,
2290
+ borderRadius: 4
2291
+ }
2292
+ })
2293
+ }
2294
+ }, {
2295
+ label: 'Setting',
2296
+ route: '/setting',
2297
+ icon: {
2298
+ position: 'right',
2299
+ component: jsx("div", {
2300
+ style: {
2301
+ width: 24,
2302
+ height: 24,
2303
+ border: '1px solid #333333',
2304
+ marginInline: 10,
2305
+ borderRadius: 4
2306
+ }
2307
+ })
2308
+ }
2309
+ }],
2310
+ bottomSection: [{
2311
+ label: 'Logout',
2312
+ route: '#logout',
2313
+ backgroundColor: '#E5E0D880',
2314
+ textColor: '#121212',
2315
+ activeColor: {
2316
+ background: '#E5E0D8',
2317
+ text: '#121212'
2318
+ },
2319
+ icon: {
2320
+ position: 'right',
2321
+ component: jsx("div", {
2322
+ style: {
2323
+ width: 24,
2324
+ height: 24,
2325
+ border: '1px solid #333333',
2326
+ marginInline: 10,
2327
+ borderRadius: 4
2328
+ }
2329
+ })
2330
+ }
2331
+ }],
2332
+ width: 270,
2333
+ height: '90%',
2334
+ sideMenuStyle: {
2335
+ display: 'flex',
2336
+ justifyContent: 'flex-start',
2337
+ alignItems: 'flex-start',
2338
+ borderRight: '1px solid #121212',
2339
+ flexDirection: 'column'
2340
+ },
2341
+ ElementStyle: {
2342
+ height: 48,
2343
+ width: '100%',
2344
+ borderRadius: 8,
2345
+ display: 'flex',
2346
+ justifyContent: 'start',
2347
+ alignItems: 'center',
2348
+ gap: 8,
2349
+ cursor: 'pointer'
2350
+ },
2351
+ ElementType: 'div',
2352
+ menuItemsDynamicStyle: {
2353
+ backgroundColor: '#d4d4d480',
2354
+ textColor: '#121212',
2355
+ activeColor: {
2356
+ background: '#d4d4d4',
2357
+ text: '#121212'
2358
+ }
2359
+ }
2360
+ },
2361
+ children: jsx("div", {
2362
+ children: "Content"
2363
+ })
2364
+ })]
2365
+ });
22
2366
  }
23
2367
 
24
2368
  function Buttons(props) {
25
- const { onClick, width, height, label, paddingX, paddingY, backgroundColor, textColor, rounded, className } = props;
26
- return jsx("button", { className: className, style: {
27
- width: width ? `${width}px` : 'auto',
28
- height: height ? `${height}px` : 'auto',
29
- paddingInline: paddingX ?? 4,
30
- paddingBlock: paddingY ?? 4,
31
- backgroundColor: backgroundColor || 'transparent',
32
- color: textColor || 'inherit',
33
- borderTopLeftRadius: typeof rounded === 'number' ? rounded : rounded?.topLeft ?? 4,
34
- borderTopRightRadius: typeof rounded === 'number' ? rounded : rounded?.topRight ?? 4,
35
- borderBottomLeftRadius: typeof rounded === 'number' ? rounded : rounded?.bottomLeft ?? 4,
36
- borderBottomRightRadius: typeof rounded === 'number' ? rounded : rounded?.bottomRight ?? 4,
37
- cursor: 'pointer',
38
- }, onClick: onClick, children: label });
39
- }
40
-
41
- export { Buttons, ViewContainer };
2369
+ var _rounded$topLeft, _rounded$topRight, _rounded$bottomLeft, _rounded$bottomRight;
2370
+ var onClick = props.onClick,
2371
+ width = props.width,
2372
+ height = props.height,
2373
+ label = props.label,
2374
+ paddingX = props.paddingX,
2375
+ paddingY = props.paddingY,
2376
+ backgroundColor = props.backgroundColor,
2377
+ textColor = props.textColor,
2378
+ rounded = props.rounded,
2379
+ className = props.className,
2380
+ style = props.style;
2381
+ return jsx("button", {
2382
+ className: className,
2383
+ style: _objectSpread2({
2384
+ width: width ? "".concat(width, "px") : 'auto',
2385
+ height: height ? "".concat(height, "px") : 'auto',
2386
+ paddingInline: paddingX !== null && paddingX !== void 0 ? paddingX : 4,
2387
+ paddingBlock: paddingY !== null && paddingY !== void 0 ? paddingY : 4,
2388
+ backgroundColor: backgroundColor || 'transparent',
2389
+ color: textColor || 'inherit',
2390
+ borderTopLeftRadius: typeof rounded === 'number' ? rounded : (_rounded$topLeft = rounded === null || rounded === void 0 ? void 0 : rounded.topLeft) !== null && _rounded$topLeft !== void 0 ? _rounded$topLeft : 4,
2391
+ borderTopRightRadius: typeof rounded === 'number' ? rounded : (_rounded$topRight = rounded === null || rounded === void 0 ? void 0 : rounded.topRight) !== null && _rounded$topRight !== void 0 ? _rounded$topRight : 4,
2392
+ borderBottomLeftRadius: typeof rounded === 'number' ? rounded : (_rounded$bottomLeft = rounded === null || rounded === void 0 ? void 0 : rounded.bottomLeft) !== null && _rounded$bottomLeft !== void 0 ? _rounded$bottomLeft : 4,
2393
+ borderBottomRightRadius: typeof rounded === 'number' ? rounded : (_rounded$bottomRight = rounded === null || rounded === void 0 ? void 0 : rounded.bottomRight) !== null && _rounded$bottomRight !== void 0 ? _rounded$bottomRight : 4,
2394
+ cursor: 'pointer'
2395
+ }, style),
2396
+ onClick: onClick,
2397
+ children: label
2398
+ });
2399
+ }
2400
+
2401
+ export { Buttons, FlexView };