create-bluecopa-react-app 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/bin/create-bluecopa-react-app.js +1 -1
  2. package/package.json +1 -1
  3. package/templates/latest/.dockerignore +5 -1
  4. package/templates/latest/Agent.md +577 -0
  5. package/templates/latest/Dockerfile +2 -2
  6. package/templates/latest/app/app.tsx +3 -1
  7. package/templates/latest/app/components/app-sidebar.tsx +14 -16
  8. package/templates/latest/app/components/nav-main.tsx +6 -22
  9. package/templates/latest/app/data/mock-payments.json +122 -0
  10. package/templates/latest/app/data/mock-transactions.json +128 -0
  11. package/templates/latest/app/routes/comments.tsx +552 -0
  12. package/templates/latest/app/routes/home.tsx +1 -1
  13. package/templates/latest/app/routes/payments.tsx +342 -0
  14. package/templates/latest/app/routes/websocket.tsx +449 -0
  15. package/templates/latest/app/routes.tsx +6 -0
  16. package/templates/latest/dist/assets/{__federation_expose_App-C8_sl1dD.js → __federation_expose_App-B2IoFaIA.js} +15 -4
  17. package/templates/latest/dist/assets/client-LFBsfOjG.js +2775 -0
  18. package/templates/latest/dist/assets/{home-DhyEFlEc.js → home-BBY02MnI.js} +87 -59
  19. package/templates/latest/dist/assets/{index-DkyIpbj3.js → index-CNNS7Foy.js} +4 -3
  20. package/templates/latest/dist/assets/{client-Hh38T4k9.js → index-D5og7-RT-BA7DwZw1.js} +46 -2789
  21. package/templates/latest/dist/assets/remoteEntry.css +4 -4
  22. package/templates/latest/dist/assets/remoteEntry.js +1 -1
  23. package/templates/latest/dist/index.html +3 -2
  24. package/templates/latest/package-lock.json +11 -11
  25. package/templates/latest/package.json +1 -1
  26. package/templates/latest/public/favicon.ico +0 -0
  27. package/templates/latest/public/avatars/shadcn.svg +0 -6
  28. /package/templates/latest/app/{dashboard → data}/data.json +0 -0
