@hortiview/modulebase 0.0.1

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 (56) hide show
  1. package/README.md +8 -0
  2. package/dist/QueryClientProvider-DQv4Y3Qu.js +707 -0
  3. package/dist/_baseGet-Bh5zJ_C8.js +805 -0
  4. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  5. package/dist/chunk-IR6S3I6Y-BvQXS3A3.js +3908 -0
  6. package/dist/components/ModuleBase.d.ts +11 -0
  7. package/dist/components/ModuleBase.js +691 -0
  8. package/dist/constants.d.ts +25 -0
  9. package/dist/constants.js +34 -0
  10. package/dist/fetches-DUCQo_6B.js +477 -0
  11. package/dist/hooks/useBreadcrumbTranslation.d.ts +1 -0
  12. package/dist/hooks/useBreadcrumbTranslation.js +20 -0
  13. package/dist/hooks/useCustom.d.ts +6 -0
  14. package/dist/hooks/useCustom.js +19 -0
  15. package/dist/hooks/useEntity.d.ts +186 -0
  16. package/dist/hooks/useEntity.js +58 -0
  17. package/dist/hooks/useNavigate.d.ts +5 -0
  18. package/dist/hooks/useNavigate.js +27 -0
  19. package/dist/hooks/useOption.d.ts +17 -0
  20. package/dist/hooks/useOption.js +23 -0
  21. package/dist/hooks/useSignalRMessages.d.ts +6 -0
  22. package/dist/hooks/useSignalRMessages.js +13 -0
  23. package/dist/hooks/useStores.d.ts +29 -0
  24. package/dist/hooks/useStores.js +844 -0
  25. package/dist/main.d.ts +9 -0
  26. package/dist/main.js +19 -0
  27. package/dist/provider/SignalR/SignalRProvider.d.ts +13 -0
  28. package/dist/provider/SignalR/SignalRProvider.js +6408 -0
  29. package/dist/provider/SignalR/signalR.d.ts +53 -0
  30. package/dist/provider/SignalR/signalR.js +11 -0
  31. package/dist/react-QiIgv49H.js +27 -0
  32. package/dist/stores/BasePropsStore.d.ts +6 -0
  33. package/dist/stores/BasePropsStore.js +7 -0
  34. package/dist/stores/EnvironmentStore.d.ts +8 -0
  35. package/dist/stores/EnvironmentStore.js +9 -0
  36. package/dist/types/AppInsights.d.ts +12 -0
  37. package/dist/types/AppInsights.js +1 -0
  38. package/dist/types/BaseProps.d.ts +38 -0
  39. package/dist/types/BaseProps.js +1 -0
  40. package/dist/types/CommonOptions.d.ts +61 -0
  41. package/dist/types/CommonOptions.js +4 -0
  42. package/dist/types/Deprecated.d.ts +93 -0
  43. package/dist/types/Deprecated.js +1 -0
  44. package/dist/types/Environment.d.ts +17 -0
  45. package/dist/types/Environment.js +1 -0
  46. package/dist/types/ModuleApi.d.ts +80 -0
  47. package/dist/types/ModuleApi.js +1 -0
  48. package/dist/types/Requests.d.ts +49 -0
  49. package/dist/types/Requests.js +4 -0
  50. package/dist/types/SystemMessage.d.ts +14 -0
  51. package/dist/types/SystemMessage.js +1 -0
  52. package/dist/useQuery-znAyMQW1.js +397 -0
  53. package/dist/utils/fetches.d.ts +26 -0
  54. package/dist/utils/fetches.js +16 -0
  55. package/dist/vite-env.d.js +1 -0
  56. package/package.json +55 -0
