@tanstack/react-router 0.0.1-beta.48 → 0.0.1-beta.49

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.
@@ -14,9 +14,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
15
  var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
16
16
  var React = require('react');
17
- var shim = require('use-sync-external-store/shim');
18
- var reactivity = require('@solidjs/reactivity');
19
17
  var routerCore = require('@tanstack/router-core');
18
+ var useStore = require('./useStore.js');
20
19
 
21
20
  function _interopNamespace(e) {
22
21
  if (e && e.__esModule) return e;
@@ -38,6 +37,8 @@ function _interopNamespace(e) {
38
37
 
39
38
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
39
 
40
+ //
41
+
41
42
  function lazy(importer) {
42
43
  const lazyComp = /*#__PURE__*/React__namespace.lazy(importer);
43
44
  const finalComp = lazyComp;
@@ -67,7 +68,7 @@ function useLinkProps(options) {
67
68
  hash,
68
69
  search,
69
70
  params,
70
- to,
71
+ to = '.',
71
72
  preload,
72
73
  preloadDelay,
73
74
  preloadMaxAge,
@@ -158,82 +159,26 @@ const Link = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
158
159
  });
159
160
  const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
160
161
  const routerContext = /*#__PURE__*/React__namespace.createContext(null);
161
- const EMPTY = {};
162
- const __useStoreValue = (seed, selector) => {
163
- const valueRef = React__namespace.useRef(EMPTY);
164
-
165
- // If there is no selector, track the seed
166
- // If there is a selector, do not track the seed
167
- const getValue = () => !selector ? seed() : selector(reactivity.untrack(() => seed()));
168
-
169
- // If empty, initialize the value
170
- if (valueRef.current === EMPTY) {
171
- valueRef.current = routerCore.sharedClone(undefined, getValue());
172
- }
173
-
174
- // Snapshot should just return the current cached value
175
- const getSnapshot = React__namespace.useCallback(() => valueRef.current, []);
176
- const getStore = React__namespace.useCallback(cb => {
177
- // A root is necessary to track effects
178
- return reactivity.createRoot(() => {
179
- reactivity.createEffect(() => {
180
- // Read and update the value
181
- // getValue will handle which values are accessed and
182
- // thus tracked.
183
- // sharedClone will both recursively track the end result
184
- // and ensure that the previous value is structurally shared
185
- // into the new version.
186
- valueRef.current = reactivity.unwrap(
187
- // Unwrap the value to get rid of any proxy structures
188
- routerCore.sharedClone(valueRef.current, getValue()));
189
- cb();
190
- });
162
+ class ReactRouter extends routerCore.Router {
163
+ constructor(opts) {
164
+ super({
165
+ ...opts,
166
+ loadComponent: async component => {
167
+ if (component.preload) {
168
+ await component.preload();
169
+ }
170
+ return component;
171
+ }
191
172
  });
192
- }, []);
193
- return shim.useSyncExternalStore(getStore, getSnapshot, getSnapshot);
194
- };
195
- const [store, setStore] = reactivity.createStore({
196
- foo: 'foo',
197
- bar: {
198
- baz: 'baz'
199
173
  }
200
- });
201
- reactivity.createRoot(() => {
202
- let prev;
203
- reactivity.createEffect(() => {
204
- console.log('effect');
205
- const next = routerCore.sharedClone(prev, store);
206
- console.log(next);
207
- prev = reactivity.untrack(() => next);
208
- });
209
- });
210
- setStore(s => {
211
- s.foo = '1';
212
- });
213
- setStore(s => {
214
- s.bar.baz = '2';
215
- });
216
- function createReactRouter(opts) {
217
- const coreRouter = routerCore.createRouter({
218
- ...opts,
219
- loadComponent: async component => {
220
- if (component.preload) {
221
- await component.preload();
222
- }
223
- return component;
224
- }
225
- });
226
- return coreRouter;
227
174
  }
228
- function RouterProvider(_ref) {
229
- let {
230
- router,
231
- ...rest
232
- } = _ref;
175
+ function RouterProvider({
176
+ router,
177
+ ...rest
178
+ }) {
233
179
  router.update(rest);
234
- const [,, currentMatches] = __useStoreValue(() => router.store, s => [s.status, s.pendingMatches, s.currentMatches]);
180
+ const [,, currentMatches] = useStore.useStore(router.store, s => [s.status, s.pendingMatches, s.currentMatches], true);
235
181
  React__namespace.useEffect(router.mount, [router]);
236
- console.log('current', currentMatches);
237
182
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
238
183
  value: {
239
184
  router: router
@@ -247,9 +192,9 @@ function useRouter() {
247
192
  routerCore.warning(!value, 'useRouter must be used inside a <Router> component!');
248
193
  return value.router;
249
194
  }
250
- function useRouterStore(selector) {
195
+ function useRouterStore(selector, shallow) {
251
196
  const router = useRouter();
252
- return __useStoreValue(() => router.store, selector);
197
+ return useStore.useStore(router.store, selector, shallow);
253
198
  }
254
199
  function useMatches() {
255
200
  return React__namespace.useContext(matchesContext);
@@ -257,12 +202,12 @@ function useMatches() {
257
202
  function useMatch(opts) {
258
203
  const router = useRouter();
259
204
  const nearestMatch = useMatches()[0];
260
- const match = opts != null && opts.from ? router.store.currentMatches.find(d => d.routeId === (opts == null ? void 0 : opts.from)) : nearestMatch;
261
- routerCore.invariant(match, `Could not find ${opts != null && opts.from ? `an active match from "${opts.from}"` : 'a nearest match!'}`);
262
- if ((opts == null ? void 0 : opts.strict) ?? true) {
263
- routerCore.invariant(nearestMatch.routeId == (match == null ? void 0 : match.routeId), `useMatch("${match == null ? void 0 : match.routeId}") is being called in a component that is meant to render the '${nearestMatch.routeId}' route. Did you mean to 'useMatch("${match == null ? void 0 : match.routeId}", { strict: false })' or 'useRoute("${match == null ? void 0 : match.routeId}")' instead?`);
205
+ const match = opts?.from ? router.store.state.currentMatches.find(d => d.route.id === opts?.from) : nearestMatch;
206
+ routerCore.invariant(match, `Could not find ${opts?.from ? `an active match from "${opts.from}"` : 'a nearest match!'}`);
207
+ if (opts?.strict ?? true) {
208
+ routerCore.invariant(nearestMatch.route.id == match?.route.id, `useMatch("${match?.route.id}") is being called in a component that is meant to render the '${nearestMatch.route.id}' route. Did you mean to 'useMatch("${match?.route.id}", { strict: false })' or 'useRoute("${match?.route.id}")' instead?`);
264
209
  }
265
- __useStoreValue(() => match.store);
210
+ useStore.useStore(match.store, d => opts?.track?.(match) ?? match, opts?.shallow);
266
211
  return match;
267
212
  }
268
213
  function useRoute(routeId) {
@@ -273,18 +218,22 @@ function useRoute(routeId) {
273
218
  }
274
219
  function useLoaderData(opts) {
275
220
  const match = useMatch(opts);
276
- return __useStoreValue(() => match == null ? void 0 : match.store.loaderData, opts == null ? void 0 : opts.select);
221
+ routerCore.invariant(match, `Could not find ${opts?.from ? `an active match from "${opts.from}"` : 'a nearest match!'}`);
222
+ useStore.useStore(match.store, d => opts?.track?.(d.loaderData) ?? d.loaderData);
223
+ return match.store.state.loaderData;
277
224
  }
278
225
  function useSearch(opts) {
279
226
  const match = useMatch(opts);
280
- return __useStoreValue(() => match == null ? void 0 : match.store.search, opts == null ? void 0 : opts.select);
227
+ useStore.useStore(match.store, d => opts?.track?.(d.search) ?? d.search);
228
+ return match.store.state.search;
281
229
  }
282
230
  function useParams(opts) {
283
231
  const router = useRouter();
284
- return __useStoreValue(() => {
285
- var _last;
286
- return (_last = routerCore.last(router.store.currentMatches)) == null ? void 0 : _last.params;
287
- }, opts == null ? void 0 : opts.select);
232
+ useStore.useStore(router.store, d => {
233
+ const params = routerCore.last(d.currentMatches)?.params;
234
+ return opts?.track?.(params) ?? params;
235
+ });
236
+ return routerCore.last(router.store.state.currentMatches)?.params;
288
237
  }
289
238
  function useNavigate(defaultOpts) {
290
239
  const router = useRouter();
@@ -295,12 +244,6 @@ function useNavigate(defaultOpts) {
295
244
  });
296
245
  };
297
246
  }
298
- function useAction(opts) {
299
- const route = useRoute(opts.from);
300
- const action = route.action;
301
- __useStoreValue(() => action);
302
- return action;
303
- }
304
247
  function useMatchRoute() {
305
248
  const router = useRouter();
306
249
  return opts => {
@@ -321,37 +264,49 @@ function MatchRoute(props) {
321
264
  if (!params) {
322
265
  return null;
323
266
  }
324
- return /*#__PURE__*/React__namespace.createElement(typeof props.children === 'function' ? props.children(params) : props.children, props);
267
+ if (typeof props.children === 'function') {
268
+ return props.children(params);
269
+ }
270
+ return params ? props.children : null;
325
271
  }
326
272
  function Outlet() {
327
- const router = useRouter();
328
273
  const matches = useMatches().slice(1);
329
274
  const match = matches[0];
275
+ if (!match) {
276
+ return null;
277
+ }
278
+ return /*#__PURE__*/React__namespace.createElement(SubOutlet, {
279
+ matches: matches,
280
+ match: match
281
+ });
282
+ }
283
+ function SubOutlet({
284
+ matches,
285
+ match
286
+ }) {
287
+ const router = useRouter();
288
+ useStore.useStore(match.store);
330
289
  const defaultPending = React__namespace.useCallback(() => null, []);
331
- __useStoreValue(() => match == null ? void 0 : match.store);
332
290
  const Inner = React__namespace.useCallback(props => {
333
- if (props.match.store.status === 'error') {
334
- throw props.match.store.error;
291
+ if (props.match.store.state.status === 'error') {
292
+ throw props.match.store.state.error;
335
293
  }
336
- if (props.match.store.status === 'success') {
337
- return /*#__PURE__*/React__namespace.createElement(props.match.__.component ?? router.options.defaultComponent ?? Outlet);
294
+ if (props.match.store.state.status === 'success') {
295
+ return /*#__PURE__*/React__namespace.createElement(props.match.component ?? router.options.defaultComponent ?? Outlet);
338
296
  }
339
- if (props.match.store.status === 'loading') {
340
- throw props.match.__.loadPromise;
297
+ if (props.match.store.state.status === 'loading') {
298
+ throw props.match.__loadPromise;
341
299
  }
342
300
  routerCore.invariant(false, 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!');
343
301
  }, []);
344
- if (!match) {
345
- return null;
346
- }
347
- const PendingComponent = match.__.pendingComponent ?? router.options.defaultPendingComponent ?? defaultPending;
348
- const errorComponent = match.__.errorComponent ?? router.options.defaultErrorComponent;
302
+ const PendingComponent = match.pendingComponent ?? router.options.defaultPendingComponent ?? defaultPending;
303
+ const errorComponent = match.errorComponent ?? router.options.defaultErrorComponent;
349
304
  return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, {
350
305
  value: matches
351
306
  }, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
352
307
  fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
353
308
  }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
354
- key: match.routeId,
309
+ key: match.route.id,
355
310
  errorComponent: errorComponent,
356
311
  match: match
357
312
  }, /*#__PURE__*/React__namespace.createElement(Inner, {
@@ -364,7 +319,7 @@ class CatchBoundary extends React__namespace.Component {
364
319
  info: undefined
365
320
  };
366
321
  componentDidCatch(error, info) {
367
- console.error(`Error in route match: ${this.props.match.matchId}`);
322
+ console.error(`Error in route match: ${this.props.match.id}`);
368
323
  console.error(error);
369
324
  this.setState({
370
325
  error,
@@ -384,20 +339,27 @@ class CatchBoundary extends React__namespace.Component {
384
339
  // router's location key changes.
385
340
  function CatchBoundaryInner(props) {
386
341
  const [activeErrorState, setActiveErrorState] = React__namespace.useState(props.errorState);
387
- const router = useRouter();
342
+ useRouter();
388
343
  const errorComponent = props.errorComponent ?? DefaultErrorBoundary;
389
- React__namespace.useEffect(() => {
390
- if (activeErrorState) {
391
- let prevKey = router.store.currentLocation.key;
392
- return reactivity.createRoot(() => reactivity.createEffect(() => {
393
- if (router.store.currentLocation.key !== prevKey) {
394
- prevKey = router.store.currentLocation.key;
395
- setActiveErrorState({});
396
- }
397
- }));
398
- }
399
- return;
400
- }, [activeErrorState]);
344
+
345
+ // React.useEffect(() => {
346
+ // if (activeErrorState) {
347
+ // let prevKey = router.store.currentLocation.key
348
+ // return createRoot((dispose) => {
349
+ // createEffect(() => {
350
+ // if (router.store.currentLocation.key !== prevKey) {
351
+ // prevKey = router.store.currentLocation.key
352
+ // setActiveErrorState({} as any)
353
+ // }
354
+ // })
355
+
356
+ // return dispose
357
+ // })
358
+ // }
359
+
360
+ // return
361
+ // }, [activeErrorState])
362
+
401
363
  React__namespace.useEffect(() => {
402
364
  if (props.errorState.error) {
403
365
  setActiveErrorState(props.errorState);
@@ -409,10 +371,9 @@ function CatchBoundaryInner(props) {
409
371
  }
410
372
  return props.children;
411
373
  }
412
- function DefaultErrorBoundary(_ref2) {
413
- let {
414
- error
415
- } = _ref2;
374
+ function DefaultErrorBoundary({
375
+ error
376
+ }) {
416
377
  return /*#__PURE__*/React__namespace.createElement("div", {
417
378
  style: {
418
379
  padding: '.5rem',
@@ -436,56 +397,51 @@ function DefaultErrorBoundary(_ref2) {
436
397
  }
437
398
  }, error.message) : null)));
438
399
  }
439
- function usePrompt(message, when) {
440
- const router = useRouter();
441
- React__namespace.useEffect(() => {
442
- if (!when) return;
443
- let unblock = router.history.block(transition => {
444
- if (window.confirm(message)) {
445
- unblock();
446
- transition.retry();
447
- } else {
448
- router.store.currentLocation.pathname = window.location.pathname;
449
- }
450
- });
451
- return unblock;
452
- }, [when, message]);
453
- }
454
- function Prompt(_ref3) {
455
- let {
456
- message,
457
- when,
458
- children
459
- } = _ref3;
460
- usePrompt(message, when ?? true);
461
- return children ?? null;
400
+ function useAction(action, opts) {
401
+ useStore.useStore(action.store, d => opts?.track?.(d) ?? d, true);
402
+ const [ref] = React__namespace.useState({});
403
+ Object.assign(ref, {
404
+ ...action,
405
+ latestSubmission: action.store.state.submissions[action.store.state.submissions.length - 1],
406
+ pendingSubmissions: React__namespace.useMemo(() => action.store.state.submissions.filter(d => d.status === 'pending'), [action.store.state.submissions])
407
+ });
408
+ return ref;
462
409
  }
463
410
 
464
- // function circularStringify(obj: any) {
465
- // const seen = new Set()
411
+ // TODO: While we migrate away from the history package, these need to be disabled
412
+ // export function usePrompt(message: string, when: boolean | any): void {
413
+ // const router = useRouter()
466
414
 
467
- // return (
468
- // JSON.stringify(obj, (_, value) => {
469
- // if (typeof value === 'function') {
470
- // return undefined
471
- // }
472
- // if (typeof value === 'object' && value !== null) {
473
- // if (seen.has(value)) return
474
- // seen.add(value)
415
+ // React.useEffect(() => {
416
+ // if (!when) return
417
+
418
+ // let unblock = router.getHistory().block((transition) => {
419
+ // if (window.confirm(message)) {
420
+ // unblock()
421
+ // transition.retry()
422
+ // } else {
423
+ // router.setStore((s) => {
424
+ // s.currentLocation.pathname = window.location.pathname
425
+ // })
475
426
  // }
476
- // return value
477
- // }) || ''
478
- // )
427
+ // })
428
+
429
+ // return unblock
430
+ // }, [when, message])
431
+ // }
432
+
433
+ // export function Prompt({ message, when, children }: PromptProps) {
434
+ // usePrompt(message, when ?? true)
435
+ // return (children ?? null) as ReactNode
479
436
  // }
480
437
 
438
+ exports.useStore = useStore.useStore;
481
439
  exports.DefaultErrorBoundary = DefaultErrorBoundary;
482
440
  exports.Link = Link;
483
441
  exports.MatchRoute = MatchRoute;
484
442
  exports.Outlet = Outlet;
485
- exports.Prompt = Prompt;
443
+ exports.ReactRouter = ReactRouter;
486
444
  exports.RouterProvider = RouterProvider;
487
- exports.__useStoreValue = __useStoreValue;
488
- exports.createReactRouter = createReactRouter;
489
445
  exports.lazy = lazy;
490
446
  exports.matchesContext = matchesContext;
491
447
  exports.routerContext = routerContext;
@@ -497,17 +453,10 @@ exports.useMatchRoute = useMatchRoute;
497
453
  exports.useMatches = useMatches;
498
454
  exports.useNavigate = useNavigate;
499
455
  exports.useParams = useParams;
500
- exports.usePrompt = usePrompt;
501
456
  exports.useRoute = useRoute;
502
457
  exports.useRouter = useRouter;
503
458
  exports.useRouterStore = useRouterStore;
504
459
  exports.useSearch = useSearch;
505
- Object.keys(reactivity).forEach(function (k) {
506
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
507
- enumerable: true,
508
- get: function () { return reactivity[k]; }
509
- });
510
- });
511
460
  Object.keys(routerCore).forEach(function (k) {
512
461
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
513
462
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n// @ts-ignore\n// import { useSyncExternalStore } from './uSES/useSyncExternalStoreShim'\nimport { createEffect, createRoot, untrack, unwrap } from '@solidjs/reactivity'\nimport { createStore } from '@solidjs/reactivity'\n\nimport {\n Route,\n RegisteredAllRouteInfo,\n RegisteredRouter,\n RouterStore,\n last,\n sharedClone,\n Action,\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AllRouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n Router,\n Expand,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\nexport * from '@solidjs/reactivity'\n\ntype ReactNode = any\n\nexport type SyncRouteComponent<TProps = {}> = (props: TProps) => ReactNode\n\nexport type RouteComponent<TProps = {}> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport function lazy(\n importer: () => Promise<{ default: SyncRouteComponent }>,\n): RouteComponent {\n const lazyComp = React.lazy(importer as any)\n let preloaded: Promise<SyncRouteComponent>\n\n const finalComp = lazyComp as unknown as RouteComponent\n\n finalComp.preload = async () => {\n if (!preloaded) {\n await importer()\n }\n }\n\n return finalComp\n}\n\nexport type LinkPropsOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = LinkOptions<RegisteredAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type MakeUseMatchRouteOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = ToOptions<RegisteredAllRouteInfo, TFrom, TTo> & MatchRouteOptions\n\nexport type MakeMatchRouteOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = ToOptions<RegisteredAllRouteInfo, TFrom, TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ReactNode\n | ((\n params: RouteInfoByPath<\n RegisteredAllRouteInfo,\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['allParams'],\n ) => ReactNode)\n }\n\nexport type MakeLinkPropsOptions<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkPropsOptions<TFrom, TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>\n\nexport type MakeLinkOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = LinkPropsOptions<TFrom, TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?: ReactNode | ((state: { isActive: boolean }) => ReactNode)\n }\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Component: RouteComponent\n ErrorComponent: RouteComponent<{\n error: unknown\n info: { componentStack: string }\n }>\n }\n\n interface RouterOptions<TRouteConfig, TRouterContext> {\n // ssrFooter?: () => JSX.Element | Node\n }\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: ReactNode\n}\n\n//\n\nexport function useLinkProps<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n>(\n options: MakeLinkPropsOptions<TFrom, TTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const router = useRouter()\n\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = router.buildLink(options as any)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const { handleClick, handleFocus, handleEnter, handleLeave, isActive, next } =\n linkInfo\n\n const reactHandleClick = (e: Event) => {\n if (React.startTransition) {\n // This is a hack for react < 18\n React.startTransition(() => {\n handleClick(e)\n })\n } else {\n handleClick(e)\n }\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n if (e.persist) e.persist()\n handlers.filter(Boolean).forEach((handler) => {\n if (e.defaultPrevented) return\n handler!(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? functionalUpdate(activeProps, {}) ?? {}\n : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([onClick, reactHandleClick]),\n onFocus: composeHandlers([onFocus, handleFocus]),\n onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n}\n\nexport interface LinkFn<\n TDefaultFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TDefaultTo extends string = '.',\n> {\n <\n TFrom extends RegisteredAllRouteInfo['routePaths'] = TDefaultFrom,\n TTo extends string = TDefaultTo,\n >(\n props: MakeLinkOptions<TFrom, TTo> & React.RefAttributes<HTMLAnchorElement>,\n ): ReactNode\n}\n\nexport const Link: LinkFn = React.forwardRef((props: any, ref) => {\n const linkProps = useLinkProps(props)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n}) as any\n\ntype MatchesContextValue = RouteMatch[]\n\nexport const matchesContext = React.createContext<MatchesContextValue>(null!)\nexport const routerContext = React.createContext<{ router: RegisteredRouter }>(\n null!,\n)\n\nexport type MatchesProviderProps = {\n value: MatchesContextValue\n children: ReactNode\n}\n\nconst EMPTY = {}\n\nexport const __useStoreValue = <TSeed, TReturn>(\n seed: () => TSeed,\n selector?: (seed: TSeed) => TReturn,\n): TReturn => {\n const valueRef = React.useRef<TReturn>(EMPTY as any)\n\n // If there is no selector, track the seed\n // If there is a selector, do not track the seed\n const getValue = () =>\n (!selector ? seed() : selector(untrack(() => seed()))) as TReturn\n\n // If empty, initialize the value\n if (valueRef.current === EMPTY) {\n valueRef.current = sharedClone(undefined, getValue())\n }\n\n // Snapshot should just return the current cached value\n const getSnapshot = React.useCallback(() => valueRef.current, [])\n\n const getStore = React.useCallback((cb: () => void) => {\n // A root is necessary to track effects\n return createRoot(() => {\n createEffect(() => {\n // Read and update the value\n // getValue will handle which values are accessed and\n // thus tracked.\n // sharedClone will both recursively track the end result\n // and ensure that the previous value is structurally shared\n // into the new version.\n valueRef.current = unwrap(\n // Unwrap the value to get rid of any proxy structures\n sharedClone(valueRef.current, getValue()),\n )\n cb()\n })\n })\n }, [])\n\n return useSyncExternalStore(getStore, getSnapshot, getSnapshot)\n}\n\nconst [store, setStore] = createStore({ foo: 'foo', bar: { baz: 'baz' } })\n\ncreateRoot(() => {\n let prev: any\n\n createEffect(() => {\n console.log('effect')\n const next = sharedClone(prev, store)\n console.log(next)\n prev = untrack(() => next)\n })\n})\n\nsetStore((s) => {\n s.foo = '1'\n})\n\nsetStore((s) => {\n s.bar.baz = '2'\n})\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n TRouterContext = unknown,\n>(\n opts: RouterOptions<TRouteConfig, TRouterContext>,\n): Router<TRouteConfig, TAllRouteInfo, TRouterContext> {\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n loadComponent: async (component) => {\n if (component.preload) {\n await component.preload()\n }\n\n return component as any\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouterContext = unknown,\n> = RouterOptions<TRouteConfig, TRouterContext> & {\n router: Router<TRouteConfig, TAllRouteInfo, TRouterContext>\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouterContext = unknown,\n>({\n router,\n ...rest\n}: RouterProps<TRouteConfig, TAllRouteInfo, TRouterContext>) {\n router.update(rest)\n\n const [, , currentMatches] = __useStoreValue(\n () => router.store,\n (s) => [s.status, s.pendingMatches, s.currentMatches],\n )\n\n React.useEffect(router.mount, [router])\n\n console.log('current', currentMatches)\n\n return (\n <>\n <routerContext.Provider value={{ router: router as any }}>\n <matchesContext.Provider value={[undefined!, ...currentMatches]}>\n <Outlet />\n </matchesContext.Provider>\n </routerContext.Provider>\n </>\n )\n}\n\nexport function useRouter(): RegisteredRouter {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n return value.router\n}\n\nexport function useRouterStore<T = RouterStore>(\n selector?: (state: Router['store']) => T,\n): T {\n const router = useRouter()\n return __useStoreValue(() => router.store, selector)\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useMatch<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n TRouteMatch = RouteMatch<\n RegisteredAllRouteInfo,\n RegisteredAllRouteInfo['routeInfoById'][TFrom]\n >,\n // TSelected = TRouteMatch,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n // select?: (match: TRouteMatch) => TSelected\n}): TStrict extends true ? TRouteMatch : TRouteMatch | undefined {\n const router = useRouter()\n const nearestMatch = useMatches()[0]!\n const match = opts?.from\n ? router.store.currentMatches.find((d) => d.routeId === opts?.from)\n : nearestMatch\n\n invariant(\n match,\n `Could not find ${\n opts?.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'\n }`,\n )\n\n if (opts?.strict ?? true) {\n invariant(\n nearestMatch.routeId == match?.routeId,\n `useMatch(\"${\n match?.routeId as string\n }\") is being called in a component that is meant to render the '${\n nearestMatch.routeId\n }' route. Did you mean to 'useMatch(\"${\n match?.routeId as string\n }\", { strict: false })' or 'useRoute(\"${\n match?.routeId as string\n }\")' instead?`,\n )\n }\n\n __useStoreValue(() => match!.store)\n\n return match as any\n}\n\nexport function useRoute<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n>(\n routeId: TId,\n): Route<RegisteredAllRouteInfo, RegisteredAllRouteInfo['routeInfoById'][TId]> {\n const router = useRouter()\n const resolvedRoute = router.getRoute(routeId as any)\n\n invariant(\n resolvedRoute,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n\n return resolvedRoute as any\n}\n\nexport function useLoaderData<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TStrict extends boolean = true,\n TLoaderData = RegisteredAllRouteInfo['routeInfoById'][TFrom]['loaderData'],\n TSelected = TLoaderData,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n select?: (loaderData: TLoaderData) => TSelected\n}): TStrict extends true ? TSelected : TSelected | undefined {\n const match = useMatch(opts) as any\n return __useStoreValue(() => match?.store.loaderData, opts?.select)\n}\n\nexport function useSearch<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n TSearch = RegisteredAllRouteInfo['routeInfoById'][TFrom]['fullSearchSchema'],\n TSelected = TSearch,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n select?: (search: TSearch) => TSelected\n}): TStrict extends true ? TSelected : TSelected | undefined {\n const match = useMatch(opts)\n return __useStoreValue(() => match?.store.search, opts?.select) as any\n}\n\nexport function useParams<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TDefaultSelected = Expand<\n RegisteredAllRouteInfo['allParams'] &\n RegisteredAllRouteInfo['routeInfoById'][TFrom]['allParams']\n >,\n TSelected = TDefaultSelected,\n>(opts?: {\n from: TFrom\n select?: (search: TDefaultSelected) => TSelected\n}): TSelected {\n const router = useRouter()\n return __useStoreValue(\n () => last(router.store.currentMatches)?.params as any,\n opts?.select,\n )\n}\n\nexport function useNavigate<\n TDefaultFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n>(defaultOpts: { from?: TDefaultFrom }) {\n const router = useRouter()\n return <\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = TDefaultFrom,\n TTo extends string = '.',\n >(\n opts: MakeLinkOptions<TFrom, TTo>,\n ) => {\n return router.navigate({ ...defaultOpts, ...(opts as any) })\n }\n}\n\nexport function useAction<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TFromRoute extends RegisteredAllRouteInfo['routeInfoById'][TFrom] = RegisteredAllRouteInfo['routeInfoById'][TFrom],\n>(opts: {\n from: TFrom\n}): Action<TFromRoute['actionPayload'], TFromRoute['actionResponse']> {\n const route = useRoute(opts.from)\n const action = route.action\n __useStoreValue(() => action)\n return action as any\n}\n\nexport function useMatchRoute() {\n const router = useRouter()\n\n return <\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n >(\n opts: MakeUseMatchRouteOptions<TFrom, TTo>,\n ) => {\n const { pending, caseSensitive, ...rest } = opts\n\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n }\n}\n\nexport function MatchRoute<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n>(props: MakeMatchRouteOptions<TFrom, TTo>): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props)\n\n if (!params) {\n return null\n }\n\n return React.createElement(\n typeof props.children === 'function'\n ? (props.children as any)(params)\n : props.children,\n props as any,\n )\n}\n\nexport function Outlet() {\n const router = useRouter()\n const matches = useMatches().slice(1)\n const match = matches[0]\n\n const defaultPending = React.useCallback(() => null, [])\n\n __useStoreValue(() => match?.store)\n\n const Inner = React.useCallback((props: { match: RouteMatch }): any => {\n if (props.match.store.status === 'error') {\n throw props.match.store.error\n }\n\n if (props.match.store.status === 'success') {\n return React.createElement(\n (props.match.__.component as any) ??\n router.options.defaultComponent ??\n Outlet,\n )\n }\n\n if (props.match.store.status === 'loading') {\n throw props.match.__.loadPromise\n }\n\n invariant(\n false,\n 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!',\n )\n }, [])\n\n if (!match) {\n return null\n }\n\n const PendingComponent = (match.__.pendingComponent ??\n router.options.defaultPendingComponent ??\n defaultPending) as any\n\n const errorComponent =\n match.__.errorComponent ?? router.options.defaultErrorComponent\n\n return (\n <matchesContext.Provider value={matches}>\n <React.Suspense fallback={<PendingComponent />}>\n <CatchBoundary\n key={match.routeId}\n errorComponent={errorComponent}\n match={match as any}\n >\n <Inner match={match} />\n </CatchBoundary>\n </React.Suspense>\n {/* Provide a suffix suspense boundary to make sure the router is\n ready to be dehydrated on the server */}\n {/* {router.options.ssrFooter && match.matchId === rootRouteId ? (\n <React.Suspense fallback={null}>\n {(() => {\n if (router.store.pending) {\n throw router.navigationPromise\n }\n\n return router.options.ssrFooter()\n })()}\n </React.Suspense>\n ) : null} */}\n </matchesContext.Provider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n errorComponent: any\n match: RouteMatch\n}> {\n state = {\n error: false,\n info: undefined,\n }\n\n componentDidCatch(error: any, info: any) {\n console.error(`Error in route match: ${this.props.match.matchId}`)\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n\n render() {\n return (\n <CatchBoundaryInner\n {...this.props}\n errorState={this.state}\n reset={() => this.setState({})}\n />\n )\n }\n}\n\n// This is the messiest thing ever... I'm either seriously tired (likely) or\n// there has to be a better way to reset error boundaries when the\n// router's location key changes.\nfunction CatchBoundaryInner(props: {\n children: any\n errorComponent: any\n errorState: { error: unknown; info: any }\n reset: () => void\n}) {\n const [activeErrorState, setActiveErrorState] = React.useState(\n props.errorState,\n )\n const router = useRouter()\n const errorComponent = props.errorComponent ?? DefaultErrorBoundary\n\n React.useEffect(() => {\n if (activeErrorState) {\n let prevKey = router.store.currentLocation.key\n return createRoot(() =>\n createEffect(() => {\n if (router.store.currentLocation.key !== prevKey) {\n prevKey = router.store.currentLocation.key\n setActiveErrorState({} as any)\n }\n }),\n )\n }\n\n return\n }, [activeErrorState])\n\n React.useEffect(() => {\n if (props.errorState.error) {\n setActiveErrorState(props.errorState)\n }\n props.reset()\n }, [props.errorState.error])\n\n if (props.errorState.error) {\n return React.createElement(errorComponent, activeErrorState)\n }\n\n return props.children\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n </div>\n )\n}\n\nexport function usePrompt(message: string, when: boolean | any): void {\n const router = useRouter()\n\n React.useEffect(() => {\n if (!when) return\n\n let unblock = router.history.block((transition) => {\n if (window.confirm(message)) {\n unblock()\n transition.retry()\n } else {\n router.store.currentLocation.pathname = window.location.pathname\n }\n })\n\n return unblock\n }, [when, message])\n}\n\nexport function Prompt({ message, when, children }: PromptProps) {\n usePrompt(message, when ?? true)\n return (children ?? null) as ReactNode\n}\n\n// function circularStringify(obj: any) {\n// const seen = new Set()\n\n// return (\n// JSON.stringify(obj, (_, value) => {\n// if (typeof value === 'function') {\n// return undefined\n// }\n// if (typeof value === 'object' && value !== null) {\n// if (seen.has(value)) return\n// seen.add(value)\n// }\n// return value\n// }) || ''\n// )\n// }\n"],"names":["lazy","importer","lazyComp","React","finalComp","preload","useLinkProps","options","router","useRouter","type","children","target","activeProps","className","inactiveProps","activeOptions","disabled","hash","search","params","to","preloadDelay","preloadMaxAge","replace","style","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","rest","linkInfo","buildLink","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","reactHandleClick","e","startTransition","composeHandlers","handlers","persist","filter","Boolean","forEach","handler","defaultPrevented","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","undefined","join","role","Link","forwardRef","props","ref","linkProps","_extends","matchesContext","createContext","routerContext","EMPTY","__useStoreValue","seed","selector","valueRef","useRef","getValue","untrack","current","sharedClone","getSnapshot","useCallback","getStore","cb","createRoot","createEffect","unwrap","useSyncExternalStore","store","setStore","createStore","foo","bar","baz","prev","console","log","s","createReactRouter","opts","coreRouter","createRouter","loadComponent","component","RouterProvider","update","currentMatches","status","pendingMatches","useEffect","mount","value","useContext","warning","useRouterStore","useMatches","useMatch","nearestMatch","match","from","find","d","routeId","invariant","strict","useRoute","resolvedRoute","getRoute","useLoaderData","loaderData","select","useSearch","useParams","last","useNavigate","defaultOpts","navigate","useAction","route","action","useMatchRoute","pending","caseSensitive","matchRoute","MatchRoute","createElement","Outlet","matches","slice","defaultPending","Inner","error","__","defaultComponent","loadPromise","PendingComponent","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","CatchBoundary","Component","state","info","componentDidCatch","matchId","setState","render","CatchBoundaryInner","activeErrorState","setActiveErrorState","useState","errorState","DefaultErrorBoundary","prevKey","currentLocation","key","reset","padding","maxWidth","fontSize","height","message","border","borderRadius","color","usePrompt","when","unblock","history","block","transition","window","confirm","retry","pathname","location","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDO,SAASA,IAAI,CAClBC,QAAwD,EACxC;AAChB,EAAA,MAAMC,QAAQ,gBAAGC,gBAAK,CAACH,IAAI,CAACC,QAAQ,CAAQ,CAAA;EAG5C,MAAMG,SAAS,GAAGF,QAAqC,CAAA;EAEvDE,SAAS,CAACC,OAAO,GAAG,YAAY;IACd;AACd,MAAA,MAAMJ,QAAQ,EAAE,CAAA;AAClB,KAAA;GACD,CAAA;AAED,EAAA,OAAOG,SAAS,CAAA;AAClB,CAAA;AAwEA;;AAEO,SAASE,YAAY,CAI1BC,OAAyC,EACM;EAC/C,MAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;EAE1B,MAAM;AACJ;IACAC,IAAI;IACJC,QAAQ;IACRC,MAAM;AACNC,IAAAA,WAAW,GAAG,OAAO;AAAEC,MAAAA,SAAS,EAAE,QAAA;AAAS,KAAC,CAAC;AAC7CC,IAAAA,aAAa,GAAG,OAAO,EAAE,CAAC;IAC1BC,aAAa;IACbC,QAAQ;AACR;IACAC,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC,EAAE;IACFhB,OAAO;IACPiB,YAAY;IACZC,aAAa;IACbC,OAAO;AACP;IACAC,KAAK;IACLX,SAAS;IACTY,OAAO;IACPC,OAAO;IACPC,YAAY;IACZC,YAAY;IACZC,YAAY;IACZC,UAAU;IACV,GAAGC,IAAAA;AACL,GAAC,GAAGzB,OAAO,CAAA;AAEX,EAAA,MAAM0B,QAAQ,GAAGzB,MAAM,CAAC0B,SAAS,CAAC3B,OAAO,CAAQ,CAAA;AAEjD,EAAA,IAAI0B,QAAQ,CAACvB,IAAI,KAAK,UAAU,EAAE;IAChC,MAAM;AAAEyB,MAAAA,IAAAA;AAAK,KAAC,GAAGF,QAAQ,CAAA;IACzB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A,OAAOP,OAAO,CAAA;AAChB,GAAC,EAAE,CAACD,IAAI,EAAEL,OAAO,CAAC,CAAC,CAAA;AACrB,CAAA;AAEO,SAASe,MAAM,CAA2C,KAAA,EAAA;EAAA,IAA1C;IAAEf,OAAO;IAAEK,IAAI;AAAE9K,IAAAA,QAAAA;GAAuB,GAAA,KAAA,CAAA;AAC7D6K,EAAAA,SAAS,CAACJ,OAAO,EAAEK,IAAI,IAAI,IAAI,CAAC,CAAA;EAChC,OAAQ9K,QAAQ,IAAI,IAAI,CAAA;AAC1B,CAAA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n Route,\n RegisteredAllRouteInfo,\n RegisteredRouter,\n RouterStore,\n last,\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n AllRouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n Router,\n Expand,\n Action,\n ActionStore,\n ActionSubmission,\n} from '@tanstack/router-core'\nimport { useStore } from './useStore'\n\n//\n\nexport * from '@tanstack/router-core'\n\nexport { useStore }\n\n//\n\ntype ReactNode = any\n\nexport type SyncRouteComponent<TProps = {}> = (props: TProps) => ReactNode\n\nexport type RouteComponent<TProps = {}> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport function lazy(\n importer: () => Promise<{ default: SyncRouteComponent }>,\n): RouteComponent {\n const lazyComp = React.lazy(importer as any)\n let preloaded: Promise<SyncRouteComponent>\n\n const finalComp = lazyComp as unknown as RouteComponent\n\n finalComp.preload = async () => {\n if (!preloaded) {\n await importer()\n }\n }\n\n return finalComp\n}\n\nexport type LinkPropsOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = LinkOptions<RegisteredAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type MakeUseMatchRouteOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = ToOptions<RegisteredAllRouteInfo, TFrom, TTo> & MatchRouteOptions\n\nexport type MakeMatchRouteOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = ToOptions<RegisteredAllRouteInfo, TFrom, TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ReactNode\n | ((\n params: RouteInfoByPath<\n RegisteredAllRouteInfo,\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['allParams'],\n ) => ReactNode)\n }\n\nexport type MakeLinkPropsOptions<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkPropsOptions<TFrom, TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>\n\nexport type MakeLinkOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = LinkPropsOptions<TFrom, TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?: ReactNode | ((state: { isActive: boolean }) => ReactNode)\n }\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Component: RouteComponent\n ErrorComponent: RouteComponent<{\n error: unknown\n info: { componentStack: string }\n }>\n }\n\n interface RouterOptions<TRouteConfig, TRouterContext> {\n // ssrFooter?: () => JSX.Element | Node\n }\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: ReactNode\n}\n\n//\n\nexport function useLinkProps<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n>(\n options: MakeLinkPropsOptions<TFrom, TTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const router = useRouter()\n\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to = '.',\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = router.buildLink(options as any)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const { handleClick, handleFocus, handleEnter, handleLeave, isActive, next } =\n linkInfo\n\n const reactHandleClick = (e: Event) => {\n if (React.startTransition) {\n // This is a hack for react < 18\n React.startTransition(() => {\n handleClick(e)\n })\n } else {\n handleClick(e)\n }\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n if (e.persist) e.persist()\n handlers.filter(Boolean).forEach((handler) => {\n if (e.defaultPrevented) return\n handler!(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? functionalUpdate(activeProps as any, {}) ?? {}\n : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([onClick, reactHandleClick]),\n onFocus: composeHandlers([onFocus, handleFocus]),\n onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n}\n\nexport interface LinkFn<\n TDefaultFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TDefaultTo extends string = '.',\n> {\n <\n TFrom extends RegisteredAllRouteInfo['routePaths'] = TDefaultFrom,\n TTo extends string = TDefaultTo,\n >(\n props: MakeLinkOptions<TFrom, TTo> & React.RefAttributes<HTMLAnchorElement>,\n ): ReactNode\n}\n\nexport const Link: LinkFn = React.forwardRef((props: any, ref) => {\n const linkProps = useLinkProps(props)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n}) as any\n\ntype MatchesContextValue = RouteMatch[]\n\nexport const matchesContext = React.createContext<MatchesContextValue>(null!)\nexport const routerContext = React.createContext<{ router: RegisteredRouter }>(\n null!,\n)\n\nexport type MatchesProviderProps = {\n value: MatchesContextValue\n children: ReactNode\n}\n\nexport class ReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n TRouterContext = unknown,\n> extends Router<TRouteConfig, TAllRouteInfo, TRouterContext> {\n constructor(opts: RouterOptions<TRouteConfig, TRouterContext>) {\n super({\n ...opts,\n loadComponent: async (component) => {\n if (component.preload) {\n await component.preload()\n }\n\n return component as any\n },\n })\n }\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouterContext = unknown,\n> = RouterOptions<TRouteConfig, TRouterContext> & {\n router: Router<TRouteConfig, TAllRouteInfo, TRouterContext>\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouterContext = unknown,\n>({\n router,\n ...rest\n}: RouterProps<TRouteConfig, TAllRouteInfo, TRouterContext>) {\n router.update(rest)\n\n const [, , currentMatches] = useStore(\n router.store,\n (s) => [s.status, s.pendingMatches, s.currentMatches],\n true,\n )\n\n React.useEffect(router.mount, [router])\n\n return (\n <>\n <routerContext.Provider value={{ router: router as any }}>\n <matchesContext.Provider value={[undefined!, ...currentMatches]}>\n <Outlet />\n </matchesContext.Provider>\n </routerContext.Provider>\n </>\n )\n}\n\nexport function useRouter(): RegisteredRouter {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n return value.router\n}\n\nexport function useRouterStore<T = RouterStore>(\n selector?: (state: Router['store']) => T,\n shallow?: boolean,\n): T {\n const router = useRouter()\n return useStore(router.store, selector as any, shallow)\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useMatch<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n TRouteMatch = RouteMatch<\n RegisteredAllRouteInfo,\n RegisteredAllRouteInfo['routeInfoById'][TFrom]\n >,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n track?: (match: TRouteMatch) => any\n shallow?: boolean\n}): TStrict extends true ? TRouteMatch : TRouteMatch | undefined {\n const router = useRouter()\n const nearestMatch = useMatches()[0]!\n const match = opts?.from\n ? router.store.state.currentMatches.find((d) => d.route.id === opts?.from)\n : nearestMatch\n\n invariant(\n match,\n `Could not find ${\n opts?.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'\n }`,\n )\n\n if (opts?.strict ?? true) {\n invariant(\n nearestMatch.route.id == match?.route.id,\n `useMatch(\"${\n match?.route.id as string\n }\") is being called in a component that is meant to render the '${\n nearestMatch.route.id\n }' route. Did you mean to 'useMatch(\"${\n match?.route.id as string\n }\", { strict: false })' or 'useRoute(\"${\n match?.route.id as string\n }\")' instead?`,\n )\n }\n\n useStore(\n match!.store,\n (d) => opts?.track?.(match as any) ?? match,\n opts?.shallow,\n )\n\n return match as any\n}\n\nexport function useRoute<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n>(\n routeId: TId,\n): Route<RegisteredAllRouteInfo, RegisteredAllRouteInfo['routeInfoById'][TId]> {\n const router = useRouter()\n const resolvedRoute = router.getRoute(routeId as any)\n\n invariant(\n resolvedRoute,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n\n return resolvedRoute as any\n}\n\nexport function useLoaderData<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TStrict extends boolean = true,\n TLoaderData = RegisteredAllRouteInfo['routeInfoById'][TFrom]['loaderData'],\n>(opts?: {\n from: TFrom\n strict?: TStrict\n track?: (loaderData: TLoaderData) => any\n}): TStrict extends true ? TLoaderData : TLoaderData | undefined {\n const match = useMatch(opts)\n\n invariant(\n match,\n `Could not find ${\n opts?.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'\n }`,\n )\n\n useStore(\n (match as any).store,\n (d: any) => opts?.track?.(d.loaderData) ?? d.loaderData,\n )\n\n return (match as unknown as RouteMatch).store.state.loaderData as any\n}\n\nexport function useSearch<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n TSearch = RegisteredAllRouteInfo['routeInfoById'][TFrom]['fullSearchSchema'],\n TSelected = TSearch,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n track?: (search: TSearch) => TSelected\n}): TStrict extends true ? TSelected : TSelected | undefined {\n const match = useMatch(opts)\n useStore(\n (match as any).store,\n (d: any) => opts?.track?.(d.search) ?? d.search,\n )\n\n return (match as unknown as RouteMatch).store.state.search as any\n}\n\nexport function useParams<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TDefaultSelected = Expand<\n RegisteredAllRouteInfo['allParams'] &\n RegisteredAllRouteInfo['routeInfoById'][TFrom]['allParams']\n >,\n TSelected = TDefaultSelected,\n>(opts?: {\n from: TFrom\n track?: (search: TDefaultSelected) => TSelected\n}): TSelected {\n const router = useRouter()\n useStore(router.store, (d) => {\n const params = last(d.currentMatches)?.params as any\n return opts?.track?.(params) ?? params\n })\n\n return last(router.store.state.currentMatches)?.params as any\n}\n\nexport function useNavigate<\n TDefaultFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n>(defaultOpts: { from?: TDefaultFrom }) {\n const router = useRouter()\n return <\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = TDefaultFrom,\n TTo extends string = '.',\n >(\n opts: MakeLinkOptions<TFrom, TTo>,\n ) => {\n return router.navigate({ ...defaultOpts, ...(opts as any) })\n }\n}\n\nexport function useMatchRoute() {\n const router = useRouter()\n\n return <\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n >(\n opts: MakeUseMatchRouteOptions<TFrom, TTo>,\n ) => {\n const { pending, caseSensitive, ...rest } = opts\n\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n }\n}\n\nexport function MatchRoute<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n>(props: MakeMatchRouteOptions<TFrom, TTo>): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props)\n\n if (!params) {\n return null\n }\n\n if (typeof props.children === 'function') {\n return (props.children as any)(params)\n }\n\n return params ? props.children : null\n}\n\nexport function Outlet() {\n const matches = useMatches().slice(1)\n const match = matches[0]\n\n if (!match) {\n return null\n }\n\n return <SubOutlet matches={matches} match={match} />\n}\n\nfunction SubOutlet({\n matches,\n match,\n}: {\n matches: RouteMatch[]\n match: RouteMatch\n}) {\n const router = useRouter()\n useStore(match!.store)\n\n const defaultPending = React.useCallback(() => null, [])\n\n const Inner = React.useCallback((props: { match: RouteMatch }): any => {\n if (props.match.store.state.status === 'error') {\n throw props.match.store.state.error\n }\n\n if (props.match.store.state.status === 'success') {\n return React.createElement(\n (props.match.component as any) ??\n router.options.defaultComponent ??\n Outlet,\n )\n }\n\n if (props.match.store.state.status === 'loading') {\n throw props.match.__loadPromise\n }\n\n invariant(\n false,\n 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!',\n )\n }, [])\n\n const PendingComponent = (match.pendingComponent ??\n router.options.defaultPendingComponent ??\n defaultPending) as any\n\n const errorComponent =\n match.errorComponent ?? router.options.defaultErrorComponent\n\n return (\n <matchesContext.Provider value={matches}>\n <React.Suspense fallback={<PendingComponent />}>\n <CatchBoundary\n key={match.route.id}\n errorComponent={errorComponent}\n match={match as any}\n >\n <Inner match={match} />\n </CatchBoundary>\n </React.Suspense>\n {/* Provide a suffix suspense boundary to make sure the router is\n ready to be dehydrated on the server */}\n {/* {router.options.ssrFooter && match.matchId === rootRouteId ? (\n <React.Suspense fallback={null}>\n {(() => {\n if (router.store.pending) {\n throw router.navigationPromise\n }\n\n return router.options.ssrFooter()\n })()}\n </React.Suspense>\n ) : null} */}\n </matchesContext.Provider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n errorComponent: any\n match: RouteMatch\n}> {\n state = {\n error: false,\n info: undefined,\n }\n\n componentDidCatch(error: any, info: any) {\n console.error(`Error in route match: ${this.props.match.id}`)\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n\n render() {\n return (\n <CatchBoundaryInner\n {...this.props}\n errorState={this.state}\n reset={() => this.setState({})}\n />\n )\n }\n}\n\n// This is the messiest thing ever... I'm either seriously tired (likely) or\n// there has to be a better way to reset error boundaries when the\n// router's location key changes.\nfunction CatchBoundaryInner(props: {\n children: any\n errorComponent: any\n errorState: { error: unknown; info: any }\n reset: () => void\n}) {\n const [activeErrorState, setActiveErrorState] = React.useState(\n props.errorState,\n )\n const router = useRouter()\n const errorComponent = props.errorComponent ?? DefaultErrorBoundary\n\n // React.useEffect(() => {\n // if (activeErrorState) {\n // let prevKey = router.store.currentLocation.key\n // return createRoot((dispose) => {\n // createEffect(() => {\n // if (router.store.currentLocation.key !== prevKey) {\n // prevKey = router.store.currentLocation.key\n // setActiveErrorState({} as any)\n // }\n // })\n\n // return dispose\n // })\n // }\n\n // return\n // }, [activeErrorState])\n\n React.useEffect(() => {\n if (props.errorState.error) {\n setActiveErrorState(props.errorState)\n }\n props.reset()\n }, [props.errorState.error])\n\n if (props.errorState.error) {\n return React.createElement(errorComponent, activeErrorState)\n }\n\n return props.children\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n </div>\n )\n}\n\nexport function useAction<\n TKey extends string = string,\n TPayload = unknown,\n TResponse = unknown,\n TError = Error,\n>(\n action: Action<TKey, TPayload, TResponse, TError>,\n opts?: {\n track?: (actionStore: ActionStore<TPayload, TResponse, TError>) => any\n },\n): Action & {\n latestSubmission: ActionSubmission<TPayload, TResponse, TError>\n pendingSubmissions: ActionSubmission<TPayload, TResponse, TError>[]\n} {\n useStore(action.store, (d) => opts?.track?.(d) ?? d, true)\n\n const [ref] = React.useState({})\n\n Object.assign(ref, {\n ...action,\n latestSubmission:\n action.store.state.submissions[action.store.state.submissions.length - 1],\n pendingSubmissions: React.useMemo(\n () =>\n action.store.state.submissions.filter((d) => d.status === 'pending'),\n [action.store.state.submissions],\n ),\n })\n\n return ref as any\n}\n\n// TODO: While we migrate away from the history package, these need to be disabled\n// export function usePrompt(message: string, when: boolean | any): void {\n// const router = useRouter()\n\n// React.useEffect(() => {\n// if (!when) return\n\n// let unblock = router.getHistory().block((transition) => {\n// if (window.confirm(message)) {\n// unblock()\n// transition.retry()\n// } else {\n// router.setStore((s) => {\n// s.currentLocation.pathname = window.location.pathname\n// })\n// }\n// })\n\n// return unblock\n// }, [when, message])\n// }\n\n// export function Prompt({ message, when, children }: PromptProps) {\n// usePrompt(message, when ?? true)\n// return (children ?? null) as ReactNode\n// }\n"],"names":["lazy","importer","lazyComp","React","finalComp","preload","useLinkProps","options","router","useRouter","type","children","target","activeProps","className","inactiveProps","activeOptions","disabled","hash","search","params","to","preloadDelay","preloadMaxAge","replace","style","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","rest","linkInfo","buildLink","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","reactHandleClick","e","startTransition","composeHandlers","handlers","persist","filter","Boolean","forEach","handler","defaultPrevented","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","undefined","join","role","Link","forwardRef","props","ref","linkProps","_extends","matchesContext","createContext","routerContext","ReactRouter","Router","constructor","opts","loadComponent","component","RouterProvider","update","currentMatches","useStore","store","s","status","pendingMatches","useEffect","mount","value","useContext","warning","useRouterStore","selector","shallow","useMatches","useMatch","nearestMatch","match","from","state","find","d","route","id","invariant","strict","track","useRoute","routeId","resolvedRoute","getRoute","useLoaderData","loaderData","useSearch","useParams","last","useNavigate","defaultOpts","navigate","useMatchRoute","pending","caseSensitive","matchRoute","MatchRoute","Outlet","matches","slice","SubOutlet","defaultPending","useCallback","Inner","error","createElement","defaultComponent","__loadPromise","PendingComponent","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","CatchBoundary","Component","info","componentDidCatch","console","setState","render","CatchBoundaryInner","activeErrorState","setActiveErrorState","useState","errorState","DefaultErrorBoundary","reset","padding","maxWidth","fontSize","height","message","border","borderRadius","color","useAction","action","Object","assign","latestSubmission","submissions","length","pendingSubmissions","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA;;AAUO,SAASA,IAAI,CAClBC,QAAwD,EACxC;AAChB,EAAA,MAAMC,QAAQ,gBAAGC,gBAAK,CAACH,IAAI,CAACC,QAAQ,CAAQ,CAAA;EAG5C,MAAMG,SAAS,GAAGF,QAAqC,CAAA;EAEvDE,SAAS,CAACC,OAAO,GAAG,YAAY;IACd;AACd,MAAA,MAAMJ,QAAQ,EAAE,CAAA;AAClB,KAAA;GACD,CAAA;AAED,EAAA,OAAOG,SAAS,CAAA;AAClB,CAAA;AAwEA;;AAEO,SAASE,YAAY,CAI1BC,OAAyC,EACM;EAC/C,MAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;EAE1B,MAAM;AACJ;IACAC,IAAI;IACJC,QAAQ;IACRC,MAAM;AACNC,IAAAA,WAAW,GAAG,OAAO;AAAEC,MAAAA,SAAS,EAAE,QAAA;AAAS,KAAC,CAAC;AAC7CC,IAAAA,aAAa,GAAG,OAAO,EAAE,CAAC;IAC1BC,aAAa;IACbC,QAAQ;AACR;IACAC,IAAI;IACJC,MAAM;IACNC,MAAM;AACNC,IAAAA,EAAE,GAAG,GAAG;IACRhB,OAAO;IACPiB,YAAY;IACZC,aAAa;IACbC,OAAO;AACP;IACAC,KAAK;IACLX,SAAS;IACTY,OAAO;IACPC,OAAO;IACPC,YAAY;IACZC,YAAY;IACZC,YAAY;IACZC,UAAU;IACV,GAAGC,IAAAA;AACL,GAAC,GAAGzB,OAAO,CAAA;AAEX,EAAA,MAAM0B,QAAQ,GAAGzB,MAAM,CAAC0B,SAAS,CAAC3B,OAAO,CAAQ,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