@@ -1,2737 +1,55 @@
1
- System.register(['./__federation_fn_import-CzfA7kmP.js', './index-BzNimew1.js', './index-DMFtQdNS.js'], (function (exports, module) {
1
+ System.register(['./index-BzNimew1.js', './__federation_fn_import-CzfA7kmP.js'], (function (exports, module) {
2
2
  'use strict';
3
- var importShared, requireReact, getDefaultExportFromCjs, requireReactDom;
3
+ var requireReact, importShared;
4
4
  return {
5
5
  setters: [module => {
6
- importShared = module.importShared;
7
- }, module => {
8
- requireReact = module.r;
9
- getDefaultExportFromCjs = module.g;
10
- }, module => {
11
- requireReactDom = module.r;
12
- }],
13
- execute: (async function () {
14
-
15
- exports({
16
- A: App,
17
- B: BrowserRouter,
18
- M: MemoryRouter,
19
- n: nS
20
- });
21
-
22
- var jsxRuntime = {exports: {}};
23
-
24
- var reactJsxRuntime_production_min = {};
25
-
26
- /**
27
- * @license React
28
- * react-jsx-runtime.production.min.js
29
- *
30
- * Copyright (c) Facebook, Inc. and its affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */
35
-
36
- var hasRequiredReactJsxRuntime_production_min;
37
-
38
- function requireReactJsxRuntime_production_min () {
39
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
40
- hasRequiredReactJsxRuntime_production_min = 1;
41
- var f=requireReact(),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
42
- function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
43
- return reactJsxRuntime_production_min;
44
- }
45
-
46
- var hasRequiredJsxRuntime;
47
-
48
- function requireJsxRuntime () {
49
- if (hasRequiredJsxRuntime) return jsxRuntime.exports;
50
- hasRequiredJsxRuntime = 1;
51
- {
52
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
53
- }
54
- return jsxRuntime.exports;
55
- }
56
-
57
- var jsxRuntimeExports = exports("j", requireJsxRuntime());
58
-
59
- var PopStateEventType = "popstate";
60
- function createMemoryHistory(options = {}) {
61
- let { initialEntries = ["/"], initialIndex, v5Compat = false } = options;
62
- let entries;
63
- entries = initialEntries.map(
64
- (entry, index2) => createMemoryLocation(
65
- entry,
66
- typeof entry === "string" ? null : entry.state,
67
- index2 === 0 ? "default" : void 0
68
- )
69
- );
70
- let index = clampIndex(
71
- initialIndex == null ? entries.length - 1 : initialIndex
72
- );
73
- let action = "POP";
74
- let listener = null;
75
- function clampIndex(n) {
76
- return Math.min(Math.max(n, 0), entries.length - 1);
77
- }
78
- function getCurrentLocation() {
79
- return entries[index];
80
- }
81
- function createMemoryLocation(to, state = null, key) {
82
- let location = createLocation(
83
- entries ? getCurrentLocation().pathname : "/",
84
- to,
85
- state,
86
- key
87
- );
88
- warning(
89
- location.pathname.charAt(0) === "/",
90
- `relative pathnames are not supported in memory history: ${JSON.stringify(
91
- to
92
- )}`
93
- );
94
- return location;
95
- }
96
- function createHref2(to) {
97
- return typeof to === "string" ? to : createPath(to);
98
- }
99
- let history = {
100
- get index() {
101
- return index;
102
- },
103
- get action() {
104
- return action;
105
- },
106
- get location() {
107
- return getCurrentLocation();
108
- },
109
- createHref: createHref2,
110
- createURL(to) {
111
- return new URL(createHref2(to), "http://localhost");
112
- },
113
- encodeLocation(to) {
114
- let path = typeof to === "string" ? parsePath(to) : to;
115
- return {
116
- pathname: path.pathname || "",
117
- search: path.search || "",
118
- hash: path.hash || ""
119
- };
120
- },
121
- push(to, state) {
122
- action = "PUSH";
123
- let nextLocation = createMemoryLocation(to, state);
124
- index += 1;
125
- entries.splice(index, entries.length, nextLocation);
126
- if (v5Compat && listener) {
127
- listener({ action, location: nextLocation, delta: 1 });
128
- }
129
- },
130
- replace(to, state) {
131
- action = "REPLACE";
132
- let nextLocation = createMemoryLocation(to, state);
133
- entries[index] = nextLocation;
134
- if (v5Compat && listener) {
135
- listener({ action, location: nextLocation, delta: 0 });
136
- }
137
- },
138
- go(delta) {
139
- action = "POP";
140
- let nextIndex = clampIndex(index + delta);
141
- let nextLocation = entries[nextIndex];
142
- index = nextIndex;
143
- if (listener) {
144
- listener({ action, location: nextLocation, delta });
145
- }
146
- },
147
- listen(fn) {
148
- listener = fn;
149
- return () => {
150
- listener = null;
151
- };
152
- }
153
- };
154
- return history;
155
- }
156
- function createBrowserHistory(options = {}) {
157
- function createBrowserLocation(window2, globalHistory) {
158
- let { pathname, search, hash } = window2.location;
159
- return createLocation(
160
- "",
161
- { pathname, search, hash },
162
- // state defaults to `null` because `window.history.state` does
163
- globalHistory.state && globalHistory.state.usr || null,
164
- globalHistory.state && globalHistory.state.key || "default"
165
- );
166
- }
167
- function createBrowserHref(window2, to) {
168
- return typeof to === "string" ? to : createPath(to);
169
- }
170
- return getUrlBasedHistory(
171
- createBrowserLocation,
172
- createBrowserHref,
173
- null,
174
- options
175
- );
176
- }
177
- function invariant(value, message) {
178
- if (value === false || value === null || typeof value === "undefined") {
179
- throw new Error(message);
180
- }
181
- }
182
- function warning(cond, message) {
183
- if (!cond) {
184
- if (typeof console !== "undefined") console.warn(message);
185
- try {
186
- throw new Error(message);
187
- } catch (e) {
188
- }
189
- }
190
- }
191
- function createKey() {
192
- return Math.random().toString(36).substring(2, 10);
193
- }
194
- function getHistoryState(location, index) {
195
- return {
196
- usr: location.state,
197
- key: location.key,
198
- idx: index
199
- };
200
- }
201
- function createLocation(current, to, state = null, key) {
202
- let location = {
203
- pathname: typeof current === "string" ? current : current.pathname,
204
- search: "",
205
- hash: "",
206
- ...typeof to === "string" ? parsePath(to) : to,
207
- state,
208
- // TODO: This could be cleaned up. push/replace should probably just take
209
- // full Locations now and avoid the need to run through this flow at all
210
- // But that's a pretty big refactor to the current test suite so going to
211
- // keep as is for the time being and just let any incoming keys take precedence
212
- key: to && to.key || key || createKey()
213
- };
214
- return location;
215
- }
216
- function createPath({
217
- pathname = "/",
218
- search = "",
219
- hash = ""
220
- }) {
221
- if (search && search !== "?")
222
- pathname += search.charAt(0) === "?" ? search : "?" + search;
223
- if (hash && hash !== "#")
224
- pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
225
- return pathname;
226
- }
227
- function parsePath(path) {
228
- let parsedPath = {};
229
- if (path) {
230
- let hashIndex = path.indexOf("#");
231
- if (hashIndex >= 0) {
232
- parsedPath.hash = path.substring(hashIndex);
233
- path = path.substring(0, hashIndex);
234
- }
235
- let searchIndex = path.indexOf("?");
236
- if (searchIndex >= 0) {
237
- parsedPath.search = path.substring(searchIndex);
238
- path = path.substring(0, searchIndex);
239
- }
240
- if (path) {
241
- parsedPath.pathname = path;
242
- }
243
- }
244
- return parsedPath;
245
- }
246
- function getUrlBasedHistory(getLocation, createHref2, validateLocation, options = {}) {
247
- let { window: window2 = document.defaultView, v5Compat = false } = options;
248
- let globalHistory = window2.history;
249
- let action = "POP";
250
- let listener = null;
251
- let index = getIndex();
252
- if (index == null) {
253
- index = 0;
254
- globalHistory.replaceState({ ...globalHistory.state, idx: index }, "");
255
- }
256
- function getIndex() {
257
- let state = globalHistory.state || { idx: null };
258
- return state.idx;
259
- }
260
- function handlePop() {
261
- action = "POP";
262
- let nextIndex = getIndex();
263
- let delta = nextIndex == null ? null : nextIndex - index;
264
- index = nextIndex;
265
- if (listener) {
266
- listener({ action, location: history.location, delta });
267
- }
268
- }
269
- function push(to, state) {
270
- action = "PUSH";
271
- let location = createLocation(history.location, to, state);
272
- index = getIndex() + 1;
273
- let historyState = getHistoryState(location, index);
274
- let url = history.createHref(location);
275
- try {
276
- globalHistory.pushState(historyState, "", url);
277
- } catch (error) {
278
- if (error instanceof DOMException && error.name === "DataCloneError") {
279
- throw error;
280
- }
281
- window2.location.assign(url);
282
- }
283
- if (v5Compat && listener) {
284
- listener({ action, location: history.location, delta: 1 });
285
- }
286
- }
287
- function replace2(to, state) {
288
- action = "REPLACE";
289
- let location = createLocation(history.location, to, state);
290
- index = getIndex();
291
- let historyState = getHistoryState(location, index);
292
- let url = history.createHref(location);
293
- globalHistory.replaceState(historyState, "", url);
294
- if (v5Compat && listener) {
295
- listener({ action, location: history.location, delta: 0 });
296
- }
297
- }
298
- function createURL(to) {
299
- return createBrowserURLImpl(to);
300
- }
301
- let history = {
302
- get action() {
303
- return action;
304
- },
305
- get location() {
306
- return getLocation(window2, globalHistory);
307
- },
308
- listen(fn) {
309
- if (listener) {
310
- throw new Error("A history only accepts one active listener");
311
- }
312
- window2.addEventListener(PopStateEventType, handlePop);
313
- listener = fn;
314
- return () => {
315
- window2.removeEventListener(PopStateEventType, handlePop);
316
- listener = null;
317
- };
318
- },
319
- createHref(to) {
320
- return createHref2(window2, to);
321
- },
322
- createURL,
323
- encodeLocation(to) {
324
- let url = createURL(to);
325
- return {
326
- pathname: url.pathname,
327
- search: url.search,
328
- hash: url.hash
329
- };
330
- },
331
- push,
332
- replace: replace2,
333
- go(n) {
334
- return globalHistory.go(n);
335
- }
336
- };
337
- return history;
338
- }
339
- function createBrowserURLImpl(to, isAbsolute = false) {
340
- let base = "http://localhost";
341
- if (typeof window !== "undefined") {
342
- base = window.location.origin !== "null" ? window.location.origin : window.location.href;
343
- }
344
- invariant(base, "No window.location.(origin|href) available to create URL");
345
- let href = typeof to === "string" ? to : createPath(to);
346
- href = href.replace(/ $/, "%20");
347
- if (!isAbsolute && href.startsWith("//")) {
348
- href = base + href;
349
- }
350
- return new URL(href, base);
351
- }
352
- function matchRoutes(routes, locationArg, basename = "/") {
353
- return matchRoutesImpl(routes, locationArg, basename, false);
354
- }
355
- function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
356
- let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
357
- let pathname = stripBasename(location.pathname || "/", basename);
358
- if (pathname == null) {
359
- return null;
360
- }
361
- let branches = flattenRoutes(routes);
362
- rankRouteBranches(branches);
363
- let matches = null;
364
- for (let i = 0; matches == null && i < branches.length; ++i) {
365
- let decoded = decodePath(pathname);
366
- matches = matchRouteBranch(
367
- branches[i],
368
- decoded,
369
- allowPartial
370
- );
371
- }
372
- return matches;
373
- }
374
- function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
375
- let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
376
- let meta = {
377
- relativePath: relativePath === void 0 ? route.path || "" : relativePath,
378
- caseSensitive: route.caseSensitive === true,
379
- childrenIndex: index,
380
- route
381
- };
382
- if (meta.relativePath.startsWith("/")) {
383
- if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
384
- return;
385
- }
386
- invariant(
387
- meta.relativePath.startsWith(parentPath),
388
- `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.`
389
- );
390
- meta.relativePath = meta.relativePath.slice(parentPath.length);
391
- }
392
- let path = joinPaths([parentPath, meta.relativePath]);
393
- let routesMeta = parentsMeta.concat(meta);
394
- if (route.children && route.children.length > 0) {
395
- invariant(
396
- // Our types know better, but runtime JS may not!
397
- // @ts-expect-error
398
- route.index !== true,
399
- `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
400
- );
401
- flattenRoutes(
402
- route.children,
403
- branches,
404
- routesMeta,
405
- path,
406
- hasParentOptionalSegments
407
- );
408
- }
409
- if (route.path == null && !route.index) {
410
- return;
411
- }
412
- branches.push({
413
- path,
414
- score: computeScore(path, route.index),
415
- routesMeta
416
- });
417
- };
418
- routes.forEach((route, index) => {
419
- if (route.path === "" || !route.path?.includes("?")) {
420
- flattenRoute(route, index);
421
- } else {
422
- for (let exploded of explodeOptionalSegments(route.path)) {
423
- flattenRoute(route, index, true, exploded);
424
- }
425
- }
426
- });
427
- return branches;
428
- }
429
- function explodeOptionalSegments(path) {
430
- let segments = path.split("/");
431
- if (segments.length === 0) return [];
432
- let [first, ...rest] = segments;
433
- let isOptional = first.endsWith("?");
434
- let required = first.replace(/\?$/, "");
435
- if (rest.length === 0) {
436
- return isOptional ? [required, ""] : [required];
437
- }
438
- let restExploded = explodeOptionalSegments(rest.join("/"));
439
- let result = [];
440
- result.push(
441
- ...restExploded.map(
442
- (subpath) => subpath === "" ? required : [required, subpath].join("/")
443
- )
444
- );
445
- if (isOptional) {
446
- result.push(...restExploded);
447
- }
448
- return result.map(
449
- (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
450
- );
451
- }
452
- function rankRouteBranches(branches) {
453
- branches.sort(
454
- (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
455
- a.routesMeta.map((meta) => meta.childrenIndex),
456
- b.routesMeta.map((meta) => meta.childrenIndex)
457
- )
458
- );
459
- }
460
- var paramRe = /^:[\w-]+$/;
461
- var dynamicSegmentValue = 3;
462
- var indexRouteValue = 2;
463
- var emptySegmentValue = 1;
464
- var staticSegmentValue = 10;
465
- var splatPenalty = -2;
466
- var isSplat = (s) => s === "*";
467
- function computeScore(path, index) {
468
- let segments = path.split("/");
469
- let initialScore = segments.length;
470
- if (segments.some(isSplat)) {
471
- initialScore += splatPenalty;
472
- }
473
- if (index) {
474
- initialScore += indexRouteValue;
475
- }
476
- return segments.filter((s) => !isSplat(s)).reduce(
477
- (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
478
- initialScore
479
- );
480
- }
481
- function compareIndexes(a, b) {
482
- let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
483
- return siblings ? (
484
- // If two routes are siblings, we should try to match the earlier sibling
485
- // first. This allows people to have fine-grained control over the matching
486
- // behavior by simply putting routes with identical paths in the order they
487
- // want them tried.
488
- a[a.length - 1] - b[b.length - 1]
489
- ) : (
490
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
491
- // so they sort equally.
492
- 0
493
- );
494
- }
495
- function matchRouteBranch(branch, pathname, allowPartial = false) {
496
- let { routesMeta } = branch;
497
- let matchedParams = {};
498
- let matchedPathname = "/";
499
- let matches = [];
500
- for (let i = 0; i < routesMeta.length; ++i) {
501
- let meta = routesMeta[i];
502
- let end = i === routesMeta.length - 1;
503
- let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
504
- let match = matchPath(
505
- { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
506
- remainingPathname
507
- );
508
- let route = meta.route;
509
- if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
510
- match = matchPath(
511
- {
512
- path: meta.relativePath,
513
- caseSensitive: meta.caseSensitive,
514
- end: false
515
- },
516
- remainingPathname
517
- );
518
- }
519
- if (!match) {
520
- return null;
521
- }
522
- Object.assign(matchedParams, match.params);
523
- matches.push({
524
- // TODO: Can this as be avoided?
525
- params: matchedParams,
526
- pathname: joinPaths([matchedPathname, match.pathname]),
527
- pathnameBase: normalizePathname(
528
- joinPaths([matchedPathname, match.pathnameBase])
529
- ),
530
- route
531
- });
532
- if (match.pathnameBase !== "/") {
533
- matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
534
- }
535
- }
536
- return matches;
537
- }
538
- function matchPath(pattern, pathname) {
539
- if (typeof pattern === "string") {
540
- pattern = { path: pattern, caseSensitive: false, end: true };
541
- }
542
- let [matcher, compiledParams] = compilePath(
543
- pattern.path,
544
- pattern.caseSensitive,
545
- pattern.end
546
- );
547
- let match = pathname.match(matcher);
548
- if (!match) return null;
549
- let matchedPathname = match[0];
550
- let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
551
- let captureGroups = match.slice(1);
552
- let params = compiledParams.reduce(
553
- (memo2, { paramName, isOptional }, index) => {
554
- if (paramName === "*") {
555
- let splatValue = captureGroups[index] || "";
556
- pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
557
- }
558
- const value = captureGroups[index];
559
- if (isOptional && !value) {
560
- memo2[paramName] = void 0;
561
- } else {
562
- memo2[paramName] = (value || "").replace(/%2F/g, "/");
563
- }
564
- return memo2;
565
- },
566
- {}
567
- );
568
- return {
569
- params,
570
- pathname: matchedPathname,
571
- pathnameBase,
572
- pattern
573
- };
574
- }
575
- function compilePath(path, caseSensitive = false, end = true) {
576
- warning(
577
- path === "*" || !path.endsWith("*") || path.endsWith("/*"),
578
- `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(/\*$/, "/*")}".`
579
- );
580
- let params = [];
581
- let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
582
- /\/:([\w-]+)(\?)?/g,
583
- (_, paramName, isOptional) => {
584
- params.push({ paramName, isOptional: isOptional != null });
585
- return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
586
- }
587
- ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
588
- if (path.endsWith("*")) {
589
- params.push({ paramName: "*" });
590
- regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
591
- } else if (end) {
592
- regexpSource += "\\/*$";
593
- } else if (path !== "" && path !== "/") {
594
- regexpSource += "(?:(?=\\/|$))";
595
- } else ;
596
- let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
597
- return [matcher, params];
598
- }
599
- function decodePath(value) {
600
- try {
601
- return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
602
- } catch (error) {
603
- warning(
604
- false,
605
- `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}).`
606
- );
607
- return value;
608
- }
609
- }
610
- function stripBasename(pathname, basename) {
611
- if (basename === "/") return pathname;
612
- if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
613
- return null;
614
- }
615
- let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
616
- let nextChar = pathname.charAt(startIndex);
617
- if (nextChar && nextChar !== "/") {
618
- return null;
619
- }
620
- return pathname.slice(startIndex) || "/";
621
- }
622
- function resolvePath(to, fromPathname = "/") {
623
- let {
624
- pathname: toPathname,
625
- search = "",
626
- hash = ""
627
- } = typeof to === "string" ? parsePath(to) : to;
628
- let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
629
- return {
630
- pathname,
631
- search: normalizeSearch(search),
632
- hash: normalizeHash(hash)
633
- };
634
- }
635
- function resolvePathname(relativePath, fromPathname) {
636
- let segments = fromPathname.replace(/\/+$/, "").split("/");
637
- let relativeSegments = relativePath.split("/");
638
- relativeSegments.forEach((segment) => {
639
- if (segment === "..") {
640
- if (segments.length > 1) segments.pop();
641
- } else if (segment !== ".") {
642
- segments.push(segment);
643
- }
644
- });
645
- return segments.length > 1 ? segments.join("/") : "/";
646
- }
647
- function getInvalidPathError(char, field, dest, path) {
648
- return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
649
- path
650
- )}]. 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.`;
651
- }
652
- function getPathContributingMatches(matches) {
653
- return matches.filter(
654
- (match, index) => index === 0 || match.route.path && match.route.path.length > 0
655
- );
656
- }
657
- function getResolveToMatches(matches) {
658
- let pathMatches = getPathContributingMatches(matches);
659
- return pathMatches.map(
660
- (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
661
- );
662
- }
663
- function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
664
- let to;
665
- if (typeof toArg === "string") {
666
- to = parsePath(toArg);
667
- } else {
668
- to = { ...toArg };
669
- invariant(
670
- !to.pathname || !to.pathname.includes("?"),
671
- getInvalidPathError("?", "pathname", "search", to)
672
- );
673
- invariant(
674
- !to.pathname || !to.pathname.includes("#"),
675
- getInvalidPathError("#", "pathname", "hash", to)
676
- );
677
- invariant(
678
- !to.search || !to.search.includes("#"),
679
- getInvalidPathError("#", "search", "hash", to)
680
- );
681
- }
682
- let isEmptyPath = toArg === "" || to.pathname === "";
683
- let toPathname = isEmptyPath ? "/" : to.pathname;
684
- let from;
685
- if (toPathname == null) {
686
- from = locationPathname;
687
- } else {
688
- let routePathnameIndex = routePathnames.length - 1;
689
- if (!isPathRelative && toPathname.startsWith("..")) {
690
- let toSegments = toPathname.split("/");
691
- while (toSegments[0] === "..") {
692
- toSegments.shift();
693
- routePathnameIndex -= 1;
694
- }
695
- to.pathname = toSegments.join("/");
696
- }
697
- from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
698
- }
699
- let path = resolvePath(to, from);
700
- let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
701
- let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
702
- if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
703
- path.pathname += "/";
704
- }
705
- return path;
706
- }
707
- var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
708
- var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
709
- var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
710
- var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
711
- function isRouteErrorResponse(error) {
712
- return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
713
- }
714
- var validMutationMethodsArr = [
715
- "POST",
716
- "PUT",
717
- "PATCH",
718
- "DELETE"
719
- ];
720
- new Set(
721
- validMutationMethodsArr
722
- );
723
- var validRequestMethodsArr = [
724
- "GET",
725
- ...validMutationMethodsArr
726
- ];
727
- new Set(validRequestMethodsArr);
728
- const React = await importShared('react');
729
-
730
- var DataRouterContext = React.createContext(null);
731
- DataRouterContext.displayName = "DataRouter";
732
- var DataRouterStateContext = React.createContext(null);
733
- DataRouterStateContext.displayName = "DataRouterState";
734
- var RSCRouterContext = React.createContext(false);
735
- function useIsRSCRouterContext() {
736
- return React.useContext(RSCRouterContext);
737
- }
738
- var ViewTransitionContext = React.createContext({
739
- isTransitioning: false
740
- });
741
- ViewTransitionContext.displayName = "ViewTransition";
742
- var FetchersContext = React.createContext(
743
- /* @__PURE__ */ new Map()
744
- );
745
- FetchersContext.displayName = "Fetchers";
746
- var AwaitContext = React.createContext(null);
747
- AwaitContext.displayName = "Await";
748
- var NavigationContext = React.createContext(
749
- null
750
- );
751
- NavigationContext.displayName = "Navigation";
752
- var LocationContext = React.createContext(
753
- null
754
- );
755
- LocationContext.displayName = "Location";
756
- var RouteContext = React.createContext({
757
- outlet: null,
758
- matches: [],
759
- isDataRoute: false
760
- });
761
- RouteContext.displayName = "Route";
762
- var RouteErrorContext = React.createContext(null);
763
- RouteErrorContext.displayName = "RouteError";
764
- const React2 = await importShared('react');
765
-
766
- function useHref(to, { relative } = {}) {
767
- invariant(
768
- useInRouterContext(),
769
- // TODO: This error is probably because they somehow have 2 versions of the
770
- // router loaded. We can help them understand how to avoid that.
771
- `useHref() may be used only in the context of a <Router> component.`
772
- );
773
- let { basename, navigator } = React2.useContext(NavigationContext);
774
- let { hash, pathname, search } = useResolvedPath(to, { relative });
775
- let joinedPathname = pathname;
776
- if (basename !== "/") {
777
- joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
778
- }
779
- return navigator.createHref({ pathname: joinedPathname, search, hash });
780
- }
781
- function useInRouterContext() {
782
- return React2.useContext(LocationContext) != null;
783
- }
784
- function useLocation() {
785
- invariant(
786
- useInRouterContext(),
787
- // TODO: This error is probably because they somehow have 2 versions of the
788
- // router loaded. We can help them understand how to avoid that.
789
- `useLocation() may be used only in the context of a <Router> component.`
790
- );
791
- return React2.useContext(LocationContext).location;
792
- }
793
- var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
794
- function useIsomorphicLayoutEffect(cb) {
795
- let isStatic = React2.useContext(NavigationContext).static;
796
- if (!isStatic) {
797
- React2.useLayoutEffect(cb);
798
- }
799
- }
800
- function useNavigate() {
801
- let { isDataRoute } = React2.useContext(RouteContext);
802
- return isDataRoute ? useNavigateStable() : useNavigateUnstable();
803
- }
804
- function useNavigateUnstable() {
805
- invariant(
806
- useInRouterContext(),
807
- // TODO: This error is probably because they somehow have 2 versions of the
808
- // router loaded. We can help them understand how to avoid that.
809
- `useNavigate() may be used only in the context of a <Router> component.`
810
- );
811
- let dataRouterContext = React2.useContext(DataRouterContext);
812
- let { basename, navigator } = React2.useContext(NavigationContext);
813
- let { matches } = React2.useContext(RouteContext);
814
- let { pathname: locationPathname } = useLocation();
815
- let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
816
- let activeRef = React2.useRef(false);
817
- useIsomorphicLayoutEffect(() => {
818
- activeRef.current = true;
819
- });
820
- let navigate = React2.useCallback(
821
- (to, options = {}) => {
822
- warning(activeRef.current, navigateEffectWarning);
823
- if (!activeRef.current) return;
824
- if (typeof to === "number") {
825
- navigator.go(to);
826
- return;
827
- }
828
- let path = resolveTo(
829
- to,
830
- JSON.parse(routePathnamesJson),
831
- locationPathname,
832
- options.relative === "path"
833
- );
834
- if (dataRouterContext == null && basename !== "/") {
835
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
836
- }
837
- (!!options.replace ? navigator.replace : navigator.push)(
838
- path,
839
- options.state,
840
- options
841
- );
842
- },
843
- [
844
- basename,
845
- navigator,
846
- routePathnamesJson,
847
- locationPathname,
848
- dataRouterContext
849
- ]
850
- );
851
- return navigate;
852
- }
853
- React2.createContext(null);
854
- function useResolvedPath(to, { relative } = {}) {
855
- let { matches } = React2.useContext(RouteContext);
856
- let { pathname: locationPathname } = useLocation();
857
- let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
858
- return React2.useMemo(
859
- () => resolveTo(
860
- to,
861
- JSON.parse(routePathnamesJson),
862
- locationPathname,
863
- relative === "path"
864
- ),
865
- [to, routePathnamesJson, locationPathname, relative]
866
- );
867
- }
868
- function useRoutes(routes, locationArg) {
869
- return useRoutesImpl(routes, locationArg);
870
- }
871
- function useRoutesImpl(routes, locationArg, dataRouterState, unstable_onError, future) {
872
- invariant(
873
- useInRouterContext(),
874
- // TODO: This error is probably because they somehow have 2 versions of the
875
- // router loaded. We can help them understand how to avoid that.
876
- `useRoutes() may be used only in the context of a <Router> component.`
877
- );
878
- let { navigator } = React2.useContext(NavigationContext);
879
- let { matches: parentMatches } = React2.useContext(RouteContext);
880
- let routeMatch = parentMatches[parentMatches.length - 1];
881
- let parentParams = routeMatch ? routeMatch.params : {};
882
- let parentPathname = routeMatch ? routeMatch.pathname : "/";
883
- let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
884
- let parentRoute = routeMatch && routeMatch.route;
885
- {
886
- let parentPath = parentRoute && parentRoute.path || "";
887
- warningOnce(
888
- parentPathname,
889
- !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
890
- `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.
891
-
892
- Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
893
- );
894
- }
895
- let locationFromContext = useLocation();
896
- let location;
897
- if (locationArg) {
898
- let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
899
- invariant(
900
- parentPathnameBase === "/" || parsedLocationArg.pathname?.startsWith(parentPathnameBase),
901
- `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
902
- );
903
- location = parsedLocationArg;
904
- } else {
905
- location = locationFromContext;
906
- }
907
- let pathname = location.pathname || "/";
908
- let remainingPathname = pathname;
909
- if (parentPathnameBase !== "/") {
910
- let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
911
- let segments = pathname.replace(/^\//, "").split("/");
912
- remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
913
- }
914
- let matches = matchRoutes(routes, { pathname: remainingPathname });
915
- {
916
- warning(
917
- parentRoute || matches != null,
918
- `No routes matched location "${location.pathname}${location.search}${location.hash}" `
919
- );
920
- warning(
921
- 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,
922
- `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.`
923
- );
924
- }
925
- let renderedMatches = _renderMatches(
926
- matches && matches.map(
927
- (match) => Object.assign({}, match, {
928
- params: Object.assign({}, parentParams, match.params),
929
- pathname: joinPaths([
930
- parentPathnameBase,
931
- // Re-encode pathnames that were decoded inside matchRoutes
932
- navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname
933
- ]),
934
- pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
935
- parentPathnameBase,
936
- // Re-encode pathnames that were decoded inside matchRoutes
937
- navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
938
- ])
939
- })
940
- ),
941
- parentMatches,
942
- dataRouterState,
943
- unstable_onError,
944
- future
945
- );
946
- if (locationArg && renderedMatches) {
947
- return /* @__PURE__ */ React2.createElement(
948
- LocationContext.Provider,
949
- {
950
- value: {
951
- location: {
952
- pathname: "/",
953
- search: "",
954
- hash: "",
955
- state: null,
956
- key: "default",
957
- ...location
958
- },
959
- navigationType: "POP"
960
- /* Pop */
961
- }
962
- },
963
- renderedMatches
964
- );
965
- }
966
- return renderedMatches;
967
- }
968
- function DefaultErrorComponent() {
969
- let error = useRouteError();
970
- let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
971
- let stack = error instanceof Error ? error.stack : null;
972
- let lightgrey = "rgba(200,200,200, 0.5)";
973
- let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
974
- let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
975
- let devInfo = null;
976
- {
977
- console.error(
978
- "Error handled by React Router default ErrorBoundary:",
979
- error
980
- );
981
- devInfo = /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ React2.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React2.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React2.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
982
- }
983
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React2.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React2.createElement("pre", { style: preStyles }, stack) : null, devInfo);
984
- }
985
- var defaultErrorElement = /* @__PURE__ */ React2.createElement(DefaultErrorComponent, null);
986
- var RenderErrorBoundary = class extends React2.Component {
987
- constructor(props) {
988
- super(props);
989
- this.state = {
990
- location: props.location,
991
- revalidation: props.revalidation,
992
- error: props.error
993
- };
994
- }
995
- static getDerivedStateFromError(error) {
996
- return { error };
997
- }
998
- static getDerivedStateFromProps(props, state) {
999
- if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
1000
- return {
1001
- error: props.error,
1002
- location: props.location,
1003
- revalidation: props.revalidation
1004
- };
1005
- }
1006
- return {
1007
- error: props.error !== void 0 ? props.error : state.error,
1008
- location: state.location,
1009
- revalidation: props.revalidation || state.revalidation
1010
- };
1011
- }
1012
- componentDidCatch(error, errorInfo) {
1013
- if (this.props.unstable_onError) {
1014
- this.props.unstable_onError(error, errorInfo);
1015
- } else {
1016
- console.error(
1017
- "React Router caught the following error during render",
1018
- error
1019
- );
1020
- }
1021
- }
1022
- render() {
1023
- return this.state.error !== void 0 ? /* @__PURE__ */ React2.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React2.createElement(
1024
- RouteErrorContext.Provider,
1025
- {
1026
- value: this.state.error,
1027
- children: this.props.component
1028
- }
1029
- )) : this.props.children;
1030
- }
1031
- };
1032
- function RenderedRoute({ routeContext, match, children }) {
1033
- let dataRouterContext = React2.useContext(DataRouterContext);
1034
- if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
1035
- dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
1036
- }
1037
- return /* @__PURE__ */ React2.createElement(RouteContext.Provider, { value: routeContext }, children);
1038
- }
1039
- function _renderMatches(matches, parentMatches = [], dataRouterState = null, unstable_onError = null, future = null) {
1040
- if (matches == null) {
1041
- if (!dataRouterState) {
1042
- return null;
1043
- }
1044
- if (dataRouterState.errors) {
1045
- matches = dataRouterState.matches;
1046
- } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
1047
- matches = dataRouterState.matches;
1048
- } else {
1049
- return null;
1050
- }
1051
- }
1052
- let renderedMatches = matches;
1053
- let errors = dataRouterState?.errors;
1054
- if (errors != null) {
1055
- let errorIndex = renderedMatches.findIndex(
1056
- (m) => m.route.id && errors?.[m.route.id] !== void 0
1057
- );
1058
- invariant(
1059
- errorIndex >= 0,
1060
- `Could not find a matching route for errors on route IDs: ${Object.keys(
1061
- errors
1062
- ).join(",")}`
1063
- );
1064
- renderedMatches = renderedMatches.slice(
1065
- 0,
1066
- Math.min(renderedMatches.length, errorIndex + 1)
1067
- );
1068
- }
1069
- let renderFallback = false;
1070
- let fallbackIndex = -1;
1071
- if (dataRouterState) {
1072
- for (let i = 0; i < renderedMatches.length; i++) {
1073
- let match = renderedMatches[i];
1074
- if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
1075
- fallbackIndex = i;
1076
- }
1077
- if (match.route.id) {
1078
- let { loaderData, errors: errors2 } = dataRouterState;
1079
- let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
1080
- if (match.route.lazy || needsToRunLoader) {
1081
- renderFallback = true;
1082
- if (fallbackIndex >= 0) {
1083
- renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
1084
- } else {
1085
- renderedMatches = [renderedMatches[0]];
1086
- }
1087
- break;
1088
- }
1089
- }
1090
- }
1091
- }
1092
- return renderedMatches.reduceRight(
1093
- (outlet, match, index) => {
1094
- let error;
1095
- let shouldRenderHydrateFallback = false;
1096
- let errorElement = null;
1097
- let hydrateFallbackElement = null;
1098
- if (dataRouterState) {
1099
- error = errors && match.route.id ? errors[match.route.id] : void 0;
1100
- errorElement = match.route.errorElement || defaultErrorElement;
1101
- if (renderFallback) {
1102
- if (fallbackIndex < 0 && index === 0) {
1103
- warningOnce(
1104
- "route-fallback",
1105
- false,
1106
- "No `HydrateFallback` element provided to render during initial hydration"
1107
- );
1108
- shouldRenderHydrateFallback = true;
1109
- hydrateFallbackElement = null;
1110
- } else if (fallbackIndex === index) {
1111
- shouldRenderHydrateFallback = true;
1112
- hydrateFallbackElement = match.route.hydrateFallbackElement || null;
1113
- }
1114
- }
1115
- }
1116
- let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
1117
- let getChildren = () => {
1118
- let children;
1119
- if (error) {
1120
- children = errorElement;
1121
- } else if (shouldRenderHydrateFallback) {
1122
- children = hydrateFallbackElement;
1123
- } else if (match.route.Component) {
1124
- children = /* @__PURE__ */ React2.createElement(match.route.Component, null);
1125
- } else if (match.route.element) {
1126
- children = match.route.element;
1127
- } else {
1128
- children = outlet;
1129
- }
1130
- return /* @__PURE__ */ React2.createElement(
1131
- RenderedRoute,
1132
- {
1133
- match,
1134
- routeContext: {
1135
- outlet,
1136
- matches: matches2,
1137
- isDataRoute: dataRouterState != null
1138
- },
1139
- children
1140
- }
1141
- );
1142
- };
1143
- return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2.createElement(
1144
- RenderErrorBoundary,
1145
- {
1146
- location: dataRouterState.location,
1147
- revalidation: dataRouterState.revalidation,
1148
- component: errorElement,
1149
- error,
1150
- children: getChildren(),
1151
- routeContext: { outlet: null, matches: matches2, isDataRoute: true },
1152
- unstable_onError
1153
- }
1154
- ) : getChildren();
1155
- },
1156
- null
1157
- );
1158
- }
1159
- function getDataRouterConsoleError(hookName) {
1160
- return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1161
- }
1162
- function useDataRouterContext(hookName) {
1163
- let ctx = React2.useContext(DataRouterContext);
1164
- invariant(ctx, getDataRouterConsoleError(hookName));
1165
- return ctx;
1166
- }
1167
- function useDataRouterState(hookName) {
1168
- let state = React2.useContext(DataRouterStateContext);
1169
- invariant(state, getDataRouterConsoleError(hookName));
1170
- return state;
1171
- }
1172
- function useRouteContext(hookName) {
1173
- let route = React2.useContext(RouteContext);
1174
- invariant(route, getDataRouterConsoleError(hookName));
1175
- return route;
1176
- }
1177
- function useCurrentRouteId(hookName) {
1178
- let route = useRouteContext(hookName);
1179
- let thisRoute = route.matches[route.matches.length - 1];
1180
- invariant(
1181
- thisRoute.route.id,
1182
- `${hookName} can only be used on routes that contain a unique "id"`
1183
- );
1184
- return thisRoute.route.id;
1185
- }
1186
- function useRouteId() {
1187
- return useCurrentRouteId(
1188
- "useRouteId"
1189
- /* UseRouteId */
1190
- );
1191
- }
1192
- function useRouteError() {
1193
- let error = React2.useContext(RouteErrorContext);
1194
- let state = useDataRouterState(
1195
- "useRouteError"
1196
- /* UseRouteError */
1197
- );
1198
- let routeId = useCurrentRouteId(
1199
- "useRouteError"
1200
- /* UseRouteError */
1201
- );
1202
- if (error !== void 0) {
1203
- return error;
1204
- }
1205
- return state.errors?.[routeId];
1206
- }
1207
- function useNavigateStable() {
1208
- let { router } = useDataRouterContext(
1209
- "useNavigate"
1210
- /* UseNavigateStable */
1211
- );
1212
- let id = useCurrentRouteId(
1213
- "useNavigate"
1214
- /* UseNavigateStable */
1215
- );
1216
- let activeRef = React2.useRef(false);
1217
- useIsomorphicLayoutEffect(() => {
1218
- activeRef.current = true;
1219
- });
1220
- let navigate = React2.useCallback(
1221
- async (to, options = {}) => {
1222
- warning(activeRef.current, navigateEffectWarning);
1223
- if (!activeRef.current) return;
1224
- if (typeof to === "number") {
1225
- router.navigate(to);
1226
- } else {
1227
- await router.navigate(to, { fromRouteId: id, ...options });
1228
- }
1229
- },
1230
- [router, id]
1231
- );
1232
- return navigate;
1233
- }
1234
- var alreadyWarned = {};
1235
- function warningOnce(key, cond, message) {
1236
- if (!cond && !alreadyWarned[key]) {
1237
- alreadyWarned[key] = true;
1238
- warning(false, message);
1239
- }
1240
- }
1241
- const React3 = await importShared('react');
1242
-
1243
- var alreadyWarned2 = {};
1244
- function warnOnce(condition, message) {
1245
- if (!condition && !alreadyWarned2[message]) {
1246
- alreadyWarned2[message] = true;
1247
- console.warn(message);
1248
- }
1249
- }
1250
- React3.memo(DataRoutes);
1251
- function DataRoutes({
1252
- routes,
1253
- future,
1254
- state,
1255
- unstable_onError
1256
- }) {
1257
- return useRoutesImpl(routes, void 0, state, unstable_onError, future);
1258
- }
1259
- function MemoryRouter({
1260
- basename,
1261
- children,
1262
- initialEntries,
1263
- initialIndex
1264
- }) {
1265
- let historyRef = React3.useRef();
1266
- if (historyRef.current == null) {
1267
- historyRef.current = createMemoryHistory({
1268
- initialEntries,
1269
- initialIndex,
1270
- v5Compat: true
1271
- });
1272
- }
1273
- let history = historyRef.current;
1274
- let [state, setStateImpl] = React3.useState({
1275
- action: history.action,
1276
- location: history.location
1277
- });
1278
- let setState = React3.useCallback(
1279
- (newState) => {
1280
- React3.startTransition(() => setStateImpl(newState));
1281
- },
1282
- [setStateImpl]
1283
- );
1284
- React3.useLayoutEffect(() => history.listen(setState), [history, setState]);
1285
- return /* @__PURE__ */ React3.createElement(
1286
- Router,
1287
- {
1288
- basename,
1289
- children,
1290
- location: state.location,
1291
- navigationType: state.action,
1292
- navigator: history
1293
- }
1294
- );
1295
- }
1296
- function Navigate({
1297
- to,
1298
- replace: replace2,
1299
- state,
1300
- relative
1301
- }) {
1302
- invariant(
1303
- useInRouterContext(),
1304
- // TODO: This error is probably because they somehow have 2 versions of
1305
- // the router loaded. We can help them understand how to avoid that.
1306
- `<Navigate> may be used only in the context of a <Router> component.`
1307
- );
1308
- let { static: isStatic } = React3.useContext(NavigationContext);
1309
- warning(
1310
- !isStatic,
1311
- `<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
1312
- );
1313
- let { matches } = React3.useContext(RouteContext);
1314
- let { pathname: locationPathname } = useLocation();
1315
- let navigate = useNavigate();
1316
- let path = resolveTo(
1317
- to,
1318
- getResolveToMatches(matches),
1319
- locationPathname,
1320
- relative === "path"
1321
- );
1322
- let jsonPath = JSON.stringify(path);
1323
- React3.useEffect(() => {
1324
- navigate(JSON.parse(jsonPath), { replace: replace2, state, relative });
1325
- }, [navigate, jsonPath, relative, replace2, state]);
1326
- return null;
1327
- }
1328
- function Route(props) {
1329
- invariant(
1330
- false,
1331
- `A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
1332
- );
1333
- }
1334
- function Router({
1335
- basename: basenameProp = "/",
1336
- children = null,
1337
- location: locationProp,
1338
- navigationType = "POP",
1339
- navigator,
1340
- static: staticProp = false
1341
- }) {
1342
- invariant(
1343
- !useInRouterContext(),
1344
- `You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
1345
- );
1346
- let basename = basenameProp.replace(/^\/*/, "/");
1347
- let navigationContext = React3.useMemo(
1348
- () => ({
1349
- basename,
1350
- navigator,
1351
- static: staticProp,
1352
- future: {}
1353
- }),
1354
- [basename, navigator, staticProp]
1355
- );
1356
- if (typeof locationProp === "string") {
1357
- locationProp = parsePath(locationProp);
1358
- }
1359
- let {
1360
- pathname = "/",
1361
- search = "",
1362
- hash = "",
1363
- state = null,
1364
- key = "default"
1365
- } = locationProp;
1366
- let locationContext = React3.useMemo(() => {
1367
- let trailingPathname = stripBasename(pathname, basename);
1368
- if (trailingPathname == null) {
1369
- return null;
1370
- }
1371
- return {
1372
- location: {
1373
- pathname: trailingPathname,
1374
- search,
1375
- hash,
1376
- state,
1377
- key
1378
- },
1379
- navigationType
1380
- };
1381
- }, [basename, pathname, search, hash, state, key, navigationType]);
1382
- warning(
1383
- locationContext != null,
1384
- `<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
1385
- );
1386
- if (locationContext == null) {
1387
- return null;
1388
- }
1389
- return /* @__PURE__ */ React3.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React3.createElement(LocationContext.Provider, { children, value: locationContext }));
1390
- }
1391
- function Routes({
1392
- children,
1393
- location
1394
- }) {
1395
- return useRoutes(createRoutesFromChildren(children), location);
1396
- }
1397
- (class extends React3.Component {
1398
- constructor(props) {
1399
- super(props);
1400
- this.state = { error: null };
1401
- }
1402
- static getDerivedStateFromError(error) {
1403
- return { error };
1404
- }
1405
- componentDidCatch(error, errorInfo) {
1406
- if (this.props.unstable_onError) {
1407
- this.props.unstable_onError(error, errorInfo);
1408
- } else {
1409
- console.error(
1410
- "<Await> caught the following error during render",
1411
- error,
1412
- errorInfo
1413
- );
1414
- }
1415
- }
1416
- render() {
1417
- let { children, errorElement, resolve } = this.props;
1418
- let promise = null;
1419
- let status = 0;
1420
- if (!(resolve instanceof Promise)) {
1421
- status = 1;
1422
- promise = Promise.resolve();
1423
- Object.defineProperty(promise, "_tracked", { get: () => true });
1424
- Object.defineProperty(promise, "_data", { get: () => resolve });
1425
- } else if (this.state.error) {
1426
- status = 2;
1427
- let renderError = this.state.error;
1428
- promise = Promise.reject().catch(() => {
1429
- });
1430
- Object.defineProperty(promise, "_tracked", { get: () => true });
1431
- Object.defineProperty(promise, "_error", { get: () => renderError });
1432
- } else if (resolve._tracked) {
1433
- promise = resolve;
1434
- status = "_error" in promise ? 2 : "_data" in promise ? 1 : 0;
1435
- } else {
1436
- status = 0;
1437
- Object.defineProperty(resolve, "_tracked", { get: () => true });
1438
- promise = resolve.then(
1439
- (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
1440
- (error) => {
1441
- this.props.unstable_onError?.(error);
1442
- Object.defineProperty(resolve, "_error", { get: () => error });
1443
- }
1444
- );
1445
- }
1446
- if (status === 2 && !errorElement) {
1447
- throw promise._error;
1448
- }
1449
- if (status === 2) {
1450
- return /* @__PURE__ */ React3.createElement(AwaitContext.Provider, { value: promise, children: errorElement });
1451
- }
1452
- if (status === 1) {
1453
- return /* @__PURE__ */ React3.createElement(AwaitContext.Provider, { value: promise, children });
1454
- }
1455
- throw promise;
1456
- }
1457
- });
1458
- function createRoutesFromChildren(children, parentPath = []) {
1459
- let routes = [];
1460
- React3.Children.forEach(children, (element, index) => {
1461
- if (!React3.isValidElement(element)) {
1462
- return;
1463
- }
1464
- let treePath = [...parentPath, index];
1465
- if (element.type === React3.Fragment) {
1466
- routes.push.apply(
1467
- routes,
1468
- createRoutesFromChildren(element.props.children, treePath)
1469
- );
1470
- return;
1471
- }
1472
- invariant(
1473
- element.type === Route,
1474
- `[${typeof element.type === "string" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
1475
- );
1476
- invariant(
1477
- !element.props.index || !element.props.children,
1478
- "An index route cannot have child routes."
1479
- );
1480
- let route = {
1481
- id: element.props.id || treePath.join("-"),
1482
- caseSensitive: element.props.caseSensitive,
1483
- element: element.props.element,
1484
- Component: element.props.Component,
1485
- index: element.props.index,
1486
- path: element.props.path,
1487
- loader: element.props.loader,
1488
- action: element.props.action,
1489
- hydrateFallbackElement: element.props.hydrateFallbackElement,
1490
- HydrateFallback: element.props.HydrateFallback,
1491
- errorElement: element.props.errorElement,
1492
- ErrorBoundary: element.props.ErrorBoundary,
1493
- hasErrorBoundary: element.props.hasErrorBoundary === true || element.props.ErrorBoundary != null || element.props.errorElement != null,
1494
- shouldRevalidate: element.props.shouldRevalidate,
1495
- handle: element.props.handle,
1496
- lazy: element.props.lazy
1497
- };
1498
- if (element.props.children) {
1499
- route.children = createRoutesFromChildren(
1500
- element.props.children,
1501
- treePath
1502
- );
1503
- }
1504
- routes.push(route);
1505
- });
1506
- return routes;
1507
- }
1508
- var defaultMethod = "get";
1509
- var defaultEncType = "application/x-www-form-urlencoded";
1510
- function isHtmlElement(object) {
1511
- return object != null && typeof object.tagName === "string";
1512
- }
1513
- function isButtonElement(object) {
1514
- return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
1515
- }
1516
- function isFormElement(object) {
1517
- return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
1518
- }
1519
- function isInputElement(object) {
1520
- return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
1521
- }
1522
- function isModifiedEvent(event) {
1523
- return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
1524
- }
1525
- function shouldProcessLinkClick(event, target) {
1526
- return event.button === 0 && // Ignore everything but left clicks
1527
- (!target || target === "_self") && // Let browser handle "target=_blank" etc.
1528
- !isModifiedEvent(event);
1529
- }
1530
- var _formDataSupportsSubmitter = null;
1531
- function isFormDataSubmitterSupported() {
1532
- if (_formDataSupportsSubmitter === null) {
1533
- try {
1534
- new FormData(
1535
- document.createElement("form"),
1536
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
1537
- 0
1538
- );
1539
- _formDataSupportsSubmitter = false;
1540
- } catch (e) {
1541
- _formDataSupportsSubmitter = true;
1542
- }
1543
- }
1544
- return _formDataSupportsSubmitter;
1545
- }
1546
- var supportedFormEncTypes = /* @__PURE__ */ new Set([
1547
- "application/x-www-form-urlencoded",
1548
- "multipart/form-data",
1549
- "text/plain"
1550
- ]);
1551
- function getFormEncType(encType) {
1552
- if (encType != null && !supportedFormEncTypes.has(encType)) {
1553
- warning(
1554
- false,
1555
- `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
1556
- );
1557
- return null;
1558
- }
1559
- return encType;
1560
- }
1561
- function getFormSubmissionInfo(target, basename) {
1562
- let method;
1563
- let action;
1564
- let encType;
1565
- let formData;
1566
- let body;
1567
- if (isFormElement(target)) {
1568
- let attr = target.getAttribute("action");
1569
- action = attr ? stripBasename(attr, basename) : null;
1570
- method = target.getAttribute("method") || defaultMethod;
1571
- encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
1572
- formData = new FormData(target);
1573
- } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
1574
- let form = target.form;
1575
- if (form == null) {
1576
- throw new Error(
1577
- `Cannot submit a <button> or <input type="submit"> without a <form>`
1578
- );
1579
- }
1580
- let attr = target.getAttribute("formaction") || form.getAttribute("action");
1581
- action = attr ? stripBasename(attr, basename) : null;
1582
- method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
1583
- encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
1584
- formData = new FormData(form, target);
1585
- if (!isFormDataSubmitterSupported()) {
1586
- let { name, type, value } = target;
1587
- if (type === "image") {
1588
- let prefix = name ? `${name}.` : "";
1589
- formData.append(`${prefix}x`, "0");
1590
- formData.append(`${prefix}y`, "0");
1591
- } else if (name) {
1592
- formData.append(name, value);
1593
- }
1594
- }
1595
- } else if (isHtmlElement(target)) {
1596
- throw new Error(
1597
- `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
1598
- );
1599
- } else {
1600
- method = defaultMethod;
1601
- action = null;
1602
- encType = defaultEncType;
1603
- body = target;
1604
- }
1605
- if (formData && encType === "text/plain") {
1606
- body = formData;
1607
- formData = void 0;
1608
- }
1609
- return { action, method: method.toLowerCase(), encType, formData, body };
1610
- }
1611
- await importShared('react');
1612
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
1613
- function invariant2(value, message) {
1614
- if (value === false || value === null || typeof value === "undefined") {
1615
- throw new Error(message);
1616
- }
1617
- }
1618
- function singleFetchUrl(reqUrl, basename, extension) {
1619
- let url = typeof reqUrl === "string" ? new URL(
1620
- reqUrl,
1621
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
1622
- // don't assume window is available
1623
- typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
1624
- ) : reqUrl;
1625
- if (url.pathname === "/") {
1626
- url.pathname = `_root.${extension}`;
1627
- } else if (basename && stripBasename(url.pathname, basename) === "/") {
1628
- url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
1629
- } else {
1630
- url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
1631
- }
1632
- return url;
1633
- }
1634
- const React9 = await importShared('react');
1635
-
1636
- const React8 = await importShared('react');
1637
-
1638
- async function loadRouteModule(route, routeModulesCache) {
1639
- if (route.id in routeModulesCache) {
1640
- return routeModulesCache[route.id];
1641
- }
1642
- try {
1643
- let routeModule = await module.import(
1644
- /* @vite-ignore */
1645
- /* webpackIgnore: true */
1646
- route.module
1647
- );
1648
- routeModulesCache[route.id] = routeModule;
1649
- return routeModule;
1650
- } catch (error) {
1651
- console.error(
1652
- `Error loading route module \`${route.module}\`, reloading page...`
1653
- );
1654
- console.error(error);
1655
- if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
1656
- void 0) ;
1657
- window.location.reload();
1658
- return new Promise(() => {
1659
- });
1660
- }
1661
- }
1662
- function isHtmlLinkDescriptor(object) {
1663
- if (object == null) {
1664
- return false;
1665
- }
1666
- if (object.href == null) {
1667
- return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
1668
- }
1669
- return typeof object.rel === "string" && typeof object.href === "string";
1670
- }
1671
- async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
1672
- let links = await Promise.all(
1673
- matches.map(async (match) => {
1674
- let route = manifest.routes[match.route.id];
1675
- if (route) {
1676
- let mod = await loadRouteModule(route, routeModules);
1677
- return mod.links ? mod.links() : [];
1678
- }
1679
- return [];
1680
- })
1681
- );
1682
- return dedupeLinkDescriptors(
1683
- links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
1684
- (link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
1685
- )
1686
- );
1687
- }
1688
- function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
1689
- let isNew = (match, index) => {
1690
- if (!currentMatches[index]) return true;
1691
- return match.route.id !== currentMatches[index].route.id;
1692
- };
1693
- let matchPathChanged = (match, index) => {
1694
- return (
1695
- // param change, /users/123 -> /users/456
1696
- currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
1697
- // e.g. /files/images/avatar.jpg -> files/finances.xls
1698
- currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
1699
- );
1700
- };
1701
- if (mode === "assets") {
1702
- return nextMatches.filter(
1703
- (match, index) => isNew(match, index) || matchPathChanged(match, index)
1704
- );
1705
- }
1706
- if (mode === "data") {
1707
- return nextMatches.filter((match, index) => {
1708
- let manifestRoute = manifest.routes[match.route.id];
1709
- if (!manifestRoute || !manifestRoute.hasLoader) {
1710
- return false;
1711
- }
1712
- if (isNew(match, index) || matchPathChanged(match, index)) {
1713
- return true;
1714
- }
1715
- if (match.route.shouldRevalidate) {
1716
- let routeChoice = match.route.shouldRevalidate({
1717
- currentUrl: new URL(
1718
- location.pathname + location.search + location.hash,
1719
- window.origin
1720
- ),
1721
- currentParams: currentMatches[0]?.params || {},
1722
- nextUrl: new URL(page, window.origin),
1723
- nextParams: match.params,
1724
- defaultShouldRevalidate: true
1725
- });
1726
- if (typeof routeChoice === "boolean") {
1727
- return routeChoice;
1728
- }
1729
- }
1730
- return true;
1731
- });
1732
- }
1733
- return [];
1734
- }
1735
- function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
1736
- return dedupeHrefs(
1737
- matches.map((match) => {
1738
- let route = manifest.routes[match.route.id];
1739
- if (!route) return [];
1740
- let hrefs = [route.module];
1741
- if (route.clientActionModule) {
1742
- hrefs = hrefs.concat(route.clientActionModule);
1743
- }
1744
- if (route.clientLoaderModule) {
1745
- hrefs = hrefs.concat(route.clientLoaderModule);
1746
- }
1747
- if (includeHydrateFallback && route.hydrateFallbackModule) {
1748
- hrefs = hrefs.concat(route.hydrateFallbackModule);
1749
- }
1750
- if (route.imports) {
1751
- hrefs = hrefs.concat(route.imports);
1752
- }
1753
- return hrefs;
1754
- }).flat(1)
1755
- );
1756
- }
1757
- function dedupeHrefs(hrefs) {
1758
- return [...new Set(hrefs)];
1759
- }
1760
- function sortKeys(obj) {
1761
- let sorted = {};
1762
- let keys = Object.keys(obj).sort();
1763
- for (let key of keys) {
1764
- sorted[key] = obj[key];
1765
- }
1766
- return sorted;
1767
- }
1768
- function dedupeLinkDescriptors(descriptors, preloads) {
1769
- let set = /* @__PURE__ */ new Set();
1770
- new Set(preloads);
1771
- return descriptors.reduce((deduped, descriptor) => {
1772
- let key = JSON.stringify(sortKeys(descriptor));
1773
- if (!set.has(key)) {
1774
- set.add(key);
1775
- deduped.push({ key, link: descriptor });
1776
- }
1777
- return deduped;
1778
- }, []);
1779
- }
1780
- await importShared('react');
6
+ requireReact = module.r;
7
+ }, module => {
8
+ importShared = module.importShared;
9
+ }],
10
+ execute: (async function () {
1781
11
 
1782
- await importShared('react');
12
+ exports({
13
+ n: nS,
14
+ s: s1
15
+ });
1783
16
 
1784
- await importShared('react');
1785
- function isFogOfWarEnabled(routeDiscovery, ssr) {
1786
- return routeDiscovery.mode === "lazy" && ssr === true;
1787
- }
1788
- function getPartialManifest({ sri, ...manifest }, router) {
1789
- let routeIds = new Set(router.state.matches.map((m) => m.route.id));
1790
- let segments = router.state.location.pathname.split("/").filter(Boolean);
1791
- let paths = ["/"];
1792
- segments.pop();
1793
- while (segments.length > 0) {
1794
- paths.push(`/${segments.join("/")}`);
1795
- segments.pop();
1796
- }
1797
- paths.forEach((path) => {
1798
- let matches = matchRoutes(router.routes, path, router.basename);
1799
- if (matches) {
1800
- matches.forEach((m) => routeIds.add(m.route.id));
1801
- }
1802
- });
1803
- let initialRoutes = [...routeIds].reduce(
1804
- (acc, id) => Object.assign(acc, { [id]: manifest.routes[id] }),
1805
- {}
1806
- );
1807
- return {
1808
- ...manifest,
1809
- routes: initialRoutes,
1810
- sri: sri ? true : void 0
1811
- };
1812
- }
1813
- function useDataRouterContext2() {
1814
- let context = React8.useContext(DataRouterContext);
1815
- invariant2(
1816
- context,
1817
- "You must render this element inside a <DataRouterContext.Provider> element"
1818
- );
1819
- return context;
1820
- }
1821
- function useDataRouterStateContext() {
1822
- let context = React8.useContext(DataRouterStateContext);
1823
- invariant2(
1824
- context,
1825
- "You must render this element inside a <DataRouterStateContext.Provider> element"
1826
- );
1827
- return context;
1828
- }
1829
- var FrameworkContext = React8.createContext(void 0);
1830
- FrameworkContext.displayName = "FrameworkContext";
1831
- function useFrameworkContext() {
1832
- let context = React8.useContext(FrameworkContext);
1833
- invariant2(
1834
- context,
1835
- "You must render this element inside a <HydratedRouter> element"
1836
- );
1837
- return context;
1838
- }
1839
- function usePrefetchBehavior(prefetch, theirElementProps) {
1840
- let frameworkContext = React8.useContext(FrameworkContext);
1841
- let [maybePrefetch, setMaybePrefetch] = React8.useState(false);
1842
- let [shouldPrefetch, setShouldPrefetch] = React8.useState(false);
1843
- let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
1844
- let ref = React8.useRef(null);
1845
- React8.useEffect(() => {
1846
- if (prefetch === "render") {
1847
- setShouldPrefetch(true);
1848
- }
1849
- if (prefetch === "viewport") {
1850
- let callback = (entries) => {
1851
- entries.forEach((entry) => {
1852
- setShouldPrefetch(entry.isIntersecting);
1853
- });
1854
- };
1855
- let observer = new IntersectionObserver(callback, { threshold: 0.5 });
1856
- if (ref.current) observer.observe(ref.current);
1857
- return () => {
1858
- observer.disconnect();
1859
- };
1860
- }
1861
- }, [prefetch]);
1862
- React8.useEffect(() => {
1863
- if (maybePrefetch) {
1864
- let id = setTimeout(() => {
1865
- setShouldPrefetch(true);
1866
- }, 100);
1867
- return () => {
1868
- clearTimeout(id);
1869
- };
1870
- }
1871
- }, [maybePrefetch]);
1872
- let setIntent = () => {
1873
- setMaybePrefetch(true);
1874
- };
1875
- let cancelIntent = () => {
1876
- setMaybePrefetch(false);
1877
- setShouldPrefetch(false);
1878
- };
1879
- if (!frameworkContext) {
1880
- return [false, ref, {}];
1881
- }
1882
- if (prefetch !== "intent") {
1883
- return [shouldPrefetch, ref, {}];
1884
- }
1885
- return [
1886
- shouldPrefetch,
1887
- ref,
1888
- {
1889
- onFocus: composeEventHandlers(onFocus, setIntent),
1890
- onBlur: composeEventHandlers(onBlur, cancelIntent),
1891
- onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
1892
- onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
1893
- onTouchStart: composeEventHandlers(onTouchStart, setIntent)
1894
- }
1895
- ];
1896
- }
1897
- function composeEventHandlers(theirHandler, ourHandler) {
1898
- return (event) => {
1899
- theirHandler && theirHandler(event);
1900
- if (!event.defaultPrevented) {
1901
- ourHandler(event);
1902
- }
1903
- };
1904
- }
1905
- function getActiveMatches(matches, errors, isSpaMode) {
1906
- if (isSpaMode && !isHydrated) {
1907
- return [matches[0]];
1908
- }
1909
- return matches;
1910
- }
1911
- function PrefetchPageLinks({ page, ...linkProps }) {
1912
- let { router } = useDataRouterContext2();
1913
- let matches = React8.useMemo(
1914
- () => matchRoutes(router.routes, page, router.basename),
1915
- [router.routes, page, router.basename]
1916
- );
1917
- if (!matches) {
1918
- return null;
1919
- }
1920
- return /* @__PURE__ */ React8.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
1921
- }
1922
- function useKeyedPrefetchLinks(matches) {
1923
- let { manifest, routeModules } = useFrameworkContext();
1924
- let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React8.useState([]);
1925
- React8.useEffect(() => {
1926
- let interrupted = false;
1927
- void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
1928
- (links) => {
1929
- if (!interrupted) {
1930
- setKeyedPrefetchLinks(links);
1931
- }
1932
- }
1933
- );
1934
- return () => {
1935
- interrupted = true;
1936
- };
1937
- }, [matches, manifest, routeModules]);
1938
- return keyedPrefetchLinks;
1939
- }
1940
- function PrefetchPageLinksImpl({
1941
- page,
1942
- matches: nextMatches,
1943
- ...linkProps
1944
- }) {
1945
- let location = useLocation();
1946
- let { manifest, routeModules } = useFrameworkContext();
1947
- let { basename } = useDataRouterContext2();
1948
- let { loaderData, matches } = useDataRouterStateContext();
1949
- let newMatchesForData = React8.useMemo(
1950
- () => getNewMatchesForLinks(
1951
- page,
1952
- nextMatches,
1953
- matches,
1954
- manifest,
1955
- location,
1956
- "data"
1957
- ),
1958
- [page, nextMatches, matches, manifest, location]
1959
- );
1960
- let newMatchesForAssets = React8.useMemo(
1961
- () => getNewMatchesForLinks(
1962
- page,
1963
- nextMatches,
1964
- matches,
1965
- manifest,
1966
- location,
1967
- "assets"
1968
- ),
1969
- [page, nextMatches, matches, manifest, location]
1970
- );
1971
- let dataHrefs = React8.useMemo(() => {
1972
- if (page === location.pathname + location.search + location.hash) {
1973
- return [];
1974
- }
1975
- let routesParams = /* @__PURE__ */ new Set();
1976
- let foundOptOutRoute = false;
1977
- nextMatches.forEach((m) => {
1978
- let manifestRoute = manifest.routes[m.route.id];
1979
- if (!manifestRoute || !manifestRoute.hasLoader) {
1980
- return;
1981
- }
1982
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
1983
- foundOptOutRoute = true;
1984
- } else if (manifestRoute.hasClientLoader) {
1985
- foundOptOutRoute = true;
1986
- } else {
1987
- routesParams.add(m.route.id);
1988
- }
1989
- });
1990
- if (routesParams.size === 0) {
1991
- return [];
1992
- }
1993
- let url = singleFetchUrl(page, basename, "data");
1994
- if (foundOptOutRoute && routesParams.size > 0) {
1995
- url.searchParams.set(
1996
- "_routes",
1997
- nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
1998
- );
1999
- }
2000
- return [url.pathname + url.search];
2001
- }, [
2002
- basename,
2003
- loaderData,
2004
- location,
2005
- manifest,
2006
- newMatchesForData,
2007
- nextMatches,
2008
- page,
2009
- routeModules
2010
- ]);
2011
- let moduleHrefs = React8.useMemo(
2012
- () => getModuleLinkHrefs(newMatchesForAssets, manifest),
2013
- [newMatchesForAssets, manifest]
2014
- );
2015
- let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
2016
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React8.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React8.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
2017
- // these don't spread `linkProps` because they are full link descriptors
2018
- // already with their own props
2019
- /* @__PURE__ */ React8.createElement("link", { key, nonce: linkProps.nonce, ...link })
2020
- )));
2021
- }
2022
- var isHydrated = false;
2023
- function setIsHydrated() {
2024
- isHydrated = true;
2025
- }
2026
- function Scripts(scriptProps) {
2027
- let {
2028
- manifest,
2029
- serverHandoffString,
2030
- isSpaMode,
2031
- renderMeta,
2032
- routeDiscovery,
2033
- ssr
2034
- } = useFrameworkContext();
2035
- let { router, static: isStatic, staticContext } = useDataRouterContext2();
2036
- let { matches: routerMatches } = useDataRouterStateContext();
2037
- let isRSCRouterContext = useIsRSCRouterContext();
2038
- let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
2039
- if (renderMeta) {
2040
- renderMeta.didRenderScripts = true;
2041
- }
2042
- let matches = getActiveMatches(routerMatches, null, isSpaMode);
2043
- React8.useEffect(() => {
2044
- setIsHydrated();
2045
- }, []);
2046
- let initialScripts = React8.useMemo(() => {
2047
- if (isRSCRouterContext) {
2048
- return null;
2049
- }
2050
- let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
2051
- let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
2052
- let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
2053
- ${matches.map((match, routeIndex) => {
2054
- let routeVarName = `route${routeIndex}`;
2055
- let manifestEntry = manifest.routes[match.route.id];
2056
- invariant2(manifestEntry, `Route ${match.route.id} not found in manifest`);
2057
- let {
2058
- clientActionModule,
2059
- clientLoaderModule,
2060
- clientMiddlewareModule,
2061
- hydrateFallbackModule,
2062
- module
2063
- } = manifestEntry;
2064
- let chunks = [
2065
- ...clientActionModule ? [
2066
- {
2067
- module: clientActionModule,
2068
- varName: `${routeVarName}_clientAction`
2069
- }
2070
- ] : [],
2071
- ...clientLoaderModule ? [
2072
- {
2073
- module: clientLoaderModule,
2074
- varName: `${routeVarName}_clientLoader`
2075
- }
2076
- ] : [],
2077
- ...clientMiddlewareModule ? [
2078
- {
2079
- module: clientMiddlewareModule,
2080
- varName: `${routeVarName}_clientMiddleware`
2081
- }
2082
- ] : [],
2083
- ...hydrateFallbackModule ? [
2084
- {
2085
- module: hydrateFallbackModule,
2086
- varName: `${routeVarName}_HydrateFallback`
2087
- }
2088
- ] : [],
2089
- { module, varName: `${routeVarName}_main` }
2090
- ];
2091
- if (chunks.length === 1) {
2092
- return `import * as ${routeVarName} from ${JSON.stringify(module)};`;
2093
- }
2094
- let chunkImportsSnippet = chunks.map((chunk) => `import * as ${chunk.varName} from "${chunk.module}";`).join("\n");
2095
- let mergedChunksSnippet = `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(",")}};`;
2096
- return [chunkImportsSnippet, mergedChunksSnippet].join("\n");
2097
- }).join("\n")}
2098
- ${enableFogOfWar ? (
2099
- // Inline a minimal manifest with the SSR matches
2100
- `window.__reactRouterManifest = ${JSON.stringify(
2101
- getPartialManifest(manifest, router),
2102
- null,
2103
- 2
2104
- )};`
2105
- ) : ""}
2106
- window.__reactRouterRouteModules = {${matches.map((match, index) => `${JSON.stringify(match.route.id)}:route${index}`).join(",")}};
17
+ var jsxRuntime = {exports: {}};
2107
18
 
2108
- import(${JSON.stringify(manifest.entry.module)});`;
2109
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
2110
- "script",
2111
- {
2112
- ...scriptProps,
2113
- suppressHydrationWarning: true,
2114
- dangerouslySetInnerHTML: { __html: contextScript },
2115
- type: void 0
2116
- }
2117
- ), /* @__PURE__ */ React8.createElement(
2118
- "script",
2119
- {
2120
- ...scriptProps,
2121
- suppressHydrationWarning: true,
2122
- dangerouslySetInnerHTML: { __html: routeModulesScript },
2123
- type: "module",
2124
- async: true
2125
- }
2126
- ));
2127
- }, []);
2128
- let preloads = isHydrated || isRSCRouterContext ? [] : dedupe(
2129
- manifest.entry.imports.concat(
2130
- getModuleLinkHrefs(matches, manifest, {
2131
- includeHydrateFallback: true
2132
- })
2133
- )
2134
- );
2135
- let sri = typeof manifest.sri === "object" ? manifest.sri : {};
2136
- warnOnce(
2137
- !isRSCRouterContext,
2138
- "The <Scripts /> element is a no-op when using RSC and can be safely removed."
2139
- );
2140
- return isHydrated || isRSCRouterContext ? null : /* @__PURE__ */ React8.createElement(React8.Fragment, null, typeof manifest.sri === "object" ? /* @__PURE__ */ React8.createElement(
2141
- "script",
2142
- {
2143
- "rr-importmap": "",
2144
- type: "importmap",
2145
- suppressHydrationWarning: true,
2146
- dangerouslySetInnerHTML: {
2147
- __html: JSON.stringify({
2148
- integrity: sri
2149
- })
2150
- }
2151
- }
2152
- ) : null, !enableFogOfWar ? /* @__PURE__ */ React8.createElement(
2153
- "link",
2154
- {
2155
- rel: "modulepreload",
2156
- href: manifest.url,
2157
- crossOrigin: scriptProps.crossOrigin,
2158
- integrity: sri[manifest.url],
2159
- suppressHydrationWarning: true
2160
- }
2161
- ) : null, /* @__PURE__ */ React8.createElement(
2162
- "link",
2163
- {
2164
- rel: "modulepreload",
2165
- href: manifest.entry.module,
2166
- crossOrigin: scriptProps.crossOrigin,
2167
- integrity: sri[manifest.entry.module],
2168
- suppressHydrationWarning: true
2169
- }
2170
- ), preloads.map((path) => /* @__PURE__ */ React8.createElement(
2171
- "link",
2172
- {
2173
- key: path,
2174
- rel: "modulepreload",
2175
- href: path,
2176
- crossOrigin: scriptProps.crossOrigin,
2177
- integrity: sri[path],
2178
- suppressHydrationWarning: true
2179
- }
2180
- )), initialScripts);
2181
- }
2182
- function dedupe(array) {
2183
- return [...new Set(array)];
2184
- }
2185
- function mergeRefs(...refs) {
2186
- return (value) => {
2187
- refs.forEach((ref) => {
2188
- if (typeof ref === "function") {
2189
- ref(value);
2190
- } else if (ref != null) {
2191
- ref.current = value;
2192
- }
2193
- });
2194
- };
2195
- }
2196
- (class extends React9.Component {
2197
- constructor(props) {
2198
- super(props);
2199
- this.state = { error: props.error || null, location: props.location };
2200
- }
2201
- static getDerivedStateFromError(error) {
2202
- return { error };
2203
- }
2204
- static getDerivedStateFromProps(props, state) {
2205
- if (state.location !== props.location) {
2206
- return { error: props.error || null, location: props.location };
2207
- }
2208
- return { error: props.error || state.error, location: state.location };
2209
- }
2210
- render() {
2211
- if (this.state.error) {
2212
- return /* @__PURE__ */ React9.createElement(
2213
- RemixRootDefaultErrorBoundary,
2214
- {
2215
- error: this.state.error,
2216
- isOutsideRemixApp: true
2217
- }
2218
- );
2219
- } else {
2220
- return this.props.children;
2221
- }
2222
- }
2223
- });
2224
- function RemixRootDefaultErrorBoundary({
2225
- error,
2226
- isOutsideRemixApp
2227
- }) {
2228
- console.error(error);
2229
- let heyDeveloper = /* @__PURE__ */ React9.createElement(
2230
- "script",
2231
- {
2232
- dangerouslySetInnerHTML: {
2233
- __html: `
2234
- console.log(
2235
- "💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
2236
- );
2237
- `
2238
- }
2239
- }
2240
- );
2241
- if (isRouteErrorResponse(error)) {
2242
- return /* @__PURE__ */ React9.createElement(BoundaryShell, { title: "Unhandled Thrown Response!" }, /* @__PURE__ */ React9.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), heyDeveloper );
2243
- }
2244
- let errorInstance;
2245
- if (error instanceof Error) {
2246
- errorInstance = error;
2247
- } else {
2248
- let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
2249
- errorInstance = new Error(errorString);
2250
- }
2251
- return /* @__PURE__ */ React9.createElement(
2252
- BoundaryShell,
2253
- {
2254
- title: "Application Error!",
2255
- isOutsideRemixApp
2256
- },
2257
- /* @__PURE__ */ React9.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"),
2258
- /* @__PURE__ */ React9.createElement(
2259
- "pre",
2260
- {
2261
- style: {
2262
- padding: "2rem",
2263
- background: "hsla(10, 50%, 50%, 0.1)",
2264
- color: "red",
2265
- overflow: "auto"
2266
- }
2267
- },
2268
- errorInstance.stack
2269
- ),
2270
- heyDeveloper
2271
- );
2272
- }
2273
- function BoundaryShell({
2274
- title,
2275
- renderScripts,
2276
- isOutsideRemixApp,
2277
- children
2278
- }) {
2279
- let { routeModules } = useFrameworkContext();
2280
- if (routeModules.root?.Layout && !isOutsideRemixApp) {
2281
- return children;
2282
- }
2283
- return /* @__PURE__ */ React9.createElement("html", { lang: "en" }, /* @__PURE__ */ React9.createElement("head", null, /* @__PURE__ */ React9.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React9.createElement(
2284
- "meta",
2285
- {
2286
- name: "viewport",
2287
- content: "width=device-width,initial-scale=1,viewport-fit=cover"
2288
- }
2289
- ), /* @__PURE__ */ React9.createElement("title", null, title)), /* @__PURE__ */ React9.createElement("body", null, /* @__PURE__ */ React9.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children, renderScripts ? /* @__PURE__ */ React9.createElement(Scripts, null) : null)));
2290
- }
2291
- const React10 = await importShared('react');
19
+ var reactJsxRuntime_production_min = {};
2292
20
 
2293
- var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
2294
- try {
2295
- if (isBrowser) {
2296
- window.__reactRouterVersion = // @ts-expect-error
2297
- "7.9.0";
2298
- }
2299
- } catch (e) {
2300
- }
2301
- function BrowserRouter({
2302
- basename,
2303
- children,
2304
- window: window2
2305
- }) {
2306
- let historyRef = React10.useRef();
2307
- if (historyRef.current == null) {
2308
- historyRef.current = createBrowserHistory({ window: window2, v5Compat: true });
2309
- }
2310
- let history = historyRef.current;
2311
- let [state, setStateImpl] = React10.useState({
2312
- action: history.action,
2313
- location: history.location
2314
- });
2315
- let setState = React10.useCallback(
2316
- (newState) => {
2317
- React10.startTransition(() => setStateImpl(newState));
2318
- },
2319
- [setStateImpl]
2320
- );
2321
- React10.useLayoutEffect(() => history.listen(setState), [history, setState]);
2322
- return /* @__PURE__ */ React10.createElement(
2323
- Router,
2324
- {
2325
- basename,
2326
- children,
2327
- location: state.location,
2328
- navigationType: state.action,
2329
- navigator: history
2330
- }
2331
- );
2332
- }
2333
- var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
2334
- var Link = React10.forwardRef(
2335
- function LinkWithRef({
2336
- onClick,
2337
- discover = "render",
2338
- prefetch = "none",
2339
- relative,
2340
- reloadDocument,
2341
- replace: replace2,
2342
- state,
2343
- target,
2344
- to,
2345
- preventScrollReset,
2346
- viewTransition,
2347
- ...rest
2348
- }, forwardedRef) {
2349
- let { basename } = React10.useContext(NavigationContext);
2350
- let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
2351
- let absoluteHref;
2352
- let isExternal = false;
2353
- if (typeof to === "string" && isAbsolute) {
2354
- absoluteHref = to;
2355
- if (isBrowser) {
2356
- try {
2357
- let currentUrl = new URL(window.location.href);
2358
- let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
2359
- let path = stripBasename(targetUrl.pathname, basename);
2360
- if (targetUrl.origin === currentUrl.origin && path != null) {
2361
- to = path + targetUrl.search + targetUrl.hash;
2362
- } else {
2363
- isExternal = true;
2364
- }
2365
- } catch (e) {
2366
- warning(
2367
- false,
2368
- `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
2369
- );
2370
- }
2371
- }
2372
- }
2373
- let href = useHref(to, { relative });
2374
- let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
2375
- prefetch,
2376
- rest
2377
- );
2378
- let internalOnClick = useLinkClickHandler(to, {
2379
- replace: replace2,
2380
- state,
2381
- target,
2382
- preventScrollReset,
2383
- relative,
2384
- viewTransition
2385
- });
2386
- function handleClick(event) {
2387
- if (onClick) onClick(event);
2388
- if (!event.defaultPrevented) {
2389
- internalOnClick(event);
2390
- }
2391
- }
2392
- let link = (
2393
- // eslint-disable-next-line jsx-a11y/anchor-has-content
2394
- /* @__PURE__ */ React10.createElement(
2395
- "a",
2396
- {
2397
- ...rest,
2398
- ...prefetchHandlers,
2399
- href: absoluteHref || href,
2400
- onClick: isExternal || reloadDocument ? onClick : handleClick,
2401
- ref: mergeRefs(forwardedRef, prefetchRef),
2402
- target,
2403
- "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
2404
- }
2405
- )
2406
- );
2407
- return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href })) : link;
2408
- }
2409
- );
2410
- Link.displayName = "Link";
2411
- var NavLink = React10.forwardRef(
2412
- function NavLinkWithRef({
2413
- "aria-current": ariaCurrentProp = "page",
2414
- caseSensitive = false,
2415
- className: classNameProp = "",
2416
- end = false,
2417
- style: styleProp,
2418
- to,
2419
- viewTransition,
2420
- children,
2421
- ...rest
2422
- }, ref) {
2423
- let path = useResolvedPath(to, { relative: rest.relative });
2424
- let location = useLocation();
2425
- let routerState = React10.useContext(DataRouterStateContext);
2426
- let { navigator, basename } = React10.useContext(NavigationContext);
2427
- let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
2428
- // eslint-disable-next-line react-hooks/rules-of-hooks
2429
- useViewTransitionState(path) && viewTransition === true;
2430
- let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
2431
- let locationPathname = location.pathname;
2432
- let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
2433
- if (!caseSensitive) {
2434
- locationPathname = locationPathname.toLowerCase();
2435
- nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
2436
- toPathname = toPathname.toLowerCase();
2437
- }
2438
- if (nextLocationPathname && basename) {
2439
- nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
2440
- }
2441
- const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
2442
- let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
2443
- let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
2444
- let renderProps = {
2445
- isActive,
2446
- isPending,
2447
- isTransitioning
2448
- };
2449
- let ariaCurrent = isActive ? ariaCurrentProp : void 0;
2450
- let className;
2451
- if (typeof classNameProp === "function") {
2452
- className = classNameProp(renderProps);
2453
- } else {
2454
- className = [
2455
- classNameProp,
2456
- isActive ? "active" : null,
2457
- isPending ? "pending" : null,
2458
- isTransitioning ? "transitioning" : null
2459
- ].filter(Boolean).join(" ");
2460
- }
2461
- let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
2462
- return /* @__PURE__ */ React10.createElement(
2463
- Link,
2464
- {
2465
- ...rest,
2466
- "aria-current": ariaCurrent,
2467
- className,
2468
- ref,
2469
- style,
2470
- to,
2471
- viewTransition
2472
- },
2473
- typeof children === "function" ? children(renderProps) : children
2474
- );
2475
- }
2476
- );
2477
- NavLink.displayName = "NavLink";
2478
- var Form = React10.forwardRef(
2479
- ({
2480
- discover = "render",
2481
- fetcherKey,
2482
- navigate,
2483
- reloadDocument,
2484
- replace: replace2,
2485
- state,
2486
- method = defaultMethod,
2487
- action,
2488
- onSubmit,
2489
- relative,
2490
- preventScrollReset,
2491
- viewTransition,
2492
- ...props
2493
- }, forwardedRef) => {
2494
- let submit = useSubmit();
2495
- let formAction = useFormAction(action, { relative });
2496
- let formMethod = method.toLowerCase() === "get" ? "get" : "post";
2497
- let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
2498
- let submitHandler = (event) => {
2499
- onSubmit && onSubmit(event);
2500
- if (event.defaultPrevented) return;
2501
- event.preventDefault();
2502
- let submitter = event.nativeEvent.submitter;
2503
- let submitMethod = submitter?.getAttribute("formmethod") || method;
2504
- submit(submitter || event.currentTarget, {
2505
- fetcherKey,
2506
- method: submitMethod,
2507
- navigate,
2508
- replace: replace2,
2509
- state,
2510
- relative,
2511
- preventScrollReset,
2512
- viewTransition
2513
- });
2514
- };
2515
- return /* @__PURE__ */ React10.createElement(
2516
- "form",
2517
- {
2518
- ref: forwardedRef,
2519
- method: formMethod,
2520
- action: formAction,
2521
- onSubmit: reloadDocument ? onSubmit : submitHandler,
2522
- ...props,
2523
- "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
2524
- }
2525
- );
2526
- }
2527
- );
2528
- Form.displayName = "Form";
2529
- function getDataRouterConsoleError2(hookName) {
2530
- return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
2531
- }
2532
- function useDataRouterContext3(hookName) {
2533
- let ctx = React10.useContext(DataRouterContext);
2534
- invariant(ctx, getDataRouterConsoleError2(hookName));
2535
- return ctx;
2536
- }
2537
- function useLinkClickHandler(to, {
2538
- target,
2539
- replace: replaceProp,
2540
- state,
2541
- preventScrollReset,
2542
- relative,
2543
- viewTransition
2544
- } = {}) {
2545
- let navigate = useNavigate();
2546
- let location = useLocation();
2547
- let path = useResolvedPath(to, { relative });
2548
- return React10.useCallback(
2549
- (event) => {
2550
- if (shouldProcessLinkClick(event, target)) {
2551
- event.preventDefault();
2552
- let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
2553
- navigate(to, {
2554
- replace: replace2,
2555
- state,
2556
- preventScrollReset,
2557
- relative,
2558
- viewTransition
2559
- });
2560
- }
2561
- },
2562
- [
2563
- location,
2564
- navigate,
2565
- path,
2566
- replaceProp,
2567
- state,
2568
- target,
2569
- to,
2570
- preventScrollReset,
2571
- relative,
2572
- viewTransition
2573
- ]
2574
- );
2575
- }
2576
- var fetcherId = 0;
2577
- var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
2578
- function useSubmit() {
2579
- let { router } = useDataRouterContext3(
2580
- "useSubmit"
2581
- /* UseSubmit */
2582
- );
2583
- let { basename } = React10.useContext(NavigationContext);
2584
- let currentRouteId = useRouteId();
2585
- return React10.useCallback(
2586
- async (target, options = {}) => {
2587
- let { action, method, encType, formData, body } = getFormSubmissionInfo(
2588
- target,
2589
- basename
2590
- );
2591
- if (options.navigate === false) {
2592
- let key = options.fetcherKey || getUniqueFetcherId();
2593
- await router.fetch(key, currentRouteId, options.action || action, {
2594
- preventScrollReset: options.preventScrollReset,
2595
- formData,
2596
- body,
2597
- formMethod: options.method || method,
2598
- formEncType: options.encType || encType,
2599
- flushSync: options.flushSync
2600
- });
2601
- } else {
2602
- await router.navigate(options.action || action, {
2603
- preventScrollReset: options.preventScrollReset,
2604
- formData,
2605
- body,
2606
- formMethod: options.method || method,
2607
- formEncType: options.encType || encType,
2608
- replace: options.replace,
2609
- state: options.state,
2610
- fromRouteId: currentRouteId,
2611
- flushSync: options.flushSync,
2612
- viewTransition: options.viewTransition
2613
- });
2614
- }
2615
- },
2616
- [router, basename, currentRouteId]
2617
- );
2618
- }
2619
- function useFormAction(action, { relative } = {}) {
2620
- let { basename } = React10.useContext(NavigationContext);
2621
- let routeContext = React10.useContext(RouteContext);
2622
- invariant(routeContext, "useFormAction must be used inside a RouteContext");
2623
- let [match] = routeContext.matches.slice(-1);
2624
- let path = { ...useResolvedPath(action ? action : ".", { relative }) };
2625
- let location = useLocation();
2626
- if (action == null) {
2627
- path.search = location.search;
2628
- let params = new URLSearchParams(path.search);
2629
- let indexValues = params.getAll("index");
2630
- let hasNakedIndexParam = indexValues.some((v) => v === "");
2631
- if (hasNakedIndexParam) {
2632
- params.delete("index");
2633
- indexValues.filter((v) => v).forEach((v) => params.append("index", v));
2634
- let qs = params.toString();
2635
- path.search = qs ? `?${qs}` : "";
2636
- }
2637
- }
2638
- if ((!action || action === ".") && match.route.index) {
2639
- path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
2640
- }
2641
- if (basename !== "/") {
2642
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
2643
- }
2644
- return createPath(path);
21
+ /**
22
+ * @license React
23
+ * react-jsx-runtime.production.min.js
24
+ *
25
+ * Copyright (c) Facebook, Inc. and its affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */
30
+
31
+ var hasRequiredReactJsxRuntime_production_min;
32
+
33
+ function requireReactJsxRuntime_production_min () {
34
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
35
+ hasRequiredReactJsxRuntime_production_min = 1;
36
+ var f=requireReact(),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
37
+ function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
38
+ return reactJsxRuntime_production_min;
2645
39
  }
2646
- function useViewTransitionState(to, { relative } = {}) {
2647
- let vtContext = React10.useContext(ViewTransitionContext);
2648
- invariant(
2649
- vtContext != null,
2650
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
2651
- );
2652
- let { basename } = useDataRouterContext3(
2653
- "useViewTransitionState"
2654
- /* useViewTransitionState */
2655
- );
2656
- let path = useResolvedPath(to, { relative });
2657
- if (!vtContext.isTransitioning) {
2658
- return false;
2659
- }
2660
- let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
2661
- let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
2662
- return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
40
+
41
+ var hasRequiredJsxRuntime;
42
+
43
+ function requireJsxRuntime () {
44
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
45
+ hasRequiredJsxRuntime = 1;
46
+ {
47
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
48
+ }
49
+ return jsxRuntime.exports;
2663
50
  }
2664
- await importShared('react');
2665
51
 
2666
- const scriptRel = 'modulepreload';const assetsURL = function(dep) { return "/"+dep };const seen = {};const __vitePreload = function preload(baseModule, deps, importerUrl) {
2667
- let promise = Promise.resolve();
2668
- if (false && deps && deps.length > 0) {
2669
- let allSettled2 = function(promises) {
2670
- return Promise.all(
2671
- promises.map(
2672
- (p) => Promise.resolve(p).then(
2673
- (value) => ({ status: "fulfilled", value }),
2674
- (reason) => ({ status: "rejected", reason })
2675
- )
2676
- )
2677
- );
2678
- };
2679
- document.getElementsByTagName("link");
2680
- const cspNonceMeta = document.querySelector(
2681
- "meta[property=csp-nonce]"
2682
- );
2683
- const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
2684
- promise = allSettled2(
2685
- deps.map((dep) => {
2686
- dep = assetsURL(dep);
2687
- if (dep in seen) return;
2688
- seen[dep] = true;
2689
- const isCss = dep.endsWith(".css");
2690
- const cssSelector = isCss ? '[rel="stylesheet"]' : "";
2691
- if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
2692
- return;
2693
- }
2694
- const link = document.createElement("link");
2695
- link.rel = isCss ? "stylesheet" : scriptRel;
2696
- if (!isCss) {
2697
- link.as = "script";
2698
- }
2699
- link.crossOrigin = "";
2700
- link.href = dep;
2701
- if (cspNonce) {
2702
- link.setAttribute("nonce", cspNonce);
2703
- }
2704
- document.head.appendChild(link);
2705
- if (isCss) {
2706
- return new Promise((res, rej) => {
2707
- link.addEventListener("load", res);
2708
- link.addEventListener(
2709
- "error",
2710
- () => rej(new Error(`Unable to preload CSS for ${dep}`))
2711
- );
2712
- });
2713
- }
2714
- })
2715
- );
2716
- }
2717
- function handlePreloadError(err) {
2718
- const e = new Event("vite:preloadError", {
2719
- cancelable: true
2720
- });
2721
- e.payload = err;
2722
- window.dispatchEvent(e);
2723
- if (!e.defaultPrevented) {
2724
- throw err;
2725
- }
2726
- }
2727
- return promise.then((res) => {
2728
- for (const item of res || []) {
2729
- if (item.status !== "rejected") continue;
2730
- handlePreloadError(item.reason);
2731
- }
2732
- return baseModule().catch(handlePreloadError);
2733
- });
2734
- };
52
+ var jsxRuntimeExports = exports("j", requireJsxRuntime());
2735
53
 
2736
54
  var Jd = (e) => {
2737
55
  throw TypeError(e);
@@ -5059,7 +2377,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
5059
2377
  n
5060
2378
  );
5061
2379
  }