@@ -0,0 +1,3908 @@
1
+ import * as m from "react";
2
+ var He = {}, Gt;
3
+ function Qr() {
4
+ if (Gt) return He;
5
+ Gt = 1, Object.defineProperty(He, "__esModule", { value: !0 }), He.parse = l, He.serialize = c;
6
+ const e = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/, t = /^[\u0021-\u003A\u003C-\u007E]*$/, r = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i, a = /^[\u0020-\u003A\u003D-\u007E]*$/, n = Object.prototype.toString, i = /* @__PURE__ */ (() => {
7
+ const g = function() {
8
+ };
9
+ return g.prototype = /* @__PURE__ */ Object.create(null), g;
10
+ })();
11
+ function l(g, p) {
12
+ const v = new i(), L = g.length;
13
+ if (L < 2)
14
+ return v;
15
+ const x = p?.decode || y;
16
+ let E = 0;
17
+ do {
18
+ const C = g.indexOf("=", E);
19
+ if (C === -1)
20
+ break;
21
+ const T = g.indexOf(";", E), N = T === -1 ? L : T;
22
+ if (C > N) {
23
+ E = g.lastIndexOf(";", C - 1) + 1;
24
+ continue;
25
+ }
26
+ const O = s(g, E, C), f = u(g, C, O), A = g.slice(O, f);
27
+ if (v[A] === void 0) {
28
+ let I = s(g, C + 1, N), $ = u(g, N, I);
29
+ const W = x(g.slice(I, $));
30
+ v[A] = W;
31
+ }
32
+ E = N + 1;
33
+ } while (E < L);
34
+ return v;
35
+ }
36
+ function s(g, p, v) {
37
+ do {
38
+ const L = g.charCodeAt(p);
39
+ if (L !== 32 && L !== 9)
40
+ return p;
41
+ } while (++p < v);
42
+ return v;
43
+ }
44
+ function u(g, p, v) {
45
+ for (; p > v; ) {
46
+ const L = g.charCodeAt(--p);
47
+ if (L !== 32 && L !== 9)
48
+ return p + 1;
49
+ }
50
+ return v;
51
+ }
52
+ function c(g, p, v) {
53
+ const L = v?.encode || encodeURIComponent;
54
+ if (!e.test(g))
55
+ throw new TypeError(`argument name is invalid: ${g}`);
56
+ const x = L(p);
57
+ if (!t.test(x))
58
+ throw new TypeError(`argument val is invalid: ${p}`);
59
+ let E = g + "=" + x;
60
+ if (!v)
61
+ return E;
62
+ if (v.maxAge !== void 0) {
63
+ if (!Number.isInteger(v.maxAge))
64
+ throw new TypeError(`option maxAge is invalid: ${v.maxAge}`);
65
+ E += "; Max-Age=" + v.maxAge;
66
+ }
67
+ if (v.domain) {
68
+ if (!r.test(v.domain))
69
+ throw new TypeError(`option domain is invalid: ${v.domain}`);
70
+ E += "; Domain=" + v.domain;
71
+ }
72
+ if (v.path) {
73
+ if (!a.test(v.path))
74
+ throw new TypeError(`option path is invalid: ${v.path}`);
75
+ E += "; Path=" + v.path;
76
+ }
77
+ if (v.expires) {
78
+ if (!b(v.expires) || !Number.isFinite(v.expires.valueOf()))
79
+ throw new TypeError(`option expires is invalid: ${v.expires}`);
80
+ E += "; Expires=" + v.expires.toUTCString();
81
+ }
82
+ if (v.httpOnly && (E += "; HttpOnly"), v.secure && (E += "; Secure"), v.partitioned && (E += "; Partitioned"), v.priority)
83
+ switch (typeof v.priority == "string" ? v.priority.toLowerCase() : void 0) {
84
+ case "low":
85
+ E += "; Priority=Low";
86
+ break;
87
+ case "medium":
88
+ E += "; Priority=Medium";
89
+ break;
90
+ case "high":
91
+ E += "; Priority=High";
92
+ break;
93
+ default:
94
+ throw new TypeError(`option priority is invalid: ${v.priority}`);
95
+ }
96
+ if (v.sameSite)
97
+ switch (typeof v.sameSite == "string" ? v.sameSite.toLowerCase() : v.sameSite) {
98
+ case !0:
99
+ case "strict":
100
+ E += "; SameSite=Strict";
101
+ break;
102
+ case "lax":
103
+ E += "; SameSite=Lax";
104
+ break;
105
+ case "none":
106
+ E += "; SameSite=None";
107
+ break;
108
+ default:
109
+ throw new TypeError(`option sameSite is invalid: ${v.sameSite}`);
110
+ }
111
+ return E;
112
+ }
113
+ function y(g) {
114
+ if (g.indexOf("%") === -1)
115
+ return g;
116
+ try {
117
+ return decodeURIComponent(g);
118
+ } catch {
119
+ return g;
120
+ }
121
+ }
122
+ function b(g) {
123
+ return n.call(g) === "[object Date]";
124
+ }
125
+ return He;
126
+ }
127
+ Qr();
128
+ /**
129
+ * react-router v7.1.5
130
+ *
131
+ * Copyright (c) Remix Software Inc.
132
+ *
133
+ * This source code is licensed under the MIT license found in the
134
+ * LICENSE.md file in the root directory of this source tree.
135
+ *
136
+ * @license MIT
137
+ */
138
+ var Xt = "popstate";
139
+ function qr(e = {}) {
140
+ function t(a, n) {
141
+ let { pathname: i, search: l, hash: s } = a.location;
142
+ return Ve(
143
+ "",
144
+ { pathname: i, search: l, hash: s },
145
+ // state defaults to `null` because `window.history.state` does
146
+ n.state && n.state.usr || null,
147
+ n.state && n.state.key || "default"
148
+ );
149
+ }
150
+ function r(a, n) {
151
+ return typeof n == "string" ? n : pe(n);
152
+ }
153
+ return en(
154
+ t,
155
+ r,
156
+ null,
157
+ e
158
+ );
159
+ }
160
+ function U(e, t) {
161
+ if (e === !1 || e === null || typeof e > "u")
162
+ throw new Error(t);
163
+ }
164
+ function G(e, t) {
165
+ if (!e) {
166
+ typeof console < "u" && console.warn(t);
167
+ try {
168
+ throw new Error(t);
169
+ } catch {
170
+ }
171
+ }
172
+ }
173
+ function Zr() {
174
+ return Math.random().toString(36).substring(2, 10);
175
+ }
176
+ function Qt(e, t) {
177
+ return {
178
+ usr: e.state,
179
+ key: e.key,
180
+ idx: t
181
+ };
182
+ }
183
+ function Ve(e, t, r = null, a) {
184
+ return {
185
+ pathname: typeof e == "string" ? e : e.pathname,
186
+ search: "",
187
+ hash: "",
188
+ ...typeof t == "string" ? ye(t) : t,
189
+ state: r,
190
+ // TODO: This could be cleaned up. push/replace should probably just take
191
+ // full Locations now and avoid the need to run through this flow at all
192
+ // But that's a pretty big refactor to the current test suite so going to
193
+ // keep as is for the time being and just let any incoming keys take precedence
194
+ key: t && t.key || a || Zr()
195
+ };
196
+ }
197
+ function pe({
198
+ pathname: e = "/",
199
+ search: t = "",
200
+ hash: r = ""
201
+ }) {
202
+ return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), r && r !== "#" && (e += r.charAt(0) === "#" ? r : "#" + r), e;
203
+ }
204
+ function ye(e) {
205
+ let t = {};
206
+ if (e) {
207
+ let r = e.indexOf("#");
208
+ r >= 0 && (t.hash = e.substring(r), e = e.substring(0, r));
209
+ let a = e.indexOf("?");
210
+ a >= 0 && (t.search = e.substring(a), e = e.substring(0, a)), e && (t.pathname = e);
211
+ }
212
+ return t;
213
+ }
214
+ function en(e, t, r, a = {}) {
215
+ let { window: n = document.defaultView, v5Compat: i = !1 } = a, l = n.history, s = "POP", u = null, c = y();
216
+ c == null && (c = 0, l.replaceState({ ...l.state, idx: c }, ""));
217
+ function y() {
218
+ return (l.state || { idx: null }).idx;
219
+ }
220
+ function b() {
221
+ s = "POP";
222
+ let x = y(), E = x == null ? null : x - c;
223
+ c = x, u && u({ action: s, location: L.location, delta: E });
224
+ }
225
+ function g(x, E) {
226
+ s = "PUSH";
227
+ let C = Ve(L.location, x, E);
228
+ c = y() + 1;
229
+ let T = Qt(C, c), N = L.createHref(C);
230
+ try {
231
+ l.pushState(T, "", N);
232
+ } catch (O) {
233
+ if (O instanceof DOMException && O.name === "DataCloneError")
234
+ throw O;
235
+ n.location.assign(N);
236
+ }
237
+ i && u && u({ action: s, location: L.location, delta: 1 });
238
+ }
239
+ function p(x, E) {
240
+ s = "REPLACE";
241
+ let C = Ve(L.location, x, E);
242
+ c = y();
243
+ let T = Qt(C, c), N = L.createHref(C);
244
+ l.replaceState(T, "", N), i && u && u({ action: s, location: L.location, delta: 0 });
245
+ }
246
+ function v(x) {
247
+ let E = n.location.origin !== "null" ? n.location.origin : n.location.href, C = typeof x == "string" ? x : pe(x);
248
+ return C = C.replace(/ $/, "%20"), U(
249
+ E,
250
+ `No window.location.(origin|href) available to create URL for href: ${C}`
251
+ ), new URL(C, E);
252
+ }
253
+ let L = {
254
+ get action() {
255
+ return s;
256
+ },
257
+ get location() {
258
+ return e(n, l);
259
+ },
260
+ listen(x) {
261
+ if (u)
262
+ throw new Error("A history only accepts one active listener");
263
+ return n.addEventListener(Xt, b), u = x, () => {
264
+ n.removeEventListener(Xt, b), u = null;
265
+ };
266
+ },
267
+ createHref(x) {
268
+ return t(n, x);
269
+ },
270
+ createURL: v,
271
+ encodeLocation(x) {
272
+ let E = v(x);
273
+ return {
274
+ pathname: E.pathname,
275
+ search: E.search,
276
+ hash: E.hash
277
+ };
278
+ },
279
+ push: g,
280
+ replace: p,
281
+ go(x) {
282
+ return l.go(x);
283
+ }
284
+ };
285
+ return L;
286
+ }
287
+ var tn = /* @__PURE__ */ new Set([
288
+ "lazy",
289
+ "caseSensitive",
290
+ "path",
291
+ "id",
292
+ "index",
293
+ "children"
294
+ ]);
295
+ function rn(e) {
296
+ return e.index === !0;
297
+ }
298
+ function ct(e, t, r = [], a = {}) {
299
+ return e.map((n, i) => {
300
+ let l = [...r, String(i)], s = typeof n.id == "string" ? n.id : l.join("-");
301
+ if (U(
302
+ n.index !== !0 || !n.children,
303
+ "Cannot specify children on an index route"
304
+ ), U(
305
+ !a[s],
306
+ `Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`
307
+ ), rn(n)) {
308
+ let u = {
309
+ ...n,
310
+ ...t(n),
311
+ id: s
312
+ };
313
+ return a[s] = u, u;
314
+ } else {
315
+ let u = {
316
+ ...n,
317
+ ...t(n),
318
+ id: s,
319
+ children: void 0
320
+ };
321
+ return a[s] = u, n.children && (u.children = ct(
322
+ n.children,
323
+ t,
324
+ l,
325
+ a
326
+ )), u;
327
+ }
328
+ });
329
+ }
330
+ function me(e, t, r = "/") {
331
+ return st(e, t, r, !1);
332
+ }
333
+ function st(e, t, r, a) {
334
+ let n = typeof t == "string" ? ye(t) : t, i = re(n.pathname || "/", r);
335
+ if (i == null)
336
+ return null;
337
+ let l = yr(e);
338
+ an(l);
339
+ let s = null;
340
+ for (let u = 0; s == null && u < l.length; ++u) {
341
+ let c = yn(i);
342
+ s = mn(
343
+ l[u],
344
+ c,
345
+ a
346
+ );
347
+ }
348
+ return s;
349
+ }
350
+ function nn(e, t) {
351
+ let { route: r, pathname: a, params: n } = e;
352
+ return {
353
+ id: r.id,
354
+ pathname: a,
355
+ params: n,
356
+ data: t[r.id],
357
+ handle: r.handle
358
+ };
359
+ }
360
+ function yr(e, t = [], r = [], a = "") {
361
+ let n = (i, l, s) => {
362
+ let u = {
363
+ relativePath: s === void 0 ? i.path || "" : s,
364
+ caseSensitive: i.caseSensitive === !0,
365
+ childrenIndex: l,
366
+ route: i
367
+ };
368
+ u.relativePath.startsWith("/") && (U(
369
+ u.relativePath.startsWith(a),
370
+ `Absolute route path "${u.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
371
+ ), u.relativePath = u.relativePath.slice(a.length));
372
+ let c = ie([a, u.relativePath]), y = r.concat(u);
373
+ i.children && i.children.length > 0 && (U(
374
+ // Our types know better, but runtime JS may not!
375
+ // @ts-expect-error
376
+ i.index !== !0,
377
+ `Index routes must not have child routes. Please remove all child routes from route path "${c}".`
378
+ ), yr(i.children, t, y, c)), !(i.path == null && !i.index) && t.push({
379
+ path: c,
380
+ score: fn(c, i.index),
381
+ routesMeta: y
382
+ });
383
+ };
384
+ return e.forEach((i, l) => {
385
+ if (i.path === "" || !i.path?.includes("?"))
386
+ n(i, l);
387
+ else
388
+ for (let s of gr(i.path))
389
+ n(i, l, s);
390
+ }), t;
391
+ }
392
+ function gr(e) {
393
+ let t = e.split("/");
394
+ if (t.length === 0) return [];
395
+ let [r, ...a] = t, n = r.endsWith("?"), i = r.replace(/\?$/, "");
396
+ if (a.length === 0)
397
+ return n ? [i, ""] : [i];
398
+ let l = gr(a.join("/")), s = [];
399
+ return s.push(
400
+ ...l.map(
401
+ (u) => u === "" ? i : [i, u].join("/")
402
+ )
403
+ ), n && s.push(...l), s.map(
404
+ (u) => e.startsWith("/") && u === "" ? "/" : u
405
+ );
406
+ }
407
+ function an(e) {
408
+ e.sort(
409
+ (t, r) => t.score !== r.score ? r.score - t.score : hn(
410
+ t.routesMeta.map((a) => a.childrenIndex),
411
+ r.routesMeta.map((a) => a.childrenIndex)
412
+ )
413
+ );
414
+ }
415
+ var on = /^:[\w-]+$/, ln = 3, sn = 2, un = 1, dn = 10, cn = -2, qt = (e) => e === "*";
416
+ function fn(e, t) {
417
+ let r = e.split("/"), a = r.length;
418
+ return r.some(qt) && (a += cn), t && (a += sn), r.filter((n) => !qt(n)).reduce(
419
+ (n, i) => n + (on.test(i) ? ln : i === "" ? un : dn),
420
+ a
421
+ );
422
+ }
423
+ function hn(e, t) {
424
+ return e.length === t.length && e.slice(0, -1).every((a, n) => a === t[n]) ? (
425
+ // If two routes are siblings, we should try to match the earlier sibling
426
+ // first. This allows people to have fine-grained control over the matching
427
+ // behavior by simply putting routes with identical paths in the order they
428
+ // want them tried.
429
+ e[e.length - 1] - t[t.length - 1]
430
+ ) : (
431
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
432
+ // so they sort equally.
433
+ 0
434
+ );
435
+ }
436
+ function mn(e, t, r = !1) {
437
+ let { routesMeta: a } = e, n = {}, i = "/", l = [];
438
+ for (let s = 0; s < a.length; ++s) {
439
+ let u = a[s], c = s === a.length - 1, y = i === "/" ? t : t.slice(i.length) || "/", b = ft(
440
+ { path: u.relativePath, caseSensitive: u.caseSensitive, end: c },
441
+ y
442
+ ), g = u.route;
443
+ if (!b && c && r && !a[a.length - 1].route.index && (b = ft(
444
+ {
445
+ path: u.relativePath,
446
+ caseSensitive: u.caseSensitive,
447
+ end: !1
448
+ },
449
+ y
450
+ )), !b)
451
+ return null;
452
+ Object.assign(n, b.params), l.push({
453
+ // TODO: Can this as be avoided?
454
+ params: n,
455
+ pathname: ie([i, b.pathname]),
456
+ pathnameBase: wn(
457
+ ie([i, b.pathnameBase])
458
+ ),
459
+ route: g
460
+ }), b.pathnameBase !== "/" && (i = ie([i, b.pathnameBase]));
461
+ }
462
+ return l;
463
+ }
464
+ function ft(e, t) {
465
+ typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
466
+ let [r, a] = pn(
467
+ e.path,
468
+ e.caseSensitive,
469
+ e.end
470
+ ), n = t.match(r);
471
+ if (!n) return null;
472
+ let i = n[0], l = i.replace(/(.)\/+$/, "$1"), s = n.slice(1);
473
+ return {
474
+ params: a.reduce(
475
+ (c, { paramName: y, isOptional: b }, g) => {
476
+ if (y === "*") {
477
+ let v = s[g] || "";
478
+ l = i.slice(0, i.length - v.length).replace(/(.)\/+$/, "$1");
479
+ }
480
+ const p = s[g];
481
+ return b && !p ? c[y] = void 0 : c[y] = (p || "").replace(/%2F/g, "/"), c;
482
+ },
483
+ {}
484
+ ),
485
+ pathname: i,
486
+ pathnameBase: l,
487
+ pattern: e
488
+ };
489
+ }
490
+ function pn(e, t = !1, r = !0) {
491
+ G(
492
+ e === "*" || !e.endsWith("*") || e.endsWith("/*"),
493
+ `Route path "${e}" will be treated as if it were "${e.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/, "/*")}".`
494
+ );
495
+ let a = [], n = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
496
+ /\/:([\w-]+)(\?)?/g,
497
+ (l, s, u) => (a.push({ paramName: s, isOptional: u != null }), u ? "/?([^\\/]+)?" : "/([^\\/]+)")
498
+ );
499
+ return e.endsWith("*") ? (a.push({ paramName: "*" }), n += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? n += "\\/*$" : e !== "" && e !== "/" && (n += "(?:(?=\\/|$))"), [new RegExp(n, t ? void 0 : "i"), a];
500
+ }
501
+ function yn(e) {
502
+ try {
503
+ return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
504
+ } catch (t) {
505
+ return G(
506
+ !1,
507
+ `The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`
508
+ ), e;
509
+ }
510
+ }
511
+ function re(e, t) {
512
+ if (t === "/") return e;
513
+ if (!e.toLowerCase().startsWith(t.toLowerCase()))
514
+ return null;
515
+ let r = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(r);
516
+ return a && a !== "/" ? null : e.slice(r) || "/";
517
+ }
518
+ function gn(e, t = "/") {
519
+ let {
520
+ pathname: r,
521
+ search: a = "",
522
+ hash: n = ""
523
+ } = typeof e == "string" ? ye(e) : e;
524
+ return {
525
+ pathname: r ? r.startsWith("/") ? r : vn(r, t) : t,
526
+ search: bn(a),
527
+ hash: En(n)
528
+ };
529
+ }
530
+ function vn(e, t) {
531
+ let r = t.replace(/\/+$/, "").split("/");
532
+ return e.split("/").forEach((n) => {
533
+ n === ".." ? r.length > 1 && r.pop() : n !== "." && r.push(n);
534
+ }), r.length > 1 ? r.join("/") : "/";
535
+ }
536
+ function bt(e, t, r, a) {
537
+ return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
538
+ a
539
+ )}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
540
+ }
541
+ function vr(e) {
542
+ return e.filter(
543
+ (t, r) => r === 0 || t.route.path && t.route.path.length > 0
544
+ );
545
+ }
546
+ function Pt(e) {
547
+ let t = vr(e);
548
+ return t.map(
549
+ (r, a) => a === t.length - 1 ? r.pathname : r.pathnameBase
550
+ );
551
+ }
552
+ function Dt(e, t, r, a = !1) {
553
+ let n;
554
+ typeof e == "string" ? n = ye(e) : (n = { ...e }, U(
555
+ !n.pathname || !n.pathname.includes("?"),
556
+ bt("?", "pathname", "search", n)
557
+ ), U(
558
+ !n.pathname || !n.pathname.includes("#"),
559
+ bt("#", "pathname", "hash", n)
560
+ ), U(
561
+ !n.search || !n.search.includes("#"),
562
+ bt("#", "search", "hash", n)
563
+ ));
564
+ let i = e === "" || n.pathname === "", l = i ? "/" : n.pathname, s;
565
+ if (l == null)
566
+ s = r;
567
+ else {
568
+ let b = t.length - 1;
569
+ if (!a && l.startsWith("..")) {
570
+ let g = l.split("/");
571
+ for (; g[0] === ".."; )
572
+ g.shift(), b -= 1;
573
+ n.pathname = g.join("/");
574
+ }
575
+ s = b >= 0 ? t[b] : "/";
576
+ }
577
+ let u = gn(n, s), c = l && l !== "/" && l.endsWith("/"), y = (i || l === ".") && r.endsWith("/");
578
+ return !u.pathname.endsWith("/") && (c || y) && (u.pathname += "/"), u;
579
+ }
580
+ var ie = (e) => e.join("/").replace(/\/\/+/g, "/"), wn = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), bn = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, En = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, ht = class {
581
+ constructor(e, t, r, a = !1) {
582
+ this.status = e, this.statusText = t || "", this.internal = a, r instanceof Error ? (this.data = r.toString(), this.error = r) : this.data = r;
583
+ }
584
+ };
585
+ function Ke(e) {
586
+ return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
587
+ }
588
+ var wr = [
589
+ "POST",
590
+ "PUT",
591
+ "PATCH",
592
+ "DELETE"
593
+ ], Rn = new Set(
594
+ wr
595
+ ), xn = [
596
+ "GET",
597
+ ...wr
598
+ ], Sn = new Set(xn), Ln = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]), Cn = /* @__PURE__ */ new Set([307, 308]), Et = {
599
+ state: "idle",
600
+ location: void 0,
601
+ formMethod: void 0,
602
+ formAction: void 0,
603
+ formEncType: void 0,
604
+ formData: void 0,
605
+ json: void 0,
606
+ text: void 0
607
+ }, Pn = {
608
+ state: "idle",
609
+ data: void 0,
610
+ formMethod: void 0,
611
+ formAction: void 0,
612
+ formEncType: void 0,
613
+ formData: void 0,
614
+ json: void 0,
615
+ text: void 0
616
+ }, ze = {
617
+ state: "unblocked",
618
+ proceed: void 0,
619
+ reset: void 0,
620
+ location: void 0
621
+ }, Mt = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, Dn = (e) => ({
622
+ hasErrorBoundary: !!e.hasErrorBoundary
623
+ }), br = "remix-router-transitions", Er = Symbol("ResetLoaderData");
624
+ function Mn(e) {
625
+ const t = e.window ? e.window : typeof window < "u" ? window : void 0, r = typeof t < "u" && typeof t.document < "u" && typeof t.document.createElement < "u";
626
+ U(
627
+ e.routes.length > 0,
628
+ "You must provide a non-empty routes array to createRouter"
629
+ );
630
+ let a = e.mapRouteProperties || Dn, n = {}, i = ct(
631
+ e.routes,
632
+ a,
633
+ void 0,
634
+ n
635
+ ), l, s = e.basename || "/", u = e.dataStrategy || Un, c = e.patchRoutesOnNavigation, y = {
636
+ ...e.future
637
+ }, b = null, g = /* @__PURE__ */ new Set(), p = null, v = null, L = null, x = e.hydrationData != null, E = me(i, e.history.location, s), C = !1, T = null;
638
+ if (E == null && !c) {
639
+ let o = ee(404, {
640
+ pathname: e.history.location.pathname
641
+ }), { matches: d, route: h } = ur(i);
642
+ E = d, T = { [h.id]: o };
643
+ }
644
+ E && !e.hydrationData && tt(
645
+ E,
646
+ i,
647
+ e.history.location.pathname
648
+ ).active && (E = null);
649
+ let N;
650
+ if (E)
651
+ if (E.some((o) => o.route.lazy))
652
+ N = !1;
653
+ else if (!E.some((o) => o.route.loader))
654
+ N = !0;
655
+ else {
656
+ let o = e.hydrationData ? e.hydrationData.loaderData : null, d = e.hydrationData ? e.hydrationData.errors : null;
657
+ if (d) {
658
+ let h = E.findIndex(
659
+ (w) => d[w.route.id] !== void 0
660
+ );
661
+ N = E.slice(0, h + 1).every((w) => !Lt(w.route, o, d));
662
+ } else
663
+ N = E.every(
664
+ (h) => !Lt(h.route, o, d)
665
+ );
666
+ }
667
+ else {
668
+ N = !1, E = [];
669
+ let o = tt(
670
+ null,
671
+ i,
672
+ e.history.location.pathname
673
+ );
674
+ o.active && o.matches && (C = !0, E = o.matches);
675
+ }
676
+ let O, f = {
677
+ historyAction: e.history.action,
678
+ location: e.history.location,
679
+ matches: E,
680
+ initialized: N,
681
+ navigation: Et,
682
+ // Don't restore on initial updateState() if we were SSR'd
683
+ restoreScrollPosition: e.hydrationData != null ? !1 : null,
684
+ preventScrollReset: !1,
685
+ revalidation: "idle",
686
+ loaderData: e.hydrationData && e.hydrationData.loaderData || {},
687
+ actionData: e.hydrationData && e.hydrationData.actionData || null,
688
+ errors: e.hydrationData && e.hydrationData.errors || T,
689
+ fetchers: /* @__PURE__ */ new Map(),
690
+ blockers: /* @__PURE__ */ new Map()
691
+ }, A = "POP", I = !1, $, W = !1, Q = /* @__PURE__ */ new Map(), ke = null, Xe = !1, ge = !1, Qe = /* @__PURE__ */ new Set(), Y = /* @__PURE__ */ new Map(), qe = 0, $e = -1, Ce = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Set(), Pe = /* @__PURE__ */ new Map(), Ue = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Set(), ve = /* @__PURE__ */ new Map(), Ze, Ne = null;
692
+ function Ur() {
693
+ if (b = e.history.listen(
694
+ ({ action: o, location: d, delta: h }) => {
695
+ if (Ze) {
696
+ Ze(), Ze = void 0;
697
+ return;
698
+ }
699
+ G(
700
+ ve.size === 0 || h != null,
701
+ "You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL."
702
+ );
703
+ let w = Vt({
704
+ currentLocation: f.location,
705
+ nextLocation: d,
706
+ historyAction: o
707
+ });
708
+ if (w && h != null) {
709
+ let S = new Promise((M) => {
710
+ Ze = M;
711
+ });
712
+ e.history.go(h * -1), et(w, {
713
+ state: "blocked",
714
+ location: d,
715
+ proceed() {
716
+ et(w, {
717
+ state: "proceeding",
718
+ proceed: void 0,
719
+ reset: void 0,
720
+ location: d
721
+ }), S.then(() => e.history.go(h));
722
+ },
723
+ reset() {
724
+ let M = new Map(f.blockers);
725
+ M.set(w, ze), q({ blockers: M });
726
+ }
727
+ });
728
+ return;
729
+ }
730
+ return we(o, d);
731
+ }
732
+ ), r) {
733
+ Vn(t, Q);
734
+ let o = () => Kn(t, Q);
735
+ t.addEventListener("pagehide", o), ke = () => t.removeEventListener("pagehide", o);
736
+ }
737
+ return f.initialized || we("POP", f.location, {
738
+ initialHydration: !0
739
+ }), O;
740
+ }
741
+ function Nr() {
742
+ b && b(), ke && ke(), g.clear(), $ && $.abort(), f.fetchers.forEach((o, d) => gt(d)), f.blockers.forEach((o, d) => Wt(d));
743
+ }
744
+ function Or(o) {
745
+ return g.add(o), () => g.delete(o);
746
+ }
747
+ function q(o, d = {}) {
748
+ f = {
749
+ ...f,
750
+ ...o
751
+ };
752
+ let h = [], w = [];
753
+ f.fetchers.forEach((S, M) => {
754
+ S.state === "idle" && (ne.has(M) ? h.push(M) : w.push(M));
755
+ }), ne.forEach((S) => {
756
+ !f.fetchers.has(S) && !Y.has(S) && h.push(S);
757
+ }), [...g].forEach(
758
+ (S) => S(f, {
759
+ deletedFetchers: h,
760
+ viewTransitionOpts: d.viewTransitionOpts,
761
+ flushSync: d.flushSync === !0
762
+ })
763
+ ), h.forEach((S) => gt(S)), w.forEach((S) => f.fetchers.delete(S));
764
+ }
765
+ function De(o, d, { flushSync: h } = {}) {
766
+ let w = f.actionData != null && f.navigation.formMethod != null && te(f.navigation.formMethod) && f.navigation.state === "loading" && o.state?._isRedirect !== !0, S;
767
+ d.actionData ? Object.keys(d.actionData).length > 0 ? S = d.actionData : S = null : w ? S = f.actionData : S = null;
768
+ let M = d.loaderData ? lr(
769
+ f.loaderData,
770
+ d.loaderData,
771
+ d.matches || [],
772
+ d.errors
773
+ ) : f.loaderData, F = f.blockers;
774
+ F.size > 0 && (F = new Map(F), F.forEach((R, k) => F.set(k, ze)));
775
+ let P = I === !0 || f.navigation.formMethod != null && te(f.navigation.formMethod) && o.state?._isRedirect !== !0;
776
+ l && (i = l, l = void 0), Xe || A === "POP" || (A === "PUSH" ? e.history.push(o, o.state) : A === "REPLACE" && e.history.replace(o, o.state));
777
+ let D;
778
+ if (A === "POP") {
779
+ let R = Q.get(f.location.pathname);
780
+ R && R.has(o.pathname) ? D = {
781
+ currentLocation: f.location,
782
+ nextLocation: o
783
+ } : Q.has(o.pathname) && (D = {
784
+ currentLocation: o,
785
+ nextLocation: f.location
786
+ });
787
+ } else if (W) {
788
+ let R = Q.get(f.location.pathname);
789
+ R ? R.add(o.pathname) : (R = /* @__PURE__ */ new Set([o.pathname]), Q.set(f.location.pathname, R)), D = {
790
+ currentLocation: f.location,
791
+ nextLocation: o
792
+ };
793
+ }
794
+ q(
795
+ {
796
+ ...d,
797
+ // matches, errors, fetchers go through as-is
798
+ actionData: S,
799
+ loaderData: M,
800
+ historyAction: A,
801
+ location: o,
802
+ initialized: !0,
803
+ navigation: Et,
804
+ revalidation: "idle",
805
+ restoreScrollPosition: Yt(
806
+ o,
807
+ d.matches || f.matches
808
+ ),
809
+ preventScrollReset: P,
810
+ blockers: F
811
+ },
812
+ {
813
+ viewTransitionOpts: D,
814
+ flushSync: h === !0
815
+ }
816
+ ), A = "POP", I = !1, W = !1, Xe = !1, ge = !1, Ne?.resolve(), Ne = null;
817
+ }
818
+ async function At(o, d) {
819
+ if (typeof o == "number") {
820
+ e.history.go(o);
821
+ return;
822
+ }
823
+ let h = St(
824
+ f.location,
825
+ f.matches,
826
+ s,
827
+ o,
828
+ d?.fromRouteId,
829
+ d?.relative
830
+ ), { path: w, submission: S, error: M } = Zt(
831
+ !1,
832
+ h,
833
+ d
834
+ ), F = f.location, P = Ve(f.location, w, d && d.state);
835
+ P = {
836
+ ...P,
837
+ ...e.history.encodeLocation(P)
838
+ };
839
+ let D = d && d.replace != null ? d.replace : void 0, R = "PUSH";
840
+ D === !0 ? R = "REPLACE" : D === !1 || S != null && te(S.formMethod) && S.formAction === f.location.pathname + f.location.search && (R = "REPLACE");
841
+ let k = d && "preventScrollReset" in d ? d.preventScrollReset === !0 : void 0, j = (d && d.flushSync) === !0, B = Vt({
842
+ currentLocation: F,
843
+ nextLocation: P,
844
+ historyAction: R
845
+ });
846
+ if (B) {
847
+ et(B, {
848
+ state: "blocked",
849
+ location: P,
850
+ proceed() {
851
+ et(B, {
852
+ state: "proceeding",
853
+ proceed: void 0,
854
+ reset: void 0,
855
+ location: P
856
+ }), At(o, d);
857
+ },
858
+ reset() {
859
+ let J = new Map(f.blockers);
860
+ J.set(B, ze), q({ blockers: J });
861
+ }
862
+ });
863
+ return;
864
+ }
865
+ await we(R, P, {
866
+ submission: S,
867
+ // Send through the formData serialization error if we have one so we can
868
+ // render at the right error boundary after we match routes
869
+ pendingError: M,
870
+ preventScrollReset: k,
871
+ replace: d && d.replace,
872
+ enableViewTransition: d && d.viewTransition,
873
+ flushSync: j
874
+ });
875
+ }
876
+ function Ar() {
877
+ Ne || (Ne = Yn()), yt(), q({ revalidation: "loading" });
878
+ let o = Ne.promise;
879
+ return f.navigation.state === "submitting" ? o : f.navigation.state === "idle" ? (we(f.historyAction, f.location, {
880
+ startUninterruptedRevalidation: !0
881
+ }), o) : (we(
882
+ A || f.historyAction,
883
+ f.navigation.location,
884
+ {
885
+ overrideNavigation: f.navigation,
886
+ // Proxy through any rending view transition
887
+ enableViewTransition: W === !0
888
+ }
889
+ ), o);
890
+ }
891
+ async function we(o, d, h) {
892
+ $ && $.abort(), $ = null, A = o, Xe = (h && h.startUninterruptedRevalidation) === !0, Yr(f.location, f.matches), I = (h && h.preventScrollReset) === !0, W = (h && h.enableViewTransition) === !0;
893
+ let w = l || i, S = h && h.overrideNavigation, M = h?.initialHydration && f.matches && f.matches.length > 0 && !C ? (
894
+ // `matchRoutes()` has already been called if we're in here via `router.initialize()`
895
+ f.matches
896
+ ) : me(w, d, s), F = (h && h.flushSync) === !0;
897
+ if (M && f.initialized && !ge && Hn(f.location, d) && !(h && h.submission && te(h.submission.formMethod))) {
898
+ De(d, { matches: M }, { flushSync: F });
899
+ return;
900
+ }
901
+ let P = tt(M, w, d.pathname);
902
+ if (P.active && P.matches && (M = P.matches), !M) {
903
+ let { error: _, notFoundMatches: z, route: K } = vt(
904
+ d.pathname
905
+ );
906
+ De(
907
+ d,
908
+ {
909
+ matches: z,
910
+ loaderData: {},
911
+ errors: {
912
+ [K.id]: _
913
+ }
914
+ },
915
+ { flushSync: F }
916
+ );
917
+ return;
918
+ }
919
+ $ = new AbortController();
920
+ let D = Fe(
921
+ e.history,
922
+ d,
923
+ $.signal,
924
+ h && h.submission
925
+ ), R;
926
+ if (h && h.pendingError)
927
+ R = [
928
+ Re(M).route.id,
929
+ { type: "error", error: h.pendingError }
930
+ ];
931
+ else if (h && h.submission && te(h.submission.formMethod)) {
932
+ let _ = await Ir(
933
+ D,
934
+ d,
935
+ h.submission,
936
+ M,
937
+ P.active,
938
+ { replace: h.replace, flushSync: F }
939
+ );
940
+ if (_.shortCircuited)
941
+ return;
942
+ if (_.pendingActionResult) {
943
+ let [z, K] = _.pendingActionResult;
944
+ if (Z(K) && Ke(K.error) && K.error.status === 404) {
945
+ $ = null, De(d, {
946
+ matches: _.matches,
947
+ loaderData: {},
948
+ errors: {
949
+ [z]: K.error
950
+ }
951
+ });
952
+ return;
953
+ }
954
+ }
955
+ M = _.matches || M, R = _.pendingActionResult, S = Rt(d, h.submission), F = !1, P.active = !1, D = Fe(
956
+ e.history,
957
+ D.url,
958
+ D.signal
959
+ );
960
+ }
961
+ let {
962
+ shortCircuited: k,
963
+ matches: j,
964
+ loaderData: B,
965
+ errors: J
966
+ } = await jr(
967
+ D,
968
+ d,
969
+ M,
970
+ P.active,
971
+ S,
972
+ h && h.submission,
973
+ h && h.fetcherSubmission,
974
+ h && h.replace,
975
+ h && h.initialHydration === !0,
976
+ F,
977
+ R
978
+ );
979
+ k || ($ = null, De(d, {
980
+ matches: j || M,
981
+ ...sr(R),
982
+ loaderData: B,
983
+ errors: J
984
+ }));
985
+ }
986
+ async function Ir(o, d, h, w, S, M = {}) {
987
+ yt();
988
+ let F = Bn(d, h);
989
+ if (q({ navigation: F }, { flushSync: M.flushSync === !0 }), S) {
990
+ let R = await rt(
991
+ w,
992
+ d.pathname,
993
+ o.signal
994
+ );
995
+ if (R.type === "aborted")
996
+ return { shortCircuited: !0 };
997
+ if (R.type === "error") {
998
+ let k = Re(R.partialMatches).route.id;
999
+ return {
1000
+ matches: R.partialMatches,
1001
+ pendingActionResult: [
1002
+ k,
1003
+ {
1004
+ type: "error",
1005
+ error: R.error
1006
+ }
1007
+ ]
1008
+ };
1009
+ } else if (R.matches)
1010
+ w = R.matches;
1011
+ else {
1012
+ let { notFoundMatches: k, error: j, route: B } = vt(
1013
+ d.pathname
1014
+ );
1015
+ return {
1016
+ matches: k,
1017
+ pendingActionResult: [
1018
+ B.id,
1019
+ {
1020
+ type: "error",
1021
+ error: j
1022
+ }
1023
+ ]
1024
+ };
1025
+ }
1026
+ }
1027
+ let P, D = We(w, d);
1028
+ if (!D.route.action && !D.route.lazy)
1029
+ P = {
1030
+ type: "error",
1031
+ error: ee(405, {
1032
+ method: o.method,
1033
+ pathname: d.pathname,
1034
+ routeId: D.route.id
1035
+ })
1036
+ };
1037
+ else if (P = (await Oe(
1038
+ "action",
1039
+ f,
1040
+ o,
1041
+ [D],
1042
+ w,
1043
+ null
1044
+ ))[D.route.id], o.signal.aborted)
1045
+ return { shortCircuited: !0 };
1046
+ if (xe(P)) {
1047
+ let R;
1048
+ return M && M.replace != null ? R = M.replace : R = ar(
1049
+ P.response.headers.get("Location"),
1050
+ new URL(o.url),
1051
+ s
1052
+ ) === f.location.pathname + f.location.search, await be(o, P, !0, {
1053
+ submission: h,
1054
+ replace: R
1055
+ }), { shortCircuited: !0 };
1056
+ }
1057
+ if (Z(P)) {
1058
+ let R = Re(w, D.route.id);
1059
+ return (M && M.replace) !== !0 && (A = "PUSH"), {
1060
+ matches: w,
1061
+ pendingActionResult: [R.route.id, P]
1062
+ };
1063
+ }
1064
+ return {
1065
+ matches: w,
1066
+ pendingActionResult: [D.route.id, P]
1067
+ };
1068
+ }
1069
+ async function jr(o, d, h, w, S, M, F, P, D, R, k) {
1070
+ let j = S || Rt(d, M), B = M || F || cr(j), J = !Xe && !D;
1071
+ if (w) {
1072
+ if (J) {
1073
+ let X = It(k);
1074
+ q(
1075
+ {
1076
+ navigation: j,
1077
+ ...X !== void 0 ? { actionData: X } : {}
1078
+ },
1079
+ {
1080
+ flushSync: R
1081
+ }
1082
+ );
1083
+ }
1084
+ let H = await rt(
1085
+ h,
1086
+ d.pathname,
1087
+ o.signal
1088
+ );
1089
+ if (H.type === "aborted")
1090
+ return { shortCircuited: !0 };
1091
+ if (H.type === "error") {
1092
+ let X = Re(H.partialMatches).route.id;
1093
+ return {
1094
+ matches: H.partialMatches,
1095
+ loaderData: {},
1096
+ errors: {
1097
+ [X]: H.error
1098
+ }
1099
+ };
1100
+ } else if (H.matches)
1101
+ h = H.matches;
1102
+ else {
1103
+ let { error: X, notFoundMatches: it, route: je } = vt(
1104
+ d.pathname
1105
+ );
1106
+ return {
1107
+ matches: it,
1108
+ loaderData: {},
1109
+ errors: {
1110
+ [je.id]: X
1111
+ }
1112
+ };
1113
+ }
1114
+ }
1115
+ let _ = l || i, [z, K] = tr(
1116
+ e.history,
1117
+ f,
1118
+ h,
1119
+ B,
1120
+ d,
1121
+ D === !0,
1122
+ ge,
1123
+ Qe,
1124
+ ne,
1125
+ Pe,
1126
+ le,
1127
+ _,
1128
+ s,
1129
+ k
1130
+ );
1131
+ if ($e = ++qe, z.length === 0 && K.length === 0) {
1132
+ let H = _t();
1133
+ return De(
1134
+ d,
1135
+ {
1136
+ matches: h,
1137
+ loaderData: {},
1138
+ // Commit pending error if we're short circuiting
1139
+ errors: k && Z(k[1]) ? { [k[0]]: k[1].error } : null,
1140
+ ...sr(k),
1141
+ ...H ? { fetchers: new Map(f.fetchers) } : {}
1142
+ },
1143
+ { flushSync: R }
1144
+ ), { shortCircuited: !0 };
1145
+ }
1146
+ if (J) {
1147
+ let H = {};
1148
+ if (!w) {
1149
+ H.navigation = j;
1150
+ let X = It(k);
1151
+ X !== void 0 && (H.actionData = X);
1152
+ }
1153
+ K.length > 0 && (H.fetchers = Hr(K)), q(H, { flushSync: R });
1154
+ }
1155
+ K.forEach((H) => {
1156
+ fe(H.key), H.controller && Y.set(H.key, H.controller);
1157
+ });
1158
+ let Me = () => K.forEach((H) => fe(H.key));
1159
+ $ && $.signal.addEventListener(
1160
+ "abort",
1161
+ Me
1162
+ );
1163
+ let { loaderResults: Ae, fetcherResults: ue } = await jt(
1164
+ f,
1165
+ h,
1166
+ z,
1167
+ K,
1168
+ o
1169
+ );
1170
+ if (o.signal.aborted)
1171
+ return { shortCircuited: !0 };
1172
+ $ && $.signal.removeEventListener(
1173
+ "abort",
1174
+ Me
1175
+ ), K.forEach((H) => Y.delete(H.key));
1176
+ let ae = ot(Ae);
1177
+ if (ae)
1178
+ return await be(o, ae.result, !0, {
1179
+ replace: P
1180
+ }), { shortCircuited: !0 };
1181
+ if (ae = ot(ue), ae)
1182
+ return le.add(ae.key), await be(o, ae.result, !0, {
1183
+ replace: P
1184
+ }), { shortCircuited: !0 };
1185
+ let { loaderData: wt, errors: Ie } = or(
1186
+ f,
1187
+ h,
1188
+ Ae,
1189
+ k,
1190
+ K,
1191
+ ue
1192
+ );
1193
+ D && f.errors && (Ie = { ...f.errors, ...Ie });
1194
+ let Ee = _t(), nt = Bt($e), at = Ee || nt || K.length > 0;
1195
+ return {
1196
+ matches: h,
1197
+ loaderData: wt,
1198
+ errors: Ie,
1199
+ ...at ? { fetchers: new Map(f.fetchers) } : {}
1200
+ };
1201
+ }
1202
+ function It(o) {
1203
+ if (o && !Z(o[1]))
1204
+ return {
1205
+ [o[0]]: o[1].data
1206
+ };
1207
+ if (f.actionData)
1208
+ return Object.keys(f.actionData).length === 0 ? null : f.actionData;
1209
+ }
1210
+ function Hr(o) {
1211
+ return o.forEach((d) => {
1212
+ let h = f.fetchers.get(d.key), w = _e(
1213
+ void 0,
1214
+ h ? h.data : void 0
1215
+ );
1216
+ f.fetchers.set(d.key, w);
1217
+ }), new Map(f.fetchers);
1218
+ }
1219
+ async function zr(o, d, h, w) {
1220
+ fe(o);
1221
+ let S = (w && w.flushSync) === !0, M = l || i, F = St(
1222
+ f.location,
1223
+ f.matches,
1224
+ s,
1225
+ h,
1226
+ d,
1227
+ w?.relative
1228
+ ), P = me(M, F, s), D = tt(P, M, F);
1229
+ if (D.active && D.matches && (P = D.matches), !P) {
1230
+ se(
1231
+ o,
1232
+ d,
1233
+ ee(404, { pathname: F }),
1234
+ { flushSync: S }
1235
+ );
1236
+ return;
1237
+ }
1238
+ let { path: R, submission: k, error: j } = Zt(
1239
+ !0,
1240
+ F,
1241
+ w
1242
+ );
1243
+ if (j) {
1244
+ se(o, d, j, { flushSync: S });
1245
+ return;
1246
+ }
1247
+ let B = We(P, R), J = (w && w.preventScrollReset) === !0;
1248
+ if (k && te(k.formMethod)) {
1249
+ await _r(
1250
+ o,
1251
+ d,
1252
+ R,
1253
+ B,
1254
+ P,
1255
+ D.active,
1256
+ S,
1257
+ J,
1258
+ k
1259
+ );
1260
+ return;
1261
+ }
1262
+ Pe.set(o, { routeId: d, path: R }), await Br(
1263
+ o,
1264
+ d,
1265
+ R,
1266
+ B,
1267
+ P,
1268
+ D.active,
1269
+ S,
1270
+ J,
1271
+ k
1272
+ );
1273
+ }
1274
+ async function _r(o, d, h, w, S, M, F, P, D) {
1275
+ yt(), Pe.delete(o);
1276
+ function R(V) {
1277
+ if (!V.route.action && !V.route.lazy) {
1278
+ let Te = ee(405, {
1279
+ method: D.formMethod,
1280
+ pathname: h,
1281
+ routeId: d
1282
+ });
1283
+ return se(o, d, Te, { flushSync: F }), !0;
1284
+ }
1285
+ return !1;
1286
+ }
1287
+ if (!M && R(w))
1288
+ return;
1289
+ let k = f.fetchers.get(o);
1290
+ ce(o, Wn(D, k), {
1291
+ flushSync: F
1292
+ });
1293
+ let j = new AbortController(), B = Fe(
1294
+ e.history,
1295
+ h,
1296
+ j.signal,
1297
+ D
1298
+ );
1299
+ if (M) {
1300
+ let V = await rt(
1301
+ S,
1302
+ h,
1303
+ B.signal
1304
+ );
1305
+ if (V.type === "aborted")
1306
+ return;
1307
+ if (V.type === "error") {
1308
+ se(o, d, V.error, { flushSync: F });
1309
+ return;
1310
+ } else if (V.matches) {
1311
+ if (S = V.matches, w = We(S, h), R(w))
1312
+ return;
1313
+ } else {
1314
+ se(
1315
+ o,
1316
+ d,
1317
+ ee(404, { pathname: h }),
1318
+ { flushSync: F }
1319
+ );
1320
+ return;
1321
+ }
1322
+ }
1323
+ Y.set(o, j);
1324
+ let J = qe, z = (await Oe(
1325
+ "action",
1326
+ f,
1327
+ B,
1328
+ [w],
1329
+ S,
1330
+ o
1331
+ ))[w.route.id];
1332
+ if (B.signal.aborted) {
1333
+ Y.get(o) === j && Y.delete(o);
1334
+ return;
1335
+ }
1336
+ if (ne.has(o)) {
1337
+ if (xe(z) || Z(z)) {
1338
+ ce(o, he(void 0));
1339
+ return;
1340
+ }
1341
+ } else {
1342
+ if (xe(z))
1343
+ if (Y.delete(o), $e > J) {
1344
+ ce(o, he(void 0));
1345
+ return;
1346
+ } else
1347
+ return le.add(o), ce(o, _e(D)), be(B, z, !1, {
1348
+ fetcherSubmission: D,
1349
+ preventScrollReset: P
1350
+ });
1351
+ if (Z(z)) {
1352
+ se(o, d, z.error);
1353
+ return;
1354
+ }
1355
+ }
1356
+ let K = f.navigation.location || f.location, Me = Fe(
1357
+ e.history,
1358
+ K,
1359
+ j.signal
1360
+ ), Ae = l || i, ue = f.navigation.state !== "idle" ? me(Ae, f.navigation.location, s) : f.matches;
1361
+ U(ue, "Didn't find any matches after fetcher action");
1362
+ let ae = ++qe;
1363
+ Ce.set(o, ae);
1364
+ let wt = _e(D, z.data);
1365
+ f.fetchers.set(o, wt);
1366
+ let [Ie, Ee] = tr(
1367
+ e.history,
1368
+ f,
1369
+ ue,
1370
+ D,
1371
+ K,
1372
+ !1,
1373
+ ge,
1374
+ Qe,
1375
+ ne,
1376
+ Pe,
1377
+ le,
1378
+ Ae,
1379
+ s,
1380
+ [w.route.id, z]
1381
+ );
1382
+ Ee.filter((V) => V.key !== o).forEach((V) => {
1383
+ let Te = V.key, Jt = f.fetchers.get(Te), Xr = _e(
1384
+ void 0,
1385
+ Jt ? Jt.data : void 0
1386
+ );
1387
+ f.fetchers.set(Te, Xr), fe(Te), V.controller && Y.set(Te, V.controller);
1388
+ }), q({ fetchers: new Map(f.fetchers) });
1389
+ let nt = () => Ee.forEach((V) => fe(V.key));
1390
+ j.signal.addEventListener(
1391
+ "abort",
1392
+ nt
1393
+ );
1394
+ let { loaderResults: at, fetcherResults: H } = await jt(
1395
+ f,
1396
+ ue,
1397
+ Ie,
1398
+ Ee,
1399
+ Me
1400
+ );
1401
+ if (j.signal.aborted)
1402
+ return;
1403
+ j.signal.removeEventListener(
1404
+ "abort",
1405
+ nt
1406
+ ), Ce.delete(o), Y.delete(o), Ee.forEach((V) => Y.delete(V.key));
1407
+ let X = ot(at);
1408
+ if (X)
1409
+ return be(
1410
+ Me,
1411
+ X.result,
1412
+ !1,
1413
+ { preventScrollReset: P }
1414
+ );
1415
+ if (X = ot(H), X)
1416
+ return le.add(X.key), be(
1417
+ Me,
1418
+ X.result,
1419
+ !1,
1420
+ { preventScrollReset: P }
1421
+ );
1422
+ let { loaderData: it, errors: je } = or(
1423
+ f,
1424
+ ue,
1425
+ at,
1426
+ void 0,
1427
+ Ee,
1428
+ H
1429
+ );
1430
+ if (f.fetchers.has(o)) {
1431
+ let V = he(z.data);
1432
+ f.fetchers.set(o, V);
1433
+ }
1434
+ Bt(ae), f.navigation.state === "loading" && ae > $e ? (U(A, "Expected pending action"), $ && $.abort(), De(f.navigation.location, {
1435
+ matches: ue,
1436
+ loaderData: it,
1437
+ errors: je,
1438
+ fetchers: new Map(f.fetchers)
1439
+ })) : (q({
1440
+ errors: je,
1441
+ loaderData: lr(
1442
+ f.loaderData,
1443
+ it,
1444
+ ue,
1445
+ je
1446
+ ),
1447
+ fetchers: new Map(f.fetchers)
1448
+ }), ge = !1);
1449
+ }
1450
+ async function Br(o, d, h, w, S, M, F, P, D) {
1451
+ let R = f.fetchers.get(o);
1452
+ ce(
1453
+ o,
1454
+ _e(
1455
+ D,
1456
+ R ? R.data : void 0
1457
+ ),
1458
+ { flushSync: F }
1459
+ );
1460
+ let k = new AbortController(), j = Fe(
1461
+ e.history,
1462
+ h,
1463
+ k.signal
1464
+ );
1465
+ if (M) {
1466
+ let z = await rt(
1467
+ S,
1468
+ h,
1469
+ j.signal
1470
+ );
1471
+ if (z.type === "aborted")
1472
+ return;
1473
+ if (z.type === "error") {
1474
+ se(o, d, z.error, { flushSync: F });
1475
+ return;
1476
+ } else if (z.matches)
1477
+ S = z.matches, w = We(S, h);
1478
+ else {
1479
+ se(
1480
+ o,
1481
+ d,
1482
+ ee(404, { pathname: h }),
1483
+ { flushSync: F }
1484
+ );
1485
+ return;
1486
+ }
1487
+ }
1488
+ Y.set(o, k);
1489
+ let B = qe, _ = (await Oe(
1490
+ "loader",
1491
+ f,
1492
+ j,
1493
+ [w],
1494
+ S,
1495
+ o
1496
+ ))[w.route.id];
1497
+ if (Y.get(o) === k && Y.delete(o), !j.signal.aborted) {
1498
+ if (ne.has(o)) {
1499
+ ce(o, he(void 0));
1500
+ return;
1501
+ }
1502
+ if (xe(_))
1503
+ if ($e > B) {
1504
+ ce(o, he(void 0));
1505
+ return;
1506
+ } else {
1507
+ le.add(o), await be(j, _, !1, {
1508
+ preventScrollReset: P
1509
+ });
1510
+ return;
1511
+ }
1512
+ if (Z(_)) {
1513
+ se(o, d, _.error);
1514
+ return;
1515
+ }
1516
+ ce(o, he(_.data));
1517
+ }
1518
+ }
1519
+ async function be(o, d, h, {
1520
+ submission: w,
1521
+ fetcherSubmission: S,
1522
+ preventScrollReset: M,
1523
+ replace: F
1524
+ } = {}) {
1525
+ d.response.headers.has("X-Remix-Revalidate") && (ge = !0);
1526
+ let P = d.response.headers.get("Location");
1527
+ U(P, "Expected a Location header on the redirect Response"), P = ar(
1528
+ P,
1529
+ new URL(o.url),
1530
+ s
1531
+ );
1532
+ let D = Ve(f.location, P, {
1533
+ _isRedirect: !0
1534
+ });
1535
+ if (r) {
1536
+ let _ = !1;
1537
+ if (d.response.headers.has("X-Remix-Reload-Document"))
1538
+ _ = !0;
1539
+ else if (Mt.test(P)) {
1540
+ const z = e.history.createURL(P);
1541
+ _ = // Hard reload if it's an absolute URL to a new origin
1542
+ z.origin !== t.location.origin || // Hard reload if it's an absolute URL that does not match our basename
1543
+ re(z.pathname, s) == null;
1544
+ }
1545
+ if (_) {
1546
+ F ? t.location.replace(P) : t.location.assign(P);
1547
+ return;
1548
+ }
1549
+ }
1550
+ $ = null;
1551
+ let R = F === !0 || d.response.headers.has("X-Remix-Replace") ? "REPLACE" : "PUSH", { formMethod: k, formAction: j, formEncType: B } = f.navigation;
1552
+ !w && !S && k && j && B && (w = cr(f.navigation));
1553
+ let J = w || S;
1554
+ if (Cn.has(d.response.status) && J && te(J.formMethod))
1555
+ await we(R, D, {
1556
+ submission: {
1557
+ ...J,
1558
+ formAction: P
1559
+ },
1560
+ // Preserve these flags across redirects
1561
+ preventScrollReset: M || I,
1562
+ enableViewTransition: h ? W : void 0
1563
+ });
1564
+ else {
1565
+ let _ = Rt(
1566
+ D,
1567
+ w
1568
+ );
1569
+ await we(R, D, {
1570
+ overrideNavigation: _,
1571
+ // Send fetcher submissions through for shouldRevalidate
1572
+ fetcherSubmission: S,
1573
+ // Preserve these flags across redirects
1574
+ preventScrollReset: M || I,
1575
+ enableViewTransition: h ? W : void 0
1576
+ });
1577
+ }
1578
+ }
1579
+ async function Oe(o, d, h, w, S, M) {
1580
+ let F, P = {};
1581
+ try {
1582
+ F = await Nn(
1583
+ u,
1584
+ o,
1585
+ d,
1586
+ h,
1587
+ w,
1588
+ S,
1589
+ M,
1590
+ n,
1591
+ a
1592
+ );
1593
+ } catch (D) {
1594
+ return w.forEach((R) => {
1595
+ P[R.route.id] = {
1596
+ type: "error",
1597
+ error: D
1598
+ };
1599
+ }), P;
1600
+ }
1601
+ for (let [D, R] of Object.entries(F))
1602
+ if (zn(R)) {
1603
+ let k = R.result;
1604
+ P[D] = {
1605
+ type: "redirect",
1606
+ response: In(
1607
+ k,
1608
+ h,
1609
+ D,
1610
+ S,
1611
+ s
1612
+ )
1613
+ };
1614
+ } else
1615
+ P[D] = await An(
1616
+ R
1617
+ );
1618
+ return P;
1619
+ }
1620
+ async function jt(o, d, h, w, S) {
1621
+ let M = Oe(
1622
+ "loader",
1623
+ o,
1624
+ S,
1625
+ h,
1626
+ d,
1627
+ null
1628
+ ), F = Promise.all(
1629
+ w.map(async (R) => {
1630
+ if (R.matches && R.match && R.controller) {
1631
+ let j = (await Oe(
1632
+ "loader",
1633
+ o,
1634
+ Fe(e.history, R.path, R.controller.signal),
1635
+ [R.match],
1636
+ R.matches,
1637
+ R.key
1638
+ ))[R.match.route.id];
1639
+ return { [R.key]: j };
1640
+ } else
1641
+ return Promise.resolve({
1642
+ [R.key]: {
1643
+ type: "error",
1644
+ error: ee(404, {
1645
+ pathname: R.path
1646
+ })
1647
+ }
1648
+ });
1649
+ })
1650
+ ), P = await M, D = (await F).reduce(
1651
+ (R, k) => Object.assign(R, k),
1652
+ {}
1653
+ );
1654
+ return {
1655
+ loaderResults: P,
1656
+ fetcherResults: D
1657
+ };
1658
+ }
1659
+ function yt() {
1660
+ ge = !0, Pe.forEach((o, d) => {
1661
+ Y.has(d) && Qe.add(d), fe(d);
1662
+ });
1663
+ }
1664
+ function ce(o, d, h = {}) {
1665
+ f.fetchers.set(o, d), q(
1666
+ { fetchers: new Map(f.fetchers) },
1667
+ { flushSync: (h && h.flushSync) === !0 }
1668
+ );
1669
+ }
1670
+ function se(o, d, h, w = {}) {
1671
+ let S = Re(f.matches, d);
1672
+ gt(o), q(
1673
+ {
1674
+ errors: {
1675
+ [S.route.id]: h
1676
+ },
1677
+ fetchers: new Map(f.fetchers)
1678
+ },
1679
+ { flushSync: (w && w.flushSync) === !0 }
1680
+ );
1681
+ }
1682
+ function Ht(o) {
1683
+ return Ue.set(o, (Ue.get(o) || 0) + 1), ne.has(o) && ne.delete(o), f.fetchers.get(o) || Pn;
1684
+ }
1685
+ function gt(o) {
1686
+ let d = f.fetchers.get(o);
1687
+ Y.has(o) && !(d && d.state === "loading" && Ce.has(o)) && fe(o), Pe.delete(o), Ce.delete(o), le.delete(o), ne.delete(o), Qe.delete(o), f.fetchers.delete(o);
1688
+ }
1689
+ function Wr(o) {
1690
+ let d = (Ue.get(o) || 0) - 1;
1691
+ d <= 0 ? (Ue.delete(o), ne.add(o)) : Ue.set(o, d), q({ fetchers: new Map(f.fetchers) });
1692
+ }
1693
+ function fe(o) {
1694
+ let d = Y.get(o);
1695
+ d && (d.abort(), Y.delete(o));
1696
+ }
1697
+ function zt(o) {
1698
+ for (let d of o) {
1699
+ let h = Ht(d), w = he(h.data);
1700
+ f.fetchers.set(d, w);
1701
+ }
1702
+ }
1703
+ function _t() {
1704
+ let o = [], d = !1;
1705
+ for (let h of le) {
1706
+ let w = f.fetchers.get(h);
1707
+ U(w, `Expected fetcher: ${h}`), w.state === "loading" && (le.delete(h), o.push(h), d = !0);
1708
+ }
1709
+ return zt(o), d;
1710
+ }
1711
+ function Bt(o) {
1712
+ let d = [];
1713
+ for (let [h, w] of Ce)
1714
+ if (w < o) {
1715
+ let S = f.fetchers.get(h);
1716
+ U(S, `Expected fetcher: ${h}`), S.state === "loading" && (fe(h), Ce.delete(h), d.push(h));
1717
+ }
1718
+ return zt(d), d.length > 0;
1719
+ }
1720
+ function Vr(o, d) {
1721
+ let h = f.blockers.get(o) || ze;
1722
+ return ve.get(o) !== d && ve.set(o, d), h;
1723
+ }
1724
+ function Wt(o) {
1725
+ f.blockers.delete(o), ve.delete(o);
1726
+ }
1727
+ function et(o, d) {
1728
+ let h = f.blockers.get(o) || ze;
1729
+ U(
1730
+ h.state === "unblocked" && d.state === "blocked" || h.state === "blocked" && d.state === "blocked" || h.state === "blocked" && d.state === "proceeding" || h.state === "blocked" && d.state === "unblocked" || h.state === "proceeding" && d.state === "unblocked",
1731
+ `Invalid blocker state transition: ${h.state} -> ${d.state}`
1732
+ );
1733
+ let w = new Map(f.blockers);
1734
+ w.set(o, d), q({ blockers: w });
1735
+ }
1736
+ function Vt({
1737
+ currentLocation: o,
1738
+ nextLocation: d,
1739
+ historyAction: h
1740
+ }) {
1741
+ if (ve.size === 0)
1742
+ return;
1743
+ ve.size > 1 && G(!1, "A router only supports one blocker at a time");
1744
+ let w = Array.from(ve.entries()), [S, M] = w[w.length - 1], F = f.blockers.get(S);
1745
+ if (!(F && F.state === "proceeding") && M({ currentLocation: o, nextLocation: d, historyAction: h }))
1746
+ return S;
1747
+ }
1748
+ function vt(o) {
1749
+ let d = ee(404, { pathname: o }), h = l || i, { matches: w, route: S } = ur(h);
1750
+ return { notFoundMatches: w, route: S, error: d };
1751
+ }
1752
+ function Kr(o, d, h) {
1753
+ if (p = o, L = d, v = h || null, !x && f.navigation === Et) {
1754
+ x = !0;
1755
+ let w = Yt(f.location, f.matches);
1756
+ w != null && q({ restoreScrollPosition: w });
1757
+ }
1758
+ return () => {
1759
+ p = null, L = null, v = null;
1760
+ };
1761
+ }
1762
+ function Kt(o, d) {
1763
+ return v && v(
1764
+ o,
1765
+ d.map((w) => nn(w, f.loaderData))
1766
+ ) || o.key;
1767
+ }
1768
+ function Yr(o, d) {
1769
+ if (p && L) {
1770
+ let h = Kt(o, d);
1771
+ p[h] = L();
1772
+ }
1773
+ }
1774
+ function Yt(o, d) {
1775
+ if (p) {
1776
+ let h = Kt(o, d), w = p[h];
1777
+ if (typeof w == "number")
1778
+ return w;
1779
+ }
1780
+ return null;
1781
+ }
1782
+ function tt(o, d, h) {
1783
+ if (c)
1784
+ if (o) {
1785
+ if (Object.keys(o[0].params).length > 0)
1786
+ return { active: !0, matches: st(
1787
+ d,
1788
+ h,
1789
+ s,
1790
+ !0
1791
+ ) };
1792
+ } else
1793
+ return { active: !0, matches: st(
1794
+ d,
1795
+ h,
1796
+ s,
1797
+ !0
1798
+ ) || [] };
1799
+ return { active: !1, matches: null };
1800
+ }
1801
+ async function rt(o, d, h) {
1802
+ if (!c)
1803
+ return { type: "success", matches: o };
1804
+ let w = o;
1805
+ for (; ; ) {
1806
+ let S = l == null, M = l || i, F = n;
1807
+ try {
1808
+ await c({
1809
+ path: d,
1810
+ matches: w,
1811
+ patch: (R, k) => {
1812
+ h.aborted || nr(
1813
+ R,
1814
+ k,
1815
+ M,
1816
+ F,
1817
+ a
1818
+ );
1819
+ }
1820
+ });
1821
+ } catch (R) {
1822
+ return { type: "error", error: R, partialMatches: w };
1823
+ } finally {
1824
+ S && !h.aborted && (i = [...i]);
1825
+ }
1826
+ if (h.aborted)
1827
+ return { type: "aborted" };
1828
+ let P = me(M, d, s);
1829
+ if (P)
1830
+ return { type: "success", matches: P };
1831
+ let D = st(
1832
+ M,
1833
+ d,
1834
+ s,
1835
+ !0
1836
+ );
1837
+ if (!D || w.length === D.length && w.every(
1838
+ (R, k) => R.route.id === D[k].route.id
1839
+ ))
1840
+ return { type: "success", matches: null };
1841
+ w = D;
1842
+ }
1843
+ }
1844
+ function Jr(o) {
1845
+ n = {}, l = ct(
1846
+ o,
1847
+ a,
1848
+ void 0,
1849
+ n
1850
+ );
1851
+ }
1852
+ function Gr(o, d) {
1853
+ let h = l == null;
1854
+ nr(
1855
+ o,
1856
+ d,
1857
+ l || i,
1858
+ n,
1859
+ a
1860
+ ), h && (i = [...i], q({}));
1861
+ }
1862
+ return O = {
1863
+ get basename() {
1864
+ return s;
1865
+ },
1866
+ get future() {
1867
+ return y;
1868
+ },
1869
+ get state() {
1870
+ return f;
1871
+ },
1872
+ get routes() {
1873
+ return i;
1874
+ },
1875
+ get window() {
1876
+ return t;
1877
+ },
1878
+ initialize: Ur,
1879
+ subscribe: Or,
1880
+ enableScrollRestoration: Kr,
1881
+ navigate: At,
1882
+ fetch: zr,
1883
+ revalidate: Ar,
1884
+ // Passthrough to history-aware createHref used by useHref so we get proper
1885
+ // hash-aware URLs in DOM paths
1886
+ createHref: (o) => e.history.createHref(o),
1887
+ encodeLocation: (o) => e.history.encodeLocation(o),
1888
+ getFetcher: Ht,
1889
+ deleteFetcher: Wr,
1890
+ dispose: Nr,
1891
+ getBlocker: Vr,
1892
+ deleteBlocker: Wt,
1893
+ patchRoutes: Gr,
1894
+ _internalFetchControllers: Y,
1895
+ // TODO: Remove setRoutes, it's temporary to avoid dealing with
1896
+ // updating the tree while validating the update algorithm.
1897
+ _internalSetRoutes: Jr
1898
+ }, O;
1899
+ }
1900
+ function Tn(e) {
1901
+ return e != null && ("formData" in e && e.formData != null || "body" in e && e.body !== void 0);
1902
+ }
1903
+ function St(e, t, r, a, n, i) {
1904
+ let l, s;
1905
+ if (n) {
1906
+ l = [];
1907
+ for (let c of t)
1908
+ if (l.push(c), c.route.id === n) {
1909
+ s = c;
1910
+ break;
1911
+ }
1912
+ } else
1913
+ l = t, s = t[t.length - 1];
1914
+ let u = Dt(
1915
+ a || ".",
1916
+ Pt(l),
1917
+ re(e.pathname, r) || e.pathname,
1918
+ i === "path"
1919
+ );
1920
+ if (a == null && (u.search = e.search, u.hash = e.hash), (a == null || a === "" || a === ".") && s) {
1921
+ let c = Tt(u.search);
1922
+ if (s.route.index && !c)
1923
+ u.search = u.search ? u.search.replace(/^\?/, "?index&") : "?index";
1924
+ else if (!s.route.index && c) {
1925
+ let y = new URLSearchParams(u.search), b = y.getAll("index");
1926
+ y.delete("index"), b.filter((p) => p).forEach((p) => y.append("index", p));
1927
+ let g = y.toString();
1928
+ u.search = g ? `?${g}` : "";
1929
+ }
1930
+ }
1931
+ return r !== "/" && (u.pathname = u.pathname === "/" ? r : ie([r, u.pathname])), pe(u);
1932
+ }
1933
+ function Zt(e, t, r) {
1934
+ if (!r || !Tn(r))
1935
+ return { path: t };
1936
+ if (r.formMethod && !_n(r.formMethod))
1937
+ return {
1938
+ path: t,
1939
+ error: ee(405, { method: r.formMethod })
1940
+ };
1941
+ let a = () => ({
1942
+ path: t,
1943
+ error: ee(400, { type: "invalid-body" })
1944
+ }), i = (r.formMethod || "get").toUpperCase(), l = xr(t);
1945
+ if (r.body !== void 0) {
1946
+ if (r.formEncType === "text/plain") {
1947
+ if (!te(i))
1948
+ return a();
1949
+ let b = typeof r.body == "string" ? r.body : r.body instanceof FormData || r.body instanceof URLSearchParams ? (
1950
+ // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
1951
+ Array.from(r.body.entries()).reduce(
1952
+ (g, [p, v]) => `${g}${p}=${v}
1953
+ `,
1954
+ ""
1955
+ )
1956
+ ) : String(r.body);
1957
+ return {
1958
+ path: t,
1959
+ submission: {
1960
+ formMethod: i,
1961
+ formAction: l,
1962
+ formEncType: r.formEncType,
1963
+ formData: void 0,
1964
+ json: void 0,
1965
+ text: b
1966
+ }
1967
+ };
1968
+ } else if (r.formEncType === "application/json") {
1969
+ if (!te(i))
1970
+ return a();
1971
+ try {
1972
+ let b = typeof r.body == "string" ? JSON.parse(r.body) : r.body;
1973
+ return {
1974
+ path: t,
1975
+ submission: {
1976
+ formMethod: i,
1977
+ formAction: l,
1978
+ formEncType: r.formEncType,
1979
+ formData: void 0,
1980
+ json: b,
1981
+ text: void 0
1982
+ }
1983
+ };
1984
+ } catch {
1985
+ return a();
1986
+ }
1987
+ }
1988
+ }
1989
+ U(
1990
+ typeof FormData == "function",
1991
+ "FormData is not available in this environment"
1992
+ );
1993
+ let s, u;
1994
+ if (r.formData)
1995
+ s = Ct(r.formData), u = r.formData;
1996
+ else if (r.body instanceof FormData)
1997
+ s = Ct(r.body), u = r.body;
1998
+ else if (r.body instanceof URLSearchParams)
1999
+ s = r.body, u = ir(s);
2000
+ else if (r.body == null)
2001
+ s = new URLSearchParams(), u = new FormData();
2002
+ else
2003
+ try {
2004
+ s = new URLSearchParams(r.body), u = ir(s);
2005
+ } catch {
2006
+ return a();
2007
+ }
2008
+ let c = {
2009
+ formMethod: i,
2010
+ formAction: l,
2011
+ formEncType: r && r.formEncType || "application/x-www-form-urlencoded",
2012
+ formData: u,
2013
+ json: void 0,
2014
+ text: void 0
2015
+ };
2016
+ if (te(c.formMethod))
2017
+ return { path: t, submission: c };
2018
+ let y = ye(t);
2019
+ return e && y.search && Tt(y.search) && s.append("index", ""), y.search = `?${s}`, { path: pe(y), submission: c };
2020
+ }
2021
+ function er(e, t, r = !1) {
2022
+ let a = e.findIndex((n) => n.route.id === t);
2023
+ return a >= 0 ? e.slice(0, r ? a + 1 : a) : e;
2024
+ }
2025
+ function tr(e, t, r, a, n, i, l, s, u, c, y, b, g, p) {
2026
+ let v = p ? Z(p[1]) ? p[1].error : p[1].data : void 0, L = e.createURL(t.location), x = e.createURL(n), E = r;
2027
+ i && t.errors ? E = er(
2028
+ r,
2029
+ Object.keys(t.errors)[0],
2030
+ !0
2031
+ ) : p && Z(p[1]) && (E = er(
2032
+ r,
2033
+ p[0]
2034
+ ));
2035
+ let C = p ? p[1].statusCode : void 0, T = C && C >= 400, N = E.filter((f, A) => {
2036
+ let { route: I } = f;
2037
+ if (I.lazy)
2038
+ return !0;
2039
+ if (I.loader == null)
2040
+ return !1;
2041
+ if (i)
2042
+ return Lt(I, t.loaderData, t.errors);
2043
+ if (Fn(t.loaderData, t.matches[A], f))
2044
+ return !0;
2045
+ let $ = t.matches[A], W = f;
2046
+ return rr(f, {
2047
+ currentUrl: L,
2048
+ currentParams: $.params,
2049
+ nextUrl: x,
2050
+ nextParams: W.params,
2051
+ ...a,
2052
+ actionResult: v,
2053
+ actionStatus: C,
2054
+ defaultShouldRevalidate: T ? !1 : (
2055
+ // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
2056
+ l || L.pathname + L.search === x.pathname + x.search || // Search params affect all loaders
2057
+ L.search !== x.search || kn($, W)
2058
+ )
2059
+ });
2060
+ }), O = [];
2061
+ return c.forEach((f, A) => {
2062
+ if (i || !r.some((ke) => ke.route.id === f.routeId) || u.has(A))
2063
+ return;
2064
+ let I = me(b, f.path, g);
2065
+ if (!I) {
2066
+ O.push({
2067
+ key: A,
2068
+ routeId: f.routeId,
2069
+ path: f.path,
2070
+ matches: null,
2071
+ match: null,
2072
+ controller: null
2073
+ });
2074
+ return;
2075
+ }
2076
+ let $ = t.fetchers.get(A), W = We(I, f.path), Q = !1;
2077
+ y.has(A) ? Q = !1 : s.has(A) ? (s.delete(A), Q = !0) : $ && $.state !== "idle" && $.data === void 0 ? Q = l : Q = rr(W, {
2078
+ currentUrl: L,
2079
+ currentParams: t.matches[t.matches.length - 1].params,
2080
+ nextUrl: x,
2081
+ nextParams: r[r.length - 1].params,
2082
+ ...a,
2083
+ actionResult: v,
2084
+ actionStatus: C,
2085
+ defaultShouldRevalidate: T ? !1 : l
2086
+ }), Q && O.push({
2087
+ key: A,
2088
+ routeId: f.routeId,
2089
+ path: f.path,
2090
+ matches: I,
2091
+ match: W,
2092
+ controller: new AbortController()
2093
+ });
2094
+ }), [N, O];
2095
+ }
2096
+ function Lt(e, t, r) {
2097
+ if (e.lazy)
2098
+ return !0;
2099
+ if (!e.loader)
2100
+ return !1;
2101
+ let a = t != null && t[e.id] !== void 0, n = r != null && r[e.id] !== void 0;
2102
+ return !a && n ? !1 : typeof e.loader == "function" && e.loader.hydrate === !0 ? !0 : !a && !n;
2103
+ }
2104
+ function Fn(e, t, r) {
2105
+ let a = (
2106
+ // [a] -> [a, b]
2107
+ !t || // [a, b] -> [a, c]
2108
+ r.route.id !== t.route.id
2109
+ ), n = !e.hasOwnProperty(r.route.id);
2110
+ return a || n;
2111
+ }
2112
+ function kn(e, t) {
2113
+ let r = e.route.path;
2114
+ return (
2115
+ // param change for this match, /users/123 -> /users/456
2116
+ e.pathname !== t.pathname || // splat param changed, which is not present in match.path
2117
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
2118
+ r != null && r.endsWith("*") && e.params["*"] !== t.params["*"]
2119
+ );
2120
+ }
2121
+ function rr(e, t) {
2122
+ if (e.route.shouldRevalidate) {
2123
+ let r = e.route.shouldRevalidate(t);
2124
+ if (typeof r == "boolean")
2125
+ return r;
2126
+ }
2127
+ return t.defaultShouldRevalidate;
2128
+ }
2129
+ function nr(e, t, r, a, n) {
2130
+ let i;
2131
+ if (e) {
2132
+ let u = a[e];
2133
+ U(
2134
+ u,
2135
+ `No route found to patch children into: routeId = ${e}`
2136
+ ), u.children || (u.children = []), i = u.children;
2137
+ } else
2138
+ i = r;
2139
+ let l = t.filter(
2140
+ (u) => !i.some(
2141
+ (c) => Rr(u, c)
2142
+ )
2143
+ ), s = ct(
2144
+ l,
2145
+ n,
2146
+ [e || "_", "patch", String(i?.length || "0")],
2147
+ a
2148
+ );
2149
+ i.push(...s);
2150
+ }
2151
+ function Rr(e, t) {
2152
+ return "id" in e && "id" in t && e.id === t.id ? !0 : e.index === t.index && e.path === t.path && e.caseSensitive === t.caseSensitive ? (!e.children || e.children.length === 0) && (!t.children || t.children.length === 0) ? !0 : e.children.every(
2153
+ (r, a) => t.children?.some((n) => Rr(r, n))
2154
+ ) : !1;
2155
+ }
2156
+ async function $n(e, t, r) {
2157
+ if (!e.lazy)
2158
+ return;
2159
+ let a = await e.lazy();
2160
+ if (!e.lazy)
2161
+ return;
2162
+ let n = r[e.id];
2163
+ U(n, "No route found in manifest");
2164
+ let i = {};
2165
+ for (let l in a) {
2166
+ let u = n[l] !== void 0 && // This property isn't static since it should always be updated based
2167
+ // on the route updates
2168
+ l !== "hasErrorBoundary";
2169
+ G(
2170
+ !u,
2171
+ `Route "${n.id}" has a static property "${l}" defined but its lazy function is also returning a value for this property. The lazy route property "${l}" will be ignored.`
2172
+ ), !u && !tn.has(l) && (i[l] = a[l]);
2173
+ }
2174
+ Object.assign(n, i), Object.assign(n, {
2175
+ // To keep things framework agnostic, we use the provided `mapRouteProperties`
2176
+ // function to set the framework-aware properties (`element`/`hasErrorBoundary`)
2177
+ // since the logic will differ between frameworks.
2178
+ ...t(n),
2179
+ lazy: void 0
2180
+ });
2181
+ }
2182
+ async function Un({
2183
+ matches: e
2184
+ }) {
2185
+ let t = e.filter((a) => a.shouldLoad);
2186
+ return (await Promise.all(t.map((a) => a.resolve()))).reduce(
2187
+ (a, n, i) => Object.assign(a, { [t[i].route.id]: n }),
2188
+ {}
2189
+ );
2190
+ }
2191
+ async function Nn(e, t, r, a, n, i, l, s, u, c) {
2192
+ let y = i.map(
2193
+ (p) => p.route.lazy ? $n(p.route, u, s) : void 0
2194
+ ), b = i.map((p, v) => {
2195
+ let L = y[v], x = n.some((C) => C.route.id === p.route.id);
2196
+ return {
2197
+ ...p,
2198
+ shouldLoad: x,
2199
+ resolve: async (C) => (C && a.method === "GET" && (p.route.lazy || p.route.loader) && (x = !0), x ? On(
2200
+ t,
2201
+ a,
2202
+ p,
2203
+ L,
2204
+ C,
2205
+ c
2206
+ ) : Promise.resolve({ type: "data", result: void 0 }))
2207
+ };
2208
+ }), g = await e({
2209
+ matches: b,
2210
+ request: a,
2211
+ params: i[0].params,
2212
+ fetcherKey: l,
2213
+ context: c
2214
+ });
2215
+ try {
2216
+ await Promise.all(y);
2217
+ } catch {
2218
+ }
2219
+ return g;
2220
+ }
2221
+ async function On(e, t, r, a, n, i) {
2222
+ let l, s, u = (c) => {
2223
+ let y, b = new Promise((v, L) => y = L);
2224
+ s = () => y(), t.signal.addEventListener("abort", s);
2225
+ let g = (v) => typeof c != "function" ? Promise.reject(
2226
+ new Error(
2227
+ `You cannot call the handler for a route which defines a boolean "${e}" [routeId: ${r.route.id}]`
2228
+ )
2229
+ ) : c(
2230
+ {
2231
+ request: t,
2232
+ params: r.params,
2233
+ context: i
2234
+ },
2235
+ ...v !== void 0 ? [v] : []
2236
+ ), p = (async () => {
2237
+ try {
2238
+ return { type: "data", result: await (n ? n((L) => g(L)) : g()) };
2239
+ } catch (v) {
2240
+ return { type: "error", result: v };
2241
+ }
2242
+ })();
2243
+ return Promise.race([p, b]);
2244
+ };
2245
+ try {
2246
+ let c = r.route[e];
2247
+ if (a)
2248
+ if (c) {
2249
+ let y, [b] = await Promise.all([
2250
+ // If the handler throws, don't let it immediately bubble out,
2251
+ // since we need to let the lazy() execution finish so we know if this
2252
+ // route has a boundary that can handle the error
2253
+ u(c).catch((g) => {
2254
+ y = g;
2255
+ }),
2256
+ a
2257
+ ]);
2258
+ if (y !== void 0)
2259
+ throw y;
2260
+ l = b;
2261
+ } else if (await a, c = r.route[e], c)
2262
+ l = await u(c);
2263
+ else if (e === "action") {
2264
+ let y = new URL(t.url), b = y.pathname + y.search;
2265
+ throw ee(405, {
2266
+ method: t.method,
2267
+ pathname: b,
2268
+ routeId: r.route.id
2269
+ });
2270
+ } else
2271
+ return { type: "data", result: void 0 };
2272
+ else if (c)
2273
+ l = await u(c);
2274
+ else {
2275
+ let y = new URL(t.url), b = y.pathname + y.search;
2276
+ throw ee(404, {
2277
+ pathname: b
2278
+ });
2279
+ }
2280
+ } catch (c) {
2281
+ return { type: "error", result: c };
2282
+ } finally {
2283
+ s && t.signal.removeEventListener("abort", s);
2284
+ }
2285
+ return l;
2286
+ }
2287
+ async function An(e) {
2288
+ let { result: t, type: r } = e;
2289
+ if (Sr(t)) {
2290
+ let a;
2291
+ try {
2292
+ let n = t.headers.get("Content-Type");
2293
+ n && /\bapplication\/json\b/.test(n) ? t.body == null ? a = null : a = await t.json() : a = await t.text();
2294
+ } catch (n) {
2295
+ return { type: "error", error: n };
2296
+ }
2297
+ return r === "error" ? {
2298
+ type: "error",
2299
+ error: new ht(t.status, t.statusText, a),
2300
+ statusCode: t.status,
2301
+ headers: t.headers
2302
+ } : {
2303
+ type: "data",
2304
+ data: a,
2305
+ statusCode: t.status,
2306
+ headers: t.headers
2307
+ };
2308
+ }
2309
+ return r === "error" ? dr(t) ? t.data instanceof Error ? {
2310
+ type: "error",
2311
+ error: t.data,
2312
+ statusCode: t.init?.status,
2313
+ headers: t.init?.headers ? new Headers(t.init.headers) : void 0
2314
+ } : {
2315
+ type: "error",
2316
+ error: new ht(
2317
+ t.init?.status || 500,
2318
+ void 0,
2319
+ t.data
2320
+ ),
2321
+ statusCode: Ke(t) ? t.status : void 0,
2322
+ headers: t.init?.headers ? new Headers(t.init.headers) : void 0
2323
+ } : {
2324
+ type: "error",
2325
+ error: t,
2326
+ statusCode: Ke(t) ? t.status : void 0
2327
+ } : dr(t) ? {
2328
+ type: "data",
2329
+ data: t.data,
2330
+ statusCode: t.init?.status,
2331
+ headers: t.init?.headers ? new Headers(t.init.headers) : void 0
2332
+ } : { type: "data", data: t };
2333
+ }
2334
+ function In(e, t, r, a, n) {
2335
+ let i = e.headers.get("Location");
2336
+ if (U(
2337
+ i,
2338
+ "Redirects returned/thrown from loaders/actions must have a Location header"
2339
+ ), !Mt.test(i)) {
2340
+ let l = a.slice(
2341
+ 0,
2342
+ a.findIndex((s) => s.route.id === r) + 1
2343
+ );
2344
+ i = St(
2345
+ new URL(t.url),
2346
+ l,
2347
+ n,
2348
+ i
2349
+ ), e.headers.set("Location", i);
2350
+ }
2351
+ return e;
2352
+ }
2353
+ function ar(e, t, r) {
2354
+ if (Mt.test(e)) {
2355
+ let a = e, n = a.startsWith("//") ? new URL(t.protocol + a) : new URL(a), i = re(n.pathname, r) != null;
2356
+ if (n.origin === t.origin && i)
2357
+ return n.pathname + n.search + n.hash;
2358
+ }
2359
+ return e;
2360
+ }
2361
+ function Fe(e, t, r, a) {
2362
+ let n = e.createURL(xr(t)).toString(), i = { signal: r };
2363
+ if (a && te(a.formMethod)) {
2364
+ let { formMethod: l, formEncType: s } = a;
2365
+ i.method = l.toUpperCase(), s === "application/json" ? (i.headers = new Headers({ "Content-Type": s }), i.body = JSON.stringify(a.json)) : s === "text/plain" ? i.body = a.text : s === "application/x-www-form-urlencoded" && a.formData ? i.body = Ct(a.formData) : i.body = a.formData;
2366
+ }
2367
+ return new Request(n, i);
2368
+ }
2369
+ function Ct(e) {
2370
+ let t = new URLSearchParams();
2371
+ for (let [r, a] of e.entries())
2372
+ t.append(r, typeof a == "string" ? a : a.name);
2373
+ return t;
2374
+ }
2375
+ function ir(e) {
2376
+ let t = new FormData();
2377
+ for (let [r, a] of e.entries())
2378
+ t.append(r, a);
2379
+ return t;
2380
+ }
2381
+ function jn(e, t, r, a = !1, n = !1) {
2382
+ let i = {}, l = null, s, u = !1, c = {}, y = r && Z(r[1]) ? r[1].error : void 0;
2383
+ return e.forEach((b) => {
2384
+ if (!(b.route.id in t))
2385
+ return;
2386
+ let g = b.route.id, p = t[g];
2387
+ if (U(
2388
+ !xe(p),
2389
+ "Cannot handle redirect results in processLoaderData"
2390
+ ), Z(p)) {
2391
+ let v = p.error;
2392
+ if (y !== void 0 && (v = y, y = void 0), l = l || {}, n)
2393
+ l[g] = v;
2394
+ else {
2395
+ let L = Re(e, g);
2396
+ l[L.route.id] == null && (l[L.route.id] = v);
2397
+ }
2398
+ a || (i[g] = Er), u || (u = !0, s = Ke(p.error) ? p.error.status : 500), p.headers && (c[g] = p.headers);
2399
+ } else
2400
+ i[g] = p.data, p.statusCode && p.statusCode !== 200 && !u && (s = p.statusCode), p.headers && (c[g] = p.headers);
2401
+ }), y !== void 0 && r && (l = { [r[0]]: y }, i[r[0]] = void 0), {
2402
+ loaderData: i,
2403
+ errors: l,
2404
+ statusCode: s || 200,
2405
+ loaderHeaders: c
2406
+ };
2407
+ }
2408
+ function or(e, t, r, a, n, i) {
2409
+ let { loaderData: l, errors: s } = jn(
2410
+ t,
2411
+ r,
2412
+ a
2413
+ );
2414
+ return n.forEach((u) => {
2415
+ let { key: c, match: y, controller: b } = u, g = i[c];
2416
+ if (U(g, "Did not find corresponding fetcher result"), !(b && b.signal.aborted))
2417
+ if (Z(g)) {
2418
+ let p = Re(e.matches, y?.route.id);
2419
+ s && s[p.route.id] || (s = {
2420
+ ...s,
2421
+ [p.route.id]: g.error
2422
+ }), e.fetchers.delete(c);
2423
+ } else if (xe(g))
2424
+ U(!1, "Unhandled fetcher revalidation redirect");
2425
+ else {
2426
+ let p = he(g.data);
2427
+ e.fetchers.set(c, p);
2428
+ }
2429
+ }), { loaderData: l, errors: s };
2430
+ }
2431
+ function lr(e, t, r, a) {
2432
+ let n = Object.entries(t).filter(([, i]) => i !== Er).reduce((i, [l, s]) => (i[l] = s, i), {});
2433
+ for (let i of r) {
2434
+ let l = i.route.id;
2435
+ if (!t.hasOwnProperty(l) && e.hasOwnProperty(l) && i.route.loader && (n[l] = e[l]), a && a.hasOwnProperty(l))
2436
+ break;
2437
+ }
2438
+ return n;
2439
+ }
2440
+ function sr(e) {
2441
+ return e ? Z(e[1]) ? {
2442
+ // Clear out prior actionData on errors
2443
+ actionData: {}
2444
+ } : {
2445
+ actionData: {
2446
+ [e[0]]: e[1].data
2447
+ }
2448
+ } : {};
2449
+ }
2450
+ function Re(e, t) {
2451
+ return (t ? e.slice(0, e.findIndex((a) => a.route.id === t) + 1) : [...e]).reverse().find((a) => a.route.hasErrorBoundary === !0) || e[0];
2452
+ }
2453
+ function ur(e) {
2454
+ let t = e.length === 1 ? e[0] : e.find((r) => r.index || !r.path || r.path === "/") || {
2455
+ id: "__shim-error-route__"
2456
+ };
2457
+ return {
2458
+ matches: [
2459
+ {
2460
+ params: {},
2461
+ pathname: "",
2462
+ pathnameBase: "",
2463
+ route: t
2464
+ }
2465
+ ],
2466
+ route: t
2467
+ };
2468
+ }
2469
+ function ee(e, {
2470
+ pathname: t,
2471
+ routeId: r,
2472
+ method: a,
2473
+ type: n,
2474
+ message: i
2475
+ } = {}) {
2476
+ let l = "Unknown Server Error", s = "Unknown @remix-run/router error";
2477
+ return e === 400 ? (l = "Bad Request", a && t && r ? s = `You made a ${a} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.` : n === "invalid-body" && (s = "Unable to encode submission body")) : e === 403 ? (l = "Forbidden", s = `Route "${r}" does not match URL "${t}"`) : e === 404 ? (l = "Not Found", s = `No route matches URL "${t}"`) : e === 405 && (l = "Method Not Allowed", a && t && r ? s = `You made a ${a.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.` : a && (s = `Invalid request method "${a.toUpperCase()}"`)), new ht(
2478
+ e || 500,
2479
+ l,
2480
+ new Error(s),
2481
+ !0
2482
+ );
2483
+ }
2484
+ function ot(e) {
2485
+ let t = Object.entries(e);
2486
+ for (let r = t.length - 1; r >= 0; r--) {
2487
+ let [a, n] = t[r];
2488
+ if (xe(n))
2489
+ return { key: a, result: n };
2490
+ }
2491
+ }
2492
+ function xr(e) {
2493
+ let t = typeof e == "string" ? ye(e) : e;
2494
+ return pe({ ...t, hash: "" });
2495
+ }
2496
+ function Hn(e, t) {
2497
+ return e.pathname !== t.pathname || e.search !== t.search ? !1 : e.hash === "" ? t.hash !== "" : e.hash === t.hash ? !0 : t.hash !== "";
2498
+ }
2499
+ function zn(e) {
2500
+ return Sr(e.result) && Ln.has(e.result.status);
2501
+ }
2502
+ function Z(e) {
2503
+ return e.type === "error";
2504
+ }
2505
+ function xe(e) {
2506
+ return (e && e.type) === "redirect";
2507
+ }
2508
+ function dr(e) {
2509
+ return typeof e == "object" && e != null && "type" in e && "data" in e && "init" in e && e.type === "DataWithResponseInit";
2510
+ }
2511
+ function Sr(e) {
2512
+ return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.headers == "object" && typeof e.body < "u";
2513
+ }
2514
+ function _n(e) {
2515
+ return Sn.has(e.toUpperCase());
2516
+ }
2517
+ function te(e) {
2518
+ return Rn.has(e.toUpperCase());
2519
+ }
2520
+ function Tt(e) {
2521
+ return new URLSearchParams(e).getAll("index").some((t) => t === "");
2522
+ }
2523
+ function We(e, t) {
2524
+ let r = typeof t == "string" ? ye(t).search : t.search;
2525
+ if (e[e.length - 1].route.index && Tt(r || ""))
2526
+ return e[e.length - 1];
2527
+ let a = vr(e);
2528
+ return a[a.length - 1];
2529
+ }
2530
+ function cr(e) {
2531
+ let { formMethod: t, formAction: r, formEncType: a, text: n, formData: i, json: l } = e;
2532
+ if (!(!t || !r || !a)) {
2533
+ if (n != null)
2534
+ return {
2535
+ formMethod: t,
2536
+ formAction: r,
2537
+ formEncType: a,
2538
+ formData: void 0,
2539
+ json: void 0,
2540
+ text: n
2541
+ };
2542
+ if (i != null)
2543
+ return {
2544
+ formMethod: t,
2545
+ formAction: r,
2546
+ formEncType: a,
2547
+ formData: i,
2548
+ json: void 0,
2549
+ text: void 0
2550
+ };
2551
+ if (l !== void 0)
2552
+ return {
2553
+ formMethod: t,
2554
+ formAction: r,
2555
+ formEncType: a,
2556
+ formData: void 0,
2557
+ json: l,
2558
+ text: void 0
2559
+ };
2560
+ }
2561
+ }
2562
+ function Rt(e, t) {
2563
+ return t ? {
2564
+ state: "loading",
2565
+ location: e,
2566
+ formMethod: t.formMethod,
2567
+ formAction: t.formAction,
2568
+ formEncType: t.formEncType,
2569
+ formData: t.formData,
2570
+ json: t.json,
2571
+ text: t.text
2572
+ } : {
2573
+ state: "loading",
2574
+ location: e,
2575
+ formMethod: void 0,
2576
+ formAction: void 0,
2577
+ formEncType: void 0,
2578
+ formData: void 0,
2579
+ json: void 0,
2580
+ text: void 0
2581
+ };
2582
+ }
2583
+ function Bn(e, t) {
2584
+ return {
2585
+ state: "submitting",
2586
+ location: e,
2587
+ formMethod: t.formMethod,
2588
+ formAction: t.formAction,
2589
+ formEncType: t.formEncType,
2590
+ formData: t.formData,
2591
+ json: t.json,
2592
+ text: t.text
2593
+ };
2594
+ }
2595
+ function _e(e, t) {
2596
+ return e ? {
2597
+ state: "loading",
2598
+ formMethod: e.formMethod,
2599
+ formAction: e.formAction,
2600
+ formEncType: e.formEncType,
2601
+ formData: e.formData,
2602
+ json: e.json,
2603
+ text: e.text,
2604
+ data: t
2605
+ } : {
2606
+ state: "loading",
2607
+ formMethod: void 0,
2608
+ formAction: void 0,
2609
+ formEncType: void 0,
2610
+ formData: void 0,
2611
+ json: void 0,
2612
+ text: void 0,
2613
+ data: t
2614
+ };
2615
+ }
2616
+ function Wn(e, t) {
2617
+ return {
2618
+ state: "submitting",
2619
+ formMethod: e.formMethod,
2620
+ formAction: e.formAction,
2621
+ formEncType: e.formEncType,
2622
+ formData: e.formData,
2623
+ json: e.json,
2624
+ text: e.text,
2625
+ data: t ? t.data : void 0
2626
+ };
2627
+ }
2628
+ function he(e) {
2629
+ return {
2630
+ state: "idle",
2631
+ formMethod: void 0,
2632
+ formAction: void 0,
2633
+ formEncType: void 0,
2634
+ formData: void 0,
2635
+ json: void 0,
2636
+ text: void 0,
2637
+ data: e
2638
+ };
2639
+ }
2640
+ function Vn(e, t) {
2641
+ try {
2642
+ let r = e.sessionStorage.getItem(
2643
+ br
2644
+ );
2645
+ if (r) {
2646
+ let a = JSON.parse(r);
2647
+ for (let [n, i] of Object.entries(a || {}))
2648
+ i && Array.isArray(i) && t.set(n, new Set(i || []));
2649
+ }
2650
+ } catch {
2651
+ }
2652
+ }
2653
+ function Kn(e, t) {
2654
+ if (t.size > 0) {
2655
+ let r = {};
2656
+ for (let [a, n] of t)
2657
+ r[a] = [...n];
2658
+ try {
2659
+ e.sessionStorage.setItem(
2660
+ br,
2661
+ JSON.stringify(r)
2662
+ );
2663
+ } catch (a) {
2664
+ G(
2665
+ !1,
2666
+ `Failed to save applied view transitions in sessionStorage (${a}).`
2667
+ );
2668
+ }
2669
+ }
2670
+ }
2671
+ function Yn() {
2672
+ let e, t, r = new Promise((a, n) => {
2673
+ e = async (i) => {
2674
+ a(i);
2675
+ try {
2676
+ await r;
2677
+ } catch {
2678
+ }
2679
+ }, t = async (i) => {
2680
+ n(i);
2681
+ try {
2682
+ await r;
2683
+ } catch {
2684
+ }
2685
+ };
2686
+ });
2687
+ return {
2688
+ promise: r,
2689
+ //@ts-ignore
2690
+ resolve: e,
2691
+ //@ts-ignore
2692
+ reject: t
2693
+ };
2694
+ }
2695
+ var Se = m.createContext(null);
2696
+ Se.displayName = "DataRouter";
2697
+ var Ye = m.createContext(null);
2698
+ Ye.displayName = "DataRouterState";
2699
+ var Ft = m.createContext({
2700
+ isTransitioning: !1
2701
+ });
2702
+ Ft.displayName = "ViewTransition";
2703
+ var Lr = m.createContext(
2704
+ /* @__PURE__ */ new Map()
2705
+ );
2706
+ Lr.displayName = "Fetchers";
2707
+ var Jn = m.createContext(null);
2708
+ Jn.displayName = "Await";
2709
+ var oe = m.createContext(
2710
+ null
2711
+ );
2712
+ oe.displayName = "Navigation";
2713
+ var mt = m.createContext(
2714
+ null
2715
+ );
2716
+ mt.displayName = "Location";
2717
+ var de = m.createContext({
2718
+ outlet: null,
2719
+ matches: [],
2720
+ isDataRoute: !1
2721
+ });
2722
+ de.displayName = "Route";
2723
+ var kt = m.createContext(null);
2724
+ kt.displayName = "RouteError";
2725
+ function Gn(e, { relative: t } = {}) {
2726
+ U(
2727
+ Je(),
2728
+ // TODO: This error is probably because they somehow have 2 versions of the
2729
+ // router loaded. We can help them understand how to avoid that.
2730
+ "useHref() may be used only in the context of a <Router> component."
2731
+ );
2732
+ let { basename: r, navigator: a } = m.useContext(oe), { hash: n, pathname: i, search: l } = Ge(e, { relative: t }), s = i;
2733
+ return r !== "/" && (s = i === "/" ? r : ie([r, i])), a.createHref({ pathname: s, search: l, hash: n });
2734
+ }
2735
+ function Je() {
2736
+ return m.useContext(mt) != null;
2737
+ }
2738
+ function Le() {
2739
+ return U(
2740
+ Je(),
2741
+ // TODO: This error is probably because they somehow have 2 versions of the
2742
+ // router loaded. We can help them understand how to avoid that.
2743
+ "useLocation() may be used only in the context of a <Router> component."
2744
+ ), m.useContext(mt).location;
2745
+ }
2746
+ var Cr = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
2747
+ function Pr(e) {
2748
+ m.useContext(oe).static || m.useLayoutEffect(e);
2749
+ }
2750
+ function Xn() {
2751
+ let { isDataRoute: e } = m.useContext(de);
2752
+ return e ? ua() : Qn();
2753
+ }
2754
+ function Qn() {
2755
+ U(
2756
+ Je(),
2757
+ // TODO: This error is probably because they somehow have 2 versions of the
2758
+ // router loaded. We can help them understand how to avoid that.
2759
+ "useNavigate() may be used only in the context of a <Router> component."
2760
+ );
2761
+ let e = m.useContext(Se), { basename: t, navigator: r } = m.useContext(oe), { matches: a } = m.useContext(de), { pathname: n } = Le(), i = JSON.stringify(Pt(a)), l = m.useRef(!1);
2762
+ return Pr(() => {
2763
+ l.current = !0;
2764
+ }), m.useCallback(
2765
+ (u, c = {}) => {
2766
+ if (G(l.current, Cr), !l.current) return;
2767
+ if (typeof u == "number") {
2768
+ r.go(u);
2769
+ return;
2770
+ }
2771
+ let y = Dt(
2772
+ u,
2773
+ JSON.parse(i),
2774
+ n,
2775
+ c.relative === "path"
2776
+ );
2777
+ e == null && t !== "/" && (y.pathname = y.pathname === "/" ? t : ie([t, y.pathname])), (c.replace ? r.replace : r.push)(
2778
+ y,
2779
+ c.state,
2780
+ c
2781
+ );
2782
+ },
2783
+ [
2784
+ t,
2785
+ r,
2786
+ i,
2787
+ n,
2788
+ e
2789
+ ]
2790
+ );
2791
+ }
2792
+ m.createContext(null);
2793
+ function Ge(e, { relative: t } = {}) {
2794
+ let { matches: r } = m.useContext(de), { pathname: a } = Le(), n = JSON.stringify(Pt(r));
2795
+ return m.useMemo(
2796
+ () => Dt(
2797
+ e,
2798
+ JSON.parse(n),
2799
+ a,
2800
+ t === "path"
2801
+ ),
2802
+ [e, n, a, t]
2803
+ );
2804
+ }
2805
+ function qn(e, t, r, a) {
2806
+ U(
2807
+ Je(),
2808
+ // TODO: This error is probably because they somehow have 2 versions of the
2809
+ // router loaded. We can help them understand how to avoid that.
2810
+ "useRoutes() may be used only in the context of a <Router> component."
2811
+ );
2812
+ let { navigator: n, static: i } = m.useContext(oe), { matches: l } = m.useContext(de), s = l[l.length - 1], u = s ? s.params : {}, c = s ? s.pathname : "/", y = s ? s.pathnameBase : "/", b = s && s.route;
2813
+ {
2814
+ let C = b && b.path || "";
2815
+ Dr(
2816
+ c,
2817
+ !b || C.endsWith("*") || C.endsWith("*?"),
2818
+ `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${C}">) 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.
2819
+
2820
+ Please change the parent <Route path="${C}"> to <Route path="${C === "/" ? "*" : `${C}/*`}">.`
2821
+ );
2822
+ }
2823
+ let g = Le(), p;
2824
+ p = g;
2825
+ let v = p.pathname || "/", L = v;
2826
+ if (y !== "/") {
2827
+ let C = y.replace(/^\//, "").split("/");
2828
+ L = "/" + v.replace(/^\//, "").split("/").slice(C.length).join("/");
2829
+ }
2830
+ let x = !i && r && r.matches && r.matches.length > 0 ? r.matches : me(e, { pathname: L });
2831
+ return G(
2832
+ b || x != null,
2833
+ `No routes matched location "${p.pathname}${p.search}${p.hash}" `
2834
+ ), G(
2835
+ x == null || x[x.length - 1].route.element !== void 0 || x[x.length - 1].route.Component !== void 0 || x[x.length - 1].route.lazy !== void 0,
2836
+ `Matched leaf route at location "${p.pathname}${p.search}${p.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.`
2837
+ ), na(
2838
+ x && x.map(
2839
+ (C) => Object.assign({}, C, {
2840
+ params: Object.assign({}, u, C.params),
2841
+ pathname: ie([
2842
+ y,
2843
+ // Re-encode pathnames that were decoded inside matchRoutes
2844
+ n.encodeLocation ? n.encodeLocation(C.pathname).pathname : C.pathname
2845
+ ]),
2846
+ pathnameBase: C.pathnameBase === "/" ? y : ie([
2847
+ y,
2848
+ // Re-encode pathnames that were decoded inside matchRoutes
2849
+ n.encodeLocation ? n.encodeLocation(C.pathnameBase).pathname : C.pathnameBase
2850
+ ])
2851
+ })
2852
+ ),
2853
+ l,
2854
+ r,
2855
+ a
2856
+ );
2857
+ }
2858
+ function Zn() {
2859
+ let e = sa(), t = Ke(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), r = e instanceof Error ? e.stack : null, a = "rgba(200,200,200, 0.5)", n = { padding: "0.5rem", backgroundColor: a }, i = { padding: "2px 4px", backgroundColor: a }, l = null;
2860
+ return console.error(
2861
+ "Error handled by React Router default ErrorBoundary:",
2862
+ e
2863
+ ), l = /* @__PURE__ */ m.createElement(m.Fragment, null, /* @__PURE__ */ m.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ m.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ m.createElement("code", { style: i }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ m.createElement("code", { style: i }, "errorElement"), " prop on your route.")), /* @__PURE__ */ m.createElement(m.Fragment, null, /* @__PURE__ */ m.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ m.createElement("h3", { style: { fontStyle: "italic" } }, t), r ? /* @__PURE__ */ m.createElement("pre", { style: n }, r) : null, l);
2864
+ }
2865
+ var ea = /* @__PURE__ */ m.createElement(Zn, null), ta = class extends m.Component {
2866
+ constructor(e) {
2867
+ super(e), this.state = {
2868
+ location: e.location,
2869
+ revalidation: e.revalidation,
2870
+ error: e.error
2871
+ };
2872
+ }
2873
+ static getDerivedStateFromError(e) {
2874
+ return { error: e };
2875
+ }
2876
+ static getDerivedStateFromProps(e, t) {
2877
+ return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
2878
+ error: e.error,
2879
+ location: e.location,
2880
+ revalidation: e.revalidation
2881
+ } : {
2882
+ error: e.error !== void 0 ? e.error : t.error,
2883
+ location: t.location,
2884
+ revalidation: e.revalidation || t.revalidation
2885
+ };
2886
+ }
2887
+ componentDidCatch(e, t) {
2888
+ console.error(
2889
+ "React Router caught the following error during render",
2890
+ e,
2891
+ t
2892
+ );
2893
+ }
2894
+ render() {
2895
+ return this.state.error !== void 0 ? /* @__PURE__ */ m.createElement(de.Provider, { value: this.props.routeContext }, /* @__PURE__ */ m.createElement(
2896
+ kt.Provider,
2897
+ {
2898
+ value: this.state.error,
2899
+ children: this.props.component
2900
+ }
2901
+ )) : this.props.children;
2902
+ }
2903
+ };
2904
+ function ra({ routeContext: e, match: t, children: r }) {
2905
+ let a = m.useContext(Se);
2906
+ return a && a.static && a.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (a.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ m.createElement(de.Provider, { value: e }, r);
2907
+ }
2908
+ function na(e, t = [], r = null, a = null) {
2909
+ if (e == null) {
2910
+ if (!r)
2911
+ return null;
2912
+ if (r.errors)
2913
+ e = r.matches;
2914
+ else if (t.length === 0 && !r.initialized && r.matches.length > 0)
2915
+ e = r.matches;
2916
+ else
2917
+ return null;
2918
+ }
2919
+ let n = e, i = r?.errors;
2920
+ if (i != null) {
2921
+ let u = n.findIndex(
2922
+ (c) => c.route.id && i?.[c.route.id] !== void 0
2923
+ );
2924
+ U(
2925
+ u >= 0,
2926
+ `Could not find a matching route for errors on route IDs: ${Object.keys(
2927
+ i
2928
+ ).join(",")}`
2929
+ ), n = n.slice(
2930
+ 0,
2931
+ Math.min(n.length, u + 1)
2932
+ );
2933
+ }
2934
+ let l = !1, s = -1;
2935
+ if (r)
2936
+ for (let u = 0; u < n.length; u++) {
2937
+ let c = n[u];
2938
+ if ((c.route.HydrateFallback || c.route.hydrateFallbackElement) && (s = u), c.route.id) {
2939
+ let { loaderData: y, errors: b } = r, g = c.route.loader && !y.hasOwnProperty(c.route.id) && (!b || b[c.route.id] === void 0);
2940
+ if (c.route.lazy || g) {
2941
+ l = !0, s >= 0 ? n = n.slice(0, s + 1) : n = [n[0]];
2942
+ break;
2943
+ }
2944
+ }
2945
+ }
2946
+ return n.reduceRight((u, c, y) => {
2947
+ let b, g = !1, p = null, v = null;
2948
+ r && (b = i && c.route.id ? i[c.route.id] : void 0, p = c.route.errorElement || ea, l && (s < 0 && y === 0 ? (Dr(
2949
+ "route-fallback",
2950
+ !1,
2951
+ "No `HydrateFallback` element provided to render during initial hydration"
2952
+ ), g = !0, v = null) : s === y && (g = !0, v = c.route.hydrateFallbackElement || null)));
2953
+ let L = t.concat(n.slice(0, y + 1)), x = () => {
2954
+ let E;
2955
+ return b ? E = p : g ? E = v : c.route.Component ? E = /* @__PURE__ */ m.createElement(c.route.Component, null) : c.route.element ? E = c.route.element : E = u, /* @__PURE__ */ m.createElement(
2956
+ ra,
2957
+ {
2958
+ match: c,
2959
+ routeContext: {
2960
+ outlet: u,
2961
+ matches: L,
2962
+ isDataRoute: r != null
2963
+ },
2964
+ children: E
2965
+ }
2966
+ );
2967
+ };
2968
+ return r && (c.route.ErrorBoundary || c.route.errorElement || y === 0) ? /* @__PURE__ */ m.createElement(
2969
+ ta,
2970
+ {
2971
+ location: r.location,
2972
+ revalidation: r.revalidation,
2973
+ component: p,
2974
+ error: b,
2975
+ children: x(),
2976
+ routeContext: { outlet: null, matches: L, isDataRoute: !0 }
2977
+ }
2978
+ ) : x();
2979
+ }, null);
2980
+ }
2981
+ function $t(e) {
2982
+ return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
2983
+ }
2984
+ function aa(e) {
2985
+ let t = m.useContext(Se);
2986
+ return U(t, $t(e)), t;
2987
+ }
2988
+ function ia(e) {
2989
+ let t = m.useContext(Ye);
2990
+ return U(t, $t(e)), t;
2991
+ }
2992
+ function oa(e) {
2993
+ let t = m.useContext(de);
2994
+ return U(t, $t(e)), t;
2995
+ }
2996
+ function Ut(e) {
2997
+ let t = oa(e), r = t.matches[t.matches.length - 1];
2998
+ return U(
2999
+ r.route.id,
3000
+ `${e} can only be used on routes that contain a unique "id"`
3001
+ ), r.route.id;
3002
+ }
3003
+ function la() {
3004
+ return Ut(
3005
+ "useRouteId"
3006
+ /* UseRouteId */
3007
+ );
3008
+ }
3009
+ function sa() {
3010
+ let e = m.useContext(kt), t = ia(
3011
+ "useRouteError"
3012
+ /* UseRouteError */
3013
+ ), r = Ut(
3014
+ "useRouteError"
3015
+ /* UseRouteError */
3016
+ );
3017
+ return e !== void 0 ? e : t.errors?.[r];
3018
+ }
3019
+ function ua() {
3020
+ let { router: e } = aa(
3021
+ "useNavigate"
3022
+ /* UseNavigateStable */
3023
+ ), t = Ut(
3024
+ "useNavigate"
3025
+ /* UseNavigateStable */
3026
+ ), r = m.useRef(!1);
3027
+ return Pr(() => {
3028
+ r.current = !0;
3029
+ }), m.useCallback(
3030
+ async (n, i = {}) => {
3031
+ G(r.current, Cr), r.current && (typeof n == "number" ? e.navigate(n) : await e.navigate(n, { fromRouteId: t, ...i }));
3032
+ },
3033
+ [e, t]
3034
+ );
3035
+ }
3036
+ var fr = {};
3037
+ function Dr(e, t, r) {
3038
+ !t && !fr[e] && (fr[e] = !0, G(!1, r));
3039
+ }
3040
+ var hr = {};
3041
+ function mr(e, t) {
3042
+ !e && !hr[t] && (hr[t] = !0, console.warn(t));
3043
+ }
3044
+ function da(e) {
3045
+ let t = {
3046
+ // Note: this check also occurs in createRoutesFromChildren so update
3047
+ // there if you change this -- please and thank you!
3048
+ hasErrorBoundary: e.hasErrorBoundary || e.ErrorBoundary != null || e.errorElement != null
3049
+ };
3050
+ return e.Component && (e.element && G(
3051
+ !1,
3052
+ "You should not include both `Component` and `element` on your route - `Component` will be used."
3053
+ ), Object.assign(t, {
3054
+ element: m.createElement(e.Component),
3055
+ Component: void 0
3056
+ })), e.HydrateFallback && (e.hydrateFallbackElement && G(
3057
+ !1,
3058
+ "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."
3059
+ ), Object.assign(t, {
3060
+ hydrateFallbackElement: m.createElement(e.HydrateFallback),
3061
+ HydrateFallback: void 0
3062
+ })), e.ErrorBoundary && (e.errorElement && G(
3063
+ !1,
3064
+ "You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."
3065
+ ), Object.assign(t, {
3066
+ errorElement: m.createElement(e.ErrorBoundary),
3067
+ ErrorBoundary: void 0
3068
+ })), t;
3069
+ }
3070
+ var ca = class {
3071
+ constructor() {
3072
+ this.status = "pending", this.promise = new Promise((e, t) => {
3073
+ this.resolve = (r) => {
3074
+ this.status === "pending" && (this.status = "resolved", e(r));
3075
+ }, this.reject = (r) => {
3076
+ this.status === "pending" && (this.status = "rejected", t(r));
3077
+ };
3078
+ });
3079
+ }
3080
+ };
3081
+ function Ga({
3082
+ router: e,
3083
+ flushSync: t
3084
+ }) {
3085
+ let [r, a] = m.useState(e.state), [n, i] = m.useState(), [l, s] = m.useState({
3086
+ isTransitioning: !1
3087
+ }), [u, c] = m.useState(), [y, b] = m.useState(), [g, p] = m.useState(), v = m.useRef(/* @__PURE__ */ new Map()), L = m.useCallback(
3088
+ (T, { deletedFetchers: N, flushSync: O, viewTransitionOpts: f }) => {
3089
+ T.fetchers.forEach((I, $) => {
3090
+ I.data !== void 0 && v.current.set($, I.data);
3091
+ }), N.forEach((I) => v.current.delete(I)), mr(
3092
+ O === !1 || t != null,
3093
+ 'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.'
3094
+ );
3095
+ let A = e.window != null && e.window.document != null && typeof e.window.document.startViewTransition == "function";
3096
+ if (mr(
3097
+ f == null || A,
3098
+ "You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."
3099
+ ), !f || !A) {
3100
+ t && O ? t(() => a(T)) : m.startTransition(() => a(T));
3101
+ return;
3102
+ }
3103
+ if (t && O) {
3104
+ t(() => {
3105
+ y && (u && u.resolve(), y.skipTransition()), s({
3106
+ isTransitioning: !0,
3107
+ flushSync: !0,
3108
+ currentLocation: f.currentLocation,
3109
+ nextLocation: f.nextLocation
3110
+ });
3111
+ });
3112
+ let I = e.window.document.startViewTransition(() => {
3113
+ t(() => a(T));
3114
+ });
3115
+ I.finished.finally(() => {
3116
+ t(() => {
3117
+ c(void 0), b(void 0), i(void 0), s({ isTransitioning: !1 });
3118
+ });
3119
+ }), t(() => b(I));
3120
+ return;
3121
+ }
3122
+ y ? (u && u.resolve(), y.skipTransition(), p({
3123
+ state: T,
3124
+ currentLocation: f.currentLocation,
3125
+ nextLocation: f.nextLocation
3126
+ })) : (i(T), s({
3127
+ isTransitioning: !0,
3128
+ flushSync: !1,
3129
+ currentLocation: f.currentLocation,
3130
+ nextLocation: f.nextLocation
3131
+ }));
3132
+ },
3133
+ [e.window, t, y, u]
3134
+ );
3135
+ m.useLayoutEffect(() => e.subscribe(L), [e, L]), m.useEffect(() => {
3136
+ l.isTransitioning && !l.flushSync && c(new ca());
3137
+ }, [l]), m.useEffect(() => {
3138
+ if (u && n && e.window) {
3139
+ let T = n, N = u.promise, O = e.window.document.startViewTransition(async () => {
3140
+ m.startTransition(() => a(T)), await N;
3141
+ });
3142
+ O.finished.finally(() => {
3143
+ c(void 0), b(void 0), i(void 0), s({ isTransitioning: !1 });
3144
+ }), b(O);
3145
+ }
3146
+ }, [n, u, e.window]), m.useEffect(() => {
3147
+ u && n && r.location.key === n.location.key && u.resolve();
3148
+ }, [u, y, r.location, n]), m.useEffect(() => {
3149
+ !l.isTransitioning && g && (i(g.state), s({
3150
+ isTransitioning: !0,
3151
+ flushSync: !1,
3152
+ currentLocation: g.currentLocation,
3153
+ nextLocation: g.nextLocation
3154
+ }), p(void 0));
3155
+ }, [l.isTransitioning, g]);
3156
+ let x = m.useMemo(() => ({
3157
+ createHref: e.createHref,
3158
+ encodeLocation: e.encodeLocation,
3159
+ go: (T) => e.navigate(T),
3160
+ push: (T, N, O) => e.navigate(T, {
3161
+ state: N,
3162
+ preventScrollReset: O?.preventScrollReset
3163
+ }),
3164
+ replace: (T, N, O) => e.navigate(T, {
3165
+ replace: !0,
3166
+ state: N,
3167
+ preventScrollReset: O?.preventScrollReset
3168
+ })
3169
+ }), [e]), E = e.basename || "/", C = m.useMemo(
3170
+ () => ({
3171
+ router: e,
3172
+ navigator: x,
3173
+ static: !1,
3174
+ basename: E
3175
+ }),
3176
+ [e, x, E]
3177
+ );
3178
+ return /* @__PURE__ */ m.createElement(m.Fragment, null, /* @__PURE__ */ m.createElement(Se.Provider, { value: C }, /* @__PURE__ */ m.createElement(Ye.Provider, { value: r }, /* @__PURE__ */ m.createElement(Lr.Provider, { value: v.current }, /* @__PURE__ */ m.createElement(Ft.Provider, { value: l }, /* @__PURE__ */ m.createElement(
3179
+ ma,
3180
+ {
3181
+ basename: E,
3182
+ location: r.location,
3183
+ navigationType: r.historyAction,
3184
+ navigator: x
3185
+ },
3186
+ /* @__PURE__ */ m.createElement(
3187
+ fa,
3188
+ {
3189
+ routes: e.routes,
3190
+ future: e.future,
3191
+ state: r
3192
+ }
3193
+ )
3194
+ ))))), null);
3195
+ }
3196
+ var fa = m.memo(ha);
3197
+ function ha({
3198
+ routes: e,
3199
+ future: t,
3200
+ state: r
3201
+ }) {
3202
+ return qn(e, void 0, r, t);
3203
+ }
3204
+ function ma({
3205
+ basename: e = "/",
3206
+ children: t = null,
3207
+ location: r,
3208
+ navigationType: a = "POP",
3209
+ navigator: n,
3210
+ static: i = !1
3211
+ }) {
3212
+ U(
3213
+ !Je(),
3214
+ "You cannot render a <Router> inside another <Router>. You should never have more than one in your app."
3215
+ );
3216
+ let l = e.replace(/^\/*/, "/"), s = m.useMemo(
3217
+ () => ({
3218
+ basename: l,
3219
+ navigator: n,
3220
+ static: i,
3221
+ future: {}
3222
+ }),
3223
+ [l, n, i]
3224
+ );
3225
+ typeof r == "string" && (r = ye(r));
3226
+ let {
3227
+ pathname: u = "/",
3228
+ search: c = "",
3229
+ hash: y = "",
3230
+ state: b = null,
3231
+ key: g = "default"
3232
+ } = r, p = m.useMemo(() => {
3233
+ let v = re(u, l);
3234
+ return v == null ? null : {
3235
+ location: {
3236
+ pathname: v,
3237
+ search: c,
3238
+ hash: y,
3239
+ state: b,
3240
+ key: g
3241
+ },
3242
+ navigationType: a
3243
+ };
3244
+ }, [l, u, c, y, b, g, a]);
3245
+ return G(
3246
+ p != null,
3247
+ `<Router basename="${l}"> is not able to match the URL "${u}${c}${y}" because it does not start with the basename, so the <Router> won't render anything.`
3248
+ ), p == null ? null : /* @__PURE__ */ m.createElement(oe.Provider, { value: s }, /* @__PURE__ */ m.createElement(mt.Provider, { children: t, value: p }));
3249
+ }
3250
+ var ut = "get", dt = "application/x-www-form-urlencoded";
3251
+ function pt(e) {
3252
+ return e != null && typeof e.tagName == "string";
3253
+ }
3254
+ function pa(e) {
3255
+ return pt(e) && e.tagName.toLowerCase() === "button";
3256
+ }
3257
+ function ya(e) {
3258
+ return pt(e) && e.tagName.toLowerCase() === "form";
3259
+ }
3260
+ function ga(e) {
3261
+ return pt(e) && e.tagName.toLowerCase() === "input";
3262
+ }
3263
+ function va(e) {
3264
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
3265
+ }
3266
+ function wa(e, t) {
3267
+ return e.button === 0 && // Ignore everything but left clicks
3268
+ (!t || t === "_self") && // Let browser handle "target=_blank" etc.
3269
+ !va(e);
3270
+ }
3271
+ var lt = null;
3272
+ function ba() {
3273
+ if (lt === null)
3274
+ try {
3275
+ new FormData(
3276
+ document.createElement("form"),
3277
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
3278
+ 0
3279
+ ), lt = !1;
3280
+ } catch {
3281
+ lt = !0;
3282
+ }
3283
+ return lt;
3284
+ }
3285
+ var Ea = /* @__PURE__ */ new Set([
3286
+ "application/x-www-form-urlencoded",
3287
+ "multipart/form-data",
3288
+ "text/plain"
3289
+ ]);
3290
+ function xt(e) {
3291
+ return e != null && !Ea.has(e) ? (G(
3292
+ !1,
3293
+ `"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dt}"`
3294
+ ), null) : e;
3295
+ }
3296
+ function Ra(e, t) {
3297
+ let r, a, n, i, l;
3298
+ if (ya(e)) {
3299
+ let s = e.getAttribute("action");
3300
+ a = s ? re(s, t) : null, r = e.getAttribute("method") || ut, n = xt(e.getAttribute("enctype")) || dt, i = new FormData(e);
3301
+ } else if (pa(e) || ga(e) && (e.type === "submit" || e.type === "image")) {
3302
+ let s = e.form;
3303
+ if (s == null)
3304
+ throw new Error(
3305
+ 'Cannot submit a <button> or <input type="submit"> without a <form>'
3306
+ );
3307
+ let u = e.getAttribute("formaction") || s.getAttribute("action");
3308
+ if (a = u ? re(u, t) : null, r = e.getAttribute("formmethod") || s.getAttribute("method") || ut, n = xt(e.getAttribute("formenctype")) || xt(s.getAttribute("enctype")) || dt, i = new FormData(s, e), !ba()) {
3309
+ let { name: c, type: y, value: b } = e;
3310
+ if (y === "image") {
3311
+ let g = c ? `${c}.` : "";
3312
+ i.append(`${g}x`, "0"), i.append(`${g}y`, "0");
3313
+ } else c && i.append(c, b);
3314
+ }
3315
+ } else {
3316
+ if (pt(e))
3317
+ throw new Error(
3318
+ 'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
3319
+ );
3320
+ r = ut, a = null, n = dt, l = e;
3321
+ }
3322
+ return i && n === "text/plain" && (l = i, i = void 0), { action: a, method: r.toLowerCase(), encType: n, formData: i, body: l };
3323
+ }
3324
+ function Nt(e, t) {
3325
+ if (e === !1 || e === null || typeof e > "u")
3326
+ throw new Error(t);
3327
+ }
3328
+ async function xa(e, t) {
3329
+ if (e.id in t)
3330
+ return t[e.id];
3331
+ try {
3332
+ let r = await import(
3333
+ /* @vite-ignore */
3334
+ /* webpackIgnore: true */
3335
+ e.module
3336
+ );
3337
+ return t[e.id] = r, r;
3338
+ } catch (r) {
3339
+ return console.error(
3340
+ `Error loading route module \`${e.module}\`, reloading page...`
3341
+ ), console.error(r), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
3342
+ });
3343
+ }
3344
+ }
3345
+ function Sa(e) {
3346
+ return e == null ? !1 : e.href == null ? e.rel === "preload" && typeof e.imageSrcSet == "string" && typeof e.imageSizes == "string" : typeof e.rel == "string" && typeof e.href == "string";
3347
+ }
3348
+ async function La(e, t, r) {
3349
+ let a = await Promise.all(
3350
+ e.map(async (n) => {
3351
+ let i = t.routes[n.route.id];
3352
+ if (i) {
3353
+ let l = await xa(i, r);
3354
+ return l.links ? l.links() : [];
3355
+ }
3356
+ return [];
3357
+ })
3358
+ );
3359
+ return Ma(
3360
+ a.flat(1).filter(Sa).filter((n) => n.rel === "stylesheet" || n.rel === "preload").map(
3361
+ (n) => n.rel === "stylesheet" ? { ...n, rel: "prefetch", as: "style" } : { ...n, rel: "prefetch" }
3362
+ )
3363
+ );
3364
+ }
3365
+ function pr(e, t, r, a, n, i) {
3366
+ let l = (u, c) => r[c] ? u.route.id !== r[c].route.id : !0, s = (u, c) => (
3367
+ // param change, /users/123 -> /users/456
3368
+ r[c].pathname !== u.pathname || // splat param changed, which is not present in match.path
3369
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
3370
+ r[c].route.path?.endsWith("*") && r[c].params["*"] !== u.params["*"]
3371
+ );
3372
+ return i === "assets" ? t.filter(
3373
+ (u, c) => l(u, c) || s(u, c)
3374
+ ) : i === "data" ? t.filter((u, c) => {
3375
+ let y = a.routes[u.route.id];
3376
+ if (!y || !y.hasLoader)
3377
+ return !1;
3378
+ if (l(u, c) || s(u, c))
3379
+ return !0;
3380
+ if (u.route.shouldRevalidate) {
3381
+ let b = u.route.shouldRevalidate({
3382
+ currentUrl: new URL(
3383
+ n.pathname + n.search + n.hash,
3384
+ window.origin
3385
+ ),
3386
+ currentParams: r[0]?.params || {},
3387
+ nextUrl: new URL(e, window.origin),
3388
+ nextParams: u.params,
3389
+ defaultShouldRevalidate: !0
3390
+ });
3391
+ if (typeof b == "boolean")
3392
+ return b;
3393
+ }
3394
+ return !0;
3395
+ }) : [];
3396
+ }
3397
+ function Ca(e, t) {
3398
+ return Pa(
3399
+ e.map((r) => {
3400
+ let a = t.routes[r.route.id];
3401
+ if (!a) return [];
3402
+ let n = [a.module];
3403
+ return a.imports && (n = n.concat(a.imports)), n;
3404
+ }).flat(1)
3405
+ );
3406
+ }
3407
+ function Pa(e) {
3408
+ return [...new Set(e)];
3409
+ }
3410
+ function Da(e) {
3411
+ let t = {}, r = Object.keys(e).sort();
3412
+ for (let a of r)
3413
+ t[a] = e[a];
3414
+ return t;
3415
+ }
3416
+ function Ma(e, t) {
3417
+ let r = /* @__PURE__ */ new Set();
3418
+ return new Set(t), e.reduce((a, n) => {
3419
+ let i = JSON.stringify(Da(n));
3420
+ return r.has(i) || (r.add(i), a.push({ key: i, link: n })), a;
3421
+ }, []);
3422
+ }
3423
+ function Ta(e) {
3424
+ let t = typeof e == "string" ? new URL(
3425
+ e,
3426
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
3427
+ // don't assume window is available
3428
+ typeof window > "u" ? "server://singlefetch/" : window.location.origin
3429
+ ) : e;
3430
+ return t.pathname === "/" ? t.pathname = "_root.data" : t.pathname = `${t.pathname.replace(/\/$/, "")}.data`, t;
3431
+ }
3432
+ function Fa() {
3433
+ let e = m.useContext(Se);
3434
+ return Nt(
3435
+ e,
3436
+ "You must render this element inside a <DataRouterContext.Provider> element"
3437
+ ), e;
3438
+ }
3439
+ function ka() {
3440
+ let e = m.useContext(Ye);
3441
+ return Nt(
3442
+ e,
3443
+ "You must render this element inside a <DataRouterStateContext.Provider> element"
3444
+ ), e;
3445
+ }
3446
+ var Ot = m.createContext(void 0);
3447
+ Ot.displayName = "FrameworkContext";
3448
+ function Mr() {
3449
+ let e = m.useContext(Ot);
3450
+ return Nt(
3451
+ e,
3452
+ "You must render this element inside a <HydratedRouter> element"
3453
+ ), e;
3454
+ }
3455
+ function $a(e, t) {
3456
+ let r = m.useContext(Ot), [a, n] = m.useState(!1), [i, l] = m.useState(!1), { onFocus: s, onBlur: u, onMouseEnter: c, onMouseLeave: y, onTouchStart: b } = t, g = m.useRef(null);
3457
+ m.useEffect(() => {
3458
+ if (e === "render" && l(!0), e === "viewport") {
3459
+ let L = (E) => {
3460
+ E.forEach((C) => {
3461
+ l(C.isIntersecting);
3462
+ });
3463
+ }, x = new IntersectionObserver(L, { threshold: 0.5 });
3464
+ return g.current && x.observe(g.current), () => {
3465
+ x.disconnect();
3466
+ };
3467
+ }
3468
+ }, [e]), m.useEffect(() => {
3469
+ if (a) {
3470
+ let L = setTimeout(() => {
3471
+ l(!0);
3472
+ }, 100);
3473
+ return () => {
3474
+ clearTimeout(L);
3475
+ };
3476
+ }
3477
+ }, [a]);
3478
+ let p = () => {
3479
+ n(!0);
3480
+ }, v = () => {
3481
+ n(!1), l(!1);
3482
+ };
3483
+ return r ? e !== "intent" ? [i, g, {}] : [
3484
+ i,
3485
+ g,
3486
+ {
3487
+ onFocus: Be(s, p),
3488
+ onBlur: Be(u, v),
3489
+ onMouseEnter: Be(c, p),
3490
+ onMouseLeave: Be(y, v),
3491
+ onTouchStart: Be(b, p)
3492
+ }
3493
+ ] : [!1, g, {}];
3494
+ }
3495
+ function Be(e, t) {
3496
+ return (r) => {
3497
+ e && e(r), r.defaultPrevented || t(r);
3498
+ };
3499
+ }
3500
+ function Ua({
3501
+ page: e,
3502
+ ...t
3503
+ }) {
3504
+ let { router: r } = Fa(), a = m.useMemo(
3505
+ () => me(r.routes, e, r.basename),
3506
+ [r.routes, e, r.basename]
3507
+ );
3508
+ return a ? /* @__PURE__ */ m.createElement(Oa, { page: e, matches: a, ...t }) : null;
3509
+ }
3510
+ function Na(e) {
3511
+ let { manifest: t, routeModules: r } = Mr(), [a, n] = m.useState([]);
3512
+ return m.useEffect(() => {
3513
+ let i = !1;
3514
+ return La(e, t, r).then(
3515
+ (l) => {
3516
+ i || n(l);
3517
+ }
3518
+ ), () => {
3519
+ i = !0;
3520
+ };
3521
+ }, [e, t, r]), a;
3522
+ }
3523
+ function Oa({
3524
+ page: e,
3525
+ matches: t,
3526
+ ...r
3527
+ }) {
3528
+ let a = Le(), { manifest: n, routeModules: i } = Mr(), { loaderData: l, matches: s } = ka(), u = m.useMemo(
3529
+ () => pr(
3530
+ e,
3531
+ t,
3532
+ s,
3533
+ n,
3534
+ a,
3535
+ "data"
3536
+ ),
3537
+ [e, t, s, n, a]
3538
+ ), c = m.useMemo(
3539
+ () => pr(
3540
+ e,
3541
+ t,
3542
+ s,
3543
+ n,
3544
+ a,
3545
+ "assets"
3546
+ ),
3547
+ [e, t, s, n, a]
3548
+ ), y = m.useMemo(() => {
3549
+ if (e === a.pathname + a.search + a.hash)
3550
+ return [];
3551
+ let p = /* @__PURE__ */ new Set(), v = !1;
3552
+ if (t.forEach((x) => {
3553
+ let E = n.routes[x.route.id];
3554
+ !E || !E.hasLoader || (!u.some((C) => C.route.id === x.route.id) && x.route.id in l && i[x.route.id]?.shouldRevalidate || E.hasClientLoader ? v = !0 : p.add(x.route.id));
3555
+ }), p.size === 0)
3556
+ return [];
3557
+ let L = Ta(e);
3558
+ return v && p.size > 0 && L.searchParams.set(
3559
+ "_routes",
3560
+ t.filter((x) => p.has(x.route.id)).map((x) => x.route.id).join(",")
3561
+ ), [L.pathname + L.search];
3562
+ }, [
3563
+ l,
3564
+ a,
3565
+ n,
3566
+ u,
3567
+ t,
3568
+ e,
3569
+ i
3570
+ ]), b = m.useMemo(
3571
+ () => Ca(c, n),
3572
+ [c, n]
3573
+ ), g = Na(c);
3574
+ return /* @__PURE__ */ m.createElement(m.Fragment, null, y.map((p) => /* @__PURE__ */ m.createElement("link", { key: p, rel: "prefetch", as: "fetch", href: p, ...r })), b.map((p) => /* @__PURE__ */ m.createElement("link", { key: p, rel: "modulepreload", href: p, ...r })), g.map(({ key: p, link: v }) => (
3575
+ // these don't spread `linkProps` because they are full link descriptors
3576
+ // already with their own props
3577
+ /* @__PURE__ */ m.createElement("link", { key: p, ...v })
3578
+ )));
3579
+ }
3580
+ function Aa(...e) {
3581
+ return (t) => {
3582
+ e.forEach((r) => {
3583
+ typeof r == "function" ? r(t) : r != null && (r.current = t);
3584
+ });
3585
+ };
3586
+ }
3587
+ var Tr = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
3588
+ try {
3589
+ Tr && (window.__reactRouterVersion = "7.1.5");
3590
+ } catch {
3591
+ }
3592
+ function Xa(e, t) {
3593
+ return Mn({
3594
+ basename: t?.basename,
3595
+ future: t?.future,
3596
+ history: qr({ window: t?.window }),
3597
+ hydrationData: Ia(),
3598
+ routes: e,
3599
+ mapRouteProperties: da,
3600
+ dataStrategy: t?.dataStrategy,
3601
+ patchRoutesOnNavigation: t?.patchRoutesOnNavigation,
3602
+ window: t?.window
3603
+ }).initialize();
3604
+ }
3605
+ function Ia() {
3606
+ let e = window?.__staticRouterHydrationData;
3607
+ return e && e.errors && (e = {
3608
+ ...e,
3609
+ errors: ja(e.errors)
3610
+ }), e;
3611
+ }
3612
+ function ja(e) {
3613
+ if (!e) return null;
3614
+ let t = Object.entries(e), r = {};
3615
+ for (let [a, n] of t)
3616
+ if (n && n.__type === "RouteErrorResponse")
3617
+ r[a] = new ht(
3618
+ n.status,
3619
+ n.statusText,
3620
+ n.data,
3621
+ n.internal === !0
3622
+ );
3623
+ else if (n && n.__type === "Error") {
3624
+ if (n.__subType) {
3625
+ let i = window[n.__subType];
3626
+ if (typeof i == "function")
3627
+ try {
3628
+ let l = new i(n.message);
3629
+ l.stack = "", r[a] = l;
3630
+ } catch {
3631
+ }
3632
+ }
3633
+ if (r[a] == null) {
3634
+ let i = new Error(n.message);
3635
+ i.stack = "", r[a] = i;
3636
+ }
3637
+ } else
3638
+ r[a] = n;
3639
+ return r;
3640
+ }
3641
+ var Fr = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, kr = m.forwardRef(
3642
+ function({
3643
+ onClick: t,
3644
+ discover: r = "render",
3645
+ prefetch: a = "none",
3646
+ relative: n,
3647
+ reloadDocument: i,
3648
+ replace: l,
3649
+ state: s,
3650
+ target: u,
3651
+ to: c,
3652
+ preventScrollReset: y,
3653
+ viewTransition: b,
3654
+ ...g
3655
+ }, p) {
3656
+ let { basename: v } = m.useContext(oe), L = typeof c == "string" && Fr.test(c), x, E = !1;
3657
+ if (typeof c == "string" && L && (x = c, Tr))
3658
+ try {
3659
+ let $ = new URL(window.location.href), W = c.startsWith("//") ? new URL($.protocol + c) : new URL(c), Q = re(W.pathname, v);
3660
+ W.origin === $.origin && Q != null ? c = Q + W.search + W.hash : E = !0;
3661
+ } catch {
3662
+ G(
3663
+ !1,
3664
+ `<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
3665
+ );
3666
+ }
3667
+ let C = Gn(c, { relative: n }), [T, N, O] = $a(
3668
+ a,
3669
+ g
3670
+ ), f = Ba(c, {
3671
+ replace: l,
3672
+ state: s,
3673
+ target: u,
3674
+ preventScrollReset: y,
3675
+ relative: n,
3676
+ viewTransition: b
3677
+ });
3678
+ function A($) {
3679
+ t && t($), $.defaultPrevented || f($);
3680
+ }
3681
+ let I = (
3682
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
3683
+ /* @__PURE__ */ m.createElement(
3684
+ "a",
3685
+ {
3686
+ ...g,
3687
+ ...O,
3688
+ href: x || C,
3689
+ onClick: E || i ? t : A,
3690
+ ref: Aa(p, N),
3691
+ target: u,
3692
+ "data-discover": !L && r === "render" ? "true" : void 0
3693
+ }
3694
+ )
3695
+ );
3696
+ return T && !L ? /* @__PURE__ */ m.createElement(m.Fragment, null, I, /* @__PURE__ */ m.createElement(Ua, { page: C })) : I;
3697
+ }
3698
+ );
3699
+ kr.displayName = "Link";
3700
+ var Ha = m.forwardRef(
3701
+ function({
3702
+ "aria-current": t = "page",
3703
+ caseSensitive: r = !1,
3704
+ className: a = "",
3705
+ end: n = !1,
3706
+ style: i,
3707
+ to: l,
3708
+ viewTransition: s,
3709
+ children: u,
3710
+ ...c
3711
+ }, y) {
3712
+ let b = Ge(l, { relative: c.relative }), g = Le(), p = m.useContext(Ye), { navigator: v, basename: L } = m.useContext(oe), x = p != null && // Conditional usage is OK here because the usage of a data router is static
3713
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3714
+ Ja(b) && s === !0, E = v.encodeLocation ? v.encodeLocation(b).pathname : b.pathname, C = g.pathname, T = p && p.navigation && p.navigation.location ? p.navigation.location.pathname : null;
3715
+ r || (C = C.toLowerCase(), T = T ? T.toLowerCase() : null, E = E.toLowerCase()), T && L && (T = re(T, L) || T);
3716
+ const N = E !== "/" && E.endsWith("/") ? E.length - 1 : E.length;
3717
+ let O = C === E || !n && C.startsWith(E) && C.charAt(N) === "/", f = T != null && (T === E || !n && T.startsWith(E) && T.charAt(E.length) === "/"), A = {
3718
+ isActive: O,
3719
+ isPending: f,
3720
+ isTransitioning: x
3721
+ }, I = O ? t : void 0, $;
3722
+ typeof a == "function" ? $ = a(A) : $ = [
3723
+ a,
3724
+ O ? "active" : null,
3725
+ f ? "pending" : null,
3726
+ x ? "transitioning" : null
3727
+ ].filter(Boolean).join(" ");
3728
+ let W = typeof i == "function" ? i(A) : i;
3729
+ return /* @__PURE__ */ m.createElement(
3730
+ kr,
3731
+ {
3732
+ ...c,
3733
+ "aria-current": I,
3734
+ className: $,
3735
+ ref: y,
3736
+ style: W,
3737
+ to: l,
3738
+ viewTransition: s
3739
+ },
3740
+ typeof u == "function" ? u(A) : u
3741
+ );
3742
+ }
3743
+ );
3744
+ Ha.displayName = "NavLink";
3745
+ var za = m.forwardRef(
3746
+ ({
3747
+ discover: e = "render",
3748
+ fetcherKey: t,
3749
+ navigate: r,
3750
+ reloadDocument: a,
3751
+ replace: n,
3752
+ state: i,
3753
+ method: l = ut,
3754
+ action: s,
3755
+ onSubmit: u,
3756
+ relative: c,
3757
+ preventScrollReset: y,
3758
+ viewTransition: b,
3759
+ ...g
3760
+ }, p) => {
3761
+ let v = Ka(), L = Ya(s, { relative: c }), x = l.toLowerCase() === "get" ? "get" : "post", E = typeof s == "string" && Fr.test(s), C = (T) => {
3762
+ if (u && u(T), T.defaultPrevented) return;
3763
+ T.preventDefault();
3764
+ let N = T.nativeEvent.submitter, O = N?.getAttribute("formmethod") || l;
3765
+ v(N || T.currentTarget, {
3766
+ fetcherKey: t,
3767
+ method: O,
3768
+ navigate: r,
3769
+ replace: n,
3770
+ state: i,
3771
+ relative: c,
3772
+ preventScrollReset: y,
3773
+ viewTransition: b
3774
+ });
3775
+ };
3776
+ return /* @__PURE__ */ m.createElement(
3777
+ "form",
3778
+ {
3779
+ ref: p,
3780
+ method: x,
3781
+ action: L,
3782
+ onSubmit: a ? u : C,
3783
+ ...g,
3784
+ "data-discover": !E && e === "render" ? "true" : void 0
3785
+ }
3786
+ );
3787
+ }
3788
+ );
3789
+ za.displayName = "Form";
3790
+ function _a(e) {
3791
+ return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
3792
+ }
3793
+ function $r(e) {
3794
+ let t = m.useContext(Se);
3795
+ return U(t, _a(e)), t;
3796
+ }
3797
+ function Ba(e, {
3798
+ target: t,
3799
+ replace: r,
3800
+ state: a,
3801
+ preventScrollReset: n,
3802
+ relative: i,
3803
+ viewTransition: l
3804
+ } = {}) {
3805
+ let s = Xn(), u = Le(), c = Ge(e, { relative: i });
3806
+ return m.useCallback(
3807
+ (y) => {
3808
+ if (wa(y, t)) {
3809
+ y.preventDefault();
3810
+ let b = r !== void 0 ? r : pe(u) === pe(c);
3811
+ s(e, {
3812
+ replace: b,
3813
+ state: a,
3814
+ preventScrollReset: n,
3815
+ relative: i,
3816
+ viewTransition: l
3817
+ });
3818
+ }
3819
+ },
3820
+ [
3821
+ u,
3822
+ s,
3823
+ c,
3824
+ r,
3825
+ a,
3826
+ t,
3827
+ e,
3828
+ n,
3829
+ i,
3830
+ l
3831
+ ]
3832
+ );
3833
+ }
3834
+ var Wa = 0, Va = () => `__${String(++Wa)}__`;
3835
+ function Ka() {
3836
+ let { router: e } = $r(
3837
+ "useSubmit"
3838
+ /* UseSubmit */
3839
+ ), { basename: t } = m.useContext(oe), r = la();
3840
+ return m.useCallback(
3841
+ async (a, n = {}) => {
3842
+ let { action: i, method: l, encType: s, formData: u, body: c } = Ra(
3843
+ a,
3844
+ t
3845
+ );
3846
+ if (n.navigate === !1) {
3847
+ let y = n.fetcherKey || Va();
3848
+ await e.fetch(y, r, n.action || i, {
3849
+ preventScrollReset: n.preventScrollReset,
3850
+ formData: u,
3851
+ body: c,
3852
+ formMethod: n.method || l,
3853
+ formEncType: n.encType || s,
3854
+ flushSync: n.flushSync
3855
+ });
3856
+ } else
3857
+ await e.navigate(n.action || i, {
3858
+ preventScrollReset: n.preventScrollReset,
3859
+ formData: u,
3860
+ body: c,
3861
+ formMethod: n.method || l,
3862
+ formEncType: n.encType || s,
3863
+ replace: n.replace,
3864
+ state: n.state,
3865
+ fromRouteId: r,
3866
+ flushSync: n.flushSync,
3867
+ viewTransition: n.viewTransition
3868
+ });
3869
+ },
3870
+ [e, t, r]
3871
+ );
3872
+ }
3873
+ function Ya(e, { relative: t } = {}) {
3874
+ let { basename: r } = m.useContext(oe), a = m.useContext(de);
3875
+ U(a, "useFormAction must be used inside a RouteContext");
3876
+ let [n] = a.matches.slice(-1), i = { ...Ge(e || ".", { relative: t }) }, l = Le();
3877
+ if (e == null) {
3878
+ i.search = l.search;
3879
+ let s = new URLSearchParams(i.search), u = s.getAll("index");
3880
+ if (u.some((y) => y === "")) {
3881
+ s.delete("index"), u.filter((b) => b).forEach((b) => s.append("index", b));
3882
+ let y = s.toString();
3883
+ i.search = y ? `?${y}` : "";
3884
+ }
3885
+ }
3886
+ return (!e || e === ".") && n.route.index && (i.search = i.search ? i.search.replace(/^\?/, "?index&") : "?index"), r !== "/" && (i.pathname = i.pathname === "/" ? r : ie([r, i.pathname])), pe(i);
3887
+ }
3888
+ function Ja(e, t = {}) {
3889
+ let r = m.useContext(Ft);
3890
+ U(
3891
+ r != null,
3892
+ "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
3893
+ );
3894
+ let { basename: a } = $r(
3895
+ "useViewTransitionState"
3896
+ /* useViewTransitionState */
3897
+ ), n = Ge(e, { relative: t.relative });
3898
+ if (!r.isTransitioning)
3899
+ return !1;
3900
+ let i = re(r.currentLocation.pathname, a) || r.currentLocation.pathname, l = re(r.nextLocation.pathname, a) || r.nextLocation.pathname;
3901
+ return ft(n.pathname, l) != null || ft(n.pathname, i) != null;
3902
+ }
3903
+ new TextEncoder();
3904
+ export {
3905
+ Ga as R,
3906
+ Xa as c,
3907
+ Xn as u
3908
+ };