@konstructio/ui 0.1.2-alpha.65 → 0.1.2-alpha.67

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 (89) hide show
  1. package/dist/{DayPicker-PUEUVAST.js → DayPicker-CaeUXRCF.js} +475 -470
  2. package/dist/assets/icons/components/AlertOutline.d.ts +3 -0
  3. package/dist/assets/icons/components/AlertOutline.js +28 -0
  4. package/dist/assets/icons/components/index.d.ts +1 -0
  5. package/dist/assets/icons/components/index.js +126 -124
  6. package/dist/assets/icons/index.js +122 -120
  7. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  8. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  9. package/dist/components/AlertDialog/components/index.js +1 -1
  10. package/dist/components/Breadcrumb/components/Item/Item.js +1 -1
  11. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  12. package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
  13. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +1 -1
  14. package/dist/components/Checkbox/Checkbox.js +51 -51
  15. package/dist/components/Command/Command.js +1 -1
  16. package/dist/components/Command/components/Command.js +1 -1
  17. package/dist/components/Command/components/CommandEmpty.js +1 -1
  18. package/dist/components/Command/components/CommandGroup.js +1 -1
  19. package/dist/components/Command/components/CommandInput.js +1 -1
  20. package/dist/components/Command/components/CommandItem.js +1 -1
  21. package/dist/components/Command/components/CommandList.js +1 -1
  22. package/dist/components/Command/components/CommandSeparator.js +1 -1
  23. package/dist/components/Command/components/DialogContent.js +1 -1
  24. package/dist/components/Command/components/DialogOverlay.js +1 -1
  25. package/dist/components/DateRangePicker/components/CalendarPanel/components/CalendarMonth/CalendarMonth.js +1 -1
  26. package/dist/components/DateRangePicker/components/CalendarPanel/components/IndependentModeCalendar/IndependentModeCalendar.js +1 -1
  27. package/dist/components/DateRangePicker/components/CalendarPanel/components/TogetherModeCalendar/TogetherModeCalendar.js +1 -1
  28. package/dist/components/Datepicker/DatePicker.js +1 -1
  29. package/dist/components/Drawer/components/index.js +6 -6
  30. package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +1 -0
  31. package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +1 -1
  32. package/dist/components/PhoneNumberInput/contexts/phone-number.provider.js +1 -1
  33. package/dist/components/PhoneNumberInput/utils/index.js +1 -1
  34. package/dist/components/ProgressBar/ProgressBar.d.ts +0 -17
  35. package/dist/components/ProgressBar/ProgressBar.js +38 -59
  36. package/dist/components/ProgressBar/ProgressBar.types.d.ts +12 -28
  37. package/dist/components/ProgressBar/ProgressBar.variants.d.ts +3 -3
  38. package/dist/components/ProgressBar/ProgressBar.variants.js +23 -24
  39. package/dist/components/Range/Range.js +1 -1
  40. package/dist/components/Slider/Slider.js +1 -1
  41. package/dist/components/Spinner/Spinner.d.ts +4 -0
  42. package/dist/components/Spinner/Spinner.js +57 -0
  43. package/dist/components/Spinner/Spinner.types.d.ts +13 -0
  44. package/dist/components/Spinner/Spinner.variants.d.ts +6 -0
  45. package/dist/components/Spinner/Spinner.variants.js +54 -0
  46. package/dist/components/Switch/Switch.js +47 -47
  47. package/dist/components/Tabs/Tabs.js +1 -1
  48. package/dist/components/Tabs/components/Content.js +1 -1
  49. package/dist/components/Tabs/components/List.js +1 -1
  50. package/dist/components/Tabs/components/Trigger.js +1 -1
  51. package/dist/components/Toast/Toast.js +9 -9
  52. package/dist/components/VirtualizedTable/VirtualizedTable.d.ts +5 -0
  53. package/dist/components/VirtualizedTable/VirtualizedTable.js +83 -71
  54. package/dist/components/VirtualizedTable/VirtualizedTable.types.d.ts +5 -0
  55. package/dist/components/VirtualizedTable/components/Body/Body.js +56 -53
  56. package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +1 -1
  57. package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +2 -2
  58. package/dist/components/VirtualizedTable/contexts/table.context.d.ts +4 -1
  59. package/dist/components/VirtualizedTable/contexts/table.provider.d.ts +1 -1
  60. package/dist/components/VirtualizedTable/contexts/table.provider.js +192 -108
  61. package/dist/components/VirtualizedTable/contexts/table.types.d.ts +4 -1
  62. package/dist/components/VirtualizedTable/events/index.d.ts +12 -0
  63. package/dist/components/VirtualizedTable/events/index.js +29 -0
  64. package/dist/components/index.d.ts +3 -0
  65. package/dist/components/index.js +98 -91
  66. package/dist/icons.d.ts +1 -1
  67. package/dist/icons.js +122 -120
  68. package/dist/{index-DKfEnhKr.js → index--l0zux8V.js} +2 -2
  69. package/dist/{index-AV6ZtGhy.js → index-3fEdeexs.js} +1 -1
  70. package/dist/{index-CeZcoQDw.js → index-9a-FL_6D.js} +6 -6
  71. package/dist/{index-Dy59FQl5.js → index-BKMaItIC.js} +1 -1
  72. package/dist/{index-DtEcCIrM.js → index-BRXMsxSL.js} +1 -1
  73. package/dist/{index-DMb4KD0b.js → index-CESXsoMn.js} +1 -1
  74. package/dist/{index-BG8O18ZY.js → index-CJnS4BVW.js} +1 -1
  75. package/dist/{index-vcSp8YRZ.js → index-Cmf-IG4l.js} +10 -10
  76. package/dist/{index-Byr10W8m.js → index-DPcwqB8q.js} +618 -613
  77. package/dist/{index-BqhYevy7.js → index-Dd_ZmIqU.js} +19 -19
  78. package/dist/{index-D9SSJ6om.js → index-Dfq4O3b4.js} +3 -3
  79. package/dist/{index-gSPwC-1I.js → index-Jr0cra7i.js} +9 -9
  80. package/dist/{index-BlSRBdPy.js → index-URQGEGX7.js} +1 -1
  81. package/dist/index.js +142 -135
  82. package/dist/{libphonenumber-C9G59k5J.js → libphonenumber-aZ-2KWIf.js} +3 -3
  83. package/dist/package.json +21 -21
  84. package/dist/{proxy-BhEKW5n7.js → proxy-BIRlSMN_.js} +856 -851
  85. package/dist/styles.css +1 -1
  86. package/dist/useBreadcrumb-C_Wb2cXs.js +1435 -0
  87. package/dist/utils/index.js +514 -355
  88. package/package.json +21 -21
  89. package/dist/useBreadcrumb-vSs0pRo3.js +0 -1412
