258 lines
7.5 KiB
JavaScript
258 lines
7.5 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: ffa5de913d3f001d.98ff1c0dc5.js
|
|
* Module id: 55197
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e, t, r) => {
|
|
"use strict";
|
|
Object.defineProperty(r, "__esModule", { value: !0 });
|
|
var n = {
|
|
convertServerPatchToFullTree: function () {
|
|
return R;
|
|
},
|
|
navigate: function () {
|
|
return d;
|
|
},
|
|
navigateToSeededRoute: function () {
|
|
return h;
|
|
},
|
|
};
|
|
for (var a in n) Object.defineProperty(r, a, { enumerable: !0, get: n[a] });
|
|
let l = e.r(687946),
|
|
u = e.r(414964),
|
|
o = e.r(523712),
|
|
i = e.r(567281),
|
|
s = e.r(133087),
|
|
c = e.r(745347),
|
|
f = e.r(393354);
|
|
function d(e, t, r, n, a, l, u, o) {
|
|
let c = Date.now(),
|
|
d = e.href,
|
|
h = d === t.href,
|
|
y = (0, s.createCacheKey)(d, a),
|
|
_ = (0, i.readRouteCacheEntry)(c, y);
|
|
if (null !== _ && _.status === i.EntryStatus.Fulfilled) {
|
|
let o = g(c, _, _.tree),
|
|
i = o.flightRouterState,
|
|
s = o.seedData,
|
|
f = v(c, _),
|
|
d = f.rsc,
|
|
y = f.isPartial,
|
|
b = _.canonicalUrl + e.hash;
|
|
return p(c, e, t, a, h, r, n, i, s, d, y, b, _.renderedSearch, l, u);
|
|
}
|
|
if (null === _ || _.status !== i.EntryStatus.Rejected) {
|
|
let o = (0, i.requestOptimisticRouteCacheEntry)(c, e, a);
|
|
if (null !== o) {
|
|
let i = g(c, o, o.tree),
|
|
s = i.flightRouterState,
|
|
f = i.seedData,
|
|
d = v(c, o),
|
|
y = d.rsc,
|
|
_ = d.isPartial,
|
|
b = o.canonicalUrl + e.hash;
|
|
return p(c, e, t, a, h, r, n, s, f, y, _, b, o.renderedSearch, l, u);
|
|
}
|
|
}
|
|
let R = o.collectedDebugInfo ?? [];
|
|
return (
|
|
void 0 === o.collectedDebugInfo && (R = o.collectedDebugInfo = []),
|
|
{ tag: f.NavigationResultTag.Async, data: b(c, e, t, a, r, n, l, u, R) }
|
|
);
|
|
}
|
|
function h(e, t, r, n, a, l, o, i, s, c) {
|
|
let d = { scrollableSegments: null, separateRefreshUrls: null },
|
|
h = t.href === a.href,
|
|
p = (0, u.startPPRNavigation)(
|
|
e,
|
|
a,
|
|
l,
|
|
o,
|
|
n.tree,
|
|
i,
|
|
n.data,
|
|
n.head,
|
|
null,
|
|
null,
|
|
!1,
|
|
h,
|
|
d,
|
|
);
|
|
return null !== p
|
|
? ((0, u.spawnDynamicRequests)(p, t, s, i, d),
|
|
y(p, r, n.renderedSearch, d.scrollableSegments, c, t.hash))
|
|
: { tag: f.NavigationResultTag.MPA, data: r };
|
|
}
|
|
function p(e, t, r, n, a, l, o, i, s, c, d, h, p, g, v) {
|
|
let _ = { scrollableSegments: null, separateRefreshUrls: null },
|
|
b = (0, u.startPPRNavigation)(
|
|
e,
|
|
r,
|
|
l,
|
|
o,
|
|
i,
|
|
g,
|
|
null,
|
|
null,
|
|
s,
|
|
c,
|
|
d,
|
|
a,
|
|
_,
|
|
);
|
|
return null !== b
|
|
? ((0, u.spawnDynamicRequests)(b, t, n, g, _),
|
|
y(b, h, p, _.scrollableSegments, v, t.hash))
|
|
: { tag: f.NavigationResultTag.MPA, data: h };
|
|
}
|
|
function y(e, t, r, n, a, l) {
|
|
return {
|
|
tag: f.NavigationResultTag.Success,
|
|
data: {
|
|
flightRouterState: e.route,
|
|
cacheNode: e.node,
|
|
canonicalUrl: t,
|
|
renderedSearch: r,
|
|
scrollableSegments: n,
|
|
shouldScroll: a,
|
|
hash: l,
|
|
},
|
|
};
|
|
}
|
|
function g(e, t, r) {
|
|
let n = {},
|
|
a = {},
|
|
l = r.slots;
|
|
if (null !== l)
|
|
for (let r in l) {
|
|
let u = g(e, t, l[r]);
|
|
(n[r] = u.flightRouterState), (a[r] = u.seedData);
|
|
}
|
|
let u = null,
|
|
o = null,
|
|
s = !0,
|
|
f = (0, i.readSegmentCacheEntry)(e, r.varyPath);
|
|
if (null !== f)
|
|
switch (f.status) {
|
|
case i.EntryStatus.Fulfilled:
|
|
(u = f.rsc), (o = f.loading), (s = f.isPartial);
|
|
break;
|
|
case i.EntryStatus.Pending: {
|
|
let e = (0, i.waitForSegmentCacheEntry)(f);
|
|
(u = e.then((e) => (null !== e ? e.rsc : null))),
|
|
(o = e.then((e) => (null !== e ? e.loading : null))),
|
|
(s = f.isPartial);
|
|
}
|
|
case i.EntryStatus.Empty:
|
|
case i.EntryStatus.Rejected:
|
|
}
|
|
return {
|
|
flightRouterState: [
|
|
(0, c.addSearchParamsIfPageSegment)(
|
|
r.segment,
|
|
Object.fromEntries(new URLSearchParams(t.renderedSearch)),
|
|
),
|
|
n,
|
|
null,
|
|
null,
|
|
r.isRootLayout,
|
|
],
|
|
seedData: [u, a, o, s, !1],
|
|
};
|
|
}
|
|
function v(e, t) {
|
|
let r = null,
|
|
n = !0,
|
|
a = (0, i.readSegmentCacheEntry)(e, t.metadata.varyPath);
|
|
if (null !== a)
|
|
switch (a.status) {
|
|
case i.EntryStatus.Fulfilled:
|
|
(r = a.rsc), (n = a.isPartial);
|
|
break;
|
|
case i.EntryStatus.Pending:
|
|
(r = (0, i.waitForSegmentCacheEntry)(a).then((e) =>
|
|
null !== e ? e.rsc : null,
|
|
)),
|
|
(n = a.isPartial);
|
|
case i.EntryStatus.Empty:
|
|
case i.EntryStatus.Rejected:
|
|
}
|
|
return { rsc: r, isPartial: n };
|
|
}
|
|
let _ = ["", {}, null, "refetch"];
|
|
async function b(e, t, r, n, a, i, s, c, d) {
|
|
let p;
|
|
switch (s) {
|
|
case u.FreshnessPolicy.Default:
|
|
case u.FreshnessPolicy.HistoryTraversal:
|
|
p = i;
|
|
break;
|
|
case u.FreshnessPolicy.Hydration:
|
|
case u.FreshnessPolicy.RefreshAll:
|
|
case u.FreshnessPolicy.HMRRefresh:
|
|
p = _;
|
|
break;
|
|
default:
|
|
p = i;
|
|
}
|
|
let y = (0, l.fetchServerResponse)(t, {
|
|
flightRouterState: p,
|
|
nextUrl: n,
|
|
}),
|
|
g = await y;
|
|
if ("string" == typeof g)
|
|
return { tag: f.NavigationResultTag.MPA, data: g };
|
|
let {
|
|
flightData: v,
|
|
canonicalUrl: b,
|
|
renderedSearch: m,
|
|
debugInfo: P,
|
|
} = g;
|
|
null !== P && d.push(...P);
|
|
let E = R(i, v, m);
|
|
return h(e, t, (0, o.createHrefFromUrl)(b), E, r, a, i, s, n, c);
|
|
}
|
|
function R(e, t, r) {
|
|
let n = e,
|
|
a = null,
|
|
l = null;
|
|
for (let { segmentPath: e, tree: r, seedData: u, head: o } of t) {
|
|
let t = (function e(t, r, n, a, l, u) {
|
|
let o;
|
|
if (u === l.length) return { tree: n, data: a };
|
|
let i = l[u],
|
|
s = t[1],
|
|
c = null !== r ? r[1] : null,
|
|
f = {},
|
|
d = {};
|
|
for (let t in s) {
|
|
let r = s[t],
|
|
o = null !== c ? (c[t] ?? null) : null;
|
|
if (t === i) {
|
|
let i = e(r, o, n, a, l, u + 2);
|
|
(f[t] = i.tree), (d[t] = i.data);
|
|
} else (f[t] = r), (d[t] = o);
|
|
}
|
|
return (
|
|
(o = [t[0], f]),
|
|
2 in t && (o[2] = t[2]),
|
|
3 in t && (o[3] = t[3]),
|
|
4 in t && (o[4] = t[4]),
|
|
{ tree: o, data: [null, d, null, !0, !1] }
|
|
);
|
|
})(n, a, r, u, e, 0);
|
|
(n = t.tree), (a = t.data), (l = o);
|
|
}
|
|
return { tree: n, data: a, renderedSearch: r, head: l };
|
|
}
|
|
("function" == typeof r.default ||
|
|
("object" == typeof r.default && null !== r.default)) &&
|
|
void 0 === r.default.__esModule &&
|
|
(Object.defineProperty(r.default, "__esModule", { value: !0 }),
|
|
Object.assign(r.default, r),
|
|
(t.exports = r.default));
|
|
};
|
|
|
|
export default moduleFactory;
|