[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/script-modules/route/ -> index.js (source)

   1  var __create = Object.create;
   2  var __defProp = Object.defineProperty;
   3  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   4  var __getOwnPropNames = Object.getOwnPropertyNames;
   5  var __getProtoOf = Object.getPrototypeOf;
   6  var __hasOwnProp = Object.prototype.hasOwnProperty;
   7  var __commonJS = (cb, mod) => function __require() {
   8    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
   9  };
  10  var __copyProps = (to, from, except, desc) => {
  11    if (from && typeof from === "object" || typeof from === "function") {
  12      for (let key of __getOwnPropNames(from))
  13        if (!__hasOwnProp.call(to, key) && key !== except)
  14          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15    }
  16    return to;
  17  };
  18  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  19    // If the importer is in node compatibility mode or this is not an ESM
  20    // file that has been converted to a CommonJS file using a Babel-
  21    // compatible transform (i.e. "__esModule" has not been set), then set
  22    // "default" to the CommonJS "module.exports" for node compatibility.
  23    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  24    mod
  25  ));
  26  
  27  // vendor-external:react/jsx-runtime
  28  var require_jsx_runtime = __commonJS({
  29    "vendor-external:react/jsx-runtime"(exports, module) {
  30      module.exports = window.ReactJSXRuntime;
  31    }
  32  });
  33  
  34  // vendor-external:react
  35  var require_react = __commonJS({
  36    "vendor-external:react"(exports, module) {
  37      module.exports = window.React;
  38    }
  39  });
  40  
  41  // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
  42  var require_use_sync_external_store_shim_development = __commonJS({
  43    "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
  44      "use strict";
  45      (function() {
  46        function is(x, y) {
  47          return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
  48        }
  49        function useSyncExternalStore$2(subscribe2, getSnapshot) {
  50          didWarnOld18Alpha || void 0 === React12.startTransition || (didWarnOld18Alpha = true, console.error(
  51            "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
  52          ));
  53          var value = getSnapshot();
  54          if (!didWarnUncachedGetSnapshot) {
  55            var cachedValue = getSnapshot();
  56            objectIs(value, cachedValue) || (console.error(
  57              "The result of getSnapshot should be cached to avoid an infinite loop"
  58            ), didWarnUncachedGetSnapshot = true);
  59          }
  60          cachedValue = useState4({
  61            inst: { value, getSnapshot }
  62          });
  63          var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
  64          useLayoutEffect3(
  65            function() {
  66              inst.value = value;
  67              inst.getSnapshot = getSnapshot;
  68              checkIfSnapshotChanged(inst) && forceUpdate({ inst });
  69            },
  70            [subscribe2, value, getSnapshot]
  71          );
  72          useEffect5(
  73            function() {
  74              checkIfSnapshotChanged(inst) && forceUpdate({ inst });
  75              return subscribe2(function() {
  76                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
  77              });
  78            },
  79            [subscribe2]
  80          );
  81          useDebugValue(value);
  82          return value;
  83        }
  84        function checkIfSnapshotChanged(inst) {
  85          var latestGetSnapshot = inst.getSnapshot;
  86          inst = inst.value;
  87          try {
  88            var nextValue = latestGetSnapshot();
  89            return !objectIs(inst, nextValue);
  90          } catch (error) {
  91            return true;
  92          }
  93        }
  94        function useSyncExternalStore$1(subscribe2, getSnapshot) {
  95          return getSnapshot();
  96        }
  97        "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
  98        var React12 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState4 = React12.useState, useEffect5 = React12.useEffect, useLayoutEffect3 = React12.useLayoutEffect, useDebugValue = React12.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
  99        exports.useSyncExternalStore = void 0 !== React12.useSyncExternalStore ? React12.useSyncExternalStore : shim;
 100        "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 101      })();
 102    }
 103  });
 104  
 105  // node_modules/use-sync-external-store/shim/index.js
 106  var require_shim = __commonJS({
 107    "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
 108      "use strict";
 109      if (false) {
 110        module.exports = null;
 111      } else {
 112        module.exports = require_use_sync_external_store_shim_development();
 113      }
 114    }
 115  });
 116  
 117  // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
 118  var require_with_selector_development = __commonJS({
 119    "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
 120      "use strict";
 121      (function() {
 122        function is(x, y) {
 123          return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
 124        }
 125        "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
 126        var React12 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef7 = React12.useRef, useEffect5 = React12.useEffect, useMemo3 = React12.useMemo, useDebugValue = React12.useDebugValue;
 127        exports.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot, getServerSnapshot, selector, isEqual) {
 128          var instRef = useRef7(null);
 129          if (null === instRef.current) {
 130            var inst = { hasValue: false, value: null };
 131            instRef.current = inst;
 132          } else inst = instRef.current;
 133          instRef = useMemo3(
 134            function() {
 135              function memoizedSelector(nextSnapshot) {
 136                if (!hasMemo) {
 137                  hasMemo = true;
 138                  memoizedSnapshot = nextSnapshot;
 139                  nextSnapshot = selector(nextSnapshot);
 140                  if (void 0 !== isEqual && inst.hasValue) {
 141                    var currentSelection = inst.value;
 142                    if (isEqual(currentSelection, nextSnapshot))
 143                      return memoizedSelection = currentSelection;
 144                  }
 145                  return memoizedSelection = nextSnapshot;
 146                }
 147                currentSelection = memoizedSelection;
 148                if (objectIs(memoizedSnapshot, nextSnapshot))
 149                  return currentSelection;
 150                var nextSelection = selector(nextSnapshot);
 151                if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
 152                  return memoizedSnapshot = nextSnapshot, currentSelection;
 153                memoizedSnapshot = nextSnapshot;
 154                return memoizedSelection = nextSelection;
 155              }
 156              var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
 157              return [
 158                function() {
 159                  return memoizedSelector(getSnapshot());
 160                },
 161                null === maybeGetServerSnapshot ? void 0 : function() {
 162                  return memoizedSelector(maybeGetServerSnapshot());
 163                }
 164              ];
 165            },
 166            [getSnapshot, getServerSnapshot, selector, isEqual]
 167          );
 168          var value = useSyncExternalStore(subscribe2, instRef[0], instRef[1]);
 169          useEffect5(
 170            function() {
 171              inst.hasValue = true;
 172              inst.value = value;
 173            },
 174            [value]
 175          );
 176          useDebugValue(value);
 177          return value;
 178        };
 179        "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 180      })();
 181    }
 182  });
 183  
 184  // node_modules/use-sync-external-store/shim/with-selector.js
 185  var require_with_selector = __commonJS({
 186    "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
 187      "use strict";
 188      if (false) {
 189        module.exports = null;
 190      } else {
 191        module.exports = require_with_selector_development();
 192      }
 193    }
 194  });
 195  
 196  // vendor-external:react-dom
 197  var require_react_dom = __commonJS({
 198    "vendor-external:react-dom"(exports, module) {
 199      module.exports = window.ReactDOM;
 200    }
 201  });
 202  
 203  // package-external:@wordpress/private-apis
 204  var require_private_apis = __commonJS({
 205    "package-external:@wordpress/private-apis"(exports, module) {
 206      module.exports = window.wp.privateApis;
 207    }
 208  });
 209  
 210  // node_modules/@tanstack/store/dist/esm/scheduler.js
 211  var __storeToDerived = /* @__PURE__ */ new WeakMap();
 212  var __derivedToStore = /* @__PURE__ */ new WeakMap();
 213  var __depsThatHaveWrittenThisTick = {
 214    current: []
 215  };
 216  var __isFlushing = false;
 217  var __batchDepth = 0;
 218  var __pendingUpdates = /* @__PURE__ */ new Set();
 219  var __initialBatchValues = /* @__PURE__ */ new Map();
 220  function __flush_internals(relatedVals) {
 221    for (const derived of relatedVals) {
 222      if (__depsThatHaveWrittenThisTick.current.includes(derived)) {
 223        continue;
 224      }
 225      __depsThatHaveWrittenThisTick.current.push(derived);
 226      derived.recompute();
 227      const stores = __derivedToStore.get(derived);
 228      if (stores) {
 229        for (const store of stores) {
 230          const relatedLinkedDerivedVals = __storeToDerived.get(store);
 231          if (!(relatedLinkedDerivedVals == null ? void 0 : relatedLinkedDerivedVals.length)) continue;
 232          __flush_internals(relatedLinkedDerivedVals);
 233        }
 234      }
 235    }
 236  }
 237  function __notifyListeners(store) {
 238    const value = {
 239      prevVal: store.prevState,
 240      currentVal: store.state
 241    };
 242    for (const listener of store.listeners) {
 243      listener(value);
 244    }
 245  }
 246  function __notifyDerivedListeners(derived) {
 247    const value = {
 248      prevVal: derived.prevState,
 249      currentVal: derived.state
 250    };
 251    for (const listener of derived.listeners) {
 252      listener(value);
 253    }
 254  }
 255  function __flush(store) {
 256    if (__batchDepth > 0 && !__initialBatchValues.has(store)) {
 257      __initialBatchValues.set(store, store.prevState);
 258    }
 259    __pendingUpdates.add(store);
 260    if (__batchDepth > 0) return;
 261    if (__isFlushing) return;
 262    try {
 263      __isFlushing = true;
 264      while (__pendingUpdates.size > 0) {
 265        const stores = Array.from(__pendingUpdates);
 266        __pendingUpdates.clear();
 267        for (const store2 of stores) {
 268          const prevState = __initialBatchValues.get(store2) ?? store2.prevState;
 269          store2.prevState = prevState;
 270          __notifyListeners(store2);
 271        }
 272        for (const store2 of stores) {
 273          const derivedVals = __storeToDerived.get(store2);
 274          if (!derivedVals) continue;
 275          __depsThatHaveWrittenThisTick.current.push(store2);
 276          __flush_internals(derivedVals);
 277        }
 278        for (const store2 of stores) {
 279          const derivedVals = __storeToDerived.get(store2);
 280          if (!derivedVals) continue;
 281          for (const derived of derivedVals) {
 282            __notifyDerivedListeners(derived);
 283          }
 284        }
 285      }
 286    } finally {
 287      __isFlushing = false;
 288      __depsThatHaveWrittenThisTick.current = [];
 289      __initialBatchValues.clear();
 290    }
 291  }
 292  function batch(fn) {
 293    __batchDepth++;
 294    try {
 295      fn();
 296    } finally {
 297      __batchDepth--;
 298      if (__batchDepth === 0) {
 299        const pendingUpdateToFlush = __pendingUpdates.values().next().value;
 300        if (pendingUpdateToFlush) {
 301          __flush(pendingUpdateToFlush);
 302        }
 303      }
 304    }
 305  }
 306  
 307  // node_modules/@tanstack/store/dist/esm/types.js
 308  function isUpdaterFunction(updater) {
 309    return typeof updater === "function";
 310  }
 311  
 312  // node_modules/@tanstack/store/dist/esm/store.js
 313  var Store = class {
 314    constructor(initialState, options) {
 315      this.listeners = /* @__PURE__ */ new Set();
 316      this.subscribe = (listener) => {
 317        var _a, _b;
 318        this.listeners.add(listener);
 319        const unsub = (_b = (_a = this.options) == null ? void 0 : _a.onSubscribe) == null ? void 0 : _b.call(_a, listener, this);
 320        return () => {
 321          this.listeners.delete(listener);
 322          unsub == null ? void 0 : unsub();
 323        };
 324      };
 325      this.prevState = initialState;
 326      this.state = initialState;
 327      this.options = options;
 328    }
 329    setState(updater) {
 330      var _a, _b, _c;
 331      this.prevState = this.state;
 332      if ((_a = this.options) == null ? void 0 : _a.updateFn) {
 333        this.state = this.options.updateFn(this.prevState)(updater);
 334      } else {
 335        if (isUpdaterFunction(updater)) {
 336          this.state = updater(this.prevState);
 337        } else {
 338          this.state = updater;
 339        }
 340      }
 341      (_c = (_b = this.options) == null ? void 0 : _b.onUpdate) == null ? void 0 : _c.call(_b);
 342      __flush(this);
 343    }
 344  };
 345  
 346  // node_modules/@tanstack/history/dist/esm/index.js
 347  var stateIndexKey = "__TSR_index";
 348  var popStateEvent = "popstate";
 349  var beforeUnloadEvent = "beforeunload";
 350  function createHistory(opts) {
 351    let location = opts.getLocation();
 352    const subscribers = /* @__PURE__ */ new Set();
 353    const notify = (action) => {
 354      location = opts.getLocation();
 355      subscribers.forEach((subscriber) => subscriber({ location, action }));
 356    };
 357    const handleIndexChange = (action) => {
 358      if (opts.notifyOnIndexChange ?? true) notify(action);
 359      else location = opts.getLocation();
 360    };
 361    const tryNavigation = async ({
 362      task,
 363      navigateOpts,
 364      ...actionInfo
 365    }) => {
 366      const ignoreBlocker = navigateOpts?.ignoreBlocker ?? false;
 367      if (ignoreBlocker) {
 368        task();
 369        return;
 370      }
 371      const blockers = opts.getBlockers?.() ?? [];
 372      const isPushOrReplace = actionInfo.type === "PUSH" || actionInfo.type === "REPLACE";
 373      if (typeof document !== "undefined" && blockers.length && isPushOrReplace) {
 374        for (const blocker of blockers) {
 375          const nextLocation = parseHref(actionInfo.path, actionInfo.state);
 376          const isBlocked = await blocker.blockerFn({
 377            currentLocation: location,
 378            nextLocation,
 379            action: actionInfo.type
 380          });
 381          if (isBlocked) {
 382            opts.onBlocked?.();
 383            return;
 384          }
 385        }
 386      }
 387      task();
 388    };
 389    return {
 390      get location() {
 391        return location;
 392      },
 393      get length() {
 394        return opts.getLength();
 395      },
 396      subscribers,
 397      subscribe: (cb) => {
 398        subscribers.add(cb);
 399        return () => {
 400          subscribers.delete(cb);
 401        };
 402      },
 403      push: (path, state, navigateOpts) => {
 404        const currentIndex = location.state[stateIndexKey];
 405        state = assignKeyAndIndex(currentIndex + 1, state);
 406        tryNavigation({
 407          task: () => {
 408            opts.pushState(path, state);
 409            notify({ type: "PUSH" });
 410          },
 411          navigateOpts,
 412          type: "PUSH",
 413          path,
 414          state
 415        });
 416      },
 417      replace: (path, state, navigateOpts) => {
 418        const currentIndex = location.state[stateIndexKey];
 419        state = assignKeyAndIndex(currentIndex, state);
 420        tryNavigation({
 421          task: () => {
 422            opts.replaceState(path, state);
 423            notify({ type: "REPLACE" });
 424          },
 425          navigateOpts,
 426          type: "REPLACE",
 427          path,
 428          state
 429        });
 430      },
 431      go: (index, navigateOpts) => {
 432        tryNavigation({
 433          task: () => {
 434            opts.go(index);
 435            handleIndexChange({ type: "GO", index });
 436          },
 437          navigateOpts,
 438          type: "GO"
 439        });
 440      },
 441      back: (navigateOpts) => {
 442        tryNavigation({
 443          task: () => {
 444            opts.back(navigateOpts?.ignoreBlocker ?? false);
 445            handleIndexChange({ type: "BACK" });
 446          },
 447          navigateOpts,
 448          type: "BACK"
 449        });
 450      },
 451      forward: (navigateOpts) => {
 452        tryNavigation({
 453          task: () => {
 454            opts.forward(navigateOpts?.ignoreBlocker ?? false);
 455            handleIndexChange({ type: "FORWARD" });
 456          },
 457          navigateOpts,
 458          type: "FORWARD"
 459        });
 460      },
 461      canGoBack: () => location.state[stateIndexKey] !== 0,
 462      createHref: (str) => opts.createHref(str),
 463      block: (blocker) => {
 464        if (!opts.setBlockers) return () => {
 465        };
 466        const blockers = opts.getBlockers?.() ?? [];
 467        opts.setBlockers([...blockers, blocker]);
 468        return () => {
 469          const blockers2 = opts.getBlockers?.() ?? [];
 470          opts.setBlockers?.(blockers2.filter((b) => b !== blocker));
 471        };
 472      },
 473      flush: () => opts.flush?.(),
 474      destroy: () => opts.destroy?.(),
 475      notify
 476    };
 477  }
 478  function assignKeyAndIndex(index, state) {
 479    if (!state) {
 480      state = {};
 481    }
 482    const key = createRandomKey();
 483    return {
 484      ...state,
 485      key,
 486      // TODO: Remove in v2 - use __TSR_key instead
 487      __TSR_key: key,
 488      [stateIndexKey]: index
 489    };
 490  }
 491  function createBrowserHistory(opts) {
 492    const win = opts?.window ?? (typeof document !== "undefined" ? window : void 0);
 493    const originalPushState = win.history.pushState;
 494    const originalReplaceState = win.history.replaceState;
 495    let blockers = [];
 496    const _getBlockers = () => blockers;
 497    const _setBlockers = (newBlockers) => blockers = newBlockers;
 498    const createHref = opts?.createHref ?? ((path) => path);
 499    const parseLocation = opts?.parseLocation ?? (() => parseHref(
 500      `$win.location.pathname}$win.location.search}$win.location.hash}`,
 501      win.history.state
 502    ));
 503    if (!win.history.state?.__TSR_key && !win.history.state?.key) {
 504      const addedKey = createRandomKey();
 505      win.history.replaceState(
 506        {
 507          [stateIndexKey]: 0,
 508          key: addedKey,
 509          // TODO: Remove in v2 - use __TSR_key instead
 510          __TSR_key: addedKey
 511        },
 512        ""
 513      );
 514    }
 515    let currentLocation = parseLocation();
 516    let rollbackLocation;
 517    let nextPopIsGo = false;
 518    let ignoreNextPop = false;
 519    let skipBlockerNextPop = false;
 520    let ignoreNextBeforeUnload = false;
 521    const getLocation = () => currentLocation;
 522    let next;
 523    let scheduled;
 524    const flush = () => {
 525      if (!next) {
 526        return;
 527      }
 528      history._ignoreSubscribers = true;
 529      (next.isPush ? win.history.pushState : win.history.replaceState)(
 530        next.state,
 531        "",
 532        next.href
 533      );
 534      history._ignoreSubscribers = false;
 535      next = void 0;
 536      scheduled = void 0;
 537      rollbackLocation = void 0;
 538    };
 539    const queueHistoryAction = (type, destHref, state) => {
 540      const href = createHref(destHref);
 541      if (!scheduled) {
 542        rollbackLocation = currentLocation;
 543      }
 544      currentLocation = parseHref(destHref, state);
 545      next = {
 546        href,
 547        state,
 548        isPush: next?.isPush || type === "push"
 549      };
 550      if (!scheduled) {
 551        scheduled = Promise.resolve().then(() => flush());
 552      }
 553    };
 554    const onPushPop = (type) => {
 555      currentLocation = parseLocation();
 556      history.notify({ type });
 557    };
 558    const onPushPopEvent = async () => {
 559      if (ignoreNextPop) {
 560        ignoreNextPop = false;
 561        return;
 562      }
 563      const nextLocation = parseLocation();
 564      const delta = nextLocation.state[stateIndexKey] - currentLocation.state[stateIndexKey];
 565      const isForward = delta === 1;
 566      const isBack = delta === -1;
 567      const isGo = !isForward && !isBack || nextPopIsGo;
 568      nextPopIsGo = false;
 569      const action = isGo ? "GO" : isBack ? "BACK" : "FORWARD";
 570      const notify = isGo ? {
 571        type: "GO",
 572        index: delta
 573      } : {
 574        type: isBack ? "BACK" : "FORWARD"
 575      };
 576      if (skipBlockerNextPop) {
 577        skipBlockerNextPop = false;
 578      } else {
 579        const blockers2 = _getBlockers();
 580        if (typeof document !== "undefined" && blockers2.length) {
 581          for (const blocker of blockers2) {
 582            const isBlocked = await blocker.blockerFn({
 583              currentLocation,
 584              nextLocation,
 585              action
 586            });
 587            if (isBlocked) {
 588              ignoreNextPop = true;
 589              win.history.go(1);
 590              history.notify(notify);
 591              return;
 592            }
 593          }
 594        }
 595      }
 596      currentLocation = parseLocation();
 597      history.notify(notify);
 598    };
 599    const onBeforeUnload = (e) => {
 600      if (ignoreNextBeforeUnload) {
 601        ignoreNextBeforeUnload = false;
 602        return;
 603      }
 604      let shouldBlock = false;
 605      const blockers2 = _getBlockers();
 606      if (typeof document !== "undefined" && blockers2.length) {
 607        for (const blocker of blockers2) {
 608          const shouldHaveBeforeUnload = blocker.enableBeforeUnload ?? true;
 609          if (shouldHaveBeforeUnload === true) {
 610            shouldBlock = true;
 611            break;
 612          }
 613          if (typeof shouldHaveBeforeUnload === "function" && shouldHaveBeforeUnload() === true) {
 614            shouldBlock = true;
 615            break;
 616          }
 617        }
 618      }
 619      if (shouldBlock) {
 620        e.preventDefault();
 621        return e.returnValue = "";
 622      }
 623      return;
 624    };
 625    const history = createHistory({
 626      getLocation,
 627      getLength: () => win.history.length,
 628      pushState: (href, state) => queueHistoryAction("push", href, state),
 629      replaceState: (href, state) => queueHistoryAction("replace", href, state),
 630      back: (ignoreBlocker) => {
 631        if (ignoreBlocker) skipBlockerNextPop = true;
 632        ignoreNextBeforeUnload = true;
 633        return win.history.back();
 634      },
 635      forward: (ignoreBlocker) => {
 636        if (ignoreBlocker) skipBlockerNextPop = true;
 637        ignoreNextBeforeUnload = true;
 638        win.history.forward();
 639      },
 640      go: (n) => {
 641        nextPopIsGo = true;
 642        win.history.go(n);
 643      },
 644      createHref: (href) => createHref(href),
 645      flush,
 646      destroy: () => {
 647        win.history.pushState = originalPushState;
 648        win.history.replaceState = originalReplaceState;
 649        win.removeEventListener(beforeUnloadEvent, onBeforeUnload, {
 650          capture: true
 651        });
 652        win.removeEventListener(popStateEvent, onPushPopEvent);
 653      },
 654      onBlocked: () => {
 655        if (rollbackLocation && currentLocation !== rollbackLocation) {
 656          currentLocation = rollbackLocation;
 657        }
 658      },
 659      getBlockers: _getBlockers,
 660      setBlockers: _setBlockers,
 661      notifyOnIndexChange: false
 662    });
 663    win.addEventListener(beforeUnloadEvent, onBeforeUnload, { capture: true });
 664    win.addEventListener(popStateEvent, onPushPopEvent);
 665    win.history.pushState = function(...args) {
 666      const res = originalPushState.apply(win.history, args);
 667      if (!history._ignoreSubscribers) onPushPop("PUSH");
 668      return res;
 669    };
 670    win.history.replaceState = function(...args) {
 671      const res = originalReplaceState.apply(win.history, args);
 672      if (!history._ignoreSubscribers) onPushPop("REPLACE");
 673      return res;
 674    };
 675    return history;
 676  }
 677  function parseHref(href, state) {
 678    const hashIndex = href.indexOf("#");
 679    const searchIndex = href.indexOf("?");
 680    const addedKey = createRandomKey();
 681    return {
 682      href,
 683      pathname: href.substring(
 684        0,
 685        hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : href.length
 686      ),
 687      hash: hashIndex > -1 ? href.substring(hashIndex) : "",
 688      search: searchIndex > -1 ? href.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
 689      state: state || { [stateIndexKey]: 0, key: addedKey, __TSR_key: addedKey }
 690    };
 691  }
 692  function createRandomKey() {
 693    return (Math.random() + 1).toString(36).substring(7);
 694  }
 695  
 696  // node_modules/@tanstack/router-core/dist/esm/utils.js
 697  function last(arr) {
 698    return arr[arr.length - 1];
 699  }
 700  function isFunction(d) {
 701    return typeof d === "function";
 702  }
 703  function functionalUpdate(updater, previous) {
 704    if (isFunction(updater)) {
 705      return updater(previous);
 706    }
 707    return updater;
 708  }
 709  var hasOwn = Object.prototype.hasOwnProperty;
 710  function replaceEqualDeep(prev, _next) {
 711    if (prev === _next) {
 712      return prev;
 713    }
 714    const next = _next;
 715    const array = isPlainArray(prev) && isPlainArray(next);
 716    if (!array && !(isPlainObject(prev) && isPlainObject(next))) return next;
 717    const prevItems = array ? prev : getEnumerableOwnKeys(prev);
 718    if (!prevItems) return next;
 719    const nextItems = array ? next : getEnumerableOwnKeys(next);
 720    if (!nextItems) return next;
 721    const prevSize = prevItems.length;
 722    const nextSize = nextItems.length;
 723    const copy = array ? new Array(nextSize) : {};
 724    let equalItems = 0;
 725    for (let i = 0; i < nextSize; i++) {
 726      const key = array ? i : nextItems[i];
 727      const p = prev[key];
 728      const n = next[key];
 729      if (p === n) {
 730        copy[key] = p;
 731        if (array ? i < prevSize : hasOwn.call(prev, key)) equalItems++;
 732        continue;
 733      }
 734      if (p === null || n === null || typeof p !== "object" || typeof n !== "object") {
 735        copy[key] = n;
 736        continue;
 737      }
 738      const v = replaceEqualDeep(p, n);
 739      copy[key] = v;
 740      if (v === p) equalItems++;
 741    }
 742    return prevSize === nextSize && equalItems === prevSize ? prev : copy;
 743  }
 744  function getEnumerableOwnKeys(o) {
 745    const keys = [];
 746    const names = Object.getOwnPropertyNames(o);
 747    for (const name of names) {
 748      if (!Object.prototype.propertyIsEnumerable.call(o, name)) return false;
 749      keys.push(name);
 750    }
 751    const symbols = Object.getOwnPropertySymbols(o);
 752    for (const symbol of symbols) {
 753      if (!Object.prototype.propertyIsEnumerable.call(o, symbol)) return false;
 754      keys.push(symbol);
 755    }
 756    return keys;
 757  }
 758  function isPlainObject(o) {
 759    if (!hasObjectPrototype(o)) {
 760      return false;
 761    }
 762    const ctor = o.constructor;
 763    if (typeof ctor === "undefined") {
 764      return true;
 765    }
 766    const prot = ctor.prototype;
 767    if (!hasObjectPrototype(prot)) {
 768      return false;
 769    }
 770    if (!prot.hasOwnProperty("isPrototypeOf")) {
 771      return false;
 772    }
 773    return true;
 774  }
 775  function hasObjectPrototype(o) {
 776    return Object.prototype.toString.call(o) === "[object Object]";
 777  }
 778  function isPlainArray(value) {
 779    return Array.isArray(value) && value.length === Object.keys(value).length;
 780  }
 781  function deepEqual(a, b, opts) {
 782    if (a === b) {
 783      return true;
 784    }
 785    if (typeof a !== typeof b) {
 786      return false;
 787    }
 788    if (Array.isArray(a) && Array.isArray(b)) {
 789      if (a.length !== b.length) return false;
 790      for (let i = 0, l = a.length; i < l; i++) {
 791        if (!deepEqual(a[i], b[i], opts)) return false;
 792      }
 793      return true;
 794    }
 795    if (isPlainObject(a) && isPlainObject(b)) {
 796      const ignoreUndefined = opts?.ignoreUndefined ?? true;
 797      if (opts?.partial) {
 798        for (const k in b) {
 799          if (!ignoreUndefined || b[k] !== void 0) {
 800            if (!deepEqual(a[k], b[k], opts)) return false;
 801          }
 802        }
 803        return true;
 804      }
 805      let aCount = 0;
 806      if (!ignoreUndefined) {
 807        aCount = Object.keys(a).length;
 808      } else {
 809        for (const k in a) {
 810          if (a[k] !== void 0) aCount++;
 811        }
 812      }
 813      let bCount = 0;
 814      for (const k in b) {
 815        if (!ignoreUndefined || b[k] !== void 0) {
 816          bCount++;
 817          if (bCount > aCount || !deepEqual(a[k], b[k], opts)) return false;
 818        }
 819      }
 820      return aCount === bCount;
 821    }
 822    return false;
 823  }
 824  function createControlledPromise(onResolve) {
 825    let resolveLoadPromise;
 826    let rejectLoadPromise;
 827    const controlledPromise = new Promise((resolve, reject) => {
 828      resolveLoadPromise = resolve;
 829      rejectLoadPromise = reject;
 830    });
 831    controlledPromise.status = "pending";
 832    controlledPromise.resolve = (value) => {
 833      controlledPromise.status = "resolved";
 834      controlledPromise.value = value;
 835      resolveLoadPromise(value);
 836      onResolve?.(value);
 837    };
 838    controlledPromise.reject = (e) => {
 839      controlledPromise.status = "rejected";
 840      rejectLoadPromise(e);
 841    };
 842    return controlledPromise;
 843  }
 844  function isPromise(value) {
 845    return Boolean(
 846      value && typeof value === "object" && typeof value.then === "function"
 847    );
 848  }
 849  function findLast(array, predicate) {
 850    for (let i = array.length - 1; i >= 0; i--) {
 851      const item = array[i];
 852      if (predicate(item)) return item;
 853    }
 854    return void 0;
 855  }
 856  var DECODE_IGNORE_LIST = Array.from(
 857    (/* @__PURE__ */ new Map([
 858      ["%", "%25"],
 859      ["\\", "%5C"],
 860      ["/", "%2F"],
 861      [";", "%3B"],
 862      [":", "%3A"],
 863      ["@", "%40"],
 864      ["&", "%26"],
 865      ["=", "%3D"],
 866      ["+", "%2B"],
 867      ["$", "%24"],
 868      [",", "%2C"]
 869    ])).values()
 870  );
 871  function decodePathSegment(part, decodeIgnore = DECODE_IGNORE_LIST, startIndex = 0) {
 872    function decode2(part2) {
 873      try {
 874        return decodeURIComponent(part2);
 875      } catch {
 876        return part2.replaceAll(/%[0-9A-Fa-f]{2}/g, (match) => {
 877          try {
 878            return decodeURIComponent(match);
 879          } catch {
 880            return match;
 881          }
 882        });
 883      }
 884    }
 885    if (part === "" || !part.match(/%[0-9A-Fa-f]{2}/g)) return part;
 886    for (let i = startIndex; i < decodeIgnore.length; i++) {
 887      const char = decodeIgnore[i];
 888      if (char && part.includes(char)) {
 889        const partsToDecode = part.split(char);
 890        const partsToJoin = [];
 891        for (const partToDecode of partsToDecode) {
 892          partsToJoin.push(decodePathSegment(partToDecode, decodeIgnore, i + 1));
 893        }
 894        return partsToJoin.join(char);
 895      }
 896    }
 897    return decode2(part);
 898  }
 899  
 900  // node_modules/tiny-invariant/dist/esm/tiny-invariant.js
 901  var isProduction = false;
 902  var prefix = "Invariant failed";
 903  function invariant(condition, message) {
 904    if (condition) {
 905      return;
 906    }
 907    if (isProduction) {
 908      throw new Error(prefix);
 909    }
 910    var provided = typeof message === "function" ? message() : message;
 911    var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
 912    throw new Error(value);
 913  }
 914  
 915  // node_modules/@tanstack/router-core/dist/esm/path.js
 916  var SEGMENT_TYPE_PATHNAME = 0;
 917  var SEGMENT_TYPE_PARAM = 1;
 918  var SEGMENT_TYPE_WILDCARD = 2;
 919  var SEGMENT_TYPE_OPTIONAL_PARAM = 3;
 920  function joinPaths(paths) {
 921    return cleanPath(
 922      paths.filter((val) => {
 923        return val !== void 0;
 924      }).join("/")
 925    );
 926  }
 927  function cleanPath(path) {
 928    return path.replace(/\/{2,}/g, "/");
 929  }
 930  function trimPathLeft(path) {
 931    return path === "/" ? path : path.replace(/^\/{1,}/, "");
 932  }
 933  function trimPathRight(path) {
 934    return path === "/" ? path : path.replace(/\/{1,}$/, "");
 935  }
 936  function trimPath(path) {
 937    return trimPathRight(trimPathLeft(path));
 938  }
 939  function removeTrailingSlash(value, basepath) {
 940    if (value?.endsWith("/") && value !== "/" && value !== `$basepath}/`) {
 941      return value.slice(0, -1);
 942    }
 943    return value;
 944  }
 945  function exactPathTest(pathName1, pathName2, basepath) {
 946    return removeTrailingSlash(pathName1, basepath) === removeTrailingSlash(pathName2, basepath);
 947  }
 948  function segmentToString(segment) {
 949    const { type, value } = segment;
 950    if (type === SEGMENT_TYPE_PATHNAME) {
 951      return value;
 952    }
 953    const { prefixSegment, suffixSegment } = segment;
 954    if (type === SEGMENT_TYPE_PARAM) {
 955      const param = value.substring(1);
 956      if (prefixSegment && suffixSegment) {
 957        return `$prefixSegment}{$$param}}$suffixSegment}`;
 958      } else if (prefixSegment) {
 959        return `$prefixSegment}{$$param}}`;
 960      } else if (suffixSegment) {
 961        return `{$$param}}$suffixSegment}`;
 962      }
 963    }
 964    if (type === SEGMENT_TYPE_OPTIONAL_PARAM) {
 965      const param = value.substring(1);
 966      if (prefixSegment && suffixSegment) {
 967        return `$prefixSegment}{-$$param}}$suffixSegment}`;
 968      } else if (prefixSegment) {
 969        return `$prefixSegment}{-$$param}}`;
 970      } else if (suffixSegment) {
 971        return `{-$$param}}$suffixSegment}`;
 972      }
 973      return `{-$$param}}`;
 974    }
 975    if (type === SEGMENT_TYPE_WILDCARD) {
 976      if (prefixSegment && suffixSegment) {
 977        return `$prefixSegment}{$}$suffixSegment}`;
 978      } else if (prefixSegment) {
 979        return `$prefixSegment}{$}`;
 980      } else if (suffixSegment) {
 981        return `{$}$suffixSegment}`;
 982      }
 983    }
 984    return value;
 985  }
 986  function resolvePath({
 987    base,
 988    to,
 989    trailingSlash = "never",
 990    parseCache
 991  }) {
 992    let baseSegments = parsePathname(base, parseCache).slice();
 993    const toSegments = parsePathname(to, parseCache);
 994    if (baseSegments.length > 1 && last(baseSegments)?.value === "/") {
 995      baseSegments.pop();
 996    }
 997    for (let index = 0, length = toSegments.length; index < length; index++) {
 998      const toSegment = toSegments[index];
 999      const value = toSegment.value;
1000      if (value === "/") {
1001        if (!index) {
1002          baseSegments = [toSegment];
1003        } else if (index === length - 1) {
1004          baseSegments.push(toSegment);
1005        } else ;
1006      } else if (value === "..") {
1007        baseSegments.pop();
1008      } else if (value === ".") ;
1009      else {
1010        baseSegments.push(toSegment);
1011      }
1012    }
1013    if (baseSegments.length > 1) {
1014      if (last(baseSegments).value === "/") {
1015        if (trailingSlash === "never") {
1016          baseSegments.pop();
1017        }
1018      } else if (trailingSlash === "always") {
1019        baseSegments.push({ type: SEGMENT_TYPE_PATHNAME, value: "/" });
1020      }
1021    }
1022    const segmentValues = baseSegments.map(segmentToString);
1023    const joined = joinPaths(segmentValues);
1024    return joined;
1025  }
1026  var parsePathname = (pathname, cache) => {
1027    if (!pathname) return [];
1028    const cached = cache?.get(pathname);
1029    if (cached) return cached;
1030    const parsed = baseParsePathname(pathname);
1031    cache?.set(pathname, parsed);
1032    return parsed;
1033  };
1034  var PARAM_RE = /^\$.{1,}$/;
1035  var PARAM_W_CURLY_BRACES_RE = /^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/;
1036  var OPTIONAL_PARAM_W_CURLY_BRACES_RE = /^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/;
1037  var WILDCARD_RE = /^\$$/;
1038  var WILDCARD_W_CURLY_BRACES_RE = /^(.*?)\{\$\}(.*)$/;
1039  function baseParsePathname(pathname) {
1040    pathname = cleanPath(pathname);
1041    const segments = [];
1042    if (pathname.slice(0, 1) === "/") {
1043      pathname = pathname.substring(1);
1044      segments.push({
1045        type: SEGMENT_TYPE_PATHNAME,
1046        value: "/"
1047      });
1048    }
1049    if (!pathname) {
1050      return segments;
1051    }
1052    const split = pathname.split("/").filter(Boolean);
1053    segments.push(
1054      ...split.map((part) => {
1055        const wildcardBracesMatch = part.match(WILDCARD_W_CURLY_BRACES_RE);
1056        if (wildcardBracesMatch) {
1057          const prefix2 = wildcardBracesMatch[1];
1058          const suffix = wildcardBracesMatch[2];
1059          return {
1060            type: SEGMENT_TYPE_WILDCARD,
1061            value: "$",
1062            prefixSegment: prefix2 || void 0,
1063            suffixSegment: suffix || void 0
1064          };
1065        }
1066        const optionalParamBracesMatch = part.match(
1067          OPTIONAL_PARAM_W_CURLY_BRACES_RE
1068        );
1069        if (optionalParamBracesMatch) {
1070          const prefix2 = optionalParamBracesMatch[1];
1071          const paramName = optionalParamBracesMatch[2];
1072          const suffix = optionalParamBracesMatch[3];
1073          return {
1074            type: SEGMENT_TYPE_OPTIONAL_PARAM,
1075            value: paramName,
1076            // Now just $paramName (no prefix)
1077            prefixSegment: prefix2 || void 0,
1078            suffixSegment: suffix || void 0
1079          };
1080        }
1081        const paramBracesMatch = part.match(PARAM_W_CURLY_BRACES_RE);
1082        if (paramBracesMatch) {
1083          const prefix2 = paramBracesMatch[1];
1084          const paramName = paramBracesMatch[2];
1085          const suffix = paramBracesMatch[3];
1086          return {
1087            type: SEGMENT_TYPE_PARAM,
1088            value: "" + paramName,
1089            prefixSegment: prefix2 || void 0,
1090            suffixSegment: suffix || void 0
1091          };
1092        }
1093        if (PARAM_RE.test(part)) {
1094          const paramName = part.substring(1);
1095          return {
1096            type: SEGMENT_TYPE_PARAM,
1097            value: "$" + paramName,
1098            prefixSegment: void 0,
1099            suffixSegment: void 0
1100          };
1101        }
1102        if (WILDCARD_RE.test(part)) {
1103          return {
1104            type: SEGMENT_TYPE_WILDCARD,
1105            value: "$",
1106            prefixSegment: void 0,
1107            suffixSegment: void 0
1108          };
1109        }
1110        return {
1111          type: SEGMENT_TYPE_PATHNAME,
1112          value: decodePathSegment(part)
1113        };
1114      })
1115    );
1116    if (pathname.slice(-1) === "/") {
1117      pathname = pathname.substring(1);
1118      segments.push({
1119        type: SEGMENT_TYPE_PATHNAME,
1120        value: "/"
1121      });
1122    }
1123    return segments;
1124  }
1125  function interpolatePath({
1126    path,
1127    params,
1128    leaveWildcards,
1129    leaveParams,
1130    decodeCharMap,
1131    parseCache
1132  }) {
1133    const interpolatedPathSegments = parsePathname(path, parseCache);
1134    function encodeParam(key) {
1135      const value = params[key];
1136      const isValueString = typeof value === "string";
1137      if (key === "*" || key === "_splat") {
1138        return isValueString ? encodeURI(value) : value;
1139      } else {
1140        return isValueString ? encodePathParam(value, decodeCharMap) : value;
1141      }
1142    }
1143    let isMissingParams = false;
1144    const usedParams = {};
1145    const interpolatedPath = joinPaths(
1146      interpolatedPathSegments.map((segment) => {
1147        if (segment.type === SEGMENT_TYPE_PATHNAME) {
1148          return segment.value;
1149        }
1150        if (segment.type === SEGMENT_TYPE_WILDCARD) {
1151          usedParams._splat = params._splat;
1152          usedParams["*"] = params._splat;
1153          const segmentPrefix = segment.prefixSegment || "";
1154          const segmentSuffix = segment.suffixSegment || "";
1155          if (!params._splat) {
1156            isMissingParams = true;
1157            if (leaveWildcards) {
1158              return `$segmentPrefix}$segment.value}$segmentSuffix}`;
1159            }
1160            if (segmentPrefix || segmentSuffix) {
1161              return `$segmentPrefix}$segmentSuffix}`;
1162            }
1163            return void 0;
1164          }
1165          const value = encodeParam("_splat");
1166          if (leaveWildcards) {
1167            return `$segmentPrefix}$segment.value}$value ?? ""}$segmentSuffix}`;
1168          }
1169          return `$segmentPrefix}$value}$segmentSuffix}`;
1170        }
1171        if (segment.type === SEGMENT_TYPE_PARAM) {
1172          const key = segment.value.substring(1);
1173          if (!isMissingParams && !(key in params)) {
1174            isMissingParams = true;
1175          }
1176          usedParams[key] = params[key];
1177          const segmentPrefix = segment.prefixSegment || "";
1178          const segmentSuffix = segment.suffixSegment || "";
1179          if (leaveParams) {
1180            const value = encodeParam(segment.value);
1181            return `$segmentPrefix}$segment.value}$value ?? ""}$segmentSuffix}`;
1182          }
1183          return `$segmentPrefix}$encodeParam(key) ?? "undefined"}$segmentSuffix}`;
1184        }
1185        if (segment.type === SEGMENT_TYPE_OPTIONAL_PARAM) {
1186          const key = segment.value.substring(1);
1187          const segmentPrefix = segment.prefixSegment || "";
1188          const segmentSuffix = segment.suffixSegment || "";
1189          if (!(key in params) || params[key] == null) {
1190            if (leaveWildcards) {
1191              return `$segmentPrefix}$key}$segmentSuffix}`;
1192            }
1193            if (segmentPrefix || segmentSuffix) {
1194              return `$segmentPrefix}$segmentSuffix}`;
1195            }
1196            return void 0;
1197          }
1198          usedParams[key] = params[key];
1199          if (leaveParams) {
1200            const value = encodeParam(segment.value);
1201            return `$segmentPrefix}$segment.value}$value ?? ""}$segmentSuffix}`;
1202          }
1203          if (leaveWildcards) {
1204            return `$segmentPrefix}$key}$encodeParam(key) ?? ""}$segmentSuffix}`;
1205          }
1206          return `$segmentPrefix}$encodeParam(key) ?? ""}$segmentSuffix}`;
1207        }
1208        return segment.value;
1209      })
1210    );
1211    return { usedParams, interpolatedPath, isMissingParams };
1212  }
1213  function encodePathParam(value, decodeCharMap) {
1214    let encoded = encodeURIComponent(value);
1215    if (decodeCharMap) {
1216      for (const [encodedChar, char] of decodeCharMap) {
1217        encoded = encoded.replaceAll(encodedChar, char);
1218      }
1219    }
1220    return encoded;
1221  }
1222  function matchPathname(currentPathname, matchLocation, parseCache) {
1223    const pathParams = matchByPath(currentPathname, matchLocation, parseCache);
1224    if (matchLocation.to && !pathParams) {
1225      return;
1226    }
1227    return pathParams ?? {};
1228  }
1229  function matchByPath(from, {
1230    to,
1231    fuzzy,
1232    caseSensitive
1233  }, parseCache) {
1234    const stringTo = to;
1235    const baseSegments = parsePathname(
1236      from.startsWith("/") ? from : `/$from}`,
1237      parseCache
1238    );
1239    const routeSegments = parsePathname(
1240      stringTo.startsWith("/") ? stringTo : `/$stringTo}`,
1241      parseCache
1242    );
1243    const params = {};
1244    const result = isMatch(
1245      baseSegments,
1246      routeSegments,
1247      params,
1248      fuzzy,
1249      caseSensitive
1250    );
1251    return result ? params : void 0;
1252  }
1253  function isMatch(baseSegments, routeSegments, params, fuzzy, caseSensitive) {
1254    let baseIndex = 0;
1255    let routeIndex = 0;
1256    while (baseIndex < baseSegments.length || routeIndex < routeSegments.length) {
1257      const baseSegment = baseSegments[baseIndex];
1258      const routeSegment = routeSegments[routeIndex];
1259      if (routeSegment) {
1260        if (routeSegment.type === SEGMENT_TYPE_WILDCARD) {
1261          const remainingBaseSegments = baseSegments.slice(baseIndex);
1262          let _splat;
1263          if (routeSegment.prefixSegment || routeSegment.suffixSegment) {
1264            if (!baseSegment) return false;
1265            const prefix2 = routeSegment.prefixSegment || "";
1266            const suffix = routeSegment.suffixSegment || "";
1267            const baseValue = baseSegment.value;
1268            if ("prefixSegment" in routeSegment) {
1269              if (!baseValue.startsWith(prefix2)) {
1270                return false;
1271              }
1272            }
1273            if ("suffixSegment" in routeSegment) {
1274              if (!baseSegments[baseSegments.length - 1]?.value.endsWith(suffix)) {
1275                return false;
1276              }
1277            }
1278            let rejoinedSplat = decodeURI(
1279              joinPaths(remainingBaseSegments.map((d) => d.value))
1280            );
1281            if (prefix2 && rejoinedSplat.startsWith(prefix2)) {
1282              rejoinedSplat = rejoinedSplat.slice(prefix2.length);
1283            }
1284            if (suffix && rejoinedSplat.endsWith(suffix)) {
1285              rejoinedSplat = rejoinedSplat.slice(
1286                0,
1287                rejoinedSplat.length - suffix.length
1288              );
1289            }
1290            _splat = rejoinedSplat;
1291          } else {
1292            _splat = decodeURI(
1293              joinPaths(remainingBaseSegments.map((d) => d.value))
1294            );
1295          }
1296          params["*"] = _splat;
1297          params["_splat"] = _splat;
1298          return true;
1299        }
1300        if (routeSegment.type === SEGMENT_TYPE_PATHNAME) {
1301          if (routeSegment.value === "/" && !baseSegment?.value) {
1302            routeIndex++;
1303            continue;
1304          }
1305          if (baseSegment) {
1306            if (caseSensitive) {
1307              if (routeSegment.value !== baseSegment.value) {
1308                return false;
1309              }
1310            } else if (routeSegment.value.toLowerCase() !== baseSegment.value.toLowerCase()) {
1311              return false;
1312            }
1313            baseIndex++;
1314            routeIndex++;
1315            continue;
1316          } else {
1317            return false;
1318          }
1319        }
1320        if (routeSegment.type === SEGMENT_TYPE_PARAM) {
1321          if (!baseSegment) {
1322            return false;
1323          }
1324          if (baseSegment.value === "/") {
1325            return false;
1326          }
1327          let _paramValue = "";
1328          let matched = false;
1329          if (routeSegment.prefixSegment || routeSegment.suffixSegment) {
1330            const prefix2 = routeSegment.prefixSegment || "";
1331            const suffix = routeSegment.suffixSegment || "";
1332            const baseValue = baseSegment.value;
1333            if (prefix2 && !baseValue.startsWith(prefix2)) {
1334              return false;
1335            }
1336            if (suffix && !baseValue.endsWith(suffix)) {
1337              return false;
1338            }
1339            let paramValue = baseValue;
1340            if (prefix2 && paramValue.startsWith(prefix2)) {
1341              paramValue = paramValue.slice(prefix2.length);
1342            }
1343            if (suffix && paramValue.endsWith(suffix)) {
1344              paramValue = paramValue.slice(0, paramValue.length - suffix.length);
1345            }
1346            _paramValue = decodeURIComponent(paramValue);
1347            matched = true;
1348          } else {
1349            _paramValue = decodeURIComponent(baseSegment.value);
1350            matched = true;
1351          }
1352          if (matched) {
1353            params[routeSegment.value.substring(1)] = _paramValue;
1354            baseIndex++;
1355          }
1356          routeIndex++;
1357          continue;
1358        }
1359        if (routeSegment.type === SEGMENT_TYPE_OPTIONAL_PARAM) {
1360          if (!baseSegment) {
1361            routeIndex++;
1362            continue;
1363          }
1364          if (baseSegment.value === "/") {
1365            routeIndex++;
1366            continue;
1367          }
1368          let _paramValue = "";
1369          let matched = false;
1370          if (routeSegment.prefixSegment || routeSegment.suffixSegment) {
1371            const prefix2 = routeSegment.prefixSegment || "";
1372            const suffix = routeSegment.suffixSegment || "";
1373            const baseValue = baseSegment.value;
1374            if ((!prefix2 || baseValue.startsWith(prefix2)) && (!suffix || baseValue.endsWith(suffix))) {
1375              let paramValue = baseValue;
1376              if (prefix2 && paramValue.startsWith(prefix2)) {
1377                paramValue = paramValue.slice(prefix2.length);
1378              }
1379              if (suffix && paramValue.endsWith(suffix)) {
1380                paramValue = paramValue.slice(
1381                  0,
1382                  paramValue.length - suffix.length
1383                );
1384              }
1385              _paramValue = decodeURIComponent(paramValue);
1386              matched = true;
1387            }
1388          } else {
1389            let shouldMatchOptional = true;
1390            for (let lookAhead = routeIndex + 1; lookAhead < routeSegments.length; lookAhead++) {
1391              const futureRouteSegment = routeSegments[lookAhead];
1392              if (futureRouteSegment?.type === SEGMENT_TYPE_PATHNAME && futureRouteSegment.value === baseSegment.value) {
1393                shouldMatchOptional = false;
1394                break;
1395              }
1396              if (futureRouteSegment?.type === SEGMENT_TYPE_PARAM || futureRouteSegment?.type === SEGMENT_TYPE_WILDCARD) {
1397                if (baseSegments.length < routeSegments.length) {
1398                  shouldMatchOptional = false;
1399                }
1400                break;
1401              }
1402            }
1403            if (shouldMatchOptional) {
1404              _paramValue = decodeURIComponent(baseSegment.value);
1405              matched = true;
1406            }
1407          }
1408          if (matched) {
1409            params[routeSegment.value.substring(1)] = _paramValue;
1410            baseIndex++;
1411          }
1412          routeIndex++;
1413          continue;
1414        }
1415      }
1416      if (baseIndex < baseSegments.length && routeIndex >= routeSegments.length) {
1417        params["**"] = joinPaths(
1418          baseSegments.slice(baseIndex).map((d) => d.value)
1419        );
1420        return !!fuzzy && routeSegments[routeSegments.length - 1]?.value !== "/";
1421      }
1422      if (routeIndex < routeSegments.length && baseIndex >= baseSegments.length) {
1423        for (let i = routeIndex; i < routeSegments.length; i++) {
1424          if (routeSegments[i]?.type !== SEGMENT_TYPE_OPTIONAL_PARAM) {
1425            return false;
1426          }
1427        }
1428        break;
1429      }
1430      break;
1431    }
1432    return true;
1433  }
1434  
1435  // node_modules/@tanstack/router-core/dist/esm/process-route-tree.js
1436  var SLASH_SCORE = 0.75;
1437  var STATIC_SEGMENT_SCORE = 1;
1438  var REQUIRED_PARAM_BASE_SCORE = 0.5;
1439  var OPTIONAL_PARAM_BASE_SCORE = 0.4;
1440  var WILDCARD_PARAM_BASE_SCORE = 0.25;
1441  var STATIC_AFTER_DYNAMIC_BONUS_SCORE = 0.2;
1442  var BOTH_PRESENCE_BASE_SCORE = 0.05;
1443  var PREFIX_PRESENCE_BASE_SCORE = 0.02;
1444  var SUFFIX_PRESENCE_BASE_SCORE = 0.01;
1445  var PREFIX_LENGTH_SCORE_MULTIPLIER = 2e-4;
1446  var SUFFIX_LENGTH_SCORE_MULTIPLIER = 1e-4;
1447  function handleParam(segment, baseScore) {
1448    if (segment.prefixSegment && segment.suffixSegment) {
1449      return baseScore + BOTH_PRESENCE_BASE_SCORE + PREFIX_LENGTH_SCORE_MULTIPLIER * segment.prefixSegment.length + SUFFIX_LENGTH_SCORE_MULTIPLIER * segment.suffixSegment.length;
1450    }
1451    if (segment.prefixSegment) {
1452      return baseScore + PREFIX_PRESENCE_BASE_SCORE + PREFIX_LENGTH_SCORE_MULTIPLIER * segment.prefixSegment.length;
1453    }
1454    if (segment.suffixSegment) {
1455      return baseScore + SUFFIX_PRESENCE_BASE_SCORE + SUFFIX_LENGTH_SCORE_MULTIPLIER * segment.suffixSegment.length;
1456    }
1457    return baseScore;
1458  }
1459  function sortRoutes(routes) {
1460    const scoredRoutes = [];
1461    routes.forEach((d, i) => {
1462      if (d.isRoot || !d.path) {
1463        return;
1464      }
1465      const trimmed = trimPathLeft(d.fullPath);
1466      let parsed = parsePathname(trimmed);
1467      let skip = 0;
1468      while (parsed.length > skip + 1 && parsed[skip]?.value === "/") {
1469        skip++;
1470      }
1471      if (skip > 0) parsed = parsed.slice(skip);
1472      let optionalParamCount = 0;
1473      let hasStaticAfter = false;
1474      const scores = parsed.map((segment, index) => {
1475        if (segment.value === "/") {
1476          return SLASH_SCORE;
1477        }
1478        if (segment.type === SEGMENT_TYPE_PATHNAME) {
1479          return STATIC_SEGMENT_SCORE;
1480        }
1481        let baseScore = void 0;
1482        if (segment.type === SEGMENT_TYPE_PARAM) {
1483          baseScore = REQUIRED_PARAM_BASE_SCORE;
1484        } else if (segment.type === SEGMENT_TYPE_OPTIONAL_PARAM) {
1485          baseScore = OPTIONAL_PARAM_BASE_SCORE;
1486          optionalParamCount++;
1487        } else {
1488          baseScore = WILDCARD_PARAM_BASE_SCORE;
1489        }
1490        for (let i2 = index + 1; i2 < parsed.length; i2++) {
1491          const nextSegment = parsed[i2];
1492          if (nextSegment.type === SEGMENT_TYPE_PATHNAME && nextSegment.value !== "/") {
1493            hasStaticAfter = true;
1494            return handleParam(
1495              segment,
1496              baseScore + STATIC_AFTER_DYNAMIC_BONUS_SCORE
1497            );
1498          }
1499        }
1500        return handleParam(segment, baseScore);
1501      });
1502      scoredRoutes.push({
1503        child: d,
1504        trimmed,
1505        parsed,
1506        index: i,
1507        scores,
1508        optionalParamCount,
1509        hasStaticAfter
1510      });
1511    });
1512    const flatRoutes = scoredRoutes.sort((a, b) => {
1513      const minLength = Math.min(a.scores.length, b.scores.length);
1514      for (let i = 0; i < minLength; i++) {
1515        if (a.scores[i] !== b.scores[i]) {
1516          return b.scores[i] - a.scores[i];
1517        }
1518      }
1519      if (a.scores.length !== b.scores.length) {
1520        if (a.optionalParamCount !== b.optionalParamCount) {
1521          if (a.hasStaticAfter === b.hasStaticAfter) {
1522            return a.optionalParamCount - b.optionalParamCount;
1523          } else if (a.hasStaticAfter && !b.hasStaticAfter) {
1524            return -1;
1525          } else if (!a.hasStaticAfter && b.hasStaticAfter) {
1526            return 1;
1527          }
1528        }
1529        return b.scores.length - a.scores.length;
1530      }
1531      for (let i = 0; i < minLength; i++) {
1532        if (a.parsed[i].value !== b.parsed[i].value) {
1533          return a.parsed[i].value > b.parsed[i].value ? 1 : -1;
1534        }
1535      }
1536      return a.index - b.index;
1537    }).map((d, i) => {
1538      d.child.rank = i;
1539      return d.child;
1540    });
1541    return flatRoutes;
1542  }
1543  function processRouteTree({
1544    routeTree,
1545    initRoute
1546  }) {
1547    const routesById = {};
1548    const routesByPath = {};
1549    const recurseRoutes = (childRoutes) => {
1550      childRoutes.forEach((childRoute, i) => {
1551        initRoute?.(childRoute, i);
1552        const existingRoute = routesById[childRoute.id];
1553        invariant(
1554          !existingRoute,
1555          `Duplicate routes found with id: $String(childRoute.id)}`
1556        );
1557        routesById[childRoute.id] = childRoute;
1558        if (!childRoute.isRoot && childRoute.path) {
1559          const trimmedFullPath = trimPathRight(childRoute.fullPath);
1560          if (!routesByPath[trimmedFullPath] || childRoute.fullPath.endsWith("/")) {
1561            routesByPath[trimmedFullPath] = childRoute;
1562          }
1563        }
1564        const children = childRoute.children;
1565        if (children?.length) {
1566          recurseRoutes(children);
1567        }
1568      });
1569    };
1570    recurseRoutes([routeTree]);
1571    const flatRoutes = sortRoutes(Object.values(routesById));
1572    return { routesById, routesByPath, flatRoutes };
1573  }
1574  
1575  // node_modules/@tanstack/router-core/dist/esm/not-found.js
1576  function isNotFound(obj) {
1577    return !!obj?.isNotFound;
1578  }
1579  
1580  // node_modules/@tanstack/router-core/dist/esm/scroll-restoration.js
1581  function getSafeSessionStorage() {
1582    try {
1583      if (typeof window !== "undefined" && typeof window.sessionStorage === "object") {
1584        return window.sessionStorage;
1585      }
1586    } catch {
1587    }
1588    return void 0;
1589  }
1590  var storageKey = "tsr-scroll-restoration-v1_3";
1591  var throttle = (fn, wait) => {
1592    let timeout;
1593    return (...args) => {
1594      if (!timeout) {
1595        timeout = setTimeout(() => {
1596          fn(...args);
1597          timeout = null;
1598        }, wait);
1599      }
1600    };
1601  };
1602  function createScrollRestorationCache() {
1603    const safeSessionStorage = getSafeSessionStorage();
1604    if (!safeSessionStorage) {
1605      return null;
1606    }
1607    const persistedState = safeSessionStorage.getItem(storageKey);
1608    let state = persistedState ? JSON.parse(persistedState) : {};
1609    return {
1610      state,
1611      // This setter is simply to make sure that we set the sessionStorage right
1612      // after the state is updated. It doesn't necessarily need to be a functional
1613      // update.
1614      set: (updater) => (state = functionalUpdate(updater, state) || state, safeSessionStorage.setItem(storageKey, JSON.stringify(state)))
1615    };
1616  }
1617  var scrollRestorationCache = createScrollRestorationCache();
1618  var defaultGetScrollRestorationKey = (location) => {
1619    return location.state.__TSR_key || location.href;
1620  };
1621  function getCssSelector(el) {
1622    const path = [];
1623    let parent;
1624    while (parent = el.parentNode) {
1625      path.push(
1626        `$el.tagName}:nth-child($Array.prototype.indexOf.call(parent.children, el) + 1})`
1627      );
1628      el = parent;
1629    }
1630    return `$path.reverse().join(" > ")}`.toLowerCase();
1631  }
1632  var ignoreScroll = false;
1633  function restoreScroll({
1634    storageKey: storageKey2,
1635    key,
1636    behavior,
1637    shouldScrollRestoration,
1638    scrollToTopSelectors,
1639    location
1640  }) {
1641    let byKey;
1642    try {
1643      byKey = JSON.parse(sessionStorage.getItem(storageKey2) || "{}");
1644    } catch (error) {
1645      console.error(error);
1646      return;
1647    }
1648    const resolvedKey = key || window.history.state?.__TSR_key;
1649    const elementEntries = byKey[resolvedKey];
1650    ignoreScroll = true;
1651    scroll: {
1652      if (shouldScrollRestoration && elementEntries && Object.keys(elementEntries).length > 0) {
1653        for (const elementSelector in elementEntries) {
1654          const entry = elementEntries[elementSelector];
1655          if (elementSelector === "window") {
1656            window.scrollTo({
1657              top: entry.scrollY,
1658              left: entry.scrollX,
1659              behavior
1660            });
1661          } else if (elementSelector) {
1662            const element = document.querySelector(elementSelector);
1663            if (element) {
1664              element.scrollLeft = entry.scrollX;
1665              element.scrollTop = entry.scrollY;
1666            }
1667          }
1668        }
1669        break scroll;
1670      }
1671      const hash = (location ?? window.location).hash.split("#", 2)[1];
1672      if (hash) {
1673        const hashScrollIntoViewOptions = window.history.state?.__hashScrollIntoViewOptions ?? true;
1674        if (hashScrollIntoViewOptions) {
1675          const el = document.getElementById(hash);
1676          if (el) {
1677            el.scrollIntoView(hashScrollIntoViewOptions);
1678          }
1679        }
1680        break scroll;
1681      }
1682      const scrollOptions = { top: 0, left: 0, behavior };
1683      window.scrollTo(scrollOptions);
1684      if (scrollToTopSelectors) {
1685        for (const selector of scrollToTopSelectors) {
1686          if (selector === "window") continue;
1687          const element = typeof selector === "function" ? selector() : document.querySelector(selector);
1688          if (element) element.scrollTo(scrollOptions);
1689        }
1690      }
1691    }
1692    ignoreScroll = false;
1693  }
1694  function setupScrollRestoration(router, force) {
1695    if (!scrollRestorationCache && !router.isServer) {
1696      return;
1697    }
1698    const shouldScrollRestoration = force ?? router.options.scrollRestoration ?? false;
1699    if (shouldScrollRestoration) {
1700      router.isScrollRestoring = true;
1701    }
1702    if (router.isServer || router.isScrollRestorationSetup || !scrollRestorationCache) {
1703      return;
1704    }
1705    router.isScrollRestorationSetup = true;
1706    ignoreScroll = false;
1707    const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
1708    window.history.scrollRestoration = "manual";
1709    const onScroll = (event) => {
1710      if (ignoreScroll || !router.isScrollRestoring) {
1711        return;
1712      }
1713      let elementSelector = "";
1714      if (event.target === document || event.target === window) {
1715        elementSelector = "window";
1716      } else {
1717        const attrId = event.target.getAttribute(
1718          "data-scroll-restoration-id"
1719        );
1720        if (attrId) {
1721          elementSelector = `[data-scroll-restoration-id="$attrId}"]`;
1722        } else {
1723          elementSelector = getCssSelector(event.target);
1724        }
1725      }
1726      const restoreKey = getKey(router.state.location);
1727      scrollRestorationCache.set((state) => {
1728        const keyEntry = state[restoreKey] ||= {};
1729        const elementEntry = keyEntry[elementSelector] ||= {};
1730        if (elementSelector === "window") {
1731          elementEntry.scrollX = window.scrollX || 0;
1732          elementEntry.scrollY = window.scrollY || 0;
1733        } else if (elementSelector) {
1734          const element = document.querySelector(elementSelector);
1735          if (element) {
1736            elementEntry.scrollX = element.scrollLeft || 0;
1737            elementEntry.scrollY = element.scrollTop || 0;
1738          }
1739        }
1740        return state;
1741      });
1742    };
1743    if (typeof document !== "undefined") {
1744      document.addEventListener("scroll", throttle(onScroll, 100), true);
1745    }
1746    router.subscribe("onRendered", (event) => {
1747      const cacheKey = getKey(event.toLocation);
1748      if (!router.resetNextScroll) {
1749        router.resetNextScroll = true;
1750        return;
1751      }
1752      if (typeof router.options.scrollRestoration === "function") {
1753        const shouldRestore = router.options.scrollRestoration({
1754          location: router.latestLocation
1755        });
1756        if (!shouldRestore) {
1757          return;
1758        }
1759      }
1760      restoreScroll({
1761        storageKey,
1762        key: cacheKey,
1763        behavior: router.options.scrollRestorationBehavior,
1764        shouldScrollRestoration: router.isScrollRestoring,
1765        scrollToTopSelectors: router.options.scrollToTopSelectors,
1766        location: router.history.location
1767      });
1768      if (router.isScrollRestoring) {
1769        scrollRestorationCache.set((state) => {
1770          state[cacheKey] ||= {};
1771          return state;
1772        });
1773      }
1774    });
1775  }
1776  function handleHashScroll(router) {
1777    if (typeof document !== "undefined" && document.querySelector) {
1778      const hashScrollIntoViewOptions = router.state.location.state.__hashScrollIntoViewOptions ?? true;
1779      if (hashScrollIntoViewOptions && router.state.location.hash !== "") {
1780        const el = document.getElementById(router.state.location.hash);
1781        if (el) {
1782          el.scrollIntoView(hashScrollIntoViewOptions);
1783        }
1784      }
1785    }
1786  }
1787  
1788  // node_modules/@tanstack/router-core/dist/esm/qss.js
1789  function encode(obj, stringify = String) {
1790    const result = new URLSearchParams();
1791    for (const key in obj) {
1792      const val = obj[key];
1793      if (val !== void 0) {
1794        result.set(key, stringify(val));
1795      }
1796    }
1797    return result.toString();
1798  }
1799  function toValue(str) {
1800    if (!str) return "";
1801    if (str === "false") return false;
1802    if (str === "true") return true;
1803    return +str * 0 === 0 && +str + "" === str ? +str : str;
1804  }
1805  function decode(str) {
1806    const searchParams = new URLSearchParams(str);
1807    const result = {};
1808    for (const [key, value] of searchParams.entries()) {
1809      const previousValue = result[key];
1810      if (previousValue == null) {
1811        result[key] = toValue(value);
1812      } else if (Array.isArray(previousValue)) {
1813        previousValue.push(toValue(value));
1814      } else {
1815        result[key] = [previousValue, toValue(value)];
1816      }
1817    }
1818    return result;
1819  }
1820  
1821  // node_modules/@tanstack/router-core/dist/esm/searchParams.js
1822  var defaultParseSearch = parseSearchWith(JSON.parse);
1823  var defaultStringifySearch = stringifySearchWith(
1824    JSON.stringify,
1825    JSON.parse
1826  );
1827  function parseSearchWith(parser) {
1828    return (searchStr) => {
1829      if (searchStr[0] === "?") {
1830        searchStr = searchStr.substring(1);
1831      }
1832      const query = decode(searchStr);
1833      for (const key in query) {
1834        const value = query[key];
1835        if (typeof value === "string") {
1836          try {
1837            query[key] = parser(value);
1838          } catch (_err) {
1839          }
1840        }
1841      }
1842      return query;
1843    };
1844  }
1845  function stringifySearchWith(stringify, parser) {
1846    const hasParser = typeof parser === "function";
1847    function stringifyValue(val) {
1848      if (typeof val === "object" && val !== null) {
1849        try {
1850          return stringify(val);
1851        } catch (_err) {
1852        }
1853      } else if (hasParser && typeof val === "string") {
1854        try {
1855          parser(val);
1856          return stringify(val);
1857        } catch (_err) {
1858        }
1859      }
1860      return val;
1861    }
1862    return (search) => {
1863      const searchStr = encode(search, stringifyValue);
1864      return searchStr ? `?$searchStr}` : "";
1865    };
1866  }
1867  
1868  // node_modules/@tanstack/router-core/dist/esm/root.js
1869  var rootRouteId = "__root__";
1870  
1871  // node_modules/@tanstack/router-core/dist/esm/redirect.js
1872  function redirect(opts) {
1873    opts.statusCode = opts.statusCode || opts.code || 307;
1874    if (!opts.reloadDocument && typeof opts.href === "string") {
1875      try {
1876        new URL(opts.href);
1877        opts.reloadDocument = true;
1878      } catch {
1879      }
1880    }
1881    const headers = new Headers(opts.headers);
1882    if (opts.href && headers.get("Location") === null) {
1883      headers.set("Location", opts.href);
1884    }
1885    const response = new Response(null, {
1886      status: opts.statusCode,
1887      headers
1888    });
1889    response.options = opts;
1890    if (opts.throw) {
1891      throw response;
1892    }
1893    return response;
1894  }
1895  function isRedirect(obj) {
1896    return obj instanceof Response && !!obj.options;
1897  }
1898  
1899  // node_modules/@tanstack/router-core/dist/esm/lru-cache.js
1900  function createLRUCache(max) {
1901    const cache = /* @__PURE__ */ new Map();
1902    let oldest;
1903    let newest;
1904    const touch = (entry) => {
1905      if (!entry.next) return;
1906      if (!entry.prev) {
1907        entry.next.prev = void 0;
1908        oldest = entry.next;
1909        entry.next = void 0;
1910        if (newest) {
1911          entry.prev = newest;
1912          newest.next = entry;
1913        }
1914      } else {
1915        entry.prev.next = entry.next;
1916        entry.next.prev = entry.prev;
1917        entry.next = void 0;
1918        if (newest) {
1919          newest.next = entry;
1920          entry.prev = newest;
1921        }
1922      }
1923      newest = entry;
1924    };
1925    return {
1926      get(key) {
1927        const entry = cache.get(key);
1928        if (!entry) return void 0;
1929        touch(entry);
1930        return entry.value;
1931      },
1932      set(key, value) {
1933        if (cache.size >= max && oldest) {
1934          const toDelete = oldest;
1935          cache.delete(toDelete.key);
1936          if (toDelete.next) {
1937            oldest = toDelete.next;
1938            toDelete.next.prev = void 0;
1939          }
1940          if (toDelete === newest) {
1941            newest = void 0;
1942          }
1943        }
1944        const existing = cache.get(key);
1945        if (existing) {
1946          existing.value = value;
1947          touch(existing);
1948        } else {
1949          const entry = { key, value, prev: newest };
1950          if (newest) newest.next = entry;
1951          newest = entry;
1952          if (!oldest) oldest = entry;
1953          cache.set(key, entry);
1954        }
1955      }
1956    };
1957  }
1958  
1959  // node_modules/@tanstack/router-core/dist/esm/load-matches.js
1960  var triggerOnReady = (inner) => {
1961    if (!inner.rendered) {
1962      inner.rendered = true;
1963      return inner.onReady?.();
1964    }
1965  };
1966  var resolvePreload = (inner, matchId) => {
1967    return !!(inner.preload && !inner.router.state.matches.some((d) => d.id === matchId));
1968  };
1969  var _handleNotFound = (inner, err) => {
1970    const routeCursor = inner.router.routesById[err.routeId ?? ""] ?? inner.router.routeTree;
1971    if (!routeCursor.options.notFoundComponent && inner.router.options?.defaultNotFoundComponent) {
1972      routeCursor.options.notFoundComponent = inner.router.options.defaultNotFoundComponent;
1973    }
1974    invariant(
1975      routeCursor.options.notFoundComponent,
1976      "No notFoundComponent found. Please set a notFoundComponent on your route or provide a defaultNotFoundComponent to the router."
1977    );
1978    const matchForRoute = inner.matches.find((m) => m.routeId === routeCursor.id);
1979    invariant(matchForRoute, "Could not find match for route: " + routeCursor.id);
1980    inner.updateMatch(matchForRoute.id, (prev) => ({
1981      ...prev,
1982      status: "notFound",
1983      error: err,
1984      isFetching: false
1985    }));
1986    if (err.routerCode === "BEFORE_LOAD" && routeCursor.parentRoute) {
1987      err.routeId = routeCursor.parentRoute.id;
1988      _handleNotFound(inner, err);
1989    }
1990  };
1991  var handleRedirectAndNotFound = (inner, match, err) => {
1992    if (!isRedirect(err) && !isNotFound(err)) return;
1993    if (isRedirect(err) && err.redirectHandled && !err.options.reloadDocument) {
1994      throw err;
1995    }
1996    if (match) {
1997      match._nonReactive.beforeLoadPromise?.resolve();
1998      match._nonReactive.loaderPromise?.resolve();
1999      match._nonReactive.beforeLoadPromise = void 0;
2000      match._nonReactive.loaderPromise = void 0;
2001      const status = isRedirect(err) ? "redirected" : "notFound";
2002      inner.updateMatch(match.id, (prev) => ({
2003        ...prev,
2004        status,
2005        isFetching: false,
2006        error: err
2007      }));
2008      if (isNotFound(err) && !err.routeId) {
2009        err.routeId = match.routeId;
2010      }
2011      match._nonReactive.loadPromise?.resolve();
2012    }
2013    if (isRedirect(err)) {
2014      inner.rendered = true;
2015      err.options._fromLocation = inner.location;
2016      err.redirectHandled = true;
2017      err = inner.router.resolveRedirect(err);
2018      throw err;
2019    } else {
2020      _handleNotFound(inner, err);
2021      throw err;
2022    }
2023  };
2024  var shouldSkipLoader = (inner, matchId) => {
2025    const match = inner.router.getMatch(matchId);
2026    if (!inner.router.isServer && match._nonReactive.dehydrated) {
2027      return true;
2028    }
2029    if (inner.router.isServer && match.ssr === false) {
2030      return true;
2031    }
2032    return false;
2033  };
2034  var handleSerialError = (inner, index, err, routerCode) => {
2035    const { id: matchId, routeId } = inner.matches[index];
2036    const route = inner.router.looseRoutesById[routeId];
2037    if (err instanceof Promise) {
2038      throw err;
2039    }
2040    err.routerCode = routerCode;
2041    inner.firstBadMatchIndex ??= index;
2042    handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
2043    try {
2044      route.options.onError?.(err);
2045    } catch (errorHandlerErr) {
2046      err = errorHandlerErr;
2047      handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
2048    }
2049    inner.updateMatch(matchId, (prev) => {
2050      prev._nonReactive.beforeLoadPromise?.resolve();
2051      prev._nonReactive.beforeLoadPromise = void 0;
2052      prev._nonReactive.loadPromise?.resolve();
2053      return {
2054        ...prev,
2055        error: err,
2056        status: "error",
2057        isFetching: false,
2058        updatedAt: Date.now(),
2059        abortController: new AbortController()
2060      };
2061    });
2062  };
2063  var isBeforeLoadSsr = (inner, matchId, index, route) => {
2064    const existingMatch = inner.router.getMatch(matchId);
2065    const parentMatchId = inner.matches[index - 1]?.id;
2066    const parentMatch = parentMatchId ? inner.router.getMatch(parentMatchId) : void 0;
2067    if (inner.router.isShell()) {
2068      existingMatch.ssr = matchId === rootRouteId;
2069      return;
2070    }
2071    if (parentMatch?.ssr === false) {
2072      existingMatch.ssr = false;
2073      return;
2074    }
2075    const parentOverride = (tempSsr2) => {
2076      if (tempSsr2 === true && parentMatch?.ssr === "data-only") {
2077        return "data-only";
2078      }
2079      return tempSsr2;
2080    };
2081    const defaultSsr = inner.router.options.defaultSsr ?? true;
2082    if (route.options.ssr === void 0) {
2083      existingMatch.ssr = parentOverride(defaultSsr);
2084      return;
2085    }
2086    if (typeof route.options.ssr !== "function") {
2087      existingMatch.ssr = parentOverride(route.options.ssr);
2088      return;
2089    }
2090    const { search, params } = existingMatch;
2091    const ssrFnContext = {
2092      search: makeMaybe(search, existingMatch.searchError),
2093      params: makeMaybe(params, existingMatch.paramsError),
2094      location: inner.location,
2095      matches: inner.matches.map((match) => ({
2096        index: match.index,
2097        pathname: match.pathname,
2098        fullPath: match.fullPath,
2099        staticData: match.staticData,
2100        id: match.id,
2101        routeId: match.routeId,
2102        search: makeMaybe(match.search, match.searchError),
2103        params: makeMaybe(match.params, match.paramsError),
2104        ssr: match.ssr
2105      }))
2106    };
2107    const tempSsr = route.options.ssr(ssrFnContext);
2108    if (isPromise(tempSsr)) {
2109      return tempSsr.then((ssr) => {
2110        existingMatch.ssr = parentOverride(ssr ?? defaultSsr);
2111      });
2112    }
2113    existingMatch.ssr = parentOverride(tempSsr ?? defaultSsr);
2114    return;
2115  };
2116  var setupPendingTimeout = (inner, matchId, route, match) => {
2117    if (match._nonReactive.pendingTimeout !== void 0) return;
2118    const pendingMs = route.options.pendingMs ?? inner.router.options.defaultPendingMs;
2119    const shouldPending = !!(inner.onReady && !inner.router.isServer && !resolvePreload(inner, matchId) && (route.options.loader || route.options.beforeLoad || routeNeedsPreload(route)) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? inner.router.options?.defaultPendingComponent));
2120    if (shouldPending) {
2121      const pendingTimeout = setTimeout(() => {
2122        triggerOnReady(inner);
2123      }, pendingMs);
2124      match._nonReactive.pendingTimeout = pendingTimeout;
2125    }
2126  };
2127  var preBeforeLoadSetup = (inner, matchId, route) => {
2128    const existingMatch = inner.router.getMatch(matchId);
2129    if (!existingMatch._nonReactive.beforeLoadPromise && !existingMatch._nonReactive.loaderPromise)
2130      return;
2131    setupPendingTimeout(inner, matchId, route, existingMatch);
2132    const then = () => {
2133      const match = inner.router.getMatch(matchId);
2134      if (match.preload && (match.status === "redirected" || match.status === "notFound")) {
2135        handleRedirectAndNotFound(inner, match, match.error);
2136      }
2137    };
2138    return existingMatch._nonReactive.beforeLoadPromise ? existingMatch._nonReactive.beforeLoadPromise.then(then) : then();
2139  };
2140  var executeBeforeLoad = (inner, matchId, index, route) => {
2141    const match = inner.router.getMatch(matchId);
2142    const prevLoadPromise = match._nonReactive.loadPromise;
2143    match._nonReactive.loadPromise = createControlledPromise(() => {
2144      prevLoadPromise?.resolve();
2145    });
2146    const { paramsError, searchError } = match;
2147    if (paramsError) {
2148      handleSerialError(inner, index, paramsError, "PARSE_PARAMS");
2149    }
2150    if (searchError) {
2151      handleSerialError(inner, index, searchError, "VALIDATE_SEARCH");
2152    }
2153    setupPendingTimeout(inner, matchId, route, match);
2154    const abortController = new AbortController();
2155    const parentMatchId = inner.matches[index - 1]?.id;
2156    const parentMatch = parentMatchId ? inner.router.getMatch(parentMatchId) : void 0;
2157    const parentMatchContext = parentMatch?.context ?? inner.router.options.context ?? void 0;
2158    const context = { ...parentMatchContext, ...match.__routeContext };
2159    let isPending = false;
2160    const pending = () => {
2161      if (isPending) return;
2162      isPending = true;
2163      inner.updateMatch(matchId, (prev) => ({
2164        ...prev,
2165        isFetching: "beforeLoad",
2166        fetchCount: prev.fetchCount + 1,
2167        abortController,
2168        context
2169      }));
2170    };
2171    const resolve = () => {
2172      match._nonReactive.beforeLoadPromise?.resolve();
2173      match._nonReactive.beforeLoadPromise = void 0;
2174      inner.updateMatch(matchId, (prev) => ({
2175        ...prev,
2176        isFetching: false
2177      }));
2178    };
2179    if (!route.options.beforeLoad) {
2180      batch(() => {
2181        pending();
2182        resolve();
2183      });
2184      return;
2185    }
2186    match._nonReactive.beforeLoadPromise = createControlledPromise();
2187    const { search, params, cause } = match;
2188    const preload = resolvePreload(inner, matchId);
2189    const beforeLoadFnContext = {
2190      search,
2191      abortController,
2192      params,
2193      preload,
2194      context,
2195      location: inner.location,
2196      navigate: (opts) => inner.router.navigate({
2197        ...opts,
2198        _fromLocation: inner.location
2199      }),
2200      buildLocation: inner.router.buildLocation,
2201      cause: preload ? "preload" : cause,
2202      matches: inner.matches,
2203      ...inner.router.options.additionalContext
2204    };
2205    const updateContext = (beforeLoadContext2) => {
2206      if (beforeLoadContext2 === void 0) {
2207        batch(() => {
2208          pending();
2209          resolve();
2210        });
2211        return;
2212      }
2213      if (isRedirect(beforeLoadContext2) || isNotFound(beforeLoadContext2)) {
2214        pending();
2215        handleSerialError(inner, index, beforeLoadContext2, "BEFORE_LOAD");
2216      }
2217      batch(() => {
2218        pending();
2219        inner.updateMatch(matchId, (prev) => ({
2220          ...prev,
2221          __beforeLoadContext: beforeLoadContext2,
2222          context: {
2223            ...prev.context,
2224            ...beforeLoadContext2
2225          }
2226        }));
2227        resolve();
2228      });
2229    };
2230    let beforeLoadContext;
2231    try {
2232      beforeLoadContext = route.options.beforeLoad(beforeLoadFnContext);
2233      if (isPromise(beforeLoadContext)) {
2234        pending();
2235        return beforeLoadContext.catch((err) => {
2236          handleSerialError(inner, index, err, "BEFORE_LOAD");
2237        }).then(updateContext);
2238      }
2239    } catch (err) {
2240      pending();
2241      handleSerialError(inner, index, err, "BEFORE_LOAD");
2242    }
2243    updateContext(beforeLoadContext);
2244    return;
2245  };
2246  var handleBeforeLoad = (inner, index) => {
2247    const { id: matchId, routeId } = inner.matches[index];
2248    const route = inner.router.looseRoutesById[routeId];
2249    const serverSsr = () => {
2250      if (inner.router.isServer) {
2251        const maybePromise = isBeforeLoadSsr(inner, matchId, index, route);
2252        if (isPromise(maybePromise)) return maybePromise.then(queueExecution);
2253      }
2254      return queueExecution();
2255    };
2256    const execute = () => executeBeforeLoad(inner, matchId, index, route);
2257    const queueExecution = () => {
2258      if (shouldSkipLoader(inner, matchId)) return;
2259      const result = preBeforeLoadSetup(inner, matchId, route);
2260      return isPromise(result) ? result.then(execute) : execute();
2261    };
2262    return serverSsr();
2263  };
2264  var executeHead = (inner, matchId, route) => {
2265    const match = inner.router.getMatch(matchId);
2266    if (!match) {
2267      return;
2268    }
2269    if (!route.options.head && !route.options.scripts && !route.options.headers) {
2270      return;
2271    }
2272    const assetContext = {
2273      matches: inner.matches,
2274      match,
2275      params: match.params,
2276      loaderData: match.loaderData
2277    };
2278    return Promise.all([
2279      route.options.head?.(assetContext),
2280      route.options.scripts?.(assetContext),
2281      route.options.headers?.(assetContext)
2282    ]).then(([headFnContent, scripts, headers]) => {
2283      const meta = headFnContent?.meta;
2284      const links = headFnContent?.links;
2285      const headScripts = headFnContent?.scripts;
2286      const styles = headFnContent?.styles;
2287      return {
2288        meta,
2289        links,
2290        headScripts,
2291        headers,
2292        scripts,
2293        styles
2294      };
2295    });
2296  };
2297  var getLoaderContext = (inner, matchId, index, route) => {
2298    const parentMatchPromise = inner.matchPromises[index - 1];
2299    const { params, loaderDeps, abortController, context, cause } = inner.router.getMatch(matchId);
2300    const preload = resolvePreload(inner, matchId);
2301    return {
2302      params,
2303      deps: loaderDeps,
2304      preload: !!preload,
2305      parentMatchPromise,
2306      abortController,
2307      context,
2308      location: inner.location,
2309      navigate: (opts) => inner.router.navigate({
2310        ...opts,
2311        _fromLocation: inner.location
2312      }),
2313      cause: preload ? "preload" : cause,
2314      route,
2315      ...inner.router.options.additionalContext
2316    };
2317  };
2318  var runLoader = async (inner, matchId, index, route) => {
2319    try {
2320      const match = inner.router.getMatch(matchId);
2321      try {
2322        if (!inner.router.isServer || match.ssr === true) {
2323          loadRouteChunk(route);
2324        }
2325        const loaderResult = route.options.loader?.(
2326          getLoaderContext(inner, matchId, index, route)
2327        );
2328        const loaderResultIsPromise = route.options.loader && isPromise(loaderResult);
2329        const willLoadSomething = !!(loaderResultIsPromise || route._lazyPromise || route._componentsPromise || route.options.head || route.options.scripts || route.options.headers || match._nonReactive.minPendingPromise);
2330        if (willLoadSomething) {
2331          inner.updateMatch(matchId, (prev) => ({
2332            ...prev,
2333            isFetching: "loader"
2334          }));
2335        }
2336        if (route.options.loader) {
2337          const loaderData = loaderResultIsPromise ? await loaderResult : loaderResult;
2338          handleRedirectAndNotFound(
2339            inner,
2340            inner.router.getMatch(matchId),
2341            loaderData
2342          );
2343          if (loaderData !== void 0) {
2344            inner.updateMatch(matchId, (prev) => ({
2345              ...prev,
2346              loaderData
2347            }));
2348          }
2349        }
2350        if (route._lazyPromise) await route._lazyPromise;
2351        const headResult = executeHead(inner, matchId, route);
2352        const head = headResult ? await headResult : void 0;
2353        const pendingPromise = match._nonReactive.minPendingPromise;
2354        if (pendingPromise) await pendingPromise;
2355        if (route._componentsPromise) await route._componentsPromise;
2356        inner.updateMatch(matchId, (prev) => ({
2357          ...prev,
2358          error: void 0,
2359          status: "success",
2360          isFetching: false,
2361          updatedAt: Date.now(),
2362          ...head
2363        }));
2364      } catch (e) {
2365        let error = e;
2366        const pendingPromise = match._nonReactive.minPendingPromise;
2367        if (pendingPromise) await pendingPromise;
2368        if (isNotFound(e)) {
2369          await route.options.notFoundComponent?.preload?.();
2370        }
2371        handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), e);
2372        try {
2373          route.options.onError?.(e);
2374        } catch (onErrorError) {
2375          error = onErrorError;
2376          handleRedirectAndNotFound(
2377            inner,
2378            inner.router.getMatch(matchId),
2379            onErrorError
2380          );
2381        }
2382        const headResult = executeHead(inner, matchId, route);
2383        const head = headResult ? await headResult : void 0;
2384        inner.updateMatch(matchId, (prev) => ({
2385          ...prev,
2386          error,
2387          status: "error",
2388          isFetching: false,
2389          ...head
2390        }));
2391      }
2392    } catch (err) {
2393      const match = inner.router.getMatch(matchId);
2394      if (match) {
2395        const headResult = executeHead(inner, matchId, route);
2396        if (headResult) {
2397          const head = await headResult;
2398          inner.updateMatch(matchId, (prev) => ({
2399            ...prev,
2400            ...head
2401          }));
2402        }
2403        match._nonReactive.loaderPromise = void 0;
2404      }
2405      handleRedirectAndNotFound(inner, match, err);
2406    }
2407  };
2408  var loadRouteMatch = async (inner, index) => {
2409    const { id: matchId, routeId } = inner.matches[index];
2410    let loaderShouldRunAsync = false;
2411    let loaderIsRunningAsync = false;
2412    const route = inner.router.looseRoutesById[routeId];
2413    if (shouldSkipLoader(inner, matchId)) {
2414      if (inner.router.isServer) {
2415        const headResult = executeHead(inner, matchId, route);
2416        if (headResult) {
2417          const head = await headResult;
2418          inner.updateMatch(matchId, (prev) => ({
2419            ...prev,
2420            ...head
2421          }));
2422        }
2423        return inner.router.getMatch(matchId);
2424      }
2425    } else {
2426      const prevMatch = inner.router.getMatch(matchId);
2427      if (prevMatch._nonReactive.loaderPromise) {
2428        if (prevMatch.status === "success" && !inner.sync && !prevMatch.preload) {
2429          return prevMatch;
2430        }
2431        await prevMatch._nonReactive.loaderPromise;
2432        const match2 = inner.router.getMatch(matchId);
2433        if (match2.error) {
2434          handleRedirectAndNotFound(inner, match2, match2.error);
2435        }
2436      } else {
2437        const age = Date.now() - prevMatch.updatedAt;
2438        const preload = resolvePreload(inner, matchId);
2439        const staleAge = preload ? route.options.preloadStaleTime ?? inner.router.options.defaultPreloadStaleTime ?? 3e4 : route.options.staleTime ?? inner.router.options.defaultStaleTime ?? 0;
2440        const shouldReloadOption = route.options.shouldReload;
2441        const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(getLoaderContext(inner, matchId, index, route)) : shouldReloadOption;
2442        const nextPreload = !!preload && !inner.router.state.matches.some((d) => d.id === matchId);
2443        const match2 = inner.router.getMatch(matchId);
2444        match2._nonReactive.loaderPromise = createControlledPromise();
2445        if (nextPreload !== match2.preload) {
2446          inner.updateMatch(matchId, (prev) => ({
2447            ...prev,
2448            preload: nextPreload
2449          }));
2450        }
2451        const { status, invalid } = match2;
2452        loaderShouldRunAsync = status === "success" && (invalid || (shouldReload ?? age > staleAge));
2453        if (preload && route.options.preload === false) ;
2454        else if (loaderShouldRunAsync && !inner.sync) {
2455          loaderIsRunningAsync = true;
2456          (async () => {
2457            try {
2458              await runLoader(inner, matchId, index, route);
2459              const match3 = inner.router.getMatch(matchId);
2460              match3._nonReactive.loaderPromise?.resolve();
2461              match3._nonReactive.loadPromise?.resolve();
2462              match3._nonReactive.loaderPromise = void 0;
2463            } catch (err) {
2464              if (isRedirect(err)) {
2465                await inner.router.navigate(err.options);
2466              }
2467            }
2468          })();
2469        } else if (status !== "success" || loaderShouldRunAsync && inner.sync) {
2470          await runLoader(inner, matchId, index, route);
2471        } else {
2472          const headResult = executeHead(inner, matchId, route);
2473          if (headResult) {
2474            const head = await headResult;
2475            inner.updateMatch(matchId, (prev) => ({
2476              ...prev,
2477              ...head
2478            }));
2479          }
2480        }
2481      }
2482    }
2483    const match = inner.router.getMatch(matchId);
2484    if (!loaderIsRunningAsync) {
2485      match._nonReactive.loaderPromise?.resolve();
2486      match._nonReactive.loadPromise?.resolve();
2487    }
2488    clearTimeout(match._nonReactive.pendingTimeout);
2489    match._nonReactive.pendingTimeout = void 0;
2490    if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = void 0;
2491    match._nonReactive.dehydrated = void 0;
2492    const nextIsFetching = loaderIsRunningAsync ? match.isFetching : false;
2493    if (nextIsFetching !== match.isFetching || match.invalid !== false) {
2494      inner.updateMatch(matchId, (prev) => ({
2495        ...prev,
2496        isFetching: nextIsFetching,
2497        invalid: false
2498      }));
2499      return inner.router.getMatch(matchId);
2500    } else {
2501      return match;
2502    }
2503  };
2504  async function loadMatches(arg) {
2505    const inner = Object.assign(arg, {
2506      matchPromises: []
2507    });
2508    if (!inner.router.isServer && inner.router.state.matches.some((d) => d._forcePending)) {
2509      triggerOnReady(inner);
2510    }
2511    try {
2512      for (let i = 0; i < inner.matches.length; i++) {
2513        const beforeLoad = handleBeforeLoad(inner, i);
2514        if (isPromise(beforeLoad)) await beforeLoad;
2515      }
2516      const max = inner.firstBadMatchIndex ?? inner.matches.length;
2517      for (let i = 0; i < max; i++) {
2518        inner.matchPromises.push(loadRouteMatch(inner, i));
2519      }
2520      await Promise.all(inner.matchPromises);
2521      const readyPromise = triggerOnReady(inner);
2522      if (isPromise(readyPromise)) await readyPromise;
2523    } catch (err) {
2524      if (isNotFound(err) && !inner.preload) {
2525        const readyPromise = triggerOnReady(inner);
2526        if (isPromise(readyPromise)) await readyPromise;
2527        throw err;
2528      }
2529      if (isRedirect(err)) {
2530        throw err;
2531      }
2532    }
2533    return inner.matches;
2534  }
2535  async function loadRouteChunk(route) {
2536    if (!route._lazyLoaded && route._lazyPromise === void 0) {
2537      if (route.lazyFn) {
2538        route._lazyPromise = route.lazyFn().then((lazyRoute) => {
2539          const { id: _id, ...options } = lazyRoute.options;
2540          Object.assign(route.options, options);
2541          route._lazyLoaded = true;
2542          route._lazyPromise = void 0;
2543        });
2544      } else {
2545        route._lazyLoaded = true;
2546      }
2547    }
2548    if (!route._componentsLoaded && route._componentsPromise === void 0) {
2549      const loadComponents = () => {
2550        const preloads = [];
2551        for (const type of componentTypes) {
2552          const preload = route.options[type]?.preload;
2553          if (preload) preloads.push(preload());
2554        }
2555        if (preloads.length)
2556          return Promise.all(preloads).then(() => {
2557            route._componentsLoaded = true;
2558            route._componentsPromise = void 0;
2559          });
2560        route._componentsLoaded = true;
2561        route._componentsPromise = void 0;
2562        return;
2563      };
2564      route._componentsPromise = route._lazyPromise ? route._lazyPromise.then(loadComponents) : loadComponents();
2565    }
2566    return route._componentsPromise;
2567  }
2568  function makeMaybe(value, error) {
2569    if (error) {
2570      return { status: "error", error };
2571    }
2572    return { status: "success", value };
2573  }
2574  function routeNeedsPreload(route) {
2575    for (const componentType of componentTypes) {
2576      if (route.options[componentType]?.preload) {
2577        return true;
2578      }
2579    }
2580    return false;
2581  }
2582  var componentTypes = [
2583    "component",
2584    "errorComponent",
2585    "pendingComponent",
2586    "notFoundComponent"
2587  ];
2588  
2589  // node_modules/@tanstack/router-core/dist/esm/rewrite.js
2590  function composeRewrites(rewrites) {
2591    return {
2592      input: ({ url }) => {
2593        for (const rewrite of rewrites) {
2594          url = executeRewriteInput(rewrite, url);
2595        }
2596        return url;
2597      },
2598      output: ({ url }) => {
2599        for (let i = rewrites.length - 1; i >= 0; i--) {
2600          url = executeRewriteOutput(rewrites[i], url);
2601        }
2602        return url;
2603      }
2604    };
2605  }
2606  function rewriteBasepath(opts) {
2607    const trimmedBasepath = trimPath(opts.basepath);
2608    const normalizedBasepath = `/$trimmedBasepath}`;
2609    const normalizedBasepathWithSlash = `$normalizedBasepath}/`;
2610    const checkBasepath = opts.caseSensitive ? normalizedBasepath : normalizedBasepath.toLowerCase();
2611    const checkBasepathWithSlash = opts.caseSensitive ? normalizedBasepathWithSlash : normalizedBasepathWithSlash.toLowerCase();
2612    return {
2613      input: ({ url }) => {
2614        const pathname = opts.caseSensitive ? url.pathname : url.pathname.toLowerCase();
2615        if (pathname === checkBasepath) {
2616          url.pathname = "/";
2617        } else if (pathname.startsWith(checkBasepathWithSlash)) {
2618          url.pathname = url.pathname.slice(normalizedBasepath.length);
2619        }
2620        return url;
2621      },
2622      output: ({ url }) => {
2623        url.pathname = joinPaths(["/", trimmedBasepath, url.pathname]);
2624        return url;
2625      }
2626    };
2627  }
2628  function executeRewriteInput(rewrite, url) {
2629    const res = rewrite?.input?.({ url });
2630    if (res) {
2631      if (typeof res === "string") {
2632        return new URL(res);
2633      } else if (res instanceof URL) {
2634        return res;
2635      }
2636    }
2637    return url;
2638  }
2639  function executeRewriteOutput(rewrite, url) {
2640    const res = rewrite?.output?.({ url });
2641    if (res) {
2642      if (typeof res === "string") {
2643        return new URL(res);
2644      } else if (res instanceof URL) {
2645        return res;
2646      }
2647    }
2648    return url;
2649  }
2650  
2651  // node_modules/@tanstack/router-core/dist/esm/router.js
2652  function getLocationChangeInfo(routerState) {
2653    const fromLocation = routerState.resolvedLocation;
2654    const toLocation = routerState.location;
2655    const pathChanged = fromLocation?.pathname !== toLocation.pathname;
2656    const hrefChanged = fromLocation?.href !== toLocation.href;
2657    const hashChanged = fromLocation?.hash !== toLocation.hash;
2658    return { fromLocation, toLocation, pathChanged, hrefChanged, hashChanged };
2659  }
2660  var RouterCore = class {
2661    /**
2662     * @deprecated Use the `createRouter` function instead
2663     */
2664    constructor(options) {
2665      this.tempLocationKey = `$Math.round(
2666        Math.random() * 1e7
2667      )}`;
2668      this.resetNextScroll = true;
2669      this.shouldViewTransition = void 0;
2670      this.isViewTransitionTypesSupported = void 0;
2671      this.subscribers = /* @__PURE__ */ new Set();
2672      this.isScrollRestoring = false;
2673      this.isScrollRestorationSetup = false;
2674      this.startTransition = (fn) => fn();
2675      this.update = (newOptions) => {
2676        if (newOptions.notFoundRoute) {
2677          console.warn(
2678            "The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info."
2679          );
2680        }
2681        const prevOptions = this.options;
2682        const prevBasepath = this.basepath ?? prevOptions?.basepath ?? "/";
2683        const basepathWasUnset = this.basepath === void 0;
2684        const prevRewriteOption = prevOptions?.rewrite;
2685        this.options = {
2686          ...prevOptions,
2687          ...newOptions
2688        };
2689        this.isServer = this.options.isServer ?? typeof document === "undefined";
2690        this.pathParamsDecodeCharMap = this.options.pathParamsAllowedCharacters ? new Map(
2691          this.options.pathParamsAllowedCharacters.map((char) => [
2692            encodeURIComponent(char),
2693            char
2694          ])
2695        ) : void 0;
2696        if (!this.history || this.options.history && this.options.history !== this.history) {
2697          if (!this.options.history) {
2698            if (!this.isServer) {
2699              this.history = createBrowserHistory();
2700            }
2701          } else {
2702            this.history = this.options.history;
2703          }
2704        }
2705        this.origin = this.options.origin;
2706        if (!this.origin) {
2707          if (!this.isServer && window?.origin && window.origin !== "null") {
2708            this.origin = window.origin;
2709          } else {
2710            this.origin = "http://localhost";
2711          }
2712        }
2713        if (this.history) {
2714          this.updateLatestLocation();
2715        }
2716        if (this.options.routeTree !== this.routeTree) {
2717          this.routeTree = this.options.routeTree;
2718          this.buildRouteTree();
2719        }
2720        if (!this.__store && this.latestLocation) {
2721          this.__store = new Store(getInitialRouterState(this.latestLocation), {
2722            onUpdate: () => {
2723              this.__store.state = {
2724                ...this.state,
2725                cachedMatches: this.state.cachedMatches.filter(
2726                  (d) => !["redirected"].includes(d.status)
2727                )
2728              };
2729            }
2730          });
2731          setupScrollRestoration(this);
2732        }
2733        let needsLocationUpdate = false;
2734        const nextBasepath = this.options.basepath ?? "/";
2735        const nextRewriteOption = this.options.rewrite;
2736        const basepathChanged = basepathWasUnset || prevBasepath !== nextBasepath;
2737        const rewriteChanged = prevRewriteOption !== nextRewriteOption;
2738        if (basepathChanged || rewriteChanged) {
2739          this.basepath = nextBasepath;
2740          const rewrites = [];
2741          if (trimPath(nextBasepath) !== "") {
2742            rewrites.push(
2743              rewriteBasepath({
2744                basepath: nextBasepath
2745              })
2746            );
2747          }
2748          if (nextRewriteOption) {
2749            rewrites.push(nextRewriteOption);
2750          }
2751          this.rewrite = rewrites.length === 0 ? void 0 : rewrites.length === 1 ? rewrites[0] : composeRewrites(rewrites);
2752          if (this.history) {
2753            this.updateLatestLocation();
2754          }
2755          needsLocationUpdate = true;
2756        }
2757        if (needsLocationUpdate && this.__store) {
2758          this.__store.state = {
2759            ...this.state,
2760            location: this.latestLocation
2761          };
2762        }
2763        if (typeof window !== "undefined" && "CSS" in window && typeof window.CSS?.supports === "function") {
2764          this.isViewTransitionTypesSupported = window.CSS.supports(
2765            "selector(:active-view-transition-type(a)"
2766          );
2767        }
2768      };
2769      this.updateLatestLocation = () => {
2770        this.latestLocation = this.parseLocation(
2771          this.history.location,
2772          this.latestLocation
2773        );
2774      };
2775      this.buildRouteTree = () => {
2776        const { routesById, routesByPath, flatRoutes } = processRouteTree({
2777          routeTree: this.routeTree,
2778          initRoute: (route, i) => {
2779            route.init({
2780              originalIndex: i
2781            });
2782          }
2783        });
2784        this.routesById = routesById;
2785        this.routesByPath = routesByPath;
2786        this.flatRoutes = flatRoutes;
2787        const notFoundRoute = this.options.notFoundRoute;
2788        if (notFoundRoute) {
2789          notFoundRoute.init({
2790            originalIndex: 99999999999
2791          });
2792          this.routesById[notFoundRoute.id] = notFoundRoute;
2793        }
2794      };
2795      this.subscribe = (eventType, fn) => {
2796        const listener = {
2797          eventType,
2798          fn
2799        };
2800        this.subscribers.add(listener);
2801        return () => {
2802          this.subscribers.delete(listener);
2803        };
2804      };
2805      this.emit = (routerEvent) => {
2806        this.subscribers.forEach((listener) => {
2807          if (listener.eventType === routerEvent.type) {
2808            listener.fn(routerEvent);
2809          }
2810        });
2811      };
2812      this.parseLocation = (locationToParse, previousLocation) => {
2813        const parse = ({
2814          href,
2815          state
2816        }) => {
2817          const fullUrl = new URL(href, this.origin);
2818          const url = executeRewriteInput(this.rewrite, fullUrl);
2819          const parsedSearch = this.options.parseSearch(url.search);
2820          const searchStr = this.options.stringifySearch(parsedSearch);
2821          url.search = searchStr;
2822          const fullPath = url.href.replace(url.origin, "");
2823          const { pathname, hash } = url;
2824          return {
2825            href: fullPath,
2826            publicHref: href,
2827            url: url.href,
2828            pathname,
2829            searchStr,
2830            search: replaceEqualDeep(previousLocation?.search, parsedSearch),
2831            hash: hash.split("#").reverse()[0] ?? "",
2832            state: replaceEqualDeep(previousLocation?.state, state)
2833          };
2834        };
2835        const location = parse(locationToParse);
2836        const { __tempLocation, __tempKey } = location.state;
2837        if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {
2838          const parsedTempLocation = parse(__tempLocation);
2839          parsedTempLocation.state.key = location.state.key;
2840          parsedTempLocation.state.__TSR_key = location.state.__TSR_key;
2841          delete parsedTempLocation.state.__tempLocation;
2842          return {
2843            ...parsedTempLocation,
2844            maskedLocation: location
2845          };
2846        }
2847        return location;
2848      };
2849      this.resolvePathWithBase = (from, path) => {
2850        const resolvedPath = resolvePath({
2851          base: from,
2852          to: cleanPath(path),
2853          trailingSlash: this.options.trailingSlash,
2854          parseCache: this.parsePathnameCache
2855        });
2856        return resolvedPath;
2857      };
2858      this.matchRoutes = (pathnameOrNext, locationSearchOrOpts, opts) => {
2859        if (typeof pathnameOrNext === "string") {
2860          return this.matchRoutesInternal(
2861            {
2862              pathname: pathnameOrNext,
2863              search: locationSearchOrOpts
2864            },
2865            opts
2866          );
2867        }
2868        return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts);
2869      };
2870      this.parsePathnameCache = createLRUCache(1e3);
2871      this.getMatchedRoutes = (pathname, routePathname) => {
2872        return getMatchedRoutes({
2873          pathname,
2874          routePathname,
2875          caseSensitive: this.options.caseSensitive,
2876          routesByPath: this.routesByPath,
2877          routesById: this.routesById,
2878          flatRoutes: this.flatRoutes,
2879          parseCache: this.parsePathnameCache
2880        });
2881      };
2882      this.cancelMatch = (id) => {
2883        const match = this.getMatch(id);
2884        if (!match) return;
2885        match.abortController.abort();
2886        clearTimeout(match._nonReactive.pendingTimeout);
2887        match._nonReactive.pendingTimeout = void 0;
2888      };
2889      this.cancelMatches = () => {
2890        this.state.pendingMatches?.forEach((match) => {
2891          this.cancelMatch(match.id);
2892        });
2893      };
2894      this.buildLocation = (opts) => {
2895        const build = (dest = {}) => {
2896          const currentLocation = dest._fromLocation || this.latestLocation;
2897          const allCurrentLocationMatches = this.matchRoutes(currentLocation, {
2898            _buildLocation: true
2899          });
2900          const lastMatch = last(allCurrentLocationMatches);
2901          if (dest.from && true && dest._isNavigate) {
2902            const allFromMatches = this.getMatchedRoutes(
2903              dest.from,
2904              void 0
2905            ).matchedRoutes;
2906            const matchedFrom = findLast(allCurrentLocationMatches, (d) => {
2907              return comparePaths(d.fullPath, dest.from);
2908            });
2909            const matchedCurrent = findLast(allFromMatches, (d) => {
2910              return comparePaths(d.fullPath, lastMatch.fullPath);
2911            });
2912            if (!matchedFrom && !matchedCurrent) {
2913              console.warn(`Could not find match for from: $dest.from}`);
2914            }
2915          }
2916          const defaultedFromPath = dest.unsafeRelative === "path" ? currentLocation.pathname : dest.from ?? lastMatch.fullPath;
2917          const fromPath = this.resolvePathWithBase(defaultedFromPath, ".");
2918          const fromSearch = lastMatch.search;
2919          const fromParams = { ...lastMatch.params };
2920          const nextTo = dest.to ? this.resolvePathWithBase(fromPath, `$dest.to}`) : this.resolvePathWithBase(fromPath, ".");
2921          const nextParams = dest.params === false || dest.params === null ? {} : (dest.params ?? true) === true ? fromParams : Object.assign(
2922            fromParams,
2923            functionalUpdate(dest.params, fromParams)
2924          );
2925          const interpolatedNextTo = interpolatePath({
2926            path: nextTo,
2927            params: nextParams,
2928            parseCache: this.parsePathnameCache
2929          }).interpolatedPath;
2930          const destRoutes = this.matchRoutes(interpolatedNextTo, void 0, {
2931            _buildLocation: true
2932          }).map((d) => this.looseRoutesById[d.routeId]);
2933          if (Object.keys(nextParams).length > 0) {
2934            for (const route of destRoutes) {
2935              const fn = route.options.params?.stringify ?? route.options.stringifyParams;
2936              if (fn) {
2937                Object.assign(nextParams, fn(nextParams));
2938              }
2939            }
2940          }
2941          const nextPathname = decodePathSegment(
2942            interpolatePath({
2943              // Use the original template path for interpolation
2944              // This preserves the original parameter syntax including optional parameters
2945              path: nextTo,
2946              params: nextParams,
2947              leaveWildcards: false,
2948              leaveParams: opts.leaveParams,
2949              decodeCharMap: this.pathParamsDecodeCharMap,
2950              parseCache: this.parsePathnameCache
2951            }).interpolatedPath
2952          );
2953          let nextSearch = fromSearch;
2954          if (opts._includeValidateSearch && this.options.search?.strict) {
2955            const validatedSearch = {};
2956            destRoutes.forEach((route) => {
2957              if (route.options.validateSearch) {
2958                try {
2959                  Object.assign(
2960                    validatedSearch,
2961                    validateSearch(route.options.validateSearch, {
2962                      ...validatedSearch,
2963                      ...nextSearch
2964                    })
2965                  );
2966                } catch {
2967                }
2968              }
2969            });
2970            nextSearch = validatedSearch;
2971          }
2972          nextSearch = applySearchMiddleware({
2973            search: nextSearch,
2974            dest,
2975            destRoutes,
2976            _includeValidateSearch: opts._includeValidateSearch
2977          });
2978          nextSearch = replaceEqualDeep(fromSearch, nextSearch);
2979          const searchStr = this.options.stringifySearch(nextSearch);
2980          const hash = dest.hash === true ? currentLocation.hash : dest.hash ? functionalUpdate(dest.hash, currentLocation.hash) : void 0;
2981          const hashStr = hash ? `#$hash}` : "";
2982          let nextState = dest.state === true ? currentLocation.state : dest.state ? functionalUpdate(dest.state, currentLocation.state) : {};
2983          nextState = replaceEqualDeep(currentLocation.state, nextState);
2984          const fullPath = `$nextPathname}$searchStr}$hashStr}`;
2985          const url = new URL(fullPath, this.origin);
2986          const rewrittenUrl = executeRewriteOutput(this.rewrite, url);
2987          return {
2988            publicHref: rewrittenUrl.pathname + rewrittenUrl.search + rewrittenUrl.hash,
2989            href: fullPath,
2990            url: rewrittenUrl.href,
2991            pathname: nextPathname,
2992            search: nextSearch,
2993            searchStr,
2994            state: nextState,
2995            hash: hash ?? "",
2996            unmaskOnReload: dest.unmaskOnReload
2997          };
2998        };
2999        const buildWithMatches = (dest = {}, maskedDest) => {
3000          const next = build(dest);
3001          let maskedNext = maskedDest ? build(maskedDest) : void 0;
3002          if (!maskedNext) {
3003            let params = {};
3004            const foundMask = this.options.routeMasks?.find((d) => {
3005              const match = matchPathname(
3006                next.pathname,
3007                {
3008                  to: d.from,
3009                  caseSensitive: false,
3010                  fuzzy: false
3011                },
3012                this.parsePathnameCache
3013              );
3014              if (match) {
3015                params = match;
3016                return true;
3017              }
3018              return false;
3019            });
3020            if (foundMask) {
3021              const { from: _from, ...maskProps } = foundMask;
3022              maskedDest = {
3023                from: opts.from,
3024                ...maskProps,
3025                params
3026              };
3027              maskedNext = build(maskedDest);
3028            }
3029          }
3030          if (maskedNext) {
3031            next.maskedLocation = maskedNext;
3032          }
3033          return next;
3034        };
3035        if (opts.mask) {
3036          return buildWithMatches(opts, {
3037            from: opts.from,
3038            ...opts.mask
3039          });
3040        }
3041        return buildWithMatches(opts);
3042      };
3043      this.commitLocation = ({
3044        viewTransition,
3045        ignoreBlocker,
3046        ...next
3047      }) => {
3048        const isSameState = () => {
3049          const ignoredProps = [
3050            "key",
3051            // TODO: Remove in v2 - use __TSR_key instead
3052            "__TSR_key",
3053            "__TSR_index",
3054            "__hashScrollIntoViewOptions"
3055          ];
3056          ignoredProps.forEach((prop) => {
3057            next.state[prop] = this.latestLocation.state[prop];
3058          });
3059          const isEqual = deepEqual(next.state, this.latestLocation.state);
3060          ignoredProps.forEach((prop) => {
3061            delete next.state[prop];
3062          });
3063          return isEqual;
3064        };
3065        const isSameUrl = trimPathRight(this.latestLocation.href) === trimPathRight(next.href);
3066        const previousCommitPromise = this.commitLocationPromise;
3067        this.commitLocationPromise = createControlledPromise(() => {
3068          previousCommitPromise?.resolve();
3069        });
3070        if (isSameUrl && isSameState()) {
3071          this.load();
3072        } else {
3073          let { maskedLocation, hashScrollIntoView, ...nextHistory } = next;
3074          if (maskedLocation) {
3075            nextHistory = {
3076              ...maskedLocation,
3077              state: {
3078                ...maskedLocation.state,
3079                __tempKey: void 0,
3080                __tempLocation: {
3081                  ...nextHistory,
3082                  search: nextHistory.searchStr,
3083                  state: {
3084                    ...nextHistory.state,
3085                    __tempKey: void 0,
3086                    __tempLocation: void 0,
3087                    __TSR_key: void 0,
3088                    key: void 0
3089                    // TODO: Remove in v2 - use __TSR_key instead
3090                  }
3091                }
3092              }
3093            };
3094            if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
3095              nextHistory.state.__tempKey = this.tempLocationKey;
3096            }
3097          }
3098          nextHistory.state.__hashScrollIntoViewOptions = hashScrollIntoView ?? this.options.defaultHashScrollIntoView ?? true;
3099          this.shouldViewTransition = viewTransition;
3100          this.history[next.replace ? "replace" : "push"](
3101            nextHistory.publicHref,
3102            nextHistory.state,
3103            { ignoreBlocker }
3104          );
3105        }
3106        this.resetNextScroll = next.resetScroll ?? true;
3107        if (!this.history.subscribers.size) {
3108          this.load();
3109        }
3110        return this.commitLocationPromise;
3111      };
3112      this.buildAndCommitLocation = ({
3113        replace,
3114        resetScroll,
3115        hashScrollIntoView,
3116        viewTransition,
3117        ignoreBlocker,
3118        href,
3119        ...rest
3120      } = {}) => {
3121        if (href) {
3122          const currentIndex = this.history.location.state.__TSR_index;
3123          const parsed = parseHref(href, {
3124            __TSR_index: replace ? currentIndex : currentIndex + 1
3125          });
3126          rest.to = parsed.pathname;
3127          rest.search = this.options.parseSearch(parsed.search);
3128          rest.hash = parsed.hash.slice(1);
3129        }
3130        const location = this.buildLocation({
3131          ...rest,
3132          _includeValidateSearch: true
3133        });
3134        return this.commitLocation({
3135          ...location,
3136          viewTransition,
3137          replace,
3138          resetScroll,
3139          hashScrollIntoView,
3140          ignoreBlocker
3141        });
3142      };
3143      this.navigate = ({ to, reloadDocument, href, ...rest }) => {
3144        if (!reloadDocument && href) {
3145          try {
3146            new URL(`$href}`);
3147            reloadDocument = true;
3148          } catch {
3149          }
3150        }
3151        if (reloadDocument) {
3152          if (!href) {
3153            const location = this.buildLocation({ to, ...rest });
3154            href = location.url;
3155          }
3156          if (rest.replace) {
3157            window.location.replace(href);
3158          } else {
3159            window.location.href = href;
3160          }
3161          return Promise.resolve();
3162        }
3163        return this.buildAndCommitLocation({
3164          ...rest,
3165          href,
3166          to,
3167          _isNavigate: true
3168        });
3169      };
3170      this.beforeLoad = () => {
3171        this.cancelMatches();
3172        this.updateLatestLocation();
3173        if (this.isServer) {
3174          const nextLocation = this.buildLocation({
3175            to: this.latestLocation.pathname,
3176            search: true,
3177            params: true,
3178            hash: true,
3179            state: true,
3180            _includeValidateSearch: true
3181          });
3182          const normalizeUrl = (url) => {
3183            try {
3184              return encodeURI(decodeURI(url));
3185            } catch {
3186              return url;
3187            }
3188          };
3189          if (trimPath(normalizeUrl(this.latestLocation.href)) !== trimPath(normalizeUrl(nextLocation.href))) {
3190            let href = nextLocation.url;
3191            if (this.origin && href.startsWith(this.origin)) {
3192              href = href.replace(this.origin, "") || "/";
3193            }
3194            throw redirect({ href });
3195          }
3196        }
3197        const pendingMatches = this.matchRoutes(this.latestLocation);
3198        this.__store.setState((s) => ({
3199          ...s,
3200          status: "pending",
3201          statusCode: 200,
3202          isLoading: true,
3203          location: this.latestLocation,
3204          pendingMatches,
3205          // If a cached moved to pendingMatches, remove it from cachedMatches
3206          cachedMatches: s.cachedMatches.filter(
3207            (d) => !pendingMatches.some((e) => e.id === d.id)
3208          )
3209        }));
3210      };
3211      this.load = async (opts) => {
3212        let redirect2;
3213        let notFound2;
3214        let loadPromise;
3215        loadPromise = new Promise((resolve) => {
3216          this.startTransition(async () => {
3217            try {
3218              this.beforeLoad();
3219              const next = this.latestLocation;
3220              const prevLocation = this.state.resolvedLocation;
3221              if (!this.state.redirect) {
3222                this.emit({
3223                  type: "onBeforeNavigate",
3224                  ...getLocationChangeInfo({
3225                    resolvedLocation: prevLocation,
3226                    location: next
3227                  })
3228                });
3229              }
3230              this.emit({
3231                type: "onBeforeLoad",
3232                ...getLocationChangeInfo({
3233                  resolvedLocation: prevLocation,
3234                  location: next
3235                })
3236              });
3237              await loadMatches({
3238                router: this,
3239                sync: opts?.sync,
3240                matches: this.state.pendingMatches,
3241                location: next,
3242                updateMatch: this.updateMatch,
3243                // eslint-disable-next-line @typescript-eslint/require-await
3244                onReady: async () => {
3245                  this.startViewTransition(async () => {
3246                    let exitingMatches;
3247                    let enteringMatches;
3248                    let stayingMatches;
3249                    batch(() => {
3250                      this.__store.setState((s) => {
3251                        const previousMatches = s.matches;
3252                        const newMatches = s.pendingMatches || s.matches;
3253                        exitingMatches = previousMatches.filter(
3254                          (match) => !newMatches.some((d) => d.id === match.id)
3255                        );
3256                        enteringMatches = newMatches.filter(
3257                          (match) => !previousMatches.some((d) => d.id === match.id)
3258                        );
3259                        stayingMatches = previousMatches.filter(
3260                          (match) => newMatches.some((d) => d.id === match.id)
3261                        );
3262                        return {
3263                          ...s,
3264                          isLoading: false,
3265                          loadedAt: Date.now(),
3266                          matches: newMatches,
3267                          pendingMatches: void 0,
3268                          cachedMatches: [
3269                            ...s.cachedMatches,
3270                            ...exitingMatches.filter((d) => d.status !== "error")
3271                          ]
3272                        };
3273                      });
3274                      this.clearExpiredCache();
3275                    });
3276                    [
3277                      [exitingMatches, "onLeave"],
3278                      [enteringMatches, "onEnter"],
3279                      [stayingMatches, "onStay"]
3280                    ].forEach(([matches, hook]) => {
3281                      matches.forEach((match) => {
3282                        this.looseRoutesById[match.routeId].options[hook]?.(match);
3283                      });
3284                    });
3285                  });
3286                }
3287              });
3288            } catch (err) {
3289              if (isRedirect(err)) {
3290                redirect2 = err;
3291                if (!this.isServer) {
3292                  this.navigate({
3293                    ...redirect2.options,
3294                    replace: true,
3295                    ignoreBlocker: true
3296                  });
3297                }
3298              } else if (isNotFound(err)) {
3299                notFound2 = err;
3300              }
3301              this.__store.setState((s) => ({
3302                ...s,
3303                statusCode: redirect2 ? redirect2.status : notFound2 ? 404 : s.matches.some((d) => d.status === "error") ? 500 : 200,
3304                redirect: redirect2
3305              }));
3306            }
3307            if (this.latestLoadPromise === loadPromise) {
3308              this.commitLocationPromise?.resolve();
3309              this.latestLoadPromise = void 0;
3310              this.commitLocationPromise = void 0;
3311            }
3312            resolve();
3313          });
3314        });
3315        this.latestLoadPromise = loadPromise;
3316        await loadPromise;
3317        while (this.latestLoadPromise && loadPromise !== this.latestLoadPromise) {
3318          await this.latestLoadPromise;
3319        }
3320        let newStatusCode = void 0;
3321        if (this.hasNotFoundMatch()) {
3322          newStatusCode = 404;
3323        } else if (this.__store.state.matches.some((d) => d.status === "error")) {
3324          newStatusCode = 500;
3325        }
3326        if (newStatusCode !== void 0) {
3327          this.__store.setState((s) => ({
3328            ...s,
3329            statusCode: newStatusCode
3330          }));
3331        }
3332      };
3333      this.startViewTransition = (fn) => {
3334        const shouldViewTransition = this.shouldViewTransition ?? this.options.defaultViewTransition;
3335        delete this.shouldViewTransition;
3336        if (shouldViewTransition && typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function") {
3337          let startViewTransitionParams;
3338          if (typeof shouldViewTransition === "object" && this.isViewTransitionTypesSupported) {
3339            const next = this.latestLocation;
3340            const prevLocation = this.state.resolvedLocation;
3341            const resolvedViewTransitionTypes = typeof shouldViewTransition.types === "function" ? shouldViewTransition.types(
3342              getLocationChangeInfo({
3343                resolvedLocation: prevLocation,
3344                location: next
3345              })
3346            ) : shouldViewTransition.types;
3347            if (resolvedViewTransitionTypes === false) {
3348              fn();
3349              return;
3350            }
3351            startViewTransitionParams = {
3352              update: fn,
3353              types: resolvedViewTransitionTypes
3354            };
3355          } else {
3356            startViewTransitionParams = fn;
3357          }
3358          document.startViewTransition(startViewTransitionParams);
3359        } else {
3360          fn();
3361        }
3362      };
3363      this.updateMatch = (id, updater) => {
3364        const matchesKey = this.state.pendingMatches?.some((d) => d.id === id) ? "pendingMatches" : this.state.matches.some((d) => d.id === id) ? "matches" : this.state.cachedMatches.some((d) => d.id === id) ? "cachedMatches" : "";
3365        if (matchesKey) {
3366          this.__store.setState((s) => ({
3367            ...s,
3368            [matchesKey]: s[matchesKey]?.map((d) => d.id === id ? updater(d) : d)
3369          }));
3370        }
3371      };
3372      this.getMatch = (matchId) => {
3373        const findFn = (d) => d.id === matchId;
3374        return this.state.cachedMatches.find(findFn) ?? this.state.pendingMatches?.find(findFn) ?? this.state.matches.find(findFn);
3375      };
3376      this.invalidate = (opts) => {
3377        const invalidate = (d) => {
3378          if (opts?.filter?.(d) ?? true) {
3379            return {
3380              ...d,
3381              invalid: true,
3382              ...opts?.forcePending || d.status === "error" ? { status: "pending", error: void 0 } : void 0
3383            };
3384          }
3385          return d;
3386        };
3387        this.__store.setState((s) => ({
3388          ...s,
3389          matches: s.matches.map(invalidate),
3390          cachedMatches: s.cachedMatches.map(invalidate),
3391          pendingMatches: s.pendingMatches?.map(invalidate)
3392        }));
3393        this.shouldViewTransition = false;
3394        return this.load({ sync: opts?.sync });
3395      };
3396      this.resolveRedirect = (redirect2) => {
3397        if (!redirect2.options.href) {
3398          const location = this.buildLocation(redirect2.options);
3399          let href = location.url;
3400          if (this.origin && href.startsWith(this.origin)) {
3401            href = href.replace(this.origin, "") || "/";
3402          }
3403          redirect2.options.href = location.href;
3404          redirect2.headers.set("Location", href);
3405        }
3406        if (!redirect2.headers.get("Location")) {
3407          redirect2.headers.set("Location", redirect2.options.href);
3408        }
3409        return redirect2;
3410      };
3411      this.clearCache = (opts) => {
3412        const filter = opts?.filter;
3413        if (filter !== void 0) {
3414          this.__store.setState((s) => {
3415            return {
3416              ...s,
3417              cachedMatches: s.cachedMatches.filter(
3418                (m) => !filter(m)
3419              )
3420            };
3421          });
3422        } else {
3423          this.__store.setState((s) => {
3424            return {
3425              ...s,
3426              cachedMatches: []
3427            };
3428          });
3429        }
3430      };
3431      this.clearExpiredCache = () => {
3432        const filter = (d) => {
3433          const route = this.looseRoutesById[d.routeId];
3434          if (!route.options.loader) {
3435            return true;
3436          }
3437          const gcTime = (d.preload ? route.options.preloadGcTime ?? this.options.defaultPreloadGcTime : route.options.gcTime ?? this.options.defaultGcTime) ?? 5 * 60 * 1e3;
3438          const isError = d.status === "error";
3439          if (isError) return true;
3440          const gcEligible = Date.now() - d.updatedAt >= gcTime;
3441          return gcEligible;
3442        };
3443        this.clearCache({ filter });
3444      };
3445      this.loadRouteChunk = loadRouteChunk;
3446      this.preloadRoute = async (opts) => {
3447        const next = this.buildLocation(opts);
3448        let matches = this.matchRoutes(next, {
3449          throwOnError: true,
3450          preload: true,
3451          dest: opts
3452        });
3453        const activeMatchIds = new Set(
3454          [...this.state.matches, ...this.state.pendingMatches ?? []].map(
3455            (d) => d.id
3456          )
3457        );
3458        const loadedMatchIds = /* @__PURE__ */ new Set([
3459          ...activeMatchIds,
3460          ...this.state.cachedMatches.map((d) => d.id)
3461        ]);
3462        batch(() => {
3463          matches.forEach((match) => {
3464            if (!loadedMatchIds.has(match.id)) {
3465              this.__store.setState((s) => ({
3466                ...s,
3467                cachedMatches: [...s.cachedMatches, match]
3468              }));
3469            }
3470          });
3471        });
3472        try {
3473          matches = await loadMatches({
3474            router: this,
3475            matches,
3476            location: next,
3477            preload: true,
3478            updateMatch: (id, updater) => {
3479              if (activeMatchIds.has(id)) {
3480                matches = matches.map((d) => d.id === id ? updater(d) : d);
3481              } else {
3482                this.updateMatch(id, updater);
3483              }
3484            }
3485          });
3486          return matches;
3487        } catch (err) {
3488          if (isRedirect(err)) {
3489            if (err.options.reloadDocument) {
3490              return void 0;
3491            }
3492            return await this.preloadRoute({
3493              ...err.options,
3494              _fromLocation: next
3495            });
3496          }
3497          if (!isNotFound(err)) {
3498            console.error(err);
3499          }
3500          return void 0;
3501        }
3502      };
3503      this.matchRoute = (location, opts) => {
3504        const matchLocation = {
3505          ...location,
3506          to: location.to ? this.resolvePathWithBase(
3507            location.from || "",
3508            location.to
3509          ) : void 0,
3510          params: location.params || {},
3511          leaveParams: true
3512        };
3513        const next = this.buildLocation(matchLocation);
3514        if (opts?.pending && this.state.status !== "pending") {
3515          return false;
3516        }
3517        const pending = opts?.pending === void 0 ? !this.state.isLoading : opts.pending;
3518        const baseLocation = pending ? this.latestLocation : this.state.resolvedLocation || this.state.location;
3519        const match = matchPathname(
3520          baseLocation.pathname,
3521          {
3522            ...opts,
3523            to: next.pathname
3524          },
3525          this.parsePathnameCache
3526        );
3527        if (!match) {
3528          return false;
3529        }
3530        if (location.params) {
3531          if (!deepEqual(match, location.params, { partial: true })) {
3532            return false;
3533          }
3534        }
3535        if (match && (opts?.includeSearch ?? true)) {
3536          return deepEqual(baseLocation.search, next.search, { partial: true }) ? match : false;
3537        }
3538        return match;
3539      };
3540      this.hasNotFoundMatch = () => {
3541        return this.__store.state.matches.some(
3542          (d) => d.status === "notFound" || d.globalNotFound
3543        );
3544      };
3545      this.update({
3546        defaultPreloadDelay: 50,
3547        defaultPendingMs: 1e3,
3548        defaultPendingMinMs: 500,
3549        context: void 0,
3550        ...options,
3551        caseSensitive: options.caseSensitive ?? false,
3552        notFoundMode: options.notFoundMode ?? "fuzzy",
3553        stringifySearch: options.stringifySearch ?? defaultStringifySearch,
3554        parseSearch: options.parseSearch ?? defaultParseSearch
3555      });
3556      if (typeof document !== "undefined") {
3557        self.__TSR_ROUTER__ = this;
3558      }
3559    }
3560    isShell() {
3561      return !!this.options.isShell;
3562    }
3563    isPrerendering() {
3564      return !!this.options.isPrerendering;
3565    }
3566    get state() {
3567      return this.__store.state;
3568    }
3569    get looseRoutesById() {
3570      return this.routesById;
3571    }
3572    matchRoutesInternal(next, opts) {
3573      const { foundRoute, matchedRoutes, routeParams } = this.getMatchedRoutes(
3574        next.pathname,
3575        opts?.dest?.to
3576      );
3577      let isGlobalNotFound = false;
3578      if (
3579        // If we found a route, and it's not an index route and we have left over path
3580        foundRoute ? foundRoute.path !== "/" && routeParams["**"] : (
3581          // Or if we didn't find a route and we have left over path
3582          trimPathRight(next.pathname)
3583        )
3584      ) {
3585        if (this.options.notFoundRoute) {
3586          matchedRoutes.push(this.options.notFoundRoute);
3587        } else {
3588          isGlobalNotFound = true;
3589        }
3590      }
3591      const globalNotFoundRouteId = (() => {
3592        if (!isGlobalNotFound) {
3593          return void 0;
3594        }
3595        if (this.options.notFoundMode !== "root") {
3596          for (let i = matchedRoutes.length - 1; i >= 0; i--) {
3597            const route = matchedRoutes[i];
3598            if (route.children) {
3599              return route.id;
3600            }
3601          }
3602        }
3603        return rootRouteId;
3604      })();
3605      const matches = [];
3606      const getParentContext = (parentMatch) => {
3607        const parentMatchId = parentMatch?.id;
3608        const parentContext = !parentMatchId ? this.options.context ?? void 0 : parentMatch.context ?? this.options.context ?? void 0;
3609        return parentContext;
3610      };
3611      matchedRoutes.forEach((route, index) => {
3612        const parentMatch = matches[index - 1];
3613        const [preMatchSearch, strictMatchSearch, searchError] = (() => {
3614          const parentSearch = parentMatch?.search ?? next.search;
3615          const parentStrictSearch = parentMatch?._strictSearch ?? void 0;
3616          try {
3617            const strictSearch = validateSearch(route.options.validateSearch, { ...parentSearch }) ?? void 0;
3618            return [
3619              {
3620                ...parentSearch,
3621                ...strictSearch
3622              },
3623              { ...parentStrictSearch, ...strictSearch },
3624              void 0
3625            ];
3626          } catch (err) {
3627            let searchParamError = err;
3628            if (!(err instanceof SearchParamError)) {
3629              searchParamError = new SearchParamError(err.message, {
3630                cause: err
3631              });
3632            }
3633            if (opts?.throwOnError) {
3634              throw searchParamError;
3635            }
3636            return [parentSearch, {}, searchParamError];
3637          }
3638        })();
3639        const loaderDeps = route.options.loaderDeps?.({
3640          search: preMatchSearch
3641        }) ?? "";
3642        const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
3643        const { interpolatedPath, usedParams } = interpolatePath({
3644          path: route.fullPath,
3645          params: routeParams,
3646          decodeCharMap: this.pathParamsDecodeCharMap
3647        });
3648        const matchId = interpolatePath({
3649          path: route.id,
3650          params: routeParams,
3651          leaveWildcards: true,
3652          decodeCharMap: this.pathParamsDecodeCharMap,
3653          parseCache: this.parsePathnameCache
3654        }).interpolatedPath + loaderDepsHash;
3655        const existingMatch = this.getMatch(matchId);
3656        const previousMatch = this.state.matches.find(
3657          (d) => d.routeId === route.id
3658        );
3659        const strictParams = existingMatch?._strictParams ?? usedParams;
3660        let paramsError = void 0;
3661        if (!existingMatch) {
3662          const strictParseParams = route.options.params?.parse ?? route.options.parseParams;
3663          if (strictParseParams) {
3664            try {
3665              Object.assign(
3666                strictParams,
3667                strictParseParams(strictParams)
3668              );
3669            } catch (err) {
3670              paramsError = new PathParamError(err.message, {
3671                cause: err
3672              });
3673              if (opts?.throwOnError) {
3674                throw paramsError;
3675              }
3676            }
3677          }
3678        }
3679        Object.assign(routeParams, strictParams);
3680        const cause = previousMatch ? "stay" : "enter";
3681        let match;
3682        if (existingMatch) {
3683          match = {
3684            ...existingMatch,
3685            cause,
3686            params: previousMatch ? replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
3687            _strictParams: strictParams,
3688            search: previousMatch ? replaceEqualDeep(previousMatch.search, preMatchSearch) : replaceEqualDeep(existingMatch.search, preMatchSearch),
3689            _strictSearch: strictMatchSearch
3690          };
3691        } else {
3692          const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
3693          match = {
3694            id: matchId,
3695            index,
3696            routeId: route.id,
3697            params: previousMatch ? replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
3698            _strictParams: strictParams,
3699            pathname: interpolatedPath,
3700            updatedAt: Date.now(),
3701            search: previousMatch ? replaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
3702            _strictSearch: strictMatchSearch,
3703            searchError: void 0,
3704            status,
3705            isFetching: false,
3706            error: void 0,
3707            paramsError,
3708            __routeContext: void 0,
3709            _nonReactive: {
3710              loadPromise: createControlledPromise()
3711            },
3712            __beforeLoadContext: void 0,
3713            context: {},
3714            abortController: new AbortController(),
3715            fetchCount: 0,
3716            cause,
3717            loaderDeps: previousMatch ? replaceEqualDeep(previousMatch.loaderDeps, loaderDeps) : loaderDeps,
3718            invalid: false,
3719            preload: false,
3720            links: void 0,
3721            scripts: void 0,
3722            headScripts: void 0,
3723            meta: void 0,
3724            staticData: route.options.staticData || {},
3725            fullPath: route.fullPath
3726          };
3727        }
3728        if (!opts?.preload) {
3729          match.globalNotFound = globalNotFoundRouteId === route.id;
3730        }
3731        match.searchError = searchError;
3732        const parentContext = getParentContext(parentMatch);
3733        match.context = {
3734          ...parentContext,
3735          ...match.__routeContext,
3736          ...match.__beforeLoadContext
3737        };
3738        matches.push(match);
3739      });
3740      matches.forEach((match, index) => {
3741        const route = this.looseRoutesById[match.routeId];
3742        const existingMatch = this.getMatch(match.id);
3743        if (!existingMatch && opts?._buildLocation !== true) {
3744          const parentMatch = matches[index - 1];
3745          const parentContext = getParentContext(parentMatch);
3746          if (route.options.context) {
3747            const contextFnContext = {
3748              deps: match.loaderDeps,
3749              params: match.params,
3750              context: parentContext ?? {},
3751              location: next,
3752              navigate: (opts2) => this.navigate({ ...opts2, _fromLocation: next }),
3753              buildLocation: this.buildLocation,
3754              cause: match.cause,
3755              abortController: match.abortController,
3756              preload: !!match.preload,
3757              matches
3758            };
3759            match.__routeContext = route.options.context(contextFnContext) ?? void 0;
3760          }
3761          match.context = {
3762            ...parentContext,
3763            ...match.__routeContext,
3764            ...match.__beforeLoadContext
3765          };
3766        }
3767      });
3768      return matches;
3769    }
3770  };
3771  var SearchParamError = class extends Error {
3772  };
3773  var PathParamError = class extends Error {
3774  };
3775  var normalize = (str) => str.endsWith("/") && str.length > 1 ? str.slice(0, -1) : str;
3776  function comparePaths(a, b) {
3777    return normalize(a) === normalize(b);
3778  }
3779  function getInitialRouterState(location) {
3780    return {
3781      loadedAt: 0,
3782      isLoading: false,
3783      isTransitioning: false,
3784      status: "idle",
3785      resolvedLocation: void 0,
3786      location,
3787      matches: [],
3788      pendingMatches: [],
3789      cachedMatches: [],
3790      statusCode: 200
3791    };
3792  }
3793  function validateSearch(validateSearch2, input) {
3794    if (validateSearch2 == null) return {};
3795    if ("~standard" in validateSearch2) {
3796      const result = validateSearch2["~standard"].validate(input);
3797      if (result instanceof Promise)
3798        throw new SearchParamError("Async validation not supported");
3799      if (result.issues)
3800        throw new SearchParamError(JSON.stringify(result.issues, void 0, 2), {
3801          cause: result
3802        });
3803      return result.value;
3804    }
3805    if ("parse" in validateSearch2) {
3806      return validateSearch2.parse(input);
3807    }
3808    if (typeof validateSearch2 === "function") {
3809      return validateSearch2(input);
3810    }
3811    return {};
3812  }
3813  function getMatchedRoutes({
3814    pathname,
3815    routePathname,
3816    caseSensitive,
3817    routesByPath,
3818    routesById,
3819    flatRoutes,
3820    parseCache
3821  }) {
3822    let routeParams = {};
3823    const trimmedPath = trimPathRight(pathname);
3824    const getMatchedParams = (route) => {
3825      const result = matchPathname(
3826        trimmedPath,
3827        {
3828          to: route.fullPath,
3829          caseSensitive: route.options?.caseSensitive ?? caseSensitive,
3830          // we need fuzzy matching for `notFoundMode: 'fuzzy'`
3831          fuzzy: true
3832        },
3833        parseCache
3834      );
3835      return result;
3836    };
3837    let foundRoute = routePathname !== void 0 ? routesByPath[routePathname] : void 0;
3838    if (foundRoute) {
3839      routeParams = getMatchedParams(foundRoute);
3840    } else {
3841      let fuzzyMatch = void 0;
3842      for (const route of flatRoutes) {
3843        const matchedParams = getMatchedParams(route);
3844        if (matchedParams) {
3845          if (route.path !== "/" && matchedParams["**"]) {
3846            if (!fuzzyMatch) {
3847              fuzzyMatch = { foundRoute: route, routeParams: matchedParams };
3848            }
3849          } else {
3850            foundRoute = route;
3851            routeParams = matchedParams;
3852            break;
3853          }
3854        }
3855      }
3856      if (!foundRoute && fuzzyMatch) {
3857        foundRoute = fuzzyMatch.foundRoute;
3858        routeParams = fuzzyMatch.routeParams;
3859      }
3860    }
3861    let routeCursor = foundRoute || routesById[rootRouteId];
3862    const matchedRoutes = [routeCursor];
3863    while (routeCursor.parentRoute) {
3864      routeCursor = routeCursor.parentRoute;
3865      matchedRoutes.push(routeCursor);
3866    }
3867    matchedRoutes.reverse();
3868    return { matchedRoutes, routeParams, foundRoute };
3869  }
3870  function applySearchMiddleware({
3871    search,
3872    dest,
3873    destRoutes,
3874    _includeValidateSearch
3875  }) {
3876    const allMiddlewares = destRoutes.reduce(
3877      (acc, route) => {
3878        const middlewares = [];
3879        if ("search" in route.options) {
3880          if (route.options.search?.middlewares) {
3881            middlewares.push(...route.options.search.middlewares);
3882          }
3883        } else if (route.options.preSearchFilters || route.options.postSearchFilters) {
3884          const legacyMiddleware = ({
3885            search: search2,
3886            next
3887          }) => {
3888            let nextSearch = search2;
3889            if ("preSearchFilters" in route.options && route.options.preSearchFilters) {
3890              nextSearch = route.options.preSearchFilters.reduce(
3891                (prev, next2) => next2(prev),
3892                search2
3893              );
3894            }
3895            const result = next(nextSearch);
3896            if ("postSearchFilters" in route.options && route.options.postSearchFilters) {
3897              return route.options.postSearchFilters.reduce(
3898                (prev, next2) => next2(prev),
3899                result
3900              );
3901            }
3902            return result;
3903          };
3904          middlewares.push(legacyMiddleware);
3905        }
3906        if (_includeValidateSearch && route.options.validateSearch) {
3907          const validate = ({ search: search2, next }) => {
3908            const result = next(search2);
3909            try {
3910              const validatedSearch = {
3911                ...result,
3912                ...validateSearch(route.options.validateSearch, result) ?? void 0
3913              };
3914              return validatedSearch;
3915            } catch {
3916              return result;
3917            }
3918          };
3919          middlewares.push(validate);
3920        }
3921        return acc.concat(middlewares);
3922      },
3923      []
3924    ) ?? [];
3925    const final = ({ search: search2 }) => {
3926      if (!dest.search) {
3927        return {};
3928      }
3929      if (dest.search === true) {
3930        return search2;
3931      }
3932      return functionalUpdate(dest.search, search2);
3933    };
3934    allMiddlewares.push(final);
3935    const applyNext = (index, currentSearch) => {
3936      if (index >= allMiddlewares.length) {
3937        return currentSearch;
3938      }
3939      const middleware = allMiddlewares[index];
3940      const next = (newSearch) => {
3941        return applyNext(index + 1, newSearch);
3942      };
3943      return middleware({ search: currentSearch, next });
3944    };
3945    return applyNext(0, search);
3946  }
3947  
3948  // node_modules/@tanstack/router-core/dist/esm/link.js
3949  var preloadWarning = "Error preloading route! \u261D\uFE0F";
3950  
3951  // node_modules/@tanstack/router-core/dist/esm/route.js
3952  var BaseRoute = class {
3953    constructor(options) {
3954      this.init = (opts) => {
3955        this.originalIndex = opts.originalIndex;
3956        const options2 = this.options;
3957        const isRoot = !options2?.path && !options2?.id;
3958        this.parentRoute = this.options.getParentRoute?.();
3959        if (isRoot) {
3960          this._path = rootRouteId;
3961        } else if (!this.parentRoute) {
3962          invariant(
3963            false,
3964            `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`
3965          );
3966        }
3967        let path = isRoot ? rootRouteId : options2?.path;
3968        if (path && path !== "/") {
3969          path = trimPathLeft(path);
3970        }
3971        const customId = options2?.id || path;
3972        let id = isRoot ? rootRouteId : joinPaths([
3973          this.parentRoute.id === rootRouteId ? "" : this.parentRoute.id,
3974          customId
3975        ]);
3976        if (path === rootRouteId) {
3977          path = "/";
3978        }
3979        if (id !== rootRouteId) {
3980          id = joinPaths(["/", id]);
3981        }
3982        const fullPath = id === rootRouteId ? "/" : joinPaths([this.parentRoute.fullPath, path]);
3983        this._path = path;
3984        this._id = id;
3985        this._fullPath = fullPath;
3986        this._to = fullPath;
3987      };
3988      this.clone = (other) => {
3989        this._path = other._path;
3990        this._id = other._id;
3991        this._fullPath = other._fullPath;
3992        this._to = other._to;
3993        this.options.getParentRoute = other.options.getParentRoute;
3994        this.children = other.children;
3995      };
3996      this.addChildren = (children) => {
3997        return this._addFileChildren(children);
3998      };
3999      this._addFileChildren = (children) => {
4000        if (Array.isArray(children)) {
4001          this.children = children;
4002        }
4003        if (typeof children === "object" && children !== null) {
4004          this.children = Object.values(children);
4005        }
4006        return this;
4007      };
4008      this._addFileTypes = () => {
4009        return this;
4010      };
4011      this.updateLoader = (options2) => {
4012        Object.assign(this.options, options2);
4013        return this;
4014      };
4015      this.update = (options2) => {
4016        Object.assign(this.options, options2);
4017        return this;
4018      };
4019      this.lazy = (lazyFn2) => {
4020        this.lazyFn = lazyFn2;
4021        return this;
4022      };
4023      this.options = options || {};
4024      this.isRoot = !options?.getParentRoute;
4025      if (options?.id && options?.path) {
4026        throw new Error(`Route cannot have both an 'id' and a 'path' option.`);
4027      }
4028    }
4029    get to() {
4030      return this._to;
4031    }
4032    get id() {
4033      return this._id;
4034    }
4035    get path() {
4036      return this._path;
4037    }
4038    get fullPath() {
4039      return this._fullPath;
4040    }
4041  };
4042  var BaseRootRoute = class extends BaseRoute {
4043    constructor(options) {
4044      super(options);
4045    }
4046  };
4047  
4048  // node_modules/@tanstack/react-router/dist/esm/CatchBoundary.js
4049  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
4050  var React = __toESM(require_react(), 1);
4051  function CatchBoundary(props) {
4052    const errorComponent = props.errorComponent ?? ErrorComponent;
4053    return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4054      CatchBoundaryImpl,
4055      {
4056        getResetKey: props.getResetKey,
4057        onCatch: props.onCatch,
4058        children: ({ error, reset }) => {
4059          if (error) {
4060            return React.createElement(errorComponent, {
4061              error,
4062              reset
4063            });
4064          }
4065          return props.children;
4066        }
4067      }
4068    );
4069  }
4070  var CatchBoundaryImpl = class extends React.Component {
4071    constructor() {
4072      super(...arguments);
4073      this.state = { error: null };
4074    }
4075    static getDerivedStateFromProps(props) {
4076      return { resetKey: props.getResetKey() };
4077    }
4078    static getDerivedStateFromError(error) {
4079      return { error };
4080    }
4081    reset() {
4082      this.setState({ error: null });
4083    }
4084    componentDidUpdate(prevProps, prevState) {
4085      if (prevState.error && prevState.resetKey !== this.state.resetKey) {
4086        this.reset();
4087      }
4088    }
4089    componentDidCatch(error, errorInfo) {
4090      if (this.props.onCatch) {
4091        this.props.onCatch(error, errorInfo);
4092      }
4093    }
4094    render() {
4095      return this.props.children({
4096        error: this.state.resetKey !== this.props.getResetKey() ? null : this.state.error,
4097        reset: () => {
4098          this.reset();
4099        }
4100      });
4101    }
4102  };
4103  function ErrorComponent({ error }) {
4104    const [show, setShow] = React.useState(true);
4105    return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: ".5rem", maxWidth: "100%" }, children: [
4106      /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: ".5rem" }, children: [
4107        /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { style: { fontSize: "1rem" }, children: "Something went wrong!" }),
4108        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4109          "button",
4110          {
4111            style: {
4112              appearance: "none",
4113              fontSize: ".6em",
4114              border: "1px solid currentColor",
4115              padding: ".1rem .2rem",
4116              fontWeight: "bold",
4117              borderRadius: ".25rem"
4118            },
4119            onClick: () => setShow((d) => !d),
4120            children: show ? "Hide Error" : "Show Error"
4121          }
4122        )
4123      ] }),
4124      /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { height: ".25rem" } }),
4125      show ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4126        "pre",
4127        {
4128          style: {
4129            fontSize: ".7em",
4130            border: "1px solid red",
4131            borderRadius: ".25rem",
4132            padding: ".3rem",
4133            color: "red",
4134            overflow: "auto"
4135          },
4136          children: error.message ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: error.message }) : null
4137        }
4138      ) }) : null
4139    ] });
4140  }
4141  
4142  // node_modules/@tanstack/react-router/dist/esm/ClientOnly.js
4143  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
4144  var import_react = __toESM(require_react(), 1);
4145  function ClientOnly({ children, fallback = null }) {
4146    return useHydrated() ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react.default.Fragment, { children }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react.default.Fragment, { children: fallback });
4147  }
4148  function useHydrated() {
4149    return import_react.default.useSyncExternalStore(
4150      subscribe,
4151      () => true,
4152      () => false
4153    );
4154  }
4155  function subscribe() {
4156    return () => {
4157    };
4158  }
4159  
4160  // node_modules/tiny-warning/dist/tiny-warning.esm.js
4161  var isProduction2 = false;
4162  function warning(condition, message) {
4163    if (!isProduction2) {
4164      if (condition) {
4165        return;
4166      }
4167      var text = "Warning: " + message;
4168      if (typeof console !== "undefined") {
4169        console.warn(text);
4170      }
4171      try {
4172        throw Error(text);
4173      } catch (x) {
4174      }
4175    }
4176  }
4177  var tiny_warning_esm_default = warning;
4178  
4179  // node_modules/@tanstack/react-router/dist/esm/route.js
4180  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
4181  var import_react3 = __toESM(require_react(), 1);
4182  
4183  // node_modules/@tanstack/react-router/dist/esm/useMatch.js
4184  var React5 = __toESM(require_react(), 1);
4185  
4186  // node_modules/@tanstack/react-store/dist/esm/index.js
4187  var import_with_selector = __toESM(require_with_selector(), 1);
4188  function useStore(store, selector = (d) => d, options = {}) {
4189    const equal = options.equal ?? shallow;
4190    const slice = (0, import_with_selector.useSyncExternalStoreWithSelector)(
4191      store.subscribe,
4192      () => store.state,
4193      () => store.state,
4194      selector,
4195      equal
4196    );
4197    return slice;
4198  }
4199  function shallow(objA, objB) {
4200    if (Object.is(objA, objB)) {
4201      return true;
4202    }
4203    if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
4204      return false;
4205    }
4206    if (objA instanceof Map && objB instanceof Map) {
4207      if (objA.size !== objB.size) return false;
4208      for (const [k, v] of objA) {
4209        if (!objB.has(k) || !Object.is(v, objB.get(k))) return false;
4210      }
4211      return true;
4212    }
4213    if (objA instanceof Set && objB instanceof Set) {
4214      if (objA.size !== objB.size) return false;
4215      for (const v of objA) {
4216        if (!objB.has(v)) return false;
4217      }
4218      return true;
4219    }
4220    if (objA instanceof Date && objB instanceof Date) {
4221      if (objA.getTime() !== objB.getTime()) return false;
4222      return true;
4223    }
4224    const keysA = getOwnKeys(objA);
4225    if (keysA.length !== getOwnKeys(objB).length) {
4226      return false;
4227    }
4228    for (let i = 0; i < keysA.length; i++) {
4229      if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {
4230        return false;
4231      }
4232    }
4233    return true;
4234  }
4235  function getOwnKeys(obj) {
4236    return Object.keys(obj).concat(
4237      Object.getOwnPropertySymbols(obj)
4238    );
4239  }
4240  
4241  // node_modules/@tanstack/react-router/dist/esm/useRouterState.js
4242  var import_react2 = __toESM(require_react(), 1);
4243  
4244  // node_modules/@tanstack/react-router/dist/esm/useRouter.js
4245  var React3 = __toESM(require_react(), 1);
4246  
4247  // node_modules/@tanstack/react-router/dist/esm/routerContext.js
4248  var React2 = __toESM(require_react(), 1);
4249  var routerContext = React2.createContext(null);
4250  function getRouterContext() {
4251    if (typeof document === "undefined") {
4252      return routerContext;
4253    }
4254    if (window.__TSR_ROUTER_CONTEXT__) {
4255      return window.__TSR_ROUTER_CONTEXT__;
4256    }
4257    window.__TSR_ROUTER_CONTEXT__ = routerContext;
4258    return routerContext;
4259  }
4260  
4261  // node_modules/@tanstack/react-router/dist/esm/useRouter.js
4262  function useRouter(opts) {
4263    const value = React3.useContext(getRouterContext());
4264    tiny_warning_esm_default(
4265      !((opts?.warn ?? true) && !value),
4266      "useRouter must be used inside a <RouterProvider> component!"
4267    );
4268    return value;
4269  }
4270  
4271  // node_modules/@tanstack/react-router/dist/esm/useRouterState.js
4272  function useRouterState(opts) {
4273    const contextRouter = useRouter({
4274      warn: opts?.router === void 0
4275    });
4276    const router = opts?.router || contextRouter;
4277    const previousResult = (0, import_react2.useRef)(void 0);
4278    return useStore(router.__store, (state) => {
4279      if (opts?.select) {
4280        if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {
4281          const newSlice = replaceEqualDeep(
4282            previousResult.current,
4283            opts.select(state)
4284          );
4285          previousResult.current = newSlice;
4286          return newSlice;
4287        }
4288        return opts.select(state);
4289      }
4290      return state;
4291    });
4292  }
4293  
4294  // node_modules/@tanstack/react-router/dist/esm/matchContext.js
4295  var React4 = __toESM(require_react(), 1);
4296  var matchContext = React4.createContext(void 0);
4297  var dummyMatchContext = React4.createContext(
4298    void 0
4299  );
4300  
4301  // node_modules/@tanstack/react-router/dist/esm/useMatch.js
4302  function useMatch(opts) {
4303    const nearestMatchId = React5.useContext(
4304      opts.from ? dummyMatchContext : matchContext
4305    );
4306    const matchSelection = useRouterState({
4307      select: (state) => {
4308        const match = state.matches.find(
4309          (d) => opts.from ? opts.from === d.routeId : d.id === nearestMatchId
4310        );
4311        invariant(
4312          !((opts.shouldThrow ?? true) && !match),
4313          `Could not find $opts.from ? `an active match from "$opts.from}"` : "a nearest match!"}`
4314        );
4315        if (match === void 0) {
4316          return void 0;
4317        }
4318        return opts.select ? opts.select(match) : match;
4319      },
4320      structuralSharing: opts.structuralSharing
4321    });
4322    return matchSelection;
4323  }
4324  
4325  // node_modules/@tanstack/react-router/dist/esm/useLoaderData.js
4326  function useLoaderData(opts) {
4327    return useMatch({
4328      from: opts.from,
4329      strict: opts.strict,
4330      structuralSharing: opts.structuralSharing,
4331      select: (s) => {
4332        return opts.select ? opts.select(s.loaderData) : s.loaderData;
4333      }
4334    });
4335  }
4336  
4337  // node_modules/@tanstack/react-router/dist/esm/useLoaderDeps.js
4338  function useLoaderDeps(opts) {
4339    const { select, ...rest } = opts;
4340    return useMatch({
4341      ...rest,
4342      select: (s) => {
4343        return select ? select(s.loaderDeps) : s.loaderDeps;
4344      }
4345    });
4346  }
4347  
4348  // node_modules/@tanstack/react-router/dist/esm/useParams.js
4349  function useParams(opts) {
4350    return useMatch({
4351      from: opts.from,
4352      shouldThrow: opts.shouldThrow,
4353      structuralSharing: opts.structuralSharing,
4354      strict: opts.strict,
4355      select: (match) => {
4356        const params = opts.strict === false ? match.params : match._strictParams;
4357        return opts.select ? opts.select(params) : params;
4358      }
4359    });
4360  }
4361  
4362  // node_modules/@tanstack/react-router/dist/esm/useSearch.js
4363  function useSearch(opts) {
4364    return useMatch({
4365      from: opts.from,
4366      strict: opts.strict,
4367      shouldThrow: opts.shouldThrow,
4368      structuralSharing: opts.structuralSharing,
4369      select: (match) => {
4370        return opts.select ? opts.select(match.search) : match.search;
4371      }
4372    });
4373  }
4374  
4375  // node_modules/@tanstack/react-router/dist/esm/useNavigate.js
4376  var React6 = __toESM(require_react(), 1);
4377  function useNavigate(_defaultOpts) {
4378    const router = useRouter();
4379    return React6.useCallback(
4380      (options) => {
4381        return router.navigate({
4382          ...options,
4383          from: options.from ?? _defaultOpts?.from
4384        });
4385      },
4386      [_defaultOpts?.from, router]
4387    );
4388  }
4389  
4390  // node_modules/@tanstack/react-router/dist/esm/link.js
4391  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
4392  var React8 = __toESM(require_react(), 1);
4393  var import_react_dom = __toESM(require_react_dom(), 1);
4394  
4395  // node_modules/@tanstack/react-router/dist/esm/utils.js
4396  var React7 = __toESM(require_react(), 1);
4397  var useLayoutEffect2 = typeof window !== "undefined" ? React7.useLayoutEffect : React7.useEffect;
4398  function usePrevious(value) {
4399    const ref = React7.useRef({
4400      value,
4401      prev: null
4402    });
4403    const current = ref.current.value;
4404    if (value !== current) {
4405      ref.current = {
4406        value,
4407        prev: current
4408      };
4409    }
4410    return ref.current.prev;
4411  }
4412  function useIntersectionObserver(ref, callback, intersectionObserverOptions2 = {}, options = {}) {
4413    React7.useEffect(() => {
4414      if (!ref.current || options.disabled || typeof IntersectionObserver !== "function") {
4415        return;
4416      }
4417      const observer = new IntersectionObserver(([entry]) => {
4418        callback(entry);
4419      }, intersectionObserverOptions2);
4420      observer.observe(ref.current);
4421      return () => {
4422        observer.disconnect();
4423      };
4424    }, [callback, intersectionObserverOptions2, options.disabled, ref]);
4425  }
4426  function useForwardedRef(ref) {
4427    const innerRef = React7.useRef(null);
4428    React7.useImperativeHandle(ref, () => innerRef.current, []);
4429    return innerRef;
4430  }
4431  
4432  // node_modules/@tanstack/react-router/dist/esm/link.js
4433  function useLinkProps(options, forwardedRef) {
4434    const router = useRouter();
4435    const [isTransitioning, setIsTransitioning] = React8.useState(false);
4436    const hasRenderFetched = React8.useRef(false);
4437    const innerRef = useForwardedRef(forwardedRef);
4438    const {
4439      // custom props
4440      activeProps,
4441      inactiveProps,
4442      activeOptions,
4443      to,
4444      preload: userPreload,
4445      preloadDelay: userPreloadDelay,
4446      hashScrollIntoView,
4447      replace,
4448      startTransition: startTransition2,
4449      resetScroll,
4450      viewTransition,
4451      // element props
4452      children,
4453      target,
4454      disabled,
4455      style,
4456      className,
4457      onClick,
4458      onFocus,
4459      onMouseEnter,
4460      onMouseLeave,
4461      onTouchStart,
4462      ignoreBlocker,
4463      // prevent these from being returned
4464      params: _params,
4465      search: _search,
4466      hash: _hash,
4467      state: _state,
4468      mask: _mask,
4469      reloadDocument: _reloadDocument,
4470      unsafeRelative: _unsafeRelative,
4471      from: _from,
4472      _fromLocation,
4473      ...propsSafeToSpread
4474    } = options;
4475    const currentSearch = useRouterState({
4476      select: (s) => s.location.search,
4477      structuralSharing: true
4478    });
4479    const from = options.from;
4480    const _options = React8.useMemo(
4481      () => {
4482        return { ...options, from };
4483      },
4484      // eslint-disable-next-line react-hooks/exhaustive-deps
4485      [
4486        router,
4487        currentSearch,
4488        from,
4489        options._fromLocation,
4490        options.hash,
4491        options.to,
4492        options.search,
4493        options.params,
4494        options.state,
4495        options.mask,
4496        options.unsafeRelative
4497      ]
4498    );
4499    const next = React8.useMemo(
4500      () => router.buildLocation({ ..._options }),
4501      [router, _options]
4502    );
4503    const hrefOption = React8.useMemo(() => {
4504      if (disabled) {
4505        return void 0;
4506      }
4507      let href = next.maskedLocation ? next.maskedLocation.url : next.url;
4508      let external = false;
4509      if (router.origin) {
4510        if (href.startsWith(router.origin)) {
4511          href = router.history.createHref(href.replace(router.origin, "")) || "/";
4512        } else {
4513          external = true;
4514        }
4515      }
4516      return { href, external };
4517    }, [disabled, next.maskedLocation, next.url, router.origin, router.history]);
4518    const externalLink = React8.useMemo(() => {
4519      if (hrefOption?.external) {
4520        return hrefOption.href;
4521      }
4522      try {
4523        new URL(to);
4524        return to;
4525      } catch {
4526      }
4527      return void 0;
4528    }, [to, hrefOption]);
4529    const preload = options.reloadDocument || externalLink ? false : userPreload ?? router.options.defaultPreload;
4530    const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;
4531    const isActive = useRouterState({
4532      select: (s) => {
4533        if (externalLink) return false;
4534        if (activeOptions?.exact) {
4535          const testExact = exactPathTest(
4536            s.location.pathname,
4537            next.pathname,
4538            router.basepath
4539          );
4540          if (!testExact) {
4541            return false;
4542          }
4543        } else {
4544          const currentPathSplit = removeTrailingSlash(
4545            s.location.pathname,
4546            router.basepath
4547          );
4548          const nextPathSplit = removeTrailingSlash(
4549            next.pathname,
4550            router.basepath
4551          );
4552          const pathIsFuzzyEqual = currentPathSplit.startsWith(nextPathSplit) && (currentPathSplit.length === nextPathSplit.length || currentPathSplit[nextPathSplit.length] === "/");
4553          if (!pathIsFuzzyEqual) {
4554            return false;
4555          }
4556        }
4557        if (activeOptions?.includeSearch ?? true) {
4558          const searchTest = deepEqual(s.location.search, next.search, {
4559            partial: !activeOptions?.exact,
4560            ignoreUndefined: !activeOptions?.explicitUndefined
4561          });
4562          if (!searchTest) {
4563            return false;
4564          }
4565        }
4566        if (activeOptions?.includeHash) {
4567          return s.location.hash === next.hash;
4568        }
4569        return true;
4570      }
4571    });
4572    const doPreload = React8.useCallback(() => {
4573      router.preloadRoute({ ..._options }).catch((err) => {
4574        console.warn(err);
4575        console.warn(preloadWarning);
4576      });
4577    }, [router, _options]);
4578    const preloadViewportIoCallback = React8.useCallback(
4579      (entry) => {
4580        if (entry?.isIntersecting) {
4581          doPreload();
4582        }
4583      },
4584      [doPreload]
4585    );
4586    useIntersectionObserver(
4587      innerRef,
4588      preloadViewportIoCallback,
4589      intersectionObserverOptions,
4590      { disabled: !!disabled || !(preload === "viewport") }
4591    );
4592    React8.useEffect(() => {
4593      if (hasRenderFetched.current) {
4594        return;
4595      }
4596      if (!disabled && preload === "render") {
4597        doPreload();
4598        hasRenderFetched.current = true;
4599      }
4600    }, [disabled, doPreload, preload]);
4601    const handleClick = (e) => {
4602      const elementTarget = e.currentTarget.getAttribute("target");
4603      const effectiveTarget = target !== void 0 ? target : elementTarget;
4604      if (!disabled && !isCtrlEvent(e) && !e.defaultPrevented && (!effectiveTarget || effectiveTarget === "_self") && e.button === 0) {
4605        e.preventDefault();
4606        (0, import_react_dom.flushSync)(() => {
4607          setIsTransitioning(true);
4608        });
4609        const unsub = router.subscribe("onResolved", () => {
4610          unsub();
4611          setIsTransitioning(false);
4612        });
4613        router.navigate({
4614          ..._options,
4615          replace,
4616          resetScroll,
4617          hashScrollIntoView,
4618          startTransition: startTransition2,
4619          viewTransition,
4620          ignoreBlocker
4621        });
4622      }
4623    };
4624    if (externalLink) {
4625      return {
4626        ...propsSafeToSpread,
4627        ref: innerRef,
4628        href: externalLink,
4629        ...children && { children },
4630        ...target && { target },
4631        ...disabled && { disabled },
4632        ...style && { style },
4633        ...className && { className },
4634        ...onClick && { onClick },
4635        ...onFocus && { onFocus },
4636        ...onMouseEnter && { onMouseEnter },
4637        ...onMouseLeave && { onMouseLeave },
4638        ...onTouchStart && { onTouchStart }
4639      };
4640    }
4641    const handleFocus = (_) => {
4642      if (disabled) return;
4643      if (preload) {
4644        doPreload();
4645      }
4646    };
4647    const handleTouchStart = handleFocus;
4648    const handleEnter = (e) => {
4649      if (disabled || !preload) return;
4650      if (!preloadDelay) {
4651        doPreload();
4652      } else {
4653        const eventTarget = e.target;
4654        if (timeoutMap.has(eventTarget)) {
4655          return;
4656        }
4657        const id = setTimeout(() => {
4658          timeoutMap.delete(eventTarget);
4659          doPreload();
4660        }, preloadDelay);
4661        timeoutMap.set(eventTarget, id);
4662      }
4663    };
4664    const handleLeave = (e) => {
4665      if (disabled || !preload || !preloadDelay) return;
4666      const eventTarget = e.target;
4667      const id = timeoutMap.get(eventTarget);
4668      if (id) {
4669        clearTimeout(id);
4670        timeoutMap.delete(eventTarget);
4671      }
4672    };
4673    const resolvedActiveProps = isActive ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
4674    const resolvedInactiveProps = isActive ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
4675    const resolvedClassName = [
4676      className,
4677      resolvedActiveProps.className,
4678      resolvedInactiveProps.className
4679    ].filter(Boolean).join(" ");
4680    const resolvedStyle = (style || resolvedActiveProps.style || resolvedInactiveProps.style) && {
4681      ...style,
4682      ...resolvedActiveProps.style,
4683      ...resolvedInactiveProps.style
4684    };
4685    return {
4686      ...propsSafeToSpread,
4687      ...resolvedActiveProps,
4688      ...resolvedInactiveProps,
4689      href: hrefOption?.href,
4690      ref: innerRef,
4691      onClick: composeHandlers([onClick, handleClick]),
4692      onFocus: composeHandlers([onFocus, handleFocus]),
4693      onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),
4694      onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),
4695      onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),
4696      disabled: !!disabled,
4697      target,
4698      ...resolvedStyle && { style: resolvedStyle },
4699      ...resolvedClassName && { className: resolvedClassName },
4700      ...disabled && STATIC_DISABLED_PROPS,
4701      ...isActive && STATIC_ACTIVE_PROPS,
4702      ...isTransitioning && STATIC_TRANSITIONING_PROPS
4703    };
4704  }
4705  var STATIC_EMPTY_OBJECT = {};
4706  var STATIC_ACTIVE_OBJECT = { className: "active" };
4707  var STATIC_DISABLED_PROPS = { role: "link", "aria-disabled": true };
4708  var STATIC_ACTIVE_PROPS = { "data-status": "active", "aria-current": "page" };
4709  var STATIC_TRANSITIONING_PROPS = { "data-transitioning": "transitioning" };
4710  var timeoutMap = /* @__PURE__ */ new WeakMap();
4711  var intersectionObserverOptions = {
4712    rootMargin: "100px"
4713  };
4714  var composeHandlers = (handlers) => (e) => {
4715    for (const handler of handlers) {
4716      if (!handler) continue;
4717      if (e.defaultPrevented) return;
4718      handler(e);
4719    }
4720  };
4721  function createLink(Comp) {
4722    return React8.forwardRef(function CreatedLink(props, ref) {
4723      return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Link, { ...props, _asChild: Comp, ref });
4724    });
4725  }
4726  var Link = React8.forwardRef(
4727    (props, ref) => {
4728      const { _asChild, ...rest } = props;
4729      const {
4730        type: _type,
4731        ref: innerRef,
4732        ...linkProps
4733      } = useLinkProps(rest, ref);
4734      const children = typeof rest.children === "function" ? rest.children({
4735        isActive: linkProps["data-status"] === "active"
4736      }) : rest.children;
4737      if (_asChild === void 0) {
4738        delete linkProps.disabled;
4739      }
4740      return React8.createElement(
4741        _asChild ? _asChild : "a",
4742        {
4743          ...linkProps,
4744          ref: innerRef
4745        },
4746        children
4747      );
4748    }
4749  );
4750  function isCtrlEvent(e) {
4751    return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
4752  }
4753  
4754  // node_modules/@tanstack/react-router/dist/esm/route.js
4755  var Route = class extends BaseRoute {
4756    /**
4757     * @deprecated Use the `createRoute` function instead.
4758     */
4759    constructor(options) {
4760      super(options);
4761      this.useMatch = (opts) => {
4762        return useMatch({
4763          select: opts?.select,
4764          from: this.id,
4765          structuralSharing: opts?.structuralSharing
4766        });
4767      };
4768      this.useRouteContext = (opts) => {
4769        return useMatch({
4770          ...opts,
4771          from: this.id,
4772          select: (d) => opts?.select ? opts.select(d.context) : d.context
4773        });
4774      };
4775      this.useSearch = (opts) => {
4776        return useSearch({
4777          select: opts?.select,
4778          structuralSharing: opts?.structuralSharing,
4779          from: this.id
4780        });
4781      };
4782      this.useParams = (opts) => {
4783        return useParams({
4784          select: opts?.select,
4785          structuralSharing: opts?.structuralSharing,
4786          from: this.id
4787        });
4788      };
4789      this.useLoaderDeps = (opts) => {
4790        return useLoaderDeps({ ...opts, from: this.id });
4791      };
4792      this.useLoaderData = (opts) => {
4793        return useLoaderData({ ...opts, from: this.id });
4794      };
4795      this.useNavigate = () => {
4796        return useNavigate({ from: this.fullPath });
4797      };
4798      this.Link = import_react3.default.forwardRef(
4799        (props, ref) => {
4800          return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Link, { ref, from: this.fullPath, ...props });
4801        }
4802      );
4803      this.$$typeof = Symbol.for("react.memo");
4804    }
4805  };
4806  function createRoute(options) {
4807    return new Route(
4808      // TODO: Help us TypeChris, you're our only hope!
4809      options
4810    );
4811  }
4812  var RootRoute = class extends BaseRootRoute {
4813    /**
4814     * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
4815     */
4816    constructor(options) {
4817      super(options);
4818      this.useMatch = (opts) => {
4819        return useMatch({
4820          select: opts?.select,
4821          from: this.id,
4822          structuralSharing: opts?.structuralSharing
4823        });
4824      };
4825      this.useRouteContext = (opts) => {
4826        return useMatch({
4827          ...opts,
4828          from: this.id,
4829          select: (d) => opts?.select ? opts.select(d.context) : d.context
4830        });
4831      };
4832      this.useSearch = (opts) => {
4833        return useSearch({
4834          select: opts?.select,
4835          structuralSharing: opts?.structuralSharing,
4836          from: this.id
4837        });
4838      };
4839      this.useParams = (opts) => {
4840        return useParams({
4841          select: opts?.select,
4842          structuralSharing: opts?.structuralSharing,
4843          from: this.id
4844        });
4845      };
4846      this.useLoaderDeps = (opts) => {
4847        return useLoaderDeps({ ...opts, from: this.id });
4848      };
4849      this.useLoaderData = (opts) => {
4850        return useLoaderData({ ...opts, from: this.id });
4851      };
4852      this.useNavigate = () => {
4853        return useNavigate({ from: this.fullPath });
4854      };
4855      this.Link = import_react3.default.forwardRef(
4856        (props, ref) => {
4857          return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Link, { ref, from: this.fullPath, ...props });
4858        }
4859      );
4860      this.$$typeof = Symbol.for("react.memo");
4861    }
4862  };
4863  function createRootRoute(options) {
4864    return new RootRoute(options);
4865  }
4866  
4867  // node_modules/@tanstack/react-router/dist/esm/fileRoute.js
4868  function createFileRoute(path) {
4869    if (typeof path === "object") {
4870      return new FileRoute(path, {
4871        silent: true
4872      }).createRoute(path);
4873    }
4874    return new FileRoute(path, {
4875      silent: true
4876    }).createRoute;
4877  }
4878  var FileRoute = class {
4879    constructor(path, _opts) {
4880      this.path = path;
4881      this.createRoute = (options) => {
4882        tiny_warning_esm_default(
4883          this.silent,
4884          "FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
4885        );
4886        const route = createRoute(options);
4887        route.isRoot = false;
4888        return route;
4889      };
4890      this.silent = _opts?.silent;
4891    }
4892  };
4893  var LazyRoute = class {
4894    constructor(opts) {
4895      this.useMatch = (opts2) => {
4896        return useMatch({
4897          select: opts2?.select,
4898          from: this.options.id,
4899          structuralSharing: opts2?.structuralSharing
4900        });
4901      };
4902      this.useRouteContext = (opts2) => {
4903        return useMatch({
4904          from: this.options.id,
4905          select: (d) => opts2?.select ? opts2.select(d.context) : d.context
4906        });
4907      };
4908      this.useSearch = (opts2) => {
4909        return useSearch({
4910          select: opts2?.select,
4911          structuralSharing: opts2?.structuralSharing,
4912          from: this.options.id
4913        });
4914      };
4915      this.useParams = (opts2) => {
4916        return useParams({
4917          select: opts2?.select,
4918          structuralSharing: opts2?.structuralSharing,
4919          from: this.options.id
4920        });
4921      };
4922      this.useLoaderDeps = (opts2) => {
4923        return useLoaderDeps({ ...opts2, from: this.options.id });
4924      };
4925      this.useLoaderData = (opts2) => {
4926        return useLoaderData({ ...opts2, from: this.options.id });
4927      };
4928      this.useNavigate = () => {
4929        const router = useRouter();
4930        return useNavigate({ from: router.routesById[this.options.id].fullPath });
4931      };
4932      this.options = opts;
4933      this.$$typeof = Symbol.for("react.memo");
4934    }
4935  };
4936  function createLazyRoute(id) {
4937    return (opts) => {
4938      return new LazyRoute({
4939        id,
4940        ...opts
4941      });
4942    };
4943  }
4944  function createLazyFileRoute(id) {
4945    if (typeof id === "object") {
4946      return new LazyRoute(id);
4947    }
4948    return (opts) => new LazyRoute({ id, ...opts });
4949  }
4950  
4951  // node_modules/@tanstack/react-router/dist/esm/Matches.js
4952  var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
4953  var React11 = __toESM(require_react(), 1);
4954  
4955  // node_modules/@tanstack/react-router/dist/esm/Transitioner.js
4956  var React9 = __toESM(require_react(), 1);
4957  function Transitioner() {
4958    const router = useRouter();
4959    const mountLoadForRouter = React9.useRef({ router, mounted: false });
4960    const [isTransitioning, setIsTransitioning] = React9.useState(false);
4961    const { hasPendingMatches, isLoading } = useRouterState({
4962      select: (s) => ({
4963        isLoading: s.isLoading,
4964        hasPendingMatches: s.matches.some((d) => d.status === "pending")
4965      }),
4966      structuralSharing: true
4967    });
4968    const previousIsLoading = usePrevious(isLoading);
4969    const isAnyPending = isLoading || isTransitioning || hasPendingMatches;
4970    const previousIsAnyPending = usePrevious(isAnyPending);
4971    const isPagePending = isLoading || hasPendingMatches;
4972    const previousIsPagePending = usePrevious(isPagePending);
4973    router.startTransition = (fn) => {
4974      setIsTransitioning(true);
4975      React9.startTransition(() => {
4976        fn();
4977        setIsTransitioning(false);
4978      });
4979    };
4980    React9.useEffect(() => {
4981      const unsub = router.history.subscribe(router.load);
4982      const nextLocation = router.buildLocation({
4983        to: router.latestLocation.pathname,
4984        search: true,
4985        params: true,
4986        hash: true,
4987        state: true,
4988        _includeValidateSearch: true
4989      });
4990      if (trimPathRight(router.latestLocation.href) !== trimPathRight(nextLocation.href)) {
4991        router.commitLocation({ ...nextLocation, replace: true });
4992      }
4993      return () => {
4994        unsub();
4995      };
4996    }, [router, router.history]);
4997    useLayoutEffect2(() => {
4998      if (
4999        // if we are hydrating from SSR, loading is triggered in ssr-client
5000        typeof window !== "undefined" && router.ssr || mountLoadForRouter.current.router === router && mountLoadForRouter.current.mounted
5001      ) {
5002        return;
5003      }
5004      mountLoadForRouter.current = { router, mounted: true };
5005      const tryLoad = async () => {
5006        try {
5007          await router.load();
5008        } catch (err) {
5009          console.error(err);
5010        }
5011      };
5012      tryLoad();
5013    }, [router]);
5014    useLayoutEffect2(() => {
5015      if (previousIsLoading && !isLoading) {
5016        router.emit({
5017          type: "onLoad",
5018          // When the new URL has committed, when the new matches have been loaded into state.matches
5019          ...getLocationChangeInfo(router.state)
5020        });
5021      }
5022    }, [previousIsLoading, router, isLoading]);
5023    useLayoutEffect2(() => {
5024      if (previousIsPagePending && !isPagePending) {
5025        router.emit({
5026          type: "onBeforeRouteMount",
5027          ...getLocationChangeInfo(router.state)
5028        });
5029      }
5030    }, [isPagePending, previousIsPagePending, router]);
5031    useLayoutEffect2(() => {
5032      if (previousIsAnyPending && !isAnyPending) {
5033        router.emit({
5034          type: "onResolved",
5035          ...getLocationChangeInfo(router.state)
5036        });
5037        router.__store.setState((s) => ({
5038          ...s,
5039          status: "idle",
5040          resolvedLocation: s.location
5041        }));
5042        handleHashScroll(router);
5043      }
5044    }, [isAnyPending, previousIsAnyPending, router]);
5045    return null;
5046  }
5047  
5048  // node_modules/@tanstack/react-router/dist/esm/Match.js
5049  var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
5050  var React10 = __toESM(require_react(), 1);
5051  
5052  // node_modules/@tanstack/react-router/dist/esm/not-found.js
5053  var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
5054  function CatchNotFound(props) {
5055    const resetKey = useRouterState({
5056      select: (s) => `not-found-$s.location.pathname}-$s.status}`
5057    });
5058    return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5059      CatchBoundary,
5060      {
5061        getResetKey: () => resetKey,
5062        onCatch: (error, errorInfo) => {
5063          if (isNotFound(error)) {
5064            props.onCatch?.(error, errorInfo);
5065          } else {
5066            throw error;
5067          }
5068        },
5069        errorComponent: ({ error }) => {
5070          if (isNotFound(error)) {
5071            return props.fallback?.(error);
5072          } else {
5073            throw error;
5074          }
5075        },
5076        children: props.children
5077      }
5078    );
5079  }
5080  function DefaultGlobalNotFound() {
5081    return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "Not Found" });
5082  }
5083  
5084  // node_modules/@tanstack/react-router/dist/esm/SafeFragment.js
5085  var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
5086  function SafeFragment(props) {
5087    return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: props.children });
5088  }
5089  
5090  // node_modules/@tanstack/react-router/dist/esm/renderRouteNotFound.js
5091  var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
5092  function renderRouteNotFound(router, route, data) {
5093    if (!route.options.notFoundComponent) {
5094      if (router.options.defaultNotFoundComponent) {
5095        return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(router.options.defaultNotFoundComponent, { data });
5096      }
5097      if (true) {
5098        tiny_warning_esm_default(
5099          route.options.notFoundComponent,
5100          `A notFoundError was encountered on the route with ID "$route.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<div>Not Found<div>)`
5101        );
5102      }
5103      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DefaultGlobalNotFound, {});
5104    }
5105    return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(route.options.notFoundComponent, { data });
5106  }
5107  
5108  // node_modules/@tanstack/react-router/dist/esm/scroll-restoration.js
5109  var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
5110  
5111  // node_modules/@tanstack/react-router/dist/esm/ScriptOnce.js
5112  var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
5113  function ScriptOnce({ children }) {
5114    const router = useRouter();
5115    if (!router.isServer) {
5116      return null;
5117    }
5118    return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5119      "script",
5120      {
5121        nonce: router.options.ssr?.nonce,
5122        className: "$tsr",
5123        dangerouslySetInnerHTML: {
5124          __html: [children].filter(Boolean).join("\n") + ";$_TSR.c()"
5125        }
5126      }
5127    );
5128  }
5129  
5130  // node_modules/@tanstack/react-router/dist/esm/scroll-restoration.js
5131  function ScrollRestoration() {
5132    const router = useRouter();
5133    if (!router.isScrollRestoring || !router.isServer) {
5134      return null;
5135    }
5136    if (typeof router.options.scrollRestoration === "function") {
5137      const shouldRestore = router.options.scrollRestoration({
5138        location: router.latestLocation
5139      });
5140      if (!shouldRestore) {
5141        return null;
5142      }
5143    }
5144    const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
5145    const userKey = getKey(router.latestLocation);
5146    const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
5147    const restoreScrollOptions = {
5148      storageKey,
5149      shouldScrollRestoration: true
5150    };
5151    if (resolvedKey) {
5152      restoreScrollOptions.key = resolvedKey;
5153    }
5154    return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5155      ScriptOnce,
5156      {
5157        children: `($restoreScroll.toString()})($JSON.stringify(restoreScrollOptions)})`
5158      }
5159    );
5160  }
5161  
5162  // node_modules/@tanstack/react-router/dist/esm/Match.js
5163  var Match = React10.memo(function MatchImpl({
5164    matchId
5165  }) {
5166    const router = useRouter();
5167    const matchState = useRouterState({
5168      select: (s) => {
5169        const match = s.matches.find((d) => d.id === matchId);
5170        invariant(
5171          match,
5172          `Could not find match for matchId "$matchId}". Please file an issue!`
5173        );
5174        return {
5175          routeId: match.routeId,
5176          ssr: match.ssr,
5177          _displayPending: match._displayPending
5178        };
5179      },
5180      structuralSharing: true
5181    });
5182    const route = router.routesById[matchState.routeId];
5183    const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
5184    const pendingElement = PendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PendingComponent, {}) : null;
5185    const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
5186    const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
5187    const routeNotFoundComponent = route.isRoot ? (
5188      // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component
5189      route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component
5190    ) : route.options.notFoundComponent;
5191    const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
5192    const ResolvedSuspenseBoundary = (
5193      // If we're on the root route, allow forcefully wrapping in suspense
5194      (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? React10.Suspense : SafeFragment
5195    );
5196    const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
5197    const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
5198    const resetKey = useRouterState({
5199      select: (s) => s.loadedAt
5200    });
5201    const parentRouteId = useRouterState({
5202      select: (s) => {
5203        const index = s.matches.findIndex((d) => d.id === matchId);
5204        return s.matches[index - 1]?.routeId;
5205      }
5206    });
5207    const ShellComponent = route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment;
5208    return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(ShellComponent, { children: [
5209      /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(matchContext.Provider, { value: matchId, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ResolvedSuspenseBoundary, { fallback: pendingElement, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5210        ResolvedCatchBoundary,
5211        {
5212          getResetKey: () => resetKey,
5213          errorComponent: routeErrorComponent || ErrorComponent,
5214          onCatch: (error, errorInfo) => {
5215            if (isNotFound(error)) throw error;
5216            tiny_warning_esm_default(false, `Error in route match: $matchId}`);
5217            routeOnCatch?.(error, errorInfo);
5218          },
5219          children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5220            ResolvedNotFoundBoundary,
5221            {
5222              fallback: (error) => {
5223                if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot)
5224                  throw error;
5225                return React10.createElement(routeNotFoundComponent, error);
5226              },
5227              children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ClientOnly, { fallback: pendingElement, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MatchInner, { matchId }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MatchInner, { matchId })
5228            }
5229          )
5230        }
5231      ) }) }),
5232      parentRouteId === rootRouteId && router.options.scrollRestoration ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
5233        /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(OnRendered, {}),
5234        /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollRestoration, {})
5235      ] }) : null
5236    ] });
5237  });
5238  function OnRendered() {
5239    const router = useRouter();
5240    const prevLocationRef = React10.useRef(
5241      void 0
5242    );
5243    return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5244      "script",
5245      {
5246        suppressHydrationWarning: true,
5247        ref: (el) => {
5248          if (el && (prevLocationRef.current === void 0 || prevLocationRef.current.href !== router.latestLocation.href)) {
5249            router.emit({
5250              type: "onRendered",
5251              ...getLocationChangeInfo(router.state)
5252            });
5253            prevLocationRef.current = router.latestLocation;
5254          }
5255        }
5256      },
5257      router.latestLocation.state.__TSR_key
5258    );
5259  }
5260  var MatchInner = React10.memo(function MatchInnerImpl({
5261    matchId
5262  }) {
5263    const router = useRouter();
5264    const { match, key, routeId } = useRouterState({
5265      select: (s) => {
5266        const match2 = s.matches.find((d) => d.id === matchId);
5267        const routeId2 = match2.routeId;
5268        const remountFn = router.routesById[routeId2].options.remountDeps ?? router.options.defaultRemountDeps;
5269        const remountDeps = remountFn?.({
5270          routeId: routeId2,
5271          loaderDeps: match2.loaderDeps,
5272          params: match2._strictParams,
5273          search: match2._strictSearch
5274        });
5275        const key2 = remountDeps ? JSON.stringify(remountDeps) : void 0;
5276        return {
5277          key: key2,
5278          routeId: routeId2,
5279          match: {
5280            id: match2.id,
5281            status: match2.status,
5282            error: match2.error,
5283            _forcePending: match2._forcePending,
5284            _displayPending: match2._displayPending
5285          }
5286        };
5287      },
5288      structuralSharing: true
5289    });
5290    const route = router.routesById[routeId];
5291    const out = React10.useMemo(() => {
5292      const Comp = route.options.component ?? router.options.defaultComponent;
5293      if (Comp) {
5294        return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Comp, {}, key);
5295      }
5296      return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Outlet, {});
5297    }, [key, route.options.component, router.options.defaultComponent]);
5298    if (match._displayPending) {
5299      throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
5300    }
5301    if (match._forcePending) {
5302      throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
5303    }
5304    if (match.status === "pending") {
5305      const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
5306      if (pendingMinMs) {
5307        const routerMatch = router.getMatch(match.id);
5308        if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
5309          if (!router.isServer) {
5310            const minPendingPromise = createControlledPromise();
5311            routerMatch._nonReactive.minPendingPromise = minPendingPromise;
5312            setTimeout(() => {
5313              minPendingPromise.resolve();
5314              routerMatch._nonReactive.minPendingPromise = void 0;
5315            }, pendingMinMs);
5316          }
5317        }
5318      }
5319      throw router.getMatch(match.id)?._nonReactive.loadPromise;
5320    }
5321    if (match.status === "notFound") {
5322      invariant(isNotFound(match.error), "Expected a notFound error");
5323      return renderRouteNotFound(router, route, match.error);
5324    }
5325    if (match.status === "redirected") {
5326      invariant(isRedirect(match.error), "Expected a redirect error");
5327      throw router.getMatch(match.id)?._nonReactive.loadPromise;
5328    }
5329    if (match.status === "error") {
5330      if (router.isServer) {
5331        const RouteErrorComponent = (route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent;
5332        return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5333          RouteErrorComponent,
5334          {
5335            error: match.error,
5336            reset: void 0,
5337            info: {
5338              componentStack: ""
5339            }
5340          }
5341        );
5342      }
5343      throw match.error;
5344    }
5345    return out;
5346  });
5347  var Outlet = React10.memo(function OutletImpl() {
5348    const router = useRouter();
5349    const matchId = React10.useContext(matchContext);
5350    const routeId = useRouterState({
5351      select: (s) => s.matches.find((d) => d.id === matchId)?.routeId
5352    });
5353    const route = router.routesById[routeId];
5354    const parentGlobalNotFound = useRouterState({
5355      select: (s) => {
5356        const matches = s.matches;
5357        const parentMatch = matches.find((d) => d.id === matchId);
5358        invariant(
5359          parentMatch,
5360          `Could not find parent match for matchId "$matchId}"`
5361        );
5362        return parentMatch.globalNotFound;
5363      }
5364    });
5365    const childMatchId = useRouterState({
5366      select: (s) => {
5367        const matches = s.matches;
5368        const index = matches.findIndex((d) => d.id === matchId);
5369        return matches[index + 1]?.id;
5370      }
5371    });
5372    const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(router.options.defaultPendingComponent, {}) : null;
5373    if (parentGlobalNotFound) {
5374      return renderRouteNotFound(router, route, void 0);
5375    }
5376    if (!childMatchId) {
5377      return null;
5378    }
5379    const nextMatch = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Match, { matchId: childMatchId });
5380    if (matchId === rootRouteId) {
5381      return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(React10.Suspense, { fallback: pendingElement, children: nextMatch });
5382    }
5383    return nextMatch;
5384  });
5385  
5386  // node_modules/@tanstack/react-router/dist/esm/Matches.js
5387  function Matches() {
5388    const router = useRouter();
5389    const rootRoute = router.routesById[rootRouteId];
5390    const PendingComponent = rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent;
5391    const pendingElement = PendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PendingComponent, {}) : null;
5392    const ResolvedSuspense = router.isServer || typeof document !== "undefined" && router.ssr ? SafeFragment : React11.Suspense;
5393    const inner = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(ResolvedSuspense, { fallback: pendingElement, children: [
5394      !router.isServer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Transitioner, {}),
5395      /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MatchesInner, {})
5396    ] });
5397    return router.options.InnerWrap ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(router.options.InnerWrap, { children: inner }) : inner;
5398  }
5399  function MatchesInner() {
5400    const router = useRouter();
5401    const matchId = useRouterState({
5402      select: (s) => {
5403        return s.matches[0]?.id;
5404      }
5405    });
5406    const resetKey = useRouterState({
5407      select: (s) => s.loadedAt
5408    });
5409    const matchComponent = matchId ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Match, { matchId }) : null;
5410    return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(matchContext.Provider, { value: matchId, children: router.options.disableGlobalCatchBoundary ? matchComponent : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5411      CatchBoundary,
5412      {
5413        getResetKey: () => resetKey,
5414        errorComponent: ErrorComponent,
5415        onCatch: (error) => {
5416          tiny_warning_esm_default(
5417            false,
5418            `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`
5419          );
5420          tiny_warning_esm_default(false, error.message || error.toString());
5421        },
5422        children: matchComponent
5423      }
5424    ) });
5425  }
5426  function useMatches(opts) {
5427    return useRouterState({
5428      select: (state) => {
5429        const matches = state.matches;
5430        return opts?.select ? opts.select(matches) : matches;
5431      },
5432      structuralSharing: opts?.structuralSharing
5433    });
5434  }
5435  
5436  // node_modules/@tanstack/react-router/dist/esm/router.js
5437  var createRouter = (options) => {
5438    return new Router(options);
5439  };
5440  var Router = class extends RouterCore {
5441    constructor(options) {
5442      super(options);
5443    }
5444  };
5445  if (typeof globalThis !== "undefined") {
5446    globalThis.createFileRoute = createFileRoute;
5447    globalThis.createLazyFileRoute = createLazyFileRoute;
5448  } else if (typeof window !== "undefined") {
5449    window.createFileRoute = createFileRoute;
5450    window.createLazyFileRoute = createLazyFileRoute;
5451  }
5452  
5453  // node_modules/@tanstack/react-router/dist/esm/RouterProvider.js
5454  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
5455  function RouterContextProvider({
5456    router,
5457    children,
5458    ...rest
5459  }) {
5460    if (Object.keys(rest).length > 0) {
5461      router.update({
5462        ...router.options,
5463        ...rest,
5464        context: {
5465          ...router.options.context,
5466          ...rest.context
5467        }
5468      });
5469    }
5470    const routerContext2 = getRouterContext();
5471    const provider = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(routerContext2.Provider, { value: router, children });
5472    if (router.options.Wrap) {
5473      return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(router.options.Wrap, { children: provider });
5474    }
5475    return provider;
5476  }
5477  function RouterProvider({ router, ...rest }) {
5478    return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RouterContextProvider, { router, ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Matches, {}) });
5479  }
5480  
5481  // node_modules/@tanstack/react-router/dist/esm/useLocation.js
5482  function useLocation(opts) {
5483    return useRouterState({
5484      select: (state) => opts?.select ? opts.select(state.location) : state.location
5485    });
5486  }
5487  
5488  // node_modules/@tanstack/react-router/dist/esm/useCanGoBack.js
5489  function useCanGoBack() {
5490    return useRouterState({ select: (s) => s.location.state.__TSR_index !== 0 });
5491  }
5492  
5493  // packages/route/build-module/lock-unlock.js
5494  var import_private_apis = __toESM(require_private_apis());
5495  var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
5496    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
5497    "@wordpress/route"
5498  );
5499  
5500  // packages/route/build-module/private-apis.js
5501  var privateApis = {};
5502  lock(privateApis, {
5503    // Router creation and setup
5504    createBrowserHistory,
5505    createLazyRoute,
5506    createRouter,
5507    createRootRoute,
5508    createRoute,
5509    Outlet,
5510    RouterProvider,
5511    // Internal routing utilities
5512    redirect,
5513    createLink,
5514    useCanGoBack,
5515    useLoaderData,
5516    useLocation,
5517    useMatches,
5518    useRouter,
5519    // History utilities
5520    parseHref
5521  });
5522  
5523  // packages/route/build-module/index.js
5524  function useInvalidate() {
5525    const router = useRouter();
5526    return () => router.invalidate();
5527  }
5528  export {
5529    Link,
5530    privateApis,
5531    redirect,
5532    useInvalidate,
5533    useNavigate,
5534    useParams,
5535    useSearch
5536  };
5537  /*! Bundled license information:
5538  
5539  use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
5540    (**
5541     * @license React
5542     * use-sync-external-store-shim.development.js
5543     *
5544     * Copyright (c) Meta Platforms, Inc. and affiliates.
5545     *
5546     * This source code is licensed under the MIT license found in the
5547     * LICENSE file in the root directory of this source tree.
5548     *)
5549  
5550  use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
5551    (**
5552     * @license React
5553     * use-sync-external-store-shim/with-selector.development.js
5554     *
5555     * Copyright (c) Meta Platforms, Inc. and affiliates.
5556     *
5557     * This source code is licensed under the MIT license found in the
5558     * LICENSE file in the root directory of this source tree.
5559     *)
5560  */


Generated : Wed Apr 15 08:20:10 2026 Cross-referenced by PHPXref