@@ -1,1412 +0,0 @@
1
- import * as i from "react";
2
- function E(e, t) {
3
- if (e === !1 || e === null || typeof e > "u")
4
- throw new Error(t);
5
- }
6
- function S(e, t) {
7
- if (!e) {
8
- typeof console < "u" && console.warn(t);
9
- try {
10
- throw new Error(t);
11
- } catch {
12
- }
13
- }
14
- }
15
- function G({
16
- pathname: e = "/",
17
- search: t = "",
18
- hash: r = ""
19
- }) {
20
- return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), r && r !== "#" && (e += r.charAt(0) === "#" ? r : "#" + r), e;
21
- }
22
- function q(e) {
23
- let t = {};
24
- if (e) {
25
- let r = e.indexOf("#");
26
- r >= 0 && (t.hash = e.substring(r), e = e.substring(0, r));
27
- let o = e.indexOf("?");
28
- o >= 0 && (t.search = e.substring(o), e = e.substring(0, o)), e && (t.pathname = e);
29
- }
30
- return t;
31
- }
32
- function le(e, t, r = "/") {
33
- return Se(e, t, r, !1);
34
- }
35
- function Se(e, t, r, o) {
36
- let a = typeof t == "string" ? q(t) : t, n = L(a.pathname || "/", r);
37
- if (n == null)
38
- return null;
39
- let l = ie(e);
40
- Pe(l);
41
- let s = null;
42
- for (let u = 0; s == null && u < l.length; ++u) {
43
- let f = Me(n);
44
- s = Ne(
45
- l[u],
46
- f,
47
- o
48
- );
49
- }
50
- return s;
51
- }
52
- function ie(e, t = [], r = [], o = "", a = !1) {
53
- let n = (l, s, u = a, f) => {
54
- let d = {
55
- relativePath: f === void 0 ? l.path || "" : f,
56
- caseSensitive: l.caseSensitive === !0,
57
- childrenIndex: s,
58
- route: l
59
- };
60
- if (d.relativePath.startsWith("/")) {
61
- if (!d.relativePath.startsWith(o) && u)
62
- return;
63
- E(
64
- d.relativePath.startsWith(o),
65
- `Absolute route path "${d.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
66
- ), d.relativePath = d.relativePath.slice(o.length);
67
- }
68
- let c = b([o, d.relativePath]), m = r.concat(d);
69
- l.children && l.children.length > 0 && (E(
70
- // Our types know better, but runtime JS may not!
71
- // @ts-expect-error
72
- l.index !== !0,
73
- `Index routes must not have child routes. Please remove all child routes from route path "${c}".`
74
- ), ie(
75
- l.children,
76
- t,
77
- m,
78
- c,
79
- u
80
- )), !(l.path == null && !l.index) && t.push({
81
- path: c,
82
- score: Fe(c, l.index),
83
- routesMeta: m
84
- });
85
- };
86
- return e.forEach((l, s) => {
87
- if (l.path === "" || !l.path?.includes("?"))
88
- n(l, s);
89
- else
90
- for (let u of ue(l.path))
91
- n(l, s, !0, u);
92
- }), t;
93
- }
94
- function ue(e) {
95
- let t = e.split("/");
96
- if (t.length === 0) return [];
97
- let [r, ...o] = t, a = r.endsWith("?"), n = r.replace(/\?$/, "");
98
- if (o.length === 0)
99
- return a ? [n, ""] : [n];
100
- let l = ue(o.join("/")), s = [];
101
- return s.push(
102
- ...l.map(
103
- (u) => u === "" ? n : [n, u].join("/")
104
- )
105
- ), a && s.push(...l), s.map(
106
- (u) => e.startsWith("/") && u === "" ? "/" : u
107
- );
108
- }
109
- function Pe(e) {
110
- e.sort(
111
- (t, r) => t.score !== r.score ? r.score - t.score : Oe(
112
- t.routesMeta.map((o) => o.childrenIndex),
113
- r.routesMeta.map((o) => o.childrenIndex)
114
- )
115
- );
116
- }
117
- var Le = /^:[\w-]+$/, $e = 3, ke = 2, Te = 1, De = 10, Ie = -2, re = (e) => e === "*";
118
- function Fe(e, t) {
119
- let r = e.split("/"), o = r.length;
120
- return r.some(re) && (o += Ie), t && (o += ke), r.filter((a) => !re(a)).reduce(
121
- (a, n) => a + (Le.test(n) ? $e : n === "" ? Te : De),
122
- o
123
- );
124
- }
125
- function Oe(e, t) {
126
- return e.length === t.length && e.slice(0, -1).every((o, a) => o === t[a]) ? (
127
- // If two routes are siblings, we should try to match the earlier sibling
128
- // first. This allows people to have fine-grained control over the matching
129
- // behavior by simply putting routes with identical paths in the order they
130
- // want them tried.
131
- e[e.length - 1] - t[t.length - 1]
132
- ) : (
133
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
134
- // so they sort equally.
135
- 0
136
- );
137
- }
138
- function Ne(e, t, r = !1) {
139
- let { routesMeta: o } = e, a = {}, n = "/", l = [];
140
- for (let s = 0; s < o.length; ++s) {
141
- let u = o[s], f = s === o.length - 1, d = n === "/" ? t : t.slice(n.length) || "/", c = W(
142
- { path: u.relativePath, caseSensitive: u.caseSensitive, end: f },
143
- d
144
- ), m = u.route;
145
- if (!c && f && r && !o[o.length - 1].route.index && (c = W(
146
- {
147
- path: u.relativePath,
148
- caseSensitive: u.caseSensitive,
149
- end: !1
150
- },
151
- d
152
- )), !c)
153
- return null;
154
- Object.assign(a, c.params), l.push({
155
- // TODO: Can this as be avoided?
156
- params: a,
157
- pathname: b([n, c.pathname]),
158
- pathnameBase: We(
159
- b([n, c.pathnameBase])
160
- ),
161
- route: m
162
- }), c.pathnameBase !== "/" && (n = b([n, c.pathnameBase]));
163
- }
164
- return l;
165
- }
166
- function W(e, t) {
167
- typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
168
- let [r, o] = _e(
169
- e.path,
170
- e.caseSensitive,
171
- e.end
172
- ), a = t.match(r);
173
- if (!a) return null;
174
- let n = a[0], l = n.replace(/(.)\/+$/, "$1"), s = a.slice(1);
175
- return {
176
- params: o.reduce(
177
- (f, { paramName: d, isOptional: c }, m) => {
178
- if (d === "*") {
179
- let w = s[m] || "";
180
- l = n.slice(0, n.length - w.length).replace(/(.)\/+$/, "$1");
181
- }
182
- const p = s[m];
183
- return c && !p ? f[d] = void 0 : f[d] = (p || "").replace(/%2F/g, "/"), f;
184
- },
185
- {}
186
- ),
187
- pathname: n,
188
- pathnameBase: l,
189
- pattern: e
190
- };
191
- }
192
- function _e(e, t = !1, r = !0) {
193
- S(
194
- e === "*" || !e.endsWith("*") || e.endsWith("/*"),
195
- `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(/\*$/, "/*")}".`
196
- );
197
- let o = [], a = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
198
- /\/:([\w-]+)(\?)?/g,
199
- (l, s, u) => (o.push({ paramName: s, isOptional: u != null }), u ? "/?([^\\/]+)?" : "/([^\\/]+)")
200
- ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
201
- return e.endsWith("*") ? (o.push({ paramName: "*" }), a += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? a += "\\/*$" : e !== "" && e !== "/" && (a += "(?:(?=\\/|$))"), [new RegExp(a, t ? void 0 : "i"), o];
202
- }
203
- function Me(e) {
204
- try {
205
- return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
206
- } catch (t) {
207
- return S(
208
- !1,
209
- `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}).`
210
- ), e;
211
- }
212
- }
213
- function L(e, t) {
214
- if (t === "/") return e;
215
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
216
- return null;
217
- let r = t.endsWith("/") ? t.length - 1 : t.length, o = e.charAt(r);
218
- return o && o !== "/" ? null : e.slice(r) || "/";
219
- }
220
- var Ae = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
221
- function Be(e, t = "/") {
222
- let {
223
- pathname: r,
224
- search: o = "",
225
- hash: a = ""
226
- } = typeof e == "string" ? q(e) : e, n;
227
- return r ? (r = r.replace(/\/\/+/g, "/"), r.startsWith("/") ? n = ne(r.substring(1), "/") : n = ne(r, t)) : n = t, {
228
- pathname: n,
229
- search: He(o),
230
- hash: je(a)
231
- };
232
- }
233
- function ne(e, t) {
234
- let r = t.replace(/\/+$/, "").split("/");
235
- return e.split("/").forEach((a) => {
236
- a === ".." ? r.length > 1 && r.pop() : a !== "." && r.push(a);
237
- }), r.length > 1 ? r.join("/") : "/";
238
- }
239
- function V(e, t, r, o) {
240
- return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
241
- o
242
- )}]. 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.`;
243
- }
244
- function Ue(e) {
245
- return e.filter(
246
- (t, r) => r === 0 || t.route.path && t.route.path.length > 0
247
- );
248
- }
249
- function se(e) {
250
- let t = Ue(e);
251
- return t.map(
252
- (r, o) => o === t.length - 1 ? r.pathname : r.pathnameBase
253
- );
254
- }
255
- function ce(e, t, r, o = !1) {
256
- let a;
257
- typeof e == "string" ? a = q(e) : (a = { ...e }, E(
258
- !a.pathname || !a.pathname.includes("?"),
259
- V("?", "pathname", "search", a)
260
- ), E(
261
- !a.pathname || !a.pathname.includes("#"),
262
- V("#", "pathname", "hash", a)
263
- ), E(
264
- !a.search || !a.search.includes("#"),
265
- V("#", "search", "hash", a)
266
- ));
267
- let n = e === "" || a.pathname === "", l = n ? "/" : a.pathname, s;
268
- if (l == null)
269
- s = r;
270
- else {
271
- let c = t.length - 1;
272
- if (!o && l.startsWith("..")) {
273
- let m = l.split("/");
274
- for (; m[0] === ".."; )
275
- m.shift(), c -= 1;
276
- a.pathname = m.join("/");
277
- }
278
- s = c >= 0 ? t[c] : "/";
279
- }
280
- let u = Be(a, s), f = l && l !== "/" && l.endsWith("/"), d = (n || l === ".") && r.endsWith("/");
281
- return !u.pathname.endsWith("/") && (f || d) && (u.pathname += "/"), u;
282
- }
283
- var b = (e) => e.join("/").replace(/\/\/+/g, "/"), We = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), He = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, je = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, ze = class {
284
- constructor(e, t, r, o = !1) {
285
- this.status = e, this.statusText = t || "", this.internal = o, r instanceof Error ? (this.data = r.toString(), this.error = r) : this.data = r;
286
- }
287
- };
288
- function Ve(e) {
289
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
290
- }
291
- function Je(e) {
292
- return e.map((t) => t.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
293
- }
294
- var fe = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
295
- function de(e, t) {
296
- let r = e;
297
- if (typeof r != "string" || !Ae.test(r))
298
- return {
299
- absoluteURL: void 0,
300
- isExternal: !1,
301
- to: r
302
- };
303
- let o = r, a = !1;
304
- if (fe)
305
- try {
306
- let n = new URL(window.location.href), l = r.startsWith("//") ? new URL(n.protocol + r) : new URL(r), s = L(l.pathname, t);
307
- l.origin === n.origin && s != null ? r = s + l.search + l.hash : a = !0;
308
- } catch {
309
- S(
310
- !1,
311
- `<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
312
- );
313
- }
314
- return {
315
- absoluteURL: o,
316
- isExternal: a,
317
- to: r
318
- };
319
- }
320
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
321
- var he = [
322
- "POST",
323
- "PUT",
324
- "PATCH",
325
- "DELETE"
326
- ];
327
- new Set(
328
- he
329
- );
330
- var Ke = [
331
- "GET",
332
- ...he
333
- ];
334
- new Set(Ke);
335
- var O = i.createContext(null);
336
- O.displayName = "DataRouter";
337
- var H = i.createContext(null);
338
- H.displayName = "DataRouterState";
339
- var Ge = i.createContext(!1), me = i.createContext({
340
- isTransitioning: !1
341
- });
342
- me.displayName = "ViewTransition";
343
- var qe = i.createContext(
344
- /* @__PURE__ */ new Map()
345
- );
346
- qe.displayName = "Fetchers";
347
- var Ye = i.createContext(null);
348
- Ye.displayName = "Await";
349
- var C = i.createContext(
350
- null
351
- );
352
- C.displayName = "Navigation";
353
- var Y = i.createContext(
354
- null
355
- );
356
- Y.displayName = "Location";
357
- var P = i.createContext({
358
- outlet: null,
359
- matches: [],
360
- isDataRoute: !1
361
- });
362
- P.displayName = "Route";
363
- var X = i.createContext(null);
364
- X.displayName = "RouteError";
365
- var pe = "REACT_ROUTER_ERROR", Xe = "REDIRECT", Qe = "ROUTE_ERROR_RESPONSE";
366
- function Ze(e) {
367
- if (e.startsWith(`${pe}:${Xe}:{`))
368
- try {
369
- let t = JSON.parse(e.slice(28));
370
- if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string" && typeof t.location == "string" && typeof t.reloadDocument == "boolean" && typeof t.replace == "boolean")
371
- return t;
372
- } catch {
373
- }
374
- }
375
- function et(e) {
376
- if (e.startsWith(
377
- `${pe}:${Qe}:{`
378
- ))
379
- try {
380
- let t = JSON.parse(e.slice(40));
381
- if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string")
382
- return new ze(
383
- t.status,
384
- t.statusText,
385
- t.data
386
- );
387
- } catch {
388
- }
389
- }
390
- function tt(e, { relative: t } = {}) {
391
- E(
392
- j(),
393
- // TODO: This error is probably because they somehow have 2 versions of the
394
- // router loaded. We can help them understand how to avoid that.
395
- "useHref() may be used only in the context of a <Router> component."
396
- );
397
- let { basename: r, navigator: o } = i.useContext(C), { hash: a, pathname: n, search: l } = M(e, { relative: t }), s = n;
398
- return r !== "/" && (s = n === "/" ? r : b([r, n])), o.createHref({ pathname: s, search: l, hash: a });
399
- }
400
- function j() {
401
- return i.useContext(Y) != null;
402
- }
403
- function $() {
404
- return E(
405
- j(),
406
- // TODO: This error is probably because they somehow have 2 versions of the
407
- // router loaded. We can help them understand how to avoid that.
408
- "useLocation() may be used only in the context of a <Router> component."
409
- ), i.useContext(Y).location;
410
- }
411
- var ge = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
412
- function ye(e) {
413
- i.useContext(C).static || i.useLayoutEffect(e);
414
- }
415
- function rt() {
416
- let { isDataRoute: e } = i.useContext(P);
417
- return e ? pt() : nt();
418
- }
419
- function nt() {
420
- E(
421
- j(),
422
- // TODO: This error is probably because they somehow have 2 versions of the
423
- // router loaded. We can help them understand how to avoid that.
424
- "useNavigate() may be used only in the context of a <Router> component."
425
- );
426
- let e = i.useContext(O), { basename: t, navigator: r } = i.useContext(C), { matches: o } = i.useContext(P), { pathname: a } = $(), n = JSON.stringify(se(o)), l = i.useRef(!1);
427
- return ye(() => {
428
- l.current = !0;
429
- }), i.useCallback(
430
- (u, f = {}) => {
431
- if (S(l.current, ge), !l.current) return;
432
- if (typeof u == "number") {
433
- r.go(u);
434
- return;
435
- }
436
- let d = ce(
437
- u,
438
- JSON.parse(n),
439
- a,
440
- f.relative === "path"
441
- );
442
- e == null && t !== "/" && (d.pathname = d.pathname === "/" ? t : b([t, d.pathname])), (f.replace ? r.replace : r.push)(
443
- d,
444
- f.state,
445
- f
446
- );
447
- },
448
- [
449
- t,
450
- r,
451
- n,
452
- a,
453
- e
454
- ]
455
- );
456
- }
457
- i.createContext(null);
458
- function M(e, { relative: t } = {}) {
459
- let { matches: r } = i.useContext(P), { pathname: o } = $(), a = JSON.stringify(se(r));
460
- return i.useMemo(
461
- () => ce(
462
- e,
463
- JSON.parse(a),
464
- o,
465
- t === "path"
466
- ),
467
- [e, a, o, t]
468
- );
469
- }
470
- function at(e, t, r, o, a) {
471
- E(
472
- j(),
473
- // TODO: This error is probably because they somehow have 2 versions of the
474
- // router loaded. We can help them understand how to avoid that.
475
- "useRoutes() may be used only in the context of a <Router> component."
476
- );
477
- let { navigator: n } = i.useContext(C), { matches: l } = i.useContext(P), s = l[l.length - 1], u = s ? s.params : {}, f = s ? s.pathname : "/", d = s ? s.pathnameBase : "/", c = s && s.route;
478
- {
479
- let h = c && c.path || "";
480
- Re(
481
- f,
482
- !c || h.endsWith("*") || h.endsWith("*?"),
483
- `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${h}">) 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.
484
-
485
- Please change the parent <Route path="${h}"> to <Route path="${h === "/" ? "*" : `${h}/*`}">.`
486
- );
487
- }
488
- let m = $(), p;
489
- p = m;
490
- let w = p.pathname || "/", y = w;
491
- if (d !== "/") {
492
- let h = d.replace(/^\//, "").split("/");
493
- y = "/" + w.replace(/^\//, "").split("/").slice(h.length).join("/");
494
- }
495
- let g = le(e, { pathname: y });
496
- return S(
497
- c || g != null,
498
- `No routes matched location "${p.pathname}${p.search}${p.hash}" `
499
- ), S(
500
- g == null || g[g.length - 1].route.element !== void 0 || g[g.length - 1].route.Component !== void 0 || g[g.length - 1].route.lazy !== void 0,
501
- `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.`
502
- ), st(
503
- g && g.map(
504
- (h) => Object.assign({}, h, {
505
- params: Object.assign({}, u, h.params),
506
- pathname: b([
507
- d,
508
- // Re-encode pathnames that were decoded inside matchRoutes.
509
- // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
510
- // `new URL()` internally and we need to prevent it from treating
511
- // them as separators
512
- n.encodeLocation ? n.encodeLocation(
513
- h.pathname.replace(/\?/g, "%3F").replace(/#/g, "%23")
514
- ).pathname : h.pathname
515
- ]),
516
- pathnameBase: h.pathnameBase === "/" ? d : b([
517
- d,
518
- // Re-encode pathnames that were decoded inside matchRoutes
519
- // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
520
- // `new URL()` internally and we need to prevent it from treating
521
- // them as separators
522
- n.encodeLocation ? n.encodeLocation(
523
- h.pathnameBase.replace(/\?/g, "%3F").replace(/#/g, "%23")
524
- ).pathname : h.pathnameBase
525
- ])
526
- })
527
- ),
528
- l,
529
- r,
530
- o,
531
- a
532
- );
533
- }
534
- function ot() {
535
- let e = mt(), t = Ve(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), r = e instanceof Error ? e.stack : null, o = "rgba(200,200,200, 0.5)", a = { padding: "0.5rem", backgroundColor: o }, n = { padding: "2px 4px", backgroundColor: o }, l = null;
536
- return console.error(
537
- "Error handled by React Router default ErrorBoundary:",
538
- e
539
- ), l = /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ i.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ i.createElement("code", { style: n }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ i.createElement("code", { style: n }, "errorElement"), " prop on your route.")), /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ i.createElement("h3", { style: { fontStyle: "italic" } }, t), r ? /* @__PURE__ */ i.createElement("pre", { style: a }, r) : null, l);
540
- }
541
- var lt = /* @__PURE__ */ i.createElement(ot, null), ve = class extends i.Component {
542
- constructor(e) {
543
- super(e), this.state = {
544
- location: e.location,
545
- revalidation: e.revalidation,
546
- error: e.error
547
- };
548
- }
549
- static getDerivedStateFromError(e) {
550
- return { error: e };
551
- }
552
- static getDerivedStateFromProps(e, t) {
553
- return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
554
- error: e.error,
555
- location: e.location,
556
- revalidation: e.revalidation
557
- } : {
558
- error: e.error !== void 0 ? e.error : t.error,
559
- location: t.location,
560
- revalidation: e.revalidation || t.revalidation
561
- };
562
- }
563
- componentDidCatch(e, t) {
564
- this.props.onError ? this.props.onError(e, t) : console.error(
565
- "React Router caught the following error during render",
566
- e
567
- );
568
- }
569
- render() {
570
- let e = this.state.error;
571
- if (this.context && typeof e == "object" && e && "digest" in e && typeof e.digest == "string") {
572
- const r = et(e.digest);
573
- r && (e = r);
574
- }
575
- let t = e !== void 0 ? /* @__PURE__ */ i.createElement(P.Provider, { value: this.props.routeContext }, /* @__PURE__ */ i.createElement(
576
- X.Provider,
577
- {
578
- value: e,
579
- children: this.props.component
580
- }
581
- )) : this.props.children;
582
- return this.context ? /* @__PURE__ */ i.createElement(it, { error: e }, t) : t;
583
- }
584
- };
585
- ve.contextType = Ge;
586
- var J = /* @__PURE__ */ new WeakMap();
587
- function it({
588
- children: e,
589
- error: t
590
- }) {
591
- let { basename: r } = i.useContext(C);
592
- if (typeof t == "object" && t && "digest" in t && typeof t.digest == "string") {
593
- let o = Ze(t.digest);
594
- if (o) {
595
- let a = J.get(t);
596
- if (a) throw a;
597
- let n = de(o.location, r);
598
- if (fe && !J.get(t))
599
- if (n.isExternal || o.reloadDocument)
600
- window.location.href = n.absoluteURL || n.to;
601
- else {
602
- const l = Promise.resolve().then(
603
- () => window.__reactRouterDataRouter.navigate(n.to, {
604
- replace: o.replace
605
- })
606
- );
607
- throw J.set(t, l), l;
608
- }
609
- return /* @__PURE__ */ i.createElement(
610
- "meta",
611
- {
612
- httpEquiv: "refresh",
613
- content: `0;url=${n.absoluteURL || n.to}`
614
- }
615
- );
616
- }
617
- }
618
- return e;
619
- }
620
- function ut({ routeContext: e, match: t, children: r }) {
621
- let o = i.useContext(O);
622
- return o && o.static && o.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (o.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ i.createElement(P.Provider, { value: e }, r);
623
- }
624
- function st(e, t = [], r = null, o = null, a = null) {
625
- if (e == null) {
626
- if (!r)
627
- return null;
628
- if (r.errors)
629
- e = r.matches;
630
- else if (t.length === 0 && !r.initialized && r.matches.length > 0)
631
- e = r.matches;
632
- else
633
- return null;
634
- }
635
- let n = e, l = r?.errors;
636
- if (l != null) {
637
- let d = n.findIndex(
638
- (c) => c.route.id && l?.[c.route.id] !== void 0
639
- );
640
- E(
641
- d >= 0,
642
- `Could not find a matching route for errors on route IDs: ${Object.keys(
643
- l
644
- ).join(",")}`
645
- ), n = n.slice(
646
- 0,
647
- Math.min(n.length, d + 1)
648
- );
649
- }
650
- let s = !1, u = -1;
651
- if (r)
652
- for (let d = 0; d < n.length; d++) {
653
- let c = n[d];
654
- if ((c.route.HydrateFallback || c.route.hydrateFallbackElement) && (u = d), c.route.id) {
655
- let { loaderData: m, errors: p } = r, w = c.route.loader && !m.hasOwnProperty(c.route.id) && (!p || p[c.route.id] === void 0);
656
- if (c.route.lazy || w) {
657
- s = !0, u >= 0 ? n = n.slice(0, u + 1) : n = [n[0]];
658
- break;
659
- }
660
- }
661
- }
662
- let f = r && o ? (d, c) => {
663
- o(d, {
664
- location: r.location,
665
- params: r.matches?.[0]?.params ?? {},
666
- unstable_pattern: Je(r.matches),
667
- errorInfo: c
668
- });
669
- } : void 0;
670
- return n.reduceRight(
671
- (d, c, m) => {
672
- let p, w = !1, y = null, g = null;
673
- r && (p = l && c.route.id ? l[c.route.id] : void 0, y = c.route.errorElement || lt, s && (u < 0 && m === 0 ? (Re(
674
- "route-fallback",
675
- !1,
676
- "No `HydrateFallback` element provided to render during initial hydration"
677
- ), w = !0, g = null) : u === m && (w = !0, g = c.route.hydrateFallbackElement || null)));
678
- let R = t.concat(n.slice(0, m + 1)), h = () => {
679
- let v;
680
- return p ? v = y : w ? v = g : c.route.Component ? v = /* @__PURE__ */ i.createElement(c.route.Component, null) : c.route.element ? v = c.route.element : v = d, /* @__PURE__ */ i.createElement(
681
- ut,
682
- {
683
- match: c,
684
- routeContext: {
685
- outlet: d,
686
- matches: R,
687
- isDataRoute: r != null
688
- },
689
- children: v
690
- }
691
- );
692
- };
693
- return r && (c.route.ErrorBoundary || c.route.errorElement || m === 0) ? /* @__PURE__ */ i.createElement(
694
- ve,
695
- {
696
- location: r.location,
697
- revalidation: r.revalidation,
698
- component: y,
699
- error: p,
700
- children: h(),
701
- routeContext: { outlet: null, matches: R, isDataRoute: !0 },
702
- onError: f
703
- }
704
- ) : h();
705
- },
706
- null
707
- );
708
- }
709
- function Q(e) {
710
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
711
- }
712
- function ct(e) {
713
- let t = i.useContext(O);
714
- return E(t, Q(e)), t;
715
- }
716
- function ft(e) {
717
- let t = i.useContext(H);
718
- return E(t, Q(e)), t;
719
- }
720
- function dt(e) {
721
- let t = i.useContext(P);
722
- return E(t, Q(e)), t;
723
- }
724
- function Z(e) {
725
- let t = dt(e), r = t.matches[t.matches.length - 1];
726
- return E(
727
- r.route.id,
728
- `${e} can only be used on routes that contain a unique "id"`
729
- ), r.route.id;
730
- }
731
- function ht() {
732
- return Z(
733
- "useRouteId"
734
- /* UseRouteId */
735
- );
736
- }
737
- function mt() {
738
- let e = i.useContext(X), t = ft(
739
- "useRouteError"
740
- /* UseRouteError */
741
- ), r = Z(
742
- "useRouteError"
743
- /* UseRouteError */
744
- );
745
- return e !== void 0 ? e : t.errors?.[r];
746
- }
747
- function pt() {
748
- let { router: e } = ct(
749
- "useNavigate"
750
- /* UseNavigateStable */
751
- ), t = Z(
752
- "useNavigate"
753
- /* UseNavigateStable */
754
- ), r = i.useRef(!1);
755
- return ye(() => {
756
- r.current = !0;
757
- }), i.useCallback(
758
- async (a, n = {}) => {
759
- S(r.current, ge), r.current && (typeof a == "number" ? await e.navigate(a) : await e.navigate(a, { fromRouteId: t, ...n }));
760
- },
761
- [e, t]
762
- );
763
- }
764
- var ae = {};
765
- function Re(e, t, r) {
766
- !t && !ae[e] && (ae[e] = !0, S(!1, r));
767
- }
768
- i.memo(gt);
769
- function gt({
770
- routes: e,
771
- future: t,
772
- state: r,
773
- onError: o
774
- }) {
775
- return at(e, void 0, r, o, t);
776
- }
777
- var B = "get", U = "application/x-www-form-urlencoded";
778
- function z(e) {
779
- return typeof HTMLElement < "u" && e instanceof HTMLElement;
780
- }
781
- function yt(e) {
782
- return z(e) && e.tagName.toLowerCase() === "button";
783
- }
784
- function vt(e) {
785
- return z(e) && e.tagName.toLowerCase() === "form";
786
- }
787
- function Rt(e) {
788
- return z(e) && e.tagName.toLowerCase() === "input";
789
- }
790
- function wt(e) {
791
- return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
792
- }
793
- function Et(e, t) {
794
- return e.button === 0 && // Ignore everything but left clicks
795
- (!t || t === "_self") && // Let browser handle "target=_blank" etc.
796
- !wt(e);
797
- }
798
- var A = null;
799
- function xt() {
800
- if (A === null)
801
- try {
802
- new FormData(
803
- document.createElement("form"),
804
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
805
- 0
806
- ), A = !1;
807
- } catch {
808
- A = !0;
809
- }
810
- return A;
811
- }
812
- var Ct = /* @__PURE__ */ new Set([
813
- "application/x-www-form-urlencoded",
814
- "multipart/form-data",
815
- "text/plain"
816
- ]);
817
- function K(e) {
818
- return e != null && !Ct.has(e) ? (S(
819
- !1,
820
- `"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${U}"`
821
- ), null) : e;
822
- }
823
- function bt(e, t) {
824
- let r, o, a, n, l;
825
- if (vt(e)) {
826
- let s = e.getAttribute("action");
827
- o = s ? L(s, t) : null, r = e.getAttribute("method") || B, a = K(e.getAttribute("enctype")) || U, n = new FormData(e);
828
- } else if (yt(e) || Rt(e) && (e.type === "submit" || e.type === "image")) {
829
- let s = e.form;
830
- if (s == null)
831
- throw new Error(
832
- 'Cannot submit a <button> or <input type="submit"> without a <form>'
833
- );
834
- let u = e.getAttribute("formaction") || s.getAttribute("action");
835
- if (o = u ? L(u, t) : null, r = e.getAttribute("formmethod") || s.getAttribute("method") || B, a = K(e.getAttribute("formenctype")) || K(s.getAttribute("enctype")) || U, n = new FormData(s, e), !xt()) {
836
- let { name: f, type: d, value: c } = e;
837
- if (d === "image") {
838
- let m = f ? `${f}.` : "";
839
- n.append(`${m}x`, "0"), n.append(`${m}y`, "0");
840
- } else f && n.append(f, c);
841
- }
842
- } else {
843
- if (z(e))
844
- throw new Error(
845
- 'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
846
- );
847
- r = B, o = null, a = U, l = e;
848
- }
849
- return n && a === "text/plain" && (l = n, n = void 0), { action: o, method: r.toLowerCase(), encType: a, formData: n, body: l };
850
- }
851
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
852
- function ee(e, t) {
853
- if (e === !1 || e === null || typeof e > "u")
854
- throw new Error(t);
855
- }
856
- function St(e, t, r, o) {
857
- let a = typeof e == "string" ? new URL(
858
- e,
859
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
860
- // don't assume window is available
861
- typeof window > "u" ? "server://singlefetch/" : window.location.origin
862
- ) : e;
863
- return r ? a.pathname.endsWith("/") ? a.pathname = `${a.pathname}_.${o}` : a.pathname = `${a.pathname}.${o}` : a.pathname === "/" ? a.pathname = `_root.${o}` : t && L(a.pathname, t) === "/" ? a.pathname = `${t.replace(/\/$/, "")}/_root.${o}` : a.pathname = `${a.pathname.replace(/\/$/, "")}.${o}`, a;
864
- }
865
- async function Pt(e, t) {
866
- if (e.id in t)
867
- return t[e.id];
868
- try {
869
- let r = await import(
870
- /* @vite-ignore */
871
- /* webpackIgnore: true */
872
- e.module
873
- );
874
- return t[e.id] = r, r;
875
- } catch (r) {
876
- return console.error(
877
- `Error loading route module \`${e.module}\`, reloading page...`
878
- ), console.error(r), window.location.reload(), new Promise(() => {
879
- });
880
- }
881
- }
882
- function Lt(e) {
883
- 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";
884
- }
885
- async function $t(e, t, r) {
886
- let o = await Promise.all(
887
- e.map(async (a) => {
888
- let n = t.routes[a.route.id];
889
- if (n) {
890
- let l = await Pt(n, r);
891
- return l.links ? l.links() : [];
892
- }
893
- return [];
894
- })
895
- );
896
- return It(
897
- o.flat(1).filter(Lt).filter((a) => a.rel === "stylesheet" || a.rel === "preload").map(
898
- (a) => a.rel === "stylesheet" ? { ...a, rel: "prefetch", as: "style" } : { ...a, rel: "prefetch" }
899
- )
900
- );
901
- }
902
- function oe(e, t, r, o, a, n) {
903
- let l = (u, f) => r[f] ? u.route.id !== r[f].route.id : !0, s = (u, f) => (
904
- // param change, /users/123 -> /users/456
905
- r[f].pathname !== u.pathname || // splat param changed, which is not present in match.path
906
- // e.g. /files/images/avatar.jpg -> files/finances.xls
907
- r[f].route.path?.endsWith("*") && r[f].params["*"] !== u.params["*"]
908
- );
909
- return n === "assets" ? t.filter(
910
- (u, f) => l(u, f) || s(u, f)
911
- ) : n === "data" ? t.filter((u, f) => {
912
- let d = o.routes[u.route.id];
913
- if (!d || !d.hasLoader)
914
- return !1;
915
- if (l(u, f) || s(u, f))
916
- return !0;
917
- if (u.route.shouldRevalidate) {
918
- let c = u.route.shouldRevalidate({
919
- currentUrl: new URL(
920
- a.pathname + a.search + a.hash,
921
- window.origin
922
- ),
923
- currentParams: r[0]?.params || {},
924
- nextUrl: new URL(e, window.origin),
925
- nextParams: u.params,
926
- defaultShouldRevalidate: !0
927
- });
928
- if (typeof c == "boolean")
929
- return c;
930
- }
931
- return !0;
932
- }) : [];
933
- }
934
- function kt(e, t, { includeHydrateFallback: r } = {}) {
935
- return Tt(
936
- e.map((o) => {
937
- let a = t.routes[o.route.id];
938
- if (!a) return [];
939
- let n = [a.module];
940
- return a.clientActionModule && (n = n.concat(a.clientActionModule)), a.clientLoaderModule && (n = n.concat(a.clientLoaderModule)), r && a.hydrateFallbackModule && (n = n.concat(a.hydrateFallbackModule)), a.imports && (n = n.concat(a.imports)), n;
941
- }).flat(1)
942
- );
943
- }
944
- function Tt(e) {
945
- return [...new Set(e)];
946
- }
947
- function Dt(e) {
948
- let t = {}, r = Object.keys(e).sort();
949
- for (let o of r)
950
- t[o] = e[o];
951
- return t;
952
- }
953
- function It(e, t) {
954
- let r = /* @__PURE__ */ new Set();
955
- return new Set(t), e.reduce((o, a) => {
956
- let n = JSON.stringify(Dt(a));
957
- return r.has(n) || (r.add(n), o.push({ key: n, link: a })), o;
958
- }, []);
959
- }
960
- function we() {
961
- let e = i.useContext(O);
962
- return ee(
963
- e,
964
- "You must render this element inside a <DataRouterContext.Provider> element"
965
- ), e;
966
- }
967
- function Ft() {
968
- let e = i.useContext(H);
969
- return ee(
970
- e,
971
- "You must render this element inside a <DataRouterStateContext.Provider> element"
972
- ), e;
973
- }
974
- var te = i.createContext(void 0);
975
- te.displayName = "FrameworkContext";
976
- function Ee() {
977
- let e = i.useContext(te);
978
- return ee(
979
- e,
980
- "You must render this element inside a <HydratedRouter> element"
981
- ), e;
982
- }
983
- function Ot(e, t) {
984
- let r = i.useContext(te), [o, a] = i.useState(!1), [n, l] = i.useState(!1), { onFocus: s, onBlur: u, onMouseEnter: f, onMouseLeave: d, onTouchStart: c } = t, m = i.useRef(null);
985
- i.useEffect(() => {
986
- if (e === "render" && l(!0), e === "viewport") {
987
- let y = (R) => {
988
- R.forEach((h) => {
989
- l(h.isIntersecting);
990
- });
991
- }, g = new IntersectionObserver(y, { threshold: 0.5 });
992
- return m.current && g.observe(m.current), () => {
993
- g.disconnect();
994
- };
995
- }
996
- }, [e]), i.useEffect(() => {
997
- if (o) {
998
- let y = setTimeout(() => {
999
- l(!0);
1000
- }, 100);
1001
- return () => {
1002
- clearTimeout(y);
1003
- };
1004
- }
1005
- }, [o]);
1006
- let p = () => {
1007
- a(!0);
1008
- }, w = () => {
1009
- a(!1), l(!1);
1010
- };
1011
- return r ? e !== "intent" ? [n, m, {}] : [
1012
- n,
1013
- m,
1014
- {
1015
- onFocus: _(s, p),
1016
- onBlur: _(u, w),
1017
- onMouseEnter: _(f, p),
1018
- onMouseLeave: _(d, w),
1019
- onTouchStart: _(c, p)
1020
- }
1021
- ] : [!1, m, {}];
1022
- }
1023
- function _(e, t) {
1024
- return (r) => {
1025
- e && e(r), r.defaultPrevented || t(r);
1026
- };
1027
- }
1028
- function Nt({ page: e, ...t }) {
1029
- let { router: r } = we(), o = i.useMemo(
1030
- () => le(r.routes, e, r.basename),
1031
- [r.routes, e, r.basename]
1032
- );
1033
- return o ? /* @__PURE__ */ i.createElement(Mt, { page: e, matches: o, ...t }) : null;
1034
- }
1035
- function _t(e) {
1036
- let { manifest: t, routeModules: r } = Ee(), [o, a] = i.useState([]);
1037
- return i.useEffect(() => {
1038
- let n = !1;
1039
- return $t(e, t, r).then(
1040
- (l) => {
1041
- n || a(l);
1042
- }
1043
- ), () => {
1044
- n = !0;
1045
- };
1046
- }, [e, t, r]), o;
1047
- }
1048
- function Mt({
1049
- page: e,
1050
- matches: t,
1051
- ...r
1052
- }) {
1053
- let o = $(), { future: a, manifest: n, routeModules: l } = Ee(), { basename: s } = we(), { loaderData: u, matches: f } = Ft(), d = i.useMemo(
1054
- () => oe(
1055
- e,
1056
- t,
1057
- f,
1058
- n,
1059
- o,
1060
- "data"
1061
- ),
1062
- [e, t, f, n, o]
1063
- ), c = i.useMemo(
1064
- () => oe(
1065
- e,
1066
- t,
1067
- f,
1068
- n,
1069
- o,
1070
- "assets"
1071
- ),
1072
- [e, t, f, n, o]
1073
- ), m = i.useMemo(() => {
1074
- if (e === o.pathname + o.search + o.hash)
1075
- return [];
1076
- let y = /* @__PURE__ */ new Set(), g = !1;
1077
- if (t.forEach((h) => {
1078
- let v = n.routes[h.route.id];
1079
- !v || !v.hasLoader || (!d.some((k) => k.route.id === h.route.id) && h.route.id in u && l[h.route.id]?.shouldRevalidate || v.hasClientLoader ? g = !0 : y.add(h.route.id));
1080
- }), y.size === 0)
1081
- return [];
1082
- let R = St(
1083
- e,
1084
- s,
1085
- a.unstable_trailingSlashAwareDataRequests,
1086
- "data"
1087
- );
1088
- return g && y.size > 0 && R.searchParams.set(
1089
- "_routes",
1090
- t.filter((h) => y.has(h.route.id)).map((h) => h.route.id).join(",")
1091
- ), [R.pathname + R.search];
1092
- }, [
1093
- s,
1094
- a.unstable_trailingSlashAwareDataRequests,
1095
- u,
1096
- o,
1097
- n,
1098
- d,
1099
- t,
1100
- e,
1101
- l
1102
- ]), p = i.useMemo(
1103
- () => kt(c, n),
1104
- [c, n]
1105
- ), w = _t(c);
1106
- return /* @__PURE__ */ i.createElement(i.Fragment, null, m.map((y) => /* @__PURE__ */ i.createElement("link", { key: y, rel: "prefetch", as: "fetch", href: y, ...r })), p.map((y) => /* @__PURE__ */ i.createElement("link", { key: y, rel: "modulepreload", href: y, ...r })), w.map(({ key: y, link: g }) => (
1107
- // these don't spread `linkProps` because they are full link descriptors
1108
- // already with their own props
1109
- /* @__PURE__ */ i.createElement(
1110
- "link",
1111
- {
1112
- key: y,
1113
- nonce: r.nonce,
1114
- ...g,
1115
- crossOrigin: g.crossOrigin ?? r.crossOrigin
1116
- }
1117
- )
1118
- )));
1119
- }
1120
- function At(...e) {
1121
- return (t) => {
1122
- e.forEach((r) => {
1123
- typeof r == "function" ? r(t) : r != null && (r.current = t);
1124
- });
1125
- };
1126
- }
1127
- var Bt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
1128
- try {
1129
- Bt && (window.__reactRouterVersion = // @ts-expect-error
1130
- "7.13.0");
1131
- } catch {
1132
- }
1133
- var xe = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, Ce = i.forwardRef(
1134
- function({
1135
- onClick: t,
1136
- discover: r = "render",
1137
- prefetch: o = "none",
1138
- relative: a,
1139
- reloadDocument: n,
1140
- replace: l,
1141
- state: s,
1142
- target: u,
1143
- to: f,
1144
- preventScrollReset: d,
1145
- viewTransition: c,
1146
- unstable_defaultShouldRevalidate: m,
1147
- ...p
1148
- }, w) {
1149
- let { basename: y, unstable_useTransitions: g } = i.useContext(C), R = typeof f == "string" && xe.test(f), h = de(f, y);
1150
- f = h.to;
1151
- let v = tt(f, { relative: a }), [k, x, T] = Ot(
1152
- o,
1153
- p
1154
- ), D = jt(f, {
1155
- replace: l,
1156
- state: s,
1157
- target: u,
1158
- preventScrollReset: d,
1159
- relative: a,
1160
- viewTransition: c,
1161
- unstable_defaultShouldRevalidate: m,
1162
- unstable_useTransitions: g
1163
- });
1164
- function I(N) {
1165
- t && t(N), N.defaultPrevented || D(N);
1166
- }
1167
- let F = (
1168
- // eslint-disable-next-line jsx-a11y/anchor-has-content
1169
- /* @__PURE__ */ i.createElement(
1170
- "a",
1171
- {
1172
- ...p,
1173
- ...T,
1174
- href: h.absoluteURL || v,
1175
- onClick: h.isExternal || n ? t : I,
1176
- ref: At(w, x),
1177
- target: u,
1178
- "data-discover": !R && r === "render" ? "true" : void 0
1179
- }
1180
- )
1181
- );
1182
- return k && !R ? /* @__PURE__ */ i.createElement(i.Fragment, null, F, /* @__PURE__ */ i.createElement(Nt, { page: v })) : F;
1183
- }
1184
- );
1185
- Ce.displayName = "Link";
1186
- var Ut = i.forwardRef(
1187
- function({
1188
- "aria-current": t = "page",
1189
- caseSensitive: r = !1,
1190
- className: o = "",
1191
- end: a = !1,
1192
- style: n,
1193
- to: l,
1194
- viewTransition: s,
1195
- children: u,
1196
- ...f
1197
- }, d) {
1198
- let c = M(l, { relative: f.relative }), m = $(), p = i.useContext(H), { navigator: w, basename: y } = i.useContext(C), g = p != null && // Conditional usage is OK here because the usage of a data router is static
1199
- // eslint-disable-next-line react-hooks/rules-of-hooks
1200
- Gt(c) && s === !0, R = w.encodeLocation ? w.encodeLocation(c).pathname : c.pathname, h = m.pathname, v = p && p.navigation && p.navigation.location ? p.navigation.location.pathname : null;
1201
- r || (h = h.toLowerCase(), v = v ? v.toLowerCase() : null, R = R.toLowerCase()), v && y && (v = L(v, y) || v);
1202
- const k = R !== "/" && R.endsWith("/") ? R.length - 1 : R.length;
1203
- let x = h === R || !a && h.startsWith(R) && h.charAt(k) === "/", T = v != null && (v === R || !a && v.startsWith(R) && v.charAt(R.length) === "/"), D = {
1204
- isActive: x,
1205
- isPending: T,
1206
- isTransitioning: g
1207
- }, I = x ? t : void 0, F;
1208
- typeof o == "function" ? F = o(D) : F = [
1209
- o,
1210
- x ? "active" : null,
1211
- T ? "pending" : null,
1212
- g ? "transitioning" : null
1213
- ].filter(Boolean).join(" ");
1214
- let N = typeof n == "function" ? n(D) : n;
1215
- return /* @__PURE__ */ i.createElement(
1216
- Ce,
1217
- {
1218
- ...f,
1219
- "aria-current": I,
1220
- className: F,
1221
- ref: d,
1222
- style: N,
1223
- to: l,
1224
- viewTransition: s
1225
- },
1226
- typeof u == "function" ? u(D) : u
1227
- );
1228
- }
1229
- );
1230
- Ut.displayName = "NavLink";
1231
- var Wt = i.forwardRef(
1232
- ({
1233
- discover: e = "render",
1234
- fetcherKey: t,
1235
- navigate: r,
1236
- reloadDocument: o,
1237
- replace: a,
1238
- state: n,
1239
- method: l = B,
1240
- action: s,
1241
- onSubmit: u,
1242
- relative: f,
1243
- preventScrollReset: d,
1244
- viewTransition: c,
1245
- unstable_defaultShouldRevalidate: m,
1246
- ...p
1247
- }, w) => {
1248
- let { unstable_useTransitions: y } = i.useContext(C), g = Jt(), R = Kt(s, { relative: f }), h = l.toLowerCase() === "get" ? "get" : "post", v = typeof s == "string" && xe.test(s), k = (x) => {
1249
- if (u && u(x), x.defaultPrevented) return;
1250
- x.preventDefault();
1251
- let T = x.nativeEvent.submitter, D = T?.getAttribute("formmethod") || l, I = () => g(T || x.currentTarget, {
1252
- fetcherKey: t,
1253
- method: D,
1254
- navigate: r,
1255
- replace: a,
1256
- state: n,
1257
- relative: f,
1258
- preventScrollReset: d,
1259
- viewTransition: c,
1260
- unstable_defaultShouldRevalidate: m
1261
- });
1262
- y && r !== !1 ? i.startTransition(() => I()) : I();
1263
- };
1264
- return /* @__PURE__ */ i.createElement(
1265
- "form",
1266
- {
1267
- ref: w,
1268
- method: h,
1269
- action: R,
1270
- onSubmit: o ? u : k,
1271
- ...p,
1272
- "data-discover": !v && e === "render" ? "true" : void 0
1273
- }
1274
- );
1275
- }
1276
- );
1277
- Wt.displayName = "Form";
1278
- function Ht(e) {
1279
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1280
- }
1281
- function be(e) {
1282
- let t = i.useContext(O);
1283
- return E(t, Ht(e)), t;
1284
- }
1285
- function jt(e, {
1286
- target: t,
1287
- replace: r,
1288
- state: o,
1289
- preventScrollReset: a,
1290
- relative: n,
1291
- viewTransition: l,
1292
- unstable_defaultShouldRevalidate: s,
1293
- unstable_useTransitions: u
1294
- } = {}) {
1295
- let f = rt(), d = $(), c = M(e, { relative: n });
1296
- return i.useCallback(
1297
- (m) => {
1298
- if (Et(m, t)) {
1299
- m.preventDefault();
1300
- let p = r !== void 0 ? r : G(d) === G(c), w = () => f(e, {
1301
- replace: p,
1302
- state: o,
1303
- preventScrollReset: a,
1304
- relative: n,
1305
- viewTransition: l,
1306
- unstable_defaultShouldRevalidate: s
1307
- });
1308
- u ? i.startTransition(() => w()) : w();
1309
- }
1310
- },
1311
- [
1312
- d,
1313
- f,
1314
- c,
1315
- r,
1316
- o,
1317
- t,
1318
- e,
1319
- a,
1320
- n,
1321
- l,
1322
- s,
1323
- u
1324
- ]
1325
- );
1326
- }
1327
- var zt = 0, Vt = () => `__${String(++zt)}__`;
1328
- function Jt() {
1329
- let { router: e } = be(
1330
- "useSubmit"
1331
- /* UseSubmit */
1332
- ), { basename: t } = i.useContext(C), r = ht(), o = e.fetch, a = e.navigate;
1333
- return i.useCallback(
1334
- async (n, l = {}) => {
1335
- let { action: s, method: u, encType: f, formData: d, body: c } = bt(
1336
- n,
1337
- t
1338
- );
1339
- if (l.navigate === !1) {
1340
- let m = l.fetcherKey || Vt();
1341
- await o(m, r, l.action || s, {
1342
- unstable_defaultShouldRevalidate: l.unstable_defaultShouldRevalidate,
1343
- preventScrollReset: l.preventScrollReset,
1344
- formData: d,
1345
- body: c,
1346
- formMethod: l.method || u,
1347
- formEncType: l.encType || f,
1348
- flushSync: l.flushSync
1349
- });
1350
- } else
1351
- await a(l.action || s, {
1352
- unstable_defaultShouldRevalidate: l.unstable_defaultShouldRevalidate,
1353
- preventScrollReset: l.preventScrollReset,
1354
- formData: d,
1355
- body: c,
1356
- formMethod: l.method || u,
1357
- formEncType: l.encType || f,
1358
- replace: l.replace,
1359
- state: l.state,
1360
- fromRouteId: r,
1361
- flushSync: l.flushSync,
1362
- viewTransition: l.viewTransition
1363
- });
1364
- },
1365
- [o, a, t, r]
1366
- );
1367
- }
1368
- function Kt(e, { relative: t } = {}) {
1369
- let { basename: r } = i.useContext(C), o = i.useContext(P);
1370
- E(o, "useFormAction must be used inside a RouteContext");
1371
- let [a] = o.matches.slice(-1), n = { ...M(e || ".", { relative: t }) }, l = $();
1372
- if (e == null) {
1373
- n.search = l.search;
1374
- let s = new URLSearchParams(n.search), u = s.getAll("index");
1375
- if (u.some((d) => d === "")) {
1376
- s.delete("index"), u.filter((c) => c).forEach((c) => s.append("index", c));
1377
- let d = s.toString();
1378
- n.search = d ? `?${d}` : "";
1379
- }
1380
- }
1381
- return (!e || e === ".") && a.route.index && (n.search = n.search ? n.search.replace(/^\?/, "?index&") : "?index"), r !== "/" && (n.pathname = n.pathname === "/" ? r : b([r, n.pathname])), G(n);
1382
- }
1383
- function Gt(e, { relative: t } = {}) {
1384
- let r = i.useContext(me);
1385
- E(
1386
- r != null,
1387
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1388
- );
1389
- let { basename: o } = be(
1390
- "useViewTransitionState"
1391
- /* useViewTransitionState */
1392
- ), a = M(e, { relative: t });
1393
- if (!r.isTransitioning)
1394
- return !1;
1395
- let n = L(r.currentLocation.pathname, o) || r.currentLocation.pathname, l = L(r.nextLocation.pathname, o) || r.nextLocation.pathname;
1396
- return W(a.pathname, l) != null || W(a.pathname, n) != null;
1397
- }
1398
- const qt = () => {
1399
- try {
1400
- return $(), {
1401
- isInsideRouter: !0
1402
- };
1403
- } catch {
1404
- return {
1405
- isInsideRouter: !1
1406
- };
1407
- }
1408
- };
1409
- export {
1410
- Ce as L,
1411
- qt as u
1412
- };