@tonyclaw/agent-inspector 4.0.7 → 4.0.9

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 (119) hide show
  1. package/.output/backend/nitro.json +1 -1
  2. package/.output/cli.js +915 -25970
  3. package/.output/server/_chunks/ssr-renderer.mjs +1 -38
  4. package/.output/server/_libs/@opentelemetry/semantic-conventions+[...].mjs +1 -2658
  5. package/.output/server/_libs/agent-base.mjs +2 -234
  6. package/.output/server/_libs/ajv-formats.mjs +1 -330
  7. package/.output/server/_libs/ajv.mjs +8 -6080
  8. package/.output/server/_libs/anthropic-ai__sdk.mjs +19 -6021
  9. package/.output/server/_libs/atomically.mjs +1 -155
  10. package/.output/server/_libs/base64-js.mjs +1 -102
  11. package/.output/server/_libs/bignumber.js.mjs +1 -1353
  12. package/.output/server/_libs/buffer-equal-constant-time.mjs +1 -38
  13. package/.output/server/_libs/conf.mjs +1 -635
  14. package/.output/server/_libs/cookie-es.mjs +1 -44
  15. package/.output/server/_libs/core-util-is.mjs +1 -75
  16. package/.output/server/_libs/data-uri-to-buffer.mjs +1 -39
  17. package/.output/server/_libs/debounce-fn.mjs +1 -69
  18. package/.output/server/_libs/debug.mjs +5 -547
  19. package/.output/server/_libs/dot-prop.mjs +1 -265
  20. package/.output/server/_libs/ecdsa-sig-formatter.mjs +1 -162
  21. package/.output/server/_libs/env-paths.mjs +1 -57
  22. package/.output/server/_libs/extend.mjs +1 -94
  23. package/.output/server/_libs/fast-deep-equal.mjs +1 -38
  24. package/.output/server/_libs/fast-uri.mjs +1 -812
  25. package/.output/server/_libs/fetch-blob.mjs +1 -287
  26. package/.output/server/_libs/formdata-polyfill.mjs +9 -86
  27. package/.output/server/_libs/gaxios.mjs +5 -926
  28. package/.output/server/_libs/gcp-metadata.mjs +1 -322
  29. package/.output/server/_libs/google-auth-library.mjs +16 -6339
  30. package/.output/server/_libs/google-logging-utils.mjs +1 -385
  31. package/.output/server/_libs/google__genai.mjs +13 -18034
  32. package/.output/server/_libs/h3-v2.mjs +2 -287
  33. package/.output/server/_libs/h3.mjs +2 -408
  34. package/.output/server/_libs/has-flag.mjs +1 -16
  35. package/.output/server/_libs/https-proxy-agent.mjs +7 -280
  36. package/.output/server/_libs/immediate.mjs +1 -74
  37. package/.output/server/_libs/inherits.mjs +1 -50
  38. package/.output/server/_libs/isarray.mjs +1 -14
  39. package/.output/server/_libs/isbot.mjs +1 -20
  40. package/.output/server/_libs/json-bigint.mjs +8 -413
  41. package/.output/server/_libs/json-schema-traverse.mjs +1 -91
  42. package/.output/server/_libs/jszip.mjs +2 -3051
  43. package/.output/server/_libs/jwa.mjs +3 -233
  44. package/.output/server/_libs/jws.mjs +1 -298
  45. package/.output/server/_libs/lie.mjs +1 -273
  46. package/.output/server/_libs/mariozechner__pi-agent-core.mjs +1 -824
  47. package/.output/server/_libs/mariozechner__pi-ai.mjs +34 -22887
  48. package/.output/server/_libs/mimic-function.mjs +2 -47
  49. package/.output/server/_libs/mistralai__mistralai.mjs +7 -32045
  50. package/.output/server/_libs/modelcontextprotocol__core.mjs +1 -1121
  51. package/.output/server/_libs/modelcontextprotocol__server.mjs +13 -13205
  52. package/.output/server/_libs/ms.mjs +1 -120
  53. package/.output/server/_libs/node-domexception.mjs +1 -17
  54. package/.output/server/_libs/node-fetch.mjs +4 -1578
  55. package/.output/server/_libs/ohash.mjs +1 -1
  56. package/.output/server/_libs/openai.mjs +23 -6766
  57. package/.output/server/_libs/opentelemetry__api.mjs +1 -1678
  58. package/.output/server/_libs/p-retry.mjs +1 -87
  59. package/.output/server/_libs/pako.mjs +1 -4223
  60. package/.output/server/_libs/partial-json.mjs +2 -244
  61. package/.output/server/_libs/process-nextick-args.mjs +1 -48
  62. package/.output/server/_libs/react-dom.mjs +62 -10778
  63. package/.output/server/_libs/react.mjs +1 -519
  64. package/.output/server/_libs/readable-stream.mjs +1 -1518
  65. package/.output/server/_libs/retry.mjs +1 -236
  66. package/.output/server/_libs/rou3.mjs +1 -14
  67. package/.output/server/_libs/safe-buffer.mjs +1 -126
  68. package/.output/server/_libs/semver.mjs +1 -1938
  69. package/.output/server/_libs/seroval-plugins.mjs +1 -58
  70. package/.output/server/_libs/seroval.mjs +3 -1775
  71. package/.output/server/_libs/setimmediate.mjs +1 -152
  72. package/.output/server/_libs/srvx.mjs +4 -1390
  73. package/.output/server/_libs/stubborn-fs.mjs +1 -91
  74. package/.output/server/_libs/stubborn-utils.mjs +1 -66
  75. package/.output/server/_libs/supports-color.mjs +1 -108
  76. package/.output/server/_libs/tanstack__history.mjs +1 -230
  77. package/.output/server/_libs/tanstack__react-router.mjs +1 -848
  78. package/.output/server/_libs/tanstack__react-store.mjs +1 -1
  79. package/.output/server/_libs/tanstack__router-core.mjs +1 -4839
  80. package/.output/server/_libs/typebox.mjs +3 -6596
  81. package/.output/server/_libs/ufo.mjs +1 -54
  82. package/.output/server/_libs/uint8array-extras.mjs +1 -69
  83. package/.output/server/_libs/util-deprecate.mjs +1 -12
  84. package/.output/server/_libs/web-streams-polyfill.mjs +1 -4282
  85. package/.output/server/_libs/when-exit.mjs +1 -53
  86. package/.output/server/_libs/ws.mjs +7 -3715
  87. package/.output/server/_libs/zod-to-json-schema.mjs +5 -1207
  88. package/.output/server/_libs/zod.mjs +59 -9958
  89. package/.output/server/_ssr/empty-plugin-adapters-C3Q1xu4u.mjs +1 -0
  90. package/.output/server/_ssr/index.mjs +2 -1512
  91. package/.output/server/_ssr/publicBasePathContext--TAQS2_5.mjs +1 -0
  92. package/.output/server/_ssr/router-zSWaME0l.mjs +341 -0
  93. package/.output/server/_ssr/start-PDVGOqUN.mjs +1 -0
  94. package/.output/server/_tanstack-start-manifest_v-D7cKwKzM.mjs +1 -0
  95. package/.output/server/index.mjs +1 -320
  96. package/.output/ui/assets/{CompareDrawer-fWsmegqc.js → CompareDrawer-C6KvvPtJ.js} +1 -1
  97. package/.output/ui/assets/{InspectorPet-Z9XIA0t8.js → InspectorPet-CSH6OAhB.js} +1 -1
  98. package/.output/ui/assets/{ProxyViewerContainer-DhIB_ZAU.js → ProxyViewerContainer-vPd7g0Xn.js} +4 -4
  99. package/.output/ui/assets/{ReplayDialog-w_3PENIi.js → ReplayDialog-DbXUcT39.js} +1 -1
  100. package/.output/ui/assets/{RequestAnatomy-Dix0D4G6.js → RequestAnatomy-BWOCIN7J.js} +1 -1
  101. package/.output/ui/assets/{ResponseView-BtlbxW2o.js → ResponseView-BqDbTzFs.js} +1 -1
  102. package/.output/ui/assets/{StreamingChunkSequence-BqNQJASb.js → StreamingChunkSequence-UHl2g6w6.js} +1 -1
  103. package/.output/ui/assets/{_sessionId-DPiw4uu2.js → _sessionId-B2S61lDJ.js} +1 -1
  104. package/.output/ui/assets/{_sessionId-Bo9J8C5J.js → _sessionId-CS6hqj8-.js} +1 -1
  105. package/.output/ui/assets/{index-BL5id77_.js → index-C6V66rNI.js} +1 -1
  106. package/.output/ui/assets/{index-icwV1YtX.js → index-DY5xBYHr.js} +1 -1
  107. package/.output/ui/assets/{index-Wd6TK76x.js → index-DgyIeqyV.js} +2 -2
  108. package/.output/ui/assets/{index-CWSVfojK.js → index-HLs5jTyi.js} +1 -1
  109. package/.output/ui/assets/{json-viewer-Cpr3uw1I.js → json-viewer-i5LcN8e7.js} +1 -1
  110. package/.output/ui/assets/{jszip.min-Cncg6JOi.js → jszip.min-yNpb9qnf.js} +1 -1
  111. package/.output/ui/index.html +1 -1
  112. package/.output/workers/logFinalizer.worker.js +41 -17739
  113. package/.output/workers/sessionWorkerEntry.js +41 -17735
  114. package/package.json +7 -7
  115. package/.output/server/_ssr/empty-plugin-adapters-BFgPZ6_d.mjs +0 -6
  116. package/.output/server/_ssr/publicBasePathContext-IH2ilOfu.mjs +0 -176
  117. package/.output/server/_ssr/router-weYHAqCb.mjs +0 -27177
  118. package/.output/server/_ssr/start-COQu_AgD.mjs +0 -57
  119. package/.output/server/_tanstack-start-manifest_v-ClTaMkEj.mjs +0 -4
