Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

187 lines
5.9 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: f40debd565774e77.35e561bbfd.js
* Module id: 693528
* 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,
a = {
RenderStage: function () {
return c;
},
StagedRenderingController: function () {
return u;
},
};
for (var o in a) Object.defineProperty(r, o, { enumerable: !0, get: a[o] });
let i = e.r(498775),
s = e.r(69624);
var c =
(((n = {})[(n.Before = 1)] = "Before"),
(n[(n.Static = 2)] = "Static"),
(n[(n.Runtime = 3)] = "Runtime"),
(n[(n.Dynamic = 4)] = "Dynamic"),
(n[(n.Abandoned = 5)] = "Abandoned"),
n);
class u {
constructor(e = null, t) {
(this.abortSignal = e),
(this.hasRuntimePrefetch = t),
(this.currentStage = 1),
(this.staticInterruptReason = null),
(this.runtimeInterruptReason = null),
(this.staticStageEndTime = 1 / 0),
(this.runtimeStageEndTime = 1 / 0),
(this.runtimeStageListeners = []),
(this.dynamicStageListeners = []),
(this.runtimeStagePromise = (0, s.createPromiseWithResolvers)()),
(this.dynamicStagePromise = (0, s.createPromiseWithResolvers)()),
(this.mayAbandon = !1),
e &&
(e.addEventListener(
"abort",
() => {
let { reason: t } = e;
this.currentStage < 3 &&
(this.runtimeStagePromise.promise.catch(l),
this.runtimeStagePromise.reject(t)),
(this.currentStage < 4 || 5 === this.currentStage) &&
(this.dynamicStagePromise.promise.catch(l),
this.dynamicStagePromise.reject(t));
},
{ once: !0 },
),
(this.mayAbandon = !0));
}
onStage(e, t) {
if (this.currentStage >= e) t();
else if (3 === e) this.runtimeStageListeners.push(t);
else if (4 === e) this.dynamicStageListeners.push(t);
else
throw Object.defineProperty(
new i.InvariantError(`Invalid render stage: ${e}`),
"__NEXT_ERROR_CODE",
{ value: "E881", enumerable: !1, configurable: !0 },
);
}
canSyncInterrupt() {
if (1 === this.currentStage) return !1;
let e = this.hasRuntimePrefetch ? 4 : 3;
return this.currentStage < e;
}
syncInterruptCurrentStageWithReason(e) {
if (1 !== this.currentStage) {
if (this.mayAbandon) return this.abandonRenderImpl();
switch (this.currentStage) {
case 2:
(this.staticInterruptReason = e), this.advanceStage(4);
return;
case 3:
this.hasRuntimePrefetch &&
((this.runtimeInterruptReason = e), this.advanceStage(4));
return;
}
}
}
getStaticInterruptReason() {
return this.staticInterruptReason;
}
getRuntimeInterruptReason() {
return this.runtimeInterruptReason;
}
getStaticStageEndTime() {
return this.staticStageEndTime;
}
getRuntimeStageEndTime() {
return this.runtimeStageEndTime;
}
abandonRender() {
if (!this.mayAbandon)
throw Object.defineProperty(
new i.InvariantError(
"`abandonRender` called on a stage controller that cannot be abandoned.",
),
"__NEXT_ERROR_CODE",
{ value: "E938", enumerable: !1, configurable: !0 },
);
this.abandonRenderImpl();
}
abandonRenderImpl() {
let { currentStage: e } = this;
switch (e) {
case 2:
(this.currentStage = 5), this.resolveRuntimeStage();
return;
case 3:
this.currentStage = 5;
return;
}
}
advanceStage(e) {
if (e <= this.currentStage) return;
let t = this.currentStage;
if (
((this.currentStage = e),
t < 3 &&
e >= 3 &&
((this.staticStageEndTime =
performance.now() + performance.timeOrigin),
this.resolveRuntimeStage()),
t < 4 && e >= 4)
) {
(this.runtimeStageEndTime =
performance.now() + performance.timeOrigin),
this.resolveDynamicStage();
return;
}
}
resolveRuntimeStage() {
let e = this.runtimeStageListeners;
for (let t = 0; t < e.length; t++) e[t]();
(e.length = 0), this.runtimeStagePromise.resolve();
}
resolveDynamicStage() {
let e = this.dynamicStageListeners;
for (let t = 0; t < e.length; t++) e[t]();
(e.length = 0), this.dynamicStagePromise.resolve();
}
getStagePromise(e) {
switch (e) {
case 3:
return this.runtimeStagePromise.promise;
case 4:
return this.dynamicStagePromise.promise;
default:
throw Object.defineProperty(
new i.InvariantError(`Invalid render stage: ${e}`),
"__NEXT_ERROR_CODE",
{ value: "E881", enumerable: !1, configurable: !0 },
);
}
}
waitForStage(e) {
return this.getStagePromise(e);
}
delayUntilStage(e, t, r) {
var n, a, o;
let i,
s =
((n = this.getStagePromise(e)),
(a = t),
(o = r),
(i = new Promise((e, t) => {
n.then(e.bind(null, o), t);
})),
void 0 !== a && (i.displayName = a),
i);
return this.abortSignal && s.catch(l), s;
}
}
function l() {}
};
export default moduleFactory;