5062
- const FR = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2380
+ const FR = exports("F", /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5063
2381
  __proto__: null,
5064
2382
  CancelledError: fc,
5065
2383
  HydrationBoundary: EO,
@@ -5108,7 +2426,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
5108
2426
  useSuspenseInfiniteQuery: yO,
5109
2427
  useSuspenseQueries: mO,
5110
2428
  useSuspenseQuery: vO
5111
- }, Symbol.toStringTag, { value: "Module" }));
2429
+ }, Symbol.toStringTag, { value: "Module" })));
5112
2430
  function Ep(e, n) {
5113
2431
  return function() {
5114
2432
  return e.apply(n, arguments);
@@ -12590,70 +9908,9 @@ function print() { __p += __j.call(arguments, '') }
12590
9908
  xe.registerSymbol = xe.defaultInstance.registerSymbol.bind(xe.defaultInstance);
12591
9909
  xe.registerCustom = xe.defaultInstance.registerCustom.bind(xe.defaultInstance);
12592
9910
  xe.allowErrorProps = xe.defaultInstance.allowErrorProps.bind(xe.defaultInstance);
12593
- var PA = function() {
9911
+ var PA = exports("P", function() {
12594
9912
  return null;
12595
- } ;
12596
-
12597
- const {lazy} = await importShared('react');
12598
- const Home = lazy(() => __vitePreload(() => module.import('./home-DhyEFlEc.js'),false ?__VITE_PRELOAD__:void 0));
12599
- function RouteConfig() {
12600
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Routes, { children: [
12601
- /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: "/", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Home, {}) }),
12602
- /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: "*", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Navigate, { to: "/", replace: true }) })
12603
- ] });
12604
- }
12605
-
12606
- const {Suspense,useEffect,useState} = await importShared('react');
12607
- const { QueryClient, QueryClientProvider } = FR;
12608
- function App(props) {
12609
- const [queryClient] = useState(() => new QueryClient({
12610
- defaultOptions: {
12611
- queries: {
12612
- staleTime: 60 * 1e3,
12613
- // 1 minute
12614
- refetchOnWindowFocus: false
12615
- }
12616
- }
12617
- }));
12618
- useEffect(() => {
12619
- let copaUser = {};
12620
- try {
12621
- const copaToken = "your_base64_encoded_token_here" ? atob("your_base64_encoded_token_here") : "{}";
12622
- copaUser = JSON.parse(copaToken);
12623
- } catch (error) {
12624
- console.warn("Failed to parse VITE_BLUECOPA_API_TOKEN:", error);
12625
- }
12626
- console.log("props aaaa", props);
12627
- s1({
12628
- apiBaseUrl: props.apiBaseUrl || "http://localhost:3000/api/v1",
12629
- workspaceId: props.workspaceId || "your_workspace_id_here",
12630
- accessToken: props.accessToken || copaUser?.accessToken || "",
12631
- userId: props.userId || ""
12632
- });
12633
- }, []);
12634
- return /* @__PURE__ */ jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-sm text-muted-foreground", children: "Loading…" }), children: [
12635
- /* @__PURE__ */ jsxRuntimeExports.jsx(RouteConfig, {}),
12636
- /* @__PURE__ */ jsxRuntimeExports.jsx(PA, { initialIsOpen: false })
12637
- ] }) });
12638
- }
12639
-
12640
- var client = {};
12641
-
12642
- var hasRequiredClient;
12643
-
12644
- function requireClient () {
12645
- if (hasRequiredClient) return client;
12646
- hasRequiredClient = 1;
12647
- var m = requireReactDom();
12648
- {
12649
- client.createRoot = m.createRoot;
12650
- client.hydrateRoot = m.hydrateRoot;
12651
- }
12652
- return client;
12653
- }
12654
-
12655
- var clientExports = exports("c", requireClient());
12656
- const ReactDOM = exports("R", /*@__PURE__*/getDefaultExportFromCjs(clientExports));
9913
+ } );
12657
9914
 
12658
9915
  })
12659
9916
  };