1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="3913097b-699d-9563-f773-d5cecf627785")}catch(e){}}(); 2(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([typeof document === "object" ? document.currentScript : undefined, 3491915, ((__turbopack_context__, module, exports) => { 4"use strict"; 5 6var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 7"use strict"; 8Object.defineProperty(exports, "__esModule", { 9 value: true 10}); 11Object.defineProperty(exports, "disableSmoothScrollDuringRouteTransition", { 12 enumerable: true, 13 get: function() { 14 return disableSmoothScrollDuringRouteTransition; 15 } 16}); 17const _warnonce = __turbopack_context__.r(233525); 18function disableSmoothScrollDuringRouteTransition(fn) { 19 let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 20 // if only the hash is changed, we don't need to disable smooth scrolling 21 // we only care to prevent smooth scrolling when navigating to a new page to avoid jarring UX 22 if (options.onlyHashChange) { 23 fn(); 24 return; 25 } 26 const htmlElement = document.documentElement; 27 const hasDataAttribute = htmlElement.dataset.scrollBehavior === 'smooth'; 28 if (!hasDataAttribute) { 29 // Warn if smooth scrolling is detected but no data attribute is present 30 if (("TURBOPACK compile-time value", "production") === 'development' && getComputedStyle(htmlElement).scrollBehavior === 'smooth') //TURBOPACK unreachable 31 ; 32 // No smooth scrolling configured, run directly without style manipulation 33 fn(); 34 return; 35 } 36 // Proceed with temporarily disabling smooth scrolling 37 const existing = htmlElement.style.scrollBehavior; 38 htmlElement.style.scrollBehavior = 'auto'; 39 if (!options.dontForceLayout) { 40 // In Chrome-based browsers we need to force reflow before calling `scrollTo`. 41 // Otherwise it will not pickup the change in scrollBehavior 42 // More info here: https://github.com/vercel/next.js/issues/40719#issuecomment-1336248042 43 htmlElement.getClientRects(); 44 } 45 fn(); 46 htmlElement.style.scrollBehavior = existing; 47} 48}), 49768017, ((__turbopack_context__, module, exports) => { 50"use strict"; 51 52var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 53'use client'; 54"use strict"; 55Object.defineProperty(exports, "__esModule", { 56 value: true 57}); 58Object.defineProperty(exports, "HTTPAccessFallbackBoundary", { 59 enumerable: true, 60 get: function() { 61 return HTTPAccessFallbackBoundary; 62 } 63}); 64const _interop_require_wildcard = __turbopack_context__.r(151836); 65const _jsxruntime = __turbopack_context__.r(843476); 66const _react = /*#__PURE__*/ _interop_require_wildcard._(__turbopack_context__.r(271645)); 67const _navigationuntracked = __turbopack_context__.r(590373); 68const _httpaccessfallback = __turbopack_context__.r(754394); 69const _warnonce = __turbopack_context__.r(233525); 70const _approutercontextsharedruntime = __turbopack_context__.r(8372); 71class HTTPAccessFallbackErrorBoundary extends _react.default.Component { 72 componentDidCatch() { 73 if (("TURBOPACK compile-time value", "production") === 'development' && this.props.missingSlots && this.props.missingSlots.size > 0 && // A missing children slot is the typical not-found case, so no need to warn 74 !this.props.missingSlots.has('children')) //TURBOPACK unreachable 75 ; 76 } 77 static getDerivedStateFromError(error) { 78 if ((0, _httpaccessfallback.isHTTPAccessFallbackError)(error)) { 79 const httpStatus = (0, _httpaccessfallback.getAccessFallbackHTTPStatus)(error); 80 return { 81 triggeredStatus: httpStatus 82 }; 83 } 84 // Re-throw if error is not for 404 85 throw error; 86 } 87 static getDerivedStateFromProps(props, state) { 88 /** 89 * Handles reset of the error boundary when a navigation happens. 90 * Ensures the error boundary does not stay enabled when navigating to a new page. 91 * Approach of setState in render is safe as it checks the previous pathname and then overrides 92 * it as outlined in https://react.dev/reference/react/useState#storing-information-from-previous-renders 93 */ if (props.pathname !== state.previousPathname && state.triggeredStatus) { 94 return { 95 triggeredStatus: undefined, 96 previousPathname: props.pathname 97 }; 98 } 99 return { 100 triggeredStatus: state.triggeredStatus, 101 previousPathname: props.pathname 102 }; 103 } 104 render() { 105 const { notFound, forbidden, unauthorized, children } = this.props; 106 const { triggeredStatus } = this.state; 107 const errorComponents = { 108 [_httpaccessfallback.HTTPAccessErrorStatus.NOT_FOUND]: notFound, 109 [_httpaccessfallback.HTTPAccessErrorStatus.FORBIDDEN]: forbidden, 110 [_httpaccessfallback.HTTPAccessErrorStatus.UNAUTHORIZED]: unauthorized 111 }; 112 if (triggeredStatus) { 113 const isNotFound = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.NOT_FOUND && notFound; 114 const isForbidden = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.FORBIDDEN && forbidden; 115 const isUnauthorized = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.UNAUTHORIZED && unauthorized;
116 // If there's no matched boundary in this layer, keep throwing the error by rendering the children 117 if (!(isNotFound || isForbidden || isUnauthorized)) { 118 return children; 119 } 120 return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, { 121 children: [ 122 /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { 123 name: "robots", 124 content: "noindex" 125 }), 126 ("TURBOPACK compile-time value", "production") === 'development' && /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { 127 name: "boundary-next-error", 128 content: (0, _httpaccessfallback.getAccessFallbackErrorTypeByStatus)(triggeredStatus) 129 }), 130 errorComponents[triggeredStatus] 131 ] 132 }); 133 } 134 return children; 135 } 136 constructor(props){ 137 super(props); 138 this.state = { 139 triggeredStatus: undefined, 140 previousPathname: props.pathname 141 }; 142 } 143} 144function HTTPAccessFallbackBoundary(param) { 145 let { notFound, forbidden, unauthorized, children } = param; 146 // When we're rendering the missing params shell, this will return null. This 147 // is because we won't be rendering any not found boundaries or error 148 // boundaries for the missing params shell. When this runs on the client 149 // (where these error can occur), we will get the correct pathname. 150 const pathname = (0, _navigationuntracked.useUntrackedPathname)(); 151 const missingSlots = (0, _react.useContext)(_approutercontextsharedruntime.MissingSlotContext); 152 const hasErrorFallback = !!(notFound || forbidden || unauthorized); 153 if (hasErrorFallback) { 154 return /*#__PURE__*/ (0, _jsxruntime.jsx)(HTTPAccessFallbackErrorBoundary, { 155 pathname: pathname, 156 notFound: notFound, 157 forbidden: forbidden, 158 unauthorized: unauthorized, 159 missingSlots: missingSlots, 160 children: children 161 }); 162 } 163 return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { 164 children: children 165 }); 166} 167if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 168 Object.defineProperty(exports.default, '__esModule', { 169 value: true 170 }); 171 Object.assign(exports.default, exports); 172 module.exports = exports.default; 173} 174}), 175728298, ((__turbopack_context__, module, exports) => { 176"use strict"; 177 178var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 179"use strict"; 180Object.defineProperty(exports, "__esModule", { 181 value: true 182}); 183Object.defineProperty(exports, "useRouterBFCache", { 184 enumerable: true, 185 get: function() { 186 return useRouterBFCache; 187 } 188}); 189const _react = __turbopack_context__.r(271645); 190// When the flag is disabled, only track the currently active tree 191const MAX_BF_CACHE_ENTRIES = ("TURBOPACK compile-time falsy", 0) ? "TURBOPACK unreachable" : 1; 192function useRouterBFCache(activeTree, activeCacheNode, activeStateKey) { 193 // The currently active entry. The entries form a linked list, sorted in 194 // order of most recently active. This allows us to reuse parts of the list 195 // without cloning, unless there's a reordering or removal. 196 // TODO: Once we start tracking back/forward history at each route level, 197 // we should use the history order instead. In other words, when traversing 198 // to an existing entry as a result of a popstate event, we should maintain 199 // the existing order instead of moving it to the front of the list. I think 200 // an initial implementation of this could be to pass an incrementing id 201 // to history.pushState/replaceState, then use that here for ordering. 202 const [prevActiveEntry, setPrevActiveEntry] = (0, _react.useState)(()=>{ 203 const initialEntry = { 204 tree: activeTree, 205 cacheNode: activeCacheNode, 206 stateKey: activeStateKey, 207 next: null 208 }; 209 return initialEntry; 210 }); 211 if (prevActiveEntry.tree === activeTree) { 212 // Fast path. The active tree hasn't changed, so we can reuse the 213 // existing state. 214 return prevActiveEntry; 215 } 216 // The route tree changed. Note that this doesn't mean that the tree changed 217 // *at this level* â the change may be due to a child route. Either way, we 218 // need to either add or update the router tree in the bfcache. 219 // 220 // The rest of the code looks more complicated than it actually is because we 221 // can't mutate the state in place; we have to copy-on-write. 222 // Create a new entry for the active cache key. This is the head of the new 223 // linked list. 224 const newActiveEntry = { 225 tree: activeTree, 226 cacheNode: activeCacheNode, 227 stateKey: activeStateKey, 228 next: null 229 }; 230 // We need to append the old list onto the new list. If the head of the new 231 // list was already present in the cache, then we'll need to clone everything 232 // that came before it. Then we can reuse the rest. 233 let n = 1; 234 let oldEntry = prevActiveEntry;
235 let clonedEntry = newActiveEntry; 236 while(oldEntry !== null && n < MAX_BF_CACHE_ENTRIES){ 237 if (oldEntry.stateKey === activeStateKey) { 238 // Fast path. This entry in the old list that corresponds to the key that 239 // is now active. We've already placed a clone of this entry at the front 240 // of the new list. We can reuse the rest of the old list without cloning. 241 // NOTE: We don't need to worry about eviction in this case because we 242 // haven't increased the size of the cache, and we assume the max size 243 // is constant across renders. If we were to change it to a dynamic limit, 244 // then the implementation would need to account for that. 245 clonedEntry.next = oldEntry.next; 246 break; 247 } else { 248 // Clone the entry and append it to the list. 249 n++; 250 const entry = { 251 tree: oldEntry.tree, 252 cacheNode: oldEntry.cacheNode, 253 stateKey: oldEntry.stateKey, 254 next: null 255 }; 256 clonedEntry.next = entry; 257 clonedEntry = entry; 258 } 259 oldEntry = oldEntry.next; 260 } 261 setPrevActiveEntry(newActiveEntry); 262 return newActiveEntry; 263} 264if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 265 Object.defineProperty(exports.default, '__esModule', { 266 value: true 267 }); 268 Object.assign(exports.default, exports); 269 module.exports = exports.default; 270} 271}), 272339756, ((__turbopack_context__, module, exports) => { 273"use strict"; 274 275var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 276'use client'; 277"use strict"; 278Object.defineProperty(exports, "__esModule", { 279 value: true 280}); 2810 && (module.exports = { 282 LoadingBoundaryProvider: null, 283 default: null 284}); 285function _export(target, all) { 286 for(var name in all)Object.defineProperty(target, name, { 287 enumerable: true, 288 get: all[name] 289 }); 290} 291_export(exports, { 292 LoadingBoundaryProvider: function() { 293 return LoadingBoundaryProvider; 294 }, 295 /** 296 * OuterLayoutRouter handles the current segment as well as <Offscreen> rendering of other segments. 297 * It can be rendered next to each other with a different `parallelRouterKey`, allowing for Parallel routes. 298 */ default: function() { 299 return OuterLayoutRouter; 300 } 301}); 302const _interop_require_default = __turbopack_context__.r(563141); 303const _interop_require_wildcard = __turbopack_context__.r(151836); 304const _jsxruntime = __turbopack_context__.r(843476); 305const _react = /*#__PURE__*/ _interop_require_wildcard._(__turbopack_context__.r(271645)); 306const _reactdom = /*#__PURE__*/ _interop_require_default._(__turbopack_context__.r(174080)); 307const _approutercontextsharedruntime = __turbopack_context__.r(8372); 308const _unresolvedthenable = __turbopack_context__.r(201244); 309const _errorboundary = __turbopack_context__.r(972383); 310const _disablesmoothscroll = __turbopack_context__.r(491915); 311const _redirectboundary = __turbopack_context__.r(358442); 312const _errorboundary1 = __turbopack_context__.r(768017); 313const _createroutercachekey = __turbopack_context__.r(270725); 314const _bfcachestatemanager = __turbopack_context__.r(728298); 315const _apppaths = __turbopack_context__.r(174180); 316const _hooksclientcontextsharedruntime = __turbopack_context__.r(47790); 317const _routeparams = __turbopack_context__.r(33906); 318const _pprnavigations = __turbopack_context__.r(595871); 319const enableNewScrollHandler = ("TURBOPACK compile-time value", false); 320const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = _reactdom.default.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; 321// TODO-APP: Replace with new React API for finding dom nodes without a `ref` when available 322/** 323 * Wraps ReactDOM.findDOMNode with additional logic to hide React Strict Mode warning 324 */ function findDOMNode(instance) { 325 // Tree-shake for server bundle 326 if (typeof window === 'undefined') return null; 327 // __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode is null during module init. 328 // We need to lazily reference it.
329 const internal_reactDOMfindDOMNode = __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.findDOMNode; 330 return internal_reactDOMfindDOMNode(instance); 331} 332const rectProperties = [ 333 'bottom', 334 'height', 335 'left', 336 'right', 337 'top', 338 'width', 339 'x', 340 'y' 341]; 342/** 343 * Check if a HTMLElement is hidden or fixed/sticky position 344 */ function shouldSkipElement(element) { 345 // we ignore fixed or sticky positioned elements since they'll likely pass the "in-viewport" check 346 // and will result in a situation we bail on scroll because of something like a fixed nav, 347 // even though the actual page content is offscreen 348 if ([ 349 'sticky', 350 'fixed' 351 ].includes(getComputedStyle(element).position)) { 352 return true; 353 } 354 // Uses `getBoundingClientRect` to check if the element is hidden instead of `offsetParent` 355 // because `offsetParent` doesn't consider document/body 356 const rect = element.getBoundingClientRect(); 357 return rectProperties.every((item)=>rect[item] === 0); 358} 359/** 360 * Check if the top corner of the HTMLElement is in the viewport.
361 */ function topOfElementInViewport(instance, viewportHeight) { 362 const rects = instance.getClientRects(); 363 if (rects.length === 0) { 364 // Just to be explicit. 365 return false; 366 } 367 let elementTop = Number.POSITIVE_INFINITY; 368 for(let i = 0; i < rects.length; i++){ 369 const rect = rects[i]; 370 if (rect.top < elementTop) { 371 elementTop = rect.top; 372 } 373 } 374 return elementTop >= 0 && elementTop <= viewportHeight; 375} 376/** 377 * Find the DOM node for a hash fragment. 378 * If `top` the page has to scroll to the top of the page. This mirrors the browser's behavior. 379 * If the hash fragment is an id, the page has to scroll to the element with that id. 380 * If the hash fragment is a name, the page has to scroll to the first element with that name. 381 */ function getHashFragmentDomNode(hashFragment) { 382 var _document_getElementById; 383 // If the hash fragment is `top` the page has to scroll to the top of the page. 384 if (hashFragment === 'top') { 385 return document.body; 386 } 387 // If the hash fragment is an id, the page has to scroll to the element with that id. 388 return (_document_getElementById = document.getElementById(hashFragment)) !== null && _document_getElementById !== void 0 ? _document_getElementById : // If the hash fragment is a name, the page has to scroll to the first element with that name. 389 document.getElementsByName(hashFragment)[0]; 390} 391class InnerScrollAndFocusHandlerOld extends _react.default.Component { 392 componentDidMount() { 393 this.handlePotentialScroll(); 394 } 395 componentDidUpdate() { 396 this.handlePotentialScroll(); 397 } 398 render() { 399 return this.props.children; 400 } 401 constructor(...args){ 402 super(...args), this.handlePotentialScroll = ()=>{ 403 // Handle scroll and focus, it's only applied once. 404 const { focusAndScrollRef, cacheNode } = this.props; 405 const scrollRef = focusAndScrollRef.forceScroll ? focusAndScrollRef.scrollRef : cacheNode.scrollRef; 406 if (scrollRef === null || !scrollRef.current) return; 407 let domNode = null; 408 const hashFragment = focusAndScrollRef.hashFragment; 409 if (hashFragment) { 410 domNode = getHashFragmentDomNode(hashFragment); 411 } 412 // `findDOMNode` is tricky because it returns just the first child if the component is a fragment. 413 // This already caused a bug where the first child was a <link/> in head. 414 if (!domNode) { 415 domNode = findDOMNode(this); 416 } 417 // If there is no DOM node this layout-router level is skipped. It'll be handled higher-up in the tree. 418 if (!(domNode instanceof Element)) { 419 return; 420 } 421 // Verify if the element is a HTMLElement and if we want to consider it for scroll behavior. 422 // If the element is skipped, try to select the next sibling and try again. 423 while(!(domNode instanceof HTMLElement) || shouldSkipElement(domNode)){ 424 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 425 { 426 var _domNode_parentElement; 427 /*TURBOPACK member replacement*/ } 428 // No siblings found that match the criteria are found, so handle scroll higher up in the tree instead. 429 if (domNode.nextElementSibling === null) { 430 return; 431 } 432 domNode = domNode.nextElementSibling; 433 } 434 // Mark as scrolled so no other segment scrolls for this navigation. 435 scrollRef.current = false; 436 (0, _disablesmoothscroll.disableSmoothScrollDuringRouteTransition)(()=>{ 437 // In case of hash scroll, we only need to scroll the element into view 438 if (hashFragment) { 439 domNode.scrollIntoView(); 440 return; 441 } 442 // Store the current viewport height because reading `clientHeight` causes a reflow,
443 // and it won't change during this function. 444 const htmlElement = document.documentElement; 445 const viewportHeight = htmlElement.clientHeight; 446 // If the element's top edge is already in the viewport, exit early. 447 if (topOfElementInViewport(domNode, viewportHeight)) { 448 return; 449 } 450 // Otherwise, try scrolling go the top of the document to be backward compatible with pages 451 // scrollIntoView() called on `<html/>` element scrolls horizontally on chrome and firefox (that shouldn't happen) 452 // We could use it to scroll horizontally following RTL but that also seems to be broken - it will always scroll left 453 // scrollLeft = 0 also seems to ignore RTL and manually checking for RTL is too much hassle so we will scroll just vertically 454 htmlElement.scrollTop = 0; 455 // Scroll to domNode if domNode is not in viewport when scrolled to top of document 456 if (!topOfElementInViewport(domNode, viewportHeight)) { 457 // Scroll into view doesn't scroll horizontally by default when not needed 458 domNode.scrollIntoView(); 459 } 460 }, { 461 // We will force layout by querying domNode position 462 dontForceLayout: true, 463 onlyHashChange: focusAndScrollRef.onlyHashChange 464 }); 465 // Mutate after scrolling so that it can be read by `disableSmoothScrollDuringRouteTransition` 466 focusAndScrollRef.onlyHashChange = false; 467 focusAndScrollRef.hashFragment = null; 468 // Set focus on the element 469 domNode.focus(); 470 }; 471 } 472} 473/** 474 * Fork of InnerScrollAndFocusHandlerOld using Fragment refs for scrolling. 475 * No longer focuses the first host descendant. 476 */ function InnerScrollHandlerNew(props) { 477 const childrenRef = _react.default.useRef(null); 478 (0, _react.useLayoutEffect)(()=>{ 479 const { focusAndScrollRef, cacheNode } = props; 480 const scrollRef = focusAndScrollRef.forceScroll ? focusAndScrollRef.scrollRef : cacheNode.scrollRef; 481 if (scrollRef === null || !scrollRef.current) return; 482 let instance = null; 483 const hashFragment = focusAndScrollRef.hashFragment; 484 if (hashFragment) { 485 instance = getHashFragmentDomNode(hashFragment); 486 } 487 if (!instance) { 488 instance = childrenRef.current; 489 } 490 // If there is no DOM node this layout-router level is skipped. It'll be handled higher-up in the tree. 491 if (instance === null) { 492 return; 493 } 494 // Mark as scrolled so no other segment scrolls for this navigation. 495 scrollRef.current = false; 496 const activeElement = document.activeElement; 497 if (activeElement !== null && 'blur' in activeElement && typeof activeElement.blur === 'function') { 498 // Trying to match hard navigations. 499 // Ideally we'd move the internal focus cursor either to the top 500 // or at least before the segment. But there's no DOM API to do that, 501 // so we just blur. 502 // We could workaround this by moving focus to a temporary element in 503 // the body. But adding elements might trigger layout or other effects 504 // so it should be well motivated. 505 activeElement.blur(); 506 } 507 (0, _disablesmoothscroll.disableSmoothScrollDuringRouteTransition)(()=>{ 508 // In case of hash scroll, we only need to scroll the element into view 509 if (hashFragment) { 510 instance.scrollIntoView(); 511 return; 512 } 513 // Store the current viewport height because reading `clientHeight` causes a reflow, 514 // and it won't change during this function. 515 const htmlElement = document.documentElement; 516 const viewportHeight = htmlElement.clientHeight; 517 // If the element's top edge is already in the viewport, exit early.
518 if (topOfElementInViewport(instance, viewportHeight)) { 519 return; 520 } 521 // Otherwise, try scrolling go the top of the document to be backward compatible with pages 522 // scrollIntoView() called on `<html/>` element scrolls horizontally on chrome and firefox (that shouldn't happen) 523 // We could use it to scroll horizontally following RTL but that also seems to be broken - it will always scroll left 524 // scrollLeft = 0 also seems to ignore RTL and manually checking for RTL is too much hassle so we will scroll just vertically 525 htmlElement.scrollTop = 0; 526 // Scroll to domNode if domNode is not in viewport when scrolled to top of document 527 if (!topOfElementInViewport(instance, viewportHeight)) { 528 // Scroll into view doesn't scroll horizontally by default when not needed 529 instance.scrollIntoView(); 530 } 531 }, { 532 // We will force layout by querying domNode position 533 dontForceLayout: true, 534 onlyHashChange: focusAndScrollRef.onlyHashChange 535 }); 536 // Mutate after scrolling so that it can be read by `disableSmoothScrollDuringRouteTransition` 537 focusAndScrollRef.onlyHashChange = false; 538 focusAndScrollRef.hashFragment = null; 539 }, // but be prepared for lots of manual testing. 540 undefined); 541 return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, { 542 ref: childrenRef, 543 children: props.children 544 }); 545} 546const InnerScrollAndMaybeFocusHandler = ("TURBOPACK compile-time falsy", 0) ? "TURBOPACK unreachable" : InnerScrollAndFocusHandlerOld; 547function ScrollAndMaybeFocusHandler(param) { 548 let { children, cacheNode } = param; 549 const context = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext); 550 if (!context) { 551 throw Object.defineProperty(new Error('invariant global layout router not mounted'), "__NEXT_ERROR_CODE", { 552 value: "E473", 553 enumerable: false, 554 configurable: true 555 }); 556 } 557 return /*#__PURE__*/ (0, _jsxruntime.jsx)(InnerScrollAndMaybeFocusHandler, { 558 focusAndScrollRef: context.focusAndScrollRef, 559 cacheNode: cacheNode, 560 children: children 561 }); 562} 563/** 564 * InnerLayoutRouter handles rendering the provided segment based on the cache. 565 */ function InnerLayoutRouter(param) { 566 let { tree, segmentPath, debugNameContext, cacheNode: maybeCacheNode, params, url, isActive } = param; 567 const context = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext); 568 const parentNavPromises = (0, _react.useContext)(_hooksclientcontextsharedruntime.NavigationPromisesContext); 569 if (!context) { 570 throw Object.defineProperty(new Error('invariant global layout router not mounted'), "__NEXT_ERROR_CODE", { 571 value: "E473", 572 enumerable: false, 573 configurable: true 574 }); 575 } 576 const cacheNode = maybeCacheNode !== null ? maybeCacheNode : // This should only be reachable for inactive/hidden segments, during 577 // prerendering The active segment should always be consistent with the 578 // CacheNode tree. Regardless, if we don't have a matching CacheNode, we 579 // must suspend rather than render nothing, to prevent showing an 580 // inconsistent route. 581 (0, _react.use)(_unresolvedthenable.unresolvedThenable); 582 // `rsc` represents the renderable node for this segment. 583 // If this segment has a `prefetchRsc`, it's the statically prefetched data. 584 // We should use that on initial render instead of `rsc`. Then we'll switch 585 // to `rsc` when the dynamic response streams in. 586 // 587 // If no prefetch data is available, then we go straight to rendering `rsc`. 588 const resolvedPrefetchRsc = cacheNode.prefetchRsc !== null ? cacheNode.prefetchRsc : cacheNode.rsc; 589 // We use `useDeferredValue` to handle switching between the prefetched and 590 // final values. The second argument is returned on initial render, then it 591 // re-renders with the first argument.
592 const rsc = (0, _react.useDeferredValue)(cacheNode.rsc, resolvedPrefetchRsc); 593 // `rsc` is either a React node or a promise for a React node, except we 594 // special case `null` to represent that this segment's data is missing. If 595 // it's a promise, we need to unwrap it so we can determine whether or not the 596 // data is missing. 597 let resolvedRsc; 598 if ((0, _pprnavigations.isDeferredRsc)(rsc)) { 599 const unwrappedRsc = (0, _react.use)(rsc); 600 if (unwrappedRsc === null) { 601 // If the promise was resolved to `null`, it means the data for this 602 // segment was not returned by the server. Suspend indefinitely. When this 603 // happens, the router is responsible for triggering a new state update to 604 // un-suspend this segment. 605 (0, _react.use)(_unresolvedthenable.unresolvedThenable); 606 } 607 resolvedRsc = unwrappedRsc; 608 } else { 609 // This is not a deferred RSC promise. Don't need to unwrap it. 610 if (rsc === null) { 611 (0, _react.use)(_unresolvedthenable.unresolvedThenable); 612 } 613 resolvedRsc = rsc; 614 } 615 // In dev, we create a NavigationPromisesContext containing the instrumented promises that provide 616 // `useSelectedLayoutSegment` and `useSelectedLayoutSegments`. 617 // Promises are cached outside of render to survive suspense retries. 618 let navigationPromises = null; 619 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 620 ; 621 let children = resolvedRsc; 622 if (navigationPromises) { 623 children = /*#__PURE__*/ (0, _jsxruntime.jsx)(_hooksclientcontextsharedruntime.NavigationPromisesContext.Provider, { 624 value: navigationPromises, 625 children: resolvedRsc 626 }); 627 } 628 children = /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.LayoutRouterContext.Provider, { 629 value: { 630 parentTree: tree, 631 parentCacheNode: cacheNode, 632 parentSegmentPath: segmentPath, 633 parentParams: params, 634 // This is always set to null as we enter a child segment. It's 635 // populated by LoadingBoundaryProvider the next time we reach a 636 // loading boundary. 637 parentLoadingData: null, 638 debugNameContext: debugNameContext, 639 // TODO-APP: overriding of url for parallel routes 640 url: url, 641 isActive: isActive 642 }, 643 children: children 644 }); 645 return children; 646} 647function LoadingBoundaryProvider(param) { 648 let { loading, children } = param; 649 // Provides the data needed to render a loading.tsx boundary, via context. 650 // 651 // loading.tsx creates a Suspense boundary around each of a layout's child 652 // slots. (Might be bit confusing to think about the data flow, but: if 653 // loading.tsx and layout.tsx are in the same directory, they are assigned 654 // to the same CacheNode.) 655 // 656 // This provider component does not render the Suspense boundary directly; 657 // that's handled by LoadingBoundary. 658 // 659 // TODO: For simplicity, we should combine this provider with LoadingBoundary 660 // and render the Suspense boundary directly. The only real benefit of doing 661 // it separately is so that when there are multiple parallel routes, we only 662 // send the boundary data once, rather than once per child. But that's a 663 // negligible benefit and can be achieved via caching instead. 664 const parentContext = (0, _react.use)(_approutercontextsharedruntime.LayoutRouterContext); 665 if (parentContext === null) { 666 return children; 667 } 668 // All values except for parentLoadingData are the same as the parent context. 669 return /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.LayoutRouterContext.Provider, { 670 value: { 671 parentTree: parentContext.parentTree, 672 parentCacheNode: parentContext.parentCacheNode, 673 parentSegmentPath: parentContext.parentSegmentPath, 674 parentParams: parentContext.parentParams, 675 parentLoadingData: loading, 676 debugNameContext: parentContext.debugNameContext, 677 url: parentContext.url,
678 isActive: parentContext.isActive 679 }, 680 children: children 681 }); 682} 683/** 684 * Renders suspense boundary with the provided "loading" property as the fallback. 685 * If no loading property is provided it renders the children without a suspense boundary. 686 */ function LoadingBoundary(param) { 687 let { name, loading, children } = param; 688 // TODO: For LoadingBoundary, and the other built-in boundary types, don't 689 // wrap in an extra function component if no user-defined boundary is 690 // provided. In other words, inline this conditional wrapping logic into 691 // the parent component. More efficient and keeps unnecessary junk out of 692 // the component stack. 693 if (loading !== null) { 694 const loadingRsc = loading[0]; 695 const loadingStyles = loading[1]; 696 const loadingScripts = loading[2]; 697 return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Suspense, { 698 name: name, 699 fallback: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, { 700 children: [ 701 loadingStyles, 702 loadingScripts, 703 loadingRsc 704 ] 705 }), 706 children: children 707 }); 708 } 709 return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { 710 children: children 711 }); 712} 713function OuterLayoutRouter(param) { 714 let { parallelRouterKey, error, errorStyles, errorScripts, templateStyles, templateScripts, template, notFound, forbidden, unauthorized, segmentViewBoundaries } = param; 715 var _maybeParentSlots_parallelRouterKey; 716 const context = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext); 717 if (!context) { 718 throw Object.defineProperty(new Error('invariant expected layout router to be mounted'), "__NEXT_ERROR_CODE", { 719 value: "E56", 720 enumerable: false, 721 configurable: true 722 }); 723 } 724 const { parentTree, parentCacheNode, parentSegmentPath, parentParams, parentLoadingData, url, isActive, debugNameContext } = context; 725 // Get the CacheNode for this segment by reading it from the parent segment's 726 // child map. 727 const parentTreeSegment = parentTree[0]; 728 const segmentPath = parentSegmentPath === null ? // the code. We should clean this up. 729 [ 730 parallelRouterKey 731 ] : parentSegmentPath.concat([ 732 parentTreeSegment, 733 parallelRouterKey 734 ]); 735 // The "state" key of a segment is the one passed to React â it represents the 736 // identity of the UI tree. Whenever the state key changes, the tree is 737 // recreated and the state is reset. In the App Router model, search params do 738 // not cause state to be lost, so two segments with the same segment path but 739 // different search params should have the same state key. 740 // 741 // The "cache" key of a segment, however, *does* include the search params, if 742 // it's possible that the segment accessed the search params on the server. 743 // (This only applies to page segments; layout segments cannot access search 744 // params on the server.) 745 const activeTree = parentTree[1][parallelRouterKey]; 746 const maybeParentSlots = parentCacheNode.slots; 747 if (activeTree === undefined || maybeParentSlots === null) { 748 // Could not find a matching segment. The client tree is inconsistent with 749 // the server tree. Suspend indefinitely; the router will have already 750 // detected the inconsistency when handling the server response, and 751 // triggered a refresh of the page to recover. 752 (0, _react.use)(_unresolvedthenable.unresolvedThenable); 753 } 754 let maybeValidationBoundaryId = null; 755 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 756 ; 757 const activeSegment = activeTree[0]; 758 const activeCacheNode = (_maybeParentSlots_parallelRouterKey = maybeParentSlots[parallelRouterKey]) !== null && _maybeParentSlots_parallelRouterKey !== void 0 ? _maybeParentSlots_parallelRouterKey : null; 759 const activeStateKey = (0, _createroutercachekey.createRouterCacheKey)(activeSegment, true) // no search params 760 ; 761 // At each level of the route tree, not only do we render the currently 762 // active segment â we also render the last N segments that were active at 763 // this level inside a hidden <Activity> boundary, to preserve their state 764 // if or when the user navigates to them again. 765 // 766 // bfcacheEntry is a linked list of FlightRouterStates. 767 let bfcacheEntry = (0, _bfcachestatemanager.useRouterBFCache)(activeTree, activeCacheNode, activeStateKey);
768 let children = []; 769 do { 770 const tree = bfcacheEntry.tree; 771 const cacheNode = bfcacheEntry.cacheNode; 772 const stateKey = bfcacheEntry.stateKey; 773 const segment = tree[0]; 774 /* 775 - Error boundary 776 - Only renders error boundary if error component is provided. 777 - Rendered for each segment to ensure they have their own error state. 778 - When gracefully degrade for bots, skip rendering error boundary. 779 - Loading boundary 780 - Only renders suspense boundary if loading components is provided. 781 - Rendered for each segment to ensure they have their own loading state. 782 - Passed to the router during rendering to ensure it can be immediately rendered when suspending on a Flight fetch. 783 */ let segmentBoundaryTriggerNode = null; 784 let segmentViewStateNode = null; 785 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 786 ; 787 let params = parentParams; 788 if (Array.isArray(segment)) { 789 // This segment contains a route param. Accumulate these as we traverse 790 // down the router tree. The result represents the set of params that 791 // the layout/page components are permitted to access below this point. 792 const paramName = segment[0]; 793 const paramCacheKey = segment[1]; 794 const paramType = segment[2]; 795 const paramValue = (0, _routeparams.getParamValueFromCacheKey)(paramCacheKey, paramType); 796 if (paramValue !== null) { 797 params = { 798 ...parentParams, 799 [paramName]: paramValue 800 }; 801 } 802 } 803 const debugName = getBoundaryDebugNameFromSegment(segment); 804 // `debugNameContext` represents the nearest non-"virtual" parent segment. 805 // `getBoundaryDebugNameFromSegment` returns undefined for virtual segments. 806 // So if `debugName` is undefined, the context is passed through unchanged. 807 const childDebugNameContext = debugName !== null && debugName !== void 0 ? debugName : debugNameContext; 808 // In practical terms, clicking this name in the Suspense DevTools 809 // should select the child slots of that layout. 810 // 811 // So the name we apply to the Activity boundary is actually based on 812 // the nearest parent segments. 813 // 814 // We skip over "virtual" parents, i.e. ones inserted by Next.js that 815 // don't correspond to application-defined code. 816 const isVirtual = debugName === undefined; 817 const debugNameToDisplay = isVirtual ? undefined : debugNameContext; 818 let templateValue = /*#__PURE__*/ (0, _jsxruntime.jsxs)(ScrollAndMaybeFocusHandler, { 819 cacheNode: cacheNode, 820 children: [ 821 /*#__PURE__*/ (0, _jsxruntime.jsx)(_errorboundary.ErrorBoundary, { 822 errorComponent: error, 823 errorStyles: errorStyles, 824 errorScripts: errorScripts, 825 children: /*#__PURE__*/ (0, _jsxruntime.jsx)(LoadingBoundary, { 826 name: debugNameToDisplay, 827 // TODO: The loading module data for a segment is stored on the 828 // parent, then applied to each of that parent segment's 829 // parallel route slots. In the simple case where there's only 830 // one parallel route (the `children` slot), this is no 831 // different from if the loading module data were stored on the 832 // child directly. But I'm not sure this actually makes sense 833 // when there are multiple parallel routes. It's not a huge 834 // issue because you always have the option to define a narrower 835 // loading boundary for a particular slot. But this sort of 836 // smells like an implementation accident to me. 837 loading: parentLoadingData, 838 children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_errorboundary1.HTTPAccessFallbackBoundary, { 839 notFound: notFound, 840 forbidden: forbidden, 841 unauthorized: unauthorized, 842 children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_redirectboundary.RedirectBoundary, { 843 children: [ 844 /*#__PURE__*/ (0, _jsxruntime.jsx)(InnerLayoutRouter, { 845 url: url, 846 tree: tree, 847 params: params, 848 cacheNode: cacheNode, 849 segmentPath: segmentPath, 850 debugNameContext: childDebugNameContext, 851 isActive: isActive && stateKey === activeStateKey 852 }), 853 segmentBoundaryTriggerNode 854 ] 855 }) 856 }) 857 }) 858 }), 859 segmentViewStateNode 860 ] 861 }); 862 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 863 ; 864 let child = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_approutercontextsharedruntime.TemplateContext.Provider, { 865 value: templateValue, 866 children: [ 867 templateStyles, 868 templateScripts, 869 template 870 ] 871 }, stateKey); 872 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 873 ; 874 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 875 ; 876 children.push(child); 877 bfcacheEntry = bfcacheEntry.next; 878 }while (bfcacheEntry !== null) 879 return children; 880} 881function getBoundaryDebugNameFromSegment(segment) { 882 if (segment === '/') { 883 // Reached the root 884 return '/'; 885 } 886 if (typeof segment === 'string') { 887 if (isVirtualLayout(segment)) { 888 return undefined; 889 } else { 890 return segment + '/'; 891 } 892 } 893 const paramCacheKey = segment[1]; 894 return paramCacheKey + '/'; 895} 896function isVirtualLayout(segment) { 897 return(// (like __PAGE__ and __DEFAULT__) to avoid collisions with 898 // user-defined route groups. 899 segment === '(__SLOT__)'); 900} 901if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 902 Object.defineProperty(exports.default, '__esModule', { 903 value: true 904 });
905 Object.assign(exports.default, exports); 906 module.exports = exports.default; 907} 908}), 909837457, ((__turbopack_context__, module, exports) => { 910"use strict"; 911 912Object.defineProperty(exports, "__esModule", { 913 value: true 914}); 915Object.defineProperty(exports, "default", { 916 enumerable: true, 917 get: function() { 918 return RenderFromTemplateContext; 919 } 920}); 921const _interop_require_wildcard = __turbopack_context__.r(151836); 922const _jsxruntime = __turbopack_context__.r(843476); 923const _react = /*#__PURE__*/ _interop_require_wildcard._(__turbopack_context__.r(271645)); 924const _approutercontextsharedruntime = __turbopack_context__.r(8372); 925function RenderFromTemplateContext() { 926 const children = (0, _react.useContext)(_approutercontextsharedruntime.TemplateContext); 927 return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, { 928 children: children 929 }); 930} 931if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 932 Object.defineProperty(exports.default, '__esModule', { 933 value: true 934 }); 935 Object.assign(exports.default, exports); 936 module.exports = exports.default; 937} 938}), 939793504, ((__turbopack_context__, module, exports) => { 940"use strict"; 941 942Object.defineProperty(exports, "__esModule", { 943 value: true 944}); 945Object.defineProperty(exports, "createRenderSearchParamsFromClient", { 946 enumerable: true, 947 get: function() { 948 return createRenderSearchParamsFromClient; 949 } 950}); 951const CachedSearchParams = new WeakMap(); 952function makeUntrackedSearchParams(underlyingSearchParams) { 953 const cachedSearchParams = CachedSearchParams.get(underlyingSearchParams); 954 if (cachedSearchParams) { 955 return cachedSearchParams; 956 } 957 const promise = Promise.resolve(underlyingSearchParams); 958 CachedSearchParams.set(underlyingSearchParams, promise); 959 return promise; 960} 961function createRenderSearchParamsFromClient(underlyingSearchParams) { 962 return makeUntrackedSearchParams(underlyingSearchParams); 963} 964if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 965 Object.defineProperty(exports.default, '__esModule', { 966 value: true 967 }); 968 Object.assign(exports.default, exports); 969 module.exports = exports.default; 970} 971}), 972266996, ((__turbopack_context__, module, exports) => { 973"use strict"; 974 975var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 976"use strict"; 977Object.defineProperty(exports, "__esModule", { 978 value: true 979}); 980Object.defineProperty(exports, "createRenderSearchParamsFromClient", { 981 enumerable: true, 982 get: function() { 983 return createRenderSearchParamsFromClient; 984 } 985}); 986const createRenderSearchParamsFromClient = ("TURBOPACK compile-time falsy", 0) ? "TURBOPACK unreachable" : __turbopack_context__.r(793504).createRenderSearchParamsFromClient; 987if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 988 Object.defineProperty(exports.default, '__esModule', { 989 value: true 990 }); 991 Object.assign(exports.default, exports); 992 module.exports = exports.default; 993} 994}), 995806831, ((__turbopack_context__, module, exports) => { 996"use strict"; 997 998Object.defineProperty(exports, "__esModule", { 999 value: true 1000}); 1001Object.defineProperty(exports, "createRenderParamsFromClient", { 1002 enumerable: true, 1003 get: function() { 1004 return createRenderParamsFromClient; 1005 } 1006}); 1007const CachedParams = new WeakMap(); 1008function makeUntrackedParams(underlyingParams) { 1009 const cachedParams = CachedParams.get(underlyingParams); 1010 if (cachedParams) { 1011 return cachedParams; 1012 } 1013 const promise = Promise.resolve(underlyingParams); 1014 CachedParams.set(underlyingParams, promise); 1015 return promise; 1016} 1017function createRenderParamsFromClient(clientParams) { 1018 return makeUntrackedParams(clientParams); 1019} 1020if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 1021 Object.defineProperty(exports.default, '__esModule', { 1022 value: true 1023 });
1024 Object.assign(exports.default, exports); 1025 module.exports = exports.default; 1026} 1027}), 1028797689, ((__turbopack_context__, module, exports) => { 1029"use strict"; 1030 1031var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 1032"use strict"; 1033Object.defineProperty(exports, "__esModule", { 1034 value: true 1035}); 1036Object.defineProperty(exports, "createRenderParamsFromClient", { 1037 enumerable: true, 1038 get: function() { 1039 return createRenderParamsFromClient; 1040 } 1041}); 1042const createRenderParamsFromClient = ("TURBOPACK compile-time falsy", 0) ? "TURBOPACK unreachable" : __turbopack_context__.r(806831).createRenderParamsFromClient; 1043if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 1044 Object.defineProperty(exports.default, '__esModule', { 1045 value: true 1046 }); 1047 Object.assign(exports.default, exports); 1048 module.exports = exports.default; 1049} 1050}), 105166373, ((__turbopack_context__, module, exports) => { 1052"use strict"; 1053 1054Object.defineProperty(exports, "__esModule", { 1055 value: true 1056}); 10570 && (module.exports = { 1058 accumulateRootVaryParam: null, 1059 accumulateVaryParam: null, 1060 createResponseVaryParamsAccumulator: null, 1061 createVaryParamsAccumulator: null, 1062 createVaryingParams: null, 1063 createVaryingSearchParams: null, 1064 emptyVaryParamsAccumulator: null, 1065 finishAccumulatingVaryParams: null, 1066 getMetadataVaryParamsAccumulator: null, 1067 getMetadataVaryParamsThenable: null, 1068 getRootParamsVaryParamsAccumulator: null, 1069 getVaryParamsThenable: null, 1070 getViewportVaryParamsAccumulator: null 1071}); 1072function _export(target, all) { 1073 for(var name in all)Object.defineProperty(target, name, { 1074 enumerable: true, 1075 get: all[name] 1076 }); 1077} 1078_export(exports, { 1079 accumulateRootVaryParam: function() { 1080 return accumulateRootVaryParam; 1081 }, 1082 accumulateVaryParam: function() { 1083 return accumulateVaryParam; 1084 }, 1085 createResponseVaryParamsAccumulator: function() { 1086 return createResponseVaryParamsAccumulator; 1087 }, 1088 createVaryParamsAccumulator: function() { 1089 return createVaryParamsAccumulator; 1090 }, 1091 createVaryingParams: function() { 1092 return createVaryingParams; 1093 }, 1094 createVaryingSearchParams: function() { 1095 return createVaryingSearchParams; 1096 }, 1097 emptyVaryParamsAccumulator: function() { 1098 return emptyVaryParamsAccumulator; 1099 }, 1100 finishAccumulatingVaryParams: function() { 1101 return finishAccumulatingVaryParams; 1102 }, 1103 getMetadataVaryParamsAccumulator: function() { 1104 return getMetadataVaryParamsAccumulator; 1105 }, 1106 getMetadataVaryParamsThenable: function() { 1107 return getMetadataVaryParamsThenable; 1108 }, 1109 getRootParamsVaryParamsAccumulator: function() { 1110 return getRootParamsVaryParamsAccumulator; 1111 }, 1112 getVaryParamsThenable: function() { 1113 return getVaryParamsThenable; 1114 }, 1115 getViewportVaryParamsAccumulator: function() { 1116 return getViewportVaryParamsAccumulator; 1117 } 1118}); 1119const _workunitasyncstorageexternal = __turbopack_context__.r(662141); 1120function createSegmentVaryParamsAccumulator() { 1121 const accumulator = { 1122 varyParams: new Set(), 1123 status: 'pending', 1124 value: new Set(), 1125 then (onfulfilled) { 1126 if (onfulfilled) { 1127 if (accumulator.status === 'pending') { 1128 accumulator.resolvers.push(onfulfilled); 1129 } else { 1130 onfulfilled(accumulator.value); 1131 } 1132 } 1133 }, 1134 resolvers: [] 1135 }; 1136 return accumulator; 1137} 1138/** 1139 * A singleton accumulator that's already resolved to an empty Set. Use this for 1140 * segments where we know upfront that no params will be accessed, such as 1141 * client components or segments without user code. 1142 * 1143 * Benefits: 1144 * - No need to accumulate or resolve later 1145 * - Resilient: resolves correctly even if other tracking fails 1146 * - Memory efficient: reuses the same object 1147 */ const emptySet = new Set(); 1148const emptyVaryParamsAccumulator = { 1149 varyParams: emptySet, 1150 status: 'fulfilled', 1151 value: emptySet, 1152 then (onfulfilled) { 1153 if (onfulfilled) { 1154 onfulfilled(emptySet); 1155 } 1156 }, 1157 resolvers: [] 1158}; 1159function createResponseVaryParamsAccumulator() {
1160 // Create the head and rootParams accumulators as top-level fields. 1161 // Segment accumulators are added to the segments set as they are created. 1162 const head = createSegmentVaryParamsAccumulator(); 1163 const rootParams = createSegmentVaryParamsAccumulator(); 1164 const segments = new Set(); 1165 return { 1166 head, 1167 rootParams, 1168 segments 1169 }; 1170} 1171function createVaryParamsAccumulator() { 1172 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 1173 if (workUnitStore) { 1174 switch(workUnitStore.type){ 1175 case 'prerender': 1176 case 'prerender-runtime': 1177 { 1178 const responseAccumulator = workUnitStore.varyParamsAccumulator; 1179 if (responseAccumulator !== null) { 1180 const accumulator = createSegmentVaryParamsAccumulator(); 1181 responseAccumulator.segments.add(accumulator); 1182 return accumulator; 1183 } 1184 return null; 1185 } 1186 case 'prerender-ppr': 1187 case 'prerender-legacy': 1188 case 'request': 1189 case 'cache': 1190 case 'private-cache': 1191 case 'prerender-client': 1192 case 'validation-client': 1193 case 'unstable-cache': 1194 case 'generate-static-params': 1195 break; 1196 default: 1197 workUnitStore; 1198 } 1199 } 1200 return null; 1201} 1202function getMetadataVaryParamsAccumulator() { 1203 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 1204 if (workUnitStore) { 1205 switch(workUnitStore.type){ 1206 case 'prerender': 1207 case 'prerender-runtime': 1208 { 1209 const responseAccumulator = workUnitStore.varyParamsAccumulator; 1210 if (responseAccumulator !== null) { 1211 return responseAccumulator.head; 1212 } 1213 return null; 1214 } 1215 case 'prerender-ppr': 1216 case 'prerender-legacy': 1217 case 'request': 1218 case 'cache': 1219 case 'private-cache': 1220 case 'prerender-client': 1221 case 'validation-client': 1222 case 'unstable-cache': 1223 case 'generate-static-params': 1224 return null; 1225 default: 1226 workUnitStore; 1227 } 1228 } 1229 return null; 1230} 1231function getVaryParamsThenable(accumulator) { 1232 return accumulator; 1233} 1234function getMetadataVaryParamsThenable() { 1235 const accumulator = getMetadataVaryParamsAccumulator(); 1236 if (accumulator !== null) { 1237 return getVaryParamsThenable(accumulator); 1238 } 1239 return null; 1240} 1241const getViewportVaryParamsAccumulator = getMetadataVaryParamsAccumulator; 1242function getRootParamsVaryParamsAccumulator() { 1243 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 1244 if (workUnitStore) { 1245 switch(workUnitStore.type){ 1246 case 'prerender': 1247 case 'prerender-runtime': 1248 { 1249 const responseAccumulator = workUnitStore.varyParamsAccumulator; 1250 if (responseAccumulator !== null) { 1251 return responseAccumulator.rootParams; 1252 } 1253 return null; 1254 } 1255 case 'prerender-ppr': 1256 case 'prerender-legacy': 1257 case 'request': 1258 case 'cache': 1259 case 'private-cache': 1260 case 'prerender-client': 1261 case 'validation-client': 1262 case 'unstable-cache': 1263 case 'generate-static-params': 1264 return null; 1265 default: 1266 workUnitStore; 1267 } 1268 } 1269 return null; 1270} 1271function accumulateVaryParam(accumulator, paramName) { 1272 accumulator.varyParams.add(paramName); 1273} 1274function accumulateRootVaryParam(paramName) { 1275 const rootParamsAccumulator = getRootParamsVaryParamsAccumulator(); 1276 if (rootParamsAccumulator !== null) {
1277 accumulateVaryParam(rootParamsAccumulator, paramName); 1278 } 1279} 1280function createVaryingParams(accumulator, originalParamsObject, optionalCatchAllParamName) { 1281 if (optionalCatchAllParamName !== null) { 1282 // When there's an optional catch-all param with no value (e.g., 1283 // [[...slug]] at /), the param doesn't exist as a property on the params 1284 // object. Use a Proxy to track all param access â both existing params 1285 // and the missing optional param â including enumeration patterns like 1286 // Object.keys(), spread, for...in, and `in` checks. 1287 return new Proxy(originalParamsObject, { 1288 get (target, prop, receiver) { 1289 if (typeof prop === 'string') { 1290 if (prop === optionalCatchAllParamName || Object.prototype.hasOwnProperty.call(target, prop)) { 1291 accumulateVaryParam(accumulator, prop); 1292 } 1293 } 1294 return Reflect.get(target, prop, receiver); 1295 }, 1296 has (target, prop) { 1297 if (prop === optionalCatchAllParamName) { 1298 accumulateVaryParam(accumulator, optionalCatchAllParamName); 1299 } 1300 return Reflect.has(target, prop); 1301 }, 1302 ownKeys (target) { 1303 // Enumerating the params object means the user's code may depend on 1304 // which params are present, so conservatively track the optional 1305 // param as accessed. 1306 accumulateVaryParam(accumulator, optionalCatchAllParamName); 1307 return Reflect.ownKeys(target); 1308 } 1309 }); 1310 } 1311 // When there's no optional catch-all, all params exist as properties on the 1312 // object, so we can use defineProperty getters instead of a Proxy. This is 1313 // faster because the engine can optimize property access on regular objects 1314 // more aggressively than Proxy trap calls. 1315 const underlyingParamsWithVarying = {}; 1316 for(const paramName in originalParamsObject){ 1317 Object.defineProperty(underlyingParamsWithVarying, paramName, { 1318 get () { 1319 accumulateVaryParam(accumulator, paramName); 1320 return originalParamsObject[paramName]; 1321 }, 1322 enumerable: true 1323 }); 1324 } 1325 return underlyingParamsWithVarying; 1326} 1327function createVaryingSearchParams(accumulator, originalSearchParamsObject) { 1328 const underlyingSearchParamsWithVarying = {}; 1329 for(const searchParamName in originalSearchParamsObject){ 1330 Object.defineProperty(underlyingSearchParamsWithVarying, searchParamName, { 1331 get () { 1332 // TODO: Unlike path params, we don't vary track each search param 1333 // individually. The entire search string is treated as a single param. 1334 // This may change in the future. 1335 accumulateVaryParam(accumulator, '?'); 1336 return originalSearchParamsObject[searchParamName]; 1337 }, 1338 enumerable: true 1339 }); 1340 } 1341 return underlyingSearchParamsWithVarying; 1342} 1343async function finishAccumulatingVaryParams(responseAccumulator) { 1344 const rootVaryParams = responseAccumulator.rootParams.varyParams; 1345 // Resolve head 1346 finishSegmentAccumulator(responseAccumulator.head, rootVaryParams); 1347 // Resolve each segment 1348 for (const segmentAccumulator of responseAccumulator.segments){ 1349 finishSegmentAccumulator(segmentAccumulator, rootVaryParams); 1350 } 1351 // Now that the thenables are resolved, Flight should be able to flush the 1352 // vary params into the response stream. This work gets scheduled internally 1353 // by Flight using a microtask as soon as we notify the thenable listeners. 1354 // 1355 // We need to ensure that Flight's pending queues are emptied before this 1356 // function returns; the caller will abort the prerender immediately after. 1357 // We can't use a macrotask, because that would allow dynamic IO to sneak 1358 // into the response. So we use microtasks instead. 1359 // 1360 // The exact number of awaits here isn't important (indeed, one seems to be 1361 // sufficient, at the time of writing), as long as we wait enough ticks for 1362 // Flight to finish writing the response. 1363 // 1364 // Anything that remains in Flight's internal queue after these awaits must 1365 // be actual dynamic IO, not caused by pending vary params tasks. In other 1366 // words, failing to do this would cause us to treat a fully static prerender 1367 // as if it were partially dynamic. 1368 await Promise.resolve(); 1369 await Promise.resolve(); 1370 await Promise.resolve(); 1371} 1372function finishSegmentAccumulator(accumulator, rootVaryParams) { 1373 if (accumulator.status !== 'pending') { 1374 return; 1375 } 1376 const merged = new Set(accumulator.varyParams); 1377 for (const param of rootVaryParams){ 1378 merged.add(param); 1379 } 1380 accumulator.value = merged; 1381 accumulator.status = 'fulfilled'; 1382 for (const resolver of accumulator.resolvers){ 1383 resolver(merged); 1384 } 1385 accumulator.resolvers = []; 1386} 1387}),
1388242715, ((__turbopack_context__, module, exports) => { 1389"use strict"; 1390 1391Object.defineProperty(exports, "__esModule", { 1392 value: true 1393}); 1394Object.defineProperty(exports, "ReflectAdapter", { 1395 enumerable: true, 1396 get: function() { 1397 return ReflectAdapter; 1398 } 1399}); 1400class ReflectAdapter { 1401 static get(target, prop, receiver) { 1402 const value = Reflect.get(target, prop, receiver); 1403 if (typeof value === 'function') { 1404 return value.bind(target); 1405 } 1406 return value; 1407 } 1408 static set(target, prop, value, receiver) { 1409 return Reflect.set(target, prop, value, receiver); 1410 } 1411 static has(target, prop) { 1412 return Reflect.has(target, prop); 1413 } 1414 static deleteProperty(target, prop) { 1415 return Reflect.deleteProperty(target, prop); 1416 } 1417} 1418}), 1419876361, ((__turbopack_context__, module, exports) => { 1420"use strict"; 1421 1422var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 1423"use strict"; 1424Object.defineProperty(exports, "__esModule", { 1425 value: true 1426}); 1427Object.defineProperty(exports, "createDedupedByCallsiteServerErrorLoggerDev", { 1428 enumerable: true, 1429 get: function() { 1430 return createDedupedByCallsiteServerErrorLoggerDev; 1431 } 1432}); 1433const _react = /*#__PURE__*/ _interop_require_wildcard(__turbopack_context__.r(271645)); 1434function _getRequireWildcardCache(nodeInterop) { 1435 if (typeof WeakMap !== "function") return null; 1436 var cacheBabelInterop = new WeakMap(); 1437 var cacheNodeInterop = new WeakMap(); 1438 return (_getRequireWildcardCache = function(nodeInterop) { 1439 return nodeInterop ? cacheNodeInterop : cacheBabelInterop; 1440 })(nodeInterop); 1441} 1442function _interop_require_wildcard(obj, nodeInterop) { 1443 if (!nodeInterop && obj && obj.__esModule) { 1444 return obj; 1445 } 1446 if (obj === null || typeof obj !== "object" && typeof obj !== "function") { 1447 return { 1448 default: obj 1449 }; 1450 } 1451 var cache = _getRequireWildcardCache(nodeInterop); 1452 if (cache && cache.has(obj)) { 1453 return cache.get(obj); 1454 } 1455 var newObj = { 1456 __proto__: null 1457 }; 1458 var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; 1459 for(var key in obj){ 1460 if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { 1461 var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; 1462 if (desc && (desc.get || desc.set)) { 1463 Object.defineProperty(newObj, key, desc); 1464 } else { 1465 newObj[key] = obj[key]; 1466 } 1467 } 1468 } 1469 newObj.default = obj; 1470 if (cache) { 1471 cache.set(obj, newObj); 1472 } 1473 return newObj; 1474} 1475const errorRef = { 1476 current: null 1477}; 1478// React.cache is currently only available in canary/experimental React channels. 1479const cache = typeof _react.cache === 'function' ? _react.cache : (fn)=>fn; 1480// When Cache Components is enabled, we record these as errors so that they 1481// are captured by the dev overlay as it's more critical to fix these 1482// when enabled. 1483const logErrorOrWarn = ("TURBOPACK compile-time falsy", 0) ? "TURBOPACK unreachable" : console.warn; 1484// We don't want to dedupe across requests. 1485// The developer might've just attempted to fix the warning so we should warn again if it still happens. 1486const flushCurrentErrorIfNew = cache((key)=>{ 1487 try { 1488 logErrorOrWarn(errorRef.current); 1489 } finally{ 1490 errorRef.current = null; 1491 } 1492}); 1493function createDedupedByCallsiteServerErrorLoggerDev(getMessage) { 1494 return function logDedupedError() { 1495 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1496 args[_key] = arguments[_key]; 1497 } 1498 const message = getMessage(...args); 1499 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 1500 { 1501 var _stack; 1502 /*TURBOPACK member replacement*/ } else { 1503 logErrorOrWarn(message); 1504 } 1505 }; 1506} 1507}), 1508565932, ((__turbopack_context__, module, exports) => { 1509"use strict"; 1510 1511// This regex will have fast negatives meaning valid identifiers may not pass 1512// this test. However this is only used during static generation to provide hints 1513// about why a page bailed out of some or all prerendering and we can use bracket notation 1514// for example while `ಠ_ಠ` is a valid identifier it's ok to print `searchParams['ಠ_ಠ']` 1515// even if this would have been fine too `searchParams.ಠ_ಠ` 1516Object.defineProperty(exports, "__esModule", { 1517 value: true 1518}); 15190 && (module.exports = { 1520 describeHasCheckingStringProperty: null, 1521 describeStringPropertyAccess: null, 1522 wellKnownProperties: null 1523}); 1524function _export(target, all) { 1525 for(var name in all)Object.defineProperty(target, name, { 1526 enumerable: true, 1527 get: all[name] 1528 }); 1529} 1530_export(exports, { 1531 describeHasCheckingStringProperty: function() { 1532 return describeHasCheckingStringProperty; 1533 }, 1534 describeStringPropertyAccess: function() { 1535 return describeStringPropertyAccess; 1536 }, 1537 wellKnownProperties: function() { 1538 return wellKnownProperties; 1539 } 1540}); 1541const isDefinitelyAValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/; 1542function describeStringPropertyAccess(target, prop) { 1543 if (isDefinitelyAValidIdentifier.test(prop)) { 1544 return "`".concat(target, ".").concat(prop, "`"); 1545 } 1546 return "`".concat(target, "[").concat(JSON.stringify(prop), "]`"); 1547} 1548function describeHasCheckingStringProperty(target, prop) { 1549 const stringifiedProp = JSON.stringify(prop); 1550 return "`Reflect.has(".concat(target, ", ").concat(stringifiedProp, ")`, `").concat(stringifiedProp, " in ").concat(target, "`, or similar"); 1551} 1552const wellKnownProperties = new Set([ 1553 'hasOwnProperty', 1554 'isPrototypeOf', 1555 'propertyIsEnumerable', 1556 'toString', 1557 'valueOf',
1558 'toLocaleString', 1559 // Promise prototype 1560 'then', 1561 'catch', 1562 'finally', 1563 // React Promise extension 1564 'status', 1565 // 'value', 1566 // 'error', 1567 // React introspection 1568 'displayName', 1569 '_debugInfo', 1570 // Common tested properties 1571 'toJSON', 1572 '$$typeof', 1573 '__esModule', 1574 // Tested by flight when checking for iterables 1575 '@@iterator' 1576]); 1577}), 1578783066, ((__turbopack_context__, module, exports) => { 1579"use strict"; 1580 1581Object.defineProperty(exports, "__esModule", { 1582 value: true 1583}); 1584Object.defineProperty(exports, "afterTaskAsyncStorageInstance", { 1585 enumerable: true, 1586 get: function() { 1587 return afterTaskAsyncStorageInstance; 1588 } 1589}); 1590const _asynclocalstorage = __turbopack_context__.r(90317); 1591const afterTaskAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)(); 1592}), 1593341643, ((__turbopack_context__, module, exports) => { 1594"use strict"; 1595 1596Object.defineProperty(exports, "__esModule", { 1597 value: true 1598}); 1599Object.defineProperty(exports, "afterTaskAsyncStorage", { 1600 enumerable: true, 1601 get: function() { 1602 return _aftertaskasyncstorageinstance.afterTaskAsyncStorageInstance; 1603 } 1604}); 1605const _aftertaskasyncstorageinstance = __turbopack_context__.r(783066); 1606}), 1607850999, ((__turbopack_context__, module, exports) => { 1608"use strict"; 1609 1610Object.defineProperty(exports, "__esModule", { 1611 value: true 1612}); 16130 && (module.exports = { 1614 isRequestAPICallableInsideAfter: null, 1615 throwForSearchParamsAccessInUseCache: null, 1616 throwWithStaticGenerationBailoutErrorWithDynamicError: null 1617}); 1618function _export(target, all) { 1619 for(var name in all)Object.defineProperty(target, name, { 1620 enumerable: true, 1621 get: all[name] 1622 }); 1623} 1624_export(exports, { 1625 isRequestAPICallableInsideAfter: function() { 1626 return isRequestAPICallableInsideAfter; 1627 }, 1628 throwForSearchParamsAccessInUseCache: function() { 1629 return throwForSearchParamsAccessInUseCache; 1630 }, 1631 throwWithStaticGenerationBailoutErrorWithDynamicError: function() { 1632 return throwWithStaticGenerationBailoutErrorWithDynamicError; 1633 } 1634}); 1635const _staticgenerationbailout = __turbopack_context__.r(643248); 1636const _aftertaskasyncstorageexternal = __turbopack_context__.r(341643); 1637function throwWithStaticGenerationBailoutErrorWithDynamicError(route, expression) { 1638 throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError("Route ".concat(route, ' with `dynamic = "error"` couldn\'t be rendered statically because it used ').concat(expression, ". See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering")), "__NEXT_ERROR_CODE", { 1639 value: "E543", 1640 enumerable: false, 1641 configurable: true 1642 }); 1643} 1644function throwForSearchParamsAccessInUseCache(workStore, constructorOpt) { 1645 var _workStore, _invalidDynamicUsageError; 1646 const error = Object.defineProperty(new Error("Route ".concat(workStore.route, ' used `searchParams` inside "use cache". Accessing dynamic request data inside a cache scope is not supported. If you need some search params inside a cached function await `searchParams` outside of the cached function and pass only the required search params as arguments to the cached function. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache')), "__NEXT_ERROR_CODE", { 1647 value: "E842", 1648 enumerable: false, 1649 configurable: true 1650 }); 1651 Error.captureStackTrace(error, constructorOpt); 1652 (_invalidDynamicUsageError = (_workStore = workStore).invalidDynamicUsageError) !== null && _invalidDynamicUsageError !== void 0 ? _invalidDynamicUsageError : _workStore.invali
1652dDynamicUsageError = error; 1653 throw error; 1654} 1655function isRequestAPICallableInsideAfter() { 1656 const afterTaskStore = _aftertaskasyncstorageexternal.afterTaskAsyncStorage.getStore(); 1657 return (afterTaskStore == null ? void 0 : afterTaskStore.rootTaskSpawnPhase) === 'action'; 1658} 1659}), 1660928649, ((__turbopack_context__, module, exports) => { 1661"use strict"; 1662 1663var __defProp = Object.defineProperty; 1664var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 1665var __getOwnPropNames = Object.getOwnPropertyNames; 1666var __hasOwnProp = Object.prototype.hasOwnProperty; 1667var __export = (target, all)=>{ 1668 for(var name in all)__defProp(target, name, { 1669 get: all[name], 1670 enumerable: true 1671 }); 1672}; 1673var __copyProps = (to, from, except, desc)=>{ 1674 if (from && typeof from === "object" || typeof from === "function") { 1675 for (let key of __getOwnPropNames(from))if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { 1676 get: ()=>from[key], 1677 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable 1678 }); 1679 } 1680 return to; 1681}; 1682var __toCommonJS = (mod)=>__copyProps(__defProp({}, "__esModule", { 1683 value: true 1684 }), mod);
1685// src/index.ts 1686var src_exports = {}; 1687__export(src_exports, { 1688 RequestCookies: ()=>RequestCookies, 1689 ResponseCookies: ()=>ResponseCookies, 1690 parseCookie: ()=>parseCookie, 1691 parseSetCookie: ()=>parseSetCookie, 1692 stringifyCookie: ()=>stringifyCookie 1693}); 1694module.exports = __toCommonJS(src_exports);
1695// src/serialize.ts 1696function stringifyCookie(c) { 1697 var _a; 1698 const attrs = [ 1699 "path" in c && c.path && "Path=".concat(c.path), 1700 "expires" in c && (c.expires || c.expires === 0) && "Expires=".concat((typeof c.expires === "number" ? new Date(c.expires) : c.expires).toUTCString()), 1701 "maxAge" in c && typeof c.maxAge === "number" && "Max-Age=".concat(c.maxAge), 1702 "domain" in c && c.domain && "Domain=".concat(c.domain), 1703 "secure" in c && c.secure && "Secure", 1704 "httpOnly" in c && c.httpOnly && "HttpOnly", 1705 "sameSite" in c && c.sameSite && "SameSite=".concat(c.sameSite), 1706 "partitioned" in c && c.partitioned && "Partitioned", 1707 "priority" in c && c.priority && "Priority=".concat(c.priority) 1708 ].filter(Boolean); 1709 const stringified = "".concat(c.name, "=").concat(encodeURIComponent((_a = c.value) != null ? _a : "")); 1710 return attrs.length === 0 ? stringified : "".concat(stringified, "; ").concat(attrs.join("; ")); 1711} 1712function parseCookie(cookie) { 1713 const map = /* @__PURE__ */ new Map(); 1714 for (const pair of cookie.split(/; */)){ 1715 if (!pair) continue; 1716 const splitAt = pair.indexOf("="); 1717 if (splitAt === -1) { 1718 map.set(pair, "true"); 1719 continue; 1720 } 1721 const [key, value] = [ 1722 pair.slice(0, splitAt), 1723 pair.slice(splitAt + 1) 1724 ]; 1725 try { 1726 map.set(key, decodeURIComponent(value != null ? value : "true")); 1727 } catch (unused) {} 1728 } 1729 return map; 1730} 1731function parseSetCookie(setCookie) { 1732 if (!setCookie) { 1733 return void 0; 1734 } 1735 const [[name, value], ...attributes] = parseCookie(setCookie); 1736 const { domain, expires, httponly, maxage, path, samesite, secure, partitioned, priority } = Object.fromEntries(attributes.map((param)=>{ 1737 let [key, value2] = param; 1738 return [ 1739 key.toLowerCase().replace(/-/g, ""), 1740 value2 1741 ]; 1742 })); 1743 const cookie = { 1744 name, 1745 value: decodeURIComponent(value), 1746 domain, 1747 ...expires && { 1748 expires: new Date(expires) 1749 }, 1750 ...httponly && { 1751 httpOnly: true 1752 }, 1753 ...typeof maxage === "string" && { 1754 maxAge: Number(maxage) 1755 }, 1756 path, 1757 ...samesite && { 1758 sameSite: parseSameSite(samesite) 1759 }, 1760 ...secure && { 1761 secure: true 1762 }, 1763 ...priority && { 1764 priority: parsePriority(priority) 1765 }, 1766 ...partitioned && { 1767 partitioned: true 1768 } 1769 }; 1770 return compact(cookie); 1771} 1772function compact(t) { 1773 const newT = {}; 1774 for(const key in t){ 1775 if (t[key]) { 1776 newT[key] = t[key]; 1777 } 1778 } 1779 return newT; 1780} 1781var SAME_SITE = [ 1782 "strict", 1783 "lax", 1784 "none" 1785]; 1786function parseSameSite(string) { 1787 string = string.toLowerCase(); 1788 return SAME_SITE.includes(string) ? string : void 0; 1789} 1790var PRIORITY = [ 1791 "low", 1792 "medium", 1793 "high" 1794]; 1795function parsePriority(string) { 1796 string = string.toLowerCase(); 1797 return PRIORITY.includes(string) ? string : void 0; 1798} 1799function splitCookiesString(cookiesString) { 1800 if (!cookiesString) return []; 1801 var cookiesStrings = []; 1802 var pos = 0; 1803 var start; 1804 var ch; 1805 var lastComma; 1806 var nextStart; 1807 var cookiesSeparatorFound; 1808 function skipWhitespace() { 1809 while(pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))){ 1810 pos += 1; 1811 } 1812 return pos < cookiesString.length; 1813 } 1814 function notSpecialChar() { 1815 ch = cookiesString.charAt(pos); 1816 return ch !== "=" && ch !== ";" && ch !== ","; 1817 } 1818 while(pos < cookiesString.length){ 1819 start = pos; 1820 cookiesSeparatorFound = false; 1821 while(skipWhitespace()){ 1822 ch = cookiesString.charAt(pos); 1823 if (ch === ",") { 1824 lastComma = pos; 1825 pos += 1; 1826 skipWhitespace(); 1827 nextStart = pos; 1828 while(pos < cookiesString.length && notSpecialChar()){ 1829 pos += 1; 1830 } 1831 if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { 1832 cookiesSeparatorFound = true; 1833 pos = nextStart; 1834 cookiesStrings.push(cookiesString.substring(start, lastComma)); 1835 start = pos; 1836 } else { 1837 pos = lastComma + 1; 1838 } 1839 } else { 1840 pos += 1; 1841 } 1842 } 1843 if (!cookiesSeparatorFound || pos >= cookiesString.length) { 1844 cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); 1845 } 1846 } 1847 return cookiesStrings; 1848}
1849// src/request-cookies.ts 1850var RequestCookies = class { 1851 [Symbol.iterator]() { 1852 return this._parsed[Symbol.iterator](); 1853 } 1854 /** 1855 * The amount of cookies received from the client 1856 */ get size() { 1857 return this._parsed.size; 1858 } 1859 get() { 1860 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1861 args[_key] = arguments[_key]; 1862 } 1863 const name = typeof args[0] === "string" ? args[0] : args[0].name; 1864 return this._parsed.get(name); 1865 } 1866 getAll() { 1867 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1868 args[_key] = arguments[_key]; 1869 } 1870 var _a; 1871 const all = Array.from(this._parsed); 1872 if (!args.length) { 1873 return all.map((param)=>{ 1874 let [_, value] = param; 1875 return value; 1876 }); 1877 } 1878 const name = typeof args[0] === "string" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name; 1879 return all.filter((param)=>{ 1880 let [n] = param; 1881 return n === name; 1882 }).map((param)=>{ 1883 let [_, value] = param; 1884 return value; 1885 }); 1886 } 1887 has(name) { 1888 return this._parsed.has(name); 1889 } 1890 set() { 1891 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1892 args[_key] = arguments[_key]; 1893 } 1894 const [name, value] = args.length === 1 ? [ 1895 args[0].name, 1896 args[0].value 1897 ] : args; 1898 const map = this._parsed; 1899 map.set(name, { 1900 name, 1901 value 1902 }); 1903 this._headers.set("cookie", Array.from(map).map((param)=>{ 1904 let [_, value2] = param; 1905 return stringifyCookie(value2); 1906 }).join("; ")); 1907 return this; 1908 } 1909 /** 1910 * Delete the cookies matching the passed name or names in the request. 1911 */ delete(names) { 1912 const map = this._parsed; 1913 const result = !Array.isArray(names) ? map.delete(names) : names.map((name)=>map.delete(name)); 1914 this._headers.set("cookie", Array.from(map).map((param)=>{ 1915 let [_, value] = param; 1916 return stringifyCookie(value); 1917 }).join("; ")); 1918 return result; 1919 } 1920 /** 1921 * Delete all the cookies in the cookies in the request. 1922 */ clear() { 1923 this.delete(Array.from(this._parsed.keys())); 1924 return this; 1925 } 1926 /** 1927 * Format the cookies in the request as a string for logging 1928 */ [Symbol.for("edge-runtime.inspect.custom")]() { 1929 return "RequestCookies ".concat(JSON.stringify(Object.fromEntries(this._parsed))); 1930 } 1931 toString() { 1932 return [ 1933 ...this._parsed.values() 1934 ].map((v)=>"".concat(v.name, "=").concat(encodeURIComponent(v.value))).join("; "); 1935 } 1936 constructor(requestHeaders){ 1937 /** @internal */ this._parsed = /* @__PURE__ */ new Map(); 1938 this._headers = requestHeaders; 1939 const header = requestHeaders.get("cookie"); 1940 if (header) { 1941 const parsed = parseCookie(header); 1942 for (const [name, value] of parsed){ 1943 this._parsed.set(name, { 1944 name, 1945 value 1946 }); 1947 } 1948 } 1949 } 1950};
1951// src/response-cookies.ts 1952var ResponseCookies = class { 1953 /** 1954 * {@link https://wicg.github.io/cookie-store/#CookieStore-get CookieStore#get} without the Promise. 1955 */ get() { 1956 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1957 args[_key] = arguments[_key]; 1958 } 1959 const key = typeof args[0] === "string" ? args[0] : args[0].name; 1960 return this._parsed.get(key); 1961 } 1962 /** 1963 * {@link https://wicg.github.io/cookie-store/#CookieStore-getAll CookieStore#getAll} without the Promise. 1964 */ getAll() { 1965 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1966 args[_key] = arguments[_key]; 1967 } 1968 var _a; 1969 const all = Array.from(this._parsed.values()); 1970 if (!args.length) { 1971 return all; 1972 } 1973 const key = typeof args[0] === "string" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name; 1974 return all.filter((c)=>c.name === key); 1975 } 1976 has(name) { 1977 return this._parsed.has(name); 1978 } 1979 /** 1980 * {@link https://wicg.github.io/cookie-store/#CookieStore-set CookieStore#set} without the Promise. 1981 */ set() { 1982 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1983 args[_key] = arguments[_key]; 1984 } 1985 const [name, value, cookie] = args.length === 1 ? [ 1986 args[0].name, 1987 args[0].value, 1988 args[0] 1989 ] : args; 1990 const map = this._parsed; 1991 map.set(name, normalizeCookie({ 1992 name, 1993 value, 1994 ...cookie 1995 })); 1996 replace(map, this._headers); 1997 return this; 1998 } 1999 /** 2000 * {@link https://wicg.github.io/cookie-store/#CookieStore-delete CookieStore#delete} without the Promise. 2001 */ delete() { 2002 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 2003 args[_key] = arguments[_key]; 2004 } 2005 const [name, options] = typeof args[0] === "string" ? [ 2006 args[0] 2007 ] : [ 2008 args[0].name, 2009 args[0] 2010 ]; 2011 return this.set({ 2012 ...options, 2013 name, 2014 value: "", 2015 expires: /* @__PURE__ */ new Date(0) 2016 }); 2017 } 2018 [Symbol.for("edge-runtime.inspect.custom")]() { 2019 return "ResponseCookies ".concat(JSON.stringify(Object.fromEntries(this._parsed))); 2020 } 2021 toString() { 2022 return [ 2023 ...this._parsed.values() 2024 ].map(stringifyCookie).join("; "); 2025 } 2026 constructor(responseHeaders){ 2027 /** @internal */ this._parsed = /* @__PURE__ */ new Map(); 2028 var _a, _b, _c; 2029 this._headers = responseHeaders;
2030 const setCookie = (_c = (_b = (_a = responseHeaders.getSetCookie) == null ? void 0 : _a.call(responseHeaders)) != null ? _b : responseHeaders.get("set-cookie")) != null ? _c : []; 2031 const cookieStrings = Array.isArray(setCookie) ? setCookie : splitCookiesString(setCookie); 2032 for (const cookieString of cookieStrings){ 2033 const parsed = parseSetCookie(cookieString); 2034 if (parsed) this._parsed.set(parsed.name, parsed); 2035 } 2036 } 2037}; 2038function replace(bag, headers) { 2039 headers.delete("set-cookie"); 2040 for (const [, value] of bag){ 2041 const serialized = stringifyCookie(value); 2042 headers.append("set-cookie", serialized); 2043 } 2044} 2045function normalizeCookie() { 2046 let cookie = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { 2047 name: "", 2048 value: "" 2049 }; 2050 if (typeof cookie.expires === "number") { 2051 cookie.expires = new Date(cookie.expires); 2052 } 2053 if (cookie.maxAge) { 2054 cookie.expires = new Date(Date.now() + cookie.maxAge * 1e3); 2055 } 2056 if (cookie.path === null || cookie.path === void 0) { 2057 cookie.path = "/"; 2058 } 2059 return cookie; 2060} 2061// Annotate the CommonJS export names for ESM import in node: 20620 && (module.exports = { 2063 RequestCookies, 2064 ResponseCookies, 2065 parseCookie, 2066 parseSetCookie, 2067 stringifyCookie 2068}); 2069}), 2070196883, ((__turbopack_context__, module, exports) => { 2071"use strict"; 2072 2073Object.defineProperty(exports, "__esModule", { 2074 value: true 2075}); 20760 && (module.exports = { 2077 RequestCookies: null, 2078 ResponseCookies: null, 2079 stringifyCookie: null 2080}); 2081function _export(target, all) { 2082 for(var name in all)Object.defineProperty(target, name, { 2083 enumerable: true, 2084 get: all[name] 2085 }); 2086} 2087_export(exports, { 2088 RequestCookies: function() { 2089 return _cookies.RequestCookies; 2090 }, 2091 ResponseCookies: function() { 2092 return _cookies.ResponseCookies; 2093 }, 2094 stringifyCookie: function() { 2095 return _cookies.stringifyCookie; 2096 } 2097}); 2098const _cookies = __turbopack_context__.r(928649); 2099}), 2100397270, ((__turbopack_context__, module, exports) => { 2101"use strict"; 2102 2103Object.defineProperty(exports, "__esModule", { 2104 value: true 2105}); 21060 && (module.exports = { 2107 MutableRequestCookiesAdapter: null, 2108 ReadonlyRequestCookiesError: null, 2109 RequestCookiesAdapter: null, 2110 appendMutableCookies: null, 2111 areCookiesMutableInCurrentPhase: null, 2112 createCookiesWithMutableAccessCheck: null, 2113 getModifiedCookieValues: null, 2114 responseCookiesToRequestCookies: null 2115}); 2116function _export(target, all) { 2117 for(var name in all)Object.defineProperty(target, name, { 2118 enumerable: true, 2119 get: all[name] 2120 }); 2121} 2122_export(exports, { 2123 MutableRequestCookiesAdapter: function() { 2124 return MutableRequestCookiesAdapter; 2125 }, 2126 ReadonlyRequestCookiesError: function() { 2127 return ReadonlyRequestCookiesError; 2128 }, 2129 RequestCookiesAdapter: function() { 2130 return RequestCookiesAdapter; 2131 }, 2132 appendMutableCookies: function() { 2133 return appendMutableCookies; 2134 }, 2135 areCookiesMutableInCurrentPhase: function() { 2136 return areCookiesMutableInCurrentPhase; 2137 }, 2138 createCookiesWithMutableAccessCheck: function() { 2139 return createCookiesWithMutableAccessCheck; 2140 }, 2141 getModifiedCookieValues: function() { 2142 return getModifiedCookieValues; 2143 }, 2144 responseCookiesToRequestCookies: function() { 2145 return responseCookiesToRequestCookies; 2146 } 2147}); 2148const _cookies = __turbopack_context__.r(196883); 2149const _reflect = __turbopack_context__.r(242715); 2150const _workasyncstorageexternal = __turbopack_context__.r(563599); 2151const _actionrevalidationkind = __turbopack_context__.r(339146); 2152class ReadonlyRequestCookiesError extends Error { 2153 static callable() { 2154 throw new ReadonlyRequestCookiesError(); 2155 } 2156 constructor(){ 2157 super('Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options'); 2158 } 2159} 2160class RequestCookiesAdapter { 2161 static seal(cookies) { 2162 return new Proxy(cookies, { 2163 get (target, prop, receiver) { 2164 switch(prop){ 2165 case 'clear': 2166 case 'delete': 2167 case 'set': 2168 return ReadonlyRequestCookiesError.callable; 2169 default: 2170 return _reflect.ReflectAdapter.get(target, prop, receiver); 2171 } 2172 } 2173 }); 2174 } 2175} 2176const SYMBOL_MODIFY_COOKIE_VALUES = Symbol.for('next.mutated.cookies'); 2177function getModifiedCookieValues(cookies) { 2178 const modified = cookies[SYMBOL_MODIFY_COOKIE_VALUES]; 2179 if (!modified || !Array.isArray(modified) || modified.length === 0) { 2180 return []; 2181 } 2182 return modified; 2183} 2184function appendMutableCookies(headers, mutableCookies) { 2185 const modifiedCookieValues = getModifiedCookieValues(mutableCookies); 2186 if (modifiedCookieValues.length === 0) { 2187 return false;
2188 } 2189 // Return a new response that extends the response with 2190 // the modified cookies as fallbacks. `res` cookies 2191 // will still take precedence. 2192 const resCookies = new _cookies.ResponseCookies(headers); 2193 const returnedCookies = resCookies.getAll(); 2194 // Set the modified cookies as fallbacks. 2195 for (const cookie of modifiedCookieValues){ 2196 resCookies.set(cookie); 2197 } 2198 // Set the original cookies as the final values. 2199 for (const cookie of returnedCookies){ 2200 resCookies.set(cookie); 2201 } 2202 return true; 2203} 2204class MutableRequestCookiesAdapter { 2205 static wrap(cookies, onUpdateCookies) { 2206 const responseCookies = new _cookies.ResponseCookies(new Headers()); 2207 for (const cookie of cookies.getAll()){ 2208 responseCookies.set(cookie); 2209 } 2210 let modifiedValues = []; 2211 const modifiedCookies = new Set(); 2212 const updateResponseCookies = ()=>{ 2213 // TODO-APP: change method of getting workStore 2214 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 2215 if (workStore) { 2216 workStore.pathWasRevalidated = _actionrevalidationkind.ActionDidRevalidateStaticAndDynamic; 2217 } 2218 const allCookies = responseCookies.getAll(); 2219 modifiedValues = allCookies.filter((c)=>modifiedCookies.has(c.name)); 2220 if (onUpdateCookies) { 2221 const serializedCookies = []; 2222 for (const cookie of modifiedValues){ 2223 const tempCookies = new _cookies.ResponseCookies(new Headers()); 2224 tempCookies.set(cookie); 2225 serializedCookies.push(tempCookies.toString()); 2226 } 2227 onUpdateCookies(serializedCookies); 2228 } 2229 }; 2230 const wrappedCookies = new Proxy(responseCookies, { 2231 get (target, prop, receiver) { 2232 switch(prop){ 2233 // A special symbol to get the modified cookie values 2234 case SYMBOL_MODIFY_COOKIE_VALUES: 2235 return modifiedValues; 2236 // TODO: Throw error if trying to set a cookie after the response 2237 // headers have been set. 2238 case 'delete': 2239 return function() { 2240 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 2241 args[_key] = arguments[_key]; 2242 } 2243 modifiedCookies.add(typeof args[0] === 'string' ? args[0] : args[0].name); 2244 try { 2245 target.delete(...args); 2246 return wrappedCookies; 2247 } finally{ 2248 updateResponseCookies(); 2249 } 2250 }; 2251 case 'set': 2252 return function() { 2253 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 2254 args[_key] = arguments[_key]; 2255 } 2256 modifiedCookies.add(typeof args[0] === 'string' ? args[0] : args[0].name); 2257 try { 2258 target.set(...args); 2259 return wrappedCookies; 2260 } finally{ 2261 updateResponseCookies(); 2262 } 2263 }; 2264 default: 2265 return _reflect.ReflectAdapter.get(target, prop, receiver); 2266 } 2267 } 2268 }); 2269 return wrappedCookies; 2270 } 2271} 2272function createCookiesWithMutableAccessCheck(requestStore) { 2273 const wrappedCookies = new Proxy(requestStore.mutableCookies, { 2274 get (target, prop, receiver) { 2275 switch(prop){ 2276 case 'delete': 2277 return function() { 2278 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 2279 args[_key] = arguments[_key]; 2280 } 2281 ensureCookiesAreStillMutable(requestStore, 'cookies().delete'); 2282 target.delete(...args); 2283 return wrappedCookies; 2284 }; 2285 case 'set': 2286 return function() { 2287 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 2288 args[_key] = arguments[_key]; 2289 } 2290 ensureCookiesAreStillMutable(requestStore, 'cookies().set'); 2291 target.set(...args); 2292 return wrappedCookies; 2293 }; 2294 default: 2295 return _reflect.ReflectAdapter.get(target, prop, receiver); 2296 } 2297 } 2298 }); 2299 return wrappedCookies; 2300} 2301function areCookiesMutableInCurrentPhase(requestStore) { 2302 return requestStore.phase === 'action'; 2303} 2304/** Ensure that cookies() starts throwing on mutation 2305 * if we changed phases and can no longer mutate. 2306 * 2307 * This can happen when going: 2308 * 'render' -> 'after' 2309 * 'action' -> 'render' 2310 * */ function ensureCookiesAreStillMutable(requestStore, _callingExpression) { 2311 if (!areCookiesMutableInCurrentPhase(requestStore)) { 2312 // TODO: maybe we can give a more precise error message based on callingExpression? 2313 throw new ReadonlyRequestCookiesError(); 2314 } 2315} 2316function responseCookiesToRequestCookies(responseCookies) { 2317 const requestCookies = new _cookies.RequestCookies(new Headers()); 2318 for (const cookie of responseCookies.getAll()){ 2319 requestCookies.set(cookie); 2320 } 2321 return requestCookies; 2322} 2323}),
2324687720, ((__turbopack_context__, module, exports) => { 2325"use strict"; 2326 2327Object.defineProperty(exports, "__esModule", { 2328 value: true 2329}); 23300 && (module.exports = { 2331 HeadersAdapter: null, 2332 ReadonlyHeadersError: null 2333}); 2334function _export(target, all) { 2335 for(var name in all)Object.defineProperty(target, name, { 2336 enumerable: true, 2337 get: all[name] 2338 }); 2339} 2340_export(exports, { 2341 HeadersAdapter: function() { 2342 return HeadersAdapter; 2343 }, 2344 ReadonlyHeadersError: function() { 2345 return ReadonlyHeadersError; 2346 } 2347}); 2348const _reflect = __turbopack_context__.r(242715); 2349class ReadonlyHeadersError extends Error { 2350 static callable() { 2351 throw new ReadonlyHeadersError(); 2352 } 2353 constructor(){ 2354 super('Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers'); 2355 } 2356} 2357class HeadersAdapter extends Headers { 2358 /** 2359 * Seals a Headers instance to prevent modification by throwing an error when 2360 * any mutating method is called. 2361 */ static seal(headers) { 2362 return new Proxy(headers, { 2363 get (target, prop, receiver) { 2364 switch(prop){ 2365 case 'append': 2366 case 'delete': 2367 case 'set': 2368 return ReadonlyHeadersError.callable; 2369 default: 2370 return _reflect.ReflectAdapter.get(target, prop, receiver); 2371 } 2372 } 2373 }); 2374 } 2375 /** 2376 * Merges a header value into a string. This stores multiple values as an 2377 * array, so we need to merge them into a string. 2378 * 2379 * @param value a header value 2380 * @returns a merged header value (a string) 2381 */ merge(value) { 2382 if (Array.isArray(value)) return value.join(', '); 2383 return value; 2384 } 2385 /** 2386 * Creates a Headers instance from a plain object or a Headers instance. 2387 * 2388 * @param headers a plain object or a Headers instance 2389 * @returns a headers instance 2390 */ static from(headers) { 2391 if (headers instanceof Headers) return headers; 2392 return new HeadersAdapter(headers); 2393 } 2394 append(name, value) { 2395 const existing = this.headers[name]; 2396 if (typeof existing === 'string') { 2397 this.headers[name] = [ 2398 existing, 2399 value 2400 ]; 2401 } else if (Array.isArray(existing)) { 2402 existing.push(value); 2403 } else { 2404 this.headers[name] = value; 2405 } 2406 } 2407 delete(name) { 2408 delete this.headers[name]; 2409 } 2410 get(name) { 2411 const value = this.headers[name]; 2412 if (typeof value !== 'undefined') return this.merge(value); 2413 return null; 2414 } 2415 has(name) { 2416 return typeof this.headers[name] !== 'undefined'; 2417 } 2418 set(name, value) { 2419 this.headers[name] = value; 2420 } 2421 forEach(callbackfn, thisArg) { 2422 for (const [name, value] of this.entries()){ 2423 callbackfn.call(thisArg, value, name, this); 2424 } 2425 } 2426 *entries() { 2427 for (const key of Object.keys(this.headers)){ 2428 const name = key.toLowerCase(); 2429 // We assert here that this is a string because we got it from the 2430 // Object.keys() call above. 2431 const value = this.get(name); 2432 yield [ 2433 name, 2434 value 2435 ]; 2436 } 2437 } 2438 *keys() { 2439 for (const key of Object.keys(this.headers)){ 2440 const name = key.toLowerCase(); 2441 yield name; 2442 } 2443 } 2444 *values() { 2445 for (const key of Object.keys(this.headers)){ 2446 // We assert here that this is a string because we got it from the 2447 // Object.keys() call above. 2448 const value = this.get(key); 2449 yield value; 2450 } 2451 } 2452 [Symbol.iterator]() { 2453 return this.entries(); 2454 } 2455 constructor(headers){ 2456 // We've already overridden the methods that would be called, so we're just 2457 // calling the super constructor to ensure that the instanceof check works. 2458 super(); 2459 this.headers = new Proxy(headers, { 2460 get (target, prop, receiver) { 2461 // Because this is just an object, we expect that all "get" operations 2462 // are for properties. If it's a "get" for a symbol, we'll just return 2463 // the symbol. 2464 if (typeof prop === 'symbol') { 2465 return _reflect.ReflectAdapter.get(target, prop, receiver); 2466 }
2467 const lowercased = prop.toLowerCase(); 2468 // Let's find the original casing of the key. This assumes that there is 2469 // no mixed case keys (e.g. "Content-Type" and "content-type") in the 2470 // headers object. 2471 const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); 2472 // If the original casing doesn't exist, return undefined. 2473 if (typeof original === 'undefined') return; 2474 // If the original casing exists, return the value. 2475 return _reflect.ReflectAdapter.get(target, original, receiver); 2476 }, 2477 set (target, prop, value, receiver) { 2478 if (typeof prop === 'symbol') { 2479 return _reflect.ReflectAdapter.set(target, prop, value, receiver); 2480 } 2481 const lowercased = prop.toLowerCase(); 2482 // Let's find the original casing of the key. This assumes that there is 2483 // no mixed case keys (e.g. "Content-Type" and "content-type") in the 2484 // headers object. 2485 const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); 2486 // If the original casing doesn't exist, use the prop as the key. 2487 return _reflect.ReflectAdapter.set(target, original !== null && original !== void 0 ? original : prop, value, receiver); 2488 }, 2489 has (target, prop) { 2490 if (typeof prop === 'symbol') return _reflect.ReflectAdapter.has(target, prop); 2491 const lowercased = prop.toLowerCase(); 2492 // Let's find the original casing of the key. This assumes that there is 2493 // no mixed case keys (e.g. "Content-Type" and "content-type") in the 2494 // headers object. 2495 const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); 2496 // If the original casing doesn't exist, return false. 2497 if (typeof original === 'undefined') return false; 2498 // If the original casing exists, return true. 2499 return _reflect.ReflectAdapter.has(target, original); 2500 }, 2501 deleteProperty (target, prop) { 2502 if (typeof prop === 'symbol') return _reflect.ReflectAdapter.deleteProperty(target, prop); 2503 const lowercased = prop.toLowerCase(); 2504 // Let's find the original casing of the key. This assumes that there is 2505 // no mixed case keys (e.g. "Content-Type" and "content-type") in the 2506 // headers object. 2507 const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased); 2508 // If the original casing doesn't exist, return true. 2509 if (typeof original === 'undefined') return true; 2510 // If the original casing exists, delete the property. 2511 return _reflect.ReflectAdapter.deleteProperty(target, original); 2512 } 2513 }); 2514 } 2515} 2516}), 2517401643, ((__turbopack_context__, module, exports) => { 2518"use strict"; 2519 2520Object.defineProperty(exports, "__esModule", { 2521 value: true 2522}); 25230 && (module.exports = { 2524 getParamProperties: null, 2525 getSegmentParam: null, 2526 isCatchAll: null 2527}); 2528function _export(target, all) { 2529 for(var name in all)Object.defineProperty(target, name, { 2530 enumerable: true, 2531 get: all[name] 2532 }); 2533} 2534_export(exports, { 2535 getParamProperties: function() { 2536 return getParamProperties; 2537 }, 2538 getSegmentParam: function() { 2539 return getSegmentParam; 2540 }, 2541 isCatchAll: function() { 2542 return isCatchAll; 2543 } 2544}); 2545const _interceptionroutes = __turbopack_context__.r(591463); 2546function getSegmentParam(segment) { 2547 const interceptionMarker = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.find((marker)=>segment.startsWith(marker)); 2548 // if an interception marker is part of the path segment, we need to jump ahead 2549 // to the relevant portion for param parsing 2550 if (interceptionMarker) { 2551 segment = segment.slice(interceptionMarker.length); 2552 } 2553 if (segment.startsWith('[[...') && segment.endsWith(']]')) { 2554 return { 2555 // TODO-APP: Optional catchall does not currently work with parallel routes, 2556 // so for now aren't handling a potential interception marker. 2557 paramType: 'optional-catchall', 2558 paramName: segment.slice(5, -2) 2559 }; 2560 } 2561 if (segment.startsWith('[...') && segment.endsWith(']')) { 2562 return { 2563 paramType: interceptionMarker ? "catchall-intercepted-".concat(interceptionMarker) : 'catchall', 2564 paramName: segment.slice(4, -1) 2565 }; 2566 } 2567 if (segment.startsWith('[') && segment.endsWith(']')) { 2568 return { 2569 paramType: interceptionMarker ? "dynamic-intercepted-".concat(interceptionMarker) : 'dynamic', 2570 paramName: segment.slice(1, -1) 2571 }; 2572 } 2573 return null; 2574} 2575function isCatchAll(type) { 2576 return type === 'catchall' || type === 'catchall-intercepted-(..)(..)' || type === 'catchall-intercepted-(.)' || type === 'catchall-intercepted-(..)' || type === 'catchall-intercepted-(...)' || type === 'optional-catchall'; 2577} 2578function getParamProperties(paramType) { 2579 let repeat = false;
2580 let optional = false; 2581 switch(paramType){ 2582 case 'catchall': 2583 case 'catchall-intercepted-(..)(..)': 2584 case 'catchall-intercepted-(.)': 2585 case 'catchall-intercepted-(..)': 2586 case 'catchall-intercepted-(...)': 2587 repeat = true; 2588 break; 2589 case 'optional-catchall': 2590 repeat = true; 2591 optional = true; 2592 break; 2593 case 'dynamic': 2594 case 'dynamic-intercepted-(..)(..)': 2595 case 'dynamic-intercepted-(.)': 2596 case 'dynamic-intercepted-(..)': 2597 case 'dynamic-intercepted-(...)': 2598 break; 2599 default: 2600 paramType; 2601 } 2602 return { 2603 repeat, 2604 optional 2605 }; 2606} 2607}), 2608722783, ((__turbopack_context__, module, exports) => { 2609"use strict"; 2610 2611Object.defineProperty(exports, "__esModule", { 2612 value: true 2613}); 2614Object.defineProperty(exports, "parseRelativeUrl", { 2615 enumerable: true, 2616 get: function() { 2617 return parseRelativeUrl; 2618 } 2619}); 2620const _utils = __turbopack_context__.r(718967); 2621const _querystring = __turbopack_context__.r(998183); 2622function parseRelativeUrl(url, base) { 2623 let parseQuery = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; 2624 const globalBase = new URL(typeof window === 'undefined' ? 'http://n' : (0, _utils.getLocationOrigin)()); 2625 const resolvedBase = base ? new URL(base, globalBase) : url.startsWith('.') ? new URL(typeof window === 'undefined' ? 'http://n' : window.location.href) : globalBase; 2626 const { pathname, searchParams, search, hash, href, origin } = url.startsWith('/') ? // Not using `origin` to support other protocols 2627 new URL("".concat(resolvedBase.protocol, "//").concat(resolvedBase.host).concat(url)) : new URL(url, resolvedBase); 2628 if (origin !== globalBase.origin) { 2629 throw Object.defineProperty(new Error("invariant: invalid relative URL, router received ".concat(url)), "__NEXT_ERROR_CODE", { 2630 value: "E159", 2631 enumerable: false, 2632 configurable: true 2633 }); 2634 } 2635 return { 2636 auth: null, 2637 host: null, 2638 hostname: null, 2639 pathname, 2640 port: null, 2641 protocol: null, 2642 query: parseQuery ? (0, _querystring.searchParamsToUrlQuery)(searchParams) : undefined, 2643 search, 2644 hash, 2645 href: href.slice(origin.length), 2646 // We don't know for relative URLs at this point since we set a custom, internal 2647 // base that isn't surfaced to users. 2648 slashes: null 2649 }; 2650} 2651}), 2652513770, ((__turbopack_context__, module, exports) => { 2653"use strict"; 2654 2655Object.defineProperty(exports, "__esModule", { 2656 value: true 2657}); 26580 && (module.exports = { 2659 InstantValidationError: null, 2660 isInstantValidationError: null 2661}); 2662function _export(target, all) { 2663 for(var name in all)Object.defineProperty(target, name, { 2664 enumerable: true, 2665 get: all[name] 2666 }); 2667} 2668_export(exports, { 2669 InstantValidationError: function() { 2670 return InstantValidationError; 2671 }, 2672 isInstantValidationError: function() { 2673 return isInstantValidationError; 2674 } 2675}); 2676const INSTANT_VALIDATION_ERROR_DIGEST = 'INSTANT_VALIDATION_ERROR'; 2677function isInstantValidationError(err) { 2678 return !!(err && typeof err === 'object' && err instanceof Error && err.digest === INSTANT_VALIDATION_ERROR_DIGEST); 2679} 2680class InstantValidationError extends Error { 2681 constructor(...args){ 2682 super(...args), this.digest = INSTANT_VALIDATION_ERROR_DIGEST; 2683 } 2684} 2685}), 2686918450, ((__turbopack_context__, module, exports) => { 2687"use strict"; 2688 2689Object.defineProperty(exports, "__esModule", { 2690 value: true 2691}); 26920 && (module.exports = { 2693 assertRootParamInSamples: null, 2694 createCookiesFromSample: null, 2695 createDraftModeForValidation: null, 2696 createExhaustiveParamsProxy: null, 2697 createExhaustiveSearchParamsProxy: null, 2698 createExhaustiveURLSearchParamsProxy: null, 2699 createHeadersFromSample: null, 2700 createRelativeURLFromSamples: null, 2701 createValidationSampleTracking: null, 2702 trackMissingSampleError: null, 2703 trackMissingSampleErrorAndThrow: null 2704}); 2705function _export(target, all) { 2706 for(var name in all)Object.defineProperty(target, name, { 2707 enumerable: true, 2708 get: all[name] 2709 }); 2710} 2711_export(exports, { 2712 assertRootParamInSamples: function() { 2713 return assertRootParamInSamples; 2714 }, 2715 createCookiesFromSample: function() { 2716 return createCookiesFromSample; 2717 }, 2718 createDraftModeForValidation: function() { 2719 return createDraftModeForValidation; 2720 }, 2721 createExhaustiveParamsProxy: function() { 2722 return createExhaustiveParamsProxy; 2723 }, 2724 createExhaustiveSearchParamsProxy: function() { 2725 return createExhaustiveSearchParamsProxy; 2726 }, 2727 createExhaustiveURLSearchParamsProxy: function() { 2728 return createExhaustiveURLSearchParamsProxy; 2729 },
2730 createHeadersFromSample: function() { 2731 return createHeadersFromSample; 2732 }, 2733 createRelativeURLFromSamples: function() { 2734 return createRelativeURLFromSamples; 2735 }, 2736 createValidationSampleTracking: function() { 2737 return createValidationSampleTracking; 2738 }, 2739 trackMissingSampleError: function() { 2740 return trackMissingSampleError; 2741 }, 2742 trackMissingSampleErrorAndThrow: function() { 2743 return trackMissingSampleErrorAndThrow; 2744 } 2745}); 2746const _cookies = __turbopack_context__.r(196883); 2747const _requestcookies = __turbopack_context__.r(397270); 2748const _headers = __turbopack_context__.r(687720); 2749const _getsegmentparam = __turbopack_context__.r(401643); 2750const _parserelativeurl = __turbopack_context__.r(722783); 2751const _invarianterror = __turbopack_context__.r(312718); 2752const _instantvalidationerror = __turbopack_context__.r(513770); 2753const _workunitasyncstorageexternal = __turbopack_context__.r(662141); 2754const _reflectutils = __turbopack_context__.r(565932); 2755function createValidationSampleTracking() { 2756 return { 2757 missingSampleErrors: [] 2758 }; 2759} 2760function getExpectedSampleTracking() { 2761 let validationSampleTracking = null; 2762 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 2763 if (workUnitStore) { 2764 switch(workUnitStore.type){ 2765 case 'request': 2766 case 'validation-client': 2767 var _workUnitStore_validationSampleTracking; 2768 // TODO(instant-validation-build): do we need any special handling for caches? 2769 validationSampleTracking = (_workUnitStore_validationSampleTracking = workUnitStore.validationSampleTracking) !== null && _workUnitStore_validationSampleTracking !== void 0 ? _workUnitStore_validationSampleTracking : null; 2770 break; 2771 case 'cache': 2772 case 'private-cache': 2773 case 'unstable-cache': 2774 case 'prerender-legacy': 2775 case 'prerender-ppr': 2776 case 'prerender-client': 2777 case 'prerender': 2778 case 'prerender-runtime': 2779 case 'generate-static-params': 2780 break; 2781 default: 2782 workUnitStore; 2783 } 2784 } 2785 if (!validationSampleTracking) { 2786 throw Object.defineProperty(new _invarianterror.InvariantError('Expected to have a workUnitStore that provides validationSampleTracking'), "__NEXT_ERROR_CODE", { 2787 value: "E1110", 2788 enumerable: false, 2789 configurable: true 2790 }); 2791 } 2792 return validationSampleTracking; 2793} 2794function trackMissingSampleError(error) { 2795 const validationSampleTracking = getExpectedSampleTracking(); 2796 validationSampleTracking.missingSampleErrors.push(error); 2797} 2798function trackMissingSampleErrorAndThrow(error) { 2799 // TODO(instant-validation-build): this should abort the render 2800 trackMissingSampleError(error); 2801 throw error; 2802} 2803function createCookiesFromSample(sampleCookies, route) { 2804 const declaredNames = new Set(); 2805 const cookies = new _cookies.RequestCookies(new Headers()); 2806 if (sampleCookies) { 2807 for (const cookie of sampleCookies){ 2808 declaredNames.add(cookie.name); 2809 if (cookie.value !== null) { 2810 cookies.set(cookie.name, cookie.value); 2811 } 2812 } 2813 } 2814 const sealed = _requestcookies.RequestCookiesAdapter.seal(cookies); 2815 return new Proxy(sealed, { 2816 get (target, prop, receiver) { 2817 if (prop === 'has') { 2818 const originalMethod = Reflect.get(target, prop, receiver); 2819 const wrappedMethod = function(name) { 2820 if (!declaredNames.has(name)) { 2821 trackMissingSampleErrorAndThrow(createMissingCookieSampleError(route, name)); 2822 } 2823 return originalMethod.call(target, name); 2824 }; 2825 return wrappedMethod; 2826 } 2827 if (prop === 'get') { 2828 const originalMethod = Reflect.get(target, prop, receiver); 2829 const wrappedMethod = function(nameOrCookie) { 2830 let name; 2831 if (typeof nameOrCookie === 'string') { 2832 name = nameOrCookie; 2833 } else if (nameOrCookie && typeof nameOrCookie === 'object' && typeof nameOrCookie.name === 'string') { 2834 name = nameOrCookie.name; 2835 } else {
2836 // This is an invalid input. Pass it through to the original method so it can error. 2837 return originalMethod.call(target, nameOrCookie); 2838 } 2839 if (!declaredNames.has(name)) { 2840 trackMissingSampleErrorAndThrow(createMissingCookieSampleError(route, name)); 2841 } 2842 return originalMethod.call(target, name); 2843 }; 2844 return wrappedMethod; 2845 } 2846 // TODO(instant-validation-build): what should getAll do? 2847 // Maybe we should only allow it if there's an array (possibly empty?) 2848 return Reflect.get(target, prop, receiver); 2849 } 2850 }); 2851} 2852function createMissingCookieSampleError(route, name) { 2853 return Object.defineProperty(new _instantvalidationerror.InstantValidationError('Route "'.concat(route, '" accessed cookie "').concat(name, '" which is not defined in the `samples` ') + "of `unstable_instant`. Add it to the sample's `cookies` array, " + 'or `{ name: "'.concat(name, '", value: null }` if it should be absent.')), "__NEXT_ERROR_CODE", { 2854 value: "E1115", 2855 enumerable: false, 2856 configurable: true 2857 }); 2858} 2859function createHeadersFromSample(rawSampleHeaders, sampleCookies, route) { 2860 // If we have cookie samples, add a `cookie` header to match. 2861 // Accessing it will be implicitly allowed by the proxy -- 2862 // if the user defined some cookies, accessing the "cookie" header is also fine. 2863 const sampleHeaders = rawSampleHeaders ? [ 2864 ...rawSampleHeaders 2865 ] : []; 2866 if (sampleHeaders.find((param)=>{ 2867 let [name] = param; 2868 return name.toLowerCase() === 'cookie'; 2869 })) {
2870 throw Object.defineProperty(new _instantvalidationerror.InstantValidationError('Invalid sample: Defining cookies via a "cookie" header is not supported. Use `cookies: [{ name: ..., value: ... }]` instead.'), "__NEXT_ERROR_CODE", { 2871 value: "E1111", 2872 enumerable: false, 2873 configurable: true 2874 }); 2875 } 2876 if (sampleCookies) { 2877 const cookieHeaderValue = sampleCookies.toString(); 2878 sampleHeaders.push([ 2879 'cookie', 2880 // if the `cookies` samples were empty, or they were all `null`, then we have no cookies, 2881 // and the header isn't present, but should remains readable, so we set it to null. 2882 cookieHeaderValue !== '' ? cookieHeaderValue : null 2883 ]); 2884 } 2885 const declaredNames = new Set(); 2886 const headersInit = {}; 2887 for (const [name, value] of sampleHeaders){ 2888 declaredNames.add(name.toLowerCase()); 2889 if (value !== null) { 2890 headersInit[name.toLowerCase()] = value; 2891 } 2892 } 2893 const sealed = _headers.HeadersAdapter.seal(_headers.HeadersAdapter.from(headersInit)); 2894 return new Proxy(sealed, { 2895 get (target, prop, receiver) { 2896 if (prop === 'get' || prop === 'has') { 2897 const originalMethod = Reflect.get(target, prop, receiver); 2898 const patchedMethod = function(rawName) { 2899 const name = rawName.toLowerCase(); 2900 if (!declaredNames.has(name)) { 2901 trackMissingSampleErrorAndThrow(Object.defineProperty(new _instantval
2901idationerror.InstantValidationError('Route "'.concat(route, '" accessed header "').concat(name, '" which is not defined in the `samples` ') + "of `unstable_instant`. Add it to the sample's `headers` array, " + 'or `["'.concat(name, '", null]` if it should be absent.')), "__NEXT_ERROR_CODE", { 2902 value: "E1116", 2903 enumerable: false, 2904 configurable: true 2905 })); 2906 } 2907 // typescript can't reconcile a union of functions with a union of return types, 2908 // so we have to cast the original return type away 2909 return originalMethod.call(target, name); 2910 }; 2911 return patchedMethod; 2912 } 2913 return Reflect.get(target, prop, receiver); 2914 } 2915 }); 2916} 2917function createDraftModeForValidation() { 2918 // Create a minimal DraftModeProvider-compatible object 2919 // that always reports draft mode as disabled. 2920 // 2921 // private properties that can't be set from outside the class. 2922 return { 2923 get isEnabled () { 2924 return false; 2925 }, 2926 enable () { 2927 throw Object.defineProperty(new Error('Draft mode cannot be enabled during build-time instant validation.'), "__NEXT_ERROR_CODE", { 2928 value: "E1092", 2929 enumerable: false, 2930 configurable: true 2931 }); 2932 }, 2933 disable () { 2934 throw Object.defineProperty(new Error('Draft mode cannot be disabled during build-time instant validation.'), "__NEXT_ERROR_CODE", { 2935 value: "E1094", 2936 enumerable: false, 2937 configurable: true 2938 }); 2939 } 2940 }; 2941} 2942function createExhaustiveParamsProxy(underlyingParams, declaredParamNames, route) { 2943 return new Proxy(underlyingParams, { 2944 get (target, prop, receiver) { 2945 if (typeof prop === 'string' && !_reflectutils.wellKnownProperties.has(prop) && // Only error when accessing a param that is part of the route but wasn't provided. 2946 // accessing properties that aren't expected to be a valid param value is fine. 2947 prop in underlyingParams && !declaredParamNames.has(prop)) { 2948 trackMissingSampleErrorAndThrow(Object.defineProperty(new _instantval
2948idationerror.InstantValidationError('Route "'.concat(route, '" accessed param "').concat(prop, '" which is not defined in the `samples` ') + "of `unstable_instant`. Add it to the sample's `params` object."), "__NEXT_ERROR_CODE", { 2949 value: "E1095", 2950 enumerable: false, 2951 configurable: true 2952 })); 2953 } 2954 return Reflect.get(target, prop, receiver); 2955 } 2956 }); 2957} 2958function createExhaustiveSearchParamsProxy(searchParams, declaredSearchParamNames, route) { 2959 return new Proxy(searchParams, { 2960 get (target, prop, receiver) { 2961 if (typeof prop === 'string' && !_reflectutils.wellKnownProperties.has(prop) && !declaredSearchParamNames.has(prop)) { 2962 trackMissingSampleErrorAndThrow(createMissingSearchParamSampleError(route, prop)); 2963 } 2964 return Reflect.get(target, prop, receiver); 2965 }, 2966 has (target, prop) { 2967 if (typeof prop === 'string' && !_reflectutils.wellKnownProperties.has(prop) && !declaredSearchParamNames.has(prop)) { 2968 trackMissingSampleErrorAndThrow(createMissingSearchParamSampleError(route, prop)); 2969 } 2970 return Reflect.has(target, prop); 2971 } 2972 }); 2973} 2974function createExhaustiveURLSearchParamsProxy(searchParams, declaredSearchParamNames, route) { 2975 return new Proxy(searchParams, { 2976 get (target, prop, receiver) { 2977 // Intercept method calls that access specific param names 2978 if (prop === 'get' || prop === 'getAll' || prop === 'has') { 2979 const originalMathod = Reflect.get(target, prop, receiver); 2980 return (name)=>{ 2981 if (typeof name === 'string' && !declaredSearchParamNames.has(name)) { 2982 trackMissingSampleErrorAndThrow(createMissingSearchParamSampleError(route, name)); 2983 } 2984 return originalMathod.call(target, name); 2985 }; 2986 } 2987 const value = Reflect.get(target, prop, receiver); 2988 // Prevent `TypeError: Value of "this" must be of type URLSearchParams` for methods 2989 if (typeof value === 'function' && !Object.hasOwn(target, prop)) { 2990 return value.bind(target); 2991 } 2992 return value; 2993 } 2994 }); 2995} 2996function createMissingSearchParamSampleError(route, name) {
2997 return Object.defineProperty(new _instantvalidationerror.InstantValidationError('Route "'.concat(route, '" accessed searchParam "').concat(name, '" which is not defined in the `samples` ') + "of `unstable_instant`. Add it to the sample's `searchParams` object, " + 'or `{ "'.concat(name, '": null }` if it should be absent.')), "__NEXT_ERROR_CODE", { 2998 value: "E1098", 2999 enumerable: false, 3000 configurable: true 3001 }); 3002} 3003function createRelativeURLFromSamples(route, sampleParams, sampleSearchParams) { 3004 // Build searchParams query object and URL search string from sample 3005 const pathname = createPathnameFromRouteAndSampleParams(route, sampleParams !== null && sampleParams !== void 0 ? sampleParams : {}); 3006 let search = ''; 3007 if (sampleSearchParams) { 3008 const qs = createURLSearchParamsFromSample(sampleSearchParams).toString(); 3009 if (qs) { 3010 search = '?' + qs; 3011 } 3012 } 3013 return (0, _parserelativeurl.parseRelativeUrl)(pathname + search, undefined, true); 3014} 3015function createURLSearchParamsFromSample(sampleSearchParams) { 3016 const result = new URLSearchParams(); 3017 if (sampleSearchParams) { 3018 for (const [key, value] of Object.entries(sampleSearchParams)){ 3019 if (value === null || value === undefined) continue; 3020 if (Array.isArray(value)) { 3021 for (const v of value){ 3022 result.append(key, v); 3023 } 3024 } else { 3025 result.set(key, value); 3026 } 3027 } 3028 } 3029 return result; 3030} 3031/** 3032 * Substitute sample params into `workStore.route` to create a plausible pathname. 3033 * TODO(instant-validation-build): this logic is somewhat hacky and likely incomplete, 3034 * but it should be good enough for some initial testing. 3035 */ function createPathnameFromRouteAndSampleParams(route, params) { 3036 let interpolatedSegments = []; 3037 const rawSegments = route.split('/'); 3038 for (const rawSegment of rawSegments){ 3039 const param = (0, _getsegmentparam.getSegmentParam)(rawSegment); 3040 if (param) { 3041 switch(param.paramType){ 3042 case 'catchall': 3043 case 'optional-catchall': 3044 { 3045 let paramValue = params[param.paramName]; 3046 if (paramValue === undefined) { 3047 // The value for the param was not provided. `usePathname` will detect this and throw 3048 // before this can surface to userspace. Use `[...NAME]` as a placeholder for the param value 3049 // in case it pops up somewhere unexpectedly. 3050 paramValue = [ 3051 rawSegment 3052 ]; 3053 } else if (!Array.isArray(paramValue)) { 3054 // NOTE: this happens outside of render, so we don't need `trackMissingSampleErrorAndThrow` 3055 throw Object.defineProperty(new _instantval
3055idationerror.InstantValidationError("Expected sample param value for segment '".concat(rawSegment, "' to be an array of strings, got ").concat(typeof paramValue)), "__NEXT_ERROR_CODE", { 3056 value: "E1104", 3057 enumerable: false, 3058 configurable: true 3059 }); 3060 } 3061 interpolatedSegments.push(...paramValue.map((v)=>encodeURIComponent(v))); 3062 break; 3063 } 3064 case 'dynamic': 3065 { 3066 let paramValue = params[param.paramName]; 3067 if (paramValue === undefined) { 3068 // The value for the param was not provided. `usePathname` will detect this and throw 3069 // before this can surface to userspace. Use `[NAME]` as a placeholder for the param value 3070 // in case it pops up somewhere unexpectedly. 3071 paramValue = rawSegment; 3072 } else if (typeof paramValue !== 'string') { 3073 // NOTE: this happens outside of render, so we don't need `trackMissingSampleErrorAndThrow` 3074 throw Object.defineProperty(new _instantval
3074idationerror.InstantValidationError("Expected sample param value for segment '".concat(rawSegment, "' to be a string, got ").concat(typeof paramValue)), "__NEXT_ERROR_CODE", { 3075 value: "E1108", 3076 enumerable: false, 3077 configurable: true 3078 }); 3079 } 3080 interpolatedSegments.push(encodeURIComponent(paramValue)); 3081 break; 3082 } 3083 case 'catchall-intercepted-(..)(..)': 3084 case 'catchall-intercepted-(.)': 3085 case 'catchall-intercepted-(..)': 3086 case 'catchall-intercepted-(...)': 3087 case 'dynamic-intercepted-(..)(..)': 3088 case 'dynamic-intercepted-(.)': 3089 case 'dynamic-intercepted-(..)': 3090 case 'dynamic-intercepted-(...)': 3091 { 3092 // TODO(instant-validation-build): i don't know how these are supposed to work, or if we can even get them here 3093 throw Object.defineProperty(new _invarianterror.InvariantError('Not implemented: Validation of interception routes'), "__NEXT_ERROR_CODE", { 3094 value: "E1106", 3095 enumerable: false, 3096 configurable: true 3097 }); 3098 } 3099 default: 3100 { 3101 param.paramType; 3102 } 3103 } 3104 } else { 3105 interpolatedSegments.push(rawSegment); 3106 } 3107 } 3108 return interpolatedSegments.join('/'); 3109} 3110function assertRootParamInSamples(workStore, sampleParams, paramName) { 3111 if (sampleParams && paramName in sampleParams) { 3112 // The param is defined in the samples. 3113 } else { 3114 const route = workStore.route; 3115 trackMissingSampleErrorAndThrow(Object.defineProperty(new _instantval
3115idationerror.InstantValidationError('Route "'.concat(route, '" accessed root param "').concat(paramName, '" which is not defined in the `samples` ') + "of `unstable_instant`. Add it to the sample's `params` object."), "__NEXT_ERROR_CODE", { 3116 value: "E1114", 3117 enumerable: false, 3118 configurable: true 3119 })); 3120 } 3121} 3122}), 3123269882, ((__turbopack_context__, module, exports) => { 3124"use strict"; 3125 3126var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 3127"use strict"; 3128Object.defineProperty(exports, "__esModule", { 3129 value: true 3130}); 31310 && (module.exports = { 3132 createPrerenderSearchParamsForClientPage: null, 3133 createSearchParamsFromClient: null, 3134 createServerSearchParamsForMetadata: null, 3135 createServerSearchParamsForServerPage: null, 3136 makeErroringSearchParamsForUseCache: null 3137}); 3138function _export(target, all) { 3139 for(var name in all)Object.defineProperty(target, name, { 3140 enumerable: true, 3141 get: all[name] 3142 }); 3143} 3144_export(exports, { 3145 createPrerenderSearchParamsForClientPage: function() { 3146 return createPrerenderSearchParamsForClientPage; 3147 }, 3148 createSearchParamsFromClient: function() { 3149 return createSearchParamsFromClient; 3150 }, 3151 createServerSearchParamsForMetadata: function() { 3152 return createServerSearchParamsForMetadata; 3153 }, 3154 createServerSearchParamsForServerPage: function() { 3155 return createServerSearchParamsForServerPage; 3156 }, 3157 makeErroringSearchParamsForUseCache: function() { 3158 return makeErroringSearchParamsForUseCache; 3159 } 3160}); 3161const _workasyncstorageexternal = __turbopack_context__.r(563599); 3162const _varyparams = __turbopack_context__.r(66373); 3163const _reflect = __turbopack_context__.r(242715); 3164const _dynamicrendering = __turbopack_context__.r(67673); 3165const _workunitasyncstorageexternal = __turbopack_context__.r(662141); 3166const _invarianterror = __turbopack_context__.r(312718); 3167const _dynamicrenderingutils = __turbopack_context__.r(963138); 3168const _creatededupedbycallsiteservererrorlogger = __turbopack_context__.r(876361); 3169const _reflectutils = __turbopack_context__.r(565932); 3170const _utils = __turbopack_context__.r(850999); 3171const _stagedrendering = __turbopack_context__.r(142852); 3172function createSearchParamsFromClient(underlyingSearchParams) { 3173 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3174 if (!workStore) { 3175 throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", { 3176 value: "E1068", 3177 enumerable: false, 3178 configurable: true 3179 }); 3180 } 3181 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 3182 if (workUnitStore) { 3183 switch(workUnitStore.type){ 3184 case 'prerender': 3185 case 'prerender-client': 3186 case 'prerender-ppr': 3187 case 'prerender-legacy': 3188 return createStaticPrerenderSearchParams(workStore, workUnitStore); 3189 case 'validation-client': 3190 { 3191 return createClientSearchParamsInValidation(underlyingSearchParams, workStore, workUnitStore); 3192 } 3193 case 'prerender-runtime': 3194 throw Object.defineProperty(new _invarianterror.InvariantError('createSearchParamsFromClient should not be called in a runtime prerender.'), "__NEXT_ERROR_CODE", { 3195 value: "E769", 3196 enumerable: false, 3197 configurable: true 3198 }); 3199 case 'cache': 3200 case 'private-cache': 3201 case 'unstable-cache': 3202 throw Object.defineProperty(new _invarianterror.InvariantError('createSearchParamsFromClient should not be called in cache contexts.'), "__NEXT_ERROR_CODE", { 3203 value: "E739", 3204 enumerable: false, 3205 configurable: true 3206 }); 3207 case 'generate-static-params': 3208 throw Object.defineProperty(new _invarianterror.InvariantError('createSearchParamsFromClient should not be called inside generateStaticParams.'), "__NEXT_ERROR_CODE", { 3209 value: "E1133", 3210 enumerable: false, 3211 configurable: true 3212 }); 3213 case 'request': 3214 // Client searchParams are not runtime prefetchable 3215 const isRuntimePrefetchable = false;
3216 return createRenderSearchParams(underlyingSearchParams, workStore, workUnitStore, isRuntimePrefetchable); 3217 default: 3218 workUnitStore; 3219 } 3220 } 3221 (0, _workunitasyncstorageexternal.throwInvariantForMissingStore)(); 3222} 3223function createServerSearchParamsForMetadata(underlyingSearchParams, isRuntimePrefetchable) { 3224 const metadataVaryParamsAccumulator = (0, _varyparams.getMetadataVaryParamsAccumulator)(); 3225 return createServerSearchParamsForServerPage(underlyingSearchParams, metadataVaryParamsAccumulator, isRuntimePrefetchable); 3226} 3227function createServerSearchParamsForServerPage(underlyingSearchParams, varyParamsAccumulator, isRuntimePrefetchable) { 3228 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3229 if (!workStore) { 3230 throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", { 3231 value: "E1068", 3232 enumerable: false, 3233 configurable: true 3234 }); 3235 } 3236 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 3237 if (workUnitStore) { 3238 switch(workUnitStore.type){ 3239 case 'prerender': 3240 case 'prerender-client': 3241 case 'prerender-ppr': 3242 case 'prerender-legacy': 3243 return createStaticPrerenderSearchParams(workStore, workUnitStore); 3244 case 'validation-client': 3245 throw Object.defineProperty(new _invarianterror.InvariantError('createServerSearchParamsForServerPage should not be called in a client validation.'), "__NEXT_ERROR_CODE", { 3246 value: "E1066", 3247 enumerable: false, 3248 configurable: true 3249 }); 3250 case 'cache': 3251 case 'private-cache': 3252 case 'unstable-cache': 3253 throw Object.defineProperty(new _invarianterror.InvariantError('createServerSearchParamsForServerPage should not be called in cache contexts.'), "__NEXT_ERROR_CODE", { 3254 value: "E747", 3255 enumerable: false, 3256 configurable: true 3257 }); 3258 case 'generate-static-params': 3259 throw Object.defineProperty(new _invarianterror.InvariantError('createServerSearchParamsForServerPage should not be called inside generateStaticParams.'), "__NEXT_ERROR_CODE", { 3260 value: "E1128", 3261 enumerable: false, 3262 configurable: true 3263 }); 3264 case 'prerender-runtime': 3265 return createRuntimePrerenderSearchParams(underlyingSearchParams, workUnitStore, varyParamsAccumulator, isRuntimePrefetchable); 3266 case 'request': 3267 return createRenderSearchParams(underlyingSearchParams, workStore, workUnitStore, isRuntimePrefetchable); 3268 default: 3269 workUnitStore; 3270 } 3271 } 3272 (0, _workunitasyncstorageexternal.throwInvariantForMissingStore)(); 3273} 3274function createPrerenderSearchParamsForClientPage() { 3275 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3276 if (!workStore) { 3277 throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", { 3278 value: "E1068", 3279 enumerable: false, 3280 configurable: true 3281 }); 3282 } 3283 if (workStore.forceStatic) { 3284 // When using forceStatic we override all other logic and always just return an empty 3285 // dictionary object. 3286 return Promise.resolve({}); 3287 } 3288 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 3289 if (workUnitStore) { 3290 switch(workUnitStore.type){ 3291 case 'prerender': 3292 case 'prerender-client': 3293 // We're prerendering in a mode that aborts (cacheComponents) and should stall 3294 // the promise to ensure the RSC side is considered dynamic 3295 return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.render
3295Signal, workStore.route, '`searchParams`'); 3296 case 'validation-client': 3297 throw Object.defineProperty(new _invarianterror.InvariantError('createPrerenderSearchParamsForClientPage should not be called in a client validation.'), "__NEXT_ERROR_CODE", { 3298 value: "E1061", 3299 enumerable: false, 3300 configurable: true 3301 }); 3302 case 'prerender-runtime': 3303 throw Object.defineProperty(new _invarianterror.InvariantError('createPrerenderSearchParamsForClientPage should not be called in a runtime prerender.'), "__NEXT_ERROR_CODE", { 3304 value: "E768", 3305 enumerable: false, 3306 configurable: true 3307 }); 3308 case 'cache': 3309 case 'private-cache': 3310 case 'unstable-cache': 3311 throw Object.defineProperty(new _invarianterror.InvariantError('createPrerenderSearchParamsForClientPage should not be called in cache contexts.'), "__NEXT_ERROR_CODE", { 3312 value: "E746", 3313 enumerable: false, 3314 configurable: true 3315 }); 3316 case 'generate-static-params': 3317 throw Object.defineProperty(new _invarianterror.InvariantError('createPrerenderSearchParamsForClientPage should not be called inside generateStaticParams.'), "__NEXT_ERROR_CODE", { 3318 value: "E1124", 3319 enumerable: false, 3320 configurable: true 3321 }); 3322 case 'prerender-ppr': 3323 case 'prerender-legacy': 3324 case 'request': 3325 return Promise.resolve({}); 3326 default: 3327 workUnitStore; 3328 } 3329 } 3330 (0, _workunitasyncstorageexternal.throwInvariantForMissingStore)(); 3331} 3332function createStaticPrerenderSearchParams(workStore, prerenderStore) { 3333 if (workStore.forceStatic) { 3334 // When using forceStatic we override all other logic and always just return an empty 3335 // dictionary object. 3336 return Promise.resolve({}); 3337 } 3338 switch(prerenderStore.type){ 3339 case 'prerender': 3340 case 'prerender-client': 3341 // We are in a cacheComponents (PPR or otherwise) prerender 3342 return makeHangingSearchParams(workStore, prerenderStore); 3343 case 'prerender-ppr': 3344 case 'prerender-legacy': 3345 // We are in a legacy static generation and need to interrupt the 3346 // prerender when search params are accessed. 3347 return makeErroringSearchParams(workStore, prerenderStore); 3348 default: 3349 return prerenderStore; 3350 } 3351} 3352function createRuntimePrerenderSearchParams(underlyingSearchParams, workUnitStore, varyParamsAccumulator, isRuntimePrefetchable) { 3353 const underlyingSearchParamsWithVarying = varyParamsAccumulator !== null ? (0, _varyparams.createVaryingSearchParams)(varyParamsAccumulator, underlyingSearchParams) : underlyingSearchParams; 3354 const result = makeUntrackedSearchParams(underlyingSearchParamsWithVarying); 3355 const { stagedRendering } = workUnitStore; 3356 if (!stagedRendering) { 3357 return result; 3358 } 3359 const stage = isRuntimePrefetchable ? _stagedrendering.RenderStage.EarlyRuntime : _stagedrendering.RenderStage.Runtime; 3360 return stagedRendering.waitForStage(stage).then(()=>result); 3361} 3362function createRenderSearchParams(underlyingSearchParams, workStore, requestStore, isRuntimePrefetchable) { 3363 if (workStore.forceStatic) { 3364 // When using forceStatic we override all other logic and always just return an empty 3365 // dictionary object. 3366 return Promise.resolve({}); 3367 } else { 3368 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 3369 ; 3370 else if (requestStore.asyncApiPromises) { 3371 if (requestStore.validationSamples) { 3372 var _requestStore_validationSamples_searchParams; 3373 const { createExhaustiveSearchParamsProxy } = __turbopack_context__.r(918450); 3374 const declaredKeys = new Set(Object.keys((_requestStore_validationSamples_searchParams = requestStore.validationSamples.searchParams) !== null && _requestStore_validationSamples_searchParams !== void 0 ? _requestStore_validationSamples_searchParams : {})); 3375 underlyingSearchParams = createExhaustiveSearchParamsProxy(underlyingSearchParams, declaredKeys, workStore.route); 3376 } 3377 return (isRuntimePrefetchable ? requestStore.asyncApiPromises.earlySharedSearchParamsParent : requestStore.asyncApiPromises.sharedSearchParamsParent).then(()=>underlyingSearchParams); 3378 } else { 3379 return makeUntrackedSearchParams(underlyingSearchParams); 3380 } 3381 } 3382} 3383const CachedSearchParams = new WeakMap(); 3384const CachedSearchParamsForUseCache = new WeakMap(); 3385function makeHangingSearchParams(workStore, prerenderStore) { 3386 const cachedSearchParams = CachedSearchParams.get(prerenderStore); 3387 if (cachedSearchParams) { 3388 return cachedSearchParams; 3389 } 3390 const promise = (0, _dynamicrenderingutils.makeHangingPromise)(prerenderStore.render
3390Signal, workStore.route, '`searchParams`'); 3391 const proxiedPromise = new Proxy(promise, { 3392 get (target, prop, receiver) { 3393 if (Object.hasOwn(promise, prop)) { 3394 // The promise has this property directly. we must return it. 3395 // We know it isn't a dynamic access because it can only be something 3396 // that was previously written to the promise and thus not an underlying searchParam value 3397 return _reflect.ReflectAdapter.get(target, prop, receiver); 3398 } 3399 switch(prop){ 3400 case 'then': 3401 { 3402 const expression = '`await searchParams`, `searchParams.then`, or similar'; 3403 (0, _dynamicrendering.annotateDynamicAccess)(expression, prerenderStore); 3404 return _reflect.ReflectAdapter.get(target, prop, receiver); 3405 } 3406 case 'status': 3407 { 3408 const expression = '`use(searchParams)`, `searchParams.status`, or similar'; 3409 (0, _dynamicrendering.annotateDynamicAccess)(expression, prerenderStore); 3410 return _reflect.ReflectAdapter.get(target, prop, receiver); 3411 } 3412 default: 3413 { 3414 return _reflect.ReflectAdapter.get(target, prop, receiver); 3415 } 3416 } 3417 } 3418 }); 3419 CachedSearchParams.set(prerenderStore, proxiedPromise); 3420 return proxiedPromise; 3421} 3422function makeErroringSearchParams(workStore, prerenderStore) { 3423 const cachedSearchParams = CachedSearchParams.get(workStore); 3424 if (cachedSearchParams) { 3425 return cachedSearchParams; 3426 } 3427 const underlyingSearchParams = {}; 3428 // For search params we don't construct a ReactPromise because we want to interrupt 3429 // rendering on any property access that was not set from outside and so we only want 3430 // to have properties like value and status if React sets them. 3431 const promise = Promise.resolve(underlyingSearchParams); 3432 const proxiedPromise = new Proxy(promise, { 3433 get (target, prop, receiver) { 3434 if (Object.hasOwn(promise, prop)) { 3435 // The promise has this property directly. we must return it. 3436 // We know it isn't a dynamic access because it can only be something 3437 // that was previously written to the promise and thus not an underlying searchParam value 3438 return _reflect.ReflectAdapter.get(target, prop, receiver); 3439 } 3440 if (typeof prop === 'string' && prop === 'then') { 3441 const expression = '`await searchParams`, `searchParams.then`, or similar'; 3442 if (workStore.dynamicShouldError) { 3443 (0, _utils.throwWithStaticGenerationBailoutErrorWithDynamicError)(workStore.route, expression); 3444 } else if (prerenderStore.type === 'prerender-ppr') { 3445 // PPR Prerender (no cacheComponents) 3446 (0, _dynamicrendering.postponeWithTracking)(workStore.route, expression, prerenderStore.dynamicTracking); 3447 } else { 3448 // Legacy Prerender 3449 (0, _dynamicrendering.throwToInterruptStaticGeneration)(expression, workStore, prerenderStore); 3450 } 3451 } 3452 return _reflect.ReflectAdapter.get(target, prop, receiver); 3453 } 3454 }); 3455 CachedSearchParams.set(workStore, proxiedPromise); 3456 return proxiedPromise; 3457} 3458function makeErroringSearchParamsForUseCache() { 3459 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3460 if (!workStore) { 3461 throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", { 3462 value: "E1068", 3463 enumerable: false, 3464 configurable: true 3465 }); 3466 } 3467 const cachedSearchParams = CachedSearchParamsForUseCache.get(workStore); 3468 if (cachedSearchParams) { 3469 return cachedSearchParams; 3470 } 3471 const promise = Promise.resolve({}); 3472 const proxiedPromise = new Proxy(promise, { 3473 get: function get(target, prop, receiver) { 3474 if (Object.hasOwn(promise, prop)) { 3475 // The promise has this property directly. we must return it. We know it 3476 // isn't a dynamic access because it can only be something that was 3477 // previously written to the promise and thus not an underlying 3478 // searchParam value 3479 return _reflect.ReflectAdapter.get(target, prop, receiver); 3480 } 3481 if (typeof prop === 'string' && (prop === 'then' || !_reflectutils.wellKnownProperties.has(prop))) { 3482 (0, _utils.throwForSearchParamsAccessInUseCache)(workStore, get); 3483 } 3484 return _reflect.ReflectAdapter.get(target, prop, receiver); 3485 } 3486 }); 3487 CachedSearchParamsForUseCache.set(workStore, proxiedPromise); 3488 return proxiedPromise; 3489} 3490function makeUntrackedSearchParams(underlyingSearchParams) { 3491 const cachedSearchParams = CachedSearchParams.get(underlyingSearchParams); 3492 if (cachedSearchParams) { 3493 return cachedSearchParams; 3494 } 3495 const promise = Promise.resolve(underlyingSearchParams); 3496 CachedSearchParams.set(underlyingSearchParams, promise); 3497 return promise; 3498} 3499function makeUntrackedSearchParamsWithDevWarnings(underlyingSearchParams, workStore, requestStore, isRuntimePrefetchable) { 3500 if (requestStore.asyncApiPromises) {
3501 // Do not cache the resulting promise. If we do, we'll only show the first "awaited at" 3502 // across all segments that receive searchParams. 3503 return makeUntrackedSearchParamsWithDevWarningsImpl(underlyingSearchParams, workStore, requestStore, isRuntimePrefetchable); 3504 } else { 3505 const cachedSearchParams = CachedSearchParams.get(underlyingSearchParams); 3506 if (cachedSearchParams) { 3507 return cachedSearchParams; 3508 } 3509 const promise = makeUntrackedSearchParamsWithDevWarningsImpl(underlyingSearchParams, workStore, requestStore, isRuntimePrefetchable); 3510 CachedSearchParams.set(requestStore, promise); 3511 return promise; 3512 } 3513} 3514function makeUntrackedSearchParamsWithDevWarningsImpl(underlyingSearchParams, workStore, requestStore, isRuntimePrefetchable) { 3515 const promiseInitialized = { 3516 current: false 3517 }; 3518 const proxiedUnderlying = instrumentSearchParamsObjectWithDevWarnings(underlyingSearchParams, workStore, promiseInitialized); 3519 let promise; 3520 if (requestStore.asyncApiPromises) { 3521 // We wrap each instance of searchParams in a `new Promise()`. 3522 // This is important when all awaits are in third party which would otherwise 3523 // track all the way to the internal params. 3524 const sharedSearchParamsParent = isRuntimePrefetchable ? requestStore.asyncApiPromises.earlySharedSearchParamsParent : requestStore.asyncApiPromises.sharedSearchParamsParent; 3525 promise = new Promise((resolve, reject)=>{ 3526 sharedSearchParamsParent.then(()=>resolve(proxiedUnderlying), reject); 3527 }); 3528 // @ts-expect-error 3529 promise.displayName = 'searchParams'; 3530 } else { 3531 promise = (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(proxiedUnderlying, requestStore, _stagedrendering.RenderStage.Runtime); 3532 } 3533 promise.then(()=>{ 3534 promiseInitialized.current = true; 3535 }, // is aborted before it can reach the runtime stage. 3536 // In that case, we have to prevent an unhandled rejection from the promise 3537 // created by this `.then()` call. 3538 // This does not affect the `promiseInitialized` logic above, 3539 // because `proxiedUnderlying` will not be used to resolve the promise, 3540 // so there's no risk of any of its properties being accessed and triggering 3541 // an undesireable warning. 3542 ignoreReject); 3543 return instrumentSearchParamsPromiseWithDevWarnings(underlyingSearchParams, promise, workStore); 3544} 3545function ignoreReject() {} 3546function instrumentSearchParamsObjectWithDevWarnings(underlyingSearchParams, workStore, promiseInitialized) { 3547 // We have an unfortunate sequence of events that requires this initialization logic. We want to instrument the underlying 3548 // searchParams object to detect if you are accessing values in dev. This is used for warnings and for things like the static prerender 3549 // indicator. However when we pass this proxy to our Promise.resolve() below the VM checks if the resolved value is a promise by looking 3550 // at the `.then` property. To our dynamic tracking logic this is indistinguishable from a `then` searchParam and so we would normally trigger 3551 // dynamic tracking. However we know that this .then is not real dynamic access, it's just how thenables resolve in sequence. So we introduce 3552 // this initialization concept so we omit the dynamic check until after we've constructed our resolved promise. 3553 return new Proxy(underlyingSearchParams, { 3554 get (target, prop, receiver) { 3555 if (typeof prop === 'string' && promiseInitialized.current) { 3556 if (workStore.dynamicShouldError) { 3557 const expression = (0, _reflectutils.describeStringPropertyAccess)('searchParams', prop); 3558 (0, _utils.throwWithStaticGenerationBailoutErrorWithDynamicError)(workStore.route, expression); 3559 } 3560 } 3561 return _reflect.ReflectAdapter.get(target, prop, receiver); 3562 }, 3563 has (target, prop) { 3564 if (typeof prop === 'string') { 3565 if (workStore.dynamicShouldError) { 3566 const expression = (0, _reflectutils.describeHasCheckingStringProperty)('searchParams', prop); 3567 (0, _utils.throwWithStaticGenerationBailoutErrorWithDynamicError)(workStore.route, expression); 3568 } 3569 } 3570 return Reflect.has(target, prop); 3571 }, 3572 ownKeys (target) { 3573 if (workStore.dynamicShouldError) { 3574 const expression = '`{...searchParams}`, `Object.keys(searchParams)`, or similar'; 3575 (0, _utils.throwWithStaticGenerationBailoutErrorWithDynamicError)(workStore.route, expression); 3576 } 3577 return Reflect.ownKeys(target); 3578 } 3579 }); 3580} 3581function instrumentSearchParamsPromiseWithDevWarnings(underlyingSearchParams, promise, workStore) { 3582 // Track which properties we should warn for. 3583 const proxiedProperties = new Set();
3584 Object.keys(underlyingSearchParams).forEach((prop)=>{ 3585 if (_reflectutils.wellKnownProperties.has(prop)) { 3586 // These properties cannot be shadowed because they need to be the 3587 // true underlying value for Promises to work correctly at runtime 3588 } else { 3589 proxiedProperties.add(prop); 3590 } 3591 }); 3592 return new Proxy(promise, { 3593 get (target, prop, receiver) { 3594 if (prop === 'then' && workStore.dynamicShouldError) { 3595 const expression = '`searchParams.then`'; 3596 (0, _utils.throwWithStaticGenerationBailoutErrorWithDynamicError)(workStore.route, expression); 3597 } 3598 if (typeof prop === 'string') { 3599 if (!_reflectutils.wellKnownProperties.has(prop) && (proxiedProperties.has(prop) || // We are accessing a property that doesn't exist on the promise nor 3600 // the underlying searchParams. 3601 Reflect.has(target, prop) === false)) { 3602 const expression = (0, _reflectutils.describeStringPropertyAccess)('searchParams', prop); 3603 warnForSyncAccess(workStore.route, expression); 3604 } 3605 } 3606 return _reflect.ReflectAdapter.get(target, prop, receiver); 3607 }, 3608 set (target, prop, value, receiver) { 3609 if (typeof prop === 'string') { 3610 proxiedProperties.delete(prop); 3611 } 3612 return Reflect.set(target, prop, value, receiver); 3613 }, 3614 has (target, prop) { 3615 if (typeof prop === 'string') { 3616 if (!_reflectutils.wellKnownProperties.has(prop) && (proxiedProperties.has(prop) || // We are accessing a property that doesn't exist on the promise nor 3617 // the underlying searchParams. 3618 Reflect.has(target, prop) === false)) { 3619 const expression = (0, _reflectutils.describeHasCheckingStringProperty)('searchParams', prop); 3620 warnForSyncAccess(workStore.route, expression); 3621 } 3622 } 3623 return Reflect.has(target, prop); 3624 }, 3625 ownKeys (target) { 3626 const expression = '`Object.keys(searchParams)` or similar'; 3627 warnForSyncAccess(workStore.route, expression); 3628 return Reflect.ownKeys(target); 3629 } 3630 }); 3631} 3632const warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createSearchAccessError); 3633function createSearchAccessError(route, expression) { 3634 const prefix = route ? 'Route "'.concat(route, '" ') : 'This route '; 3635 return Object.defineProperty(new Error("".concat(prefix, "used ").concat(expression, ". ") + "`searchParams` is a Promise and must be unwrapped with `await` or `React.use()` before accessing its properties. " + "Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis"), "__NEXT_ERROR_CODE", { 3636 value: "E848", 3637 enumerable: false, 3638 configurable: true 3639 }); 3640} 3641function createClientSearchParamsInValidation(underlyingSearchParams, workStore, workUnitStore) { 3642 var _ref; 3643 var _workUnitStore_validationSamples; 3644 const { createExhaustiveSearchParamsProxy } = __turbopack_context__.r(918450); 3645 const declaredKeys = new Set(Object.keys((_ref = (_workUnitStore_validationSamples = workUnitStore.validationSamples) == null ? void 0 : _workUnitStore_validationSamples.searchParams) !== null && _ref !== void 0 ? _ref : {})); 3646 underlyingSearchParams = createExhaustiveSearchParamsProxy(underlyingSearchParams, declaredKeys, workStore.route); 3647 return Promise.resolve(underlyingSearchParams); 3648} 3649}), 365074804, ((__turbopack_context__, module, exports) => { 3651"use strict"; 3652 3653Object.defineProperty(exports, "__esModule", { 3654 value: true 3655}); 3656Object.defineProperty(exports, "dynamicAccessAsyncStorageInstance", { 3657 enumerable: true, 3658 get: function() { 3659 return dynamicAccessAsyncStorageInstance; 3660 } 3661}); 3662const _asynclocalstorage = __turbopack_context__.r(90317); 3663const dynamicAccessAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)(); 3664}),
3665288276, ((__turbopack_context__, module, exports) => { 3666"use strict"; 3667 3668Object.defineProperty(exports, "__esModule", { 3669 value: true 3670}); 3671Object.defineProperty(exports, "dynamicAccessAsyncStorage", { 3672 enumerable: true, 3673 get: function() { 3674 return _dynamicaccessasyncstorageinstance.dynamicAccessAsyncStorageInstance; 3675 } 3676}); 3677const _dynamicaccessasyncstorageinstance = __turbopack_context__.r(74804); 3678}), 3679541489, ((__turbopack_context__, module, exports) => { 3680"use strict"; 3681 3682var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 3683"use strict"; 3684Object.defineProperty(exports, "__esModule", { 3685 value: true 3686}); 36870 && (module.exports = { 3688 createParamsFromClient: null, 3689 createPrerenderParamsForClientSegment: null, 3690 createServerParamsForMetadata: null, 3691 createServerParamsForRoute: null, 3692 createServerParamsForServerSegment: null 3693}); 3694function _export(target, all) { 3695 for(var name in all)Object.defineProperty(target, name, { 3696 enumerable: true, 3697 get: all[name] 3698 }); 3699} 3700_export(exports, { 3701 createParamsFromClient: function() { 3702 return createParamsFromClient; 3703 }, 3704 createPrerenderParamsForClientSegment: function() { 3705 return createPrerenderParamsForClientSegment; 3706 }, 3707 createServerParamsForMetadata: function() { 3708 return createServerParamsForMetadata; 3709 }, 3710 createServerParamsForRoute: function() { 3711 return createServerParamsForRoute; 3712 }, 3713 createServerParamsForServerSegment: function() { 3714 return createServerParamsForServerSegment; 3715 } 3716}); 3717const _workasyncstorageexternal = __turbopack_context__.r(563599); 3718const _varyparams = __turbopack_context__.r(66373); 3719const _reflect = __turbopack_context__.r(242715); 3720const _dynamicrendering = __turbopack_context__.r(67673); 3721const _workunitasyncstorageexternal = __turbopack_context__.r(662141); 3722const _invarianterror = __turbopack_context__.r(312718); 3723const _reflectutils = __turbopack_context__.r(565932); 3724const _dynamicrenderingutils = __turbopack_context__.r(963138); 3725const _creatededupedbycallsiteservererrorlogger = __turbopack_context__.r(876361); 3726const _dynamicaccessasyncstorageexternal = __turbopack_context__.r(288276); 3727const _stagedrendering = __turbopack_context__.r(142852); 3728function createParamsFromClient(underlyingParams) { 3729 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3730 if (!workStore) { 3731 throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", { 3732 value: "E1068", 3733 enumerable: false, 3734 configurable: true 3735 }); 3736 } 3737 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 3738 if (workUnitStore) { 3739 switch(workUnitStore.type){ 3740 case 'prerender': 3741 case 'prerender-client': 3742 case 'prerender-ppr': 3743 case 'prerender-legacy': 3744 // Client params don't need additional vary tracking because by the 3745 // time they reach the client, the access would have already been 3746 // tracked by the server. 3747 const varyParamsAccumulator = null; 3748 return createStaticPrerenderParams(underlyingParams, null, workStore, workUnitStore, varyParamsAccumulator); 3749 case 'validation-client': 3750 return createClientParamsInInstantValidation(underlyingParams, workStore, workUnitStore.validationSamples); 3751 case 'cache': 3752 case 'private-cache': 3753 case 'unstable-cache': 3754 throw Object.defineProperty(new _invarianterror.InvariantError('createParamsFromClient should not be called in cache contexts.'), "__NEXT_ERROR_CODE", { 3755 value: "E736", 3756 enumerable: false, 3757 configurable: true 3758 }); 3759 case 'prerender-runtime': 3760 throw Object.defineProperty(new _invarianterror.InvariantError('createParamsFromClient should not be called in a runtime prerender.'), "__NEXT_ERROR_CODE", { 3761 value: "E770", 3762 enumerable: false, 3763 configurable: true 3764 }); 3765 case 'generate-static-params': 3766 throw Object.defineProperty(new _invarianterror.InvariantError('createParamsFromClient should not be called inside generateStaticParams.'), "__NEXT_ERROR_CODE", { 3767 value: "E1122", 3768 enumerable: false, 3769 configurable: true 3770 }); 3771 case 'request': 3772 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 3773 ; 3774 else if (workUnitStore.validationSamples) { 3775 return createClientParamsInInstantValidation(underlyingParams, workStore, workUnitStore.validationSamples); 3776 } else { 3777 return createRenderParamsInProd(underlyingParams); 3778 } 3779 default: 3780 workUnitStore; 3781 } 3782 } 3783 (0, _workunitasyncstorageexternal.throwInvariantForMissingStore)(); 3784} 3785function createServerParamsForMetadata(underlyingParams, optionalCatchAllParamName, isRuntimePrefetchable) { 3786 const metadataVaryParamsAccumulator = (0, _varyparams.getMetadataVaryParamsAccumulator)(); 3787 return createServerParamsForServerSegment(underlyingParams, optionalCatchAllParamName, metadataVaryParamsAccumulator, isRuntimePrefetchable); 3788} 3789function createServerParamsForRoute(underlyingParams) { 3790 let varyParamsAccumulator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; 3791 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3792 if (!workStore) { 3793 throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", { 3794 value: "E1068", 3795 enumerable: false, 3796 configurable: true 3797 }); 3798 } 3799 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 3800 if (workUnitStore) { 3801 switch(workUnitStore.type){ 3802 case 'prerender': 3803 case 'prerender-ppr': 3804 case 'prerender-legacy': 3805 return createStaticPrerenderParams(underlyingParams, null, workStore, workUnitStore, varyParamsAccumulator); 3806 case 'prerender-client': 3807 case 'validation-client': 3808 throw Object.defineProperty(new _invarianterror.InvariantError('createServerParamsForRoute should not be called in client contexts.'), "__NEXT_ERROR_CODE", { 3809 value: "E1064", 3810 enumerable: false, 3811 configurable: true 3812 }); 3813 case 'cache': 3814 case 'private-cache': 3815 case 'unstable-cache': 3816 throw Object.defineProperty(new _invarianterror.InvariantError('createServerParamsForRoute should not be called in cache contexts.'), "__NEXT_ERROR_CODE", { 3817 value: "E738", 3818 enumerable: false, 3819 configurable: true 3820 }); 3821 case 'generate-static-params': 3822 throw Object.defineProperty(new _invarianterror.InvariantError('createServerParamsForRoute should not be called inside generateStaticParams.'), "__NEXT_ERROR_CODE", { 3823 value: "E1131", 3824 enumerable: false, 3825 configurable: true 3826 }); 3827 case 'prerender-runtime': 3828 { 3829 // Route params are not runtime prefetchable 3830 const isRuntimePrefetchable = false;
3831 return createRuntimePrerenderParams(underlyingParams, null, workUnitStore, varyParamsAccumulator, isRuntimePrefetchable); 3832 } 3833 case 'request': 3834 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 3835 ; 3836 else { 3837 return createRenderParamsInProd(underlyingParams); 3838 } 3839 default: 3840 workUnitStore; 3841 } 3842 } 3843 (0, _workunitasyncstorageexternal.throwInvariantForMissingStore)(); 3844} 3845function createServerParamsForServerSegment(underlyingParams, optionalCatchAllParamName, varyParamsAccumulator, isRuntimePrefetchable) { 3846 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3847 if (!workStore) { 3848 throw Object.defineProperty(new _invarianterror.InvariantError('Expected workStore to be initialized'), "__NEXT_ERROR_CODE", { 3849 value: "E1068", 3850 enumerable: false, 3851 configurable: true 3852 }); 3853 } 3854 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 3855 if (workUnitStore) { 3856 switch(workUnitStore.type){ 3857 case 'prerender': 3858 case 'prerender-client': 3859 case 'prerender-ppr': 3860 case 'prerender-legacy': 3861 return createStaticPrerenderParams(underlyingParams, optionalCatchAllParamName, workStore, workUnitStore, varyParamsAccumulator); 3862 case 'validation-client': 3863 throw Object.defineProperty(new _invarianterror.InvariantError('createServerParamsForServerSegment should not be called in client contexts.'), "__NEXT_ERROR_CODE", { 3864 value: "E1101", 3865 enumerable: false, 3866 configurable: true 3867 }); 3868 case 'cache': 3869 case 'private-cache': 3870 case 'unstable-cache': 3871 throw Object.defineProperty(new _invarianterror.InvariantError('createServerParamsForServerSegment should not be called in cache contexts.'), "__NEXT_ERROR_CODE", { 3872 value: "E743", 3873 enumerable: false, 3874 configurable: true 3875 }); 3876 case 'generate-static-params': 3877 throw Object.defineProperty(new _invarianterror.InvariantError('createServerParamsForServerSegment should not be called inside generateStaticParams.'), "__NEXT_ERROR_CODE", { 3878 value: "E1120", 3879 enumerable: false, 3880 configurable: true 3881 }); 3882 case 'prerender-runtime': 3883 return createRuntimePrerenderParams(underlyingParams, optionalCatchAllParamName, workUnitStore, varyParamsAccumulator, isRuntimePrefetchable); 3884 case 'request': 3885 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 3886 ; 3887 else if (workUnitStore.asyncApiPromises && workUnitStore.validationSamples) { 3888 return createServerParamsInInstantValidation(underlyingParams, workStore, workUnitStore.validationSamples, workUnitStore.asyncApiPromises, isRuntimePrefetchable); 3889 } else if (workUnitStore.asyncApiPromises && hasFallbackRouteParams(underlyingParams, workUnitStore.fallbackParams)) { 3890 return (isRuntimePrefetchable ? workUnitStore.asyncApiPromises.earlySharedParamsParent : workUnitStore.asyncApiPromises.sharedParamsParent).then(()=>underlyingParams); 3891 } else { 3892 return createRenderParamsInProd(underlyingParams); 3893 } 3894 default: 3895 workUnitStore; 3896 } 3897 } 3898 (0, _workunitasyncstorageexternal.throwInvariantForMissingStore)(); 3899} 3900function createPrerenderParamsForClientSegment(underlyingParams) { 3901 const workStore = _workasyncstorageexternal.workAsyncStorage.getStore(); 3902 if (!workStore) { 3903 throw Object.defineProperty(new _invarianterror.InvariantError('Missing workStore in createPrerenderParamsForClientSegment'), "__NEXT_ERROR_CODE", { 3904 value: "E773", 3905 enumerable: false, 3906 configurable: true 3907 }); 3908 } 3909 const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore(); 3910 if (workUnitStore) { 3911 switch(workUnitStore.type){ 3912 case 'prerender': 3913 case 'prerender-client': 3914 const fallbackParams = workUnitStore.fallbackRouteParam
3914s; 3915 if (fallbackParams) { 3916 for(let key in underlyingParams){ 3917 if (fallbackParams.has(key)) { 3918 // This params object has one or more fallback params, so we need 3919 // to consider the awaiting of this params object "dynamic". Since 3920 // we are in cacheComponents mode we encode this as a promise that never 3921 // resolves. 3922 return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, '`params`'); 3923 } 3924 } 3925 } 3926 break; 3927 case 'validation-client': 3928 throw Object.defineProperty(new _invarianterror.InvariantError('createPrerenderParamsForClientSegment should not be called in validation contexts.'), "__NEXT_ERROR_CODE", { 3929 value: "E1099", 3930 enumerable: false, 3931 configurable: true 3932 }); 3933 break; 3934 case 'cache': 3935 case 'private-cache': 3936 case 'unstable-cache': 3937 throw Object.defineProperty(new _invarianterror.InvariantError('createPrerenderParamsForClientSegment should not be called in cache contexts.'), "__NEXT_ERROR_CODE", { 3938 value: "E734", 3939 enumerable: false, 3940 configurable: true 3941 }); 3942 case 'generate-static-params': 3943 throw Object.defineProperty(new _invarianterror.InvariantError('createPrerenderParamsForClientSegment should not be called inside generateStaticParams.'), "__NEXT_ERROR_CODE", { 3944 value: "E1126", 3945 enumerable: false, 3946 configurable: true 3947 }); 3948 case 'prerender-ppr': 3949 case 'prerender-legacy': 3950 case 'prerender-runtime': 3951 case 'request': 3952 break; 3953 default: 3954 workUnitStore; 3955 } 3956 } 3957 // We're prerendering in a mode that does not abort. We resolve the promise without 3958 // any tracking because we're just transporting a value from server to client where the tracking 3959 // will be applied. 3960 return Promise.resolve(underlyingParams); 3961} 3962function createStaticPrerenderParams(underlyingParams, optionalCatchAllParamName, workStore, prerenderStore, varyParamsAccumulator) { 3963 const underlyingParamsWithVarying = varyParamsAccumulator !== null ? (0, _varyparams.createVaryingParams)(varyParamsAccumulator, underlyingParams, optionalCatchAllParamName) : underlyingParams; 3964 switch(prerenderStore.type){ 3965 case 'prerender': 3966 case 'prerender-client': 3967 { 3968 const fallbackParams = prerenderStore.fallbackRouteParams; 3969 if (fallbackParams) { 3970 for(const key in underlyingParams){ 3971 if (fallbackParams.has(key)) { 3972 // This params object has one or more fallback params, so we need 3973 // to consider the awaiting of this params object "dynamic". Since 3974 // we are in cacheComponents mode we encode this as a promise that never 3975 // resolves. 3976 return makeHangingParams(underlyingParamsWithVarying, workStore, prerenderStore); 3977 } 3978 } 3979 } 3980 break; 3981 } 3982 case 'prerender-ppr': 3983 { 3984 const fallbackParams = prerenderStore.fallbackRouteParams; 3985 if (fallbackParams) { 3986 for(const key in underlyingParams){ 3987 if (fallbackParams.has(key)) { 3988 return makeErroringParams(underlyingParamsWithVarying, fallbackParams, workStore, prerenderStore); 3989 } 3990 } 3991 } 3992 break; 3993 } 3994 case 'prerender-legacy': 3995 break; 3996 default: 3997 prerenderStore; 3998 } 3999 return makeUntrackedParams(underlyingParamsWithVarying); 4000}
4001function createRuntimePrerenderParams(underlyingParams, optionalCatchAllParamName, workUnitStore, varyParamsAccumulator, isRuntimePrefetchable) { 4002 const underlyingParamsWithVarying = varyParamsAccumulator !== null ? (0, _varyparams.createVaryingParams)(varyParamsAccumulator, underlyingParams, optionalCatchAllParamName) : underlyingParams; 4003 const result = makeUntrackedParams(underlyingParamsWithVarying); 4004 const { stagedRendering } = workUnitStore; 4005 if (!stagedRendering) { 4006 return result; 4007 } 4008 const stage = isRuntimePrefetchable ? _stagedrendering.RenderStage.EarlyRuntime : _stagedrendering.RenderStage.Runtime; 4009 return stagedRendering.waitForStage(stage).then(()=>result); 4010} 4011function hasFallbackRouteParams(underlyingParams, fallbackParams) { 4012 if (fallbackParams) { 4013 for(let key in underlyingParams){ 4014 if (fallbackParams.has(key)) { 4015 return true; 4016 } 4017 } 4018 } 4019 return false; 4020} 4021function createServerParamsInInstantValidation(underlyingParams, workStore, validationSamples, asyncApiPromises, isRuntimePrefetchable) { 4022 var _validationSamples_params; 4023 const { createExhaustiveParamsProxy } = __turbopack_context__.r(918450); 4024 const declaredParams = new Set(Object.keys((_validationSamples_params = validationSamples.params) !== null && _validationSamples_params !== void 0 ? _validationSamples_params : {})); 4025 const proxiedUnderlying = createExhaustiveParamsProxy(underlyingParams, declaredParams, workStore.route); 4026 return (isRuntimePrefetchable ? asyncApiPromises.earlySharedParamsParent : asyncApiPromises.sharedParamsParent).then(()=>proxiedUnderlying); 4027} 4028function createClientParamsInInstantValidation(underlyingParams, workStore, validationSamples) { 4029 var _ref; 4030 const { createExhaustiveParamsProxy } = __turbopack_context__.r(918450); 4031 const declaredParams = new Set(Object.keys((_ref = validationSamples == null ? void 0 : validationSamples.params) !== null && _ref !== void 0 ? _ref : {})); 4032 const proxiedUnderlying = createExhaustiveParamsProxy(underlyingParams, declaredParams, workStore.route); 4033 return Promise.resolve(proxiedUnderlying); 4034} 4035function createRenderParamsInProd(underlyingParams) { 4036 return makeUntrackedParams(underlyingParams); 4037} 4038function createRenderParamsInDev(underlyingParams, fallbackParams, workStore, requestStore, isRuntimePrefetchable) { 4039 return makeDynamicallyTrackedParamsWithDevWarnings(underlyingParams, hasFallbackRouteParams(underlyingParams, fallbackParams), workStore, requestStore, isRuntimePrefetchable); 4040} 4041const CachedParams = new WeakMap(); 4042const fallbackParamsProxyHandler = { 4043 get: function get(target, prop, receiver) { 4044 if (prop === 'then' || prop === 'catch' || prop === 'finally') { 4045 const originalMethod = _reflect.ReflectAdapter.get(target, prop, receiver); 4046 return ({ 4047 [prop]: function() { 4048 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 4049 args[_key] = arguments[_key]; 4050 } 4051 const store = _dynamicaccessasyncstorageexternal.dynamicAccessAsyncStorage.getStore(); 4052 if (store) { 4053 store.abortController.abort(Object.defineProperty(new Error("Accessed fallback `params` during prerendering."), "__NEXT_ERROR_CODE", { 4054 value: "E691", 4055 enumerable: false, 4056 configurable: true 4057 })); 4058 } 4059 return new Proxy(originalMethod.apply(target, args), fallbackParamsProxyHandler); 4060 } 4061 })[prop]; 4062 } 4063 return _reflect.ReflectAdapter.get(target, prop, receiver); 4064 } 4065}; 4066function makeHangingParams(underlyingParams, workStore, prerenderStore) { 4067 const cachedParams = CachedParams.get(underlyingParams); 4068 if (cachedParams) { 4069 return cachedParams; 4070 } 4071 const promise = new Proxy((0, _dynamicrenderingutils.makeHangingPromise)(prerenderStore.render
4071Signal, workStore.route, '`params`'), fallbackParamsProxyHandler); 4072 CachedParams.set(underlyingParams, promise); 4073 return promise; 4074} 4075function makeErroringParams(underlyingParams, fallbackParams, workStore, prerenderStore) { 4076 const cachedParams = CachedParams.get(underlyingParams); 4077 if (cachedParams) { 4078 return cachedParams; 4079 } 4080 const augmentedUnderlying = { 4081 ...underlyingParams 4082 }; 4083 // We don't use makeResolvedReactPromise here because params 4084 // supports copying with spread and we don't want to unnecessarily 4085 // instrument the promise with spreadable properties of ReactPromise. 4086 const promise = Promise.resolve(augmentedUnderlying); 4087 CachedParams.set(underlyingParams, promise); 4088 Object.keys(underlyingParams).forEach((prop)=>{ 4089 if (_reflectutils.wellKnownProperties.has(prop)) { 4090 // These properties cannot be shadowed because they need to be the 4091 // true underlying value for Promises to work correctly at runtime 4092 } else { 4093 if (fallbackParams.has(prop)) { 4094 Object.defineProperty(augmentedUnderlying, prop, { 4095 get () { 4096 const expression = (0, _reflectutils.describeStringPropertyAccess)('params', prop); 4097 // In most dynamic APIs we also throw if `dynamic = "error"` however 4098 // for params is only dynamic when we're generating a fallback shell 4099 // and even when `dynamic = "error"` we still support generating dynamic 4100 // fallback shells 4101 // TODO remove this comment when cacheComponents is the default since there 4102 // will be no `dynamic = "error"` 4103 if (prerenderStore.type === 'prerender-ppr') { 4104 // PPR Prerender (no cacheComponents) 4105 (0, _dynamicrendering.postponeWithTracking)(workStore.route, expression, prerenderStore.dynamicTracking); 4106 } else { 4107 // Legacy Prerender 4108 (0, _dynamicrendering.throwToInterruptStaticGeneration)(expression, workStore, prerenderStore); 4109 } 4110 }, 4111 enumerable: true 4112 }); 4113 } 4114 } 4115 }); 4116 return promise; 4117} 4118function makeUntrackedParams(underlyingParams) { 4119 const cachedParams = CachedParams.get(underlyingParams); 4120 if (cachedParams) { 4121 return cachedParams; 4122 } 4123 const promise = Promise.resolve(underlyingParams); 4124 CachedParams.set(underlyingParams, promise); 4125 return promise; 4126} 4127function makeDynamicallyTrackedParamsWithDevWarnings(underlyingParams, hasFallbackParams, workStore, requestStore, isRuntimePrefetchable) { 4128 if (requestStore.asyncApiPromises && hasFallbackParams) { 4129 // We wrap each instance of params in a `new Promise()`, because deduping 4130 // them across requests doesn't work anyway and this let us show each 4131 // await a different set of values. This is important when all awaits 4132 // are in third party which would otherwise track all the way to the 4133 // internal params. 4134 const sharedParamsParent = isRuntimePrefetchable ? requestStore.asyncApiPromises.earlySharedParamsParent : requestStore.asyncApiPromises.sharedParamsParent; 4135 const promise = new Promise((resolve, reject)=>{ 4136 sharedParamsParent.then(()=>resolve(underlyingParams), reject); 4137 }); 4138 // @ts-expect-error 4139 promise.displayName = 'params'; 4140 return instrumentParamsPromiseWithDevWarnings(underlyingParams, promise, workStore); 4141 } 4142 const cachedParams = CachedParams.get(underlyingParams); 4143 if (cachedParams) { 4144 return cachedParams; 4145 } 4146 // We don't use makeResolvedReactPromise here because params 4147 // supports copying with spread and we don't want to unnecessarily 4148 // instrument the promise with spreadable properties of ReactPromise. 4149 const promise = hasFallbackParams ? (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(underlyingParams, requestStore, _stagedrendering.RenderStage.Runtime) : Promise.resolve(underlyingParams);
4150 const proxiedPromise = instrumentParamsPromiseWithDevWarnings(underlyingParams, promise, workStore); 4151 CachedParams.set(underlyingParams, proxiedPromise); 4152 return proxiedPromise; 4153} 4154function instrumentParamsPromiseWithDevWarnings(underlyingParams, promise, workStore) { 4155 // Track which properties we should warn for. 4156 const proxiedProperties = new Set(); 4157 Object.keys(underlyingParams).forEach((prop)=>{ 4158 if (_reflectutils.wellKnownProperties.has(prop)) { 4159 // These properties cannot be shadowed because they need to be the 4160 // true underlying value for Promises to work correctly at runtime 4161 } else { 4162 proxiedProperties.add(prop); 4163 } 4164 }); 4165 return new Proxy(promise, { 4166 get (target, prop, receiver) { 4167 if (typeof prop === 'string') { 4168 if (proxiedProperties.has(prop)) { 4169 const expression = (0, _reflectutils.describeStringPropertyAccess)('params', prop); 4170 warnForSyncAccess(workStore.route, expression); 4171 } 4172 } 4173 return _reflect.ReflectAdapter.get(target, prop, receiver); 4174 }, 4175 set (target, prop, value, receiver) { 4176 if (typeof prop === 'string') { 4177 proxiedProperties.delete(prop); 4178 } 4179 return _reflect.ReflectAdapter.set(target, prop, value, receiver); 4180 }, 4181 ownKeys (target) { 4182 const expression = '`...params` or similar expression'; 4183 warnForSyncAccess(workStore.route, expression); 4184 return Reflect.ownKeys(target); 4185 } 4186 }); 4187} 4188const warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createParamsAccessError); 4189function createParamsAccessError(route, expression) { 4190 const prefix = route ? 'Route "'.concat(route, '" ') : 'This route '; 4191 return Object.defineProperty(new Error("".concat(prefix, "used ").concat(expression, ". ") + "`params` is a Promise and must be unwrapped with `await` or `React.use()` before accessing its properties. " + "Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis"), "__NEXT_ERROR_CODE", { 4192 value: "E834", 4193 enumerable: false, 4194 configurable: true 4195 }); 4196} 4197}), 4198347257, ((__turbopack_context__, module, exports) => { 4199"use strict"; 4200 4201Object.defineProperty(exports, "__esModule", { 4202 value: true 4203}); 4204Object.defineProperty(exports, "ClientPageRoot", { 4205 enumerable: true, 4206 get: function() { 4207 return ClientPageRoot; 4208 } 4209}); 4210const _jsxruntime = __turbopack_context__.r(843476); 4211const _approutercontextsharedruntime = __turbopack_context__.r(8372); 4212const _react = __turbopack_context__.r(271645); 4213const _routeparams = __turbopack_context__.r(33906); 4214const _hooksclientcontextsharedruntime = __turbopack_context__.r(47790); 4215function ClientPageRoot(param) { 4216 let { Component, serverProvidedParams } = param; 4217 let searchParams; 4218 let params; 4219 if (serverProvidedParams !== null) { 4220 searchParams = serverProvidedParams.searchParams; 4221 params = serverProvidedParams.params; 4222 } else { 4223 // When Cache Components is enabled, the server does not pass the params as 4224 // props; they are parsed on the client and passed via context. 4225 const layoutRouterContext = (0, _react.use)(_approutercontextsharedruntime.LayoutRouterContext); 4226 params = layoutRouterContext !== null ? layoutRouterContext.parentParams : {}; 4227 // This is an intentional behavior change: when Cache Components is enabled, 4228 // client segments receive the "canonical" search params, not the 4229 // rewritten ones. Users should either call useSearchParams directly or pass 4230 // the rewritten ones in from a Server Component. 4231 // TODO: Log a deprecation error when this object is accessed 4232 searchParams = (0, _routeparams.urlSearchParamsToParsedUrlQuery)((0, _react.use)(_hooksclientcontextsharedruntime.SearchParamsContext)); 4233 } 4234 if (typeof window === 'undefined') { 4235 let clientSearchParams; 4236 let clientParams; 4237 const { createSearchParamsFromClient } = __turbopack_context__.r(269882); 4238 clientSearchParams = createSearchParamsFromClient(searchParams); 4239 const { createParamsFromClient } = __turbopack_context__.r(541489); 4240 clientParams = createParamsFromClient(params); 4241 return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, { 4242 params: clientParams, 4243 searchParams: clientSearchParams 4244 }); 4245 } else { 4246 const { createRenderSearchParamsFromClient } = __turbopack_context__.r(266996); 4247 const clientSearchParams = createRenderSearchParamsFromClient(searchParams); 4248 const { createRenderParamsFromClient } = __turbopack_context__.r(797689); 4249 const clientParams = createRenderParamsFromClient(params); 4250 return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, { 4251 params: clientParams, 4252 searchParams: clientSearchParams 4253 }); 4254 } 4255} 4256if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 4257 Object.defineProperty(exports.default, '__esModule', { 4258 value: true 4259 });
4260 Object.assign(exports.default, exports); 4261 module.exports = exports.default; 4262} 4263}), 426492825, ((__turbopack_context__, module, exports) => { 4265"use strict"; 4266 4267Object.defineProperty(exports, "__esModule", { 4268 value: true 4269}); 4270Object.defineProperty(exports, "ClientSegmentRoot", { 4271 enumerable: true, 4272 get: function() { 4273 return ClientSegmentRoot; 4274 } 4275}); 4276const _jsxruntime = __turbopack_context__.r(843476); 4277const _approutercontextsharedruntime = __turbopack_context__.r(8372); 4278const _react = __turbopack_context__.r(271645); 4279function ClientSegmentRoot(param) { 4280 let { Component, slots, serverProvidedParams } = param; 4281 let params; 4282 if (serverProvidedParams !== null) { 4283 params = serverProvidedParams.params; 4284 } else { 4285 // When Cache Components is enabled, the server does not pass the params 4286 // as props; they are parsed on the client and passed via context. 4287 const layoutRouterContext = (0, _react.use)(_approutercontextsharedruntime.LayoutRouterContext); 4288 params = layoutRouterContext !== null ? layoutRouterContext.parentParams : {}; 4289 } 4290 if (typeof window === 'undefined') { 4291 const { createParamsFromClient } = __turbopack_context__.r(541489); 4292 const clientParams = createParamsFromClient(params); 4293 return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, { 4294 ...slots, 4295 params: clientParams 4296 }); 4297 } else { 4298 const { createRenderParamsFromClient } = __turbopack_context__.r(797689); 4299 const clientParams = createRenderParamsFromClient(params); 4300 return /*#__PURE__*/ (0, _jsxruntime.jsx)(Component, { 4301 ...slots, 4302 params: clientParams 4303 }); 4304 } 4305} 4306if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') { 4307 Object.defineProperty(exports.default, '__esModule', { 4308 value: true 4309 }); 4310 Object.assign(exports.default, exports); 4311 module.exports = exports.default; 4312} 4313}), 431427201, ((__turbopack_context__, module, exports) => { 4315"use strict"; 4316 4317Object.defineProperty(exports, "__esModule", { 4318 value: true 4319}); 4320Object.defineProperty(exports, "IconMark", { 4321 enumerable: true, 4322 get: function() { 4323 return IconMark; 4324 } 4325}); 4326const _jsxruntime = __turbopack_context__.r(843476); 4327const IconMark = ()=>{ 4328 if (typeof window !== 'undefined') { 4329 return null; 4330 } 4331 return /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", { 4332 name: "\xabnxt-icon\xbb" 4333 }); 4334}; 4335}), 4336]); 4337 4338//# debugId=3913097b-699d-9563-f773-d5cecf627785
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.