zudoku 0.12.2 → 0.13.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 (197) hide show
  1. package/dist/app/main.js +3 -3
  2. package/dist/app/main.js.map +1 -1
  3. package/dist/cli/dev/handler.js +2 -2
  4. package/dist/cli/dev/handler.js.map +1 -1
  5. package/dist/config/validators/validate.d.ts +42 -23
  6. package/dist/config/validators/validate.js +6 -2
  7. package/dist/config/validators/validate.js.map +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/lib/components/Banner.js +7 -1
  10. package/dist/lib/components/Banner.js.map +1 -1
  11. package/dist/lib/components/Header.js +1 -1
  12. package/dist/lib/components/Header.js.map +1 -1
  13. package/dist/lib/components/Layout.js +1 -1
  14. package/dist/lib/components/Layout.js.map +1 -1
  15. package/dist/lib/components/MobileTopNavigation.js +2 -1
  16. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  17. package/dist/lib/components/Search.js +1 -1
  18. package/dist/lib/components/Search.js.map +1 -1
  19. package/dist/lib/components/SlotletProvider.d.ts +9 -2
  20. package/dist/lib/components/SlotletProvider.js +4 -2
  21. package/dist/lib/components/SlotletProvider.js.map +1 -1
  22. package/dist/lib/components/index.d.ts +2 -1
  23. package/dist/lib/components/index.js.map +1 -1
  24. package/dist/lib/core/DevPortalContext.d.ts +1 -1
  25. package/dist/lib/oas/graphql/index.js +2 -6
  26. package/dist/lib/oas/graphql/index.js.map +1 -1
  27. package/dist/lib/plugins/custom-pages/CustomPage.d.ts +2 -0
  28. package/dist/lib/plugins/custom-pages/CustomPage.js +10 -0
  29. package/dist/lib/plugins/custom-pages/CustomPage.js.map +1 -0
  30. package/dist/lib/plugins/custom-pages/index.d.ts +10 -0
  31. package/dist/lib/plugins/custom-pages/index.js +11 -0
  32. package/dist/lib/plugins/custom-pages/index.js.map +1 -0
  33. package/dist/lib/plugins/openapi/Endpoint.js +1 -1
  34. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  35. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  36. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  37. package/dist/lib/plugins/openapi/Route.d.ts +1 -1
  38. package/dist/lib/plugins/openapi/Route.js +1 -1
  39. package/dist/lib/plugins/openapi/Route.js.map +1 -1
  40. package/dist/lib/plugins/openapi/Sidecar.js +1 -1
  41. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  42. package/dist/lib/plugins/openapi/client/createMemoryClient.js +1 -1
  43. package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -1
  44. package/dist/lib/plugins/openapi/client/createWorkerClient.js +1 -1
  45. package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -1
  46. package/dist/lib/plugins/openapi/index.js +1 -1
  47. package/dist/lib/plugins/openapi/index.js.map +1 -1
  48. package/dist/lib/ui/Callout.d.ts +36 -35
  49. package/dist/lib/ui/Callout.js.map +1 -1
  50. package/dist/lib/ui/Drawer.d.ts +8 -10
  51. package/dist/lib/ui/Drawer.js.map +1 -1
  52. package/dist/lib/util/useExposedProps.d.ts +2 -0
  53. package/dist/lib/util/useExposedProps.js +8 -0
  54. package/dist/lib/util/useExposedProps.js.map +1 -0
  55. package/dist/vite/config.js +2 -0
  56. package/dist/vite/config.js.map +1 -1
  57. package/dist/vite/dev-server.d.ts +6 -1
  58. package/dist/vite/dev-server.js +13 -3
  59. package/dist/vite/dev-server.js.map +1 -1
  60. package/dist/vite/plugin-component.js +0 -1
  61. package/dist/vite/plugin-component.js.map +1 -1
  62. package/dist/vite/plugin-custom-pages.d.ts +4 -0
  63. package/dist/vite/plugin-custom-pages.js +30 -0
  64. package/dist/vite/plugin-custom-pages.js.map +1 -0
  65. package/dist/vite/plugin.js +2 -0
  66. package/dist/vite/plugin.js.map +1 -1
  67. package/lib/{AuthenticationPlugin-Bx9FK124.js → AuthenticationPlugin-CbgJ5SAh.js} +3 -3
  68. package/lib/{AuthenticationPlugin-Bx9FK124.js.map → AuthenticationPlugin-CbgJ5SAh.js.map} +1 -1
  69. package/lib/{DeveloperHint-YeWHKvyr.js → DeveloperHint-CiXPc9Xm.js} +2 -2
  70. package/lib/{DeveloperHint-YeWHKvyr.js.map → DeveloperHint-CiXPc9Xm.js.map} +1 -1
  71. package/lib/ErrorPage-B-zoPPVx.js +15 -0
  72. package/lib/{ErrorPage-CsZAN_za.js.map → ErrorPage-B-zoPPVx.js.map} +1 -1
  73. package/lib/Input-QMLhK7Rb.js +2229 -0
  74. package/lib/Input-QMLhK7Rb.js.map +1 -0
  75. package/lib/{Markdown-DapSf3wG.js → Markdown-D6Nze6qq.js} +3281 -5392
  76. package/lib/Markdown-D6Nze6qq.js.map +1 -0
  77. package/lib/{MdxPage-BqBWsXZ1.js → MdxPage-DBhq6-5F.js} +15 -15
  78. package/lib/{MdxPage-BqBWsXZ1.js.map → MdxPage-DBhq6-5F.js.map} +1 -1
  79. package/lib/{OperationList-CYrmxPa8.js → OperationList-Ba24gUd2.js} +50 -51
  80. package/lib/OperationList-Ba24gUd2.js.map +1 -0
  81. package/lib/{Route-Q5mqNQrv.js → Route-DI38nxYt.js} +3 -4
  82. package/lib/Route-DI38nxYt.js.map +1 -0
  83. package/lib/SidebarBadge-B9-VJSQr.js +503 -0
  84. package/lib/SidebarBadge-B9-VJSQr.js.map +1 -0
  85. package/lib/{SlotletProvider-D3UD5Go3.js → SlotletProvider-Cb8mGpBO.js} +46 -46
  86. package/lib/{SlotletProvider-D3UD5Go3.js.map → SlotletProvider-Cb8mGpBO.js.map} +1 -1
  87. package/lib/ZudokuContext-BEmsYQoq.js +1173 -0
  88. package/lib/ZudokuContext-BEmsYQoq.js.map +1 -0
  89. package/lib/assets/{index-B9EWVYfo.js → index-B_Jk_Yzp.js} +968 -938
  90. package/lib/assets/index-B_Jk_Yzp.js.map +1 -0
  91. package/lib/assets/{worker-Bcj4NA2p.js → worker-Bf8vjASY.js} +4582 -4303
  92. package/lib/assets/worker-Bf8vjASY.js.map +1 -0
  93. package/lib/cn-BmFQLtkS.js +2279 -0
  94. package/lib/cn-BmFQLtkS.js.map +1 -0
  95. package/lib/{index-BG0g4WW0.js → index-BRCiYFaL.js} +747 -737
  96. package/lib/index-BRCiYFaL.js.map +1 -0
  97. package/lib/{index-CLd8ycZz.js → index-CkwDvuPt.js} +947 -917
  98. package/lib/index-CkwDvuPt.js.map +1 -0
  99. package/lib/{index-LNp6rxyU.js → index-D06ATMgg.js} +2 -2
  100. package/lib/{index-LNp6rxyU.js.map → index-D06ATMgg.js.map} +1 -1
  101. package/lib/{index-BlJ2rj99.js → index-DA74gNq3.js} +1124 -974
  102. package/lib/index-DA74gNq3.js.map +1 -0
  103. package/lib/index-DJqnphbT.js +35 -0
  104. package/lib/{index-Bn6Lc9tq.js.map → index-DJqnphbT.js.map} +1 -1
  105. package/lib/{index-BngPzhKn.js → index-dgcPryXi.js} +3 -3
  106. package/lib/{index-BngPzhKn.js.map → index-dgcPryXi.js.map} +1 -1
  107. package/lib/{index-Dolisrci.js → index-g_JJcuFg.js} +603 -549
  108. package/lib/index-g_JJcuFg.js.map +1 -0
  109. package/lib/router-Oe6YmY6B.js +3024 -0
  110. package/lib/router-Oe6YmY6B.js.map +1 -0
  111. package/lib/state-CsuHT8ZO.js +183 -0
  112. package/lib/state-CsuHT8ZO.js.map +1 -0
  113. package/lib/urql-core-KJnLL26g.js +1455 -0
  114. package/lib/urql-core-KJnLL26g.js.map +1 -0
  115. package/lib/useExposedProps-Csw8oAlt.js +9 -0
  116. package/lib/useExposedProps-Csw8oAlt.js.map +1 -0
  117. package/lib/{utils-ByIc_KIM.js → utils-Chi3p5nE.js} +4 -4
  118. package/lib/utils-Chi3p5nE.js.map +1 -0
  119. package/lib/zudoku.auth-auth0.js +1 -1
  120. package/lib/zudoku.auth-clerk.js +2 -2
  121. package/lib/zudoku.auth-openid.js +363 -350
  122. package/lib/zudoku.auth-openid.js.map +1 -1
  123. package/lib/zudoku.components.js +1697 -1623
  124. package/lib/zudoku.components.js.map +1 -1
  125. package/lib/zudoku.openapi-worker.js +4599 -4319
  126. package/lib/zudoku.openapi-worker.js.map +1 -1
  127. package/lib/zudoku.plugin-api-keys.js +7 -7
  128. package/lib/zudoku.plugin-custom-pages.js +21 -0
  129. package/lib/zudoku.plugin-custom-pages.js.map +1 -0
  130. package/lib/zudoku.plugin-markdown.js +1 -1
  131. package/lib/zudoku.plugin-openapi.js +8 -8
  132. package/lib/zudoku.plugin-redirect.js +1 -1
  133. package/package.json +61 -68
  134. package/src/app/main.tsx +3 -3
  135. package/src/lib/components/Banner.tsx +12 -2
  136. package/src/lib/components/Header.tsx +4 -2
  137. package/src/lib/components/Layout.tsx +1 -0
  138. package/src/lib/components/MobileTopNavigation.tsx +4 -0
  139. package/src/lib/components/Search.tsx +1 -1
  140. package/src/lib/components/SlotletProvider.tsx +27 -4
  141. package/src/lib/components/index.ts +1 -1
  142. package/src/lib/core/DevPortalContext.ts +1 -1
  143. package/src/lib/oas/graphql/index.ts +3 -11
  144. package/src/lib/plugins/custom-pages/CustomPage.tsx +15 -0
  145. package/src/lib/plugins/custom-pages/index.tsx +24 -0
  146. package/src/lib/plugins/openapi/Endpoint.tsx +1 -1
  147. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  148. package/src/lib/plugins/openapi/Route.tsx +1 -2
  149. package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
  150. package/src/lib/plugins/openapi/client/createMemoryClient.ts +1 -6
  151. package/src/lib/plugins/openapi/client/createWorkerClient.ts +1 -6
  152. package/src/lib/plugins/openapi/index.tsx +1 -5
  153. package/src/lib/ui/Callout.tsx +7 -6
  154. package/src/lib/ui/Drawer.tsx +38 -36
  155. package/src/lib/util/useExposedProps.tsx +10 -0
  156. package/dist/lib/plugins/custom-page/index.d.ts +0 -8
  157. package/dist/lib/plugins/custom-page/index.js +0 -12
  158. package/dist/lib/plugins/custom-page/index.js.map +0 -1
  159. package/dist/lib/plugins/openapi/playground/Editor.d.ts +0 -1
  160. package/dist/lib/plugins/openapi/playground/Editor.js +0 -5
  161. package/dist/lib/plugins/openapi/playground/Editor.js.map +0 -1
  162. package/dist/lib/plugins/openapi/util/urql.d.ts +0 -7
  163. package/dist/lib/plugins/openapi/util/urql.js +0 -8
  164. package/dist/lib/plugins/openapi/util/urql.js.map +0 -1
  165. package/lib/CategoryHeading-ovR-zHRq.js +0 -10
  166. package/lib/CategoryHeading-ovR-zHRq.js.map +0 -1
  167. package/lib/ErrorPage-CsZAN_za.js +0 -16
  168. package/lib/Input-CtVUl3eT.js +0 -2198
  169. package/lib/Input-CtVUl3eT.js.map +0 -1
  170. package/lib/Markdown-DapSf3wG.js.map +0 -1
  171. package/lib/OperationList-CYrmxPa8.js.map +0 -1
  172. package/lib/Route-Q5mqNQrv.js.map +0 -1
  173. package/lib/SidebarBadge-Dx7jtnoA.js +0 -498
  174. package/lib/SidebarBadge-Dx7jtnoA.js.map +0 -1
  175. package/lib/ZudokuContext-cr-pTRY1.js +0 -1084
  176. package/lib/ZudokuContext-cr-pTRY1.js.map +0 -1
  177. package/lib/_commonjsHelpers-BkfeUUK-.js +0 -29
  178. package/lib/_commonjsHelpers-BkfeUUK-.js.map +0 -1
  179. package/lib/assets/index-B9EWVYfo.js.map +0 -1
  180. package/lib/assets/worker-Bcj4NA2p.js.map +0 -1
  181. package/lib/index-BG0g4WW0.js.map +0 -1
  182. package/lib/index-BlJ2rj99.js.map +0 -1
  183. package/lib/index-Bn6Lc9tq.js +0 -9
  184. package/lib/index-CLd8ycZz.js.map +0 -1
  185. package/lib/index-Dolisrci.js.map +0 -1
  186. package/lib/router-D2p7Olpn.js +0 -2971
  187. package/lib/router-D2p7Olpn.js.map +0 -1
  188. package/lib/state-hNe1dw4B.js +0 -548
  189. package/lib/state-hNe1dw4B.js.map +0 -1
  190. package/lib/urql-YhcsXYy8.js +0 -1591
  191. package/lib/urql-YhcsXYy8.js.map +0 -1
  192. package/lib/utils-ByIc_KIM.js.map +0 -1
  193. package/lib/zudoku.plugin-custom-page.js +0 -13
  194. package/lib/zudoku.plugin-custom-page.js.map +0 -1
  195. package/src/lib/plugins/custom-page/index.tsx +0 -22
  196. package/src/lib/plugins/openapi/playground/Editor.tsx +0 -4
  197. package/src/lib/plugins/openapi/util/urql.ts +0 -8
