1import { 2 __esm, 3 __export, 4 __toESM, 5 init_react, 6 require_react 7} from "/build/_shared/chunk-BNRLY3XL.js"; 8
vendor: 479 bytes, lines 9-25
9// node_modules/@babel/runtime/helpers/esm/extends.js 10function _extends() { 11 return _extends = Object.assign ? Object.assign.bind() : function(n) { 12 for (var e = 1; e < arguments.length; e++) { 13 var t = arguments[e]; 14 for (var r in t) 15 ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); 16 } 17 return n; 18 }, _extends.apply(null, arguments); 19} 20var init_extends = __esm({ 21 "node_modules/@babel/runtime/helpers/esm/extends.js"() { 22 init_react(); 23 } 24}); 25
vendor: 7,344 bytes, lines 26-274
26// node_modules/history/index.js 27function warning(cond, message) { 28 if (!cond) { 29 if (typeof console !== "undefined") 30 console.warn(message); 31 try { 32 throw new Error(message); 33 } catch (e) { 34 } 35 } 36} 37function createBrowserHistory(options) { 38 if (options === void 0) { 39 options = {}; 40 } 41 var _options = options, _options$window = _options.window, window2 = _options$window === void 0 ? document.defaultView : _options$window; 42 var globalHistory = window2.history; 43 function getIndexAndLocation() { 44 var _window$location = window2.location, pathname = _window$location.pathname, search = _window$location.search, hash = _window$location.hash; 45 var state = globalHistory.state || {}; 46 return [state.idx, readOnly({ 47 pathname, 48 search, 49 hash, 50 state: state.usr || null, 51 key: state.key || "default" 52 })]; 53 } 54 var blockedPopTx = null; 55 function handlePop() { 56 if (blockedPopTx) { 57 blockers.call(blockedPopTx); 58 blockedPopTx = null; 59 } else { 60 var nextAction = Action.Pop; 61 var _getIndexAndLocation = getIndexAndLocation(), nextIndex = _getIndexAndLocation[0], nextLocation = _getIndexAndLocation[1]; 62 if (blockers.length) { 63 if (nextIndex != null) { 64 var delta = index - nextIndex; 65 if (delta) { 66 blockedPopTx = { 67 action: nextAction, 68 location: nextLocation, 69 retry: function retry() { 70 go(delta * -1); 71 } 72 }; 73 go(delta); 74 } 75 } else { 76 true ? warning(false, "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.") : void 0; 77 } 78 } else { 79 applyTx(nextAction); 80 } 81 } 82 } 83 window2.addEventListener(PopStateEventType, handlePop); 84 var action = Action.Pop; 85 var _getIndexAndLocation2 = getIndexAndLocation(), index = _getIndexAndLocation2[0], location = _getIndexAndLocation2[1]; 86 var listeners = createEvents(); 87 var blockers = createEvents(); 88 if (index == null) { 89 index = 0; 90 globalHistory.replaceState(_extends({}, globalHistory.state, { 91 idx: index 92 }), ""); 93 } 94 function createHref2(to) { 95 return typeof to === "string" ? to : createPath(to); 96 } 97 function getNextLocation(to, state) { 98 if (state === void 0) { 99 state = null; 100 } 101 return readOnly(_extends({ 102 pathname: location.pathname, 103 hash: "", 104 search: "" 105 }, typeof to === "string" ? parsePath(to) : to, { 106 state, 107 key: createKey() 108 })); 109 } 110 function getHistoryStateAndUrl(nextLocation, index2) { 111 return [{ 112 usr: nextLocation.state, 113 key: nextLocation.key, 114 idx: index2 115 }, createHref2(nextLocation)]; 116 } 117 function allowTx(action2, location2, retry) { 118 return !blockers.length || (blockers.call({ 119 action: action2, 120 location: location2, 121 retry 122 }), false); 123 } 124 function applyTx(nextAction) { 125 action = nextAction; 126 var _getIndexAndLocation3 = getIndexAndLocation(); 127 index = _getIndexAndLocation3[0]; 128 location = _getIndexAndLocation3[1]; 129 listeners.call({ 130 action, 131 location 132 }); 133 } 134 function push(to, state) { 135 var nextAction = Action.Push; 136 var nextLocation = getNextLocation(to, state); 137 function retry() { 138 push(to, state); 139 } 140 if (allowTx(nextAction, nextLocation, retry)) { 141 var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1), historyState = _getHistoryStateAndUr[0], url = _getHistoryStateAndUr[1]; 142 try { 143 globalHistory.pushState(historyState, "", url); 144 } catch (error) { 145 window2.location.assign(url); 146 } 147 applyTx(nextAction); 148 } 149 } 150 function replace(to, state) { 151 var nextAction = Action.Replace; 152 var nextLocation = getNextLocation(to, state); 153 function retry() { 154 replace(to, state); 155 } 156 if (allowTx(nextAction, nextLocation, retry)) { 157 var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index), historyState = _getHistoryStateAndUr2[0], url = _getHistoryStateAndUr2[1]; 158 globalHistory.replaceState(historyState, "", url); 159 applyTx(nextAction); 160 } 161 } 162 function go(delta) { 163 globalHistory.go(delta); 164 } 165 var history = { 166 get action() { 167 return action; 168 }, 169 get location() { 170 return location; 171 }, 172 createHref: createHref2, 173 push, 174 replace, 175 go, 176 back: function back() { 177 go(-1); 178 }, 179 forward: function forward() { 180 go(1); 181 }, 182 listen: function listen(listener) { 183 return listeners.push(listener); 184 }, 185 block: function block(blocker) { 186 var unblock = blockers.push(blocker); 187 if (blockers.length === 1) { 188 window2.addEventListener(BeforeUnloadEventType, promptBeforeUnload); 189 } 190 return function() { 191 unblock(); 192 if (!blockers.length) { 193 window2.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); 194 } 195 }; 196 } 197 }; 198 return history; 199} 200function promptBeforeUnload(event) { 201 event.preventDefault(); 202 event.returnValue = ""; 203} 204function createEvents() { 205 var handlers = []; 206 return { 207 get length() { 208 return handlers.length; 209 }, 210 push: function push(fn) { 211 handlers.push(fn); 212 return function() { 213 handlers = handlers.filter(function(handler) { 214 return handler !== fn; 215 }); 216 }; 217 }, 218 call: function call(arg) { 219 handlers.forEach(function(fn) { 220 return fn && fn(arg); 221 }); 222 } 223 }; 224} 225function createKey() { 226 return Math.random().toString(36).substr(2, 8); 227} 228function createPath(_ref) { 229 var _ref$pathname = _ref.pathname, pathname = _ref$pathname === void 0 ? "/" : _ref$pathname, _ref$search = _ref.search, search = _ref$search === void 0 ? "" : _ref$search, _ref$hash = _ref.hash, hash = _ref$hash === void 0 ? "" : _ref$hash; 230 if (search && search !== "?") 231 pathname += search.charAt(0) === "?" ? search : "?" + search; 232 if (hash && hash !== "#") 233 pathname += hash.charAt(0) === "#" ? hash : "#" + hash; 234 return pathname; 235} 236function parsePath(path) { 237 var parsedPath = {}; 238 if (path) { 239 var hashIndex = path.indexOf("#"); 240 if (hashIndex >= 0) { 241 parsedPath.hash = path.substr(hashIndex); 242 path = path.substr(0, hashIndex); 243 } 244 var searchIndex = path.indexOf("?"); 245 if (searchIndex >= 0) { 246 parsedPath.search = path.substr(searchIndex); 247 path = path.substr(0, searchIndex); 248 } 249 if (path) { 250 parsedPath.pathname = path; 251 } 252 } 253 return parsedPath; 254} 255var Action, readOnly, BeforeUnloadEventType, PopStateEventType; 256var init_history = __esm({ 257 "node_modules/history/index.js"() { 258 init_react(); 259 init_extends(); 260 (function(Action3) { 261 Action3["Pop"] = "POP"; 262 Action3["Push"] = "PUSH"; 263 Action3["Replace"] = "REPLACE"; 264 })(Action || (Action = {})); 265 readOnly = true ? function(obj) { 266 return Object.freeze(obj); 267 } : function(obj) { 268 return obj; 269 }; 270 BeforeUnloadEventType = "beforeunload"; 271 PopStateEventType = "popstate"; 272 } 273}); 274
vendor: 640 bytes, lines 275-295
275// node_modules/@remix-run/react/dist/esm/_virtual/_rollupPluginBabelHelpers.js 276function _extends2() { 277 _extends2 = Object.assign ? Object.assign.bind() : function(target) { 278 for (var i = 1; i < arguments.length; i++) { 279 var source = arguments[i]; 280 for (var key in source) { 281 if (Object.prototype.hasOwnProperty.call(source, key)) { 282 target[key] = source[key]; 283 } 284 } 285 } 286 return target; 287 }; 288 return _extends2.apply(this, arguments); 289} 290var init_rollupPluginBabelHelpers = __esm({ 291 "node_modules/@remix-run/react/dist/esm/_virtual/_rollupPluginBabelHelpers.js"() { 292 init_react(); 293 } 294}); 295
vendor: 14,912 bytes, lines 296-700
296// node_modules/@remix-run/router/dist/router.js 297function _extends3() { 298 _extends3 = Object.assign ? Object.assign.bind() : function(target) { 299 for (var i = 1; i < arguments.length; i++) { 300 var source = arguments[i]; 301 for (var key in source) { 302 if (Object.prototype.hasOwnProperty.call(source, key)) { 303 target[key] = source[key]; 304 } 305 } 306 } 307 return target; 308 }; 309 return _extends3.apply(this, arguments); 310} 311function invariant(value, message) { 312 if (value === false || value === null || typeof value === "undefined") { 313 throw new Error(message); 314 } 315} 316function createPath2(_ref) { 317 let { 318 pathname = "/", 319 search = "", 320 hash = "" 321 } = _ref; 322 if (search && search !== "?") 323 pathname += search.charAt(0) === "?" ? search : "?" + search; 324 if (hash && hash !== "#") 325 pathname += hash.charAt(0) === "#" ? hash : "#" + hash; 326 return pathname; 327} 328function parsePath2(path) { 329 let parsedPath = {}; 330 if (path) { 331 let hashIndex = path.indexOf("#"); 332 if (hashIndex >= 0) { 333 parsedPath.hash = path.substr(hashIndex); 334 path = path.substr(0, hashIndex); 335 } 336 let searchIndex = path.indexOf("?"); 337 if (searchIndex >= 0) { 338 parsedPath.search = path.substr(searchIndex); 339 path = path.substr(0, searchIndex); 340 } 341 if (path) { 342 parsedPath.pathname = path; 343 } 344 } 345 return parsedPath; 346} 347function matchRoutes(routes, locationArg, basename) { 348 if (basename === void 0) { 349 basename = "/"; 350 } 351 let location = typeof locationArg === "string" ? parsePath2(locationArg) : locationArg; 352 let pathname = stripBasename(location.pathname || "/", basename); 353 if (pathname == null) { 354 return null; 355 } 356 let branches = flattenRoutes(routes); 357 rankRouteBranches(branches); 358 let matches = null; 359 for (let i = 0; matches == null && i < branches.length; ++i) { 360 matches = matchRouteBranch(branches[i], safelyDecodeURI(pathname)); 361 } 362 return matches; 363} 364function flattenRoutes(routes, branches, parentsMeta, parentPath) { 365 if (branches === void 0) { 366 branches = []; 367 } 368 if (parentsMeta === void 0) { 369 parentsMeta = []; 370 } 371 if (parentPath === void 0) { 372 parentPath = ""; 373 } 374 let flattenRoute = (route, index, relativePath) => { 375 let meta = { 376 relativePath: relativePath === void 0 ? route.path || "" : relativePath, 377 caseSensitive: route.caseSensitive === true, 378 childrenIndex: index, 379 route 380 }; 381 if (meta.relativePath.startsWith("/")) { 382 invariant(meta.relativePath.startsWith(parentPath), 'Absolute route path "' + meta.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes."); 383 meta.relativePath = meta.relativePath.slice(parentPath.length); 384 } 385 let path = joinPaths([parentPath, meta.relativePath]); 386 let routesMeta = parentsMeta.concat(meta); 387 if (route.children && route.children.length > 0) { 388 invariant(route.index !== true, "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path + '".')); 389 flattenRoutes(route.children, branches, routesMeta, path); 390 } 391 if (route.path == null && !route.index) { 392 return; 393 } 394 branches.push({ 395 path, 396 score: computeScore(path, route.index), 397 routesMeta 398 }); 399 }; 400 routes.forEach((route, index) => { 401 var _route$path; 402 if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) { 403 flattenRoute(route, index); 404 } else { 405 for (let exploded of explodeOptionalSegments(route.path)) { 406 flattenRoute(route, index, exploded); 407 } 408 } 409 }); 410 return branches; 411} 412function explodeOptionalSegments(path) { 413 let segments = path.split("/"); 414 if (segments.length === 0) 415 return []; 416 let [first, ...rest] = segments; 417 let isOptional = first.endsWith("?"); 418 let required = first.replace(/\?$/, ""); 419 if (rest.length === 0) { 420 return isOptional ? [required, ""] : [required]; 421 } 422 let restExploded = explodeOptionalSegments(rest.join("/")); 423 let result = []; 424 result.push(...restExploded.map((subpath) => subpath === "" ? required : [required, subpath].join("/"))); 425 if (isOptional) { 426 result.push(...restExploded); 427 } 428 return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded); 429} 430function rankRouteBranches(branches) { 431 branches.sort((a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex))); 432} 433function computeScore(path, index) { 434 let segments = path.split("/"); 435 let initialScore = segments.length; 436 if (segments.some(isSplat)) { 437 initialScore += splatPenalty; 438 } 439 if (index) { 440 initialScore += indexRouteValue; 441 } 442 return segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore); 443} 444function compareIndexes(a, b) { 445 let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]); 446 return siblings ? a[a.length - 1] - b[b.length - 1] : 0; 447} 448function matchRouteBranch(branch, pathname) { 449 let { 450 routesMeta 451 } = branch; 452 let matchedParams = {}; 453 let matchedPathname = "/"; 454 let matches = []; 455 for (let i = 0; i < routesMeta.length; ++i) { 456 let meta = routesMeta[i]; 457 let end = i === routesMeta.length - 1; 458 let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/"; 459 let match = matchPath({ 460 path: meta.relativePath, 461 caseSensitive: meta.caseSensitive, 462 end 463 }, remainingPathname); 464 if (!match) 465 return null; 466 Object.assign(matchedParams, match.params); 467 let route = meta.route; 468 matches.push({ 469 params: matchedParams, 470 pathname: joinPaths([matchedPathname, match.pathname]), 471 pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])), 472 route 473 }); 474 if (match.pathnameBase !== "/") { 475 matchedPathname = joinPaths([matchedPathname, match.pathnameBase]); 476 } 477 } 478 return matches; 479} 480function matchPath(pattern, pathname) { 481 if (typeof pattern === "string") { 482 pattern = { 483 path: pattern, 484 caseSensitive: false, 485 end: true 486 }; 487 } 488 let [matcher, paramNames] = compilePath(pattern.path, pattern.caseSensitive, pattern.end); 489 let match = pathname.match(matcher); 490 if (!match) 491 return null; 492 let matchedPathname = match[0]; 493 let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1"); 494 let captureGroups = match.slice(1); 495 let params = paramNames.reduce((memo, paramName, index) => { 496 if (paramName === "*") { 497 let splatValue = captureGroups[index] || ""; 498 pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1"); 499 } 500 memo[paramName] = safelyDecodeURIComponent(captureGroups[index] || "", paramName); 501 return memo; 502 }, {}); 503 return { 504 params, 505 pathname: matchedPathname, 506 pathnameBase, 507 pattern 508 }; 509} 510function compilePath(path, caseSensitive, end) { 511 if (caseSensitive === void 0) { 512 caseSensitive = false; 513 } 514 if (end === void 0) { 515 end = true; 516 } 517 warning2(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".')); 518 let paramNames = []; 519 let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^$?{}|()[\]]/g, "\\$&").replace(/\/:(\w+)/g, (_, paramName) => { 520 paramNames.push(paramName); 521 return "/([^\\/]+)"; 522 }); 523 if (path.endsWith("*")) { 524 paramNames.push("*"); 525 regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$"; 526 } else if (end) { 527 regexpSource += "\\/*$"; 528 } else if (path !== "" && path !== "/") { 529 regexpSource += "(?:(?=\\/|$))"; 530 } else 531 ; 532 let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i"); 533 return [matcher, paramNames]; 534} 535function safelyDecodeURI(value) { 536 try { 537 return decodeURI(value); 538 } catch (error) { 539 warning2(false, 'The URL path "' + value + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error + ").")); 540 return value; 541 } 542} 543function safelyDecodeURIComponent(value, paramName) { 544 try { 545 return decodeURIComponent(value); 546 } catch (error) { 547 warning2(false, 'The value for the URL param "' + paramName + '" will not be decoded because' + (' the string "' + value + '" is a malformed URL segment. This is probably') + (" due to a bad percent encoding (" + error + ").")); 548 return value; 549 } 550} 551function stripBasename(pathname, basename) { 552 if (basename === "/") 553 return pathname; 554 if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) { 555 return null; 556 } 557 let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length; 558 let nextChar = pathname.charAt(startIndex); 559 if (nextChar && nextChar !== "/") { 560 return null; 561 } 562 return pathname.slice(startIndex) || "/"; 563} 564function warning2(cond, message) { 565 if (!cond) { 566 if (typeof console !== "undefined") 567 console.warn(message); 568 try { 569 throw new Error(message); 570 } catch (e) { 571 } 572 } 573} 574function resolvePath(to, fromPathname) { 575 if (fromPathname === void 0) { 576 fromPathname = "/"; 577 } 578 let { 579 pathname: toPathname, 580 search = "", 581 hash = "" 582 } = typeof to === "string" ? parsePath2(to) : to; 583 let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname; 584 return { 585 pathname, 586 search: normalizeSearch(search), 587 hash: normalizeHash(hash) 588 }; 589} 590function resolvePathname(relativePath, fromPathname) { 591 let segments = fromPathname.replace(/\/+$/, "").split("/"); 592 let relativeSegments = relativePath.split("/"); 593 relativeSegments.forEach((segment) => { 594 if (segment === "..") { 595 if (segments.length > 1) 596 segments.pop(); 597 } else if (segment !== ".") { 598 segments.push(segment); 599 } 600 }); 601 return segments.length > 1 ? segments.join("/") : "/"; 602} 603function getInvalidPathError(char, field, dest, path) { 604 return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.'; 605} 606function getPathContributingMatches(matches) { 607 return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0); 608} 609function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) { 610 if (isPathRelative === void 0) { 611 isPathRelative = false; 612 } 613 let to; 614 if (typeof toArg === "string") { 615 to = parsePath2(toArg); 616 } else { 617 to = _extends3({}, toArg); 618 invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to)); 619 invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to)); 620 invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to)); 621 } 622 let isEmptyPath = toArg === "" || to.pathname === ""; 623 let toPathname = isEmptyPath ? "/" : to.pathname; 624 let from; 625 if (isPathRelative || toPathname == null) { 626 from = locationPathname; 627 } else { 628 let routePathnameIndex = routePathnames.length - 1; 629 if (toPathname.startsWith("..")) { 630 let toSegments = toPathname.split("/"); 631 while (toSegments[0] === "..") { 632 toSegments.shift(); 633 routePathnameIndex -= 1; 634 } 635 to.pathname = toSegments.join("/"); 636 } 637 from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/"; 638 } 639 let path = resolvePath(to, from); 640 let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/"); 641 let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/"); 642 if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) { 643 path.pathname += "/"; 644 } 645 return path; 646} 647function isRouteErrorResponse(e) { 648 return e instanceof ErrorResponse; 649} 650var Action2, ResultType, paramRe, dynamicSegmentValue, indexRouteValue, emptySegmentValue, staticSegmentValue, splatPenalty, isSplat, joinPaths, normalizePathname, normalizeSearch, normalizeHash, ErrorResponse, validMutationMethodsArr, validMutationMethods, validRequestMethodsArr, validRequestMethods, isBrowser, UNSAFE_DEFERRED_SYMBOL; 651var init_router = __esm({ 652 "node_modules/@remix-run/router/dist/router.js"() { 653 init_react(); 654 (function(Action3) { 655 Action3["Pop"] = "POP"; 656 Action3["Push"] = "PUSH"; 657 Action3["Replace"] = "REPLACE"; 658 })(Action2 || (Action2 = {})); 659 (function(ResultType2) { 660 ResultType2["data"] = "data"; 661 ResultType2["deferred"] = "deferred"; 662 ResultType2["redirect"] = "redirect"; 663 ResultType2["error"] = "error"; 664 })(ResultType || (ResultType = {})); 665 paramRe = /^:\w+$/; 666 dynamicSegmentValue = 3; 667 indexRouteValue = 2; 668 emptySegmentValue = 1; 669 staticSegmentValue = 10; 670 splatPenalty = -2; 671 isSplat = (s) => s === "*"; 672 joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/"); 673 normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/"); 674 normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search; 675 normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash; 676 ErrorResponse = class { 677 constructor(status, statusText, data, internal) { 678 if (internal === void 0) { 679 internal = false; 680 } 681 this.status = status; 682 this.statusText = statusText || ""; 683 this.internal = internal; 684 if (data instanceof Error) { 685 this.data = data.toString(); 686 this.error = data; 687 } else { 688 this.data = data; 689 } 690 } 691 }; 692 validMutationMethodsArr = ["post", "put", "patch", "delete"]; 693 validMutationMethods = new Set(validMutationMethodsArr); 694 validRequestMethodsArr = ["get", ...validMutationMethodsArr]; 695 validRequestMethods = new Set(validRequestMethodsArr); 696 isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; 697 UNSAFE_DEFERRED_SYMBOL = Symbol("deferred"); 698 } 699}); 700
vendor: 21,535 bytes, lines 701-1262
701// node_modules/react-router/dist/index.js 702function _extends4() { 703 _extends4 = Object.assign ? Object.assign.bind() : function(target) { 704 for (var i = 1; i < arguments.length; i++) { 705 var source = arguments[i]; 706 for (var key in source) { 707 if (Object.prototype.hasOwnProperty.call(source, key)) { 708 target[key] = source[key]; 709 } 710 } 711 } 712 return target; 713 }; 714 return _extends4.apply(this, arguments); 715} 716function isPolyfill(x, y) { 717 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y; 718} 719function useSyncExternalStore$2(subscribe, getSnapshot, getServerSnapshot) { 720 if (true) { 721 if (!didWarnOld18Alpha) { 722 if ("startTransition" in React2) { 723 didWarnOld18Alpha = true; 724 console.error("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."); 725 } 726 } 727 } 728 const value = getSnapshot(); 729 if (true) { 730 if (!didWarnUncachedGetSnapshot) { 731 const cachedValue = getSnapshot(); 732 if (!is(value, cachedValue)) { 733 console.error("The result of getSnapshot should be cached to avoid an infinite loop"); 734 didWarnUncachedGetSnapshot = true; 735 } 736 } 737 } 738 const [{ 739 inst 740 }, forceUpdate] = useState2({ 741 inst: { 742 value, 743 getSnapshot 744 } 745 }); 746 useLayoutEffect2(() => { 747 inst.value = value; 748 inst.getSnapshot = getSnapshot; 749 if (checkIfSnapshotChanged(inst)) { 750 forceUpdate({ 751 inst 752 }); 753 } 754 }, [subscribe, value, getSnapshot]); 755 useEffect2(() => { 756 if (checkIfSnapshotChanged(inst)) { 757 forceUpdate({ 758 inst 759 }); 760 } 761 const handleStoreChange = () => { 762 if (checkIfSnapshotChanged(inst)) { 763 forceUpdate({ 764 inst 765 }); 766 } 767 }; 768 return subscribe(handleStoreChange); 769 }, [subscribe]); 770 useDebugValue(value); 771 return value; 772} 773function checkIfSnapshotChanged(inst) { 774 const latestGetSnapshot = inst.getSnapshot; 775 const prevValue = inst.value; 776 try { 777 const nextValue = latestGetSnapshot(); 778 return !is(prevValue, nextValue); 779 } catch (error) { 780 return true; 781 } 782} 783function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) { 784 return getSnapshot(); 785} 786function useHref(to, _temp) { 787 let { 788 relative 789 } = _temp === void 0 ? {} : _temp; 790 !useInRouterContext() ? true ? invariant(false, "useHref() may be used only in the context of a <Router> component.") : invariant(false) : void 0; 791 let { 792 basename, 793 navigator 794 } = React2.useContext(NavigationContext); 795 let { 796 hash, 797 pathname, 798 search 799 } = useResolvedPath(to, { 800 relative 801 }); 802 let joinedPathname = pathname; 803 if (basename !== "/") { 804 joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]); 805 } 806 return navigator.createHref({ 807 pathname: joinedPathname, 808 search, 809 hash 810 }); 811} 812function useInRouterContext() { 813 return React2.useContext(LocationContext) != null; 814} 815function useLocation() { 816 !useInRouterContext() ? true ? invariant(false, "useLocation() may be used only in the context of a <Router> component.") : invariant(false) : void 0; 817 return React2.useContext(LocationContext).location; 818} 819function useNavigationType() { 820 return React2.useContext(LocationContext).navigationType; 821} 822function useNavigate() { 823 !useInRouterContext() ? true ? invariant(false, "useNavigate() may be used only in the context of a <Router> component.") : invariant(false) : void 0; 824 let { 825 basename, 826 navigator 827 } = React2.useContext(NavigationContext); 828 let { 829 matches 830 } = React2.useContext(RouteContext); 831 let { 832 pathname: locationPathname 833 } = useLocation(); 834 let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase)); 835 let activeRef = React2.useRef(false); 836 React2.useEffect(() => { 837 activeRef.current = true; 838 }); 839 let navigate = React2.useCallback(function(to, options) { 840 if (options === void 0) { 841 options = {}; 842 } 843 true ? warning2(activeRef.current, "You should call navigate() in a React.useEffect(), not when your component is first rendered.") : void 0; 844 if (!activeRef.current) 845 return; 846 if (typeof to === "number") { 847 navigator.go(to); 848 return; 849 } 850 let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path"); 851 if (basename !== "/") { 852 path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); 853 } 854 (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options); 855 }, [basename, navigator, routePathnamesJson, locationPathname]); 856 return navigate; 857} 858function useOutletContext() { 859 return React2.useContext(OutletContext); 860} 861function useOutlet(context) { 862 let outlet = React2.useContext(RouteContext).outlet; 863 if (outlet) { 864 return /* @__PURE__ */ React2.createElement(OutletContext.Provider, { 865 value: context 866 }, outlet); 867 } 868 return outlet; 869} 870function useParams() { 871 let { 872 matches 873 } = React2.useContext(RouteContext); 874 let routeMatch = matches[matches.length - 1]; 875 return routeMatch ? routeMatch.params : {}; 876} 877function useResolvedPath(to, _temp2) { 878 let { 879 relative 880 } = _temp2 === void 0 ? {} : _temp2; 881 let { 882 matches 883 } = React2.useContext(RouteContext); 884 let { 885 pathname: locationPathname 886 } = useLocation(); 887 let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase)); 888 return React2.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]); 889} 890function useRoutes(routes, locationArg) { 891 !useInRouterContext() ? true ? invariant(false, "useRoutes() may be used only in the context of a <Router> component.") : invariant(false) : void 0; 892 let { 893 navigator 894 } = React2.useContext(NavigationContext); 895 let dataRouterStateContext = React2.useContext(DataRouterStateContext); 896 let { 897 matches: parentMatches 898 } = React2.useContext(RouteContext); 899 let routeMatch = parentMatches[parentMatches.length - 1]; 900 let parentParams = routeMatch ? routeMatch.params : {}; 901 let parentPathname = routeMatch ? routeMatch.pathname : "/"; 902 let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/"; 903 let parentRoute = routeMatch && routeMatch.route; 904 if (true) { 905 let parentPath = parentRoute && parentRoute.path || ""; 906 warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ('"' + parentPathname + '" (under <Route path="' + parentPath + '">) but the ') + `parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. 907 908` + ('Please change the parent <Route path="' + parentPath + '"> to <Route ') + ('path="' + (parentPath === "/" ? "*" : parentPath + "/*") + '">.')); 909 } 910 let locationFromContext = useLocation(); 911 let location; 912 if (locationArg) { 913 var _parsedLocationArg$pa; 914 let parsedLocationArg = typeof locationArg === "string" ? parsePath2(locationArg) : locationArg; 915 !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? true ? invariant(false, "When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, the location pathname must begin with the portion of the URL pathname that was " + ('matched by all parent routes. The current pathname base is "' + parentPathnameBase + '" ') + ('but pathname "' + parsedLocationArg.pathname + '" was given in the `location` prop.')) : invariant(false) : void 0; 916 location = parsedLocationArg; 917 } else { 918 location = locationFromContext; 919 } 920 let pathname = location.pathname || "/"; 921 let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/"; 922 let matches = matchRoutes(routes, { 923 pathname: remainingPathname 924 }); 925 if (true) { 926 true ? warning2(parentRoute || matches != null, 'No routes matched location "' + location.pathname + location.search + location.hash + '" ') : void 0; 927 true ? warning2(matches == null || matches[matches.length - 1].route.element !== void 0, 'Matched leaf route at location "' + location.pathname + location.search + location.hash + '" does not have an element. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.') : void 0; 928 } 929 let renderedMatches = _renderMatches(matches && matches.map((match) => Object.assign({}, match, { 930 params: Object.assign({}, parentParams, match.params), 931 pathname: joinPaths([ 932 parentPathnameBase, 933 navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname 934 ]), 935 pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([ 936 parentPathnameBase, 937 navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase 938 ]) 939 })), parentMatches, dataRouterStateContext || void 0); 940 if (locationArg && renderedMatches) { 941 return /* @__PURE__ */ React2.createElement(LocationContext.Provider, { 942 value: { 943 location: _extends4({ 944 pathname: "/", 945 search: "", 946 hash: "", 947 state: null, 948 key: "default" 949 }, location), 950 navigationType: Action2.Pop 951 } 952 }, renderedMatches); 953 } 954 return renderedMatches; 955} 956function DefaultErrorElement() { 957 let error = useRouteError(); 958 let message = isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error); 959 let stack = error instanceof Error ? error.stack : null; 960 let lightgrey = "rgba(200,200,200, 0.5)"; 961 let preStyles = { 962 padding: "0.5rem", 963 backgroundColor: lightgrey 964 }; 965 let codeStyles = { 966 padding: "2px 4px", 967 backgroundColor: lightgrey 968 }; 969 return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", null, "Unhandled Thrown Error!"), /* @__PURE__ */ React2.createElement("h3", { 970 style: { 971 fontStyle: "italic" 972 } 973 }, message), stack ? /* @__PURE__ */ React2.createElement("pre", { 974 style: preStyles 975 }, stack) : null, /* @__PURE__ */ React2.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React2.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own\xA0", /* @__PURE__ */ React2.createElement("code", { 976 style: codeStyles 977 }, "errorElement"), " props on\xA0", /* @__PURE__ */ React2.createElement("code", { 978 style: codeStyles 979 }, "<Route>"))); 980} 981function RenderedRoute(_ref) { 982 let { 983 routeContext, 984 match, 985 children 986 } = _ref; 987 let dataRouterContext = React2.useContext(DataRouterContext); 988 if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && match.route.errorElement) { 989 dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id; 990 } 991 return /* @__PURE__ */ React2.createElement(RouteContext.Provider, { 992 value: routeContext 993 }, children); 994} 995function _renderMatches(matches, parentMatches, dataRouterState) { 996 if (parentMatches === void 0) { 997 parentMatches = []; 998 } 999 if (matches == null) { 1000 if (dataRouterState != null && dataRouterState.errors) { 1001 matches = dataRouterState.matches; 1002 } else { 1003 return null; 1004 } 1005 } 1006 let renderedMatches = matches; 1007 let errors = dataRouterState == null ? void 0 : dataRouterState.errors; 1008 if (errors != null) { 1009 let errorIndex = renderedMatches.findIndex((m) => m.route.id && (errors == null ? void 0 : errors[m.route.id])); 1010 !(errorIndex >= 0) ? true ? invariant(false, "Could not find a matching route for the current errors: " + errors) : invariant(false) : void 0; 1011 renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1)); 1012 } 1013 return renderedMatches.reduceRight((outlet, match, index) => { 1014 let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null; 1015 let errorElement = dataRouterState ? match.route.errorElement || /* @__PURE__ */ React2.createElement(DefaultErrorElement, null) : null; 1016 let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1)); 1017 let getChildren = () => /* @__PURE__ */ React2.createElement(RenderedRoute, { 1018 match, 1019 routeContext: { 1020 outlet, 1021 matches: matches2 1022 } 1023 }, error ? errorElement : match.route.element !== void 0 ? match.route.element : outlet); 1024 return dataRouterState && (match.route.errorElement || index === 0) ? /* @__PURE__ */ React2.createElement(RenderErrorBoundary, { 1025 location: dataRouterState.location, 1026 component: errorElement, 1027 error, 1028 children: getChildren(), 1029 routeContext: { 1030 outlet: null, 1031 matches: matches2 1032 } 1033 }) : getChildren(); 1034 }, null); 1035} 1036function getDataRouterConsoleError(hookName) { 1037 return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router."; 1038} 1039function useDataRouterState(hookName) { 1040 let state = React2.useContext(DataRouterStateContext); 1041 !state ? true ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0; 1042 return state; 1043} 1044function useRouteContext(hookName) { 1045 let route = React2.useContext(RouteContext); 1046 !route ? true ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0; 1047 return route; 1048} 1049function useCurrentRouteId(hookName) { 1050 let route = useRouteContext(hookName); 1051 let thisRoute = route.matches[route.matches.length - 1]; 1052 !thisRoute.route.id ? true ? invariant(false, hookName + ' can only be used on routes that contain a unique "id"') : invariant(false) : void 0; 1053 return thisRoute.route.id; 1054} 1055function useNavigation() { 1056 let state = useDataRouterState(DataRouterStateHook.UseNavigation); 1057 return state.navigation; 1058} 1059function useMatches() { 1060 let { 1061 matches, 1062 loaderData 1063 } = useDataRouterState(DataRouterStateHook.UseMatches); 1064 return React2.useMemo(() => matches.map((match) => { 1065 let { 1066 pathname, 1067 params 1068 } = match; 1069 return { 1070 id: match.route.id, 1071 pathname, 1072 params, 1073 data: loaderData[match.route.id], 1074 handle: match.route.handle 1075 }; 1076 }), [matches, loaderData]); 1077} 1078function useRouteError() { 1079 var _state$errors; 1080 let error = React2.useContext(RouteErrorContext); 1081 let state = useDataRouterState(DataRouterStateHook.UseRouteError); 1082 let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError); 1083 if (error) { 1084 return error; 1085 } 1086 return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId]; 1087} 1088function warningOnce(key, cond, message) { 1089 if (!cond && !alreadyWarned[key]) { 1090 alreadyWarned[key] = true; 1091 true ? warning2(false, message) : void 0; 1092 } 1093} 1094function Outlet(props) { 1095 return useOutlet(props.context); 1096} 1097function Router(_ref4) { 1098 let { 1099 basename: basenameProp = "/", 1100 children = null, 1101 location: locationProp, 1102 navigationType = Action2.Pop, 1103 navigator, 1104 static: staticProp = false 1105 } = _ref4; 1106 !!useInRouterContext() ? true ? invariant(false, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : invariant(false) : void 0; 1107 let basename = basenameProp.replace(/^\/*/, "/"); 1108 let navigationContext = React2.useMemo(() => ({ 1109 basename, 1110 navigator, 1111 static: staticProp 1112 }), [basename, navigator, staticProp]); 1113 if (typeof locationProp === "string") { 1114 locationProp = parsePath2(locationProp); 1115 } 1116 let { 1117 pathname = "/", 1118 search = "", 1119 hash = "", 1120 state = null, 1121 key = "default" 1122 } = locationProp; 1123 let location = React2.useMemo(() => { 1124 let trailingPathname = stripBasename(pathname, basename); 1125 if (trailingPathname == null) { 1126 return null; 1127 } 1128 return { 1129 pathname: trailingPathname, 1130 search, 1131 hash, 1132 state, 1133 key 1134 }; 1135 }, [basename, pathname, search, hash, state, key]); 1136 true ? warning2(location != null, '<Router basename="' + basename + '"> is not able to match the URL ' + ('"' + pathname + search + hash + '" because it does not start with the ') + "basename, so the <Router> won't render anything.") : void 0; 1137 if (location == null) { 1138 return null; 1139 } 1140 return /* @__PURE__ */ React2.createElement(NavigationContext.Provider, { 1141 value: navigationContext 1142 }, /* @__PURE__ */ React2.createElement(LocationContext.Provider, { 1143 children, 1144 value: { 1145 location, 1146 navigationType 1147 } 1148 })); 1149} 1150var React2, is, useState2, useEffect2, useLayoutEffect2, useDebugValue, didWarnOld18Alpha, didWarnUncachedGetSnapshot, canUseDOM, isServerEnvironment, shim, useSyncExternalStore, DataRouterContext, DataRouterStateContext, AwaitContext, NavigationContext, LocationContext, RouteContext, RouteErrorContext, OutletContext, RenderErrorBoundary, DataRouterHook, DataRouterStateHook, alreadyWarned, AwaitRenderStatus, neverSettledPromise; 1151var init_dist = __esm({ 1152 "node_modules/react-router/dist/index.js"() { 1153 init_react(); 1154 init_router(); 1155 init_router(); 1156 React2 = __toESM(require_react()); 1157 is = typeof Object.is === "function" ? Object.is : isPolyfill; 1158 ({ 1159 useState: useState2, 1160 useEffect: useEffect2, 1161 useLayoutEffect: useLayoutEffect2, 1162 useDebugValue 1163 } = React2); 1164 didWarnOld18Alpha = false; 1165 didWarnUncachedGetSnapshot = false; 1166 canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"); 1167 isServerEnvironment = !canUseDOM; 1168 shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2; 1169 useSyncExternalStore = "useSyncExternalStore" in React2 ? ((module) => module.useSyncExternalStore)(React2) : shim; 1170 DataRouterContext = /* @__PURE__ */ React2.createContext(null); 1171 if (true) { 1172 DataRouterContext.displayName = "DataRouter"; 1173 } 1174 DataRouterStateContext = /* @__PURE__ */ React2.createContext(null); 1175 if (true) { 1176 DataRouterStateContext.displayName = "DataRouterState"; 1177 } 1178 AwaitContext = /* @__PURE__ */ React2.createContext(null); 1179 if (true) { 1180 AwaitContext.displayName = "Await"; 1181 } 1182 NavigationContext = /* @__PURE__ */ React2.createContext(null); 1183 if (true) { 1184 NavigationContext.displayName = "Navigation"; 1185 } 1186 LocationContext = /* @__PURE__ */ React2.createContext(null); 1187 if (true) { 1188 LocationContext.displayName = "Location"; 1189 } 1190 RouteContext = /* @__PURE__ */ React2.createContext({ 1191 outlet: null, 1192 matches: [] 1193 }); 1194 if (true) { 1195 RouteContext.displayName = "Route"; 1196 } 1197 RouteErrorContext = /* @__PURE__ */ React2.createContext(null); 1198 if (true) { 1199 RouteErrorContext.displayName = "RouteError"; 1200 } 1201 OutletContext = /* @__PURE__ */ React2.createContext(null); 1202 RenderErrorBoundary = class extends React2.Component { 1203 constructor(props) { 1204 super(props); 1205 this.state = { 1206 location: props.location, 1207 error: props.error 1208 }; 1209 } 1210 static getDerivedStateFromError(error) { 1211 return { 1212 error 1213 }; 1214 } 1215 static getDerivedStateFromProps(props, state) { 1216 if (state.location !== props.location) { 1217 return { 1218 error: props.error, 1219 location: props.location 1220 }; 1221 } 1222 return { 1223 error: props.error || state.error, 1224 location: state.location 1225 }; 1226 } 1227 componentDidCatch(error, errorInfo) { 1228 console.error("React Router caught the following error during render", error, errorInfo); 1229 } 1230 render() { 1231 return this.state.error ? /* @__PURE__ */ React2.createElement(RouteContext.Provider, { 1232 value: this.props.routeContext 1233 }, /* @__PURE__ */ React2.createElement(RouteErrorContext.Provider, { 1234 value: this.state.error, 1235 children: this.props.component 1236 })) : this.props.children; 1237 } 1238 }; 1239 (function(DataRouterHook3) { 1240 DataRouterHook3["UseBlocker"] = "useBlocker"; 1241 DataRouterHook3["UseRevalidator"] = "useRevalidator"; 1242 })(DataRouterHook || (DataRouterHook = {})); 1243 (function(DataRouterStateHook3) { 1244 DataRouterStateHook3["UseLoaderData"] = "useLoaderData"; 1245 DataRouterStateHook3["UseActionData"] = "useActionData"; 1246 DataRouterStateHook3["UseRouteError"] = "useRouteError"; 1247 DataRouterStateHook3["UseNavigation"] = "useNavigation"; 1248 DataRouterStateHook3["UseRouteLoaderData"] = "useRouteLoaderData"; 1249 DataRouterStateHook3["UseMatches"] = "useMatches"; 1250 DataRouterStateHook3["UseRevalidator"] = "useRevalidator"; 1251 })(DataRouterStateHook || (DataRouterStateHook = {})); 1252 alreadyWarned = {}; 1253 (function(AwaitRenderStatus2) { 1254 AwaitRenderStatus2[AwaitRenderStatus2["pending"] = 0] = "pending"; 1255 AwaitRenderStatus2[AwaitRenderStatus2["success"] = 1] = "success"; 1256 AwaitRenderStatus2[AwaitRenderStatus2["error"] = 2] = "error"; 1257 })(AwaitRenderStatus || (AwaitRenderStatus = {})); 1258 neverSettledPromise = new Promise(() => { 1259 }); 1260 } 1261}); 1262
vendor: 19,068 bytes, lines 1263-1799
1263// node_modules/react-router-dom/dist/index.js 1264function _extends5() { 1265 _extends5 = Object.assign ? Object.assign.bind() : function(target) { 1266 for (var i = 1; i < arguments.length; i++) { 1267 var source = arguments[i]; 1268 for (var key in source) { 1269 if (Object.prototype.hasOwnProperty.call(source, key)) { 1270 target[key] = source[key]; 1271 } 1272 } 1273 } 1274 return target; 1275 }; 1276 return _extends5.apply(this, arguments); 1277} 1278function _objectWithoutPropertiesLoose(source, excluded) { 1279 if (source == null) 1280 return {}; 1281 var target = {}; 1282 var sourceKeys = Object.keys(source); 1283 var key, i; 1284 for (i = 0; i < sourceKeys.length; i++) { 1285 key = sourceKeys[i]; 1286 if (excluded.indexOf(key) >= 0) 1287 continue; 1288 target[key] = source[key]; 1289 } 1290 return target; 1291} 1292function isHtmlElement(object) { 1293 return object != null && typeof object.tagName === "string"; 1294} 1295function isButtonElement(object) { 1296 return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; 1297} 1298function isFormElement(object) { 1299 return isHtmlElement(object) && object.tagName.toLowerCase() === "form"; 1300} 1301function isInputElement(object) { 1302 return isHtmlElement(object) && object.tagName.toLowerCase() === "input"; 1303} 1304function isModifiedEvent(event) { 1305 return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); 1306} 1307function shouldProcessLinkClick(event, target) { 1308 return event.button === 0 && (!target || target === "_self") && !isModifiedEvent(event); 1309} 1310function createSearchParams(init) { 1311 if (init === void 0) { 1312 init = ""; 1313 } 1314 return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => { 1315 let value = init[key]; 1316 return memo.concat(Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]); 1317 }, [])); 1318} 1319function getSearchParamsForLocation(locationSearch, defaultSearchParams) { 1320 let searchParams = createSearchParams(locationSearch); 1321 for (let key of defaultSearchParams.keys()) { 1322 if (!searchParams.has(key)) { 1323 defaultSearchParams.getAll(key).forEach((value) => { 1324 searchParams.append(key, value); 1325 }); 1326 } 1327 } 1328 return searchParams; 1329} 1330function getFormSubmissionInfo(target, defaultAction, options) { 1331 let method; 1332 let action; 1333 let encType; 1334 let formData; 1335 if (isFormElement(target)) { 1336 let submissionTrigger = options.submissionTrigger; 1337 method = options.method || target.getAttribute("method") || defaultMethod; 1338 action = options.action || target.getAttribute("action") || defaultAction; 1339 encType = options.encType || target.getAttribute("enctype") || defaultEncType; 1340 formData = new FormData(target); 1341 if (submissionTrigger && submissionTrigger.name) { 1342 formData.append(submissionTrigger.name, submissionTrigger.value); 1343 } 1344 } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { 1345 let form = target.form; 1346 if (form == null) { 1347 throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>'); 1348 } 1349 method = options.method || target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod; 1350 action = options.action || target.getAttribute("formaction") || form.getAttribute("action") || defaultAction; 1351 encType = options.encType || target.getAttribute("formenctype") || form.getAttribute("enctype") || defaultEncType; 1352 formData = new FormData(form); 1353 if (target.name) { 1354 formData.append(target.name, target.value); 1355 } 1356 } else if (isHtmlElement(target)) { 1357 throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">'); 1358 } else { 1359 method = options.method || defaultMethod; 1360 action = options.action || defaultAction; 1361 encType = options.encType || defaultEncType; 1362 if (target instanceof FormData) { 1363 formData = target; 1364 } else { 1365 formData = new FormData(); 1366 if (target instanceof URLSearchParams) { 1367 for (let [name, value] of target) { 1368 formData.append(name, value); 1369 } 1370 } else if (target != null) { 1371 for (let name of Object.keys(target)) { 1372 formData.append(name, target[name]); 1373 } 1374 } 1375 } 1376 } 1377 let { 1378 protocol, 1379 host 1380 } = window.location; 1381 let url = new URL(action, protocol + "//" + host); 1382 return { 1383 url, 1384 method: method.toLowerCase(), 1385 encType, 1386 formData 1387 }; 1388} 1389function HistoryRouter(_ref3) { 1390 let { 1391 basename, 1392 children, 1393 history 1394 } = _ref3; 1395 const [state, setState] = React3.useState({ 1396 action: history.action, 1397 location: history.location 1398 }); 1399 React3.useLayoutEffect(() => history.listen(setState), [history]); 1400 return /* @__PURE__ */ React3.createElement(Router, { 1401 basename, 1402 children, 1403 location: state.location, 1404 navigationType: state.action, 1405 navigator: history 1406 }); 1407} 1408function ScrollRestoration(_ref7) { 1409 let { 1410 getKey, 1411 storageKey 1412 } = _ref7; 1413 useScrollRestoration({ 1414 getKey, 1415 storageKey 1416 }); 1417 return null; 1418} 1419function getDataRouterConsoleError2(hookName) { 1420 return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router."; 1421} 1422function useDataRouterContext(hookName) { 1423 let ctx = React3.useContext(DataRouterContext); 1424 !ctx ? true ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0; 1425 return ctx; 1426} 1427function useDataRouterState2(hookName) { 1428 let state = React3.useContext(DataRouterStateContext); 1429 !state ? true ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0; 1430 return state; 1431} 1432function useLinkClickHandler(to, _temp) { 1433 let { 1434 target, 1435 replace: replaceProp, 1436 state, 1437 preventScrollReset, 1438 relative 1439 } = _temp === void 0 ? {} : _temp; 1440 let navigate = useNavigate(); 1441 let location = useLocation(); 1442 let path = useResolvedPath(to, { 1443 relative 1444 }); 1445 return React3.useCallback((event) => { 1446 if (shouldProcessLinkClick(event, target)) { 1447 event.preventDefault(); 1448 let replace = replaceProp !== void 0 ? replaceProp : createPath2(location) === createPath2(path); 1449 navigate(to, { 1450 replace, 1451 state, 1452 preventScrollReset, 1453 relative 1454 }); 1455 } 1456 }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative]); 1457} 1458function useSearchParams(defaultInit) { 1459 true ? warning3(typeof URLSearchParams !== "undefined", "You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params\n\nIf you're unsure how to load polyfills, we recommend you check out https://polyfill.io/v3/ which provides some recommendations about how to load polyfills only for users that need them, instead of for every user.") : void 0; 1460 let defaultSearchParamsRef = React3.useRef(createSearchParams(defaultInit)); 1461 let location = useLocation(); 1462 let searchParams = React3.useMemo(() => getSearchParamsForLocation(location.search, defaultSearchParamsRef.current), [location.search]); 1463 let navigate = useNavigate(); 1464 let setSearchParams = React3.useCallback((nextInit, navigateOptions) => { 1465 const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit); 1466 navigate("?" + newSearchParams, navigateOptions); 1467 }, [navigate, searchParams]); 1468 return [searchParams, setSearchParams]; 1469} 1470function useSubmitImpl(fetcherKey, routeId) { 1471 let { 1472 router 1473 } = useDataRouterContext(DataRouterHook2.UseSubmitImpl); 1474 let defaultAction = useFormAction(); 1475 return React3.useCallback(function(target, options) { 1476 if (options === void 0) { 1477 options = {}; 1478 } 1479 if (typeof document === "undefined") { 1480 throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead."); 1481 } 1482 let { 1483 method, 1484 encType, 1485 formData, 1486 url 1487 } = getFormSubmissionInfo(target, defaultAction, options); 1488 let href = url.pathname + url.search; 1489 let opts = { 1490 replace: options.replace, 1491 preventScrollReset: options.preventScrollReset, 1492 formData, 1493 formMethod: method, 1494 formEncType: encType 1495 }; 1496 if (fetcherKey) { 1497 !(routeId != null) ? true ? invariant(false, "No routeId available for useFetcher()") : invariant(false) : void 0; 1498 router.fetch(fetcherKey, routeId, href, opts); 1499 } else { 1500 router.navigate(href, opts); 1501 } 1502 }, [defaultAction, router, fetcherKey, routeId]); 1503} 1504function useFormAction(action, _temp2) { 1505 let { 1506 relative 1507 } = _temp2 === void 0 ? {} : _temp2; 1508 let { 1509 basename 1510 } = React3.useContext(NavigationContext); 1511 let routeContext = React3.useContext(RouteContext); 1512 !routeContext ? true ? invariant(false, "useFormAction must be used inside a RouteContext") : invariant(false) : void 0; 1513 let [match] = routeContext.matches.slice(-1); 1514 let path = _extends5({}, useResolvedPath(action ? action : ".", { 1515 relative 1516 })); 1517 let location = useLocation(); 1518 if (action == null) { 1519 path.search = location.search; 1520 path.hash = location.hash; 1521 if (match.route.index) { 1522 let params = new URLSearchParams(path.search); 1523 params.delete("index"); 1524 path.search = params.toString() ? "?" + params.toString() : ""; 1525 } 1526 } 1527 if ((!action || action === ".") && match.route.index) { 1528 path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; 1529 } 1530 if (basename !== "/") { 1531 path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); 1532 } 1533 return createPath2(path); 1534} 1535function useScrollRestoration(_temp3) { 1536 let { 1537 getKey, 1538 storageKey 1539 } = _temp3 === void 0 ? {} : _temp3; 1540 let { 1541 router 1542 } = useDataRouterContext(DataRouterHook2.UseScrollRestoration); 1543 let { 1544 restoreScrollPosition, 1545 preventScrollReset 1546 } = useDataRouterState2(DataRouterStateHook2.UseScrollRestoration); 1547 let location = useLocation(); 1548 let matches = useMatches(); 1549 let navigation = useNavigation(); 1550 React3.useEffect(() => { 1551 window.history.scrollRestoration = "manual"; 1552 return () => { 1553 window.history.scrollRestoration = "auto"; 1554 }; 1555 }, []); 1556 useBeforeUnload(React3.useCallback(() => { 1557 if (navigation.state === "idle") { 1558 let key = (getKey ? getKey(location, matches) : null) || location.key; 1559 savedScrollPositions[key] = window.scrollY; 1560 } 1561 sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions)); 1562 window.history.scrollRestoration = "auto"; 1563 }, [storageKey, getKey, navigation.state, location, matches])); 1564 if (typeof document !== "undefined") { 1565 React3.useLayoutEffect(() => { 1566 try { 1567 let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY); 1568 if (sessionPositions) { 1569 savedScrollPositions = JSON.parse(sessionPositions); 1570 } 1571 } catch (e) { 1572 } 1573 }, [storageKey]); 1574 React3.useLayoutEffect(() => { 1575 let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey); 1576 return () => disableScrollRestoration && disableScrollRestoration(); 1577 }, [router, getKey]); 1578 React3.useLayoutEffect(() => { 1579 if (restoreScrollPosition === false) { 1580 return; 1581 } 1582 if (typeof restoreScrollPosition === "number") { 1583 window.scrollTo(0, restoreScrollPosition); 1584 return; 1585 } 1586 if (location.hash) { 1587 let el = document.getElementById(location.hash.slice(1)); 1588 if (el) { 1589 el.scrollIntoView(); 1590 return; 1591 } 1592 } 1593 if (preventScrollReset === true) { 1594 return; 1595 } 1596 window.scrollTo(0, 0); 1597 }, [location, restoreScrollPosition, preventScrollReset]); 1598 } 1599} 1600function useBeforeUnload(callback, options) { 1601 let { 1602 capture 1603 } = options || {}; 1604 React3.useEffect(() => { 1605 let opts = capture != null ? { 1606 capture 1607 } : void 0; 1608 window.addEventListener("beforeunload", callback, opts); 1609 return () => { 1610 window.removeEventListener("beforeunload", callback, opts); 1611 }; 1612 }, [callback, capture]); 1613} 1614function warning3(cond, message) { 1615 if (!cond) { 1616 if (typeof console !== "undefined") 1617 console.warn(message); 1618 try { 1619 throw new Error(message); 1620 } catch (e) { 1621 } 1622 } 1623} 1624var React3, defaultMethod, defaultEncType, _excluded, _excluded2, _excluded3, Link, NavLink, Form, FormImpl, DataRouterHook2, DataRouterStateHook2, SCROLL_RESTORATION_STORAGE_KEY, savedScrollPositions; 1625var init_dist2 = __esm({ 1626 "node_modules/react-router-dom/dist/index.js"() { 1627 init_react(); 1628 React3 = __toESM(require_react()); 1629 init_dist(); 1630 init_dist(); 1631 init_router(); 1632 defaultMethod = "get"; 1633 defaultEncType = "application/x-www-form-urlencoded"; 1634 _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"]; 1635 _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"]; 1636 _excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId", "relative", "preventScrollReset"]; 1637 if (true) { 1638 HistoryRouter.displayName = "unstable_HistoryRouter"; 1639 } 1640 Link = /* @__PURE__ */ React3.forwardRef(function LinkWithRef(_ref4, ref) { 1641 let { 1642 onClick, 1643 relative, 1644 reloadDocument, 1645 replace, 1646 state, 1647 target, 1648 to, 1649 preventScrollReset 1650 } = _ref4, rest = _objectWithoutPropertiesLoose(_ref4, _excluded); 1651 let href = useHref(to, { 1652 relative 1653 }); 1654 let internalOnClick = useLinkClickHandler(to, { 1655 replace, 1656 state, 1657 target, 1658 preventScrollReset, 1659 relative 1660 }); 1661 function handleClick(event) { 1662 if (onClick) 1663 onClick(event); 1664 if (!event.defaultPrevented) { 1665 internalOnClick(event); 1666 } 1667 } 1668 return /* @__PURE__ */ React3.createElement("a", _extends5({}, rest, { 1669 href, 1670 onClick: reloadDocument ? onClick : handleClick, 1671 ref, 1672 target 1673 })); 1674 }); 1675 if (true) { 1676 Link.displayName = "Link"; 1677 } 1678 NavLink = /* @__PURE__ */ React3.forwardRef(function NavLinkWithRef(_ref5, ref) { 1679 let { 1680 "aria-current": ariaCurrentProp = "page", 1681 caseSensitive = false, 1682 className: classNameProp = "", 1683 end = false, 1684 style: styleProp, 1685 to, 1686 children 1687 } = _ref5, rest = _objectWithoutPropertiesLoose(_ref5, _excluded2); 1688 let path = useResolvedPath(to, { 1689 relative: rest.relative 1690 }); 1691 let location = useLocation(); 1692 let routerState = React3.useContext(DataRouterStateContext); 1693 let { 1694 navigator 1695 } = React3.useContext(NavigationContext); 1696 let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname; 1697 let locationPathname = location.pathname; 1698 let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null; 1699 if (!caseSensitive) { 1700 locationPathname = locationPathname.toLowerCase(); 1701 nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null; 1702 toPathname = toPathname.toLowerCase(); 1703 } 1704 let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/"; 1705 let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"); 1706 let ariaCurrent = isActive ? ariaCurrentProp : void 0; 1707 let className; 1708 if (typeof classNameProp === "function") { 1709 className = classNameProp({ 1710 isActive, 1711 isPending 1712 }); 1713 } else { 1714 className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null].filter(Boolean).join(" "); 1715 } 1716 let style = typeof styleProp === "function" ? styleProp({ 1717 isActive, 1718 isPending 1719 }) : styleProp; 1720 return /* @__PURE__ */ React3.createElement(Link, _extends5({}, rest, { 1721 "aria-current": ariaCurrent, 1722 className, 1723 ref, 1724 style, 1725 to 1726 }), typeof children === "function" ? children({ 1727 isActive, 1728 isPending 1729 }) : children); 1730 }); 1731 if (true) { 1732 NavLink.displayName = "NavLink"; 1733 } 1734 Form = /* @__PURE__ */ React3.forwardRef((props, ref) => { 1735 return /* @__PURE__ */ React3.createElement(FormImpl, _extends5({}, props, { 1736 ref 1737 })); 1738 }); 1739 if (true) { 1740 Form.displayName = "Form"; 1741 } 1742 FormImpl = /* @__PURE__ */ React3.forwardRef((_ref6, forwardedRef) => { 1743 let { 1744 reloadDocument, 1745 replace, 1746 method = defaultMethod, 1747 action, 1748 onSubmit, 1749 fetcherKey, 1750 routeId, 1751 relative, 1752 preventScrollReset 1753 } = _ref6, props = _objectWithoutPropertiesLoose(_ref6, _excluded3); 1754 let submit = useSubmitImpl(fetcherKey, routeId); 1755 let formMethod = method.toLowerCase() === "get" ? "get" : "post"; 1756 let formAction = useFormAction(action, { 1757 relative 1758 }); 1759 let submitHandler = (event) => { 1760 onSubmit && onSubmit(event); 1761 if (event.defaultPrevented) 1762 return; 1763 event.preventDefault(); 1764 let submitter = event.nativeEvent.submitter; 1765 let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method; 1766 submit(submitter || event.currentTarget, { 1767 method: submitMethod, 1768 replace, 1769 relative, 1770 preventScrollReset 1771 }); 1772 }; 1773 return /* @__PURE__ */ React3.createElement("form", _extends5({ 1774 ref: forwardedRef, 1775 method: formMethod, 1776 action: formAction, 1777 onSubmit: reloadDocument ? onSubmit : submitHandler 1778 }, props)); 1779 }); 1780 if (true) { 1781 FormImpl.displayName = "FormImpl"; 1782 } 1783 if (true) { 1784 ScrollRestoration.displayName = "ScrollRestoration"; 1785 } 1786 (function(DataRouterHook3) { 1787 DataRouterHook3["UseScrollRestoration"] = "useScrollRestoration"; 1788 DataRouterHook3["UseSubmitImpl"] = "useSubmitImpl"; 1789 DataRouterHook3["UseFetcher"] = "useFetcher"; 1790 })(DataRouterHook2 || (DataRouterHook2 = {})); 1791 (function(DataRouterStateHook3) { 1792 DataRouterStateHook3["UseFetchers"] = "useFetchers"; 1793 DataRouterStateHook3["UseScrollRestoration"] = "useScrollRestoration"; 1794 })(DataRouterStateHook2 || (DataRouterStateHook2 = {})); 1795 SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions"; 1796 savedScrollPositions = {}; 1797 } 1798}); 1799
vendor: 4,524 bytes, lines 1800-1920
1800// node_modules/@remix-run/react/dist/esm/errorBoundaries.js 1801function RemixRootDefaultErrorBoundary({ 1802 error 1803}) { 1804 console.error(error); 1805 return /* @__PURE__ */ import_react.default.createElement("html", { 1806 lang: "en" 1807 }, /* @__PURE__ */ import_react.default.createElement("head", null, /* @__PURE__ */ import_react.default.createElement("meta", { 1808 charSet: "utf-8" 1809 }), /* @__PURE__ */ import_react.default.createElement("meta", { 1810 name: "viewport", 1811 content: "width=device-width,initial-scale=1,viewport-fit=cover" 1812 }), /* @__PURE__ */ import_react.default.createElement("title", null, "Application Error!")), /* @__PURE__ */ import_react.default.createElement("body", null, /* @__PURE__ */ import_react.default.createElement("main", { 1813 style: { 1814 fontFamily: "system-ui, sans-serif", 1815 padding: "2rem" 1816 } 1817 }, /* @__PURE__ */ import_react.default.createElement("h1", { 1818 style: { 1819 fontSize: "24px" 1820 } 1821 }, "Application Error"), /* @__PURE__ */ import_react.default.createElement("pre", { 1822 style: { 1823 padding: "2rem", 1824 background: "hsla(10, 50%, 50%, 0.1)", 1825 color: "red", 1826 overflow: "auto" 1827 } 1828 }, error.stack)), /* @__PURE__ */ import_react.default.createElement("script", { 1829 dangerouslySetInnerHTML: { 1830 __html: ` 1831 console.log( 1832 "\u{1F4BF} Hey developer\u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://remix.run/guides/errors for more information." 1833 ); 1834 ` 1835 } 1836 }))); 1837} 1838function useCatch() { 1839 return (0, import_react.useContext)(RemixCatchContext); 1840} 1841function RemixCatchBoundary({ 1842 catch: catchVal, 1843 component: Component2, 1844 children 1845}) { 1846 if (catchVal) { 1847 return /* @__PURE__ */ import_react.default.createElement(RemixCatchContext.Provider, { 1848 value: catchVal 1849 }, /* @__PURE__ */ import_react.default.createElement(Component2, null)); 1850 } 1851 return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children); 1852} 1853function RemixRootDefaultCatchBoundary() { 1854 let caught = useCatch(); 1855 return /* @__PURE__ */ import_react.default.createElement("html", { 1856 lang: "en" 1857 }, /* @__PURE__ */ import_react.default.createElement("head", null, /* @__PURE__ */ import_react.default.createElement("meta", { 1858 charSet: "utf-8" 1859 }), /* @__PURE__ */ import_react.default.createElement("meta", { 1860 name: "viewport", 1861 content: "width=device-width,initial-scale=1,viewport-fit=cover" 1862 }), /* @__PURE__ */ import_react.default.createElement("title", null, "Unhandled Thrown Response!")), /* @__PURE__ */ import_react.default.createElement("body", null, /* @__PURE__ */ import_react.default.createElement("h1", { 1863 style: { 1864 fontFamily: "system-ui, sans-serif", 1865 padding: "2rem" 1866 } 1867 }, caught.status, " ", caught.statusText), /* @__PURE__ */ import_react.default.createElement("script", { 1868 dangerouslySetInnerHTML: { 1869 __html: ` 1870 console.log( 1871 "\u{1F4BF} Hey developer\u{1F44B}. You can provide a way better UX than this when your app throws 404s (and other responses). Check out https://remix.run/guides/not-found for more information." 1872 ); 1873 ` 1874 } 1875 }))); 1876} 1877var import_react, RemixErrorBoundary, RemixCatchContext; 1878var init_errorBoundaries = __esm({ 1879 "node_modules/@remix-run/react/dist/esm/errorBoundaries.js"() { 1880 init_react(); 1881 import_react = __toESM(require_react()); 1882 RemixErrorBoundary = class extends import_react.default.Component { 1883 constructor(props) { 1884 super(props); 1885 this.state = { 1886 error: props.error || null, 1887 location: props.location 1888 }; 1889 } 1890 static getDerivedStateFromError(error) { 1891 return { 1892 error 1893 }; 1894 } 1895 static getDerivedStateFromProps(props, state) { 1896 if (state.location !== props.location) { 1897 return { 1898 error: props.error || null, 1899 location: props.location 1900 }; 1901 } 1902 return { 1903 error: props.error || state.error, 1904 location: state.location 1905 }; 1906 } 1907 render() { 1908 if (this.state.error) { 1909 return /* @__PURE__ */ import_react.default.createElement(this.props.component, { 1910 error: this.state.error 1911 }); 1912 } else { 1913 return this.props.children; 1914 } 1915 } 1916 }; 1917 RemixCatchContext = /* @__PURE__ */ import_react.default.createContext(void 0); 1918 } 1919}); 1920
vendor: 320 bytes, lines 1921-1932
1921// node_modules/@remix-run/react/dist/esm/invariant.js 1922function invariant2(value, message) { 1923 if (value === false || value === null || typeof value === "undefined") { 1924 throw new Error(message); 1925 } 1926} 1927var init_invariant = __esm({ 1928 "node_modules/@remix-run/react/dist/esm/invariant.js"() { 1929 init_react(); 1930 } 1931}); 1932
vendor: 590 bytes, lines 1933-1956
1933// node_modules/@remix-run/react/dist/esm/routeModules.js 1934async function loadRouteModule(route, routeModulesCache) { 1935 if (route.id in routeModulesCache) { 1936 return routeModulesCache[route.id]; 1937 } 1938 try { 1939 let routeModule = await import( 1940 /* webpackIgnore: true */ 1941 route.module 1942 ); 1943 routeModulesCache[route.id] = routeModule; 1944 return routeModule; 1945 } catch (error) { 1946 window.location.reload(); 1947 return new Promise(() => { 1948 }); 1949 } 1950} 1951var init_routeModules = __esm({ 1952 "node_modules/@remix-run/react/dist/esm/routeModules.js"() { 1953 init_react(); 1954 } 1955}); 1956
vendor: 5,779 bytes, lines 1957-2126
1957// node_modules/@remix-run/react/dist/esm/links.js 1958function getLinksForMatches(matches, routeModules, manifest) { 1959 let descriptors = matches.map((match) => { 1960 var _module$links; 1961 let module = routeModules[match.route.id]; 1962 return ((_module$links = module.links) === null || _module$links === void 0 ? void 0 : _module$links.call(module)) || []; 1963 }).flat(1); 1964 let preloads = getCurrentPageModulePreloadHrefs(matches, manifest); 1965 return dedupe(descriptors, preloads); 1966} 1967async function prefetchStyleLinks(routeModule) { 1968 if (!routeModule.links) 1969 return; 1970 let descriptors = routeModule.links(); 1971 if (!descriptors) 1972 return; 1973 let styleLinks = []; 1974 for (let descriptor of descriptors) { 1975 if (!isPageLinkDescriptor(descriptor) && descriptor.rel === "stylesheet") { 1976 styleLinks.push({ 1977 ...descriptor, 1978 rel: "preload", 1979 as: "style" 1980 }); 1981 } 1982 } 1983 let matchingLinks = styleLinks.filter((link) => !link.media || window.matchMedia(link.media).matches); 1984 await Promise.all(matchingLinks.map(prefetchStyleLink)); 1985} 1986async function prefetchStyleLink(descriptor) { 1987 return new Promise((resolve) => { 1988 let link = document.createElement("link"); 1989 Object.assign(link, descriptor); 1990 function removeLink() { 1991 if (document.head.contains(link)) { 1992 document.head.removeChild(link); 1993 } 1994 } 1995 link.onload = () => { 1996 removeLink(); 1997 resolve(); 1998 }; 1999 link.onerror = () => { 2000 removeLink(); 2001 resolve(); 2002 }; 2003 document.head.appendChild(link); 2004 }); 2005} 2006function isPageLinkDescriptor(object) { 2007 return object != null && typeof object.page === "string"; 2008} 2009function isHtmlLinkDescriptor(object) { 2010 if (object == null) 2011 return false; 2012 if (object.href == null) { 2013 return object.rel === "preload" && (typeof object.imageSrcSet === "string" || typeof object.imagesrcset === "string") && (typeof object.imageSizes === "string" || typeof object.imagesizes === "string"); 2014 } 2015 return typeof object.rel === "string" && typeof object.href === "string"; 2016} 2017async function getStylesheetPrefetchLinks(matches, routeModules) { 2018 let links = await Promise.all(matches.map(async (match) => { 2019 let mod = await loadRouteModule(match.route, routeModules); 2020 return mod.links ? mod.links() : []; 2021 })); 2022 return links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map((link) => link.rel === "preload" ? { 2023 ...link, 2024 rel: "prefetch" 2025 } : { 2026 ...link, 2027 rel: "prefetch", 2028 as: "style" 2029 }); 2030} 2031function getNewMatchesForLinks(page, nextMatches, currentMatches, location, mode) { 2032 let path = parsePathPatch(page); 2033 let isNew = (match, index) => { 2034 if (!currentMatches[index]) 2035 return true; 2036 return match.route.id !== currentMatches[index].route.id; 2037 }; 2038 let matchPathChanged = (match, index) => { 2039 var _currentMatches$index; 2040 return currentMatches[index].pathname !== match.pathname || ((_currentMatches$index = currentMatches[index].route.path) === null || _currentMatches$index === void 0 ? void 0 : _currentMatches$index.endsWith("*")) && currentMatches[index].params["*"] !== match.params["*"]; 2041 }; 2042 let newMatches = mode === "data" && location.search !== path.search ? nextMatches.filter((match, index) => { 2043 if (!match.route.hasLoader) { 2044 return false; 2045 } 2046 if (isNew(match, index) || matchPathChanged(match, index)) { 2047 return true; 2048 } 2049 if (match.route.shouldReload) { 2050 return match.route.shouldReload({ 2051 params: match.params, 2052 prevUrl: new URL(location.pathname + location.search + location.hash, window.origin), 2053 url: new URL(page, window.origin) 2054 }); 2055 } 2056 return true; 2057 }) : nextMatches.filter((match, index) => { 2058 return (mode === "assets" || match.route.hasLoader) && (isNew(match, index) || matchPathChanged(match, index)); 2059 }); 2060 return newMatches; 2061} 2062function getDataLinkHrefs(page, matches, manifest) { 2063 let path = parsePathPatch(page); 2064 return dedupeHrefs(matches.filter((match) => manifest.routes[match.route.id].hasLoader).map((match) => { 2065 let { 2066 pathname, 2067 search 2068 } = path; 2069 let searchParams = new URLSearchParams(search); 2070 searchParams.set("_data", match.route.id); 2071 return `${pathname}?${searchParams}`; 2072 })); 2073} 2074function getModuleLinkHrefs(matches, manifestPatch) { 2075 return dedupeHrefs(matches.map((match) => { 2076 let route = manifestPatch.routes[match.route.id]; 2077 let hrefs = [route.module]; 2078 if (route.imports) { 2079 hrefs = hrefs.concat(route.imports); 2080 } 2081 return hrefs; 2082 }).flat(1)); 2083} 2084function getCurrentPageModulePreloadHrefs(matches, manifest) { 2085 return dedupeHrefs(matches.map((match) => { 2086 let route = manifest.routes[match.route.id]; 2087 let hrefs = [route.module]; 2088 if (route.imports) { 2089 hrefs = hrefs.concat(route.imports); 2090 } 2091 return hrefs; 2092 }).flat(1)); 2093} 2094function dedupeHrefs(hrefs) { 2095 return [...new Set(hrefs)]; 2096} 2097function dedupe(descriptors, preloads) { 2098 let set = /* @__PURE__ */ new Set(); 2099 let preloadsSet = new Set(preloads); 2100 return descriptors.reduce((deduped, descriptor) => { 2101 let alreadyModulePreload = !isPageLinkDescriptor(descriptor) && descriptor.as === "script" && descriptor.href && preloadsSet.has(descriptor.href); 2102 if (alreadyModulePreload) { 2103 return deduped; 2104 } 2105 let str = JSON.stringify(descriptor); 2106 if (!set.has(str)) { 2107 set.add(str); 2108 deduped.push(descriptor); 2109 } 2110 return deduped; 2111 }, []); 2112} 2113function parsePathPatch(href) { 2114 let path = parsePath(href); 2115 if (path.search === void 0) 2116 path.search = ""; 2117 return path; 2118} 2119var init_links = __esm({ 2120 "node_modules/@remix-run/react/dist/esm/links.js"() { 2121 init_react(); 2122 init_history(); 2123 init_routeModules(); 2124 } 2125}); 2126
vendor: 225 bytes, lines 2127-2138
2127// node_modules/@remix-run/react/dist/esm/markup.js 2128function createHtml(html) { 2129 return { 2130 __html: html 2131 }; 2132} 2133var init_markup = __esm({ 2134 "node_modules/@remix-run/react/dist/esm/markup.js"() { 2135 init_react(); 2136 } 2137}); 2138
vendor: 1,884 bytes, lines 2139-2203
2139// node_modules/@remix-run/react/dist/esm/data.js 2140function isCatchResponse(response) { 2141 return response instanceof Response && response.headers.get("X-Remix-Catch") != null; 2142} 2143function isErrorResponse(response) { 2144 return response instanceof Response && response.headers.get("X-Remix-Error") != null; 2145} 2146function isRedirectResponse(response) { 2147 return response instanceof Response && response.headers.get("X-Remix-Redirect") != null; 2148} 2149async function fetchData(url, routeId, signal, submission) { 2150 url.searchParams.set("_data", routeId); 2151 let init = submission ? getActionInit(submission, signal) : { 2152 credentials: "same-origin", 2153 signal 2154 }; 2155 let response = await fetch(url.href, init); 2156 if (isErrorResponse(response)) { 2157 let data = await response.json(); 2158 let error = new Error(data.message); 2159 error.stack = data.stack; 2160 return error; 2161 } 2162 return response; 2163} 2164async function extractData(response) { 2165 let contentType = response.headers.get("Content-Type"); 2166 if (contentType && /\bapplication\/json\b/.test(contentType)) { 2167 return response.json(); 2168 } 2169 return response.text(); 2170} 2171function getActionInit(submission, signal) { 2172 let { 2173 encType, 2174 method, 2175 formData 2176 } = submission; 2177 let headers = void 0; 2178 let body = formData; 2179 if (encType === "application/x-www-form-urlencoded") { 2180 body = new URLSearchParams(); 2181 for (let [key, value] of formData) { 2182 invariant2(typeof value === "string", `File inputs are not supported with encType "application/x-www-form-urlencoded", please use "multipart/form-data" instead.`); 2183 body.append(key, value); 2184 } 2185 headers = { 2186 "Content-Type": encType 2187 }; 2188 } 2189 return { 2190 method, 2191 body, 2192 signal, 2193 credentials: "same-origin", 2194 headers 2195 }; 2196} 2197var init_data = __esm({ 2198 "node_modules/@remix-run/react/dist/esm/data.js"() { 2199 init_react(); 2200 init_invariant(); 2201 } 2202}); 2203
vendor: 451 bytes, lines 2204-2221
2204// node_modules/@remix-run/react/dist/esm/routeMatching.js 2205function matchClientRoutes(routes, location) { 2206 let matches = matchRoutes(routes, location); 2207 if (!matches) 2208 return null; 2209 return matches.map((match) => ({ 2210 params: match.params, 2211 pathname: match.pathname, 2212 route: match.route 2213 })); 2214} 2215var init_routeMatching = __esm({ 2216 "node_modules/@remix-run/react/dist/esm/routeMatching.js"() { 2217 init_react(); 2218 init_dist2(); 2219 } 2220}); 2221
vendor: 30,481 bytes, lines 2222-3199
2222// node_modules/@remix-run/react/dist/esm/transition.js 2223function isActionSubmission(submission) { 2224 return ["POST", "PUT", "PATCH", "DELETE"].includes(submission.method); 2225} 2226function isLoaderSubmission(submission) { 2227 return submission.method === "GET"; 2228} 2229function isRedirectLocation(location) { 2230 return Boolean(location.state) && location.state.isRedirect; 2231} 2232function isLoaderRedirectLocation(location) { 2233 return isRedirectLocation(location) && location.state.type === "loader"; 2234} 2235function isActionRedirectLocation(location) { 2236 return isRedirectLocation(location) && location.state.type === "action"; 2237} 2238function isFetchActionRedirect(location) { 2239 return isRedirectLocation(location) && location.state.type === "fetchAction"; 2240} 2241function isLoaderSubmissionRedirectLocation(location) { 2242 return isRedirectLocation(location) && location.state.type === "loaderSubmission"; 2243} 2244function createTransitionManager(init) { 2245 let { 2246 routes 2247 } = init; 2248 let pendingNavigationController; 2249 let fetchControllers = /* @__PURE__ */ new Map(); 2250 let incrementingLoadId = 0; 2251 let navigationLoadId = -1; 2252 let fetchReloadIds = /* @__PURE__ */ new Map(); 2253 let fetchRedirectIds = /* @__PURE__ */ new Set(); 2254 let subscribers = /* @__PURE__ */ new Set(); 2255 let matches = matchClientRoutes(routes, init.location); 2256 if (!matches) { 2257 matches = [{ 2258 params: {}, 2259 pathname: "", 2260 route: routes[0] 2261 }]; 2262 } 2263 let state = { 2264 location: init.location, 2265 loaderData: init.loaderData || {}, 2266 actionData: init.actionData, 2267 catch: init.catch, 2268 error: init.error, 2269 catchBoundaryId: init.catchBoundaryId || null, 2270 errorBoundaryId: init.errorBoundaryId || null, 2271 matches, 2272 nextMatches: void 0, 2273 transition: IDLE_TRANSITION, 2274 fetchers: /* @__PURE__ */ new Map() 2275 }; 2276 function update(updates) { 2277 if (updates.transition) { 2278 if (updates.transition === IDLE_TRANSITION) { 2279 pendingNavigationController = void 0; 2280 } 2281 } 2282 state = Object.assign({}, state, updates); 2283 for (let subscriber of subscribers.values()) { 2284 subscriber(state); 2285 } 2286 } 2287 function getState() { 2288 return state; 2289 } 2290 function getFetcher(key) { 2291 return state.fetchers.get(key) || IDLE_FETCHER; 2292 } 2293 function setFetcher(key, fetcher) { 2294 state.fetchers.set(key, fetcher); 2295 } 2296 function deleteFetcher(key) { 2297 if (fetchControllers.has(key)) 2298 abortFetcher(key); 2299 fetchReloadIds.delete(key); 2300 fetchRedirectIds.delete(key); 2301 state.fetchers.delete(key); 2302 } 2303 async function send(event) { 2304 switch (event.type) { 2305 case "navigation": { 2306 let { 2307 action, 2308 location, 2309 submission 2310 } = event; 2311 let matches2 = matchClientRoutes(routes, location); 2312 if (!matches2) { 2313 matches2 = [{ 2314 params: {}, 2315 pathname: "", 2316 route: routes[0] 2317 }]; 2318 await handleNotFoundNavigation(location, matches2); 2319 } else if (!submission && isHashChangeOnly(location)) { 2320 await handleHashChange(location, matches2); 2321 } else if (action === Action.Pop) { 2322 await handleLoad(location, matches2); 2323 } else if (submission && isActionSubmission(submission)) { 2324 await handleActionSubmissionNavigation(location, submission, matches2); 2325 } else if (submission && isLoaderSubmission(submission)) { 2326 await handleLoaderSubmissionNavigation(location, submission, matches2); 2327 } else if (isActionRedirectLocation(location)) { 2328 await handleActionRedirect(location, matches2); 2329 } else if (isLoaderSubmissionRedirectLocation(location)) { 2330 await handleLoaderSubmissionRedirect(location, matches2); 2331 } else if (isLoaderRedirectLocation(location)) { 2332 await handleLoaderRedirect(location, matches2); 2333 } else if (isFetchActionRedirect(location)) { 2334 await handleFetchActionRedirect(location, matches2); 2335 } else { 2336 await handleLoad(location, matches2); 2337 } 2338 navigationLoadId = -1; 2339 break; 2340 } 2341 case "fetcher": { 2342 let { 2343 key, 2344 submission, 2345 href 2346 } = event; 2347 let matches2 = matchClientRoutes(routes, href); 2348 invariant2(matches2, "No matches found"); 2349 if (fetchControllers.has(key)) 2350 abortFetcher(key); 2351 let match = getFetcherRequestMatch(new URL(href, window.location.href), matches2); 2352 if (submission && isActionSubmission(submission)) { 2353 await handleActionFetchSubmission(key, submission, match); 2354 } else if (submission && isLoaderSubmission(submission)) { 2355 await handleLoaderFetchSubmission(href, key, submission, match); 2356 } else { 2357 await handleLoaderFetch(href, key, match); 2358 } 2359 break; 2360 } 2361 default: { 2362 throw new Error(`Unknown data event type: ${event.type}`); 2363 } 2364 } 2365 } 2366 function dispose() { 2367 abortNormalNavigation(); 2368 for (let [, controller] of fetchControllers) { 2369 controller.abort(); 2370 } 2371 } 2372 function isIndexRequestUrl(url) { 2373 for (let param of url.searchParams.getAll("index")) { 2374 if (param === "") { 2375 return true; 2376 } 2377 } 2378 return false; 2379 } 2380 function getFetcherRequestMatch(url, matches2) { 2381 let match = matches2.slice(-1)[0]; 2382 if (!isIndexRequestUrl(url) && match.route.index) { 2383 return matches2.slice(-2)[0]; 2384 } 2385 return match; 2386 } 2387 async function handleActionFetchSubmission(key, submission, match) { 2388 let currentFetcher = state.fetchers.get(key); 2389 let fetcher = { 2390 state: "submitting", 2391 type: "actionSubmission", 2392 submission, 2393 data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || void 0 2394 }; 2395 setFetcher(key, fetcher); 2396 update({ 2397 fetchers: new Map(state.fetchers) 2398 }); 2399 let controller = new AbortController(); 2400 fetchControllers.set(key, controller); 2401 let result = await callAction(submission, match, controller.signal); 2402 if (controller.signal.aborted) { 2403 return; 2404 } 2405 if (isRedirectResult(result)) { 2406 let locationState = { 2407 isRedirect: true, 2408 type: "fetchAction", 2409 setCookie: result.value.setCookie 2410 }; 2411 fetchRedirectIds.add(key); 2412 init.onRedirect(result.value.location, locationState); 2413 let loadingFetcher = { 2414 state: "loading", 2415 type: "actionRedirect", 2416 submission, 2417 data: void 0 2418 }; 2419 setFetcher(key, loadingFetcher); 2420 update({ 2421 fetchers: new Map(state.fetchers) 2422 }); 2423 return; 2424 } 2425 if (maybeBailOnError(match, key, result)) { 2426 return; 2427 } 2428 if (await maybeBailOnCatch(match, key, result)) { 2429 return; 2430 } 2431 let loadFetcher = { 2432 state: "loading", 2433 type: "actionReload", 2434 data: result.value, 2435 submission 2436 }; 2437 setFetcher(key, loadFetcher); 2438 update({ 2439 fetchers: new Map(state.fetchers) 2440 }); 2441 let maybeActionErrorResult = isErrorResult(result) ? result : void 0; 2442 let maybeActionCatchResult = isCatchResult(result) ? result : void 0; 2443 let loadId = ++incrementingLoadId; 2444 fetchReloadIds.set(key, loadId); 2445 let matchesToLoad = state.nextMatches || state.matches; 2446 let results = await callLoaders(state, state.transition.location || state.location, matchesToLoad, controller.signal, maybeActionErrorResult, maybeActionCatchResult, submission, match.route.id, loadFetcher); 2447 if (controller.signal.aborted) { 2448 return; 2449 } 2450 fetchReloadIds.delete(key); 2451 fetchControllers.delete(key); 2452 let redirect2 = findRedirect(results); 2453 if (redirect2) { 2454 let locationState = { 2455 isRedirect: true, 2456 type: "loader", 2457 setCookie: redirect2.setCookie 2458 }; 2459 init.onRedirect(redirect2.location, locationState); 2460 return; 2461 } 2462 let [error, errorBoundaryId] = findErrorAndBoundaryId(results, state.matches, maybeActionErrorResult); 2463 let [catchVal, catchBoundaryId] = await findCatchAndBoundaryId(results, state.matches, maybeActionCatchResult) || []; 2464 let doneFetcher = { 2465 state: "idle", 2466 type: "done", 2467 data: result.value, 2468 submission: void 0 2469 }; 2470 setFetcher(key, doneFetcher); 2471 let abortedKeys = abortStaleFetchLoads(loadId); 2472 if (abortedKeys) { 2473 markFetchersDone(abortedKeys); 2474 } 2475 let yeetedNavigation = yeetStaleNavigationLoad(loadId); 2476 if (yeetedNavigation) { 2477 let { 2478 transition 2479 } = state; 2480 invariant2(transition.state === "loading", "Expected loading transition"); 2481 update({ 2482 location: transition.location, 2483 matches: state.nextMatches, 2484 error, 2485 errorBoundaryId, 2486 catch: catchVal, 2487 catchBoundaryId, 2488 loaderData: makeLoaderData(state, results, matchesToLoad), 2489 actionData: transition.type === "actionReload" ? state.actionData : void 0, 2490 transition: IDLE_TRANSITION, 2491 fetchers: new Map(state.fetchers) 2492 }); 2493 } else { 2494 update({ 2495 fetchers: new Map(state.fetchers), 2496 error, 2497 errorBoundaryId, 2498 loaderData: makeLoaderData(state, results, matchesToLoad) 2499 }); 2500 } 2501 } 2502 function yeetStaleNavigationLoad(landedId) { 2503 let isLoadingNavigation = state.transition.state === "loading"; 2504 if (isLoadingNavigation && navigationLoadId < landedId) { 2505 abortNormalNavigation(); 2506 return true; 2507 } 2508 return false; 2509 } 2510 function markFetchersDone(keys) { 2511 for (let key of keys) { 2512 let fetcher = getFetcher(key); 2513 let doneFetcher = { 2514 state: "idle", 2515 type: "done", 2516 data: fetcher.data, 2517 submission: void 0 2518 }; 2519 setFetcher(key, doneFetcher); 2520 } 2521 } 2522 function abortStaleFetchLoads(landedId) { 2523 let yeetedKeys = []; 2524 for (let [key, id] of fetchReloadIds) { 2525 if (id < landedId) { 2526 let fetcher = state.fetchers.get(key); 2527 invariant2(fetcher, `Expected fetcher: ${key}`); 2528 if (fetcher.state === "loading") { 2529 abortFetcher(key); 2530 fetchReloadIds.delete(key); 2531 yeetedKeys.push(key); 2532 } 2533 } 2534 } 2535 return yeetedKeys.length ? yeetedKeys : false; 2536 } 2537 async function handleLoaderFetchSubmission(href, key, submission, match) { 2538 let currentFetcher = state.fetchers.get(key); 2539 let fetcher = { 2540 state: "submitting", 2541 type: "loaderSubmission", 2542 submission, 2543 data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || void 0 2544 }; 2545 setFetcher(key, fetcher); 2546 update({ 2547 fetchers: new Map(state.fetchers) 2548 }); 2549 let controller = new AbortController(); 2550 fetchControllers.set(key, controller); 2551 let result = await callLoader(match, createUrl(href), controller.signal); 2552 fetchControllers.delete(key); 2553 if (controller.signal.aborted) { 2554 return; 2555 } 2556 if (isRedirectResult(result)) { 2557 let locationState = { 2558 isRedirect: true, 2559 type: "loader", 2560 setCookie: result.value.setCookie 2561 }; 2562 init.onRedirect(result.value.location, locationState); 2563 return; 2564 } 2565 if (maybeBailOnError(match, key, result)) { 2566 return; 2567 } 2568 if (await maybeBailOnCatch(match, key, result)) { 2569 return; 2570 } 2571 let doneFetcher = { 2572 state: "idle", 2573 type: "done", 2574 data: result.value, 2575 submission: void 0 2576 }; 2577 setFetcher(key, doneFetcher); 2578 update({ 2579 fetchers: new Map(state.fetchers) 2580 }); 2581 } 2582 async function handleLoaderFetch(href, key, match) { 2583 if (typeof AbortController === "undefined") { 2584 throw new Error("handleLoaderFetch was called during the server render, but it shouldn't be. You are likely calling useFetcher.load() in the body of your component. Try moving it to a useEffect or a callback."); 2585 } 2586 let currentFetcher = state.fetchers.get(key); 2587 let fetcher = { 2588 state: "loading", 2589 type: "normalLoad", 2590 submission: void 0, 2591 data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || void 0 2592 }; 2593 setFetcher(key, fetcher); 2594 update({ 2595 fetchers: new Map(state.fetchers) 2596 }); 2597 let controller = new AbortController(); 2598 fetchControllers.set(key, controller); 2599 let result = await callLoader(match, createUrl(href), controller.signal); 2600 if (controller.signal.aborted) 2601 return; 2602 fetchControllers.delete(key); 2603 if (isRedirectResult(result)) { 2604 let locationState = { 2605 isRedirect: true, 2606 type: "loader", 2607 setCookie: result.value.setCookie 2608 }; 2609 init.onRedirect(result.value.location, locationState); 2610 return; 2611 } 2612 if (maybeBailOnError(match, key, result)) { 2613 return; 2614 } 2615 if (await maybeBailOnCatch(match, key, result)) { 2616 return; 2617 } 2618 let doneFetcher = { 2619 state: "idle", 2620 type: "done", 2621 data: result.value, 2622 submission: void 0 2623 }; 2624 setFetcher(key, doneFetcher); 2625 update({ 2626 fetchers: new Map(state.fetchers) 2627 }); 2628 } 2629 async function maybeBailOnCatch(match, key, result) { 2630 if (isCatchResult(result)) { 2631 let catchBoundaryId = findNearestCatchBoundary(match, state.matches); 2632 state.fetchers.delete(key); 2633 update({ 2634 transition: IDLE_TRANSITION, 2635 fetchers: new Map(state.fetchers), 2636 catch: { 2637 data: result.value.data, 2638 status: result.value.status, 2639 statusText: result.value.statusText 2640 }, 2641 catchBoundaryId 2642 }); 2643 return true; 2644 } 2645 return false; 2646 } 2647 function maybeBailOnError(match, key, result) { 2648 if (isErrorResult(result)) { 2649 let errorBoundaryId = findNearestBoundary(match, state.matches); 2650 state.fetchers.delete(key); 2651 update({ 2652 fetchers: new Map(state.fetchers), 2653 error: result.value, 2654 errorBoundaryId 2655 }); 2656 return true; 2657 } 2658 return false; 2659 } 2660 async function handleNotFoundNavigation(location, matches2) { 2661 abortNormalNavigation(); 2662 let transition = { 2663 state: "loading", 2664 type: "normalLoad", 2665 submission: void 0, 2666 location 2667 }; 2668 update({ 2669 transition, 2670 nextMatches: matches2 2671 }); 2672 await Promise.resolve(); 2673 let catchBoundaryId = findNearestCatchBoundary(matches2[0], matches2); 2674 update({ 2675 location, 2676 matches: matches2, 2677 catch: { 2678 data: null, 2679 status: 404, 2680 statusText: "Not Found" 2681 }, 2682 catchBoundaryId, 2683 transition: IDLE_TRANSITION 2684 }); 2685 } 2686 async function handleActionSubmissionNavigation(location, submission, matches2) { 2687 abortNormalNavigation(); 2688 let transition = { 2689 state: "submitting", 2690 type: "actionSubmission", 2691 submission, 2692 location 2693 }; 2694 update({ 2695 transition, 2696 nextMatches: matches2 2697 }); 2698 let controller = new AbortController(); 2699 pendingNavigationController = controller; 2700 let actionMatches = matches2; 2701 if (!isIndexRequestUrl(createUrl(submission.action)) && actionMatches[matches2.length - 1].route.index) { 2702 actionMatches = actionMatches.slice(0, -1); 2703 } 2704 let leafMatch = actionMatches.slice(-1)[0]; 2705 let result = await callAction(submission, leafMatch, controller.signal); 2706 if (controller.signal.aborted) { 2707 return; 2708 } 2709 if (isRedirectResult(result)) { 2710 let locationState = { 2711 isRedirect: true, 2712 type: "action", 2713 setCookie: result.value.setCookie 2714 }; 2715 init.onRedirect(result.value.location, locationState); 2716 return; 2717 } 2718 let catchVal, catchBoundaryId; 2719 if (isCatchResult(result)) { 2720 [catchVal, catchBoundaryId] = await findCatchAndBoundaryId([result], actionMatches, result) || []; 2721 } 2722 let loadTransition = { 2723 state: "loading", 2724 type: "actionReload", 2725 submission, 2726 location 2727 }; 2728 update({ 2729 transition: loadTransition, 2730 actionData: { 2731 [leafMatch.route.id]: result.value 2732 } 2733 }); 2734 await loadPageData(location, matches2, submission, leafMatch.route.id, result, catchVal, catchBoundaryId); 2735 } 2736 async function handleLoaderSubmissionNavigation(location, submission, matches2) { 2737 abortNormalNavigation(); 2738 let transition = { 2739 state: "submitting", 2740 type: "loaderSubmission", 2741 submission, 2742 location 2743 }; 2744 update({ 2745 transition, 2746 nextMatches: matches2 2747 }); 2748 await loadPageData(location, matches2, submission); 2749 } 2750 async function handleHashChange(location, matches2) { 2751 abortNormalNavigation(); 2752 let transition = { 2753 state: "loading", 2754 type: "normalLoad", 2755 submission: void 0, 2756 location 2757 }; 2758 update({ 2759 transition, 2760 nextMatches: matches2 2761 }); 2762 await Promise.resolve(); 2763 update({ 2764 location, 2765 matches: matches2, 2766 transition: IDLE_TRANSITION 2767 }); 2768 } 2769 async function handleLoad(location, matches2) { 2770 abortNormalNavigation(); 2771 let transition = { 2772 state: "loading", 2773 type: "normalLoad", 2774 submission: void 0, 2775 location 2776 }; 2777 update({ 2778 transition, 2779 nextMatches: matches2 2780 }); 2781 await loadPageData(location, matches2); 2782 } 2783 async function handleLoaderRedirect(location, matches2) { 2784 abortNormalNavigation(); 2785 let transition = { 2786 state: "loading", 2787 type: "normalRedirect", 2788 submission: void 0, 2789 location 2790 }; 2791 update({ 2792 transition, 2793 nextMatches: matches2 2794 }); 2795 await loadPageData(location, matches2); 2796 } 2797 async function handleLoaderSubmissionRedirect(location, matches2) { 2798 abortNormalNavigation(); 2799 invariant2(state.transition.type === "loaderSubmission", `Unexpected transition: ${JSON.stringify(state.transition)}`); 2800 let { 2801 submission 2802 } = state.transition; 2803 let transition = { 2804 state: "loading", 2805 type: "loaderSubmissionRedirect", 2806 submission, 2807 location 2808 }; 2809 update({ 2810 transition, 2811 nextMatches: matches2 2812 }); 2813 await loadPageData(location, matches2, submission); 2814 } 2815 async function handleFetchActionRedirect(location, matches2) { 2816 abortNormalNavigation(); 2817 let transition = { 2818 state: "loading", 2819 type: "fetchActionRedirect", 2820 submission: void 0, 2821 location 2822 }; 2823 update({ 2824 transition, 2825 nextMatches: matches2 2826 }); 2827 await loadPageData(location, matches2); 2828 } 2829 async function handleActionRedirect(location, matches2) { 2830 abortNormalNavigation(); 2831 invariant2(state.transition.type === "actionSubmission" || state.transition.type === "actionReload" || state.transition.type === "actionRedirect", `Unexpected transition: ${JSON.stringify(state.transition)}`); 2832 let { 2833 submission 2834 } = state.transition; 2835 let transition = { 2836 state: "loading", 2837 type: "actionRedirect", 2838 submission, 2839 location 2840 }; 2841 update({ 2842 transition, 2843 nextMatches: matches2 2844 }); 2845 await loadPageData(location, matches2, submission); 2846 } 2847 function isHashChangeOnly(location) { 2848 return createHref(state.location) === createHref(location) && state.location.hash !== location.hash; 2849 } 2850 async function loadPageData(location, matches2, submission, submissionRouteId, actionResult, catchVal, catchBoundaryId) { 2851 let maybeActionErrorResult = actionResult && isErrorResult(actionResult) ? actionResult : void 0; 2852 let maybeActionCatchResult = actionResult && isCatchResult(actionResult) ? actionResult : void 0; 2853 let controller = new AbortController(); 2854 pendingNavigationController = controller; 2855 navigationLoadId = ++incrementingLoadId; 2856 let results = await callLoaders(state, location, matches2, controller.signal, maybeActionErrorResult, maybeActionCatchResult, submission, submissionRouteId, void 0, catchBoundaryId); 2857 if (controller.signal.aborted) { 2858 return; 2859 } 2860 let redirect2 = findRedirect(results); 2861 if (redirect2) { 2862 if (state.transition.type === "actionReload" || isActionRedirectLocation(location)) { 2863 let locationState = { 2864 isRedirect: true, 2865 type: "action", 2866 setCookie: redirect2.setCookie 2867 }; 2868 init.onRedirect(redirect2.location, locationState); 2869 } else if (state.transition.type === "loaderSubmission") { 2870 let locationState = { 2871 isRedirect: true, 2872 type: "loaderSubmission", 2873 setCookie: redirect2.setCookie 2874 }; 2875 init.onRedirect(redirect2.location, locationState); 2876 } else { 2877 var _location$state; 2878 let locationState = { 2879 isRedirect: true, 2880 type: "loader", 2881 setCookie: redirect2.setCookie || ((_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.setCookie) === true 2882 }; 2883 init.onRedirect(redirect2.location, locationState); 2884 } 2885 return; 2886 } 2887 let [error, errorBoundaryId] = findErrorAndBoundaryId(results, matches2, maybeActionErrorResult); 2888 [catchVal, catchBoundaryId] = await findCatchAndBoundaryId(results, matches2, maybeActionErrorResult) || [catchVal, catchBoundaryId]; 2889 markFetchRedirectsDone(); 2890 let abortedIds = abortStaleFetchLoads(navigationLoadId); 2891 if (abortedIds) { 2892 markFetchersDone(abortedIds); 2893 } 2894 update({ 2895 location, 2896 matches: matches2, 2897 error, 2898 errorBoundaryId, 2899 catch: catchVal, 2900 catchBoundaryId, 2901 loaderData: makeLoaderData(state, results, matches2), 2902 actionData: state.transition.type === "actionReload" ? state.actionData : void 0, 2903 transition: IDLE_TRANSITION, 2904 fetchers: abortedIds ? new Map(state.fetchers) : state.fetchers 2905 }); 2906 } 2907 function abortNormalNavigation() { 2908 if (pendingNavigationController) { 2909 pendingNavigationController.abort(); 2910 } 2911 } 2912 function abortFetcher(key) { 2913 let controller = fetchControllers.get(key); 2914 invariant2(controller, `Expected fetch controller: ${key}`); 2915 controller.abort(); 2916 fetchControllers.delete(key); 2917 } 2918 function markFetchRedirectsDone() { 2919 let doneKeys = []; 2920 for (let key of fetchRedirectIds) { 2921 let fetcher = state.fetchers.get(key); 2922 invariant2(fetcher, `Expected fetcher: ${key}`); 2923 if (fetcher.type === "actionRedirect") { 2924 fetchRedirectIds.delete(key); 2925 doneKeys.push(key); 2926 } 2927 } 2928 markFetchersDone(doneKeys); 2929 } 2930 function subscribe(subscriber) { 2931 subscribers.add(subscriber); 2932 return () => { 2933 subscribers.delete(subscriber); 2934 }; 2935 } 2936 return { 2937 subscribe, 2938 send, 2939 getState, 2940 getFetcher, 2941 deleteFetcher, 2942 dispose, 2943 get _internalFetchControllers() { 2944 return fetchControllers; 2945 } 2946 }; 2947} 2948async function callLoaders(state, location, matches, signal, actionErrorResult, actionCatchResult, submission, submissionRouteId, fetcher, catchBoundaryId) { 2949 let url = createUrl(createHref(location)); 2950 let matchesToLoad = filterMatchesToLoad(state, location, matches, actionErrorResult, actionCatchResult, submission, submissionRouteId, fetcher, catchBoundaryId); 2951 return Promise.all(matchesToLoad.map((match) => callLoader(match, url, signal))); 2952} 2953async function callLoader(match, url, signal) { 2954 invariant2(match.route.loader, `Expected loader for ${match.route.id}`); 2955 try { 2956 let { 2957 params 2958 } = match; 2959 let value = await match.route.loader({ 2960 params, 2961 url, 2962 signal 2963 }); 2964 return { 2965 match, 2966 value 2967 }; 2968 } catch (error) { 2969 return { 2970 match, 2971 value: error 2972 }; 2973 } 2974} 2975async function callAction(submission, match, signal) { 2976 try { 2977 let value = await match.route.action({ 2978 url: createUrl(submission.action), 2979 params: match.params, 2980 submission, 2981 signal 2982 }); 2983 return { 2984 match, 2985 value 2986 }; 2987 } catch (error) { 2988 return { 2989 match, 2990 value: error 2991 }; 2992 } 2993} 2994function filterMatchesToLoad(state, location, matches, actionErrorResult, actionCatchResult, submission, submissionRouteId, fetcher, catchBoundaryId) { 2995 var _location$state2; 2996 if (catchBoundaryId || submissionRouteId && (actionCatchResult || actionErrorResult)) { 2997 let foundProblematicRoute = false; 2998 matches = matches.filter((match) => { 2999 if (foundProblematicRoute) { 3000 return false; 3001 } 3002 if (match.route.id === submissionRouteId || match.route.id === catchBoundaryId) { 3003 foundProblematicRoute = true; 3004 return false; 3005 } 3006 return true; 3007 }); 3008 } 3009 let isNew = (match, index) => { 3010 if (!state.matches[index]) 3011 return true; 3012 return match.route.id !== state.matches[index].route.id; 3013 }; 3014 let matchPathChanged = (match, index) => { 3015 var _state$matches$index$; 3016 return state.matches[index].pathname !== match.pathname || ((_state$matches$index$ = state.matches[index].route.path) === null || _state$matches$index$ === void 0 ? void 0 : _state$matches$index$.endsWith("*")) && state.matches[index].params["*"] !== match.params["*"]; 3017 }; 3018 let url = createUrl(createHref(location)); 3019 let filterByRouteProps = (match, index) => { 3020 if (!match.route.loader) { 3021 return false; 3022 } 3023 if (isNew(match, index) || matchPathChanged(match, index)) { 3024 return true; 3025 } 3026 if (match.route.shouldReload) { 3027 let prevUrl = createUrl(createHref(state.location)); 3028 return match.route.shouldReload({ 3029 prevUrl, 3030 url, 3031 submission, 3032 params: match.params 3033 }); 3034 } 3035 return true; 3036 }; 3037 let isInRootCatchBoundary = state.matches.length === 1; 3038 if (isInRootCatchBoundary) { 3039 return matches.filter((match) => !!match.route.loader); 3040 } 3041 if ((fetcher === null || fetcher === void 0 ? void 0 : fetcher.type) === "actionReload") { 3042 return matches.filter(filterByRouteProps); 3043 } else if (state.transition.type === "actionReload" || state.transition.type === "actionRedirect" || state.transition.type === "fetchActionRedirect" || createHref(url) === createHref(state.location) || url.searchParams.toString() !== state.location.search.substring(1) || (_location$state2 = location.state) !== null && _location$state2 !== void 0 && _location$state2.setCookie) { 3044 return matches.filter(filterByRouteProps); 3045 } 3046 return matches.filter((match, index, arr) => { 3047 var _location$state3; 3048 if ((actionErrorResult || actionCatchResult) && arr.length - 1 === index) { 3049 return false; 3050 } 3051 return match.route.loader && (isNew(match, index) || matchPathChanged(match, index) || ((_location$state3 = location.state) === null || _location$state3 === void 0 ? void 0 : _location$state3.setCookie)); 3052 }); 3053} 3054function isRedirectResult(result) { 3055 return result.value instanceof TransitionRedirect; 3056} 3057function createHref(location) { 3058 return location.pathname + location.search; 3059} 3060function findRedirect(results) { 3061 for (let result of results) { 3062 if (isRedirectResult(result)) { 3063 return result.value; 3064 } 3065 } 3066 return null; 3067} 3068async function findCatchAndBoundaryId(results, matches, actionCatchResult) { 3069 let loaderCatchResult; 3070 for (let result of results) { 3071 if (isCatchResult(result)) { 3072 loaderCatchResult = result; 3073 break; 3074 } 3075 } 3076 let extractCatchData = async (res) => ({ 3077 status: res.status, 3078 statusText: res.statusText, 3079 data: res.data 3080 }); 3081 if (actionCatchResult && loaderCatchResult) { 3082 let boundaryId = findNearestCatchBoundary(loaderCatchResult.match, matches); 3083 return [await extractCatchData(actionCatchResult.value), boundaryId]; 3084 } 3085 if (loaderCatchResult) { 3086 let boundaryId = findNearestCatchBoundary(loaderCatchResult.match, matches); 3087 return [await extractCatchData(loaderCatchResult.value), boundaryId]; 3088 } 3089 return null; 3090} 3091function findErrorAndBoundaryId(results, matches, actionErrorResult) { 3092 let loaderErrorResult; 3093 for (let result of results) { 3094 if (isErrorResult(result)) { 3095 loaderErrorResult = result; 3096 break; 3097 } 3098 } 3099 if (actionErrorResult && loaderErrorResult) { 3100 let boundaryId = findNearestBoundary(loaderErrorResult.match, matches); 3101 return [actionErrorResult.value, boundaryId]; 3102 } 3103 if (actionErrorResult) { 3104 let boundaryId = findNearestBoundary(actionErrorResult.match, matches); 3105 return [actionErrorResult.value, boundaryId]; 3106 } 3107 if (loaderErrorResult) { 3108 let boundaryId = findNearestBoundary(loaderErrorResult.match, matches); 3109 return [loaderErrorResult.value, boundaryId]; 3110 } 3111 return [void 0, void 0]; 3112} 3113function findNearestCatchBoundary(matchWithError, matches) { 3114 let nearestBoundaryId = null; 3115 for (let match of matches) { 3116 if (match.route.CatchBoundary) { 3117 nearestBoundaryId = match.route.id; 3118 } 3119 if (match === matchWithError) { 3120 break; 3121 } 3122 } 3123 return nearestBoundaryId; 3124} 3125function findNearestBoundary(matchWithError, matches) { 3126 let nearestBoundaryId = null; 3127 for (let match of matches) { 3128 if (match.route.ErrorBoundary) { 3129 nearestBoundaryId = match.route.id; 3130 } 3131 if (match === matchWithError) { 3132 break; 3133 } 3134 } 3135 return nearestBoundaryId; 3136} 3137function makeLoaderData(state, results, matches) { 3138 let newData = {}; 3139 for (let { 3140 match, 3141 value 3142 } of results) { 3143 newData[match.route.id] = value; 3144 } 3145 let loaderData = {}; 3146 for (let { 3147 route 3148 } of matches) { 3149 let value = newData[route.id] !== void 0 ? newData[route.id] : state.loaderData[route.id]; 3150 if (value !== void 0) { 3151 loaderData[route.id] = value; 3152 } 3153 } 3154 return loaderData; 3155} 3156function isCatchResult(result) { 3157 return result.value instanceof CatchValue; 3158} 3159function isErrorResult(result) { 3160 return result.value instanceof Error; 3161} 3162function createUrl(href) { 3163 return new URL(href, window.location.origin); 3164} 3165var CatchValue, TransitionRedirect, IDLE_TRANSITION, IDLE_FETCHER; 3166var init_transition = __esm({ 3167 "node_modules/@remix-run/react/dist/esm/transition.js"() { 3168 init_react(); 3169 init_history(); 3170 init_routeMatching(); 3171 init_invariant(); 3172 CatchValue = class { 3173 constructor(status, statusText, data) { 3174 this.status = status; 3175 this.statusText = statusText; 3176 this.data = data; 3177 } 3178 }; 3179 TransitionRedirect = class { 3180 constructor(location, setCookie) { 3181 this.setCookie = setCookie; 3182 this.location = typeof location === "string" ? location : location.pathname + location.search; 3183 } 3184 }; 3185 IDLE_TRANSITION = { 3186 state: "idle", 3187 submission: void 0, 3188 location: void 0, 3189 type: "idle" 3190 }; 3191 IDLE_FETCHER = { 3192 state: "idle", 3193 type: "init", 3194 data: void 0, 3195 submission: void 0 3196 }; 3197 } 3198}); 3199
vendor: 3,960 bytes, lines 3200-3316
3200// node_modules/@remix-run/react/dist/esm/routes.js 3201function createClientRoute(entryRoute, routeModulesCache, Component2) { 3202 return { 3203 caseSensitive: !!entryRoute.caseSensitive, 3204 element: /* @__PURE__ */ React4.createElement(Component2, { 3205 id: entryRoute.id 3206 }), 3207 id: entryRoute.id, 3208 path: entryRoute.path, 3209 index: entryRoute.index, 3210 module: entryRoute.module, 3211 loader: createLoader(entryRoute, routeModulesCache), 3212 action: createAction(entryRoute, routeModulesCache), 3213 shouldReload: createShouldReload(entryRoute, routeModulesCache), 3214 ErrorBoundary: entryRoute.hasErrorBoundary, 3215 CatchBoundary: entryRoute.hasCatchBoundary, 3216 hasLoader: entryRoute.hasLoader 3217 }; 3218} 3219function createClientRoutes(routeManifest, routeModulesCache, Component2, parentId) { 3220 return Object.keys(routeManifest).filter((key) => routeManifest[key].parentId === parentId).map((key) => { 3221 let route = createClientRoute(routeManifest[key], routeModulesCache, Component2); 3222 let children = createClientRoutes(routeManifest, routeModulesCache, Component2, route.id); 3223 if (children.length > 0) 3224 route.children = children; 3225 return route; 3226 }); 3227} 3228function createShouldReload(route, routeModules) { 3229 let shouldReload = (arg) => { 3230 let module = routeModules[route.id]; 3231 invariant2(module, `Expected route module to be loaded for ${route.id}`); 3232 if (module.unstable_shouldReload) { 3233 return module.unstable_shouldReload(arg); 3234 } 3235 return true; 3236 }; 3237 return shouldReload; 3238} 3239async function loadRouteModuleWithBlockingLinks(route, routeModules) { 3240 let routeModule = await loadRouteModule(route, routeModules); 3241 await prefetchStyleLinks(routeModule); 3242 return routeModule; 3243} 3244function createLoader(route, routeModules) { 3245 let loader = async ({ 3246 url, 3247 signal, 3248 submission 3249 }) => { 3250 if (route.hasLoader) { 3251 let [result] = await Promise.all([fetchData(url, route.id, signal, submission), loadRouteModuleWithBlockingLinks(route, routeModules)]); 3252 if (result instanceof Error) 3253 throw result; 3254 let redirect2 = await checkRedirect(result); 3255 if (redirect2) 3256 return redirect2; 3257 if (isCatchResponse(result)) { 3258 throw new CatchValue(result.status, result.statusText, await extractData(result)); 3259 } 3260 return extractData(result); 3261 } else { 3262 await loadRouteModuleWithBlockingLinks(route, routeModules); 3263 } 3264 }; 3265 return loader; 3266} 3267function createAction(route, routeModules) { 3268 let action = async ({ 3269 url, 3270 signal, 3271 submission 3272 }) => { 3273 if (!route.hasAction) { 3274 console.error(`Route "${route.id}" does not have an action, but you are trying to submit to it. To fix this, please add an \`action\` function to the route`); 3275 } 3276 let result = await fetchData(url, route.id, signal, submission); 3277 if (result instanceof Error) { 3278 throw result; 3279 } 3280 let redirect2 = await checkRedirect(result); 3281 if (redirect2) 3282 return redirect2; 3283 await loadRouteModuleWithBlockingLinks(route, routeModules); 3284 if (isCatchResponse(result)) { 3285 throw new CatchValue(result.status, result.statusText, await extractData(result)); 3286 } 3287 return extractData(result); 3288 }; 3289 return action; 3290} 3291async function checkRedirect(response) { 3292 if (isRedirectResponse(response)) { 3293 let url = new URL(response.headers.get("X-Remix-Redirect"), window.location.origin); 3294 if (url.origin !== window.location.origin) { 3295 await new Promise(() => { 3296 window.location.replace(url.href); 3297 }); 3298 } else { 3299 return new TransitionRedirect(url.pathname + url.search + url.hash, response.headers.get("X-Remix-Revalidate") !== null); 3300 } 3301 } 3302 return null; 3303} 3304var React4; 3305var init_routes = __esm({ 3306 "node_modules/@remix-run/react/dist/esm/routes.js"() { 3307 init_react(); 3308 React4 = __toESM(require_react()); 3309 init_routeModules(); 3310 init_data(); 3311 init_transition(); 3312 init_links(); 3313 init_invariant(); 3314 } 3315}); 3316
vendor: 27,898 bytes, lines 3317-4157
3317// node_modules/@remix-run/react/dist/esm/components.js 3318function useRemixEntryContext() { 3319 let context = React5.useContext(RemixEntryContext); 3320 invariant2(context, "You must render this element inside a <Remix> element"); 3321 return context; 3322} 3323function RemixEntry({ 3324 context: entryContext, 3325 action, 3326 location: historyLocation, 3327 navigator: _navigator, 3328 static: staticProp = false 3329}) { 3330 let { 3331 manifest, 3332 routeData: documentLoaderData, 3333 actionData: documentActionData, 3334 routeModules, 3335 serverHandoffString, 3336 appState: entryComponentDidCatchEmulator 3337 } = entryContext; 3338 let clientRoutes = React5.useMemo(() => createClientRoutes(manifest.routes, routeModules, RemixRoute), [manifest, routeModules]); 3339 let [clientState, setClientState] = React5.useState(entryComponentDidCatchEmulator); 3340 let [transitionManager] = React5.useState(() => { 3341 return createTransitionManager({ 3342 routes: clientRoutes, 3343 actionData: documentActionData, 3344 loaderData: documentLoaderData, 3345 location: historyLocation, 3346 catch: entryComponentDidCatchEmulator.catch, 3347 catchBoundaryId: entryComponentDidCatchEmulator.catchBoundaryRouteId, 3348 onRedirect: _navigator.replace 3349 }); 3350 }); 3351 React5.useEffect(() => { 3352 let subscriber = (state) => { 3353 setClientState({ 3354 catch: state.catch, 3355 error: state.error, 3356 catchBoundaryRouteId: state.catchBoundaryId, 3357 loaderBoundaryRouteId: state.errorBoundaryId, 3358 renderBoundaryRouteId: null, 3359 trackBoundaries: false, 3360 trackCatchBoundaries: false 3361 }); 3362 }; 3363 return transitionManager.subscribe(subscriber); 3364 }, [transitionManager]); 3365 let navigator = React5.useMemo(() => { 3366 let push = (to, state) => { 3367 return transitionManager.getState().transition.state !== "idle" ? _navigator.replace(to, state) : _navigator.push(to, state); 3368 }; 3369 return { 3370 ..._navigator, 3371 push 3372 }; 3373 }, [_navigator, transitionManager]); 3374 let { 3375 location, 3376 matches, 3377 loaderData, 3378 actionData 3379 } = transitionManager.getState(); 3380 React5.useEffect(() => { 3381 let { 3382 location: location2 3383 } = transitionManager.getState(); 3384 if (historyLocation === location2) 3385 return; 3386 transitionManager.send({ 3387 type: "navigation", 3388 location: historyLocation, 3389 submission: consumeNextNavigationSubmission(), 3390 action 3391 }); 3392 }, [transitionManager, historyLocation, action]); 3393 let ssrErrorBeforeRoutesRendered = clientState.error && clientState.renderBoundaryRouteId === null && clientState.loaderBoundaryRouteId === null ? deserializeError(clientState.error) : void 0; 3394 let ssrCatchBeforeRoutesRendered = clientState.catch && clientState.catchBoundaryRouteId === null ? clientState.catch : void 0; 3395 return /* @__PURE__ */ React5.createElement(RemixEntryContext.Provider, { 3396 value: { 3397 matches, 3398 manifest, 3399 appState: clientState, 3400 routeModules, 3401 serverHandoffString, 3402 clientRoutes, 3403 routeData: loaderData, 3404 actionData, 3405 transitionManager 3406 } 3407 }, /* @__PURE__ */ React5.createElement(RemixErrorBoundary, { 3408 location, 3409 component: RemixRootDefaultErrorBoundary, 3410 error: ssrErrorBeforeRoutesRendered 3411 }, /* @__PURE__ */ React5.createElement(RemixCatchBoundary, { 3412 location, 3413 component: RemixRootDefaultCatchBoundary, 3414 catch: ssrCatchBeforeRoutesRendered 3415 }, /* @__PURE__ */ React5.createElement(Router, { 3416 navigationType: action, 3417 location, 3418 navigator, 3419 static: staticProp 3420 }, /* @__PURE__ */ React5.createElement(Routes2, null))))); 3421} 3422function deserializeError(data) { 3423 let error = new Error(data.message); 3424 error.stack = data.stack; 3425 return error; 3426} 3427function Routes2() { 3428 let { 3429 clientRoutes 3430 } = useRemixEntryContext(); 3431 let element = useRoutes(clientRoutes) || clientRoutes[0].element; 3432 return element; 3433} 3434function useRemixRouteContext() { 3435 let context = React5.useContext(RemixRouteContext); 3436 invariant2(context, "You must render this element in a remix route element"); 3437 return context; 3438} 3439function DefaultRouteComponent({ 3440 id 3441}) { 3442 throw new Error(`Route "${id}" has no component! Please go add a \`default\` export in the route module file. 3443If you were trying to navigate or submit to a resource route, use \`<a>\` instead of \`<Link>\` or \`<Form reloadDocument>\`.`); 3444} 3445function RemixRoute({ 3446 id 3447}) { 3448 let location = useLocation(); 3449 let { 3450 routeData, 3451 routeModules, 3452 appState 3453 } = useRemixEntryContext(); 3454 invariant2(routeData, "Cannot initialize 'routeData'. This normally occurs when you have server code in your client modules.\nCheck this link for more details:\nhttps://remix.run/pages/gotchas#server-code-in-client-bundles"); 3455 invariant2(routeModules, "Cannot initialize 'routeModules'. This normally occurs when you have server code in your client modules.\nCheck this link for more details:\nhttps://remix.run/pages/gotchas#server-code-in-client-bundles"); 3456 let data = routeData[id]; 3457 let { 3458 default: Component2, 3459 CatchBoundary, 3460 ErrorBoundary 3461 } = routeModules[id]; 3462 let element = Component2 ? /* @__PURE__ */ React5.createElement(Component2, null) : /* @__PURE__ */ React5.createElement(DefaultRouteComponent, { 3463 id 3464 }); 3465 let context = { 3466 data, 3467 id 3468 }; 3469 if (CatchBoundary) { 3470 let maybeServerCaught = appState.catch && appState.catchBoundaryRouteId === id ? appState.catch : void 0; 3471 if (appState.trackCatchBoundaries) { 3472 appState.catchBoundaryRouteId = id; 3473 } 3474 context = maybeServerCaught ? { 3475 id, 3476 get data() { 3477 console.error("You cannot `useLoaderData` in a catch boundary."); 3478 return void 0; 3479 } 3480 } : { 3481 id, 3482 data 3483 }; 3484 element = /* @__PURE__ */ React5.createElement(RemixCatchBoundary, { 3485 location, 3486 component: CatchBoundary, 3487 catch: maybeServerCaught 3488 }, element); 3489 } 3490 if (ErrorBoundary) { 3491 let maybeServerRenderError = appState.error && (appState.renderBoundaryRouteId === id || appState.loaderBoundaryRouteId === id) ? deserializeError(appState.error) : void 0; 3492 if (appState.trackBoundaries) { 3493 appState.renderBoundaryRouteId = id; 3494 } 3495 context = maybeServerRenderError ? { 3496 id, 3497 get data() { 3498 console.error("You cannot `useLoaderData` in an error boundary."); 3499 return void 0; 3500 } 3501 } : { 3502 id, 3503 data 3504 }; 3505 element = /* @__PURE__ */ React5.createElement(RemixErrorBoundary, { 3506 location, 3507 component: ErrorBoundary, 3508 error: maybeServerRenderError 3509 }, element); 3510 } 3511 return /* @__PURE__ */ React5.createElement(RemixRouteContext.Provider, { 3512 value: context 3513 }, element); 3514} 3515function usePrefetchBehavior(prefetch, theirElementProps) { 3516 let [maybePrefetch, setMaybePrefetch] = React5.useState(false); 3517 let [shouldPrefetch, setShouldPrefetch] = React5.useState(false); 3518 let { 3519 onFocus, 3520 onBlur, 3521 onMouseEnter, 3522 onMouseLeave, 3523 onTouchStart 3524 } = theirElementProps; 3525 React5.useEffect(() => { 3526 if (prefetch === "render") { 3527 setShouldPrefetch(true); 3528 } 3529 }, [prefetch]); 3530 let setIntent = () => { 3531 if (prefetch === "intent") { 3532 setMaybePrefetch(true); 3533 } 3534 }; 3535 let cancelIntent = () => { 3536 if (prefetch === "intent") { 3537 setMaybePrefetch(false); 3538 setShouldPrefetch(false); 3539 } 3540 }; 3541 React5.useEffect(() => { 3542 if (maybePrefetch) { 3543 let id = setTimeout(() => { 3544 setShouldPrefetch(true); 3545 }, 100); 3546 return () => { 3547 clearTimeout(id); 3548 }; 3549 } 3550 }, [maybePrefetch]); 3551 return [shouldPrefetch, { 3552 onFocus: composeEventHandlers(onFocus, setIntent), 3553 onBlur: composeEventHandlers(onBlur, cancelIntent), 3554 onMouseEnter: composeEventHandlers(onMouseEnter, setIntent), 3555 onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent), 3556 onTouchStart: composeEventHandlers(onTouchStart, setIntent) 3557 }]; 3558} 3559function composeEventHandlers(theirHandler, ourHandler) { 3560 return (event) => { 3561 theirHandler && theirHandler(event); 3562 if (!event.defaultPrevented) { 3563 ourHandler(event); 3564 } 3565 }; 3566} 3567function Links() { 3568 let { 3569 matches, 3570 routeModules, 3571 manifest 3572 } = useRemixEntryContext(); 3573 let links = React5.useMemo(() => getLinksForMatches(matches, routeModules, manifest), [matches, routeModules, manifest]); 3574 return /* @__PURE__ */ React5.createElement(React5.Fragment, null, links.map((link) => { 3575 if (isPageLinkDescriptor(link)) { 3576 return /* @__PURE__ */ React5.createElement(PrefetchPageLinks, _extends2({ 3577 key: link.page 3578 }, link)); 3579 } 3580 let imageSrcSet = null; 3581 if ("useId" in React5) { 3582 if (link.imagesrcset) { 3583 link.imageSrcSet = imageSrcSet = link.imagesrcset; 3584 delete link.imagesrcset; 3585 } 3586 if (link.imagesizes) { 3587 link.imageSizes = link.imagesizes; 3588 delete link.imagesizes; 3589 } 3590 } else { 3591 if (link.imageSrcSet) { 3592 link.imagesrcset = imageSrcSet = link.imageSrcSet; 3593 delete link.imageSrcSet; 3594 } 3595 if (link.imageSizes) { 3596 link.imagesizes = link.imageSizes; 3597 delete link.imageSizes; 3598 } 3599 } 3600 return /* @__PURE__ */ React5.createElement("link", _extends2({ 3601 key: link.rel + (link.href || "") + (imageSrcSet || "") 3602 }, link)); 3603 })); 3604} 3605function PrefetchPageLinks({ 3606 page, 3607 ...dataLinkProps 3608}) { 3609 let { 3610 clientRoutes 3611 } = useRemixEntryContext(); 3612 let matches = React5.useMemo(() => matchClientRoutes(clientRoutes, page), [clientRoutes, page]); 3613 if (!matches) { 3614 console.warn(`Tried to prefetch ${page} but no routes matched.`); 3615 return null; 3616 } 3617 return /* @__PURE__ */ React5.createElement(PrefetchPageLinksImpl, _extends2({ 3618 page, 3619 matches 3620 }, dataLinkProps)); 3621} 3622function usePrefetchedStylesheets(matches) { 3623 let { 3624 routeModules 3625 } = useRemixEntryContext(); 3626 let [styleLinks, setStyleLinks] = React5.useState([]); 3627 React5.useEffect(() => { 3628 let interrupted = false; 3629 getStylesheetPrefetchLinks(matches, routeModules).then((links) => { 3630 if (!interrupted) 3631 setStyleLinks(links); 3632 }); 3633 return () => { 3634 interrupted = true; 3635 }; 3636 }, [matches, routeModules]); 3637 return styleLinks; 3638} 3639function PrefetchPageLinksImpl({ 3640 page, 3641 matches: nextMatches, 3642 ...linkProps 3643}) { 3644 let location = useLocation(); 3645 let { 3646 matches, 3647 manifest 3648 } = useRemixEntryContext(); 3649 let newMatchesForData = React5.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, location, "data"), [page, nextMatches, matches, location]); 3650 let newMatchesForAssets = React5.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, location, "assets"), [page, nextMatches, matches, location]); 3651 let dataHrefs = React5.useMemo(() => getDataLinkHrefs(page, newMatchesForData, manifest), [newMatchesForData, page, manifest]); 3652 let moduleHrefs = React5.useMemo(() => getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]); 3653 let styleLinks = usePrefetchedStylesheets(newMatchesForAssets); 3654 return /* @__PURE__ */ React5.createElement(React5.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React5.createElement("link", _extends2({ 3655 key: href, 3656 rel: "prefetch", 3657 as: "fetch", 3658 href 3659 }, linkProps))), moduleHrefs.map((href) => /* @__PURE__ */ React5.createElement("link", _extends2({ 3660 key: href, 3661 rel: "modulepreload", 3662 href 3663 }, linkProps))), styleLinks.map((link) => /* @__PURE__ */ React5.createElement("link", _extends2({ 3664 key: link.href 3665 }, link)))); 3666} 3667function Meta() { 3668 let { 3669 matches, 3670 routeData, 3671 routeModules 3672 } = useRemixEntryContext(); 3673 let location = useLocation(); 3674 let meta = {}; 3675 let parentsData = {}; 3676 for (let match of matches) { 3677 let routeId = match.route.id; 3678 let data = routeData[routeId]; 3679 let params = match.params; 3680 let routeModule = routeModules[routeId]; 3681 if (routeModule.meta) { 3682 let routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({ 3683 data, 3684 parentsData, 3685 params, 3686 location 3687 }) : routeModule.meta; 3688 Object.assign(meta, routeMeta); 3689 } 3690 parentsData[routeId] = data; 3691 } 3692 return /* @__PURE__ */ React5.createElement(React5.Fragment, null, Object.entries(meta).map(([name, value]) => { 3693 if (!value) { 3694 return null; 3695 } 3696 if (["charset", "charSet"].includes(name)) { 3697 return /* @__PURE__ */ React5.createElement("meta", { 3698 key: "charset", 3699 charSet: value 3700 }); 3701 } 3702 if (name === "title") { 3703 return /* @__PURE__ */ React5.createElement("title", { 3704 key: "title" 3705 }, String(value)); 3706 } 3707 let isOpenGraphTag = name.startsWith("og:"); 3708 return [value].flat().map((content) => { 3709 if (isOpenGraphTag) { 3710 return /* @__PURE__ */ React5.createElement("meta", { 3711 content, 3712 key: name + content, 3713 property: name 3714 }); 3715 } 3716 if (typeof content === "string") { 3717 return /* @__PURE__ */ React5.createElement("meta", { 3718 content, 3719 name, 3720 key: name + content 3721 }); 3722 } 3723 return /* @__PURE__ */ React5.createElement("meta", _extends2({ 3724 key: name + JSON.stringify(content) 3725 }, content)); 3726 }); 3727 })); 3728} 3729function Scripts(props) { 3730 let { 3731 manifest, 3732 matches, 3733 pendingLocation, 3734 clientRoutes, 3735 serverHandoffString 3736 } = useRemixEntryContext(); 3737 React5.useEffect(() => { 3738 isHydrated = true; 3739 }, []); 3740 let initialScripts = React5.useMemo(() => { 3741 let contextScript = serverHandoffString ? `window.__remixContext = ${serverHandoffString};` : ""; 3742 let routeModulesScript = `${matches.map((match, index) => `import * as route${index} from ${JSON.stringify(manifest.routes[match.route.id].module)};`).join("\n")} 3743window.__remixRouteModules = {${matches.map((match, index) => `${JSON.stringify(match.route.id)}:route${index}`).join(",")}};`; 3744 return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("script", _extends2({}, props, { 3745 suppressHydrationWarning: true, 3746 dangerouslySetInnerHTML: createHtml(contextScript) 3747 })), /* @__PURE__ */ React5.createElement("script", _extends2({}, props, { 3748 src: manifest.url 3749 })), /* @__PURE__ */ React5.createElement("script", _extends2({}, props, { 3750 dangerouslySetInnerHTML: createHtml(routeModulesScript), 3751 type: "module" 3752 })), /* @__PURE__ */ React5.createElement("script", _extends2({}, props, { 3753 src: manifest.entry.module, 3754 type: "module" 3755 }))); 3756 }, []); 3757 let nextMatches = React5.useMemo(() => { 3758 if (pendingLocation) { 3759 let matches2 = matchClientRoutes(clientRoutes, pendingLocation); 3760 invariant2(matches2, `No routes match path "${pendingLocation.pathname}"`); 3761 return matches2; 3762 } 3763 return []; 3764 }, [pendingLocation, clientRoutes]); 3765 let routePreloads = matches.concat(nextMatches).map((match) => { 3766 let route = manifest.routes[match.route.id]; 3767 return (route.imports || []).concat([route.module]); 3768 }).flat(1); 3769 let preloads = manifest.entry.imports.concat(routePreloads); 3770 return /* @__PURE__ */ React5.createElement(React5.Fragment, null, dedupe2(preloads).map((path) => /* @__PURE__ */ React5.createElement("link", { 3771 key: path, 3772 rel: "modulepreload", 3773 href: path, 3774 crossOrigin: props.crossOrigin 3775 })), isHydrated ? null : initialScripts); 3776} 3777function dedupe2(array) { 3778 return [...new Set(array)]; 3779} 3780function useFormAction2(action, method = "get") { 3781 let { 3782 id 3783 } = useRemixRouteContext(); 3784 let resolvedPath = useResolvedPath(action ?? "."); 3785 let location = useLocation(); 3786 let { 3787 search, 3788 hash 3789 } = resolvedPath; 3790 if (action == null) { 3791 search = location.search; 3792 hash = location.hash; 3793 } 3794 let isIndexRoute = id.endsWith("/index"); 3795 if ((action == null || action === ".") && isIndexRoute) { 3796 search = search ? search.replace(/^\?/, "?index&") : "?index"; 3797 } 3798 return createPath({ 3799 pathname: resolvedPath.pathname, 3800 search, 3801 hash 3802 }); 3803} 3804function useSubmit() { 3805 return useSubmitImpl2(); 3806} 3807function useSubmitImpl2(key) { 3808 let navigate = useNavigate(); 3809 let defaultAction = useFormAction2(); 3810 let { 3811 transitionManager 3812 } = useRemixEntryContext(); 3813 return React5.useCallback((target, options = {}) => { 3814 let method; 3815 let action; 3816 let encType; 3817 let formData; 3818 if (isFormElement2(target)) { 3819 let submissionTrigger = options.submissionTrigger; 3820 method = options.method || target.getAttribute("method") || defaultMethod2; 3821 action = options.action || target.getAttribute("action") || defaultAction; 3822 encType = options.encType || target.getAttribute("enctype") || defaultEncType2; 3823 formData = new FormData(target); 3824 if (submissionTrigger && submissionTrigger.name) { 3825 formData.append(submissionTrigger.name, submissionTrigger.value); 3826 } 3827 } else if (isButtonElement2(target) || isInputElement2(target) && (target.type === "submit" || target.type === "image")) { 3828 let form = target.form; 3829 if (form == null) { 3830 throw new Error(`Cannot submit a <button> without a <form>`); 3831 } 3832 method = options.method || target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod2; 3833 action = options.action || target.getAttribute("formaction") || form.getAttribute("action") || defaultAction; 3834 encType = options.encType || target.getAttribute("formenctype") || form.getAttribute("enctype") || defaultEncType2; 3835 formData = new FormData(form); 3836 if (target.name) { 3837 formData.append(target.name, target.value); 3838 } 3839 } else { 3840 if (isHtmlElement2(target)) { 3841 throw new Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`); 3842 } 3843 method = options.method || "get"; 3844 action = options.action || defaultAction; 3845 encType = options.encType || "application/x-www-form-urlencoded"; 3846 if (target instanceof FormData) { 3847 formData = target; 3848 } else { 3849 formData = new FormData(); 3850 if (target instanceof URLSearchParams) { 3851 for (let [name, value] of target) { 3852 formData.append(name, value); 3853 } 3854 } else if (target != null) { 3855 for (let name of Object.keys(target)) { 3856 formData.append(name, target[name]); 3857 } 3858 } 3859 } 3860 } 3861 if (typeof document === "undefined") { 3862 throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead."); 3863 } 3864 let { 3865 protocol, 3866 host 3867 } = window.location; 3868 let url = new URL(action, `${protocol}//${host}`); 3869 if (method.toLowerCase() === "get") { 3870 for (let [name, value] of formData) { 3871 if (typeof value === "string") { 3872 url.searchParams.append(name, value); 3873 } else { 3874 throw new Error(`Cannot submit binary form data using GET`); 3875 } 3876 } 3877 } 3878 let submission = { 3879 formData, 3880 action: url.pathname + url.search, 3881 method: method.toUpperCase(), 3882 encType, 3883 key: Math.random().toString(36).substr(2, 8) 3884 }; 3885 if (key) { 3886 transitionManager.send({ 3887 type: "fetcher", 3888 href: submission.action, 3889 submission, 3890 key 3891 }); 3892 } else { 3893 setNextNavigationSubmission(submission); 3894 navigate(url.pathname + url.search, { 3895 replace: options.replace 3896 }); 3897 } 3898 }, [defaultAction, key, navigate, transitionManager]); 3899} 3900function setNextNavigationSubmission(submission) { 3901 nextNavigationSubmission = submission; 3902} 3903function consumeNextNavigationSubmission() { 3904 let submission = nextNavigationSubmission; 3905 nextNavigationSubmission = void 0; 3906 return submission; 3907} 3908function isHtmlElement2(object) { 3909 return object != null && typeof object.tagName === "string"; 3910} 3911function isButtonElement2(object) { 3912 return isHtmlElement2(object) && object.tagName.toLowerCase() === "button"; 3913} 3914function isFormElement2(object) { 3915 return isHtmlElement2(object) && object.tagName.toLowerCase() === "form"; 3916} 3917function isInputElement2(object) { 3918 return isHtmlElement2(object) && object.tagName.toLowerCase() === "input"; 3919} 3920function useBeforeUnload2(callback) { 3921 React5.useEffect(() => { 3922 window.addEventListener("beforeunload", callback); 3923 return () => { 3924 window.removeEventListener("beforeunload", callback); 3925 }; 3926 }, [callback]); 3927} 3928function useMatches2() { 3929 let { 3930 matches, 3931 routeData, 3932 routeModules 3933 } = useRemixEntryContext(); 3934 return React5.useMemo(() => matches.map((match) => { 3935 var _routeModules$match$r; 3936 let { 3937 pathname, 3938 params 3939 } = match; 3940 return { 3941 id: match.route.id, 3942 pathname, 3943 params, 3944 data: routeData[match.route.id], 3945 handle: (_routeModules$match$r = routeModules[match.route.id]) === null || _routeModules$match$r === void 0 ? void 0 : _routeModules$match$r.handle 3946 }; 3947 }), [matches, routeData, routeModules]); 3948} 3949function useLoaderData2() { 3950 return useRemixRouteContext().data; 3951} 3952function useActionData2() { 3953 let { 3954 id: routeId 3955 } = useRemixRouteContext(); 3956 let { 3957 transitionManager 3958 } = useRemixEntryContext(); 3959 let { 3960 actionData 3961 } = transitionManager.getState(); 3962 return actionData ? actionData[routeId] : void 0; 3963} 3964function useTransition() { 3965 let { 3966 transitionManager 3967 } = useRemixEntryContext(); 3968 return transitionManager.getState().transition; 3969} 3970function createFetcherForm(fetchKey) { 3971 let FetcherForm = /* @__PURE__ */ React5.forwardRef((props, ref) => { 3972 return /* @__PURE__ */ React5.createElement(FormImpl2, _extends2({}, props, { 3973 ref, 3974 fetchKey 3975 })); 3976 }); 3977 FetcherForm.displayName = "fetcher.Form"; 3978 return FetcherForm; 3979} 3980function useFetcher() { 3981 let { 3982 transitionManager 3983 } = useRemixEntryContext(); 3984 let [key] = React5.useState(() => String(++fetcherId)); 3985 let [Form3] = React5.useState(() => createFetcherForm(key)); 3986 let [load] = React5.useState(() => (href) => { 3987 transitionManager.send({ 3988 type: "fetcher", 3989 href, 3990 key 3991 }); 3992 }); 3993 let submit = useSubmitImpl2(key); 3994 let fetcher = transitionManager.getFetcher(key); 3995 let fetcherWithComponents = React5.useMemo(() => ({ 3996 Form: Form3, 3997 submit, 3998 load, 3999 ...fetcher 4000 }), [fetcher, Form3, submit, load]); 4001 React5.useEffect(() => { 4002 return () => transitionManager.deleteFetcher(key); 4003 }, [transitionManager, key]); 4004 return fetcherWithComponents; 4005} 4006function useFetchers() { 4007 let { 4008 transitionManager 4009 } = useRemixEntryContext(); 4010 let { 4011 fetchers 4012 } = transitionManager.getState(); 4013 return [...fetchers.values()]; 4014} 4015var React5, RemixEntryContext, RemixRouteContext, NavLink2, Link2, isHydrated, Form2, FormImpl2, defaultMethod2, defaultEncType2, nextNavigationSubmission, fetcherId, LiveReload; 4016var init_components = __esm({ 4017 "node_modules/@remix-run/react/dist/esm/components.js"() { 4018 init_react(); 4019 init_rollupPluginBabelHelpers(); 4020 React5 = __toESM(require_react()); 4021 init_dist2(); 4022 init_history(); 4023 init_errorBoundaries(); 4024 init_invariant(); 4025 init_links(); 4026 init_markup(); 4027 init_routes(); 4028 init_routeMatching(); 4029 init_transition(); 4030 RemixEntryContext = /* @__PURE__ */ React5.createContext(void 0); 4031 RemixRouteContext = /* @__PURE__ */ React5.createContext(void 0); 4032 NavLink2 = /* @__PURE__ */ React5.forwardRef(({ 4033 to, 4034 prefetch = "none", 4035 ...props 4036 }, forwardedRef) => { 4037 let href = useHref(to); 4038 let [shouldPrefetch, prefetchHandlers] = usePrefetchBehavior(prefetch, props); 4039 return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(NavLink, _extends2({ 4040 ref: forwardedRef, 4041 to 4042 }, props, prefetchHandlers)), shouldPrefetch ? /* @__PURE__ */ React5.createElement(PrefetchPageLinks, { 4043 page: href 4044 }) : null); 4045 }); 4046 NavLink2.displayName = "NavLink"; 4047 Link2 = /* @__PURE__ */ React5.forwardRef(({ 4048 to, 4049 prefetch = "none", 4050 ...props 4051 }, forwardedRef) => { 4052 let href = useHref(to); 4053 let [shouldPrefetch, prefetchHandlers] = usePrefetchBehavior(prefetch, props); 4054 return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Link, _extends2({ 4055 ref: forwardedRef, 4056 to 4057 }, props, prefetchHandlers)), shouldPrefetch ? /* @__PURE__ */ React5.createElement(PrefetchPageLinks, { 4058 page: href 4059 }) : null); 4060 }); 4061 Link2.displayName = "Link"; 4062 isHydrated = false; 4063 Form2 = /* @__PURE__ */ React5.forwardRef((props, ref) => { 4064 return /* @__PURE__ */ React5.createElement(FormImpl2, _extends2({}, props, { 4065 ref 4066 })); 4067 }); 4068 Form2.displayName = "Form"; 4069 FormImpl2 = /* @__PURE__ */ React5.forwardRef(({ 4070 reloadDocument = false, 4071 replace = false, 4072 method = "get", 4073 action, 4074 encType = "application/x-www-form-urlencoded", 4075 fetchKey, 4076 onSubmit, 4077 ...props 4078 }, forwardedRef) => { 4079 let submit = useSubmitImpl2(fetchKey); 4080 let formMethod = method.toLowerCase() === "get" ? "get" : "post"; 4081 let formAction = useFormAction2(action); 4082 return /* @__PURE__ */ React5.createElement("form", _extends2({ 4083 ref: forwardedRef, 4084 method: formMethod, 4085 action: formAction, 4086 encType, 4087 onSubmit: reloadDocument ? void 0 : (event) => { 4088 onSubmit && onSubmit(event); 4089 if (event.defaultPrevented) 4090 return; 4091 event.preventDefault(); 4092 let submitter = event.nativeEvent.submitter; 4093 submit(submitter || event.currentTarget, { 4094 method, 4095 replace 4096 }); 4097 } 4098 }, props)); 4099 }); 4100 FormImpl2.displayName = "FormImpl"; 4101 defaultMethod2 = "get"; 4102 defaultEncType2 = "application/x-www-form-urlencoded"; 4103 fetcherId = 0; 4104 LiveReload = false ? () => null : function LiveReload2({ 4105 port = Number(8002), 4106 nonce = void 0 4107 }) { 4108 let js = String.raw; 4109 return /* @__PURE__ */ React5.createElement("script", { 4110 nonce, 4111 suppressHydrationWarning: true, 4112 dangerouslySetInnerHTML: { 4113 __html: js` 4114 function remixLiveReloadConnect(config) { 4115 let protocol = location.protocol === "https:" ? "wss:" : "ws:"; 4116 let host = location.hostname; 4117 let socketPath = protocol + "//" + host + ":" + ${String(port)} + "/socket"; 4118 4119 let ws = new WebSocket(socketPath); 4120 ws.onmessage = (message) => { 4121 let event = JSON.parse(message.data); 4122 if (event.type === "LOG") { 4123 console.log(event.message); 4124 } 4125 if (event.type === "RELOAD") { 4126 console.log("ð¿ Reloading window ..."); 4127 window.location.reload(); 4128 } 4129 }; 4130 ws.onopen = () => { 4131 if (config && typeof config.onOpen === "function") { 4132 config.onOpen(); 4133 } 4134 }; 4135 ws.onclose = (error) => { 4136 console.log("Remix dev asset server web socket closed. Reconnecting..."); 4137 setTimeout( 4138 () => 4139 remixLiveReloadConnect({ 4140 onOpen: () => window.location.reload(), 4141 }), 4142 1000 4143 ); 4144 }; 4145 ws.onerror = (error) => { 4146 console.log("Remix dev asset server web socket error:"); 4147 console.error(error); 4148 }; 4149 } 4150 remixLiveReloadConnect(); 4151 ` 4152 } 4153 }); 4154 }; 4155 } 4156}); 4157
vendor: 1,104 bytes, lines 4158-4193
4158// node_modules/@remix-run/react/dist/esm/browser.js 4159function RemixBrowser(_props) { 4160 let historyRef = React6.useRef(); 4161 if (historyRef.current == null) { 4162 historyRef.current = createBrowserHistory({ 4163 window 4164 }); 4165 } 4166 let history = historyRef.current; 4167 let [state, dispatch] = React6.useReducer((_, update) => update, { 4168 action: history.action, 4169 location: history.location 4170 }); 4171 React6.useLayoutEffect(() => history.listen(dispatch), [history]); 4172 let entryContext = window.__remixContext; 4173 entryContext.manifest = window.__remixManifest; 4174 entryContext.routeModules = window.__remixRouteModules; 4175 entryContext.appState.trackBoundaries = false; 4176 entryContext.appState.trackCatchBoundaries = false; 4177 return /* @__PURE__ */ React6.createElement(RemixEntry, { 4178 context: entryContext, 4179 action: state.action, 4180 location: state.location, 4181 navigator: history 4182 }); 4183} 4184var React6; 4185var init_browser = __esm({ 4186 "node_modules/@remix-run/react/dist/esm/browser.js"() { 4187 init_react(); 4188 init_history(); 4189 React6 = __toESM(require_react()); 4190 init_components(); 4191 } 4192}); 4193
vendor: 2,947 bytes, lines 4194-4297
4194// node_modules/@remix-run/react/dist/esm/scroll-restoration.js 4195function ScrollRestoration2({ 4196 nonce = void 0 4197}) { 4198 useScrollRestoration2(); 4199 React7.useEffect(() => { 4200 window.history.scrollRestoration = "manual"; 4201 }, []); 4202 useBeforeUnload2(React7.useCallback(() => { 4203 window.history.scrollRestoration = "auto"; 4204 }, [])); 4205 let restoreScroll = ((STORAGE_KEY2) => { 4206 if (!window.history.state || !window.history.state.key) { 4207 let key = Math.random().toString(32).slice(2); 4208 window.history.replaceState({ 4209 key 4210 }, ""); 4211 } 4212 try { 4213 let positions2 = JSON.parse(sessionStorage.getItem(STORAGE_KEY2) || "{}"); 4214 let storedY = positions2[window.history.state.key]; 4215 if (typeof storedY === "number") { 4216 window.scrollTo(0, storedY); 4217 } 4218 } catch (error) { 4219 console.error(error); 4220 sessionStorage.removeItem(STORAGE_KEY2); 4221 } 4222 }).toString(); 4223 return /* @__PURE__ */ React7.createElement("script", { 4224 nonce, 4225 suppressHydrationWarning: true, 4226 dangerouslySetInnerHTML: { 4227 __html: `(${restoreScroll})(${JSON.stringify(STORAGE_KEY)})` 4228 } 4229 }); 4230} 4231function useScrollRestoration2() { 4232 let location = useLocation(); 4233 let transition = useTransition(); 4234 let wasSubmissionRef = React7.useRef(false); 4235 React7.useEffect(() => { 4236 if (transition.submission) { 4237 wasSubmissionRef.current = true; 4238 } 4239 }, [transition]); 4240 React7.useEffect(() => { 4241 if (transition.location) { 4242 positions[location.key] = window.scrollY; 4243 } 4244 }, [transition, location]); 4245 useBeforeUnload2(React7.useCallback(() => { 4246 sessionStorage.setItem(STORAGE_KEY, JSON.stringify(positions)); 4247 }, [])); 4248 if (typeof document !== "undefined") { 4249 React7.useLayoutEffect(() => { 4250 if (!hydrated) { 4251 hydrated = true; 4252 return; 4253 } 4254 let y = positions[location.key]; 4255 if (y != void 0) { 4256 window.scrollTo(0, y); 4257 return; 4258 } 4259 if (location.hash) { 4260 let el = document.getElementById(location.hash.slice(1)); 4261 if (el) { 4262 el.scrollIntoView(); 4263 return; 4264 } 4265 } 4266 if (wasSubmissionRef.current === true) { 4267 wasSubmissionRef.current = false; 4268 return; 4269 } 4270 window.scrollTo(0, 0); 4271 }, [location]); 4272 } 4273 React7.useEffect(() => { 4274 if (transition.submission) { 4275 wasSubmissionRef.current = true; 4276 } 4277 }, [transition]); 4278} 4279var React7, STORAGE_KEY, positions, hydrated; 4280var init_scroll_restoration = __esm({ 4281 "node_modules/@remix-run/react/dist/esm/scroll-restoration.js"() { 4282 init_react(); 4283 React7 = __toESM(require_react()); 4284 init_dist2(); 4285 init_components(); 4286 STORAGE_KEY = "positions"; 4287 positions = {}; 4288 if (typeof document !== "undefined") { 4289 let sessionPositions = sessionStorage.getItem(STORAGE_KEY); 4290 if (sessionPositions) { 4291 positions = JSON.parse(sessionPositions); 4292 } 4293 } 4294 hydrated = false; 4295 } 4296}); 4297
vendor: 1,908 bytes, lines 4298-4353
4298// node_modules/@remix-run/react/dist/esm/server.js 4299function RemixServer({ 4300 context, 4301 url 4302}) { 4303 if (typeof url === "string") { 4304 url = new URL(url); 4305 } 4306 let location = { 4307 pathname: url.pathname, 4308 search: url.search, 4309 hash: "", 4310 state: null, 4311 key: "default" 4312 }; 4313 let staticNavigator = { 4314 createHref(to) { 4315 return typeof to === "string" ? to : createPath(to); 4316 }, 4317 push(to) { 4318 throw new Error(`You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.`); 4319 }, 4320 replace(to) { 4321 throw new Error(`You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.`); 4322 }, 4323 go(delta) { 4324 throw new Error(`You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.`); 4325 }, 4326 back() { 4327 throw new Error(`You cannot use navigator.back() on the server because it is a stateless environment.`); 4328 }, 4329 forward() { 4330 throw new Error(`You cannot use navigator.forward() on the server because it is a stateless environment.`); 4331 }, 4332 block() { 4333 throw new Error(`You cannot use navigator.block() on the server because it is a stateless environment.`); 4334 } 4335 }; 4336 return /* @__PURE__ */ React8.createElement(RemixEntry, { 4337 context, 4338 action: Action.Pop, 4339 location, 4340 navigator: staticNavigator, 4341 static: true 4342 }); 4343} 4344var React8; 4345var init_server = __esm({ 4346 "node_modules/@remix-run/react/dist/esm/server.js"() { 4347 init_react(); 4348 init_history(); 4349 React8 = __toESM(require_react()); 4350 init_components(); 4351 } 4352}); 4353
vendor: 2,787 bytes, lines 4354-4468
4354// node_modules/@remix-run/react/dist/esm/index.js 4355var esm_exports = {}; 4356__export(esm_exports, { 4357 Form: () => Form2, 4358 Link: () => Link2, 4359 Links: () => Links, 4360 LiveReload: () => LiveReload, 4361 Meta: () => Meta, 4362 NavLink: () => NavLink2, 4363 Outlet: () => Outlet, 4364 PrefetchPageLinks: () => PrefetchPageLinks, 4365 RemixBrowser: () => RemixBrowser, 4366 RemixServer: () => RemixServer, 4367 Scripts: () => Scripts, 4368 ScrollRestoration: () => ScrollRestoration2, 4369 useActionData: () => useActionData2, 4370 useBeforeUnload: () => useBeforeUnload2, 4371 useCatch: () => useCatch, 4372 useFetcher: () => useFetcher, 4373 useFetchers: () => useFetchers, 4374 useFormAction: () => useFormAction2, 4375 useHref: () => useHref, 4376 useLoaderData: () => useLoaderData2, 4377 useLocation: () => useLocation, 4378 useMatches: () => useMatches2, 4379 useNavigate: () => useNavigate, 4380 useNavigationType: () => useNavigationType, 4381 useOutlet: () => useOutlet, 4382 useOutletContext: () => useOutletContext, 4383 useParams: () => useParams, 4384 useResolvedPath: () => useResolvedPath, 4385 useSearchParams: () => useSearchParams, 4386 useSubmit: () => useSubmit, 4387 useTransition: () => useTransition 4388}); 4389var init_esm = __esm({ 4390 "node_modules/@remix-run/react/dist/esm/index.js"() { 4391 init_react(); 4392 init_browser(); 4393 init_dist2(); 4394 init_components(); 4395 init_errorBoundaries(); 4396 init_scroll_restoration(); 4397 init_server(); 4398 } 4399}); 4400 4401export { 4402 _extends, 4403 init_extends, 4404 useLocation, 4405 useNavigate, 4406 useOutletContext, 4407 useParams, 4408 Outlet, 4409 useSearchParams, 4410 useCatch, 4411 Link2 as Link, 4412 Links, 4413 Meta, 4414 Scripts, 4415 Form2 as Form, 4416 useSubmit, 4417 useBeforeUnload2 as useBeforeUnload, 4418 useMatches2 as useMatches, 4419 useLoaderData2 as useLoaderData, 4420 useActionData2 as useActionData, 4421 useTransition, 4422 useFetcher, 4423 LiveReload, 4424 RemixBrowser, 4425 esm_exports, 4426 init_esm 4427}; 4428/** 4429 * @remix-run/react v1.6.8 4430 * 4431 * Copyright (c) Remix Software Inc. 4432 * 4433 * This source code is licensed under the MIT license found in the 4434 * LICENSE.md file in the root directory of this source tree. 4435 * 4436 * @license MIT 4437 */ 4438/** 4439 * @remix-run/router v1.3.0 4440 * 4441 * Copyright (c) Remix Software Inc. 4442 * 4443 * This source code is licensed under the MIT license found in the 4444 * LICENSE.md file in the root directory of this source tree. 4445 * 4446 * @license MIT 4447 */ 4448/** 4449 * React Router DOM v6.7.0 4450 * 4451 * Copyright (c) Remix Software Inc. 4452 * 4453 * This source code is licensed under the MIT license found in the 4454 * LICENSE.md file in the root directory of this source tree. 4455 * 4456 * @license MIT 4457 */ 4458/** 4459 * React Router v6.7.0 4460 * 4461 * Copyright (c) Remix Software Inc. 4462 * 4463 * This source code is licensed under the MIT license found in the 4464 * LICENSE.md file in the root directory of this source tree. 4465 * 4466 * @license MIT 4467 */ 4468//# sourceMappingURL=/build/_shared/chunk-46RNFGVL.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.