@@ -1,848 +1 @@
1
- import { r as reactExports, j as jsxRuntimeExports, R as React } from "./react.mjs";
2
- import { i as invariant, a as isDangerousProtocol, e as exactPathTest, r as removeTrailingSlash, h as hasKeys, d as deepEqual, f as functionalUpdate, B as BaseRootRoute, b as BaseRoute, c as isNotFound, g as getScrollRestorationScriptForRouter, j as rootRouteId, k as isServer, l as isRedirect, m as createNonReactiveReadonlyStore, n as createNonReactiveMutableStore, R as RouterCore, t as transformReadableStreamWithRouter, o as createSsrStreamResponse, p as transformPipeableStreamWithRouter } from "./tanstack__router-core.mjs";
3
- import { R as ReactDOMServer } from "./react-dom.mjs";
4
- import { PassThrough } from "node:stream";
5
- import { i as isbot } from "./isbot.mjs";
6
- function useForwardedRef(ref) {
7
- const innerRef = reactExports.useRef(null);
8
- reactExports.useImperativeHandle(ref, () => innerRef.current, []);
9
- return innerRef;
10
- }
11
- function CatchBoundary(props) {
12
- const errorComponent = props.errorComponent ?? ErrorComponent;
13
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CatchBoundaryImpl, {
14
- getResetKey: props.getResetKey,
15
- onCatch: props.onCatch,
16
- children: ({ error, reset }) => {
17
- if (error) return reactExports.createElement(errorComponent, {
18
- error,
19
- reset
20
- });
21
- return props.children;
22
- }
23
- });
24
- }
25
- var CatchBoundaryImpl = class extends reactExports.Component {
26
- constructor(..._args) {
27
- super(..._args);
28
- this.state = { error: null };
29
- }
30
- static getDerivedStateFromProps(props, state) {
31
- const resetKey = props.getResetKey();
32
- if (state.error && state.resetKey !== resetKey) return {
33
- resetKey,
34
- error: null
35
- };
36
- return { resetKey };
37
- }
38
- static getDerivedStateFromError(error) {
39
- return { error };
40
- }
41
- reset() {
42
- this.setState({ error: null });
43
- }
44
- componentDidCatch(error, errorInfo) {
45
- if (this.props.onCatch) this.props.onCatch(error, errorInfo);
46
- }
47
- render() {
48
- return this.props.children({
49
- error: this.state.error,
50
- reset: () => {
51
- this.reset();
52
- }
53
- });
54
- }
55
- };
56
- function ErrorComponent({ error }) {
57
- const [show, setShow] = reactExports.useState(false);
58
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
59
- style: {
60
- padding: ".5rem",
61
- maxWidth: "100%"
62
- },
63
- children: [
64
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
65
- style: {
66
- display: "flex",
67
- alignItems: "center",
68
- gap: ".5rem"
69
- },
70
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("strong", {
71
- style: { fontSize: "1rem" },
72
- children: "Something went wrong!"
73
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("button", {
74
- style: {
75
- appearance: "none",
76
- fontSize: ".6em",
77
- border: "1px solid currentColor",
78
- padding: ".1rem .2rem",
79
- fontWeight: "bold",
80
- borderRadius: ".25rem"
81
- },
82
- onClick: () => setShow((d) => !d),
83
- children: show ? "Hide Error" : "Show Error"
84
- })]
85
- }),
86
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: ".25rem" } }),
87
- show ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", {
88
- style: {
89
- fontSize: ".7em",
90
- border: "1px solid red",
91
- borderRadius: ".25rem",
92
- padding: ".3rem",
93
- color: "red",
94
- overflow: "auto"
95
- },
96
- children: error.message ? /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: error.message }) : null
97
- }) }) : null
98
- ]
99
- });
100
- }
101
- function ClientOnly({ children, fallback = null }) {
102
- return useHydrated() ? /* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, { children }) : /* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, { children: fallback });
103
- }
104
- function useHydrated() {
105
- return React.useSyncExternalStore(subscribe, () => true, () => false);
106
- }
107
- function subscribe() {
108
- return () => {
109
- };
110
- }
111
- var routerContext = reactExports.createContext(null);
112
- function useRouter(opts) {
113
- const value = reactExports.useContext(routerContext);
114
- return value;
115
- }
116
- var matchContext = reactExports.createContext(void 0);
117
- var dummyMatchContext = reactExports.createContext(void 0);
118
- function useMatch(opts) {
119
- const router = useRouter();
120
- const nearestMatchId = reactExports.useContext(opts.from ? dummyMatchContext : matchContext);
121
- const matchStore = opts.from ? router.stores.getRouteMatchStore(opts.from) : router.stores.matchStores.get(nearestMatchId);
122
- {
123
- const match = matchStore?.get();
124
- if (!match) {
125
- if (opts.shouldThrow ?? true) {
126
- invariant();
127
- }
128
- return;
129
- }
130
- return opts.select ? opts.select(match) : match;
131
- }
132
- }
133
- function useLoaderData(opts) {
134
- return useMatch({
135
- from: opts.from,
136
- strict: opts.strict,
137
- structuralSharing: opts.structuralSharing,
138
- select: (match) => {
139
- return opts.select ? opts.select(match.loaderData) : match.loaderData;
140
- }
141
- });
142
- }
143
- function useLoaderDeps(opts) {
144
- const { select, ...rest } = opts;
145
- return useMatch({
146
- ...rest,
147
- select: (match) => {
148
- return select ? select(match.loaderDeps) : match.loaderDeps;
149
- }
150
- });
151
- }
152
- function useParams(opts) {
153
- return useMatch({
154
- from: opts.from,
155
- shouldThrow: opts.shouldThrow,
156
- structuralSharing: opts.structuralSharing,
157
- strict: opts.strict,
158
- select: (match) => {
159
- const params = opts.strict === false ? match.params : match._strictParams;
160
- return opts.select ? opts.select(params) : params;
161
- }
162
- });
163
- }
164
- function useSearch(opts) {
165
- return useMatch({
166
- from: opts.from,
167
- strict: opts.strict,
168
- shouldThrow: opts.shouldThrow,
169
- structuralSharing: opts.structuralSharing,
170
- select: (match) => {
171
- return opts.select ? opts.select(match.search) : match.search;
172
- }
173
- });
174
- }
175
- function useNavigate(_defaultOpts) {
176
- const router = useRouter();
177
- return reactExports.useCallback((options) => {
178
- return router.navigate({
179
- ...options,
180
- from: options.from ?? _defaultOpts?.from
181
- });
182
- }, [_defaultOpts?.from, router]);
183
- }
184
- function useRouteContext(opts) {
185
- return useMatch({
186
- ...opts,
187
- select: (match) => opts.select ? opts.select(match.context) : match.context
188
- });
189
- }
190
- function useLinkProps(options, forwardedRef) {
191
- const router = useRouter();
192
- const innerRef = useForwardedRef(forwardedRef);
193
- const { activeProps, inactiveProps, activeOptions, to, preload: userPreload, preloadDelay: userPreloadDelay, preloadIntentProximity: _preloadIntentProximity, hashScrollIntoView, replace, startTransition, resetScroll, viewTransition, children, target, disabled, style, className, onClick, onBlur, onFocus, onMouseEnter, onMouseLeave, onTouchStart, ignoreBlocker, params: _params, search: _search, hash: _hash, state: _state, mask: _mask, reloadDocument: _reloadDocument, unsafeRelative: _unsafeRelative, from: _from, _fromLocation, ...propsSafeToSpread } = options;
194
- {
195
- const safeInternal = isSafeInternal(to);
196
- if (typeof to === "string" && !safeInternal && to.indexOf(":") > -1) try {
197
- new URL(to);
198
- if (isDangerousProtocol(to, router.protocolAllowlist)) {
199
- if (false) ;
200
- return {
201
- ...propsSafeToSpread,
202
- ref: innerRef,
203
- href: void 0,
204
- ...children && { children },
205
- ...target && { target },
206
- ...disabled && { disabled },
207
- ...style && { style },
208
- ...className && { className }
209
- };
210
- }
211
- return {
212
- ...propsSafeToSpread,
213
- ref: innerRef,
214
- href: to,
215
- ...children && { children },
216
- ...target && { target },
217
- ...disabled && { disabled },
218
- ...style && { style },
219
- ...className && { className }
220
- };
221
- } catch {
222
- }
223
- const next2 = router.buildLocation({
224
- ...options,
225
- from: options.from
226
- });
227
- const hrefOption2 = getHrefOption(next2.maskedLocation ? next2.maskedLocation.publicHref : next2.publicHref, next2.maskedLocation ? next2.maskedLocation.external : next2.external, router.history, disabled);
228
- const externalLink2 = (() => {
229
- if (hrefOption2?.external) {
230
- if (isDangerousProtocol(hrefOption2.href, router.protocolAllowlist)) {
231
- return;
232
- }
233
- return hrefOption2.href;
234
- }
235
- if (safeInternal) return void 0;
236
- if (typeof to === "string" && to.indexOf(":") > -1) try {
237
- new URL(to);
238
- if (isDangerousProtocol(to, router.protocolAllowlist)) {
239
- if (false) ;
240
- return;
241
- }
242
- return to;
243
- } catch {
244
- }
245
- })();
246
- const isActive2 = (() => {
247
- if (externalLink2) return false;
248
- const currentLocation2 = router.stores.location.get();
249
- const exact = activeOptions?.exact ?? false;
250
- if (exact) {
251
- if (!exactPathTest(currentLocation2.pathname, next2.pathname, router.basepath)) return false;
252
- } else {
253
- const currentPathSplit = removeTrailingSlash(currentLocation2.pathname, router.basepath);
254
- const nextPathSplit = removeTrailingSlash(next2.pathname, router.basepath);
255
- if (!(currentPathSplit.startsWith(nextPathSplit) && (currentPathSplit.length === nextPathSplit.length || currentPathSplit[nextPathSplit.length] === "/"))) return false;
256
- }
257
- if (activeOptions?.includeSearch ?? true) {
258
- if (currentLocation2.search !== next2.search) {
259
- const currentSearchEmpty = !currentLocation2.search || typeof currentLocation2.search === "object" && !hasKeys(currentLocation2.search);
260
- const nextSearchEmpty = !next2.search || typeof next2.search === "object" && !hasKeys(next2.search);
261
- if (!(currentSearchEmpty && nextSearchEmpty)) {
262
- if (!deepEqual(currentLocation2.search, next2.search, {
263
- partial: !exact,
264
- ignoreUndefined: !activeOptions?.explicitUndefined
265
- })) return false;
266
- }
267
- }
268
- }
269
- if (activeOptions?.includeHash) return false;
270
- return true;
271
- })();
272
- if (externalLink2) return {
273
- ...propsSafeToSpread,
274
- ref: innerRef,
275
- href: externalLink2,
276
- ...children && { children },
277
- ...target && { target },
278
- ...disabled && { disabled },
279
- ...style && { style },
280
- ...className && { className }
281
- };
282
- const resolvedActiveProps2 = isActive2 ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
283
- const resolvedInactiveProps2 = isActive2 ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
284
- const resolvedStyle2 = (() => {
285
- const baseStyle = style;
286
- const activeStyle = resolvedActiveProps2.style;
287
- const inactiveStyle = resolvedInactiveProps2.style;
288
- if (!baseStyle && !activeStyle && !inactiveStyle) return;
289
- if (baseStyle && !activeStyle && !inactiveStyle) return baseStyle;
290
- if (!baseStyle && activeStyle && !inactiveStyle) return activeStyle;
291
- if (!baseStyle && !activeStyle && inactiveStyle) return inactiveStyle;
292
- return {
293
- ...baseStyle,
294
- ...activeStyle,
295
- ...inactiveStyle
296
- };
297
- })();
298
- const resolvedClassName2 = (() => {
299
- const baseClassName = className;
300
- const activeClassName = resolvedActiveProps2.className;
301
- const inactiveClassName = resolvedInactiveProps2.className;
302
- if (!baseClassName && !activeClassName && !inactiveClassName) return "";
303
- let out = "";
304
- if (baseClassName) out = baseClassName;
305
- if (activeClassName) out = out ? `${out} ${activeClassName}` : activeClassName;
306
- if (inactiveClassName) out = out ? `${out} ${inactiveClassName}` : inactiveClassName;
307
- return out;
308
- })();
309
- return {
310
- ...propsSafeToSpread,
311
- ...resolvedActiveProps2,
312
- ...resolvedInactiveProps2,
313
- href: hrefOption2?.href,
314
- ref: innerRef,
315
- disabled: !!disabled,
316
- target,
317
- ...resolvedStyle2 && { style: resolvedStyle2 },
318
- ...resolvedClassName2 && { className: resolvedClassName2 },
319
- ...disabled && STATIC_DISABLED_PROPS,
320
- ...isActive2 && STATIC_ACTIVE_PROPS
321
- };
322
- }
323
- }
324
- var STATIC_EMPTY_OBJECT = {};
325
- var STATIC_ACTIVE_OBJECT = { className: "active" };
326
- var STATIC_DISABLED_PROPS = {
327
- role: "link",
328
- "aria-disabled": true
329
- };
330
- var STATIC_ACTIVE_PROPS = {
331
- "data-status": "active",
332
- "aria-current": "page"
333
- };
334
- function getHrefOption(publicHref, external, history, disabled) {
335
- if (disabled) return void 0;
336
- if (external) return {
337
- href: publicHref,
338
- external: true
339
- };
340
- return {
341
- href: history.createHref(publicHref) || "/",
342
- external: false
343
- };
344
- }
345
- function isSafeInternal(to) {
346
- if (typeof to !== "string") return false;
347
- const zero = to.charCodeAt(0);
348
- if (zero === 47) return to.charCodeAt(1) !== 47;
349
- return zero === 46;
350
- }
351
- var Link = reactExports.forwardRef((props, ref) => {
352
- const { _asChild, ...rest } = props;
353
- const { type: _type, ...linkProps } = useLinkProps(rest, ref);
354
- const children = typeof rest.children === "function" ? rest.children({ isActive: linkProps["data-status"] === "active" }) : rest.children;
355
- if (!_asChild) {
356
- const { disabled: _, ...rest2 } = linkProps;
357
- return reactExports.createElement("a", rest2, children);
358
- }
359
- return reactExports.createElement(_asChild, linkProps, children);
360
- });
361
- var Route = class extends BaseRoute {
362
- /**
363
- * @deprecated Use the `createRoute` function instead.
364
- */
365
- constructor(options) {
366
- super(options);
367
- this.useMatch = (opts) => {
368
- return useMatch({
369
- select: opts?.select,
370
- from: this.id,
371
- structuralSharing: opts?.structuralSharing
372
- });
373
- };
374
- this.useRouteContext = (opts) => {
375
- return useRouteContext({
376
- ...opts,
377
- from: this.id
378
- });
379
- };
380
- this.useSearch = (opts) => {
381
- return useSearch({
382
- select: opts?.select,
383
- structuralSharing: opts?.structuralSharing,
384
- from: this.id
385
- });
386
- };
387
- this.useParams = (opts) => {
388
- return useParams({
389
- select: opts?.select,
390
- structuralSharing: opts?.structuralSharing,
391
- from: this.id
392
- });
393
- };
394
- this.useLoaderDeps = (opts) => {
395
- return useLoaderDeps({
396
- ...opts,
397
- from: this.id
398
- });
399
- };
400
- this.useLoaderData = (opts) => {
401
- return useLoaderData({
402
- ...opts,
403
- from: this.id
404
- });
405
- };
406
- this.useNavigate = () => {
407
- return useNavigate({ from: this.fullPath });
408
- };
409
- this.Link = React.forwardRef((props, ref) => {
410
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, {
411
- ref,
412
- from: this.fullPath,
413
- ...props
414
- });
415
- });
416
- }
417
- };
418
- function createRoute(options) {
419
- return new Route(options);
420
- }
421
- var RootRoute = class extends BaseRootRoute {
422
- /**
423
- * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
424
- */
425
- constructor(options) {
426
- super(options);
427
- this.useMatch = (opts) => {
428
- return useMatch({
429
- select: opts?.select,
430
- from: this.id,
431
- structuralSharing: opts?.structuralSharing
432
- });
433
- };
434
- this.useRouteContext = (opts) => {
435
- return useRouteContext({
436
- ...opts,
437
- from: this.id
438
- });
439
- };
440
- this.useSearch = (opts) => {
441
- return useSearch({
442
- select: opts?.select,
443
- structuralSharing: opts?.structuralSharing,
444
- from: this.id
445
- });
446
- };
447
- this.useParams = (opts) => {
448
- return useParams({
449
- select: opts?.select,
450
- structuralSharing: opts?.structuralSharing,
451
- from: this.id
452
- });
453
- };
454
- this.useLoaderDeps = (opts) => {
455
- return useLoaderDeps({
456
- ...opts,
457
- from: this.id
458
- });
459
- };
460
- this.useLoaderData = (opts) => {
461
- return useLoaderData({
462
- ...opts,
463
- from: this.id
464
- });
465
- };
466
- this.useNavigate = () => {
467
- return useNavigate({ from: this.fullPath });
468
- };
469
- this.Link = React.forwardRef((props, ref) => {
470
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, {
471
- ref,
472
- from: this.fullPath,
473
- ...props
474
- });
475
- });
476
- }
477
- };
478
- function createRootRoute(options) {
479
- return new RootRoute(options);
480
- }
481
- function createFileRoute(path) {
482
- return new FileRoute(path, { silent: true }).createRoute;
483
- }
484
- var FileRoute = class {
485
- constructor(path, _opts) {
486
- this.path = path;
487
- this.createRoute = (options) => {
488
- const route = createRoute(options);
489
- route.isRoot = false;
490
- return route;
491
- };
492
- this.silent = _opts?.silent;
493
- }
494
- };
495
- function CatchNotFound(props) {
496
- const router = useRouter();
497
- {
498
- const resetKey = `not-found-${router.stores.location.get().pathname}-${router.stores.status.get()}`;
499
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CatchBoundary, {
500
- getResetKey: () => resetKey,
501
- onCatch: (error, errorInfo) => {
502
- if (isNotFound(error)) props.onCatch?.(error, errorInfo);
503
- else throw error;
504
- },
505
- errorComponent: ({ error }) => {
506
- if (isNotFound(error)) return props.fallback?.(error);
507
- else throw error;
508
- },
509
- children: props.children
510
- });
511
- }
512
- }
513
- function DefaultGlobalNotFound() {
514
- return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Not Found" });
515
- }
516
- function ScriptOnce({ children }) {
517
- const router = useRouter();
518
- return /* @__PURE__ */ jsxRuntimeExports.jsx("script", {
519
- nonce: router.options.ssr?.nonce,
520
- dangerouslySetInnerHTML: { __html: children + ";document.currentScript.remove()" }
521
- });
522
- }
523
- function SafeFragment(props) {
524
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props.children });
525
- }
526
- function renderRouteNotFound(router, route, data) {
527
- if (!route.options.notFoundComponent) {
528
- if (router.options.defaultNotFoundComponent) return /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.defaultNotFoundComponent, { ...data });
529
- return /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultGlobalNotFound, {});
530
- }
531
- return /* @__PURE__ */ jsxRuntimeExports.jsx(route.options.notFoundComponent, { ...data });
532
- }
533
- function ScrollRestoration() {
534
- const script = getScrollRestorationScriptForRouter(useRouter());
535
- if (!script) return null;
536
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ScriptOnce, { children: script });
537
- }
538
- var Match = reactExports.memo(function MatchImpl({ matchId }) {
539
- const router = useRouter();
540
- {
541
- const match2 = router.stores.matchStores.get(matchId)?.get();
542
- if (!match2) {
543
- invariant();
544
- }
545
- const routeId = match2.routeId;
546
- const parentRouteId = router.routesById[routeId].parentRoute?.id;
547
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MatchView, {
548
- router,
549
- matchId,
550
- resetKey: router.stores.loadedAt.get(),
551
- matchState: {
552
- routeId,
553
- ssr: match2.ssr,
554
- _displayPending: match2._displayPending,
555
- parentRouteId
556
- }
557
- });
558
- }
559
- });
560
- function MatchView({ router, matchId, resetKey, matchState }) {
561
- const route = router.routesById[matchState.routeId];
562
- const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
563
- const pendingElement = PendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(PendingComponent, {}) : null;
564
- const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
565
- const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
566
- const routeNotFoundComponent = route.isRoot ? route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component : route.options.notFoundComponent;
567
- const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
568
- const ResolvedSuspenseBoundary = (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? reactExports.Suspense : SafeFragment;
569
- const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
570
- const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
571
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment, { children: [/* @__PURE__ */ jsxRuntimeExports.jsx(matchContext.Provider, {
572
- value: matchId,
573
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResolvedSuspenseBoundary, {
574
- fallback: pendingElement,
575
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResolvedCatchBoundary, {
576
- getResetKey: () => resetKey,
577
- errorComponent: routeErrorComponent || ErrorComponent,
578
- onCatch: (error, errorInfo) => {
579
- if (isNotFound(error)) {
580
- error.routeId ??= matchState.routeId;
581
- throw error;
582
- }
583
- routeOnCatch?.(error, errorInfo);
584
- },
585
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResolvedNotFoundBoundary, {
586
- fallback: (error) => {
587
- error.routeId ??= matchState.routeId;
588
- if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot) throw error;
589
- return reactExports.createElement(routeNotFoundComponent, error);
590
- },
591
- children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ jsxRuntimeExports.jsx(ClientOnly, {
592
- fallback: pendingElement,
593
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MatchInner, { matchId })
594
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MatchInner, { matchId })
595
- })
596
- })
597
- })
598
- }), matchState.parentRouteId === rootRouteId ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [/* @__PURE__ */ jsxRuntimeExports.jsx(OnRendered, {}), router.options.scrollRestoration && isServer ? /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollRestoration, {}) : null] }) : null] });
599
- }
600
- function OnRendered() {
601
- useRouter();
602
- return null;
603
- }
604
- var MatchInner = reactExports.memo(function MatchInnerImpl({ matchId }) {
605
- const router = useRouter();
606
- const getMatchPromise = (match2, key2) => {
607
- return router.getMatch(match2.id)?._nonReactive[key2] ?? match2._nonReactive[key2];
608
- };
609
- {
610
- const match2 = router.stores.matchStores.get(matchId)?.get();
611
- if (!match2) {
612
- invariant();
613
- }
614
- const routeId2 = match2.routeId;
615
- const route2 = router.routesById[routeId2];
616
- const remountDeps = (router.routesById[routeId2].options.remountDeps ?? router.options.defaultRemountDeps)?.({
617
- routeId: routeId2,
618
- loaderDeps: match2.loaderDeps,
619
- params: match2._strictParams,
620
- search: match2._strictSearch
621
- });
622
- const key2 = remountDeps ? JSON.stringify(remountDeps) : void 0;
623
- const Comp = route2.options.component ?? router.options.defaultComponent;
624
- const out2 = Comp ? /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, {}, key2) : /* @__PURE__ */ jsxRuntimeExports.jsx(Outlet, {});
625
- if (match2._displayPending) throw getMatchPromise(match2, "displayPendingPromise");
626
- if (match2._forcePending) throw getMatchPromise(match2, "minPendingPromise");
627
- if (match2.status === "pending") throw getMatchPromise(match2, "loadPromise");
628
- if (match2.status === "notFound") {
629
- if (!isNotFound(match2.error)) {
630
- invariant();
631
- }
632
- return renderRouteNotFound(router, route2, match2.error);
633
- }
634
- if (match2.status === "redirected") {
635
- if (!isRedirect(match2.error)) {
636
- invariant();
637
- }
638
- throw getMatchPromise(match2, "loadPromise");
639
- }
640
- if (match2.status === "error") return /* @__PURE__ */ jsxRuntimeExports.jsx((route2.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
641
- error: match2.error,
642
- reset: void 0,
643
- info: { componentStack: "" }
644
- });
645
- return out2;
646
- }
647
- });
648
- var Outlet = reactExports.memo(function OutletImpl() {
649
- const router = useRouter();
650
- const matchId = reactExports.useContext(matchContext);
651
- let routeId;
652
- let parentGlobalNotFound = false;
653
- let childMatchId;
654
- {
655
- const matches = router.stores.matches.get();
656
- const parentIndex = matchId ? matches.findIndex((match) => match.id === matchId) : -1;
657
- const parentMatch = parentIndex >= 0 ? matches[parentIndex] : void 0;
658
- routeId = parentMatch?.routeId;
659
- parentGlobalNotFound = parentMatch?.globalNotFound ?? false;
660
- childMatchId = parentIndex >= 0 ? matches[parentIndex + 1]?.id : void 0;
661
- }
662
- const route = routeId ? router.routesById[routeId] : void 0;
663
- const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.defaultPendingComponent, {}) : null;
664
- if (parentGlobalNotFound) {
665
- if (!route) {
666
- invariant();
667
- }
668
- return renderRouteNotFound(router, route, void 0);
669
- }
670
- if (!childMatchId) return null;
671
- const nextMatch = /* @__PURE__ */ jsxRuntimeExports.jsx(Match, { matchId: childMatchId });
672
- if (routeId === rootRouteId) return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, {
673
- fallback: pendingElement,
674
- children: nextMatch
675
- });
676
- return nextMatch;
677
- });
678
- function Matches() {
679
- const router = useRouter();
680
- const PendingComponent = router.routesById[rootRouteId].options.pendingComponent ?? router.options.defaultPendingComponent;
681
- const pendingElement = PendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(PendingComponent, {}) : null;
682
- const inner = /* @__PURE__ */ jsxRuntimeExports.jsxs(SafeFragment, {
683
- fallback: pendingElement,
684
- children: [false, /* @__PURE__ */ jsxRuntimeExports.jsx(MatchesInner, {})]
685
- });
686
- return router.options.InnerWrap ? /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.InnerWrap, { children: inner }) : inner;
687
- }
688
- function MatchesInner() {
689
- const router = useRouter();
690
- const matchId = router.stores.firstId.get();
691
- const resetKey = router.stores.loadedAt.get();
692
- const matchComponent = matchId ? /* @__PURE__ */ jsxRuntimeExports.jsx(Match, { matchId }) : null;
693
- return /* @__PURE__ */ jsxRuntimeExports.jsx(matchContext.Provider, {
694
- value: matchId,
695
- children: router.options.disableGlobalCatchBoundary ? matchComponent : /* @__PURE__ */ jsxRuntimeExports.jsx(CatchBoundary, {
696
- getResetKey: () => resetKey,
697
- errorComponent: ErrorComponent,
698
- onCatch: void 0,
699
- children: matchComponent
700
- })
701
- });
702
- }
703
- var getStoreFactory = (opts) => {
704
- return {
705
- createMutableStore: createNonReactiveMutableStore,
706
- createReadonlyStore: createNonReactiveReadonlyStore,
707
- batch: (fn) => fn()
708
- };
709
- };
710
- var createRouter = (options) => {
711
- return new Router(options);
712
- };
713
- var Router = class extends RouterCore {
714
- constructor(options) {
715
- super(options, getStoreFactory);
716
- }
717
- };
718
- function RouterContextProvider({ router, children, ...rest }) {
719
- if (hasKeys(rest)) router.update({
720
- ...router.options,
721
- ...rest,
722
- context: {
723
- ...router.options.context,
724
- ...rest.context
725
- }
726
- });
727
- const provider = /* @__PURE__ */ jsxRuntimeExports.jsx(routerContext.Provider, {
728
- value: router,
729
- children
730
- });
731
- if (router.options.Wrap) return /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.Wrap, { children: provider });
732
- return provider;
733
- }
734
- function RouterProvider({ router, ...rest }) {
735
- return /* @__PURE__ */ jsxRuntimeExports.jsx(RouterContextProvider, {
736
- router,
737
- ...rest,
738
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Matches, {})
739
- });
740
- }
741
- var noop = () => {
742
- };
743
- async function waitForReadyOrAbort(ready, signal) {
744
- let cleanup = noop;
745
- try {
746
- await Promise.race([ready, new Promise((resolve) => {
747
- const onAbort = () => resolve();
748
- cleanup = () => signal.removeEventListener("abort", onAbort);
749
- signal.addEventListener("abort", onAbort, { once: true });
750
- if (signal.aborted) resolve();
751
- })]);
752
- } finally {
753
- cleanup();
754
- }
755
- }
756
- var isAbortError = (request, error) => request.signal.aborted && error === request.signal.reason || error instanceof Error && error.name === "AbortError";
757
- var renderRouterToStream = async ({ request, router, responseHeaders, children }) => {
758
- if (typeof ReactDOMServer.renderToReadableStream === "function") {
759
- const stream = await ReactDOMServer.renderToReadableStream(children, {
760
- signal: request.signal,
761
- nonce: router.options.ssr?.nonce,
762
- progressiveChunkSize: Number.POSITIVE_INFINITY,
763
- onError: (error, info) => {
764
- if (!isAbortError(request, error)) console.error("Error in renderToReadableStream:", error, info);
765
- }
766
- });
767
- if (isbot(request.headers.get("User-Agent"))) await waitForReadyOrAbort(stream.allReady, request.signal);
768
- const responseStream = transformReadableStreamWithRouter(router, stream, { onAbort: () => stream.cancel().catch(() => {
769
- }) });
770
- return createSsrStreamResponse(router, new Response(responseStream, {
771
- status: router.stores.statusCode.get(),
772
- headers: responseHeaders
773
- }));
774
- }
775
- if (typeof ReactDOMServer.renderToPipeableStream === "function") {
776
- const reactAppPassthrough = new PassThrough();
777
- let pipeable;
778
- let responseAttached = false;
779
- let aborted = false;
780
- let endedBeforeAttach = false;
781
- let pendingAbortReason;
782
- const toError = (reason) => reason instanceof Error ? reason : new Error(String(reason ?? "SSR aborted"));
783
- const destroyError = (reason) => reason === void 0 ? void 0 : toError(reason);
784
- const pendingDestroyError = () => pendingAbortReason === void 0 ? toError(pendingAbortReason) : destroyError(pendingAbortReason);
785
- const finishPassThrough = (reason, opts) => {
786
- if (reactAppPassthrough.destroyed) return;
787
- if (responseAttached) reactAppPassthrough.destroy(opts?.defaultError ? toError(reason) : destroyError(reason));
788
- else endedBeforeAttach = true;
789
- };
790
- const abortPipeable = (reason, opts) => {
791
- if (aborted) return;
792
- aborted = true;
793
- pendingAbortReason = reason;
794
- const err = toError(reason);
795
- try {
796
- pipeable?.abort(err);
797
- } catch {
798
- }
799
- finishPassThrough(reason, opts);
800
- };
801
- if (request.signal.aborted) abortPipeable(request.signal.reason);
802
- else {
803
- const onRequestAbort = () => abortPipeable(request.signal.reason);
804
- request.signal.addEventListener("abort", onRequestAbort, { once: true });
805
- router.serverSsr?.onCleanup(() => {
806
- request.signal.removeEventListener("abort", onRequestAbort);
807
- });
808
- }
809
- try {
810
- pipeable = ReactDOMServer.renderToPipeableStream(children, {
811
- nonce: router.options.ssr?.nonce,
812
- progressiveChunkSize: Number.POSITIVE_INFINITY,
813
- ...isbot(request.headers.get("User-Agent")) ? { onAllReady() {
814
- pipeable.pipe(reactAppPassthrough);
815
- } } : { onShellReady() {
816
- pipeable.pipe(reactAppPassthrough);
817
- } },
818
- onError: (error, info) => {
819
- if (!isAbortError(request, error)) console.error("Error in renderToPipeableStream:", error, info);
820
- abortPipeable(error, { defaultError: true });
821
- }
822
- });
823
- } catch (e) {
824
- console.error("Error in renderToPipeableStream:", e);
825
- router.serverSsr?.cleanup();
826
- throw e;
827
- }
828
- const responseStream = transformPipeableStreamWithRouter(router, reactAppPassthrough, { onAbort: abortPipeable });
829
- responseAttached = true;
830
- if (endedBeforeAttach) reactAppPassthrough.destroy(pendingDestroyError());
831
- if (aborted && pipeable) try {
832
- pipeable.abort(toError(pendingAbortReason));
833
- } catch {
834
- }
835
- return createSsrStreamResponse(router, new Response(responseStream, {
836
- status: router.stores.statusCode.get(),
837
- headers: responseHeaders
838
- }));
839
- }
840
- throw new Error("No renderToReadableStream or renderToPipeableStream found in react-dom/server. Ensure you are using a version of react-dom that supports streaming.");
841
- };
842
- export {
843
- RouterProvider as R,
844
- createRootRoute as a,
845
- createFileRoute as b,
846
- createRouter as c,
847
- renderRouterToStream as r
848
- };
1
+ import{r as l,j as s,R as N}from"./react.mjs";import{i as T,a as U,e as he,r as X,h as V,d as me,f as Z,B as pe,b as ge,c as L,g as ve,j as $,k as Se,l as xe,m as Re,n as ye,R as Ce,t as be,o as q,p as Ie}from"./tanstack__router-core.mjs";import{R as k}from"./react-dom.mjs";import{PassThrough as Pe}from"node:stream";import{i as ee}from"./isbot.mjs";function je(e){const t=l.useRef(null);return l.useImperativeHandle(e,()=>t.current,[]),t}function G(e){const t=e.errorComponent??M;return s.jsx(Ee,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:r,reset:n})=>r?l.createElement(t,{error:r,reset:n}):e.children})}var Ee=class extends l.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const r=e.getResetKey();return t.error&&t.resetKey!==r?{resetKey:r,error:null}:{resetKey:r}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function M({error:e}){const[t,r]=l.useState(!1);return s.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[s.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),s.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>r(n=>!n),children:t?"Hide Error":"Show Error"})]}),s.jsx("div",{style:{height:".25rem"}}),t?s.jsx("div",{children:s.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?s.jsx("code",{children:e.message}):null})}):null]})}function we({children:e,fallback:t=null}){return Te()?s.jsx(N.Fragment,{children:e}):s.jsx(N.Fragment,{children:t})}function Te(){return N.useSyncExternalStore(Ne,()=>!0,()=>!1)}function Ne(){return()=>{}}var ne=l.createContext(null);function y(e){return l.useContext(ne)}var B=l.createContext(void 0),_e=l.createContext(void 0);function j(e){const t=y(),r=l.useContext(e.from?_e:B),n=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(r);{const o=n?.get();if(!o){(e.shouldThrow??!0)&&T();return}return e.select?e.select(o):o}}function oe(e){return j({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function se(e){const{select:t,...r}=e;return j({...r,select:n=>t?t(n.loaderDeps):n.loaderDeps})}function ae(e){return j({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const r=e.strict===!1?t.params:t._strictParams;return e.select?e.select(r):r}})}function ie(e){return j({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function ce(e){const t=y();return l.useCallback(r=>t.navigate({...r,from:r.from??e?.from}),[e?.from,t])}function ue(e){return j({...e,select:t=>e.select?e.select(t.context):t.context})}function Fe(e,t){const r=y(),n=je(t),{activeProps:o,inactiveProps:a,activeOptions:u,to:c,preload:R,preloadDelay:f,preloadIntentProximity:h,hashScrollIntoView:b,replace:E,startTransition:_,resetScroll:m,viewTransition:F,children:i,target:S,disabled:C,style:I,className:P,onClick:rt,onBlur:nt,onFocus:ot,onMouseEnter:st,onMouseLeave:at,onTouchStart:it,ignoreBlocker:ct,params:ut,search:lt,hash:dt,state:ft,mask:ht,reloadDocument:mt,unsafeRelative:pt,from:gt,_fromLocation:vt,...A}=e;{const J=Me(c);if(typeof c=="string"&&!J&&c.indexOf(":")>-1)try{return new URL(c),U(c,r.protocolAllowlist)?{...A,ref:n,href:void 0,...i&&{children:i},...S&&{target:S},...C&&{disabled:C},...I&&{style:I},...P&&{className:P}}:{...A,ref:n,href:c,...i&&{children:i},...S&&{target:S},...C&&{disabled:C},...I&&{style:I},...P&&{className:P}}}catch{}const x=r.buildLocation({...e,from:e.from}),D=Le(x.maskedLocation?x.maskedLocation.publicHref:x.publicHref,x.maskedLocation?x.maskedLocation.external:x.external,r.history,C),O=(()=>{if(D?.external)return U(D.href,r.protocolAllowlist)?void 0:D.href;if(!J&&typeof c=="string"&&c.indexOf(":")>-1)try{return new URL(c),U(c,r.protocolAllowlist)?void 0:c}catch{}})(),K=(()=>{if(O)return!1;const d=r.stores.location.get(),g=u?.exact??!1;if(g){if(!he(d.pathname,x.pathname,r.basepath))return!1}else{const p=X(d.pathname,r.basepath),v=X(x.pathname,r.basepath);if(!(p.startsWith(v)&&(p.length===v.length||p[v.length]==="/")))return!1}if((u?.includeSearch??!0)&&d.search!==x.search){const p=!d.search||typeof d.search=="object"&&!V(d.search),v=!x.search||typeof x.search=="object"&&!V(x.search);if(!(p&&v)&&!me(d.search,x.search,{partial:!g,ignoreUndefined:!u?.explicitUndefined}))return!1}return!u?.includeHash})();if(O)return{...A,ref:n,href:O,...i&&{children:i},...S&&{target:S},...C&&{disabled:C},...I&&{style:I},...P&&{className:P}};const W=K?Z(o,{})??Ae:z,H=K?z:Z(a,{})??z,Y=(()=>{const d=I,g=W.style,p=H.style;if(!(!d&&!g&&!p))return d&&!g&&!p?d:!d&&g&&!p?g:!d&&!g&&p?p:{...d,...g,...p}})(),Q=(()=>{const d=P,g=W.className,p=H.className;if(!d&&!g&&!p)return"";let v="";return d&&(v=d),g&&(v=v?`${v} ${g}`:g),p&&(v=v?`${v} ${p}`:p),v})();return{...A,...W,...H,href:D?.href,ref:n,disabled:!!C,target:S,...Y&&{style:Y},...Q&&{className:Q},...C&&De,...K&&ke}}}var z={},Ae={className:"active"},De={role:"link","aria-disabled":!0},ke={"data-status":"active","aria-current":"page"};function Le(e,t,r,n){if(!n)return t?{href:e,external:!0}:{href:r.createHref(e)||"/",external:!1}}function Me(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var le=l.forwardRef((e,t)=>{const{_asChild:r,...n}=e,{type:o,...a}=Fe(n,t),u=typeof n.children=="function"?n.children({isActive:a["data-status"]==="active"}):n.children;if(!r){const{disabled:c,...R}=a;return l.createElement("a",R,u)}return l.createElement(r,a,u)}),Be=class extends ge{constructor(e){super(e),this.useMatch=t=>j({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ue({...t,from:this.id}),this.useSearch=t=>ie({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>ae({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>se({...t,from:this.id}),this.useLoaderData=t=>oe({...t,from:this.id}),this.useNavigate=()=>ce({from:this.fullPath}),this.Link=N.forwardRef((t,r)=>s.jsx(le,{ref:r,from:this.fullPath,...t}))}};function Oe(e){return new Be(e)}var Ke=class extends pe{constructor(e){super(e),this.useMatch=t=>j({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ue({...t,from:this.id}),this.useSearch=t=>ie({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>ae({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>se({...t,from:this.id}),this.useLoaderData=t=>oe({...t,from:this.id}),this.useNavigate=()=>ce({from:this.fullPath}),this.Link=N.forwardRef((t,r)=>s.jsx(le,{ref:r,from:this.fullPath,...t}))}};function bt(e){return new Ke(e)}function It(e){return new We(e,{silent:!0}).createRoute}var We=class{constructor(e,t){this.path=e,this.createRoute=r=>{const n=Oe(r);return n.isRoot=!1,n},this.silent=t?.silent}};function He(e){const t=y();{const r=`not-found-${t.stores.location.get().pathname}-${t.stores.status.get()}`;return s.jsx(G,{getResetKey:()=>r,onCatch:(n,o)=>{if(L(n))e.onCatch?.(n,o);else throw n},errorComponent:({error:n})=>{if(L(n))return e.fallback?.(n);throw n},children:e.children})}}function Ue(){return s.jsx("p",{children:"Not Found"})}function ze({children:e}){const t=y();return s.jsx("script",{nonce:t.options.ssr?.nonce,dangerouslySetInnerHTML:{__html:e+";document.currentScript.remove()"}})}function w(e){return s.jsx(s.Fragment,{children:e.children})}function de(e,t,r){return t.options.notFoundComponent?s.jsx(t.options.notFoundComponent,{...r}):e.options.defaultNotFoundComponent?s.jsx(e.options.defaultNotFoundComponent,{...r}):s.jsx(Ue,{})}function Ve(){const e=ve(y());return e?s.jsx(ze,{children:e}):null}var fe=l.memo(function({matchId:t}){const r=y();{const n=r.stores.matchStores.get(t)?.get();n||T();const o=n.routeId,a=r.routesById[o].parentRoute?.id;return s.jsx($e,{router:r,matchId:t,resetKey:r.stores.loadedAt.get(),matchState:{routeId:o,ssr:n.ssr,_displayPending:n._displayPending,parentRouteId:a}})}});function $e({router:e,matchId:t,resetKey:r,matchState:n}){const o=e.routesById[n.routeId],a=o.options.pendingComponent??e.options.defaultPendingComponent,u=a?s.jsx(a,{}):null,c=o.options.errorComponent??e.options.defaultErrorComponent,R=o.options.onCatch??e.options.defaultOnCatch,f=o.isRoot?o.options.notFoundComponent??e.options.notFoundRoute?.options.component:o.options.notFoundComponent,h=n.ssr===!1||n.ssr==="data-only",b=(!o.isRoot||o.options.wrapInSuspense||h)&&(o.options.wrapInSuspense??a??(o.options.errorComponent?.preload||h))?l.Suspense:w,E=c?G:w,_=f?He:w;return s.jsxs(o.isRoot?o.options.shellComponent??w:w,{children:[s.jsx(B.Provider,{value:t,children:s.jsx(b,{fallback:u,children:s.jsx(E,{getResetKey:()=>r,errorComponent:c||M,onCatch:(m,F)=>{if(L(m))throw m.routeId??=n.routeId,m;R?.(m,F)},children:s.jsx(_,{fallback:m=>{if(m.routeId??=n.routeId,!f||m.routeId&&m.routeId!==n.routeId||!m.routeId&&!o.isRoot)throw m;return l.createElement(f,m)},children:h||n._displayPending?s.jsx(we,{fallback:u,children:s.jsx(te,{matchId:t})}):s.jsx(te,{matchId:t})})})})}),n.parentRouteId===$?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{}),e.options.scrollRestoration&&Se?s.jsx(Ve,{}):null]}):null]})}function Ge(){return y(),null}var te=l.memo(function({matchId:t}){const r=y(),n=(o,a)=>r.getMatch(o.id)?._nonReactive[a]??o._nonReactive[a];{const o=r.stores.matchStores.get(t)?.get();o||T();const a=o.routeId,u=r.routesById[a],c=(r.routesById[a].options.remountDeps??r.options.defaultRemountDeps)?.({routeId:a,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch}),R=c?JSON.stringify(c):void 0,f=u.options.component??r.options.defaultComponent,h=f?s.jsx(f,{},R):s.jsx(Je,{});if(o._displayPending)throw n(o,"displayPendingPromise");if(o._forcePending)throw n(o,"minPendingPromise");if(o.status==="pending")throw n(o,"loadPromise");if(o.status==="notFound")return L(o.error)||T(),de(r,u,o.error);if(o.status==="redirected")throw xe(o.error)||T(),n(o,"loadPromise");return o.status==="error"?s.jsx((u.options.errorComponent??r.options.defaultErrorComponent)||M,{error:o.error,reset:void 0,info:{componentStack:""}}):h}}),Je=l.memo(function(){const t=y(),r=l.useContext(B);let n,o=!1,a;{const f=t.stores.matches.get(),h=r?f.findIndex(E=>E.id===r):-1,b=h>=0?f[h]:void 0;n=b?.routeId,o=b?.globalNotFound??!1,a=h>=0?f[h+1]?.id:void 0}const u=n?t.routesById[n]:void 0,c=t.options.defaultPendingComponent?s.jsx(t.options.defaultPendingComponent,{}):null;if(o)return u||T(),de(t,u,void 0);if(!a)return null;const R=s.jsx(fe,{matchId:a});return n===$?s.jsx(l.Suspense,{fallback:c,children:R}):R});function Ye(){const e=y(),t=e.routesById[$].options.pendingComponent??e.options.defaultPendingComponent,r=t?s.jsx(t,{}):null,n=s.jsxs(w,{fallback:r,children:[!1,s.jsx(Qe,{})]});return e.options.InnerWrap?s.jsx(e.options.InnerWrap,{children:n}):n}function Qe(){const e=y(),t=e.stores.firstId.get(),r=e.stores.loadedAt.get(),n=t?s.jsx(fe,{matchId:t}):null;return s.jsx(B.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?n:s.jsx(G,{getResetKey:()=>r,errorComponent:M,onCatch:void 0,children:n})})}var Xe=e=>({createMutableStore:ye,createReadonlyStore:Re,batch:t=>t()}),Pt=e=>new Ze(e),Ze=class extends Ce{constructor(e){super(e,Xe)}};function qe({router:e,children:t,...r}){V(r)&&e.update({...e.options,...r,context:{...e.options.context,...r.context}});const n=s.jsx(ne.Provider,{value:e,children:t});return e.options.Wrap?s.jsx(e.options.Wrap,{children:n}):n}function jt({router:e,...t}){return s.jsx(qe,{router:e,...t,children:s.jsx(Ye,{})})}var et=()=>{};async function tt(e,t){let r=et;try{await Promise.race([e,new Promise(n=>{const o=()=>n();r=()=>t.removeEventListener("abort",o),t.addEventListener("abort",o,{once:!0}),t.aborted&&n()})])}finally{r()}}var re=(e,t)=>e.signal.aborted&&t===e.signal.reason||t instanceof Error&&t.name==="AbortError",Et=async({request:e,router:t,responseHeaders:r,children:n})=>{if(typeof k.renderToReadableStream=="function"){const o=await k.renderToReadableStream(n,{signal:e.signal,nonce:t.options.ssr?.nonce,progressiveChunkSize:Number.POSITIVE_INFINITY,onError:(u,c)=>{re(e,u)||console.error("Error in renderToReadableStream:",u,c)}});ee(e.headers.get("User-Agent"))&&await tt(o.allReady,e.signal);const a=be(t,o,{onAbort:()=>o.cancel().catch(()=>{})});return q(t,new Response(a,{status:t.stores.statusCode.get(),headers:r}))}if(typeof k.renderToPipeableStream=="function"){const o=new Pe;let a,u=!1,c=!1,R=!1,f;const h=i=>i instanceof Error?i:new Error(String(i??"SSR aborted")),b=i=>i===void 0?void 0:h(i),E=()=>f===void 0?h(f):b(f),_=(i,S)=>{o.destroyed||(u?o.destroy(S?.defaultError?h(i):b(i)):R=!0)},m=(i,S)=>{if(c)return;c=!0,f=i;const C=h(i);try{a?.abort(C)}catch{}_(i,S)};if(e.signal.aborted)m(e.signal.reason);else{const i=()=>m(e.signal.reason);e.signal.addEventListener("abort",i,{once:!0}),t.serverSsr?.onCleanup(()=>{e.signal.removeEventListener("abort",i)})}try{a=k.renderToPipeableStream(n,{nonce:t.options.ssr?.nonce,progressiveChunkSize:Number.POSITIVE_INFINITY,...ee(e.headers.get("User-Agent"))?{onAllReady(){a.pipe(o)}}:{onShellReady(){a.pipe(o)}},onError:(i,S)=>{re(e,i)||console.error("Error in renderToPipeableStream:",i,S),m(i,{defaultError:!0})}})}catch(i){throw console.error("Error in renderToPipeableStream:",i),t.serverSsr?.cleanup(),i}const F=Ie(t,o,{onAbort:m});if(u=!0,R&&o.destroy(E()),c&&a)try{a.abort(h(f))}catch{}return q(t,new Response(F,{status:t.stores.statusCode.get(),headers:r}))}throw new Error("No renderToReadableStream or renderToPipeableStream found in react-dom/server. Ensure you are using a version of react-dom that supports streaming.")};export{jt as R,bt as a,It as b,Pt as c,Et as r};