@@ -1,2971 +0,0 @@
1
- /**
2
- * @remix-run/router v1.18.0
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- function I() {
12
- return I = Object.assign ? Object.assign.bind() : function(e) {
13
- for (var t = 1; t < arguments.length; t++) {
14
- var r = arguments[t];
15
- for (var a in r)
16
- Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
17
- }
18
- return e;
19
- }, I.apply(this, arguments);
20
- }
21
- var V;
22
- (function(e) {
23
- e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
24
- })(V || (V = {}));
25
- const _t = "popstate";
26
- function Wr(e) {
27
- e === void 0 && (e = {});
28
- let {
29
- initialEntries: t = ["/"],
30
- initialIndex: r,
31
- v5Compat: a = !1
32
- } = e, n;
33
- n = t.map((m, y) => b(m, typeof m == "string" ? null : m.state, y === 0 ? "default" : void 0));
34
- let s = u(r ?? n.length - 1), l = V.Pop, f = null;
35
- function u(m) {
36
- return Math.min(Math.max(m, 0), n.length - 1);
37
- }
38
- function v() {
39
- return n[s];
40
- }
41
- function b(m, y, g) {
42
- y === void 0 && (y = null);
43
- let P = ge(n ? v().pathname : "/", m, y, g);
44
- return de(P.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(m)), P;
45
- }
46
- function p(m) {
47
- return typeof m == "string" ? m : ue(m);
48
- }
49
- return {
50
- get index() {
51
- return s;
52
- },
53
- get action() {
54
- return l;
55
- },
56
- get location() {
57
- return v();
58
- },
59
- createHref: p,
60
- createURL(m) {
61
- return new URL(p(m), "http://localhost");
62
- },
63
- encodeLocation(m) {
64
- let y = typeof m == "string" ? oe(m) : m;
65
- return {
66
- pathname: y.pathname || "",
67
- search: y.search || "",
68
- hash: y.hash || ""
69
- };
70
- },
71
- push(m, y) {
72
- l = V.Push;
73
- let g = b(m, y);
74
- s += 1, n.splice(s, n.length, g), a && f && f({
75
- action: l,
76
- location: g,
77
- delta: 1
78
- });
79
- },
80
- replace(m, y) {
81
- l = V.Replace;
82
- let g = b(m, y);
83
- n[s] = g, a && f && f({
84
- action: l,
85
- location: g,
86
- delta: 0
87
- });
88
- },
89
- go(m) {
90
- l = V.Pop;
91
- let y = u(s + m), g = n[y];
92
- s = y, f && f({
93
- action: l,
94
- location: g,
95
- delta: m
96
- });
97
- },
98
- listen(m) {
99
- return f = m, () => {
100
- f = null;
101
- };
102
- }
103
- };
104
- }
105
- function Kr(e) {
106
- e === void 0 && (e = {});
107
- function t(a, n) {
108
- let {
109
- pathname: s,
110
- search: l,
111
- hash: f
112
- } = a.location;
113
- return ge(
114
- "",
115
- {
116
- pathname: s,
117
- search: l,
118
- hash: f
119
- },
120
- // state defaults to `null` because `window.history.state` does
121
- n.state && n.state.usr || null,
122
- n.state && n.state.key || "default"
123
- );
124
- }
125
- function r(a, n) {
126
- return typeof n == "string" ? n : ue(n);
127
- }
128
- return Gt(t, r, null, e);
129
- }
130
- function $r(e) {
131
- e === void 0 && (e = {});
132
- function t(n, s) {
133
- let {
134
- pathname: l = "/",
135
- search: f = "",
136
- hash: u = ""
137
- } = oe(n.location.hash.substr(1));
138
- return !l.startsWith("/") && !l.startsWith(".") && (l = "/" + l), ge(
139
- "",
140
- {
141
- pathname: l,
142
- search: f,
143
- hash: u
144
- },
145
- // state defaults to `null` because `window.history.state` does
146
- s.state && s.state.usr || null,
147
- s.state && s.state.key || "default"
148
- );
149
- }
150
- function r(n, s) {
151
- let l = n.document.querySelector("base"), f = "";
152
- if (l && l.getAttribute("href")) {
153
- let u = n.location.href, v = u.indexOf("#");
154
- f = v === -1 ? u : u.slice(0, v);
155
- }
156
- return f + "#" + (typeof s == "string" ? s : ue(s));
157
- }
158
- function a(n, s) {
159
- de(n.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(s) + ")");
160
- }
161
- return Gt(t, r, a, e);
162
- }
163
- function O(e, t) {
164
- if (e === !1 || e === null || typeof e > "u")
165
- throw new Error(t);
166
- }
167
- function de(e, t) {
168
- if (!e) {
169
- typeof console < "u" && console.warn(t);
170
- try {
171
- throw new Error(t);
172
- } catch {
173
- }
174
- }
175
- }
176
- function kr() {
177
- return Math.random().toString(36).substr(2, 8);
178
- }
179
- function Ut(e, t) {
180
- return {
181
- usr: e.state,
182
- key: e.key,
183
- idx: t
184
- };
185
- }
186
- function ge(e, t, r, a) {
187
- return r === void 0 && (r = null), I({
188
- pathname: typeof e == "string" ? e : e.pathname,
189
- search: "",
190
- hash: ""
191
- }, typeof t == "string" ? oe(t) : t, {
192
- state: r,
193
- // TODO: This could be cleaned up. push/replace should probably just take
194
- // full Locations now and avoid the need to run through this flow at all
195
- // But that's a pretty big refactor to the current test suite so going to
196
- // keep as is for the time being and just let any incoming keys take precedence
197
- key: t && t.key || a || kr()
198
- });
199
- }
200
- function ue(e) {
201
- let {
202
- pathname: t = "/",
203
- search: r = "",
204
- hash: a = ""
205
- } = e;
206
- return r && r !== "?" && (t += r.charAt(0) === "?" ? r : "?" + r), a && a !== "#" && (t += a.charAt(0) === "#" ? a : "#" + a), t;
207
- }
208
- function oe(e) {
209
- let t = {};
210
- if (e) {
211
- let r = e.indexOf("#");
212
- r >= 0 && (t.hash = e.substr(r), e = e.substr(0, r));
213
- let a = e.indexOf("?");
214
- a >= 0 && (t.search = e.substr(a), e = e.substr(0, a)), e && (t.pathname = e);
215
- }
216
- return t;
217
- }
218
- function Gt(e, t, r, a) {
219
- a === void 0 && (a = {});
220
- let {
221
- window: n = document.defaultView,
222
- v5Compat: s = !1
223
- } = a, l = n.history, f = V.Pop, u = null, v = b();
224
- v == null && (v = 0, l.replaceState(I({}, l.state, {
225
- idx: v
226
- }), ""));
227
- function b() {
228
- return (l.state || {
229
- idx: null
230
- }).idx;
231
- }
232
- function p() {
233
- f = V.Pop;
234
- let P = b(), A = P == null ? null : P - v;
235
- v = P, u && u({
236
- action: f,
237
- location: g.location,
238
- delta: A
239
- });
240
- }
241
- function R(P, A) {
242
- f = V.Push;
243
- let x = ge(g.location, P, A);
244
- r && r(x, P), v = b() + 1;
245
- let U = Ut(x, v), S = g.createHref(x);
246
- try {
247
- l.pushState(U, "", S);
248
- } catch (N) {
249
- if (N instanceof DOMException && N.name === "DataCloneError")
250
- throw N;
251
- n.location.assign(S);
252
- }
253
- s && u && u({
254
- action: f,
255
- location: g.location,
256
- delta: 1
257
- });
258
- }
259
- function m(P, A) {
260
- f = V.Replace;
261
- let x = ge(g.location, P, A);
262
- r && r(x, P), v = b();
263
- let U = Ut(x, v), S = g.createHref(x);
264
- l.replaceState(U, "", S), s && u && u({
265
- action: f,
266
- location: g.location,
267
- delta: 0
268
- });
269
- }
270
- function y(P) {
271
- let A = n.location.origin !== "null" ? n.location.origin : n.location.href, x = typeof P == "string" ? P : ue(P);
272
- return x = x.replace(/ $/, "%20"), O(A, "No window.location.(origin|href) available to create URL for href: " + x), new URL(x, A);
273
- }
274
- let g = {
275
- get action() {
276
- return f;
277
- },
278
- get location() {
279
- return e(n, l);
280
- },
281
- listen(P) {
282
- if (u)
283
- throw new Error("A history only accepts one active listener");
284
- return n.addEventListener(_t, p), u = P, () => {
285
- n.removeEventListener(_t, p), u = null;
286
- };
287
- },
288
- createHref(P) {
289
- return t(n, P);
290
- },
291
- createURL: y,
292
- encodeLocation(P) {
293
- let A = y(P);
294
- return {
295
- pathname: A.pathname,
296
- search: A.search,
297
- hash: A.hash
298
- };
299
- },
300
- push: R,
301
- replace: m,
302
- go(P) {
303
- return l.go(P);
304
- }
305
- };
306
- return g;
307
- }
308
- var H;
309
- (function(e) {
310
- e.data = "data", e.deferred = "deferred", e.redirect = "redirect", e.error = "error";
311
- })(H || (H = {}));
312
- const Vr = /* @__PURE__ */ new Set(["lazy", "caseSensitive", "path", "id", "index", "children"]);
313
- function Yr(e) {
314
- return e.index === !0;
315
- }
316
- function je(e, t, r, a) {
317
- return r === void 0 && (r = []), a === void 0 && (a = {}), e.map((n, s) => {
318
- let l = [...r, String(s)], f = typeof n.id == "string" ? n.id : l.join("-");
319
- if (O(n.index !== !0 || !n.children, "Cannot specify children on an index route"), O(!a[f], 'Found a route id collision on id "' + f + `". Route id's must be globally unique within Data Router usages`), Yr(n)) {
320
- let u = I({}, n, t(n), {
321
- id: f
322
- });
323
- return a[f] = u, u;
324
- } else {
325
- let u = I({}, n, t(n), {
326
- id: f,
327
- children: void 0
328
- });
329
- return a[f] = u, n.children && (u.children = je(n.children, t, l, a)), u;
330
- }
331
- });
332
- }
333
- function me(e, t, r) {
334
- return r === void 0 && (r = "/"), at(e, t, r, !1);
335
- }
336
- function at(e, t, r, a) {
337
- let n = typeof t == "string" ? oe(t) : t, s = Ye(n.pathname || "/", r);
338
- if (s == null)
339
- return null;
340
- let l = Qt(e);
341
- Jr(l);
342
- let f = null;
343
- for (let u = 0; f == null && u < l.length; ++u) {
344
- let v = qt(s);
345
- f = aa(l[u], v, a);
346
- }
347
- return f;
348
- }
349
- function Xt(e, t) {
350
- let {
351
- route: r,
352
- pathname: a,
353
- params: n
354
- } = e;
355
- return {
356
- id: r.id,
357
- pathname: a,
358
- params: n,
359
- data: t[r.id],
360
- handle: r.handle
361
- };
362
- }
363
- function Qt(e, t, r, a) {
364
- t === void 0 && (t = []), r === void 0 && (r = []), a === void 0 && (a = "");
365
- let n = (s, l, f) => {
366
- let u = {
367
- relativePath: f === void 0 ? s.path || "" : f,
368
- caseSensitive: s.caseSensitive === !0,
369
- childrenIndex: l,
370
- route: s
371
- };
372
- u.relativePath.startsWith("/") && (O(u.relativePath.startsWith(a), '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."), u.relativePath = u.relativePath.slice(a.length));
373
- let v = He([a, u.relativePath]), b = r.concat(u);
374
- s.children && s.children.length > 0 && (O(
375
- // Our types know better, but runtime JS may not!
376
- // @ts-expect-error
377
- s.index !== !0,
378
- "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + v + '".')
379
- ), Qt(s.children, t, b, v)), !(s.path == null && !s.index) && t.push({
380
- path: v,
381
- score: ta(v, s.index),
382
- routesMeta: b
383
- });
384
- };
385
- return e.forEach((s, l) => {
386
- var f;
387
- if (s.path === "" || !((f = s.path) != null && f.includes("?")))
388
- n(s, l);
389
- else
390
- for (let u of Zt(s.path))
391
- n(s, l, u);
392
- }), t;
393
- }
394
- function Zt(e) {
395
- let t = e.split("/");
396
- if (t.length === 0) return [];
397
- let [r, ...a] = t, n = r.endsWith("?"), s = r.replace(/\?$/, "");
398
- if (a.length === 0)
399
- return n ? [s, ""] : [s];
400
- let l = Zt(a.join("/")), f = [];
401
- return f.push(...l.map((u) => u === "" ? s : [s, u].join("/"))), n && f.push(...l), f.map((u) => e.startsWith("/") && u === "" ? "/" : u);
402
- }
403
- function Jr(e) {
404
- e.sort((t, r) => t.score !== r.score ? r.score - t.score : ra(t.routesMeta.map((a) => a.childrenIndex), r.routesMeta.map((a) => a.childrenIndex)));
405
- }
406
- const Gr = /^:[\w-]+$/, Xr = 3, Qr = 2, Zr = 1, qr = 10, ea = -2, At = (e) => e === "*";
407
- function ta(e, t) {
408
- let r = e.split("/"), a = r.length;
409
- return r.some(At) && (a += ea), t && (a += Qr), r.filter((n) => !At(n)).reduce((n, s) => n + (Gr.test(s) ? Xr : s === "" ? Zr : qr), a);
410
- }
411
- function ra(e, t) {
412
- return e.length === t.length && e.slice(0, -1).every((a, n) => a === t[n]) ? (
413
- // If two routes are siblings, we should try to match the earlier sibling
414
- // first. This allows people to have fine-grained control over the matching
415
- // behavior by simply putting routes with identical paths in the order they
416
- // want them tried.
417
- e[e.length - 1] - t[t.length - 1]
418
- ) : (
419
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
420
- // so they sort equally.
421
- 0
422
- );
423
- }
424
- function aa(e, t, r) {
425
- r === void 0 && (r = !1);
426
- let {
427
- routesMeta: a
428
- } = e, n = {}, s = "/", l = [];
429
- for (let f = 0; f < a.length; ++f) {
430
- let u = a[f], v = f === a.length - 1, b = s === "/" ? t : t.slice(s.length) || "/", p = ht({
431
- path: u.relativePath,
432
- caseSensitive: u.caseSensitive,
433
- end: v
434
- }, b), R = u.route;
435
- if (!p && v && r && !a[a.length - 1].route.index && (p = ht({
436
- path: u.relativePath,
437
- caseSensitive: u.caseSensitive,
438
- end: !1
439
- }, b)), !p)
440
- return null;
441
- Object.assign(n, p.params), l.push({
442
- // TODO: Can this as be avoided?
443
- params: n,
444
- pathname: He([s, p.pathname]),
445
- pathnameBase: nr(He([s, p.pathnameBase])),
446
- route: R
447
- }), p.pathnameBase !== "/" && (s = He([s, p.pathnameBase]));
448
- }
449
- return l;
450
- }
451
- function na(e, t) {
452
- t === void 0 && (t = {});
453
- let r = e;
454
- r.endsWith("*") && r !== "*" && !r.endsWith("/*") && (de(!1, 'Route path "' + r + '" will be treated as if it were ' + ('"' + r.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + r.replace(/\*$/, "/*") + '".')), r = r.replace(/\*$/, "/*"));
455
- const a = r.startsWith("/") ? "/" : "", n = (l) => l == null ? "" : typeof l == "string" ? l : String(l), s = r.split(/\/+/).map((l, f, u) => {
456
- if (f === u.length - 1 && l === "*")
457
- return n(t["*"]);
458
- const b = l.match(/^:([\w-]+)(\??)$/);
459
- if (b) {
460
- const [, p, R] = b;
461
- let m = t[p];
462
- return O(R === "?" || m != null, 'Missing ":' + p + '" param'), n(m);
463
- }
464
- return l.replace(/\?$/g, "");
465
- }).filter((l) => !!l);
466
- return a + s.join("/");
467
- }
468
- function ht(e, t) {
469
- typeof e == "string" && (e = {
470
- path: e,
471
- caseSensitive: !1,
472
- end: !0
473
- });
474
- let [r, a] = ia(e.path, e.caseSensitive, e.end), n = t.match(r);
475
- if (!n) return null;
476
- let s = n[0], l = s.replace(/(.)\/+$/, "$1"), f = n.slice(1);
477
- return {
478
- params: a.reduce((v, b, p) => {
479
- let {
480
- paramName: R,
481
- isOptional: m
482
- } = b;
483
- if (R === "*") {
484
- let g = f[p] || "";
485
- l = s.slice(0, s.length - g.length).replace(/(.)\/+$/, "$1");
486
- }
487
- const y = f[p];
488
- return m && !y ? v[R] = void 0 : v[R] = (y || "").replace(/%2F/g, "/"), v;
489
- }, {}),
490
- pathname: s,
491
- pathnameBase: l,
492
- pattern: e
493
- };
494
- }
495
- function ia(e, t, r) {
496
- t === void 0 && (t = !1), r === void 0 && (r = !0), de(e === "*" || !e.endsWith("*") || e.endsWith("/*"), '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(/\*$/, "/*") + '".'));
497
- let a = [], n = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (l, f, u) => (a.push({
498
- paramName: f,
499
- isOptional: u != null
500
- }), u ? "/?([^\\/]+)?" : "/([^\\/]+)"));
501
- return e.endsWith("*") ? (a.push({
502
- paramName: "*"
503
- }), n += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? n += "\\/*$" : e !== "" && e !== "/" && (n += "(?:(?=\\/|$))"), [new RegExp(n, t ? void 0 : "i"), a];
504
- }
505
- function qt(e) {
506
- try {
507
- return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
508
- } catch (t) {
509
- return de(!1, 'The URL path "' + e + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + t + ").")), e;
510
- }
511
- }
512
- function Ye(e, t) {
513
- if (t === "/") return e;
514
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
515
- return null;
516
- let r = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(r);
517
- return a && a !== "/" ? null : e.slice(r) || "/";
518
- }
519
- function er(e, t) {
520
- t === void 0 && (t = "/");
521
- let {
522
- pathname: r,
523
- search: a = "",
524
- hash: n = ""
525
- } = typeof e == "string" ? oe(e) : e;
526
- return {
527
- pathname: r ? r.startsWith("/") ? r : oa(r, t) : t,
528
- search: sa(a),
529
- hash: da(n)
530
- };
531
- }
532
- function oa(e, t) {
533
- let r = t.replace(/\/+$/, "").split("/");
534
- return e.split("/").forEach((n) => {
535
- n === ".." ? r.length > 1 && r.pop() : n !== "." && r.push(n);
536
- }), r.length > 1 ? r.join("/") : "/";
537
- }
538
- function ft(e, t, r, a) {
539
- return "Cannot include a '" + e + "' character in a manually specified " + ("`to." + t + "` field [" + JSON.stringify(a) + "]. 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 tr(e) {
542
- return e.filter((t, r) => r === 0 || t.route.path && t.route.path.length > 0);
543
- }
544
- function rr(e, t) {
545
- let r = tr(e);
546
- return t ? r.map((a, n) => n === r.length - 1 ? a.pathname : a.pathnameBase) : r.map((a) => a.pathnameBase);
547
- }
548
- function ar(e, t, r, a) {
549
- a === void 0 && (a = !1);
550
- let n;
551
- typeof e == "string" ? n = oe(e) : (n = I({}, e), O(!n.pathname || !n.pathname.includes("?"), ft("?", "pathname", "search", n)), O(!n.pathname || !n.pathname.includes("#"), ft("#", "pathname", "hash", n)), O(!n.search || !n.search.includes("#"), ft("#", "search", "hash", n)));
552
- let s = e === "" || n.pathname === "", l = s ? "/" : n.pathname, f;
553
- if (l == null)
554
- f = r;
555
- else {
556
- let p = t.length - 1;
557
- if (!a && l.startsWith("..")) {
558
- let R = l.split("/");
559
- for (; R[0] === ".."; )
560
- R.shift(), p -= 1;
561
- n.pathname = R.join("/");
562
- }
563
- f = p >= 0 ? t[p] : "/";
564
- }
565
- let u = er(n, f), v = l && l !== "/" && l.endsWith("/"), b = (s || l === ".") && r.endsWith("/");
566
- return !u.pathname.endsWith("/") && (v || b) && (u.pathname += "/"), u;
567
- }
568
- function la(e) {
569
- return e === "" || e.pathname === "" ? "/" : typeof e == "string" ? oe(e).pathname : e.pathname;
570
- }
571
- const He = (e) => e.join("/").replace(/\/\/+/g, "/"), nr = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), sa = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, da = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, ua = function(t, r) {
572
- r === void 0 && (r = {});
573
- let a = typeof r == "number" ? {
574
- status: r
575
- } : r, n = new Headers(a.headers);
576
- return n.has("Content-Type") || n.set("Content-Type", "application/json; charset=utf-8"), new Response(JSON.stringify(t), I({}, a, {
577
- headers: n
578
- }));
579
- };
580
- class pt extends Error {
581
- }
582
- class ir {
583
- constructor(t, r) {
584
- this.pendingKeysSet = /* @__PURE__ */ new Set(), this.subscribers = /* @__PURE__ */ new Set(), this.deferredKeys = [], O(t && typeof t == "object" && !Array.isArray(t), "defer() only accepts plain objects");
585
- let a;
586
- this.abortPromise = new Promise((s, l) => a = l), this.controller = new AbortController();
587
- let n = () => a(new pt("Deferred data aborted"));
588
- this.unlistenAbortSignal = () => this.controller.signal.removeEventListener("abort", n), this.controller.signal.addEventListener("abort", n), this.data = Object.entries(t).reduce((s, l) => {
589
- let [f, u] = l;
590
- return Object.assign(s, {
591
- [f]: this.trackPromise(f, u)
592
- });
593
- }, {}), this.done && this.unlistenAbortSignal(), this.init = r;
594
- }
595
- trackPromise(t, r) {
596
- if (!(r instanceof Promise))
597
- return r;
598
- this.deferredKeys.push(t), this.pendingKeysSet.add(t);
599
- let a = Promise.race([r, this.abortPromise]).then((n) => this.onSettle(a, t, void 0, n), (n) => this.onSettle(a, t, n));
600
- return a.catch(() => {
601
- }), Object.defineProperty(a, "_tracked", {
602
- get: () => !0
603
- }), a;
604
- }
605
- onSettle(t, r, a, n) {
606
- if (this.controller.signal.aborted && a instanceof pt)
607
- return this.unlistenAbortSignal(), Object.defineProperty(t, "_error", {
608
- get: () => a
609
- }), Promise.reject(a);
610
- if (this.pendingKeysSet.delete(r), this.done && this.unlistenAbortSignal(), a === void 0 && n === void 0) {
611
- let s = new Error('Deferred data for key "' + r + '" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');
612
- return Object.defineProperty(t, "_error", {
613
- get: () => s
614
- }), this.emit(!1, r), Promise.reject(s);
615
- }
616
- return n === void 0 ? (Object.defineProperty(t, "_error", {
617
- get: () => a
618
- }), this.emit(!1, r), Promise.reject(a)) : (Object.defineProperty(t, "_data", {
619
- get: () => n
620
- }), this.emit(!1, r), n);
621
- }
622
- emit(t, r) {
623
- this.subscribers.forEach((a) => a(t, r));
624
- }
625
- subscribe(t) {
626
- return this.subscribers.add(t), () => this.subscribers.delete(t);
627
- }
628
- cancel() {
629
- this.controller.abort(), this.pendingKeysSet.forEach((t, r) => this.pendingKeysSet.delete(r)), this.emit(!0);
630
- }
631
- async resolveData(t) {
632
- let r = !1;
633
- if (!this.done) {
634
- let a = () => this.cancel();
635
- t.addEventListener("abort", a), r = await new Promise((n) => {
636
- this.subscribe((s) => {
637
- t.removeEventListener("abort", a), (s || this.done) && n(s);
638
- });
639
- });
640
- }
641
- return r;
642
- }
643
- get done() {
644
- return this.pendingKeysSet.size === 0;
645
- }
646
- get unwrappedData() {
647
- return O(this.data !== null && this.done, "Can only unwrap data on initialized and settled deferreds"), Object.entries(this.data).reduce((t, r) => {
648
- let [a, n] = r;
649
- return Object.assign(t, {
650
- [a]: ca(n)
651
- });
652
- }, {});
653
- }
654
- get pendingKeys() {
655
- return Array.from(this.pendingKeysSet);
656
- }
657
- }
658
- function fa(e) {
659
- return e instanceof Promise && e._tracked === !0;
660
- }
661
- function ca(e) {
662
- if (!fa(e))
663
- return e;
664
- if (e._error)
665
- throw e._error;
666
- return e._data;
667
- }
668
- const ha = function(t, r) {
669
- r === void 0 && (r = {});
670
- let a = typeof r == "number" ? {
671
- status: r
672
- } : r;
673
- return new ir(t, a);
674
- }, or = function(t, r) {
675
- r === void 0 && (r = 302);
676
- let a = r;
677
- typeof a == "number" ? a = {
678
- status: a
679
- } : typeof a.status > "u" && (a.status = 302);
680
- let n = new Headers(a.headers);
681
- return n.set("Location", t), new Response(null, I({}, a, {
682
- headers: n
683
- }));
684
- }, pa = (e, t) => {
685
- let r = or(e, t);
686
- return r.headers.set("X-Remix-Reload-Document", "true"), r;
687
- };
688
- class vt {
689
- constructor(t, r, a, n) {
690
- n === void 0 && (n = !1), this.status = t, this.statusText = r || "", this.internal = n, a instanceof Error ? (this.data = a.toString(), this.error = a) : this.data = a;
691
- }
692
- }
693
- function ze(e) {
694
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
695
- }
696
- const lr = ["post", "put", "patch", "delete"], ma = new Set(lr), ga = ["get", ...lr], ya = new Set(ga), va = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]), wa = /* @__PURE__ */ new Set([307, 308]), nt = {
697
- state: "idle",
698
- location: void 0,
699
- formMethod: void 0,
700
- formAction: void 0,
701
- formEncType: void 0,
702
- formData: void 0,
703
- json: void 0,
704
- text: void 0
705
- }, sr = {
706
- state: "idle",
707
- data: void 0,
708
- formMethod: void 0,
709
- formAction: void 0,
710
- formEncType: void 0,
711
- formData: void 0,
712
- json: void 0,
713
- text: void 0
714
- }, Ne = {
715
- state: "unblocked",
716
- proceed: void 0,
717
- reset: void 0,
718
- location: void 0
719
- }, wt = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, dr = (e) => ({
720
- hasErrorBoundary: !!e.hasErrorBoundary
721
- }), ur = "remix-router-transitions";
722
- function ba(e) {
723
- 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", a = !r;
724
- O(e.routes.length > 0, "You must provide a non-empty routes array to createRouter");
725
- let n;
726
- if (e.mapRouteProperties)
727
- n = e.mapRouteProperties;
728
- else if (e.detectErrorBoundary) {
729
- let i = e.detectErrorBoundary;
730
- n = (o) => ({
731
- hasErrorBoundary: i(o)
732
- });
733
- } else
734
- n = dr;
735
- let s = {}, l = je(e.routes, n, void 0, s), f, u = e.basename || "/", v = e.unstable_dataStrategy || mr, b = e.unstable_patchRoutesOnMiss, p = I({
736
- v7_fetcherPersist: !1,
737
- v7_normalizeFormMethod: !1,
738
- v7_partialHydration: !1,
739
- v7_prependBasename: !1,
740
- v7_relativeSplatPath: !1,
741
- v7_skipActionErrorRevalidation: !1
742
- }, e.future), R = null, m = /* @__PURE__ */ new Set(), y = null, g = null, P = null, A = e.hydrationData != null, x = me(l, e.history.location, u), U = null;
743
- if (x == null && !b) {
744
- let i = Y(404, {
745
- pathname: e.history.location.pathname
746
- }), {
747
- matches: o,
748
- route: d
749
- } = it(l);
750
- x = o, U = {
751
- [d.id]: i
752
- };
753
- }
754
- x && b && !e.hydrationData && ut(x, l, e.history.location.pathname).active && (x = null);
755
- let S;
756
- if (!x)
757
- S = !1, x = [];
758
- else if (x.some((i) => i.route.lazy))
759
- S = !1;
760
- else if (!x.some((i) => i.route.loader))
761
- S = !0;
762
- else if (p.v7_partialHydration) {
763
- let i = e.hydrationData ? e.hydrationData.loaderData : null, o = e.hydrationData ? e.hydrationData.errors : null, d = (h) => h.route.loader ? typeof h.route.loader == "function" && h.route.loader.hydrate === !0 ? !1 : i && i[h.route.id] !== void 0 || o && o[h.route.id] !== void 0 : !0;
764
- if (o) {
765
- let h = x.findIndex((D) => o[D.route.id] !== void 0);
766
- S = x.slice(0, h + 1).every(d);
767
- } else
768
- S = x.every(d);
769
- } else
770
- S = e.hydrationData != null;
771
- let N, c = {
772
- historyAction: e.history.action,
773
- location: e.history.location,
774
- matches: x,
775
- initialized: S,
776
- navigation: nt,
777
- // Don't restore on initial updateState() if we were SSR'd
778
- restoreScrollPosition: e.hydrationData != null ? !1 : null,
779
- preventScrollReset: !1,
780
- revalidation: "idle",
781
- loaderData: e.hydrationData && e.hydrationData.loaderData || {},
782
- actionData: e.hydrationData && e.hydrationData.actionData || null,
783
- errors: e.hydrationData && e.hydrationData.errors || U,
784
- fetchers: /* @__PURE__ */ new Map(),
785
- blockers: /* @__PURE__ */ new Map()
786
- }, C = V.Pop, J = !1, F, X = !1, K = /* @__PURE__ */ new Map(), ne = null, le = !1, te = !1, Ce = [], Je = [], Q = /* @__PURE__ */ new Map(), Ge = 0, Be = -1, Te = /* @__PURE__ */ new Map(), fe = /* @__PURE__ */ new Set(), Fe = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Set(), Ee = /* @__PURE__ */ new Map(), Pe = /* @__PURE__ */ new Map(), Er = /* @__PURE__ */ new Map(), ot = !1;
787
- function Pr() {
788
- if (R = e.history.listen((i) => {
789
- let {
790
- action: o,
791
- location: d,
792
- delta: h
793
- } = i;
794
- if (ot) {
795
- ot = !1;
796
- return;
797
- }
798
- de(Pe.size === 0 || h != null, "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.");
799
- let D = jt({
800
- currentLocation: c.location,
801
- nextLocation: d,
802
- historyAction: o
803
- });
804
- if (D && h != null) {
805
- ot = !0, e.history.go(h * -1), Qe(D, {
806
- state: "blocked",
807
- location: d,
808
- proceed() {
809
- Qe(D, {
810
- state: "proceeding",
811
- proceed: void 0,
812
- reset: void 0,
813
- location: d
814
- }), e.history.go(h);
815
- },
816
- reset() {
817
- let E = new Map(c.blockers);
818
- E.set(D, Ne), re({
819
- blockers: E
820
- });
821
- }
822
- });
823
- return;
824
- }
825
- return xe(o, d);
826
- }), r) {
827
- _a(t, K);
828
- let i = () => Ua(t, K);
829
- t.addEventListener("pagehide", i), ne = () => t.removeEventListener("pagehide", i);
830
- }
831
- return c.initialized || xe(V.Pop, c.location, {
832
- initialHydration: !0
833
- }), N;
834
- }
835
- function xr() {
836
- R && R(), ne && ne(), m.clear(), F && F.abort(), c.fetchers.forEach((i, o) => Xe(o)), c.blockers.forEach((i, o) => Mt(o));
837
- }
838
- function Lr(i) {
839
- return m.add(i), () => m.delete(i);
840
- }
841
- function re(i, o) {
842
- o === void 0 && (o = {}), c = I({}, c, i);
843
- let d = [], h = [];
844
- p.v7_fetcherPersist && c.fetchers.forEach((D, E) => {
845
- D.state === "idle" && (ce.has(E) ? h.push(E) : d.push(E));
846
- }), [...m].forEach((D) => D(c, {
847
- deletedFetchers: h,
848
- unstable_viewTransitionOpts: o.viewTransitionOpts,
849
- unstable_flushSync: o.flushSync === !0
850
- })), p.v7_fetcherPersist && (d.forEach((D) => c.fetchers.delete(D)), h.forEach((D) => Xe(D)));
851
- }
852
- function _e(i, o, d) {
853
- var h, D;
854
- let {
855
- flushSync: E
856
- } = d === void 0 ? {} : d, j = c.actionData != null && c.navigation.formMethod != null && ie(c.navigation.formMethod) && c.navigation.state === "loading" && ((h = i.state) == null ? void 0 : h._isRedirect) !== !0, w;
857
- o.actionData ? Object.keys(o.actionData).length > 0 ? w = o.actionData : w = null : j ? w = c.actionData : w = null;
858
- let T = o.loaderData ? $t(c.loaderData, o.loaderData, o.matches || [], o.errors) : c.loaderData, L = c.blockers;
859
- L.size > 0 && (L = new Map(L), L.forEach((B, $) => L.set($, Ne)));
860
- let M = J === !0 || c.navigation.formMethod != null && ie(c.navigation.formMethod) && ((D = i.state) == null ? void 0 : D._isRedirect) !== !0;
861
- f && (l = f, f = void 0), le || C === V.Pop || (C === V.Push ? e.history.push(i, i.state) : C === V.Replace && e.history.replace(i, i.state));
862
- let W;
863
- if (C === V.Pop) {
864
- let B = K.get(c.location.pathname);
865
- B && B.has(i.pathname) ? W = {
866
- currentLocation: c.location,
867
- nextLocation: i
868
- } : K.has(i.pathname) && (W = {
869
- currentLocation: i,
870
- nextLocation: c.location
871
- });
872
- } else if (X) {
873
- let B = K.get(c.location.pathname);
874
- B ? B.add(i.pathname) : (B = /* @__PURE__ */ new Set([i.pathname]), K.set(c.location.pathname, B)), W = {
875
- currentLocation: c.location,
876
- nextLocation: i
877
- };
878
- }
879
- re(I({}, o, {
880
- actionData: w,
881
- loaderData: T,
882
- historyAction: C,
883
- location: i,
884
- initialized: !0,
885
- navigation: nt,
886
- revalidation: "idle",
887
- restoreScrollPosition: Tt(i, o.matches || c.matches),
888
- preventScrollReset: M,
889
- blockers: L
890
- }), {
891
- viewTransitionOpts: W,
892
- flushSync: E === !0
893
- }), C = V.Pop, J = !1, X = !1, le = !1, te = !1, Ce = [], Je = [];
894
- }
895
- async function Rt(i, o) {
896
- if (typeof i == "number") {
897
- e.history.go(i);
898
- return;
899
- }
900
- let d = mt(c.location, c.matches, u, p.v7_prependBasename, i, p.v7_relativeSplatPath, o == null ? void 0 : o.fromRouteId, o == null ? void 0 : o.relative), {
901
- path: h,
902
- submission: D,
903
- error: E
904
- } = It(p.v7_normalizeFormMethod, !1, d, o), j = c.location, w = ge(c.location, h, o && o.state);
905
- w = I({}, w, e.history.encodeLocation(w));
906
- let T = o && o.replace != null ? o.replace : void 0, L = V.Push;
907
- T === !0 ? L = V.Replace : T === !1 || D != null && ie(D.formMethod) && D.formAction === c.location.pathname + c.location.search && (L = V.Replace);
908
- let M = o && "preventScrollReset" in o ? o.preventScrollReset === !0 : void 0, W = (o && o.unstable_flushSync) === !0, B = jt({
909
- currentLocation: j,
910
- nextLocation: w,
911
- historyAction: L
912
- });
913
- if (B) {
914
- Qe(B, {
915
- state: "blocked",
916
- location: w,
917
- proceed() {
918
- Qe(B, {
919
- state: "proceeding",
920
- proceed: void 0,
921
- reset: void 0,
922
- location: w
923
- }), Rt(i, o);
924
- },
925
- reset() {
926
- let $ = new Map(c.blockers);
927
- $.set(B, Ne), re({
928
- blockers: $
929
- });
930
- }
931
- });
932
- return;
933
- }
934
- return await xe(L, w, {
935
- submission: D,
936
- // Send through the formData serialization error if we have one so we can
937
- // render at the right error boundary after we match routes
938
- pendingError: E,
939
- preventScrollReset: M,
940
- replace: o && o.replace,
941
- enableViewTransition: o && o.unstable_viewTransition,
942
- flushSync: W
943
- });
944
- }
945
- function Mr() {
946
- if (lt(), re({
947
- revalidation: "loading"
948
- }), c.navigation.state !== "submitting") {
949
- if (c.navigation.state === "idle") {
950
- xe(c.historyAction, c.location, {
951
- startUninterruptedRevalidation: !0
952
- });
953
- return;
954
- }
955
- xe(C || c.historyAction, c.navigation.location, {
956
- overrideNavigation: c.navigation
957
- });
958
- }
959
- }
960
- async function xe(i, o, d) {
961
- F && F.abort(), F = null, C = i, le = (d && d.startUninterruptedRevalidation) === !0, Nr(c.location, c.matches), J = (d && d.preventScrollReset) === !0, X = (d && d.enableViewTransition) === !0;
962
- let h = f || l, D = d && d.overrideNavigation, E = me(h, o, u), j = (d && d.flushSync) === !0, w = ut(E, h, o.pathname);
963
- if (w.active && w.matches && (E = w.matches), !E) {
964
- let {
965
- error: z,
966
- notFoundMatches: q,
967
- route: Z
968
- } = st(o.pathname);
969
- _e(o, {
970
- matches: q,
971
- loaderData: {},
972
- errors: {
973
- [Z.id]: z
974
- }
975
- }, {
976
- flushSync: j
977
- });
978
- return;
979
- }
980
- if (c.initialized && !te && La(c.location, o) && !(d && d.submission && ie(d.submission.formMethod))) {
981
- _e(o, {
982
- matches: E
983
- }, {
984
- flushSync: j
985
- });
986
- return;
987
- }
988
- F = new AbortController();
989
- let T = Ie(e.history, o, F.signal, d && d.submission), L;
990
- if (d && d.pendingError)
991
- L = [Le(E).route.id, {
992
- type: H.error,
993
- error: d.pendingError
994
- }];
995
- else if (d && d.submission && ie(d.submission.formMethod)) {
996
- let z = await jr(T, o, d.submission, E, w.active, {
997
- replace: d.replace,
998
- flushSync: j
999
- });
1000
- if (z.shortCircuited)
1001
- return;
1002
- if (z.pendingActionResult) {
1003
- let [q, Z] = z.pendingActionResult;
1004
- if (ee(Z) && ze(Z.error) && Z.error.status === 404) {
1005
- F = null, _e(o, {
1006
- matches: z.matches,
1007
- loaderData: {},
1008
- errors: {
1009
- [q]: Z.error
1010
- }
1011
- });
1012
- return;
1013
- }
1014
- }
1015
- E = z.matches || E, L = z.pendingActionResult, D = ct(o, d.submission), j = !1, w.active = !1, T = Ie(e.history, T.url, T.signal);
1016
- }
1017
- let {
1018
- shortCircuited: M,
1019
- matches: W,
1020
- loaderData: B,
1021
- errors: $
1022
- } = await Cr(T, o, E, w.active, D, d && d.submission, d && d.fetcherSubmission, d && d.replace, d && d.initialHydration === !0, j, L);
1023
- M || (F = null, _e(o, I({
1024
- matches: W || E
1025
- }, kt(L), {
1026
- loaderData: B,
1027
- errors: $
1028
- })));
1029
- }
1030
- async function jr(i, o, d, h, D, E) {
1031
- E === void 0 && (E = {}), lt();
1032
- let j = Ta(o, d);
1033
- if (re({
1034
- navigation: j
1035
- }, {
1036
- flushSync: E.flushSync === !0
1037
- }), D) {
1038
- let L = await qe(h, o.pathname, i.signal);
1039
- if (L.type === "aborted")
1040
- return {
1041
- shortCircuited: !0
1042
- };
1043
- if (L.type === "error") {
1044
- let {
1045
- boundaryId: M,
1046
- error: W
1047
- } = Ze(o.pathname, L);
1048
- return {
1049
- matches: L.partialMatches,
1050
- pendingActionResult: [M, {
1051
- type: H.error,
1052
- error: W
1053
- }]
1054
- };
1055
- } else if (L.matches)
1056
- h = L.matches;
1057
- else {
1058
- let {
1059
- notFoundMatches: M,
1060
- error: W,
1061
- route: B
1062
- } = st(o.pathname);
1063
- return {
1064
- matches: M,
1065
- pendingActionResult: [B.id, {
1066
- type: H.error,
1067
- error: W
1068
- }]
1069
- };
1070
- }
1071
- }
1072
- let w, T = Me(h, o);
1073
- if (!T.route.action && !T.route.lazy)
1074
- w = {
1075
- type: H.error,
1076
- error: Y(405, {
1077
- method: i.method,
1078
- pathname: o.pathname,
1079
- routeId: T.route.id
1080
- })
1081
- };
1082
- else if (w = (await $e("action", i, [T], h))[0], i.signal.aborted)
1083
- return {
1084
- shortCircuited: !0
1085
- };
1086
- if (De(w)) {
1087
- let L;
1088
- return E && E.replace != null ? L = E.replace : L = Bt(w.response.headers.get("Location"), new URL(i.url), u) === c.location.pathname + c.location.search, await Ke(i, w, {
1089
- submission: d,
1090
- replace: L
1091
- }), {
1092
- shortCircuited: !0
1093
- };
1094
- }
1095
- if (Se(w))
1096
- throw Y(400, {
1097
- type: "defer-action"
1098
- });
1099
- if (ee(w)) {
1100
- let L = Le(h, T.route.id);
1101
- return (E && E.replace) !== !0 && (C = V.Push), {
1102
- matches: h,
1103
- pendingActionResult: [L.route.id, w]
1104
- };
1105
- }
1106
- return {
1107
- matches: h,
1108
- pendingActionResult: [T.route.id, w]
1109
- };
1110
- }
1111
- async function Cr(i, o, d, h, D, E, j, w, T, L, M) {
1112
- let W = D || ct(o, E), B = E || j || Jt(W), $ = !le && (!p.v7_partialHydration || !T);
1113
- if (h) {
1114
- if ($) {
1115
- let G = St(M);
1116
- re(I({
1117
- navigation: W
1118
- }, G !== void 0 ? {
1119
- actionData: G
1120
- } : {}), {
1121
- flushSync: L
1122
- });
1123
- }
1124
- let _ = await qe(d, o.pathname, i.signal);
1125
- if (_.type === "aborted")
1126
- return {
1127
- shortCircuited: !0
1128
- };
1129
- if (_.type === "error") {
1130
- let {
1131
- boundaryId: G,
1132
- error: ae
1133
- } = Ze(o.pathname, _);
1134
- return {
1135
- matches: _.partialMatches,
1136
- loaderData: {},
1137
- errors: {
1138
- [G]: ae
1139
- }
1140
- };
1141
- } else if (_.matches)
1142
- d = _.matches;
1143
- else {
1144
- let {
1145
- error: G,
1146
- notFoundMatches: ae,
1147
- route: k
1148
- } = st(o.pathname);
1149
- return {
1150
- matches: ae,
1151
- loaderData: {},
1152
- errors: {
1153
- [k.id]: G
1154
- }
1155
- };
1156
- }
1157
- }
1158
- let z = f || l, [q, Z] = Nt(e.history, c, d, B, o, p.v7_partialHydration && T === !0, p.v7_skipActionErrorRevalidation, te, Ce, Je, ce, Fe, fe, z, u, M);
1159
- if (dt((_) => !(d && d.some((G) => G.route.id === _)) || q && q.some((G) => G.route.id === _)), Be = ++Ge, q.length === 0 && Z.length === 0) {
1160
- let _ = xt();
1161
- return _e(o, I({
1162
- matches: d,
1163
- loaderData: {},
1164
- // Commit pending error if we're short circuiting
1165
- errors: M && ee(M[1]) ? {
1166
- [M[0]]: M[1].error
1167
- } : null
1168
- }, kt(M), _ ? {
1169
- fetchers: new Map(c.fetchers)
1170
- } : {}), {
1171
- flushSync: L
1172
- }), {
1173
- shortCircuited: !0
1174
- };
1175
- }
1176
- if ($) {
1177
- let _ = {};
1178
- if (!h) {
1179
- _.navigation = W;
1180
- let G = St(M);
1181
- G !== void 0 && (_.actionData = G);
1182
- }
1183
- Z.length > 0 && (_.fetchers = Tr(Z)), re(_, {
1184
- flushSync: L
1185
- });
1186
- }
1187
- Z.forEach((_) => {
1188
- Q.has(_.key) && ve(_.key), _.controller && Q.set(_.key, _.controller);
1189
- });
1190
- let ke = () => Z.forEach((_) => ve(_.key));
1191
- F && F.signal.addEventListener("abort", ke);
1192
- let {
1193
- loaderResults: we,
1194
- fetcherResults: Ue
1195
- } = await Dt(c.matches, d, q, Z, i);
1196
- if (i.signal.aborted)
1197
- return {
1198
- shortCircuited: !0
1199
- };
1200
- F && F.signal.removeEventListener("abort", ke), Z.forEach((_) => Q.delete(_.key));
1201
- let Ae = Vt([...we, ...Ue]);
1202
- if (Ae) {
1203
- if (Ae.idx >= q.length) {
1204
- let _ = Z[Ae.idx - q.length].key;
1205
- fe.add(_);
1206
- }
1207
- return await Ke(i, Ae.result, {
1208
- replace: w
1209
- }), {
1210
- shortCircuited: !0
1211
- };
1212
- }
1213
- let {
1214
- loaderData: Oe,
1215
- errors: se
1216
- } = Kt(c, d, q, we, M, Z, Ue, Ee);
1217
- Ee.forEach((_, G) => {
1218
- _.subscribe((ae) => {
1219
- (ae || _.done) && Ee.delete(G);
1220
- });
1221
- }), p.v7_partialHydration && T && c.errors && Object.entries(c.errors).filter((_) => {
1222
- let [G] = _;
1223
- return !q.some((ae) => ae.route.id === G);
1224
- }).forEach((_) => {
1225
- let [G, ae] = _;
1226
- se = Object.assign(se || {}, {
1227
- [G]: ae
1228
- });
1229
- });
1230
- let et = xt(), tt = Lt(Be), rt = et || tt || Z.length > 0;
1231
- return I({
1232
- matches: d,
1233
- loaderData: Oe,
1234
- errors: se
1235
- }, rt ? {
1236
- fetchers: new Map(c.fetchers)
1237
- } : {});
1238
- }
1239
- function St(i) {
1240
- if (i && !ee(i[1]))
1241
- return {
1242
- [i[0]]: i[1].data
1243
- };
1244
- if (c.actionData)
1245
- return Object.keys(c.actionData).length === 0 ? null : c.actionData;
1246
- }
1247
- function Tr(i) {
1248
- return i.forEach((o) => {
1249
- let d = c.fetchers.get(o.key), h = Ve(void 0, d ? d.data : void 0);
1250
- c.fetchers.set(o.key, h);
1251
- }), new Map(c.fetchers);
1252
- }
1253
- function Fr(i, o, d, h) {
1254
- if (a)
1255
- throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");
1256
- Q.has(i) && ve(i);
1257
- let D = (h && h.unstable_flushSync) === !0, E = f || l, j = mt(c.location, c.matches, u, p.v7_prependBasename, d, p.v7_relativeSplatPath, o, h == null ? void 0 : h.relative), w = me(E, j, u), T = ut(w, E, j);
1258
- if (T.active && T.matches && (w = T.matches), !w) {
1259
- he(i, o, Y(404, {
1260
- pathname: j
1261
- }), {
1262
- flushSync: D
1263
- });
1264
- return;
1265
- }
1266
- let {
1267
- path: L,
1268
- submission: M,
1269
- error: W
1270
- } = It(p.v7_normalizeFormMethod, !0, j, h);
1271
- if (W) {
1272
- he(i, o, W, {
1273
- flushSync: D
1274
- });
1275
- return;
1276
- }
1277
- let B = Me(w, L);
1278
- if (J = (h && h.preventScrollReset) === !0, M && ie(M.formMethod)) {
1279
- _r(i, o, L, B, w, T.active, D, M);
1280
- return;
1281
- }
1282
- Fe.set(i, {
1283
- routeId: o,
1284
- path: L
1285
- }), Ur(i, o, L, B, w, T.active, D, M);
1286
- }
1287
- async function _r(i, o, d, h, D, E, j, w) {
1288
- lt(), Fe.delete(i);
1289
- function T(k) {
1290
- if (!k.route.action && !k.route.lazy) {
1291
- let pe = Y(405, {
1292
- method: w.formMethod,
1293
- pathname: d,
1294
- routeId: o
1295
- });
1296
- return he(i, o, pe, {
1297
- flushSync: j
1298
- }), !0;
1299
- }
1300
- return !1;
1301
- }
1302
- if (!E && T(h))
1303
- return;
1304
- let L = c.fetchers.get(i);
1305
- ye(i, Fa(w, L), {
1306
- flushSync: j
1307
- });
1308
- let M = new AbortController(), W = Ie(e.history, d, M.signal, w);
1309
- if (E) {
1310
- let k = await qe(D, d, W.signal);
1311
- if (k.type === "aborted")
1312
- return;
1313
- if (k.type === "error") {
1314
- let {
1315
- error: pe
1316
- } = Ze(d, k);
1317
- he(i, o, pe, {
1318
- flushSync: j
1319
- });
1320
- return;
1321
- } else if (k.matches) {
1322
- if (D = k.matches, h = Me(D, d), T(h))
1323
- return;
1324
- } else {
1325
- he(i, o, Y(404, {
1326
- pathname: d
1327
- }), {
1328
- flushSync: j
1329
- });
1330
- return;
1331
- }
1332
- }
1333
- Q.set(i, M);
1334
- let B = Ge, z = (await $e("action", W, [h], D))[0];
1335
- if (W.signal.aborted) {
1336
- Q.get(i) === M && Q.delete(i);
1337
- return;
1338
- }
1339
- if (p.v7_fetcherPersist && ce.has(i)) {
1340
- if (De(z) || ee(z)) {
1341
- ye(i, be(void 0));
1342
- return;
1343
- }
1344
- } else {
1345
- if (De(z))
1346
- if (Q.delete(i), Be > B) {
1347
- ye(i, be(void 0));
1348
- return;
1349
- } else
1350
- return fe.add(i), ye(i, Ve(w)), Ke(W, z, {
1351
- fetcherSubmission: w
1352
- });
1353
- if (ee(z)) {
1354
- he(i, o, z.error);
1355
- return;
1356
- }
1357
- }
1358
- if (Se(z))
1359
- throw Y(400, {
1360
- type: "defer-action"
1361
- });
1362
- let q = c.navigation.location || c.location, Z = Ie(e.history, q, M.signal), ke = f || l, we = c.navigation.state !== "idle" ? me(ke, c.navigation.location, u) : c.matches;
1363
- O(we, "Didn't find any matches after fetcher action");
1364
- let Ue = ++Ge;
1365
- Te.set(i, Ue);
1366
- let Ae = Ve(w, z.data);
1367
- c.fetchers.set(i, Ae);
1368
- let [Oe, se] = Nt(e.history, c, we, w, q, !1, p.v7_skipActionErrorRevalidation, te, Ce, Je, ce, Fe, fe, ke, u, [h.route.id, z]);
1369
- se.filter((k) => k.key !== i).forEach((k) => {
1370
- let pe = k.key, Ft = c.fetchers.get(pe), Br = Ve(void 0, Ft ? Ft.data : void 0);
1371
- c.fetchers.set(pe, Br), Q.has(pe) && ve(pe), k.controller && Q.set(pe, k.controller);
1372
- }), re({
1373
- fetchers: new Map(c.fetchers)
1374
- });
1375
- let et = () => se.forEach((k) => ve(k.key));
1376
- M.signal.addEventListener("abort", et);
1377
- let {
1378
- loaderResults: tt,
1379
- fetcherResults: rt
1380
- } = await Dt(c.matches, we, Oe, se, Z);
1381
- if (M.signal.aborted)
1382
- return;
1383
- M.signal.removeEventListener("abort", et), Te.delete(i), Q.delete(i), se.forEach((k) => Q.delete(k.key));
1384
- let _ = Vt([...tt, ...rt]);
1385
- if (_) {
1386
- if (_.idx >= Oe.length) {
1387
- let k = se[_.idx - Oe.length].key;
1388
- fe.add(k);
1389
- }
1390
- return Ke(Z, _.result);
1391
- }
1392
- let {
1393
- loaderData: G,
1394
- errors: ae
1395
- } = Kt(c, c.matches, Oe, tt, void 0, se, rt, Ee);
1396
- if (c.fetchers.has(i)) {
1397
- let k = be(z.data);
1398
- c.fetchers.set(i, k);
1399
- }
1400
- Lt(Ue), c.navigation.state === "loading" && Ue > Be ? (O(C, "Expected pending action"), F && F.abort(), _e(c.navigation.location, {
1401
- matches: we,
1402
- loaderData: G,
1403
- errors: ae,
1404
- fetchers: new Map(c.fetchers)
1405
- })) : (re({
1406
- errors: ae,
1407
- loaderData: $t(c.loaderData, G, we, ae),
1408
- fetchers: new Map(c.fetchers)
1409
- }), te = !1);
1410
- }
1411
- async function Ur(i, o, d, h, D, E, j, w) {
1412
- let T = c.fetchers.get(i);
1413
- ye(i, Ve(w, T ? T.data : void 0), {
1414
- flushSync: j
1415
- });
1416
- let L = new AbortController(), M = Ie(e.history, d, L.signal);
1417
- if (E) {
1418
- let z = await qe(D, d, M.signal);
1419
- if (z.type === "aborted")
1420
- return;
1421
- if (z.type === "error") {
1422
- let {
1423
- error: q
1424
- } = Ze(d, z);
1425
- he(i, o, q, {
1426
- flushSync: j
1427
- });
1428
- return;
1429
- } else if (z.matches)
1430
- D = z.matches, h = Me(D, d);
1431
- else {
1432
- he(i, o, Y(404, {
1433
- pathname: d
1434
- }), {
1435
- flushSync: j
1436
- });
1437
- return;
1438
- }
1439
- }
1440
- Q.set(i, L);
1441
- let W = Ge, $ = (await $e("loader", M, [h], D))[0];
1442
- if (Se($) && ($ = await Dr($, M.signal, !0) || $), Q.get(i) === L && Q.delete(i), !M.signal.aborted) {
1443
- if (ce.has(i)) {
1444
- ye(i, be(void 0));
1445
- return;
1446
- }
1447
- if (De($))
1448
- if (Be > W) {
1449
- ye(i, be(void 0));
1450
- return;
1451
- } else {
1452
- fe.add(i), await Ke(M, $);
1453
- return;
1454
- }
1455
- if (ee($)) {
1456
- he(i, o, $.error);
1457
- return;
1458
- }
1459
- O(!Se($), "Unhandled fetcher deferred data"), ye(i, be($.data));
1460
- }
1461
- }
1462
- async function Ke(i, o, d) {
1463
- let {
1464
- submission: h,
1465
- fetcherSubmission: D,
1466
- replace: E
1467
- } = d === void 0 ? {} : d;
1468
- o.response.headers.has("X-Remix-Revalidate") && (te = !0);
1469
- let j = o.response.headers.get("Location");
1470
- O(j, "Expected a Location header on the redirect Response"), j = Bt(j, new URL(i.url), u);
1471
- let w = ge(c.location, j, {
1472
- _isRedirect: !0
1473
- });
1474
- if (r) {
1475
- let $ = !1;
1476
- if (o.response.headers.has("X-Remix-Reload-Document"))
1477
- $ = !0;
1478
- else if (wt.test(j)) {
1479
- const z = e.history.createURL(j);
1480
- $ = // Hard reload if it's an absolute URL to a new origin
1481
- z.origin !== t.location.origin || // Hard reload if it's an absolute URL that does not match our basename
1482
- Ye(z.pathname, u) == null;
1483
- }
1484
- if ($) {
1485
- E ? t.location.replace(j) : t.location.assign(j);
1486
- return;
1487
- }
1488
- }
1489
- F = null;
1490
- let T = E === !0 ? V.Replace : V.Push, {
1491
- formMethod: L,
1492
- formAction: M,
1493
- formEncType: W
1494
- } = c.navigation;
1495
- !h && !D && L && M && W && (h = Jt(c.navigation));
1496
- let B = h || D;
1497
- if (wa.has(o.response.status) && B && ie(B.formMethod))
1498
- await xe(T, w, {
1499
- submission: I({}, B, {
1500
- formAction: j
1501
- }),
1502
- // Preserve this flag across redirects
1503
- preventScrollReset: J
1504
- });
1505
- else {
1506
- let $ = ct(w, h);
1507
- await xe(T, w, {
1508
- overrideNavigation: $,
1509
- // Send fetcher submissions through for shouldRevalidate
1510
- fetcherSubmission: D,
1511
- // Preserve this flag across redirects
1512
- preventScrollReset: J
1513
- });
1514
- }
1515
- }
1516
- async function $e(i, o, d, h) {
1517
- try {
1518
- let D = await gr(v, i, o, d, h, s, n);
1519
- return await Promise.all(D.map((E, j) => {
1520
- if (Rr(E)) {
1521
- let w = E.result;
1522
- return {
1523
- type: H.redirect,
1524
- response: vr(w, o, d[j].route.id, h, u, p.v7_relativeSplatPath)
1525
- };
1526
- }
1527
- return yr(E);
1528
- }));
1529
- } catch (D) {
1530
- return d.map(() => ({
1531
- type: H.error,
1532
- error: D
1533
- }));
1534
- }
1535
- }
1536
- async function Dt(i, o, d, h, D) {
1537
- let [E, ...j] = await Promise.all([d.length ? $e("loader", D, d, o) : [], ...h.map((w) => {
1538
- if (w.matches && w.match && w.controller) {
1539
- let T = Ie(e.history, w.path, w.controller.signal);
1540
- return $e("loader", T, [w.match], w.matches).then((L) => L[0]);
1541
- } else
1542
- return Promise.resolve({
1543
- type: H.error,
1544
- error: Y(404, {
1545
- pathname: w.path
1546
- })
1547
- });
1548
- })]);
1549
- return await Promise.all([Yt(i, d, E, E.map(() => D.signal), !1, c.loaderData), Yt(i, h.map((w) => w.match), j, h.map((w) => w.controller ? w.controller.signal : null), !0)]), {
1550
- loaderResults: E,
1551
- fetcherResults: j
1552
- };
1553
- }
1554
- function lt() {
1555
- te = !0, Ce.push(...dt()), Fe.forEach((i, o) => {
1556
- Q.has(o) && (Je.push(o), ve(o));
1557
- });
1558
- }
1559
- function ye(i, o, d) {
1560
- d === void 0 && (d = {}), c.fetchers.set(i, o), re({
1561
- fetchers: new Map(c.fetchers)
1562
- }, {
1563
- flushSync: (d && d.flushSync) === !0
1564
- });
1565
- }
1566
- function he(i, o, d, h) {
1567
- h === void 0 && (h = {});
1568
- let D = Le(c.matches, o);
1569
- Xe(i), re({
1570
- errors: {
1571
- [D.route.id]: d
1572
- },
1573
- fetchers: new Map(c.fetchers)
1574
- }, {
1575
- flushSync: (h && h.flushSync) === !0
1576
- });
1577
- }
1578
- function Et(i) {
1579
- return p.v7_fetcherPersist && (We.set(i, (We.get(i) || 0) + 1), ce.has(i) && ce.delete(i)), c.fetchers.get(i) || sr;
1580
- }
1581
- function Xe(i) {
1582
- let o = c.fetchers.get(i);
1583
- Q.has(i) && !(o && o.state === "loading" && Te.has(i)) && ve(i), Fe.delete(i), Te.delete(i), fe.delete(i), ce.delete(i), c.fetchers.delete(i);
1584
- }
1585
- function Ar(i) {
1586
- if (p.v7_fetcherPersist) {
1587
- let o = (We.get(i) || 0) - 1;
1588
- o <= 0 ? (We.delete(i), ce.add(i)) : We.set(i, o);
1589
- } else
1590
- Xe(i);
1591
- re({
1592
- fetchers: new Map(c.fetchers)
1593
- });
1594
- }
1595
- function ve(i) {
1596
- let o = Q.get(i);
1597
- O(o, "Expected fetch controller: " + i), o.abort(), Q.delete(i);
1598
- }
1599
- function Pt(i) {
1600
- for (let o of i) {
1601
- let d = Et(o), h = be(d.data);
1602
- c.fetchers.set(o, h);
1603
- }
1604
- }
1605
- function xt() {
1606
- let i = [], o = !1;
1607
- for (let d of fe) {
1608
- let h = c.fetchers.get(d);
1609
- O(h, "Expected fetcher: " + d), h.state === "loading" && (fe.delete(d), i.push(d), o = !0);
1610
- }
1611
- return Pt(i), o;
1612
- }
1613
- function Lt(i) {
1614
- let o = [];
1615
- for (let [d, h] of Te)
1616
- if (h < i) {
1617
- let D = c.fetchers.get(d);
1618
- O(D, "Expected fetcher: " + d), D.state === "loading" && (ve(d), Te.delete(d), o.push(d));
1619
- }
1620
- return Pt(o), o.length > 0;
1621
- }
1622
- function Or(i, o) {
1623
- let d = c.blockers.get(i) || Ne;
1624
- return Pe.get(i) !== o && Pe.set(i, o), d;
1625
- }
1626
- function Mt(i) {
1627
- c.blockers.delete(i), Pe.delete(i);
1628
- }
1629
- function Qe(i, o) {
1630
- let d = c.blockers.get(i) || Ne;
1631
- O(d.state === "unblocked" && o.state === "blocked" || d.state === "blocked" && o.state === "blocked" || d.state === "blocked" && o.state === "proceeding" || d.state === "blocked" && o.state === "unblocked" || d.state === "proceeding" && o.state === "unblocked", "Invalid blocker state transition: " + d.state + " -> " + o.state);
1632
- let h = new Map(c.blockers);
1633
- h.set(i, o), re({
1634
- blockers: h
1635
- });
1636
- }
1637
- function jt(i) {
1638
- let {
1639
- currentLocation: o,
1640
- nextLocation: d,
1641
- historyAction: h
1642
- } = i;
1643
- if (Pe.size === 0)
1644
- return;
1645
- Pe.size > 1 && de(!1, "A router only supports one blocker at a time");
1646
- let D = Array.from(Pe.entries()), [E, j] = D[D.length - 1], w = c.blockers.get(E);
1647
- if (!(w && w.state === "proceeding") && j({
1648
- currentLocation: o,
1649
- nextLocation: d,
1650
- historyAction: h
1651
- }))
1652
- return E;
1653
- }
1654
- function st(i) {
1655
- let o = Y(404, {
1656
- pathname: i
1657
- }), d = f || l, {
1658
- matches: h,
1659
- route: D
1660
- } = it(d);
1661
- return dt(), {
1662
- notFoundMatches: h,
1663
- route: D,
1664
- error: o
1665
- };
1666
- }
1667
- function Ze(i, o) {
1668
- return {
1669
- boundaryId: Le(o.partialMatches).route.id,
1670
- error: Y(400, {
1671
- type: "route-discovery",
1672
- pathname: i,
1673
- message: o.error != null && "message" in o.error ? o.error : String(o.error)
1674
- })
1675
- };
1676
- }
1677
- function dt(i) {
1678
- let o = [];
1679
- return Ee.forEach((d, h) => {
1680
- (!i || i(h)) && (d.cancel(), o.push(h), Ee.delete(h));
1681
- }), o;
1682
- }
1683
- function Ir(i, o, d) {
1684
- if (y = i, P = o, g = d || null, !A && c.navigation === nt) {
1685
- A = !0;
1686
- let h = Tt(c.location, c.matches);
1687
- h != null && re({
1688
- restoreScrollPosition: h
1689
- });
1690
- }
1691
- return () => {
1692
- y = null, P = null, g = null;
1693
- };
1694
- }
1695
- function Ct(i, o) {
1696
- return g && g(i, o.map((h) => Xt(h, c.loaderData))) || i.key;
1697
- }
1698
- function Nr(i, o) {
1699
- if (y && P) {
1700
- let d = Ct(i, o);
1701
- y[d] = P();
1702
- }
1703
- }
1704
- function Tt(i, o) {
1705
- if (y) {
1706
- let d = Ct(i, o), h = y[d];
1707
- if (typeof h == "number")
1708
- return h;
1709
- }
1710
- return null;
1711
- }
1712
- function ut(i, o, d) {
1713
- if (b)
1714
- if (i) {
1715
- let h = i[i.length - 1].route;
1716
- if (h.path && (h.path === "*" || h.path.endsWith("/*")))
1717
- return {
1718
- active: !0,
1719
- matches: at(o, d, u, !0)
1720
- };
1721
- } else
1722
- return {
1723
- active: !0,
1724
- matches: at(o, d, u, !0) || []
1725
- };
1726
- return {
1727
- active: !1,
1728
- matches: null
1729
- };
1730
- }
1731
- async function qe(i, o, d) {
1732
- let h = i, D = h.length > 0 ? h[h.length - 1].route : null;
1733
- for (; ; ) {
1734
- let E = f == null, j = f || l;
1735
- try {
1736
- await Pa(b, o, h, j, s, n, Er, d);
1737
- } catch (M) {
1738
- return {
1739
- type: "error",
1740
- error: M,
1741
- partialMatches: h
1742
- };
1743
- } finally {
1744
- E && (l = [...l]);
1745
- }
1746
- if (d.aborted)
1747
- return {
1748
- type: "aborted"
1749
- };
1750
- let w = me(j, o, u), T = !1;
1751
- if (w) {
1752
- let M = w[w.length - 1].route;
1753
- if (M.index)
1754
- return {
1755
- type: "success",
1756
- matches: w
1757
- };
1758
- if (M.path && M.path.length > 0)
1759
- if (M.path === "*")
1760
- T = !0;
1761
- else
1762
- return {
1763
- type: "success",
1764
- matches: w
1765
- };
1766
- }
1767
- let L = at(j, o, u, !0);
1768
- if (!L || h.map((M) => M.route.id).join("-") === L.map((M) => M.route.id).join("-"))
1769
- return {
1770
- type: "success",
1771
- matches: T ? w : null
1772
- };
1773
- if (h = L, D = h[h.length - 1].route, D.path === "*")
1774
- return {
1775
- type: "success",
1776
- matches: h
1777
- };
1778
- }
1779
- }
1780
- function Hr(i) {
1781
- s = {}, f = je(i, n, void 0, s);
1782
- }
1783
- function zr(i, o) {
1784
- let d = f == null;
1785
- pr(i, o, f || l, s, n), d && (l = [...l], re({}));
1786
- }
1787
- return N = {
1788
- get basename() {
1789
- return u;
1790
- },
1791
- get future() {
1792
- return p;
1793
- },
1794
- get state() {
1795
- return c;
1796
- },
1797
- get routes() {
1798
- return l;
1799
- },
1800
- get window() {
1801
- return t;
1802
- },
1803
- initialize: Pr,
1804
- subscribe: Lr,
1805
- enableScrollRestoration: Ir,
1806
- navigate: Rt,
1807
- fetch: Fr,
1808
- revalidate: Mr,
1809
- // Passthrough to history-aware createHref used by useHref so we get proper
1810
- // hash-aware URLs in DOM paths
1811
- createHref: (i) => e.history.createHref(i),
1812
- encodeLocation: (i) => e.history.encodeLocation(i),
1813
- getFetcher: Et,
1814
- deleteFetcher: Ar,
1815
- dispose: xr,
1816
- getBlocker: Or,
1817
- deleteBlocker: Mt,
1818
- patchRoutes: zr,
1819
- _internalFetchControllers: Q,
1820
- _internalActiveDeferreds: Ee,
1821
- // TODO: Remove setRoutes, it's temporary to avoid dealing with
1822
- // updating the tree while validating the update algorithm.
1823
- _internalSetRoutes: Hr
1824
- }, N;
1825
- }
1826
- const fr = Symbol("deferred");
1827
- function Ra(e, t) {
1828
- O(e.length > 0, "You must provide a non-empty routes array to createStaticHandler");
1829
- let r = {}, a = (t ? t.basename : null) || "/", n;
1830
- if (t != null && t.mapRouteProperties)
1831
- n = t.mapRouteProperties;
1832
- else if (t != null && t.detectErrorBoundary) {
1833
- let m = t.detectErrorBoundary;
1834
- n = (y) => ({
1835
- hasErrorBoundary: m(y)
1836
- });
1837
- } else
1838
- n = dr;
1839
- let s = I({
1840
- v7_relativeSplatPath: !1,
1841
- v7_throwAbortReason: !1
1842
- }, t ? t.future : null), l = je(e, n, void 0, r);
1843
- async function f(m, y) {
1844
- let {
1845
- requestContext: g,
1846
- skipLoaderErrorBubbling: P,
1847
- unstable_dataStrategy: A
1848
- } = y === void 0 ? {} : y, x = new URL(m.url), U = m.method, S = ge("", ue(x), null, "default"), N = me(l, S, a);
1849
- if (!yt(U) && U !== "HEAD") {
1850
- let C = Y(405, {
1851
- method: U
1852
- }), {
1853
- matches: J,
1854
- route: F
1855
- } = it(l);
1856
- return {
1857
- basename: a,
1858
- location: S,
1859
- matches: J,
1860
- loaderData: {},
1861
- actionData: null,
1862
- errors: {
1863
- [F.id]: C
1864
- },
1865
- statusCode: C.status,
1866
- loaderHeaders: {},
1867
- actionHeaders: {},
1868
- activeDeferreds: null
1869
- };
1870
- } else if (!N) {
1871
- let C = Y(404, {
1872
- pathname: S.pathname
1873
- }), {
1874
- matches: J,
1875
- route: F
1876
- } = it(l);
1877
- return {
1878
- basename: a,
1879
- location: S,
1880
- matches: J,
1881
- loaderData: {},
1882
- actionData: null,
1883
- errors: {
1884
- [F.id]: C
1885
- },
1886
- statusCode: C.status,
1887
- loaderHeaders: {},
1888
- actionHeaders: {},
1889
- activeDeferreds: null
1890
- };
1891
- }
1892
- let c = await v(m, S, N, g, A || null, P === !0, null);
1893
- return Re(c) ? c : I({
1894
- location: S,
1895
- basename: a
1896
- }, c);
1897
- }
1898
- async function u(m, y) {
1899
- let {
1900
- routeId: g,
1901
- requestContext: P,
1902
- unstable_dataStrategy: A
1903
- } = y === void 0 ? {} : y, x = new URL(m.url), U = m.method, S = ge("", ue(x), null, "default"), N = me(l, S, a);
1904
- if (!yt(U) && U !== "HEAD" && U !== "OPTIONS")
1905
- throw Y(405, {
1906
- method: U
1907
- });
1908
- if (!N)
1909
- throw Y(404, {
1910
- pathname: S.pathname
1911
- });
1912
- let c = g ? N.find((X) => X.route.id === g) : Me(N, S);
1913
- if (g && !c)
1914
- throw Y(403, {
1915
- pathname: S.pathname,
1916
- routeId: g
1917
- });
1918
- if (!c)
1919
- throw Y(404, {
1920
- pathname: S.pathname
1921
- });
1922
- let C = await v(m, S, N, P, A || null, !1, c);
1923
- if (Re(C))
1924
- return C;
1925
- let J = C.errors ? Object.values(C.errors)[0] : void 0;
1926
- if (J !== void 0)
1927
- throw J;
1928
- if (C.actionData)
1929
- return Object.values(C.actionData)[0];
1930
- if (C.loaderData) {
1931
- var F;
1932
- let X = Object.values(C.loaderData)[0];
1933
- return (F = C.activeDeferreds) != null && F[c.route.id] && (X[fr] = C.activeDeferreds[c.route.id]), X;
1934
- }
1935
- }
1936
- async function v(m, y, g, P, A, x, U) {
1937
- O(m.signal, "query()/queryRoute() requests must contain an AbortController signal");
1938
- try {
1939
- if (ie(m.method.toLowerCase()))
1940
- return await b(m, g, U || Me(g, y), P, A, x, U != null);
1941
- let S = await p(m, g, P, A, x, U);
1942
- return Re(S) ? S : I({}, S, {
1943
- actionData: null,
1944
- actionHeaders: {}
1945
- });
1946
- } catch (S) {
1947
- if (ja(S) && Re(S.result)) {
1948
- if (S.type === H.error)
1949
- throw S.result;
1950
- return S.result;
1951
- }
1952
- if (Ca(S))
1953
- return S;
1954
- throw S;
1955
- }
1956
- }
1957
- async function b(m, y, g, P, A, x, U) {
1958
- let S;
1959
- if (!g.route.action && !g.route.lazy) {
1960
- let C = Y(405, {
1961
- method: m.method,
1962
- pathname: new URL(m.url).pathname,
1963
- routeId: g.route.id
1964
- });
1965
- if (U)
1966
- throw C;
1967
- S = {
1968
- type: H.error,
1969
- error: C
1970
- };
1971
- } else
1972
- S = (await R("action", m, [g], y, U, P, A))[0], m.signal.aborted && Ot(m, U, s);
1973
- if (De(S))
1974
- throw new Response(null, {
1975
- status: S.response.status,
1976
- headers: {
1977
- Location: S.response.headers.get("Location")
1978
- }
1979
- });
1980
- if (Se(S)) {
1981
- let C = Y(400, {
1982
- type: "defer-action"
1983
- });
1984
- if (U)
1985
- throw C;
1986
- S = {
1987
- type: H.error,
1988
- error: C
1989
- };
1990
- }
1991
- if (U) {
1992
- if (ee(S))
1993
- throw S.error;
1994
- return {
1995
- matches: [g],
1996
- loaderData: {},
1997
- actionData: {
1998
- [g.route.id]: S.data
1999
- },
2000
- errors: null,
2001
- // Note: statusCode + headers are unused here since queryRoute will
2002
- // return the raw Response or value
2003
- statusCode: 200,
2004
- loaderHeaders: {},
2005
- actionHeaders: {},
2006
- activeDeferreds: null
2007
- };
2008
- }
2009
- let N = new Request(m.url, {
2010
- headers: m.headers,
2011
- redirect: m.redirect,
2012
- signal: m.signal
2013
- });
2014
- if (ee(S)) {
2015
- let C = x ? g : Le(y, g.route.id), J = await p(N, y, P, A, x, null, [C.route.id, S]);
2016
- return I({}, J, {
2017
- statusCode: ze(S.error) ? S.error.status : S.statusCode != null ? S.statusCode : 500,
2018
- actionData: null,
2019
- actionHeaders: I({}, S.headers ? {
2020
- [g.route.id]: S.headers
2021
- } : {})
2022
- });
2023
- }
2024
- let c = await p(N, y, P, A, x, null);
2025
- return I({}, c, {
2026
- actionData: {
2027
- [g.route.id]: S.data
2028
- }
2029
- }, S.statusCode ? {
2030
- statusCode: S.statusCode
2031
- } : {}, {
2032
- actionHeaders: S.headers ? {
2033
- [g.route.id]: S.headers
2034
- } : {}
2035
- });
2036
- }
2037
- async function p(m, y, g, P, A, x, U) {
2038
- let S = x != null;
2039
- if (S && !(x != null && x.route.loader) && !(x != null && x.route.lazy))
2040
- throw Y(400, {
2041
- method: m.method,
2042
- pathname: new URL(m.url).pathname,
2043
- routeId: x == null ? void 0 : x.route.id
2044
- });
2045
- let c = (x ? [x] : U && ee(U[1]) ? cr(y, U[0]) : y).filter((K) => K.route.loader || K.route.lazy);
2046
- if (c.length === 0)
2047
- return {
2048
- matches: y,
2049
- // Add a null for all matched routes for proper revalidation on the client
2050
- loaderData: y.reduce((K, ne) => Object.assign(K, {
2051
- [ne.route.id]: null
2052
- }), {}),
2053
- errors: U && ee(U[1]) ? {
2054
- [U[0]]: U[1].error
2055
- } : null,
2056
- statusCode: 200,
2057
- loaderHeaders: {},
2058
- activeDeferreds: null
2059
- };
2060
- let C = await R("loader", m, c, y, S, g, P);
2061
- m.signal.aborted && Ot(m, S, s);
2062
- let J = /* @__PURE__ */ new Map(), F = wr(y, c, C, U, J, A), X = new Set(c.map((K) => K.route.id));
2063
- return y.forEach((K) => {
2064
- X.has(K.route.id) || (F.loaderData[K.route.id] = null);
2065
- }), I({}, F, {
2066
- matches: y,
2067
- activeDeferreds: J.size > 0 ? Object.fromEntries(J.entries()) : null
2068
- });
2069
- }
2070
- async function R(m, y, g, P, A, x, U) {
2071
- let S = await gr(U || mr, m, y, g, P, r, n, x);
2072
- return await Promise.all(S.map((N, c) => {
2073
- if (Rr(N)) {
2074
- let C = N.result;
2075
- throw vr(C, y, g[c].route.id, P, a, s.v7_relativeSplatPath);
2076
- }
2077
- if (Re(N.result) && A)
2078
- throw N;
2079
- return yr(N);
2080
- }));
2081
- }
2082
- return {
2083
- dataRoutes: l,
2084
- query: f,
2085
- queryRoute: u
2086
- };
2087
- }
2088
- function Sa(e, t, r) {
2089
- return I({}, t, {
2090
- statusCode: ze(r) ? r.status : 500,
2091
- errors: {
2092
- [t._deepestRenderedBoundaryId || e[0].id]: r
2093
- }
2094
- });
2095
- }
2096
- function Ot(e, t, r) {
2097
- if (r.v7_throwAbortReason && e.signal.reason !== void 0)
2098
- throw e.signal.reason;
2099
- let a = t ? "queryRoute" : "query";
2100
- throw new Error(a + "() call aborted: " + e.method + " " + e.url);
2101
- }
2102
- function Da(e) {
2103
- return e != null && ("formData" in e && e.formData != null || "body" in e && e.body !== void 0);
2104
- }
2105
- function mt(e, t, r, a, n, s, l, f) {
2106
- let u, v;
2107
- if (l) {
2108
- u = [];
2109
- for (let p of t)
2110
- if (u.push(p), p.route.id === l) {
2111
- v = p;
2112
- break;
2113
- }
2114
- } else
2115
- u = t, v = t[t.length - 1];
2116
- let b = ar(n || ".", rr(u, s), Ye(e.pathname, r) || e.pathname, f === "path");
2117
- return n == null && (b.search = e.search, b.hash = e.hash), (n == null || n === "" || n === ".") && v && v.route.index && !bt(b.search) && (b.search = b.search ? b.search.replace(/^\?/, "?index&") : "?index"), a && r !== "/" && (b.pathname = b.pathname === "/" ? r : He([r, b.pathname])), ue(b);
2118
- }
2119
- function It(e, t, r, a) {
2120
- if (!a || !Da(a))
2121
- return {
2122
- path: r
2123
- };
2124
- if (a.formMethod && !yt(a.formMethod))
2125
- return {
2126
- path: r,
2127
- error: Y(405, {
2128
- method: a.formMethod
2129
- })
2130
- };
2131
- let n = () => ({
2132
- path: r,
2133
- error: Y(400, {
2134
- type: "invalid-body"
2135
- })
2136
- }), s = a.formMethod || "get", l = e ? s.toUpperCase() : s.toLowerCase(), f = br(r);
2137
- if (a.body !== void 0) {
2138
- if (a.formEncType === "text/plain") {
2139
- if (!ie(l))
2140
- return n();
2141
- let R = typeof a.body == "string" ? a.body : a.body instanceof FormData || a.body instanceof URLSearchParams ? (
2142
- // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
2143
- Array.from(a.body.entries()).reduce((m, y) => {
2144
- let [g, P] = y;
2145
- return "" + m + g + "=" + P + `
2146
- `;
2147
- }, "")
2148
- ) : String(a.body);
2149
- return {
2150
- path: r,
2151
- submission: {
2152
- formMethod: l,
2153
- formAction: f,
2154
- formEncType: a.formEncType,
2155
- formData: void 0,
2156
- json: void 0,
2157
- text: R
2158
- }
2159
- };
2160
- } else if (a.formEncType === "application/json") {
2161
- if (!ie(l))
2162
- return n();
2163
- try {
2164
- let R = typeof a.body == "string" ? JSON.parse(a.body) : a.body;
2165
- return {
2166
- path: r,
2167
- submission: {
2168
- formMethod: l,
2169
- formAction: f,
2170
- formEncType: a.formEncType,
2171
- formData: void 0,
2172
- json: R,
2173
- text: void 0
2174
- }
2175
- };
2176
- } catch {
2177
- return n();
2178
- }
2179
- }
2180
- }
2181
- O(typeof FormData == "function", "FormData is not available in this environment");
2182
- let u, v;
2183
- if (a.formData)
2184
- u = gt(a.formData), v = a.formData;
2185
- else if (a.body instanceof FormData)
2186
- u = gt(a.body), v = a.body;
2187
- else if (a.body instanceof URLSearchParams)
2188
- u = a.body, v = Wt(u);
2189
- else if (a.body == null)
2190
- u = new URLSearchParams(), v = new FormData();
2191
- else
2192
- try {
2193
- u = new URLSearchParams(a.body), v = Wt(u);
2194
- } catch {
2195
- return n();
2196
- }
2197
- let b = {
2198
- formMethod: l,
2199
- formAction: f,
2200
- formEncType: a && a.formEncType || "application/x-www-form-urlencoded",
2201
- formData: v,
2202
- json: void 0,
2203
- text: void 0
2204
- };
2205
- if (ie(b.formMethod))
2206
- return {
2207
- path: r,
2208
- submission: b
2209
- };
2210
- let p = oe(r);
2211
- return t && p.search && bt(p.search) && u.append("index", ""), p.search = "?" + u, {
2212
- path: ue(p),
2213
- submission: b
2214
- };
2215
- }
2216
- function cr(e, t) {
2217
- let r = e;
2218
- if (t) {
2219
- let a = e.findIndex((n) => n.route.id === t);
2220
- a >= 0 && (r = e.slice(0, a));
2221
- }
2222
- return r;
2223
- }
2224
- function Nt(e, t, r, a, n, s, l, f, u, v, b, p, R, m, y, g) {
2225
- let P = g ? ee(g[1]) ? g[1].error : g[1].data : void 0, A = e.createURL(t.location), x = e.createURL(n), U = g && ee(g[1]) ? g[0] : void 0, S = U ? cr(r, U) : r, N = g ? g[1].statusCode : void 0, c = l && N && N >= 400, C = S.filter((F, X) => {
2226
- let {
2227
- route: K
2228
- } = F;
2229
- if (K.lazy)
2230
- return !0;
2231
- if (K.loader == null)
2232
- return !1;
2233
- if (s)
2234
- return typeof K.loader != "function" || K.loader.hydrate ? !0 : t.loaderData[K.id] === void 0 && // Don't re-run if the loader ran and threw an error
2235
- (!t.errors || t.errors[K.id] === void 0);
2236
- if (Ea(t.loaderData, t.matches[X], F) || u.some((te) => te === F.route.id))
2237
- return !0;
2238
- let ne = t.matches[X], le = F;
2239
- return Ht(F, I({
2240
- currentUrl: A,
2241
- currentParams: ne.params,
2242
- nextUrl: x,
2243
- nextParams: le.params
2244
- }, a, {
2245
- actionResult: P,
2246
- actionStatus: N,
2247
- defaultShouldRevalidate: c ? !1 : (
2248
- // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
2249
- f || A.pathname + A.search === x.pathname + x.search || // Search params affect all loaders
2250
- A.search !== x.search || hr(ne, le)
2251
- )
2252
- }));
2253
- }), J = [];
2254
- return p.forEach((F, X) => {
2255
- if (s || !r.some((Ce) => Ce.route.id === F.routeId) || b.has(X))
2256
- return;
2257
- let K = me(m, F.path, y);
2258
- if (!K) {
2259
- J.push({
2260
- key: X,
2261
- routeId: F.routeId,
2262
- path: F.path,
2263
- matches: null,
2264
- match: null,
2265
- controller: null
2266
- });
2267
- return;
2268
- }
2269
- let ne = t.fetchers.get(X), le = Me(K, F.path), te = !1;
2270
- R.has(X) ? te = !1 : v.includes(X) ? te = !0 : ne && ne.state !== "idle" && ne.data === void 0 ? te = f : te = Ht(le, I({
2271
- currentUrl: A,
2272
- currentParams: t.matches[t.matches.length - 1].params,
2273
- nextUrl: x,
2274
- nextParams: r[r.length - 1].params
2275
- }, a, {
2276
- actionResult: P,
2277
- actionStatus: N,
2278
- defaultShouldRevalidate: c ? !1 : f
2279
- })), te && J.push({
2280
- key: X,
2281
- routeId: F.routeId,
2282
- path: F.path,
2283
- matches: K,
2284
- match: le,
2285
- controller: new AbortController()
2286
- });
2287
- }), [C, J];
2288
- }
2289
- function Ea(e, t, r) {
2290
- let a = (
2291
- // [a] -> [a, b]
2292
- !t || // [a, b] -> [a, c]
2293
- r.route.id !== t.route.id
2294
- ), n = e[r.route.id] === void 0;
2295
- return a || n;
2296
- }
2297
- function hr(e, t) {
2298
- let r = e.route.path;
2299
- return (
2300
- // param change for this match, /users/123 -> /users/456
2301
- e.pathname !== t.pathname || // splat param changed, which is not present in match.path
2302
- // e.g. /files/images/avatar.jpg -> files/finances.xls
2303
- r != null && r.endsWith("*") && e.params["*"] !== t.params["*"]
2304
- );
2305
- }
2306
- function Ht(e, t) {
2307
- if (e.route.shouldRevalidate) {
2308
- let r = e.route.shouldRevalidate(t);
2309
- if (typeof r == "boolean")
2310
- return r;
2311
- }
2312
- return t.defaultShouldRevalidate;
2313
- }
2314
- async function Pa(e, t, r, a, n, s, l, f) {
2315
- let u = [t, ...r.map((v) => v.route.id)].join("-");
2316
- try {
2317
- let v = l.get(u);
2318
- v || (v = e({
2319
- path: t,
2320
- matches: r,
2321
- patch: (b, p) => {
2322
- f.aborted || pr(b, p, a, n, s);
2323
- }
2324
- }), l.set(u, v)), v && Ma(v) && await v;
2325
- } finally {
2326
- l.delete(u);
2327
- }
2328
- }
2329
- function pr(e, t, r, a, n) {
2330
- if (e) {
2331
- var s;
2332
- let l = a[e];
2333
- O(l, "No route found to patch children into: routeId = " + e);
2334
- let f = je(t, n, [e, "patch", String(((s = l.children) == null ? void 0 : s.length) || "0")], a);
2335
- l.children ? l.children.push(...f) : l.children = f;
2336
- } else {
2337
- let l = je(t, n, ["patch", String(r.length || "0")], a);
2338
- r.push(...l);
2339
- }
2340
- }
2341
- async function zt(e, t, r) {
2342
- if (!e.lazy)
2343
- return;
2344
- let a = await e.lazy();
2345
- if (!e.lazy)
2346
- return;
2347
- let n = r[e.id];
2348
- O(n, "No route found in manifest");
2349
- let s = {};
2350
- for (let l in a) {
2351
- let u = n[l] !== void 0 && // This property isn't static since it should always be updated based
2352
- // on the route updates
2353
- l !== "hasErrorBoundary";
2354
- de(!u, '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.')), !u && !Vr.has(l) && (s[l] = a[l]);
2355
- }
2356
- Object.assign(n, s), Object.assign(n, I({}, t(n), {
2357
- lazy: void 0
2358
- }));
2359
- }
2360
- function mr(e) {
2361
- return Promise.all(e.matches.map((t) => t.resolve()));
2362
- }
2363
- async function gr(e, t, r, a, n, s, l, f) {
2364
- let u = a.reduce((p, R) => p.add(R.route.id), /* @__PURE__ */ new Set()), v = /* @__PURE__ */ new Set(), b = await e({
2365
- matches: n.map((p) => {
2366
- let R = u.has(p.route.id);
2367
- return I({}, p, {
2368
- shouldLoad: R,
2369
- resolve: (y) => (v.add(p.route.id), R ? xa(t, r, p, s, l, y, f) : Promise.resolve({
2370
- type: H.data,
2371
- result: void 0
2372
- }))
2373
- });
2374
- }),
2375
- request: r,
2376
- params: n[0].params,
2377
- context: f
2378
- });
2379
- return n.forEach((p) => O(v.has(p.route.id), '`match.resolve()` was not called for route id "' + p.route.id + '". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')), b.filter((p, R) => u.has(n[R].route.id));
2380
- }
2381
- async function xa(e, t, r, a, n, s, l) {
2382
- let f, u, v = (b) => {
2383
- let p, R = new Promise((g, P) => p = P);
2384
- u = () => p(), t.signal.addEventListener("abort", u);
2385
- let m = (g) => typeof b != "function" ? Promise.reject(new Error("You cannot call the handler for a route which defines a boolean " + ('"' + e + '" [routeId: ' + r.route.id + "]"))) : b({
2386
- request: t,
2387
- params: r.params,
2388
- context: l
2389
- }, ...g !== void 0 ? [g] : []), y;
2390
- return s ? y = s((g) => m(g)) : y = (async () => {
2391
- try {
2392
- return {
2393
- type: "data",
2394
- result: await m()
2395
- };
2396
- } catch (g) {
2397
- return {
2398
- type: "error",
2399
- result: g
2400
- };
2401
- }
2402
- })(), Promise.race([y, R]);
2403
- };
2404
- try {
2405
- let b = r.route[e];
2406
- if (r.route.lazy)
2407
- if (b) {
2408
- let p, [R] = await Promise.all([
2409
- // If the handler throws, don't let it immediately bubble out,
2410
- // since we need to let the lazy() execution finish so we know if this
2411
- // route has a boundary that can handle the error
2412
- v(b).catch((m) => {
2413
- p = m;
2414
- }),
2415
- zt(r.route, n, a)
2416
- ]);
2417
- if (p !== void 0)
2418
- throw p;
2419
- f = R;
2420
- } else if (await zt(r.route, n, a), b = r.route[e], b)
2421
- f = await v(b);
2422
- else if (e === "action") {
2423
- let p = new URL(t.url), R = p.pathname + p.search;
2424
- throw Y(405, {
2425
- method: t.method,
2426
- pathname: R,
2427
- routeId: r.route.id
2428
- });
2429
- } else
2430
- return {
2431
- type: H.data,
2432
- result: void 0
2433
- };
2434
- else if (b)
2435
- f = await v(b);
2436
- else {
2437
- let p = new URL(t.url), R = p.pathname + p.search;
2438
- throw Y(404, {
2439
- pathname: R
2440
- });
2441
- }
2442
- O(f.result !== void 0, "You defined " + (e === "action" ? "an action" : "a loader") + " for route " + ('"' + r.route.id + "\" but didn't return anything from your `" + e + "` ") + "function. Please return a value or `null`.");
2443
- } catch (b) {
2444
- return {
2445
- type: H.error,
2446
- result: b
2447
- };
2448
- } finally {
2449
- u && t.signal.removeEventListener("abort", u);
2450
- }
2451
- return f;
2452
- }
2453
- async function yr(e) {
2454
- let {
2455
- result: t,
2456
- type: r,
2457
- status: a
2458
- } = e;
2459
- if (Re(t)) {
2460
- let l;
2461
- try {
2462
- let f = t.headers.get("Content-Type");
2463
- f && /\bapplication\/json\b/.test(f) ? t.body == null ? l = null : l = await t.json() : l = await t.text();
2464
- } catch (f) {
2465
- return {
2466
- type: H.error,
2467
- error: f
2468
- };
2469
- }
2470
- return r === H.error ? {
2471
- type: H.error,
2472
- error: new vt(t.status, t.statusText, l),
2473
- statusCode: t.status,
2474
- headers: t.headers
2475
- } : {
2476
- type: H.data,
2477
- data: l,
2478
- statusCode: t.status,
2479
- headers: t.headers
2480
- };
2481
- }
2482
- if (r === H.error)
2483
- return {
2484
- type: H.error,
2485
- error: t,
2486
- statusCode: ze(t) ? t.status : a
2487
- };
2488
- if (Sr(t)) {
2489
- var n, s;
2490
- return {
2491
- type: H.deferred,
2492
- deferredData: t,
2493
- statusCode: (n = t.init) == null ? void 0 : n.status,
2494
- headers: ((s = t.init) == null ? void 0 : s.headers) && new Headers(t.init.headers)
2495
- };
2496
- }
2497
- return {
2498
- type: H.data,
2499
- data: t,
2500
- statusCode: a
2501
- };
2502
- }
2503
- function vr(e, t, r, a, n, s) {
2504
- let l = e.headers.get("Location");
2505
- if (O(l, "Redirects returned/thrown from loaders/actions must have a Location header"), !wt.test(l)) {
2506
- let f = a.slice(0, a.findIndex((u) => u.route.id === r) + 1);
2507
- l = mt(new URL(t.url), f, n, !0, l, s), e.headers.set("Location", l);
2508
- }
2509
- return e;
2510
- }
2511
- function Bt(e, t, r) {
2512
- if (wt.test(e)) {
2513
- let a = e, n = a.startsWith("//") ? new URL(t.protocol + a) : new URL(a), s = Ye(n.pathname, r) != null;
2514
- if (n.origin === t.origin && s)
2515
- return n.pathname + n.search + n.hash;
2516
- }
2517
- return e;
2518
- }
2519
- function Ie(e, t, r, a) {
2520
- let n = e.createURL(br(t)).toString(), s = {
2521
- signal: r
2522
- };
2523
- if (a && ie(a.formMethod)) {
2524
- let {
2525
- formMethod: l,
2526
- formEncType: f
2527
- } = a;
2528
- s.method = l.toUpperCase(), f === "application/json" ? (s.headers = new Headers({
2529
- "Content-Type": f
2530
- }), s.body = JSON.stringify(a.json)) : f === "text/plain" ? s.body = a.text : f === "application/x-www-form-urlencoded" && a.formData ? s.body = gt(a.formData) : s.body = a.formData;
2531
- }
2532
- return new Request(n, s);
2533
- }
2534
- function gt(e) {
2535
- let t = new URLSearchParams();
2536
- for (let [r, a] of e.entries())
2537
- t.append(r, typeof a == "string" ? a : a.name);
2538
- return t;
2539
- }
2540
- function Wt(e) {
2541
- let t = new FormData();
2542
- for (let [r, a] of e.entries())
2543
- t.append(r, a);
2544
- return t;
2545
- }
2546
- function wr(e, t, r, a, n, s) {
2547
- let l = {}, f = null, u, v = !1, b = {}, p = a && ee(a[1]) ? a[1].error : void 0;
2548
- return r.forEach((R, m) => {
2549
- let y = t[m].route.id;
2550
- if (O(!De(R), "Cannot handle redirect results in processLoaderData"), ee(R)) {
2551
- let g = R.error;
2552
- if (p !== void 0 && (g = p, p = void 0), f = f || {}, s)
2553
- f[y] = g;
2554
- else {
2555
- let P = Le(e, y);
2556
- f[P.route.id] == null && (f[P.route.id] = g);
2557
- }
2558
- l[y] = void 0, v || (v = !0, u = ze(R.error) ? R.error.status : 500), R.headers && (b[y] = R.headers);
2559
- } else
2560
- Se(R) ? (n.set(y, R.deferredData), l[y] = R.deferredData.data, R.statusCode != null && R.statusCode !== 200 && !v && (u = R.statusCode), R.headers && (b[y] = R.headers)) : (l[y] = R.data, R.statusCode && R.statusCode !== 200 && !v && (u = R.statusCode), R.headers && (b[y] = R.headers));
2561
- }), p !== void 0 && a && (f = {
2562
- [a[0]]: p
2563
- }, l[a[0]] = void 0), {
2564
- loaderData: l,
2565
- errors: f,
2566
- statusCode: u || 200,
2567
- loaderHeaders: b
2568
- };
2569
- }
2570
- function Kt(e, t, r, a, n, s, l, f) {
2571
- let {
2572
- loaderData: u,
2573
- errors: v
2574
- } = wr(
2575
- t,
2576
- r,
2577
- a,
2578
- n,
2579
- f,
2580
- !1
2581
- // This method is only called client side so we always want to bubble
2582
- );
2583
- for (let b = 0; b < s.length; b++) {
2584
- let {
2585
- key: p,
2586
- match: R,
2587
- controller: m
2588
- } = s[b];
2589
- O(l !== void 0 && l[b] !== void 0, "Did not find corresponding fetcher result");
2590
- let y = l[b];
2591
- if (!(m && m.signal.aborted))
2592
- if (ee(y)) {
2593
- let g = Le(e.matches, R == null ? void 0 : R.route.id);
2594
- v && v[g.route.id] || (v = I({}, v, {
2595
- [g.route.id]: y.error
2596
- })), e.fetchers.delete(p);
2597
- } else if (De(y))
2598
- O(!1, "Unhandled fetcher revalidation redirect");
2599
- else if (Se(y))
2600
- O(!1, "Unhandled fetcher deferred data");
2601
- else {
2602
- let g = be(y.data);
2603
- e.fetchers.set(p, g);
2604
- }
2605
- }
2606
- return {
2607
- loaderData: u,
2608
- errors: v
2609
- };
2610
- }
2611
- function $t(e, t, r, a) {
2612
- let n = I({}, t);
2613
- for (let s of r) {
2614
- let l = s.route.id;
2615
- if (t.hasOwnProperty(l) ? t[l] !== void 0 && (n[l] = t[l]) : e[l] !== void 0 && s.route.loader && (n[l] = e[l]), a && a.hasOwnProperty(l))
2616
- break;
2617
- }
2618
- return n;
2619
- }
2620
- function kt(e) {
2621
- return e ? ee(e[1]) ? {
2622
- // Clear out prior actionData on errors
2623
- actionData: {}
2624
- } : {
2625
- actionData: {
2626
- [e[0]]: e[1].data
2627
- }
2628
- } : {};
2629
- }
2630
- function Le(e, t) {
2631
- return (t ? e.slice(0, e.findIndex((a) => a.route.id === t) + 1) : [...e]).reverse().find((a) => a.route.hasErrorBoundary === !0) || e[0];
2632
- }
2633
- function it(e) {
2634
- let t = e.length === 1 ? e[0] : e.find((r) => r.index || !r.path || r.path === "/") || {
2635
- id: "__shim-error-route__"
2636
- };
2637
- return {
2638
- matches: [{
2639
- params: {},
2640
- pathname: "",
2641
- pathnameBase: "",
2642
- route: t
2643
- }],
2644
- route: t
2645
- };
2646
- }
2647
- function Y(e, t) {
2648
- let {
2649
- pathname: r,
2650
- routeId: a,
2651
- method: n,
2652
- type: s,
2653
- message: l
2654
- } = t === void 0 ? {} : t, f = "Unknown Server Error", u = "Unknown @remix-run/router error";
2655
- return e === 400 ? (f = "Bad Request", s === "route-discovery" ? u = 'Unable to match URL "' + r + '" - the `unstable_patchRoutesOnMiss()` ' + (`function threw the following error:
2656
- ` + l) : n && r && a ? u = "You made a " + n + ' request to "' + r + '" but ' + ('did not provide a `loader` for route "' + a + '", ') + "so there is no way to handle the request." : s === "defer-action" ? u = "defer() is not supported in actions" : s === "invalid-body" && (u = "Unable to encode submission body")) : e === 403 ? (f = "Forbidden", u = 'Route "' + a + '" does not match URL "' + r + '"') : e === 404 ? (f = "Not Found", u = 'No route matches URL "' + r + '"') : e === 405 && (f = "Method Not Allowed", n && r && a ? u = "You made a " + n.toUpperCase() + ' request to "' + r + '" but ' + ('did not provide an `action` for route "' + a + '", ') + "so there is no way to handle the request." : n && (u = 'Invalid request method "' + n.toUpperCase() + '"')), new vt(e || 500, f, new Error(u), !0);
2657
- }
2658
- function Vt(e) {
2659
- for (let t = e.length - 1; t >= 0; t--) {
2660
- let r = e[t];
2661
- if (De(r))
2662
- return {
2663
- result: r,
2664
- idx: t
2665
- };
2666
- }
2667
- }
2668
- function br(e) {
2669
- let t = typeof e == "string" ? oe(e) : e;
2670
- return ue(I({}, t, {
2671
- hash: ""
2672
- }));
2673
- }
2674
- function La(e, t) {
2675
- return e.pathname !== t.pathname || e.search !== t.search ? !1 : e.hash === "" ? t.hash !== "" : e.hash === t.hash ? !0 : t.hash !== "";
2676
- }
2677
- function Ma(e) {
2678
- return typeof e == "object" && e != null && "then" in e;
2679
- }
2680
- function ja(e) {
2681
- return e != null && typeof e == "object" && "type" in e && "result" in e && (e.type === H.data || e.type === H.error);
2682
- }
2683
- function Rr(e) {
2684
- return Re(e.result) && va.has(e.result.status);
2685
- }
2686
- function Se(e) {
2687
- return e.type === H.deferred;
2688
- }
2689
- function ee(e) {
2690
- return e.type === H.error;
2691
- }
2692
- function De(e) {
2693
- return (e && e.type) === H.redirect;
2694
- }
2695
- function Sr(e) {
2696
- let t = e;
2697
- return t && typeof t == "object" && typeof t.data == "object" && typeof t.subscribe == "function" && typeof t.cancel == "function" && typeof t.resolveData == "function";
2698
- }
2699
- function Re(e) {
2700
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.headers == "object" && typeof e.body < "u";
2701
- }
2702
- function Ca(e) {
2703
- if (!Re(e))
2704
- return !1;
2705
- let t = e.status, r = e.headers.get("Location");
2706
- return t >= 300 && t <= 399 && r != null;
2707
- }
2708
- function yt(e) {
2709
- return ya.has(e.toLowerCase());
2710
- }
2711
- function ie(e) {
2712
- return ma.has(e.toLowerCase());
2713
- }
2714
- async function Yt(e, t, r, a, n, s) {
2715
- for (let l = 0; l < r.length; l++) {
2716
- let f = r[l], u = t[l];
2717
- if (!u)
2718
- continue;
2719
- let v = e.find((p) => p.route.id === u.route.id), b = v != null && !hr(v, u) && (s && s[u.route.id]) !== void 0;
2720
- if (Se(f) && (n || b)) {
2721
- let p = a[l];
2722
- O(p, "Expected an AbortSignal for revalidating fetcher deferred result"), await Dr(f, p, n).then((R) => {
2723
- R && (r[l] = R || r[l]);
2724
- });
2725
- }
2726
- }
2727
- }
2728
- async function Dr(e, t, r) {
2729
- if (r === void 0 && (r = !1), !await e.deferredData.resolveData(t)) {
2730
- if (r)
2731
- try {
2732
- return {
2733
- type: H.data,
2734
- data: e.deferredData.unwrappedData
2735
- };
2736
- } catch (n) {
2737
- return {
2738
- type: H.error,
2739
- error: n
2740
- };
2741
- }
2742
- return {
2743
- type: H.data,
2744
- data: e.deferredData.data
2745
- };
2746
- }
2747
- }
2748
- function bt(e) {
2749
- return new URLSearchParams(e).getAll("index").some((t) => t === "");
2750
- }
2751
- function Me(e, t) {
2752
- let r = typeof t == "string" ? oe(t).search : t.search;
2753
- if (e[e.length - 1].route.index && bt(r || ""))
2754
- return e[e.length - 1];
2755
- let a = tr(e);
2756
- return a[a.length - 1];
2757
- }
2758
- function Jt(e) {
2759
- let {
2760
- formMethod: t,
2761
- formAction: r,
2762
- formEncType: a,
2763
- text: n,
2764
- formData: s,
2765
- json: l
2766
- } = e;
2767
- if (!(!t || !r || !a)) {
2768
- if (n != null)
2769
- return {
2770
- formMethod: t,
2771
- formAction: r,
2772
- formEncType: a,
2773
- formData: void 0,
2774
- json: void 0,
2775
- text: n
2776
- };
2777
- if (s != null)
2778
- return {
2779
- formMethod: t,
2780
- formAction: r,
2781
- formEncType: a,
2782
- formData: s,
2783
- json: void 0,
2784
- text: void 0
2785
- };
2786
- if (l !== void 0)
2787
- return {
2788
- formMethod: t,
2789
- formAction: r,
2790
- formEncType: a,
2791
- formData: void 0,
2792
- json: l,
2793
- text: void 0
2794
- };
2795
- }
2796
- }
2797
- function ct(e, t) {
2798
- return t ? {
2799
- state: "loading",
2800
- location: e,
2801
- formMethod: t.formMethod,
2802
- formAction: t.formAction,
2803
- formEncType: t.formEncType,
2804
- formData: t.formData,
2805
- json: t.json,
2806
- text: t.text
2807
- } : {
2808
- state: "loading",
2809
- location: e,
2810
- formMethod: void 0,
2811
- formAction: void 0,
2812
- formEncType: void 0,
2813
- formData: void 0,
2814
- json: void 0,
2815
- text: void 0
2816
- };
2817
- }
2818
- function Ta(e, t) {
2819
- return {
2820
- state: "submitting",
2821
- location: e,
2822
- formMethod: t.formMethod,
2823
- formAction: t.formAction,
2824
- formEncType: t.formEncType,
2825
- formData: t.formData,
2826
- json: t.json,
2827
- text: t.text
2828
- };
2829
- }
2830
- function Ve(e, t) {
2831
- return e ? {
2832
- state: "loading",
2833
- formMethod: e.formMethod,
2834
- formAction: e.formAction,
2835
- formEncType: e.formEncType,
2836
- formData: e.formData,
2837
- json: e.json,
2838
- text: e.text,
2839
- data: t
2840
- } : {
2841
- state: "loading",
2842
- formMethod: void 0,
2843
- formAction: void 0,
2844
- formEncType: void 0,
2845
- formData: void 0,
2846
- json: void 0,
2847
- text: void 0,
2848
- data: t
2849
- };
2850
- }
2851
- function Fa(e, t) {
2852
- return {
2853
- state: "submitting",
2854
- formMethod: e.formMethod,
2855
- formAction: e.formAction,
2856
- formEncType: e.formEncType,
2857
- formData: e.formData,
2858
- json: e.json,
2859
- text: e.text,
2860
- data: t ? t.data : void 0
2861
- };
2862
- }
2863
- function be(e) {
2864
- return {
2865
- state: "idle",
2866
- formMethod: void 0,
2867
- formAction: void 0,
2868
- formEncType: void 0,
2869
- formData: void 0,
2870
- json: void 0,
2871
- text: void 0,
2872
- data: e
2873
- };
2874
- }
2875
- function _a(e, t) {
2876
- try {
2877
- let r = e.sessionStorage.getItem(ur);
2878
- if (r) {
2879
- let a = JSON.parse(r);
2880
- for (let [n, s] of Object.entries(a || {}))
2881
- s && Array.isArray(s) && t.set(n, new Set(s || []));
2882
- }
2883
- } catch {
2884
- }
2885
- }
2886
- function Ua(e, t) {
2887
- if (t.size > 0) {
2888
- let r = {};
2889
- for (let [a, n] of t)
2890
- r[a] = [...n];
2891
- try {
2892
- e.sessionStorage.setItem(ur, JSON.stringify(r));
2893
- } catch (a) {
2894
- de(!1, "Failed to save applied view transitions in sessionStorage (" + a + ").");
2895
- }
2896
- }
2897
- }
2898
- const Aa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2899
- __proto__: null,
2900
- AbortedDeferredError: pt,
2901
- get Action() {
2902
- return V;
2903
- },
2904
- IDLE_BLOCKER: Ne,
2905
- IDLE_FETCHER: sr,
2906
- IDLE_NAVIGATION: nt,
2907
- UNSAFE_DEFERRED_SYMBOL: fr,
2908
- UNSAFE_DeferredData: ir,
2909
- UNSAFE_ErrorResponseImpl: vt,
2910
- UNSAFE_convertRouteMatchToUiMatch: Xt,
2911
- UNSAFE_convertRoutesToDataRoutes: je,
2912
- UNSAFE_decodePath: qt,
2913
- UNSAFE_getResolveToMatches: rr,
2914
- UNSAFE_invariant: O,
2915
- UNSAFE_warning: de,
2916
- createBrowserHistory: Kr,
2917
- createHashHistory: $r,
2918
- createMemoryHistory: Wr,
2919
- createPath: ue,
2920
- createRouter: ba,
2921
- createStaticHandler: Ra,
2922
- defer: ha,
2923
- generatePath: na,
2924
- getStaticContextFromError: Sa,
2925
- getToPathname: la,
2926
- isDeferredData: Sr,
2927
- isRouteErrorResponse: ze,
2928
- joinPaths: He,
2929
- json: ua,
2930
- matchPath: ht,
2931
- matchRoutes: me,
2932
- normalizePathname: nr,
2933
- parsePath: oe,
2934
- redirect: or,
2935
- redirectDocument: pa,
2936
- resolvePath: er,
2937
- resolveTo: ar,
2938
- stripBasename: Ye
2939
- }, Symbol.toStringTag, { value: "Module" }));
2940
- export {
2941
- V as A,
2942
- vt as E,
2943
- Ne as I,
2944
- ar as a,
2945
- ze as b,
2946
- ht as c,
2947
- qt as d,
2948
- Xt as e,
2949
- Wr as f,
2950
- rr as g,
2951
- pt as h,
2952
- O as i,
2953
- He as j,
2954
- ba as k,
2955
- ue as l,
2956
- me as m,
2957
- ha as n,
2958
- na as o,
2959
- oe as p,
2960
- ua as q,
2961
- or as r,
2962
- Ye as s,
2963
- pa as t,
2964
- er as u,
2965
- Kr as v,
2966
- de as w,
2967
- $r as x,
2968
- sr as y,
2969
- Aa as z
2970
- };
2971
- //# sourceMappingURL=router-D2p7Olpn.js.map