react-server-dom-webpack 19.2.0-canary-ab859e31-20250606 → 19.2.0-canary-280ff6fe-20250606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4318 +0,0 @@
1
- /**
2
- * @license React
3
- * react-server-dom-webpack-server.node-webstreams.development.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
-
11
- "use strict";
12
- "production" !== process.env.NODE_ENV &&
13
- (function () {
14
- function voidHandler() {}
15
- function getIteratorFn(maybeIterable) {
16
- if (null === maybeIterable || "object" !== typeof maybeIterable)
17
- return null;
18
- maybeIterable =
19
- (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
20
- maybeIterable["@@iterator"];
21
- return "function" === typeof maybeIterable ? maybeIterable : null;
22
- }
23
- function _defineProperty(obj, key, value) {
24
- a: if ("object" == typeof key && key) {
25
- var e = key[Symbol.toPrimitive];
26
- if (void 0 !== e) {
27
- key = e.call(key, "string");
28
- if ("object" != typeof key) break a;
29
- throw new TypeError("@@toPrimitive must return a primitive value.");
30
- }
31
- key = String(key);
32
- }
33
- key = "symbol" == typeof key ? key : key + "";
34
- key in obj
35
- ? Object.defineProperty(obj, key, {
36
- value: value,
37
- enumerable: !0,
38
- configurable: !0,
39
- writable: !0
40
- })
41
- : (obj[key] = value);
42
- return obj;
43
- }
44
- function writeChunkAndReturn(destination, chunk) {
45
- if (0 !== chunk.byteLength)
46
- if (2048 < chunk.byteLength)
47
- 0 < writtenBytes &&
48
- (destination.enqueue(
49
- new Uint8Array(currentView.buffer, 0, writtenBytes)
50
- ),
51
- (currentView = new Uint8Array(2048)),
52
- (writtenBytes = 0)),
53
- destination.enqueue(chunk);
54
- else {
55
- var allowableBytes = currentView.length - writtenBytes;
56
- allowableBytes < chunk.byteLength &&
57
- (0 === allowableBytes
58
- ? destination.enqueue(currentView)
59
- : (currentView.set(
60
- chunk.subarray(0, allowableBytes),
61
- writtenBytes
62
- ),
63
- destination.enqueue(currentView),
64
- (chunk = chunk.subarray(allowableBytes))),
65
- (currentView = new Uint8Array(2048)),
66
- (writtenBytes = 0));
67
- currentView.set(chunk, writtenBytes);
68
- writtenBytes += chunk.byteLength;
69
- }
70
- return !0;
71
- }
72
- function stringToChunk(content) {
73
- return textEncoder.encode(content);
74
- }
75
- function byteLengthOfChunk(chunk) {
76
- return chunk.byteLength;
77
- }
78
- function closeWithError(destination, error) {
79
- "function" === typeof destination.error
80
- ? destination.error(error)
81
- : destination.close();
82
- }
83
- function isClientReference(reference) {
84
- return reference.$$typeof === CLIENT_REFERENCE_TAG$1;
85
- }
86
- function registerClientReferenceImpl(proxyImplementation, id, async) {
87
- return Object.defineProperties(proxyImplementation, {
88
- $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
89
- $$id: { value: id },
90
- $$async: { value: async }
91
- });
92
- }
93
- function bind() {
94
- var newFn = FunctionBind.apply(this, arguments);
95
- if (this.$$typeof === SERVER_REFERENCE_TAG) {
96
- null != arguments[0] &&
97
- console.error(
98
- 'Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().'
99
- );
100
- var args = ArraySlice.call(arguments, 1),
101
- $$typeof = { value: SERVER_REFERENCE_TAG },
102
- $$id = { value: this.$$id };
103
- args = { value: this.$$bound ? this.$$bound.concat(args) : args };
104
- return Object.defineProperties(newFn, {
105
- $$typeof: $$typeof,
106
- $$id: $$id,
107
- $$bound: args,
108
- $$location: { value: this.$$location, configurable: !0 },
109
- bind: { value: bind, configurable: !0 }
110
- });
111
- }
112
- return newFn;
113
- }
114
- function getReference(target, name) {
115
- switch (name) {
116
- case "$$typeof":
117
- return target.$$typeof;
118
- case "$$id":
119
- return target.$$id;
120
- case "$$async":
121
- return target.$$async;
122
- case "name":
123
- return target.name;
124
- case "defaultProps":
125
- return;
126
- case "toJSON":
127
- return;
128
- case Symbol.toPrimitive:
129
- return Object.prototype[Symbol.toPrimitive];
130
- case Symbol.toStringTag:
131
- return Object.prototype[Symbol.toStringTag];
132
- case "__esModule":
133
- var moduleId = target.$$id;
134
- target.default = registerClientReferenceImpl(
135
- function () {
136
- throw Error(
137
- "Attempted to call the default export of " +
138
- moduleId +
139
- " from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
140
- );
141
- },
142
- target.$$id + "#",
143
- target.$$async
144
- );
145
- return !0;
146
- case "then":
147
- if (target.then) return target.then;
148
- if (target.$$async) return;
149
- var clientReference = registerClientReferenceImpl(
150
- {},
151
- target.$$id,
152
- !0
153
- ),
154
- proxy = new Proxy(clientReference, proxyHandlers$1);
155
- target.status = "fulfilled";
156
- target.value = proxy;
157
- return (target.then = registerClientReferenceImpl(
158
- function (resolve) {
159
- return Promise.resolve(resolve(proxy));
160
- },
161
- target.$$id + "#then",
162
- !1
163
- ));
164
- }
165
- if ("symbol" === typeof name)
166
- throw Error(
167
- "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
168
- );
169
- clientReference = target[name];
170
- clientReference ||
171
- ((clientReference = registerClientReferenceImpl(
172
- function () {
173
- throw Error(
174
- "Attempted to call " +
175
- String(name) +
176
- "() from the server but " +
177
- String(name) +
178
- " is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
179
- );
180
- },
181
- target.$$id + "#" + name,
182
- target.$$async
183
- )),
184
- Object.defineProperty(clientReference, "name", { value: name }),
185
- (clientReference = target[name] =
186
- new Proxy(clientReference, deepProxyHandlers)));
187
- return clientReference;
188
- }
189
- function trimOptions(options) {
190
- if (null == options) return null;
191
- var hasProperties = !1,
192
- trimmed = {},
193
- key;
194
- for (key in options)
195
- null != options[key] &&
196
- ((hasProperties = !0), (trimmed[key] = options[key]));
197
- return hasProperties ? trimmed : null;
198
- }
199
- function resolveOwner() {
200
- if (currentOwner) return currentOwner;
201
- var owner = componentStorage.getStore();
202
- return owner ? owner : null;
203
- }
204
- function collectStackTrace(error, structuredStackTrace) {
205
- for (
206
- var result = [], i = framesToSkip;
207
- i < structuredStackTrace.length;
208
- i++
209
- ) {
210
- var callSite = structuredStackTrace[i],
211
- _name = callSite.getFunctionName() || "<anonymous>";
212
- if ("react-stack-bottom-frame" === _name) break;
213
- else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]);
214
- else {
215
- if (callSite.isConstructor()) _name = "new " + _name;
216
- else if (!callSite.isToplevel()) {
217
- var callSite$jscomp$0 = callSite;
218
- _name = callSite$jscomp$0.getTypeName();
219
- var methodName = callSite$jscomp$0.getMethodName();
220
- callSite$jscomp$0 = callSite$jscomp$0.getFunctionName();
221
- var result$jscomp$0 = "";
222
- callSite$jscomp$0
223
- ? (_name &&
224
- identifierRegExp.test(callSite$jscomp$0) &&
225
- callSite$jscomp$0 !== _name &&
226
- (result$jscomp$0 += _name + "."),
227
- (result$jscomp$0 += callSite$jscomp$0),
228
- !methodName ||
229
- callSite$jscomp$0 === methodName ||
230
- callSite$jscomp$0.endsWith("." + methodName) ||
231
- callSite$jscomp$0.endsWith(" " + methodName) ||
232
- (result$jscomp$0 += " [as " + methodName + "]"))
233
- : (_name && (result$jscomp$0 += _name + "."),
234
- (result$jscomp$0 = methodName
235
- ? result$jscomp$0 + methodName
236
- : result$jscomp$0 + "<anonymous>"));
237
- _name = result$jscomp$0;
238
- }
239
- "<anonymous>" === _name && (_name = "");
240
- methodName = callSite.getScriptNameOrSourceURL() || "<anonymous>";
241
- "<anonymous>" === methodName && (methodName = "");
242
- callSite.isEval() &&
243
- !methodName &&
244
- (callSite$jscomp$0 = callSite.getEvalOrigin()) &&
245
- (methodName = callSite$jscomp$0.toString() + ", <anonymous>");
246
- callSite$jscomp$0 = callSite.getLineNumber() || 0;
247
- result$jscomp$0 = callSite.getColumnNumber() || 0;
248
- var enclosingLine =
249
- "function" === typeof callSite.getEnclosingLineNumber
250
- ? callSite.getEnclosingLineNumber() || 0
251
- : 0;
252
- callSite =
253
- "function" === typeof callSite.getEnclosingColumnNumber
254
- ? callSite.getEnclosingColumnNumber() || 0
255
- : 0;
256
- result.push([
257
- _name,
258
- methodName,
259
- callSite$jscomp$0,
260
- result$jscomp$0,
261
- enclosingLine,
262
- callSite
263
- ]);
264
- }
265
- }
266
- error = (error.name || "Error") + ": " + (error.message || "");
267
- for (i = 0; i < structuredStackTrace.length; i++)
268
- error += "\n at " + structuredStackTrace[i].toString();
269
- collectedStackTrace = result;
270
- return error;
271
- }
272
- function parseStackTrace(error, skipFrames) {
273
- var existing = stackTraceCache.get(error);
274
- if (void 0 !== existing) return existing;
275
- collectedStackTrace = null;
276
- framesToSkip = skipFrames;
277
- existing = Error.prepareStackTrace;
278
- Error.prepareStackTrace = collectStackTrace;
279
- try {
280
- var stack = String(error.stack);
281
- } finally {
282
- Error.prepareStackTrace = existing;
283
- }
284
- if (null !== collectedStackTrace)
285
- return (
286
- (skipFrames = collectedStackTrace),
287
- (collectedStackTrace = null),
288
- stackTraceCache.set(error, skipFrames),
289
- skipFrames
290
- );
291
- stack.startsWith("Error: react-stack-top-frame\n") &&
292
- (stack = stack.slice(29));
293
- existing = stack.indexOf("react-stack-bottom-frame");
294
- -1 !== existing && (existing = stack.lastIndexOf("\n", existing));
295
- -1 !== existing && (stack = stack.slice(0, existing));
296
- stack = stack.split("\n");
297
- for (existing = []; skipFrames < stack.length; skipFrames++) {
298
- var parsed = frameRegExp.exec(stack[skipFrames]);
299
- if (parsed) {
300
- var name = parsed[1] || "";
301
- "<anonymous>" === name && (name = "");
302
- var filename = parsed[2] || parsed[5] || "";
303
- "<anonymous>" === filename && (filename = "");
304
- existing.push([
305
- name,
306
- filename,
307
- +(parsed[3] || parsed[6]),
308
- +(parsed[4] || parsed[7]),
309
- 0,
310
- 0
311
- ]);
312
- }
313
- }
314
- stackTraceCache.set(error, existing);
315
- return existing;
316
- }
317
- function createTemporaryReference(temporaryReferences, id) {
318
- var reference = Object.defineProperties(
319
- function () {
320
- throw Error(
321
- "Attempted to call a temporary Client Reference from the server but it is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
322
- );
323
- },
324
- { $$typeof: { value: TEMPORARY_REFERENCE_TAG } }
325
- );
326
- reference = new Proxy(reference, proxyHandlers);
327
- temporaryReferences.set(reference, id);
328
- return reference;
329
- }
330
- function noop() {}
331
- function trackUsedThenable(thenableState, thenable, index) {
332
- index = thenableState[index];
333
- void 0 === index
334
- ? thenableState.push(thenable)
335
- : index !== thenable && (thenable.then(noop, noop), (thenable = index));
336
- switch (thenable.status) {
337
- case "fulfilled":
338
- return thenable.value;
339
- case "rejected":
340
- throw thenable.reason;
341
- default:
342
- "string" === typeof thenable.status
343
- ? thenable.then(noop, noop)
344
- : ((thenableState = thenable),
345
- (thenableState.status = "pending"),
346
- thenableState.then(
347
- function (fulfilledValue) {
348
- if ("pending" === thenable.status) {
349
- var fulfilledThenable = thenable;
350
- fulfilledThenable.status = "fulfilled";
351
- fulfilledThenable.value = fulfilledValue;
352
- }
353
- },
354
- function (error) {
355
- if ("pending" === thenable.status) {
356
- var rejectedThenable = thenable;
357
- rejectedThenable.status = "rejected";
358
- rejectedThenable.reason = error;
359
- }
360
- }
361
- ));
362
- switch (thenable.status) {
363
- case "fulfilled":
364
- return thenable.value;
365
- case "rejected":
366
- throw thenable.reason;
367
- }
368
- suspendedThenable = thenable;
369
- throw SuspenseException;
370
- }
371
- }
372
- function getSuspendedThenable() {
373
- if (null === suspendedThenable)
374
- throw Error(
375
- "Expected a suspended thenable. This is a bug in React. Please file an issue."
376
- );
377
- var thenable = suspendedThenable;
378
- suspendedThenable = null;
379
- return thenable;
380
- }
381
- function getThenableStateAfterSuspending() {
382
- var state = thenableState || [];
383
- state._componentDebugInfo = currentComponentDebugInfo;
384
- thenableState = currentComponentDebugInfo = null;
385
- return state;
386
- }
387
- function unsupportedHook() {
388
- throw Error("This Hook is not supported in Server Components.");
389
- }
390
- function unsupportedRefresh() {
391
- throw Error(
392
- "Refreshing the cache is not supported in Server Components."
393
- );
394
- }
395
- function unsupportedContext() {
396
- throw Error("Cannot read a Client Context from a Server Component.");
397
- }
398
- function prepareStackTrace(error, structuredStackTrace) {
399
- error = (error.name || "Error") + ": " + (error.message || "");
400
- for (var i = 0; i < structuredStackTrace.length; i++)
401
- error += "\n at " + structuredStackTrace[i].toString();
402
- return error;
403
- }
404
- function resetOwnerStackLimit() {
405
- var now = getCurrentTime();
406
- 1e3 < now - lastResetTime &&
407
- ((ReactSharedInternalsServer.recentlyCreatedOwnerStacks = 0),
408
- (lastResetTime = now));
409
- }
410
- function isObjectPrototype(object) {
411
- if (!object) return !1;
412
- var ObjectPrototype = Object.prototype;
413
- if (object === ObjectPrototype) return !0;
414
- if (getPrototypeOf(object)) return !1;
415
- object = Object.getOwnPropertyNames(object);
416
- for (var i = 0; i < object.length; i++)
417
- if (!(object[i] in ObjectPrototype)) return !1;
418
- return !0;
419
- }
420
- function isSimpleObject(object) {
421
- if (!isObjectPrototype(getPrototypeOf(object))) return !1;
422
- for (
423
- var names = Object.getOwnPropertyNames(object), i = 0;
424
- i < names.length;
425
- i++
426
- ) {
427
- var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
428
- if (
429
- !descriptor ||
430
- (!descriptor.enumerable &&
431
- (("key" !== names[i] && "ref" !== names[i]) ||
432
- "function" !== typeof descriptor.get))
433
- )
434
- return !1;
435
- }
436
- return !0;
437
- }
438
- function objectName(object) {
439
- return Object.prototype.toString
440
- .call(object)
441
- .replace(/^\[object (.*)\]$/, function (m, p0) {
442
- return p0;
443
- });
444
- }
445
- function describeKeyForErrorMessage(key) {
446
- var encodedKey = JSON.stringify(key);
447
- return '"' + key + '"' === encodedKey ? key : encodedKey;
448
- }
449
- function describeValueForErrorMessage(value) {
450
- switch (typeof value) {
451
- case "string":
452
- return JSON.stringify(
453
- 10 >= value.length ? value : value.slice(0, 10) + "..."
454
- );
455
- case "object":
456
- if (isArrayImpl(value)) return "[...]";
457
- if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
458
- return "client";
459
- value = objectName(value);
460
- return "Object" === value ? "{...}" : value;
461
- case "function":
462
- return value.$$typeof === CLIENT_REFERENCE_TAG
463
- ? "client"
464
- : (value = value.displayName || value.name)
465
- ? "function " + value
466
- : "function";
467
- default:
468
- return String(value);
469
- }
470
- }
471
- function describeElementType(type) {
472
- if ("string" === typeof type) return type;
473
- switch (type) {
474
- case REACT_SUSPENSE_TYPE:
475
- return "Suspense";
476
- case REACT_SUSPENSE_LIST_TYPE:
477
- return "SuspenseList";
478
- }
479
- if ("object" === typeof type)
480
- switch (type.$$typeof) {
481
- case REACT_FORWARD_REF_TYPE:
482
- return describeElementType(type.render);
483
- case REACT_MEMO_TYPE:
484
- return describeElementType(type.type);
485
- case REACT_LAZY_TYPE:
486
- var payload = type._payload;
487
- type = type._init;
488
- try {
489
- return describeElementType(type(payload));
490
- } catch (x) {}
491
- }
492
- return "";
493
- }
494
- function describeObjectForErrorMessage(objectOrArray, expandedName) {
495
- var objKind = objectName(objectOrArray);
496
- if ("Object" !== objKind && "Array" !== objKind) return objKind;
497
- var start = -1,
498
- length = 0;
499
- if (isArrayImpl(objectOrArray))
500
- if (jsxChildrenParents.has(objectOrArray)) {
501
- var type = jsxChildrenParents.get(objectOrArray);
502
- objKind = "<" + describeElementType(type) + ">";
503
- for (var i = 0; i < objectOrArray.length; i++) {
504
- var value = objectOrArray[i];
505
- value =
506
- "string" === typeof value
507
- ? value
508
- : "object" === typeof value && null !== value
509
- ? "{" + describeObjectForErrorMessage(value) + "}"
510
- : "{" + describeValueForErrorMessage(value) + "}";
511
- "" + i === expandedName
512
- ? ((start = objKind.length),
513
- (length = value.length),
514
- (objKind += value))
515
- : (objKind =
516
- 15 > value.length && 40 > objKind.length + value.length
517
- ? objKind + value
518
- : objKind + "{...}");
519
- }
520
- objKind += "</" + describeElementType(type) + ">";
521
- } else {
522
- objKind = "[";
523
- for (type = 0; type < objectOrArray.length; type++)
524
- 0 < type && (objKind += ", "),
525
- (i = objectOrArray[type]),
526
- (i =
527
- "object" === typeof i && null !== i
528
- ? describeObjectForErrorMessage(i)
529
- : describeValueForErrorMessage(i)),
530
- "" + type === expandedName
531
- ? ((start = objKind.length),
532
- (length = i.length),
533
- (objKind += i))
534
- : (objKind =
535
- 10 > i.length && 40 > objKind.length + i.length
536
- ? objKind + i
537
- : objKind + "...");
538
- objKind += "]";
539
- }
540
- else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
541
- objKind = "<" + describeElementType(objectOrArray.type) + "/>";
542
- else {
543
- if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
544
- if (jsxPropsParents.has(objectOrArray)) {
545
- objKind = jsxPropsParents.get(objectOrArray);
546
- objKind = "<" + (describeElementType(objKind) || "...");
547
- type = Object.keys(objectOrArray);
548
- for (i = 0; i < type.length; i++) {
549
- objKind += " ";
550
- value = type[i];
551
- objKind += describeKeyForErrorMessage(value) + "=";
552
- var _value2 = objectOrArray[value];
553
- var _substr2 =
554
- value === expandedName &&
555
- "object" === typeof _value2 &&
556
- null !== _value2
557
- ? describeObjectForErrorMessage(_value2)
558
- : describeValueForErrorMessage(_value2);
559
- "string" !== typeof _value2 && (_substr2 = "{" + _substr2 + "}");
560
- value === expandedName
561
- ? ((start = objKind.length),
562
- (length = _substr2.length),
563
- (objKind += _substr2))
564
- : (objKind =
565
- 10 > _substr2.length && 40 > objKind.length + _substr2.length
566
- ? objKind + _substr2
567
- : objKind + "...");
568
- }
569
- objKind += ">";
570
- } else {
571
- objKind = "{";
572
- type = Object.keys(objectOrArray);
573
- for (i = 0; i < type.length; i++)
574
- 0 < i && (objKind += ", "),
575
- (value = type[i]),
576
- (objKind += describeKeyForErrorMessage(value) + ": "),
577
- (_value2 = objectOrArray[value]),
578
- (_value2 =
579
- "object" === typeof _value2 && null !== _value2
580
- ? describeObjectForErrorMessage(_value2)
581
- : describeValueForErrorMessage(_value2)),
582
- value === expandedName
583
- ? ((start = objKind.length),
584
- (length = _value2.length),
585
- (objKind += _value2))
586
- : (objKind =
587
- 10 > _value2.length && 40 > objKind.length + _value2.length
588
- ? objKind + _value2
589
- : objKind + "...");
590
- objKind += "}";
591
- }
592
- }
593
- return void 0 === expandedName
594
- ? objKind
595
- : -1 < start && 0 < length
596
- ? ((objectOrArray = " ".repeat(start) + "^".repeat(length)),
597
- "\n " + objKind + "\n " + objectOrArray)
598
- : "\n " + objKind;
599
- }
600
- function defaultFilterStackFrame(filename) {
601
- return (
602
- "" !== filename &&
603
- !filename.startsWith("node:") &&
604
- !filename.includes("node_modules")
605
- );
606
- }
607
- function filterStackTrace(request, stack) {
608
- request = request.filterStackFrame;
609
- for (var filteredStack = [], i = 0; i < stack.length; i++) {
610
- var callsite = stack[i],
611
- functionName = callsite[0];
612
- var url = callsite[1];
613
- if (url.startsWith("rsc://React/")) {
614
- var envIdx = url.indexOf("/", 12),
615
- suffixIdx = url.lastIndexOf("?");
616
- -1 < envIdx &&
617
- -1 < suffixIdx &&
618
- (url = url.slice(envIdx + 1, suffixIdx));
619
- }
620
- request(url, functionName) &&
621
- ((callsite = callsite.slice(0)),
622
- (callsite[1] = url),
623
- filteredStack.push(callsite));
624
- }
625
- return filteredStack;
626
- }
627
- function patchConsole(consoleInst, methodName) {
628
- var descriptor = Object.getOwnPropertyDescriptor(consoleInst, methodName);
629
- if (
630
- descriptor &&
631
- (descriptor.configurable || descriptor.writable) &&
632
- "function" === typeof descriptor.value
633
- ) {
634
- var originalMethod = descriptor.value;
635
- descriptor = Object.getOwnPropertyDescriptor(originalMethod, "name");
636
- var wrapperMethod = function () {
637
- var request = resolveRequest();
638
- if (("assert" !== methodName || !arguments[0]) && null !== request) {
639
- var stack = filterStackTrace(
640
- request,
641
- parseStackTrace(Error("react-stack-top-frame"), 1)
642
- );
643
- request.pendingChunks++;
644
- var owner = resolveOwner();
645
- emitConsoleChunk(request, methodName, owner, stack, arguments);
646
- }
647
- return originalMethod.apply(this, arguments);
648
- };
649
- descriptor && Object.defineProperty(wrapperMethod, "name", descriptor);
650
- Object.defineProperty(consoleInst, methodName, {
651
- value: wrapperMethod
652
- });
653
- }
654
- }
655
- function getCurrentStackInDEV() {
656
- var owner = resolveOwner();
657
- if (null === owner) return "";
658
- try {
659
- var info = "";
660
- if (owner.owner || "string" !== typeof owner.name) {
661
- for (; owner; ) {
662
- var ownerStack = owner.debugStack;
663
- if (null != ownerStack) {
664
- if ((owner = owner.owner)) {
665
- var JSCompiler_temp_const = info;
666
- var error = ownerStack,
667
- prevPrepareStackTrace = Error.prepareStackTrace;
668
- Error.prepareStackTrace = prepareStackTrace;
669
- var stack = error.stack;
670
- Error.prepareStackTrace = prevPrepareStackTrace;
671
- stack.startsWith("Error: react-stack-top-frame\n") &&
672
- (stack = stack.slice(29));
673
- var idx = stack.indexOf("\n");
674
- -1 !== idx && (stack = stack.slice(idx + 1));
675
- idx = stack.indexOf("react-stack-bottom-frame");
676
- -1 !== idx && (idx = stack.lastIndexOf("\n", idx));
677
- var JSCompiler_inline_result =
678
- -1 !== idx ? (stack = stack.slice(0, idx)) : "";
679
- info =
680
- JSCompiler_temp_const + ("\n" + JSCompiler_inline_result);
681
- }
682
- } else break;
683
- }
684
- var JSCompiler_inline_result$jscomp$0 = info;
685
- } else {
686
- JSCompiler_temp_const = owner.name;
687
- if (void 0 === prefix)
688
- try {
689
- throw Error();
690
- } catch (x) {
691
- (prefix =
692
- ((error = x.stack.trim().match(/\n( *(at )?)/)) && error[1]) ||
693
- ""),
694
- (suffix =
695
- -1 < x.stack.indexOf("\n at")
696
- ? " (<anonymous>)"
697
- : -1 < x.stack.indexOf("@")
698
- ? "@unknown:0:0"
699
- : "");
700
- }
701
- JSCompiler_inline_result$jscomp$0 =
702
- "\n" + prefix + JSCompiler_temp_const + suffix;
703
- }
704
- } catch (x) {
705
- JSCompiler_inline_result$jscomp$0 =
706
- "\nError generating stack: " + x.message + "\n" + x.stack;
707
- }
708
- return JSCompiler_inline_result$jscomp$0;
709
- }
710
- function defaultErrorHandler(error) {
711
- console.error(error);
712
- }
713
- function RequestInstance(
714
- type,
715
- model,
716
- bundlerConfig,
717
- onError,
718
- identifierPrefix,
719
- onPostpone,
720
- temporaryReferences,
721
- environmentName,
722
- filterStackFrame,
723
- onAllReady,
724
- onFatalError
725
- ) {
726
- if (
727
- null !== ReactSharedInternalsServer.A &&
728
- ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
729
- )
730
- throw Error(
731
- "Currently React only supports one RSC renderer at a time."
732
- );
733
- ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
734
- ReactSharedInternalsServer.getCurrentStack = getCurrentStackInDEV;
735
- var abortSet = new Set(),
736
- pingedTasks = [],
737
- hints = new Set();
738
- this.type = type;
739
- this.status = OPENING;
740
- this.flushScheduled = !1;
741
- this.destination = this.fatalError = null;
742
- this.bundlerConfig = bundlerConfig;
743
- this.cache = new Map();
744
- this.pendingChunks = this.nextChunkId = 0;
745
- this.hints = hints;
746
- this.abortListeners = new Set();
747
- this.abortableTasks = abortSet;
748
- this.pingedTasks = pingedTasks;
749
- this.completedImportChunks = [];
750
- this.completedHintChunks = [];
751
- this.completedRegularChunks = [];
752
- this.completedErrorChunks = [];
753
- this.writtenSymbols = new Map();
754
- this.writtenClientReferences = new Map();
755
- this.writtenServerReferences = new Map();
756
- this.writtenObjects = new WeakMap();
757
- this.temporaryReferences = temporaryReferences;
758
- this.identifierPrefix = identifierPrefix || "";
759
- this.identifierCount = 1;
760
- this.taintCleanupQueue = [];
761
- this.onError = void 0 === onError ? defaultErrorHandler : onError;
762
- this.onPostpone =
763
- void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
764
- this.onAllReady = onAllReady;
765
- this.onFatalError = onFatalError;
766
- this.environmentName =
767
- void 0 === environmentName
768
- ? function () {
769
- return "Server";
770
- }
771
- : "function" !== typeof environmentName
772
- ? function () {
773
- return environmentName;
774
- }
775
- : environmentName;
776
- this.filterStackFrame =
777
- void 0 === filterStackFrame
778
- ? defaultFilterStackFrame
779
- : filterStackFrame;
780
- this.didWarnForKey = null;
781
- type = createTask(this, model, null, !1, abortSet, 0, null, null, null);
782
- pingedTasks.push(type);
783
- }
784
- function createRequest(
785
- model,
786
- bundlerConfig,
787
- onError,
788
- identifierPrefix,
789
- onPostpone,
790
- temporaryReferences,
791
- environmentName,
792
- filterStackFrame
793
- ) {
794
- resetOwnerStackLimit();
795
- return new RequestInstance(
796
- 20,
797
- model,
798
- bundlerConfig,
799
- onError,
800
- identifierPrefix,
801
- onPostpone,
802
- temporaryReferences,
803
- environmentName,
804
- filterStackFrame,
805
- noop,
806
- noop
807
- );
808
- }
809
- function createPrerenderRequest(
810
- model,
811
- bundlerConfig,
812
- onAllReady,
813
- onFatalError,
814
- onError,
815
- identifierPrefix,
816
- onPostpone,
817
- temporaryReferences,
818
- environmentName,
819
- filterStackFrame
820
- ) {
821
- resetOwnerStackLimit();
822
- return new RequestInstance(
823
- PRERENDER,
824
- model,
825
- bundlerConfig,
826
- onError,
827
- identifierPrefix,
828
- onPostpone,
829
- temporaryReferences,
830
- environmentName,
831
- filterStackFrame,
832
- onAllReady,
833
- onFatalError
834
- );
835
- }
836
- function resolveRequest() {
837
- if (currentRequest) return currentRequest;
838
- var store = requestStorage.getStore();
839
- return store ? store : null;
840
- }
841
- function serializeThenable(request, task, thenable) {
842
- var newTask = createTask(
843
- request,
844
- null,
845
- task.keyPath,
846
- task.implicitSlot,
847
- request.abortableTasks,
848
- 0,
849
- task.debugOwner,
850
- task.debugStack,
851
- task.debugTask
852
- );
853
- (task = thenable._debugInfo) &&
854
- forwardDebugInfo(request, newTask.id, task);
855
- switch (thenable.status) {
856
- case "fulfilled":
857
- return (
858
- (newTask.model = thenable.value),
859
- pingTask(request, newTask),
860
- newTask.id
861
- );
862
- case "rejected":
863
- return erroredTask(request, newTask, thenable.reason), newTask.id;
864
- default:
865
- if (request.status === ABORTING)
866
- return (
867
- request.abortableTasks.delete(newTask),
868
- (newTask.status = ABORTED),
869
- (task = stringify(serializeByValueID(request.fatalError))),
870
- emitModelChunk(request, newTask.id, task),
871
- newTask.id
872
- );
873
- "string" !== typeof thenable.status &&
874
- ((thenable.status = "pending"),
875
- thenable.then(
876
- function (fulfilledValue) {
877
- "pending" === thenable.status &&
878
- ((thenable.status = "fulfilled"),
879
- (thenable.value = fulfilledValue));
880
- },
881
- function (error) {
882
- "pending" === thenable.status &&
883
- ((thenable.status = "rejected"), (thenable.reason = error));
884
- }
885
- ));
886
- }
887
- thenable.then(
888
- function (value) {
889
- newTask.model = value;
890
- pingTask(request, newTask);
891
- },
892
- function (reason) {
893
- newTask.status === PENDING$1 &&
894
- (erroredTask(request, newTask, reason), enqueueFlush(request));
895
- }
896
- );
897
- return newTask.id;
898
- }
899
- function serializeReadableStream(request, task, stream) {
900
- function progress(entry) {
901
- if (!aborted)
902
- if (entry.done)
903
- (entry = streamTask.id.toString(16) + ":C\n"),
904
- request.completedRegularChunks.push(stringToChunk(entry)),
905
- enqueueFlush(request),
906
- request.abortListeners.delete(abortStream),
907
- callOnAllReadyIfReady(request),
908
- (aborted = !0);
909
- else
910
- try {
911
- (streamTask.model = entry.value),
912
- request.pendingChunks++,
913
- tryStreamTask(request, streamTask),
914
- enqueueFlush(request),
915
- reader.read().then(progress, error);
916
- } catch (x$0) {
917
- error(x$0);
918
- }
919
- }
920
- function error(reason) {
921
- aborted ||
922
- ((aborted = !0),
923
- request.abortListeners.delete(abortStream),
924
- erroredTask(request, streamTask, reason),
925
- enqueueFlush(request),
926
- reader.cancel(reason).then(error, error));
927
- }
928
- function abortStream(reason) {
929
- aborted ||
930
- ((aborted = !0),
931
- request.abortListeners.delete(abortStream),
932
- erroredTask(request, streamTask, reason),
933
- enqueueFlush(request),
934
- reader.cancel(reason).then(error, error));
935
- }
936
- var supportsBYOB = stream.supportsBYOB;
937
- if (void 0 === supportsBYOB)
938
- try {
939
- stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0);
940
- } catch (x) {
941
- supportsBYOB = !1;
942
- }
943
- var reader = stream.getReader(),
944
- streamTask = createTask(
945
- request,
946
- task.model,
947
- task.keyPath,
948
- task.implicitSlot,
949
- request.abortableTasks,
950
- 0,
951
- task.debugOwner,
952
- task.debugStack,
953
- task.debugTask
954
- );
955
- request.abortableTasks.delete(streamTask);
956
- request.pendingChunks++;
957
- task =
958
- streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
959
- request.completedRegularChunks.push(stringToChunk(task));
960
- var aborted = !1;
961
- request.abortListeners.add(abortStream);
962
- reader.read().then(progress, error);
963
- return serializeByValueID(streamTask.id);
964
- }
965
- function serializeAsyncIterable(request, task, iterable, iterator) {
966
- function progress(entry) {
967
- if (!aborted)
968
- if (entry.done) {
969
- if (void 0 === entry.value)
970
- var endStreamRow = streamTask.id.toString(16) + ":C\n";
971
- else
972
- try {
973
- var chunkId = outlineModel(request, entry.value);
974
- endStreamRow =
975
- streamTask.id.toString(16) +
976
- ":C" +
977
- stringify(serializeByValueID(chunkId)) +
978
- "\n";
979
- } catch (x) {
980
- error(x);
981
- return;
982
- }
983
- request.completedRegularChunks.push(stringToChunk(endStreamRow));
984
- enqueueFlush(request);
985
- request.abortListeners.delete(abortIterable);
986
- callOnAllReadyIfReady(request);
987
- aborted = !0;
988
- } else
989
- try {
990
- (streamTask.model = entry.value),
991
- request.pendingChunks++,
992
- tryStreamTask(request, streamTask),
993
- enqueueFlush(request),
994
- callIteratorInDEV(iterator, progress, error);
995
- } catch (x$1) {
996
- error(x$1);
997
- }
998
- }
999
- function error(reason) {
1000
- aborted ||
1001
- ((aborted = !0),
1002
- request.abortListeners.delete(abortIterable),
1003
- erroredTask(request, streamTask, reason),
1004
- enqueueFlush(request),
1005
- "function" === typeof iterator.throw &&
1006
- iterator.throw(reason).then(error, error));
1007
- }
1008
- function abortIterable(reason) {
1009
- aborted ||
1010
- ((aborted = !0),
1011
- request.abortListeners.delete(abortIterable),
1012
- erroredTask(request, streamTask, reason),
1013
- enqueueFlush(request),
1014
- "function" === typeof iterator.throw &&
1015
- iterator.throw(reason).then(error, error));
1016
- }
1017
- var isIterator = iterable === iterator,
1018
- streamTask = createTask(
1019
- request,
1020
- task.model,
1021
- task.keyPath,
1022
- task.implicitSlot,
1023
- request.abortableTasks,
1024
- 0,
1025
- task.debugOwner,
1026
- task.debugStack,
1027
- task.debugTask
1028
- );
1029
- request.abortableTasks.delete(streamTask);
1030
- request.pendingChunks++;
1031
- task = streamTask.id.toString(16) + ":" + (isIterator ? "x" : "X") + "\n";
1032
- request.completedRegularChunks.push(stringToChunk(task));
1033
- (iterable = iterable._debugInfo) &&
1034
- forwardDebugInfo(request, streamTask.id, iterable);
1035
- var aborted = !1;
1036
- request.abortListeners.add(abortIterable);
1037
- callIteratorInDEV(iterator, progress, error);
1038
- return serializeByValueID(streamTask.id);
1039
- }
1040
- function emitHint(request, code, model) {
1041
- model = stringify(model);
1042
- code = stringToChunk(":H" + code + model + "\n");
1043
- request.completedHintChunks.push(code);
1044
- enqueueFlush(request);
1045
- }
1046
- function readThenable(thenable) {
1047
- if ("fulfilled" === thenable.status) return thenable.value;
1048
- if ("rejected" === thenable.status) throw thenable.reason;
1049
- throw thenable;
1050
- }
1051
- function createLazyWrapperAroundWakeable(wakeable) {
1052
- switch (wakeable.status) {
1053
- case "fulfilled":
1054
- case "rejected":
1055
- break;
1056
- default:
1057
- "string" !== typeof wakeable.status &&
1058
- ((wakeable.status = "pending"),
1059
- wakeable.then(
1060
- function (fulfilledValue) {
1061
- "pending" === wakeable.status &&
1062
- ((wakeable.status = "fulfilled"),
1063
- (wakeable.value = fulfilledValue));
1064
- },
1065
- function (error) {
1066
- "pending" === wakeable.status &&
1067
- ((wakeable.status = "rejected"), (wakeable.reason = error));
1068
- }
1069
- ));
1070
- }
1071
- var lazyType = {
1072
- $$typeof: REACT_LAZY_TYPE,
1073
- _payload: wakeable,
1074
- _init: readThenable
1075
- };
1076
- lazyType._debugInfo = wakeable._debugInfo || [];
1077
- return lazyType;
1078
- }
1079
- function callWithDebugContextInDEV(request, task, callback, arg) {
1080
- var componentDebugInfo = {
1081
- name: "",
1082
- env: task.environmentName,
1083
- key: null,
1084
- owner: task.debugOwner
1085
- };
1086
- componentDebugInfo.stack =
1087
- null === task.debugStack
1088
- ? null
1089
- : filterStackTrace(request, parseStackTrace(task.debugStack, 1));
1090
- componentDebugInfo.debugStack = task.debugStack;
1091
- request = componentDebugInfo.debugTask = task.debugTask;
1092
- currentOwner = componentDebugInfo;
1093
- try {
1094
- return request ? request.run(callback.bind(null, arg)) : callback(arg);
1095
- } finally {
1096
- currentOwner = null;
1097
- }
1098
- }
1099
- function processServerComponentReturnValue(
1100
- request,
1101
- task,
1102
- Component,
1103
- result
1104
- ) {
1105
- if (
1106
- "object" !== typeof result ||
1107
- null === result ||
1108
- isClientReference(result)
1109
- )
1110
- return result;
1111
- if ("function" === typeof result.then)
1112
- return (
1113
- result.then(function (resolvedValue) {
1114
- "object" === typeof resolvedValue &&
1115
- null !== resolvedValue &&
1116
- resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
1117
- (resolvedValue._store.validated = 1);
1118
- }, voidHandler),
1119
- "fulfilled" === result.status
1120
- ? result.value
1121
- : createLazyWrapperAroundWakeable(result)
1122
- );
1123
- result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1);
1124
- var iteratorFn = getIteratorFn(result);
1125
- if (iteratorFn) {
1126
- var multiShot = _defineProperty({}, Symbol.iterator, function () {
1127
- var iterator = iteratorFn.call(result);
1128
- iterator !== result ||
1129
- ("[object GeneratorFunction]" ===
1130
- Object.prototype.toString.call(Component) &&
1131
- "[object Generator]" ===
1132
- Object.prototype.toString.call(result)) ||
1133
- callWithDebugContextInDEV(request, task, function () {
1134
- console.error(
1135
- "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
1136
- );
1137
- });
1138
- return iterator;
1139
- });
1140
- multiShot._debugInfo = result._debugInfo;
1141
- return multiShot;
1142
- }
1143
- return "function" !== typeof result[ASYNC_ITERATOR] ||
1144
- ("function" === typeof ReadableStream &&
1145
- result instanceof ReadableStream)
1146
- ? result
1147
- : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () {
1148
- var iterator = result[ASYNC_ITERATOR]();
1149
- iterator !== result ||
1150
- ("[object AsyncGeneratorFunction]" ===
1151
- Object.prototype.toString.call(Component) &&
1152
- "[object AsyncGenerator]" ===
1153
- Object.prototype.toString.call(result)) ||
1154
- callWithDebugContextInDEV(request, task, function () {
1155
- console.error(
1156
- "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1157
- );
1158
- });
1159
- return iterator;
1160
- })),
1161
- (multiShot._debugInfo = result._debugInfo),
1162
- multiShot);
1163
- }
1164
- function renderFunctionComponent(
1165
- request,
1166
- task,
1167
- key,
1168
- Component,
1169
- props,
1170
- validated
1171
- ) {
1172
- var prevThenableState = task.thenableState;
1173
- task.thenableState = null;
1174
- if (null === debugID) return outlineTask(request, task);
1175
- if (null !== prevThenableState)
1176
- var componentDebugInfo = prevThenableState._componentDebugInfo;
1177
- else {
1178
- var componentDebugID = debugID;
1179
- componentDebugInfo = Component.displayName || Component.name || "";
1180
- var componentEnv = (0, request.environmentName)();
1181
- request.pendingChunks++;
1182
- componentDebugInfo = {
1183
- name: componentDebugInfo,
1184
- env: componentEnv,
1185
- key: key,
1186
- owner: task.debugOwner
1187
- };
1188
- componentDebugInfo.stack =
1189
- null === task.debugStack
1190
- ? null
1191
- : filterStackTrace(request, parseStackTrace(task.debugStack, 1));
1192
- componentDebugInfo.props = props;
1193
- componentDebugInfo.debugStack = task.debugStack;
1194
- componentDebugInfo.debugTask = task.debugTask;
1195
- outlineComponentInfo(request, componentDebugInfo);
1196
- emitDebugChunk(request, componentDebugID, componentDebugInfo);
1197
- task.environmentName = componentEnv;
1198
- 2 === validated &&
1199
- warnForMissingKey(request, key, componentDebugInfo, task.debugTask);
1200
- }
1201
- thenableIndexCounter = 0;
1202
- thenableState = prevThenableState;
1203
- currentComponentDebugInfo = componentDebugInfo;
1204
- props = task.debugTask
1205
- ? task.debugTask.run(
1206
- componentStorage.run.bind(
1207
- componentStorage,
1208
- componentDebugInfo,
1209
- callComponentInDEV,
1210
- Component,
1211
- props,
1212
- componentDebugInfo
1213
- )
1214
- )
1215
- : componentStorage.run(
1216
- componentDebugInfo,
1217
- callComponentInDEV,
1218
- Component,
1219
- props,
1220
- componentDebugInfo
1221
- );
1222
- if (request.status === ABORTING)
1223
- throw (
1224
- ("object" !== typeof props ||
1225
- null === props ||
1226
- "function" !== typeof props.then ||
1227
- isClientReference(props) ||
1228
- props.then(voidHandler, voidHandler),
1229
- null)
1230
- );
1231
- props = processServerComponentReturnValue(
1232
- request,
1233
- task,
1234
- Component,
1235
- props
1236
- );
1237
- Component = task.keyPath;
1238
- validated = task.implicitSlot;
1239
- null !== key
1240
- ? (task.keyPath = null === Component ? key : Component + "," + key)
1241
- : null === Component && (task.implicitSlot = !0);
1242
- request = renderModelDestructive(request, task, emptyRoot, "", props);
1243
- task.keyPath = Component;
1244
- task.implicitSlot = validated;
1245
- return request;
1246
- }
1247
- function warnForMissingKey(request, key, componentDebugInfo, debugTask) {
1248
- function logKeyError() {
1249
- console.error(
1250
- 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
1251
- "",
1252
- ""
1253
- );
1254
- }
1255
- key = request.didWarnForKey;
1256
- null == key && (key = request.didWarnForKey = new WeakSet());
1257
- request = componentDebugInfo.owner;
1258
- if (null != request) {
1259
- if (key.has(request)) return;
1260
- key.add(request);
1261
- }
1262
- debugTask
1263
- ? debugTask.run(
1264
- componentStorage.run.bind(
1265
- componentStorage,
1266
- componentDebugInfo,
1267
- callComponentInDEV,
1268
- logKeyError,
1269
- null,
1270
- componentDebugInfo
1271
- )
1272
- )
1273
- : componentStorage.run(
1274
- componentDebugInfo,
1275
- callComponentInDEV,
1276
- logKeyError,
1277
- null,
1278
- componentDebugInfo
1279
- );
1280
- }
1281
- function renderFragment(request, task, children) {
1282
- for (var i = 0; i < children.length; i++) {
1283
- var child = children[i];
1284
- null === child ||
1285
- "object" !== typeof child ||
1286
- child.$$typeof !== REACT_ELEMENT_TYPE ||
1287
- null !== child.key ||
1288
- child._store.validated ||
1289
- (child._store.validated = 2);
1290
- }
1291
- if (null !== task.keyPath)
1292
- return (
1293
- (request = [
1294
- REACT_ELEMENT_TYPE,
1295
- REACT_FRAGMENT_TYPE,
1296
- task.keyPath,
1297
- { children: children },
1298
- null,
1299
- null,
1300
- 0
1301
- ]),
1302
- task.implicitSlot ? [request] : request
1303
- );
1304
- if ((i = children._debugInfo)) {
1305
- if (null === debugID) return outlineTask(request, task);
1306
- forwardDebugInfo(request, debugID, i);
1307
- children = Array.from(children);
1308
- }
1309
- return children;
1310
- }
1311
- function renderAsyncFragment(request, task, children, getAsyncIterator) {
1312
- if (null !== task.keyPath)
1313
- return (
1314
- (request = [
1315
- REACT_ELEMENT_TYPE,
1316
- REACT_FRAGMENT_TYPE,
1317
- task.keyPath,
1318
- { children: children },
1319
- null,
1320
- null,
1321
- 0
1322
- ]),
1323
- task.implicitSlot ? [request] : request
1324
- );
1325
- getAsyncIterator = getAsyncIterator.call(children);
1326
- return serializeAsyncIterable(request, task, children, getAsyncIterator);
1327
- }
1328
- function deferTask(request, task) {
1329
- task = createTask(
1330
- request,
1331
- task.model,
1332
- task.keyPath,
1333
- task.implicitSlot,
1334
- request.abortableTasks,
1335
- 0,
1336
- task.debugOwner,
1337
- task.debugStack,
1338
- task.debugTask
1339
- );
1340
- pingTask(request, task);
1341
- return serializeLazyID(task.id);
1342
- }
1343
- function outlineTask(request, task) {
1344
- task = createTask(
1345
- request,
1346
- task.model,
1347
- task.keyPath,
1348
- task.implicitSlot,
1349
- request.abortableTasks,
1350
- 0,
1351
- task.debugOwner,
1352
- task.debugStack,
1353
- task.debugTask
1354
- );
1355
- retryTask(request, task);
1356
- return task.status === COMPLETED
1357
- ? serializeByValueID(task.id)
1358
- : serializeLazyID(task.id);
1359
- }
1360
- function renderElement(request, task, type, key, ref, props, validated) {
1361
- if (null !== ref && void 0 !== ref)
1362
- throw Error(
1363
- "Refs cannot be used in Server Components, nor passed to Client Components."
1364
- );
1365
- jsxPropsParents.set(props, type);
1366
- "object" === typeof props.children &&
1367
- null !== props.children &&
1368
- jsxChildrenParents.set(props.children, type);
1369
- if (
1370
- "function" !== typeof type ||
1371
- isClientReference(type) ||
1372
- type.$$typeof === TEMPORARY_REFERENCE_TAG
1373
- ) {
1374
- if (type === REACT_FRAGMENT_TYPE && null === key)
1375
- return (
1376
- 2 === validated &&
1377
- ((validated = {
1378
- name: "Fragment",
1379
- env: (0, request.environmentName)(),
1380
- key: key,
1381
- owner: task.debugOwner,
1382
- stack:
1383
- null === task.debugStack
1384
- ? null
1385
- : filterStackTrace(
1386
- request,
1387
- parseStackTrace(task.debugStack, 1)
1388
- ),
1389
- props: props,
1390
- debugStack: task.debugStack,
1391
- debugTask: task.debugTask
1392
- }),
1393
- warnForMissingKey(request, key, validated, task.debugTask)),
1394
- (validated = task.implicitSlot),
1395
- null === task.keyPath && (task.implicitSlot = !0),
1396
- (request = renderModelDestructive(
1397
- request,
1398
- task,
1399
- emptyRoot,
1400
- "",
1401
- props.children
1402
- )),
1403
- (task.implicitSlot = validated),
1404
- request
1405
- );
1406
- if (
1407
- null != type &&
1408
- "object" === typeof type &&
1409
- !isClientReference(type)
1410
- )
1411
- switch (type.$$typeof) {
1412
- case REACT_LAZY_TYPE:
1413
- type = callLazyInitInDEV(type);
1414
- if (request.status === ABORTING) throw null;
1415
- return renderElement(
1416
- request,
1417
- task,
1418
- type,
1419
- key,
1420
- ref,
1421
- props,
1422
- validated
1423
- );
1424
- case REACT_FORWARD_REF_TYPE:
1425
- return renderFunctionComponent(
1426
- request,
1427
- task,
1428
- key,
1429
- type.render,
1430
- props,
1431
- validated
1432
- );
1433
- case REACT_MEMO_TYPE:
1434
- return renderElement(
1435
- request,
1436
- task,
1437
- type.type,
1438
- key,
1439
- ref,
1440
- props,
1441
- validated
1442
- );
1443
- case REACT_ELEMENT_TYPE:
1444
- type._store.validated = 1;
1445
- }
1446
- } else
1447
- return renderFunctionComponent(
1448
- request,
1449
- task,
1450
- key,
1451
- type,
1452
- props,
1453
- validated
1454
- );
1455
- ref = task.keyPath;
1456
- null === key ? (key = ref) : null !== ref && (key = ref + "," + key);
1457
- null !== task.debugOwner &&
1458
- outlineComponentInfo(request, task.debugOwner);
1459
- request = [
1460
- REACT_ELEMENT_TYPE,
1461
- type,
1462
- key,
1463
- props,
1464
- task.debugOwner,
1465
- null === task.debugStack
1466
- ? null
1467
- : filterStackTrace(request, parseStackTrace(task.debugStack, 1)),
1468
- validated
1469
- ];
1470
- task = task.implicitSlot && null !== key ? [request] : request;
1471
- return task;
1472
- }
1473
- function pingTask(request, task) {
1474
- var pingedTasks = request.pingedTasks;
1475
- pingedTasks.push(task);
1476
- 1 === pingedTasks.length &&
1477
- ((request.flushScheduled = null !== request.destination),
1478
- request.type === PRERENDER || request.status === OPENING
1479
- ? scheduleMicrotask(function () {
1480
- return performWork(request);
1481
- })
1482
- : setImmediate(function () {
1483
- return performWork(request);
1484
- }));
1485
- }
1486
- function createTask(
1487
- request,
1488
- model,
1489
- keyPath,
1490
- implicitSlot,
1491
- abortSet,
1492
- lastTimestamp,
1493
- debugOwner,
1494
- debugStack,
1495
- debugTask
1496
- ) {
1497
- request.pendingChunks++;
1498
- lastTimestamp = request.nextChunkId++;
1499
- "object" !== typeof model ||
1500
- null === model ||
1501
- null !== keyPath ||
1502
- implicitSlot ||
1503
- request.writtenObjects.set(model, serializeByValueID(lastTimestamp));
1504
- var task = {
1505
- id: lastTimestamp,
1506
- status: PENDING$1,
1507
- model: model,
1508
- keyPath: keyPath,
1509
- implicitSlot: implicitSlot,
1510
- ping: function () {
1511
- return pingTask(request, task);
1512
- },
1513
- toJSON: function (parentPropertyName, value) {
1514
- var parent = this,
1515
- originalValue = parent[parentPropertyName];
1516
- "object" !== typeof originalValue ||
1517
- originalValue === value ||
1518
- originalValue instanceof Date ||
1519
- callWithDebugContextInDEV(request, task, function () {
1520
- "Object" !== objectName(originalValue)
1521
- ? "string" === typeof jsxChildrenParents.get(parent)
1522
- ? console.error(
1523
- "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
1524
- objectName(originalValue),
1525
- describeObjectForErrorMessage(parent, parentPropertyName)
1526
- )
1527
- : console.error(
1528
- "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
1529
- objectName(originalValue),
1530
- describeObjectForErrorMessage(parent, parentPropertyName)
1531
- )
1532
- : console.error(
1533
- "Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.%s",
1534
- describeObjectForErrorMessage(parent, parentPropertyName)
1535
- );
1536
- });
1537
- return renderModel(request, task, parent, parentPropertyName, value);
1538
- },
1539
- thenableState: null
1540
- };
1541
- task.environmentName = request.environmentName();
1542
- task.debugOwner = debugOwner;
1543
- task.debugStack = debugStack;
1544
- task.debugTask = debugTask;
1545
- abortSet.add(task);
1546
- return task;
1547
- }
1548
- function serializeByValueID(id) {
1549
- return "$" + id.toString(16);
1550
- }
1551
- function serializeLazyID(id) {
1552
- return "$L" + id.toString(16);
1553
- }
1554
- function serializeNumber(number) {
1555
- return Number.isFinite(number)
1556
- ? 0 === number && -Infinity === 1 / number
1557
- ? "$-0"
1558
- : number
1559
- : Infinity === number
1560
- ? "$Infinity"
1561
- : -Infinity === number
1562
- ? "$-Infinity"
1563
- : "$NaN";
1564
- }
1565
- function encodeReferenceChunk(request, id, reference) {
1566
- request = stringify(reference);
1567
- id = id.toString(16) + ":" + request + "\n";
1568
- return stringToChunk(id);
1569
- }
1570
- function serializeClientReference(
1571
- request,
1572
- parent,
1573
- parentPropertyName,
1574
- clientReference
1575
- ) {
1576
- var clientReferenceKey = clientReference.$$async
1577
- ? clientReference.$$id + "#async"
1578
- : clientReference.$$id,
1579
- writtenClientReferences = request.writtenClientReferences,
1580
- existingId = writtenClientReferences.get(clientReferenceKey);
1581
- if (void 0 !== existingId)
1582
- return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1583
- ? serializeLazyID(existingId)
1584
- : serializeByValueID(existingId);
1585
- try {
1586
- var config = request.bundlerConfig,
1587
- modulePath = clientReference.$$id;
1588
- existingId = "";
1589
- var resolvedModuleData = config[modulePath];
1590
- if (resolvedModuleData) existingId = resolvedModuleData.name;
1591
- else {
1592
- var idx = modulePath.lastIndexOf("#");
1593
- -1 !== idx &&
1594
- ((existingId = modulePath.slice(idx + 1)),
1595
- (resolvedModuleData = config[modulePath.slice(0, idx)]));
1596
- if (!resolvedModuleData)
1597
- throw Error(
1598
- 'Could not find the module "' +
1599
- modulePath +
1600
- '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
1601
- );
1602
- }
1603
- if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
1604
- throw Error(
1605
- 'The module "' +
1606
- modulePath +
1607
- '" is marked as an async ESM module but was loaded as a CJS proxy. This is probably a bug in the React Server Components bundler.'
1608
- );
1609
- var clientReferenceMetadata =
1610
- !0 === resolvedModuleData.async || !0 === clientReference.$$async
1611
- ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1612
- : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
1613
- request.pendingChunks++;
1614
- var importId = request.nextChunkId++,
1615
- json = stringify(clientReferenceMetadata),
1616
- row = importId.toString(16) + ":I" + json + "\n",
1617
- processedChunk = stringToChunk(row);
1618
- request.completedImportChunks.push(processedChunk);
1619
- writtenClientReferences.set(clientReferenceKey, importId);
1620
- return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1621
- ? serializeLazyID(importId)
1622
- : serializeByValueID(importId);
1623
- } catch (x) {
1624
- return (
1625
- request.pendingChunks++,
1626
- (parent = request.nextChunkId++),
1627
- (parentPropertyName = logRecoverableError(request, x, null)),
1628
- emitErrorChunk(request, parent, parentPropertyName, x),
1629
- serializeByValueID(parent)
1630
- );
1631
- }
1632
- }
1633
- function outlineModel(request, value) {
1634
- value = createTask(
1635
- request,
1636
- value,
1637
- null,
1638
- !1,
1639
- request.abortableTasks,
1640
- 0,
1641
- null,
1642
- null,
1643
- null
1644
- );
1645
- retryTask(request, value);
1646
- return value.id;
1647
- }
1648
- function serializeServerReference(request, serverReference) {
1649
- var writtenServerReferences = request.writtenServerReferences,
1650
- existingId = writtenServerReferences.get(serverReference);
1651
- if (void 0 !== existingId) return "$F" + existingId.toString(16);
1652
- existingId = serverReference.$$bound;
1653
- existingId = null === existingId ? null : Promise.resolve(existingId);
1654
- var id = serverReference.$$id,
1655
- location = null,
1656
- error = serverReference.$$location;
1657
- error &&
1658
- ((error = parseStackTrace(error, 1)),
1659
- 0 < error.length &&
1660
- ((location = error[0]),
1661
- (location = [location[0], location[1], location[2], location[3]])));
1662
- existingId =
1663
- null !== location
1664
- ? {
1665
- id: id,
1666
- bound: existingId,
1667
- name:
1668
- "function" === typeof serverReference
1669
- ? serverReference.name
1670
- : "",
1671
- env: (0, request.environmentName)(),
1672
- location: location
1673
- }
1674
- : { id: id, bound: existingId };
1675
- request = outlineModel(request, existingId);
1676
- writtenServerReferences.set(serverReference, request);
1677
- return "$F" + request.toString(16);
1678
- }
1679
- function serializeLargeTextString(request, text) {
1680
- request.pendingChunks++;
1681
- var textId = request.nextChunkId++;
1682
- emitTextChunk(request, textId, text);
1683
- return serializeByValueID(textId);
1684
- }
1685
- function serializeMap(request, map) {
1686
- map = Array.from(map);
1687
- return "$Q" + outlineModel(request, map).toString(16);
1688
- }
1689
- function serializeFormData(request, formData) {
1690
- formData = Array.from(formData.entries());
1691
- return "$K" + outlineModel(request, formData).toString(16);
1692
- }
1693
- function serializeSet(request, set) {
1694
- set = Array.from(set);
1695
- return "$W" + outlineModel(request, set).toString(16);
1696
- }
1697
- function serializeTypedArray(request, tag, typedArray) {
1698
- request.pendingChunks++;
1699
- var bufferId = request.nextChunkId++;
1700
- emitTypedArrayChunk(request, bufferId, tag, typedArray);
1701
- return serializeByValueID(bufferId);
1702
- }
1703
- function serializeBlob(request, blob) {
1704
- function progress(entry) {
1705
- if (!aborted)
1706
- if (entry.done)
1707
- request.abortListeners.delete(abortBlob),
1708
- (aborted = !0),
1709
- pingTask(request, newTask);
1710
- else
1711
- return (
1712
- model.push(entry.value), reader.read().then(progress).catch(error)
1713
- );
1714
- }
1715
- function error(reason) {
1716
- aborted ||
1717
- ((aborted = !0),
1718
- request.abortListeners.delete(abortBlob),
1719
- erroredTask(request, newTask, reason),
1720
- enqueueFlush(request),
1721
- reader.cancel(reason).then(error, error));
1722
- }
1723
- function abortBlob(reason) {
1724
- aborted ||
1725
- ((aborted = !0),
1726
- request.abortListeners.delete(abortBlob),
1727
- erroredTask(request, newTask, reason),
1728
- enqueueFlush(request),
1729
- reader.cancel(reason).then(error, error));
1730
- }
1731
- var model = [blob.type],
1732
- newTask = createTask(
1733
- request,
1734
- model,
1735
- null,
1736
- !1,
1737
- request.abortableTasks,
1738
- 0,
1739
- null,
1740
- null,
1741
- null
1742
- ),
1743
- reader = blob.stream().getReader(),
1744
- aborted = !1;
1745
- request.abortListeners.add(abortBlob);
1746
- reader.read().then(progress).catch(error);
1747
- return "$B" + newTask.id.toString(16);
1748
- }
1749
- function renderModel(request, task, parent, key, value) {
1750
- serializedSize += key.length;
1751
- var prevKeyPath = task.keyPath,
1752
- prevImplicitSlot = task.implicitSlot;
1753
- try {
1754
- return renderModelDestructive(request, task, parent, key, value);
1755
- } catch (thrownValue) {
1756
- parent = task.model;
1757
- parent =
1758
- "object" === typeof parent &&
1759
- null !== parent &&
1760
- (parent.$$typeof === REACT_ELEMENT_TYPE ||
1761
- parent.$$typeof === REACT_LAZY_TYPE);
1762
- if (request.status === ABORTING)
1763
- return (
1764
- (task.status = ABORTED),
1765
- (task = request.fatalError),
1766
- parent ? serializeLazyID(task) : serializeByValueID(task)
1767
- );
1768
- key =
1769
- thrownValue === SuspenseException
1770
- ? getSuspendedThenable()
1771
- : thrownValue;
1772
- if (
1773
- "object" === typeof key &&
1774
- null !== key &&
1775
- "function" === typeof key.then
1776
- )
1777
- return (
1778
- (request = createTask(
1779
- request,
1780
- task.model,
1781
- task.keyPath,
1782
- task.implicitSlot,
1783
- request.abortableTasks,
1784
- 0,
1785
- task.debugOwner,
1786
- task.debugStack,
1787
- task.debugTask
1788
- )),
1789
- (value = request.ping),
1790
- key.then(value, value),
1791
- (request.thenableState = getThenableStateAfterSuspending()),
1792
- (task.keyPath = prevKeyPath),
1793
- (task.implicitSlot = prevImplicitSlot),
1794
- parent
1795
- ? serializeLazyID(request.id)
1796
- : serializeByValueID(request.id)
1797
- );
1798
- task.keyPath = prevKeyPath;
1799
- task.implicitSlot = prevImplicitSlot;
1800
- request.pendingChunks++;
1801
- prevKeyPath = request.nextChunkId++;
1802
- task = logRecoverableError(request, key, task);
1803
- emitErrorChunk(request, prevKeyPath, task, key);
1804
- return parent
1805
- ? serializeLazyID(prevKeyPath)
1806
- : serializeByValueID(prevKeyPath);
1807
- }
1808
- }
1809
- function renderModelDestructive(
1810
- request,
1811
- task,
1812
- parent,
1813
- parentPropertyName,
1814
- value
1815
- ) {
1816
- task.model = value;
1817
- if (value === REACT_ELEMENT_TYPE) return "$";
1818
- if (null === value) return null;
1819
- if ("object" === typeof value) {
1820
- switch (value.$$typeof) {
1821
- case REACT_ELEMENT_TYPE:
1822
- var elementReference = null,
1823
- _writtenObjects = request.writtenObjects;
1824
- if (null === task.keyPath && !task.implicitSlot) {
1825
- var _existingReference = _writtenObjects.get(value);
1826
- if (void 0 !== _existingReference)
1827
- if (modelRoot === value) modelRoot = null;
1828
- else return _existingReference;
1829
- else
1830
- -1 === parentPropertyName.indexOf(":") &&
1831
- ((_existingReference = _writtenObjects.get(parent)),
1832
- void 0 !== _existingReference &&
1833
- ((elementReference =
1834
- _existingReference + ":" + parentPropertyName),
1835
- _writtenObjects.set(value, elementReference)));
1836
- }
1837
- if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
1838
- if ((_existingReference = value._debugInfo)) {
1839
- if (null === debugID) return outlineTask(request, task);
1840
- forwardDebugInfo(request, debugID, _existingReference);
1841
- }
1842
- _existingReference = value.props;
1843
- var refProp = _existingReference.ref;
1844
- task.debugOwner = value._owner;
1845
- task.debugStack = value._debugStack;
1846
- task.debugTask = value._debugTask;
1847
- request = renderElement(
1848
- request,
1849
- task,
1850
- value.type,
1851
- value.key,
1852
- void 0 !== refProp ? refProp : null,
1853
- _existingReference,
1854
- value._store.validated
1855
- );
1856
- "object" === typeof request &&
1857
- null !== request &&
1858
- null !== elementReference &&
1859
- (_writtenObjects.has(request) ||
1860
- _writtenObjects.set(request, elementReference));
1861
- return request;
1862
- case REACT_LAZY_TYPE:
1863
- if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
1864
- task.thenableState = null;
1865
- elementReference = callLazyInitInDEV(value);
1866
- if (request.status === ABORTING) throw null;
1867
- if ((_writtenObjects = value._debugInfo)) {
1868
- if (null === debugID) return outlineTask(request, task);
1869
- forwardDebugInfo(request, debugID, _writtenObjects);
1870
- }
1871
- return renderModelDestructive(
1872
- request,
1873
- task,
1874
- emptyRoot,
1875
- "",
1876
- elementReference
1877
- );
1878
- case REACT_LEGACY_ELEMENT_TYPE:
1879
- throw Error(
1880
- 'A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the "react" package is used.\n- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n- A compiler tries to "inline" JSX instead of using the runtime.'
1881
- );
1882
- }
1883
- if (isClientReference(value))
1884
- return serializeClientReference(
1885
- request,
1886
- parent,
1887
- parentPropertyName,
1888
- value
1889
- );
1890
- if (
1891
- void 0 !== request.temporaryReferences &&
1892
- ((elementReference = request.temporaryReferences.get(value)),
1893
- void 0 !== elementReference)
1894
- )
1895
- return "$T" + elementReference;
1896
- elementReference = request.writtenObjects;
1897
- _writtenObjects = elementReference.get(value);
1898
- if ("function" === typeof value.then) {
1899
- if (void 0 !== _writtenObjects) {
1900
- if (null !== task.keyPath || task.implicitSlot)
1901
- return (
1902
- "$@" + serializeThenable(request, task, value).toString(16)
1903
- );
1904
- if (modelRoot === value) modelRoot = null;
1905
- else return _writtenObjects;
1906
- }
1907
- request = "$@" + serializeThenable(request, task, value).toString(16);
1908
- elementReference.set(value, request);
1909
- return request;
1910
- }
1911
- if (void 0 !== _writtenObjects)
1912
- if (modelRoot === value) modelRoot = null;
1913
- else return _writtenObjects;
1914
- else if (
1915
- -1 === parentPropertyName.indexOf(":") &&
1916
- ((_writtenObjects = elementReference.get(parent)),
1917
- void 0 !== _writtenObjects)
1918
- ) {
1919
- _existingReference = parentPropertyName;
1920
- if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1921
- switch (parentPropertyName) {
1922
- case "1":
1923
- _existingReference = "type";
1924
- break;
1925
- case "2":
1926
- _existingReference = "key";
1927
- break;
1928
- case "3":
1929
- _existingReference = "props";
1930
- break;
1931
- case "4":
1932
- _existingReference = "_owner";
1933
- }
1934
- elementReference.set(
1935
- value,
1936
- _writtenObjects + ":" + _existingReference
1937
- );
1938
- }
1939
- if (isArrayImpl(value)) return renderFragment(request, task, value);
1940
- if (value instanceof Map) return serializeMap(request, value);
1941
- if (value instanceof Set) return serializeSet(request, value);
1942
- if ("function" === typeof FormData && value instanceof FormData)
1943
- return serializeFormData(request, value);
1944
- if (value instanceof Error) return serializeErrorValue(request, value);
1945
- if (value instanceof ArrayBuffer)
1946
- return serializeTypedArray(request, "A", new Uint8Array(value));
1947
- if (value instanceof Int8Array)
1948
- return serializeTypedArray(request, "O", value);
1949
- if (value instanceof Uint8Array)
1950
- return serializeTypedArray(request, "o", value);
1951
- if (value instanceof Uint8ClampedArray)
1952
- return serializeTypedArray(request, "U", value);
1953
- if (value instanceof Int16Array)
1954
- return serializeTypedArray(request, "S", value);
1955
- if (value instanceof Uint16Array)
1956
- return serializeTypedArray(request, "s", value);
1957
- if (value instanceof Int32Array)
1958
- return serializeTypedArray(request, "L", value);
1959
- if (value instanceof Uint32Array)
1960
- return serializeTypedArray(request, "l", value);
1961
- if (value instanceof Float32Array)
1962
- return serializeTypedArray(request, "G", value);
1963
- if (value instanceof Float64Array)
1964
- return serializeTypedArray(request, "g", value);
1965
- if (value instanceof BigInt64Array)
1966
- return serializeTypedArray(request, "M", value);
1967
- if (value instanceof BigUint64Array)
1968
- return serializeTypedArray(request, "m", value);
1969
- if (value instanceof DataView)
1970
- return serializeTypedArray(request, "V", value);
1971
- if ("function" === typeof Blob && value instanceof Blob)
1972
- return serializeBlob(request, value);
1973
- if ((elementReference = getIteratorFn(value)))
1974
- return (
1975
- (elementReference = elementReference.call(value)),
1976
- elementReference === value
1977
- ? "$i" +
1978
- outlineModel(request, Array.from(elementReference)).toString(16)
1979
- : renderFragment(request, task, Array.from(elementReference))
1980
- );
1981
- if (
1982
- "function" === typeof ReadableStream &&
1983
- value instanceof ReadableStream
1984
- )
1985
- return serializeReadableStream(request, task, value);
1986
- elementReference = value[ASYNC_ITERATOR];
1987
- if ("function" === typeof elementReference)
1988
- return renderAsyncFragment(request, task, value, elementReference);
1989
- if (value instanceof Date) return "$D" + value.toJSON();
1990
- elementReference = getPrototypeOf(value);
1991
- if (
1992
- elementReference !== ObjectPrototype &&
1993
- (null === elementReference ||
1994
- null !== getPrototypeOf(elementReference))
1995
- )
1996
- throw Error(
1997
- "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." +
1998
- describeObjectForErrorMessage(parent, parentPropertyName)
1999
- );
2000
- if ("Object" !== objectName(value))
2001
- callWithDebugContextInDEV(request, task, function () {
2002
- console.error(
2003
- "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
2004
- objectName(value),
2005
- describeObjectForErrorMessage(parent, parentPropertyName)
2006
- );
2007
- });
2008
- else if (!isSimpleObject(value))
2009
- callWithDebugContextInDEV(request, task, function () {
2010
- console.error(
2011
- "Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
2012
- describeObjectForErrorMessage(parent, parentPropertyName)
2013
- );
2014
- });
2015
- else if (Object.getOwnPropertySymbols) {
2016
- var symbols = Object.getOwnPropertySymbols(value);
2017
- 0 < symbols.length &&
2018
- callWithDebugContextInDEV(request, task, function () {
2019
- console.error(
2020
- "Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
2021
- symbols[0].description,
2022
- describeObjectForErrorMessage(parent, parentPropertyName)
2023
- );
2024
- });
2025
- }
2026
- return value;
2027
- }
2028
- if ("string" === typeof value)
2029
- return (
2030
- (serializedSize += value.length),
2031
- "Z" === value[value.length - 1] &&
2032
- parent[parentPropertyName] instanceof Date
2033
- ? "$D" + value
2034
- : 1024 <= value.length && null !== byteLengthOfChunk
2035
- ? serializeLargeTextString(request, value)
2036
- : "$" === value[0]
2037
- ? "$" + value
2038
- : value
2039
- );
2040
- if ("boolean" === typeof value) return value;
2041
- if ("number" === typeof value) return serializeNumber(value);
2042
- if ("undefined" === typeof value) return "$undefined";
2043
- if ("function" === typeof value) {
2044
- if (isClientReference(value))
2045
- return serializeClientReference(
2046
- request,
2047
- parent,
2048
- parentPropertyName,
2049
- value
2050
- );
2051
- if (value.$$typeof === SERVER_REFERENCE_TAG)
2052
- return serializeServerReference(request, value);
2053
- if (
2054
- void 0 !== request.temporaryReferences &&
2055
- ((request = request.temporaryReferences.get(value)),
2056
- void 0 !== request)
2057
- )
2058
- return "$T" + request;
2059
- if (value.$$typeof === TEMPORARY_REFERENCE_TAG)
2060
- throw Error(
2061
- "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
2062
- );
2063
- if (/^on[A-Z]/.test(parentPropertyName))
2064
- throw Error(
2065
- "Event handlers cannot be passed to Client Component props." +
2066
- describeObjectForErrorMessage(parent, parentPropertyName) +
2067
- "\nIf you need interactivity, consider converting part of this to a Client Component."
2068
- );
2069
- if (
2070
- jsxChildrenParents.has(parent) ||
2071
- (jsxPropsParents.has(parent) && "children" === parentPropertyName)
2072
- )
2073
- throw (
2074
- ((request = value.displayName || value.name || "Component"),
2075
- Error(
2076
- "Functions are not valid as a child of Client Components. This may happen if you return " +
2077
- request +
2078
- " instead of <" +
2079
- request +
2080
- " /> from render. Or maybe you meant to call this function rather than return it." +
2081
- describeObjectForErrorMessage(parent, parentPropertyName)
2082
- ))
2083
- );
2084
- throw Error(
2085
- 'Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.' +
2086
- describeObjectForErrorMessage(parent, parentPropertyName)
2087
- );
2088
- }
2089
- if ("symbol" === typeof value) {
2090
- task = request.writtenSymbols;
2091
- elementReference = task.get(value);
2092
- if (void 0 !== elementReference)
2093
- return serializeByValueID(elementReference);
2094
- elementReference = value.description;
2095
- if (Symbol.for(elementReference) !== value)
2096
- throw Error(
2097
- "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
2098
- (value.description + ") cannot be found among global symbols.") +
2099
- describeObjectForErrorMessage(parent, parentPropertyName)
2100
- );
2101
- request.pendingChunks++;
2102
- _writtenObjects = request.nextChunkId++;
2103
- emitSymbolChunk(request, _writtenObjects, elementReference);
2104
- task.set(value, _writtenObjects);
2105
- return serializeByValueID(_writtenObjects);
2106
- }
2107
- if ("bigint" === typeof value) return "$n" + value.toString(10);
2108
- throw Error(
2109
- "Type " +
2110
- typeof value +
2111
- " is not supported in Client Component props." +
2112
- describeObjectForErrorMessage(parent, parentPropertyName)
2113
- );
2114
- }
2115
- function logRecoverableError(request, error, task) {
2116
- var prevRequest = currentRequest;
2117
- currentRequest = null;
2118
- try {
2119
- var onError = request.onError;
2120
- var errorDigest =
2121
- null !== task
2122
- ? requestStorage.run(
2123
- void 0,
2124
- callWithDebugContextInDEV,
2125
- request,
2126
- task,
2127
- onError,
2128
- error
2129
- )
2130
- : requestStorage.run(void 0, onError, error);
2131
- } finally {
2132
- currentRequest = prevRequest;
2133
- }
2134
- if (null != errorDigest && "string" !== typeof errorDigest)
2135
- throw Error(
2136
- 'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' +
2137
- typeof errorDigest +
2138
- '" instead'
2139
- );
2140
- return errorDigest || "";
2141
- }
2142
- function fatalError(request, error) {
2143
- var onFatalError = request.onFatalError;
2144
- onFatalError(error);
2145
- null !== request.destination
2146
- ? ((request.status = CLOSED),
2147
- closeWithError(request.destination, error))
2148
- : ((request.status = CLOSING), (request.fatalError = error));
2149
- }
2150
- function serializeErrorValue(request, error) {
2151
- var name = "Error",
2152
- env = (0, request.environmentName)();
2153
- try {
2154
- name = error.name;
2155
- var message = String(error.message);
2156
- var stack = filterStackTrace(request, parseStackTrace(error, 0));
2157
- var errorEnv = error.environmentName;
2158
- "string" === typeof errorEnv && (env = errorEnv);
2159
- } catch (x) {
2160
- (message =
2161
- "An error occurred but serializing the error message failed."),
2162
- (stack = []);
2163
- }
2164
- return (
2165
- "$Z" +
2166
- outlineModel(request, {
2167
- name: name,
2168
- message: message,
2169
- stack: stack,
2170
- env: env
2171
- }).toString(16)
2172
- );
2173
- }
2174
- function emitErrorChunk(request, id, digest, error) {
2175
- var name = "Error",
2176
- env = (0, request.environmentName)();
2177
- try {
2178
- if (error instanceof Error) {
2179
- name = error.name;
2180
- var message = String(error.message);
2181
- var stack = filterStackTrace(request, parseStackTrace(error, 0));
2182
- var errorEnv = error.environmentName;
2183
- "string" === typeof errorEnv && (env = errorEnv);
2184
- } else
2185
- (message =
2186
- "object" === typeof error && null !== error
2187
- ? describeObjectForErrorMessage(error)
2188
- : String(error)),
2189
- (stack = []);
2190
- } catch (x) {
2191
- (message =
2192
- "An error occurred but serializing the error message failed."),
2193
- (stack = []);
2194
- }
2195
- digest = {
2196
- digest: digest,
2197
- name: name,
2198
- message: message,
2199
- stack: stack,
2200
- env: env
2201
- };
2202
- id = id.toString(16) + ":E" + stringify(digest) + "\n";
2203
- id = stringToChunk(id);
2204
- request.completedErrorChunks.push(id);
2205
- }
2206
- function emitSymbolChunk(request, id, name) {
2207
- id = encodeReferenceChunk(request, id, "$S" + name);
2208
- request.completedImportChunks.push(id);
2209
- }
2210
- function emitModelChunk(request, id, json) {
2211
- id = id.toString(16) + ":" + json + "\n";
2212
- id = stringToChunk(id);
2213
- request.completedRegularChunks.push(id);
2214
- }
2215
- function emitDebugChunk(request, id, debugInfo) {
2216
- var counter = { objectLimit: 500 };
2217
- debugInfo = stringify(debugInfo, function (parentPropertyName, value) {
2218
- return renderConsoleValue(
2219
- request,
2220
- counter,
2221
- this,
2222
- parentPropertyName,
2223
- value
2224
- );
2225
- });
2226
- id = id.toString(16) + ":D" + debugInfo + "\n";
2227
- id = stringToChunk(id);
2228
- request.completedRegularChunks.push(id);
2229
- }
2230
- function outlineComponentInfo(request, componentInfo) {
2231
- if (!request.writtenObjects.has(componentInfo)) {
2232
- null != componentInfo.owner &&
2233
- outlineComponentInfo(request, componentInfo.owner);
2234
- var objectLimit = 10;
2235
- null != componentInfo.stack &&
2236
- (objectLimit += componentInfo.stack.length);
2237
- objectLimit = { objectLimit: objectLimit };
2238
- var componentDebugInfo = {
2239
- name: componentInfo.name,
2240
- env: componentInfo.env,
2241
- key: componentInfo.key,
2242
- owner: componentInfo.owner
2243
- };
2244
- componentDebugInfo.stack = componentInfo.stack;
2245
- componentDebugInfo.props = componentInfo.props;
2246
- objectLimit = outlineConsoleValue(
2247
- request,
2248
- objectLimit,
2249
- componentDebugInfo
2250
- );
2251
- request.writtenObjects.set(
2252
- componentInfo,
2253
- serializeByValueID(objectLimit)
2254
- );
2255
- }
2256
- }
2257
- function emitIOInfoChunk(request, id, name, start, end, env, owner, stack) {
2258
- var objectLimit = 10;
2259
- stack && (objectLimit += stack.length);
2260
- var counter = { objectLimit: objectLimit };
2261
- name = {
2262
- name: name,
2263
- start: start - request.timeOrigin,
2264
- end: end - request.timeOrigin
2265
- };
2266
- null != env && (name.env = env);
2267
- null != stack && (name.stack = stack);
2268
- null != owner && (name.owner = owner);
2269
- env = stringify(name, function (parentPropertyName, value) {
2270
- return renderConsoleValue(
2271
- request,
2272
- counter,
2273
- this,
2274
- parentPropertyName,
2275
- value
2276
- );
2277
- });
2278
- id = id.toString(16) + ":J" + env + "\n";
2279
- id = stringToChunk(id);
2280
- request.completedRegularChunks.push(id);
2281
- }
2282
- function emitTypedArrayChunk(request, id, tag, typedArray) {
2283
- request.pendingChunks++;
2284
- var buffer = new Uint8Array(
2285
- typedArray.buffer,
2286
- typedArray.byteOffset,
2287
- typedArray.byteLength
2288
- );
2289
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2290
- buffer = typedArray.byteLength;
2291
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2292
- id = stringToChunk(id);
2293
- request.completedRegularChunks.push(id, typedArray);
2294
- }
2295
- function emitTextChunk(request, id, text) {
2296
- if (null === byteLengthOfChunk)
2297
- throw Error(
2298
- "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
2299
- );
2300
- request.pendingChunks++;
2301
- text = stringToChunk(text);
2302
- var binaryLength = text.byteLength;
2303
- id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
2304
- id = stringToChunk(id);
2305
- request.completedRegularChunks.push(id, text);
2306
- }
2307
- function renderConsoleValue(
2308
- request,
2309
- counter,
2310
- parent,
2311
- parentPropertyName,
2312
- value
2313
- ) {
2314
- if (null === value) return null;
2315
- if (value === REACT_ELEMENT_TYPE) return "$";
2316
- if ("object" === typeof value) {
2317
- if (isClientReference(value))
2318
- return serializeClientReference(
2319
- request,
2320
- parent,
2321
- parentPropertyName,
2322
- value
2323
- );
2324
- if (
2325
- void 0 !== request.temporaryReferences &&
2326
- ((parent = request.temporaryReferences.get(value)), void 0 !== parent)
2327
- )
2328
- return "$T" + parent;
2329
- parent = request.writtenObjects.get(value);
2330
- if (void 0 !== parent) return parent;
2331
- if (0 >= counter.objectLimit && !doNotLimit.has(value)) return "$Y";
2332
- counter.objectLimit--;
2333
- switch (value.$$typeof) {
2334
- case REACT_ELEMENT_TYPE:
2335
- null != value._owner && outlineComponentInfo(request, value._owner);
2336
- "object" === typeof value.type &&
2337
- null !== value.type &&
2338
- doNotLimit.add(value.type);
2339
- "object" === typeof value.key &&
2340
- null !== value.key &&
2341
- doNotLimit.add(value.key);
2342
- doNotLimit.add(value.props);
2343
- null !== value._owner && doNotLimit.add(value._owner);
2344
- counter = null;
2345
- if (null != value._debugStack)
2346
- for (
2347
- counter = filterStackTrace(
2348
- request,
2349
- parseStackTrace(value._debugStack, 1)
2350
- ),
2351
- doNotLimit.add(counter),
2352
- request = 0;
2353
- request < counter.length;
2354
- request++
2355
- )
2356
- doNotLimit.add(counter[request]);
2357
- return [
2358
- REACT_ELEMENT_TYPE,
2359
- value.type,
2360
- value.key,
2361
- value.props,
2362
- value._owner,
2363
- counter,
2364
- value._store.validated
2365
- ];
2366
- }
2367
- if ("function" === typeof value.then) {
2368
- switch (value.status) {
2369
- case "fulfilled":
2370
- return (
2371
- "$@" +
2372
- outlineConsoleValue(request, counter, value.value).toString(16)
2373
- );
2374
- case "rejected":
2375
- return (
2376
- (counter = value.reason),
2377
- request.pendingChunks++,
2378
- (value = request.nextChunkId++),
2379
- emitErrorChunk(request, value, "", counter),
2380
- "$@" + value.toString(16)
2381
- );
2382
- }
2383
- return "$@";
2384
- }
2385
- if (isArrayImpl(value)) return value;
2386
- if (value instanceof Map) {
2387
- value = Array.from(value);
2388
- counter.objectLimit++;
2389
- for (parent = 0; parent < value.length; parent++) {
2390
- var entry = value[parent];
2391
- doNotLimit.add(entry);
2392
- parentPropertyName = entry[0];
2393
- entry = entry[1];
2394
- "object" === typeof parentPropertyName &&
2395
- null !== parentPropertyName &&
2396
- doNotLimit.add(parentPropertyName);
2397
- "object" === typeof entry &&
2398
- null !== entry &&
2399
- doNotLimit.add(entry);
2400
- }
2401
- return (
2402
- "$Q" + outlineConsoleValue(request, counter, value).toString(16)
2403
- );
2404
- }
2405
- if (value instanceof Set) {
2406
- value = Array.from(value);
2407
- counter.objectLimit++;
2408
- for (parent = 0; parent < value.length; parent++)
2409
- (parentPropertyName = value[parent]),
2410
- "object" === typeof parentPropertyName &&
2411
- null !== parentPropertyName &&
2412
- doNotLimit.add(parentPropertyName);
2413
- return (
2414
- "$W" + outlineConsoleValue(request, counter, value).toString(16)
2415
- );
2416
- }
2417
- return "function" === typeof FormData && value instanceof FormData
2418
- ? serializeFormData(request, value)
2419
- : value instanceof Error
2420
- ? serializeErrorValue(request, value)
2421
- : value instanceof ArrayBuffer
2422
- ? serializeTypedArray(request, "A", new Uint8Array(value))
2423
- : value instanceof Int8Array
2424
- ? serializeTypedArray(request, "O", value)
2425
- : value instanceof Uint8Array
2426
- ? serializeTypedArray(request, "o", value)
2427
- : value instanceof Uint8ClampedArray
2428
- ? serializeTypedArray(request, "U", value)
2429
- : value instanceof Int16Array
2430
- ? serializeTypedArray(request, "S", value)
2431
- : value instanceof Uint16Array
2432
- ? serializeTypedArray(request, "s", value)
2433
- : value instanceof Int32Array
2434
- ? serializeTypedArray(request, "L", value)
2435
- : value instanceof Uint32Array
2436
- ? serializeTypedArray(request, "l", value)
2437
- : value instanceof Float32Array
2438
- ? serializeTypedArray(request, "G", value)
2439
- : value instanceof Float64Array
2440
- ? serializeTypedArray(request, "g", value)
2441
- : value instanceof BigInt64Array
2442
- ? serializeTypedArray(request, "M", value)
2443
- : value instanceof BigUint64Array
2444
- ? serializeTypedArray(request, "m", value)
2445
- : value instanceof DataView
2446
- ? serializeTypedArray(request, "V", value)
2447
- : "function" === typeof Blob &&
2448
- value instanceof Blob
2449
- ? serializeBlob(request, value)
2450
- : getIteratorFn(value)
2451
- ? Array.from(value)
2452
- : value;
2453
- }
2454
- if ("string" === typeof value)
2455
- return "Z" === value[value.length - 1] &&
2456
- parent[parentPropertyName] instanceof Date
2457
- ? "$D" + value
2458
- : 1024 <= value.length
2459
- ? serializeLargeTextString(request, value)
2460
- : "$" === value[0]
2461
- ? "$" + value
2462
- : value;
2463
- if ("boolean" === typeof value) return value;
2464
- if ("number" === typeof value) return serializeNumber(value);
2465
- if ("undefined" === typeof value) return "$undefined";
2466
- if ("function" === typeof value)
2467
- return isClientReference(value)
2468
- ? serializeClientReference(request, parent, parentPropertyName, value)
2469
- : void 0 !== request.temporaryReferences &&
2470
- ((request = request.temporaryReferences.get(value)),
2471
- void 0 !== request)
2472
- ? "$T" + request
2473
- : "$E(" + (Function.prototype.toString.call(value) + ")");
2474
- if ("symbol" === typeof value) {
2475
- counter = request.writtenSymbols.get(value);
2476
- if (void 0 !== counter) return serializeByValueID(counter);
2477
- counter = value.description;
2478
- request.pendingChunks++;
2479
- value = request.nextChunkId++;
2480
- emitSymbolChunk(request, value, counter);
2481
- return serializeByValueID(value);
2482
- }
2483
- return "bigint" === typeof value
2484
- ? "$n" + value.toString(10)
2485
- : value instanceof Date
2486
- ? "$D" + value.toJSON()
2487
- : "unknown type " + typeof value;
2488
- }
2489
- function outlineConsoleValue(request, counter, model) {
2490
- function replacer(parentPropertyName, value) {
2491
- try {
2492
- return renderConsoleValue(
2493
- request,
2494
- counter,
2495
- this,
2496
- parentPropertyName,
2497
- value
2498
- );
2499
- } catch (x) {
2500
- return (
2501
- "Unknown Value: React could not send it from the server.\n" +
2502
- x.message
2503
- );
2504
- }
2505
- }
2506
- "object" === typeof model && null !== model && doNotLimit.add(model);
2507
- try {
2508
- var json = stringify(model, replacer);
2509
- } catch (x) {
2510
- json = stringify(
2511
- "Unknown Value: React could not send it from the server.\n" +
2512
- x.message
2513
- );
2514
- }
2515
- request.pendingChunks++;
2516
- model = request.nextChunkId++;
2517
- json = model.toString(16) + ":" + json + "\n";
2518
- json = stringToChunk(json);
2519
- request.completedRegularChunks.push(json);
2520
- return model;
2521
- }
2522
- function emitConsoleChunk(request, methodName, owner, stackTrace, args) {
2523
- function replacer(parentPropertyName, value) {
2524
- try {
2525
- return renderConsoleValue(
2526
- request,
2527
- counter,
2528
- this,
2529
- parentPropertyName,
2530
- value
2531
- );
2532
- } catch (x) {
2533
- return (
2534
- "Unknown Value: React could not send it from the server.\n" +
2535
- x.message
2536
- );
2537
- }
2538
- }
2539
- var counter = { objectLimit: 500 };
2540
- null != owner && outlineComponentInfo(request, owner);
2541
- var env = (0, request.environmentName)(),
2542
- payload = [methodName, stackTrace, owner, env];
2543
- payload.push.apply(payload, args);
2544
- try {
2545
- var json = stringify(payload, replacer);
2546
- } catch (x) {
2547
- json = stringify(
2548
- [
2549
- methodName,
2550
- stackTrace,
2551
- owner,
2552
- env,
2553
- "Unknown Value: React could not send it from the server.",
2554
- x
2555
- ],
2556
- replacer
2557
- );
2558
- }
2559
- methodName = stringToChunk(":W" + json + "\n");
2560
- request.completedRegularChunks.push(methodName);
2561
- }
2562
- function forwardDebugInfo(request$jscomp$0, id$jscomp$0, debugInfo) {
2563
- for (var i = 0; i < debugInfo.length; i++)
2564
- if ("number" !== typeof debugInfo[i].time)
2565
- if (
2566
- (request$jscomp$0.pendingChunks++,
2567
- "string" === typeof debugInfo[i].name)
2568
- )
2569
- outlineComponentInfo(request$jscomp$0, debugInfo[i]),
2570
- emitDebugChunk(request$jscomp$0, id$jscomp$0, debugInfo[i]);
2571
- else if (debugInfo[i].awaited) {
2572
- var ioInfo = debugInfo[i].awaited;
2573
- var request = request$jscomp$0,
2574
- ioInfo$jscomp$0 = ioInfo;
2575
- if (!request.writtenObjects.has(ioInfo$jscomp$0)) {
2576
- request.pendingChunks++;
2577
- var id = request.nextChunkId++,
2578
- owner = ioInfo$jscomp$0.owner;
2579
- null != owner && outlineComponentInfo(request, owner);
2580
- emitIOInfoChunk(
2581
- request,
2582
- id,
2583
- ioInfo$jscomp$0.name,
2584
- ioInfo$jscomp$0.start,
2585
- ioInfo$jscomp$0.end,
2586
- ioInfo$jscomp$0.env,
2587
- owner,
2588
- ioInfo$jscomp$0.stack
2589
- );
2590
- request.writtenObjects.set(
2591
- ioInfo$jscomp$0,
2592
- serializeByValueID(id)
2593
- );
2594
- }
2595
- emitDebugChunk(request$jscomp$0, id$jscomp$0, {
2596
- awaited: ioInfo,
2597
- env: debugInfo[i].env,
2598
- owner: debugInfo[i].owner,
2599
- stack: debugInfo[i].stack
2600
- });
2601
- } else emitDebugChunk(request$jscomp$0, id$jscomp$0, debugInfo[i]);
2602
- }
2603
- function emitChunk(request, task, value) {
2604
- var id = task.id;
2605
- "string" === typeof value && null !== byteLengthOfChunk
2606
- ? emitTextChunk(request, id, value)
2607
- : value instanceof ArrayBuffer
2608
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
2609
- : value instanceof Int8Array
2610
- ? emitTypedArrayChunk(request, id, "O", value)
2611
- : value instanceof Uint8Array
2612
- ? emitTypedArrayChunk(request, id, "o", value)
2613
- : value instanceof Uint8ClampedArray
2614
- ? emitTypedArrayChunk(request, id, "U", value)
2615
- : value instanceof Int16Array
2616
- ? emitTypedArrayChunk(request, id, "S", value)
2617
- : value instanceof Uint16Array
2618
- ? emitTypedArrayChunk(request, id, "s", value)
2619
- : value instanceof Int32Array
2620
- ? emitTypedArrayChunk(request, id, "L", value)
2621
- : value instanceof Uint32Array
2622
- ? emitTypedArrayChunk(request, id, "l", value)
2623
- : value instanceof Float32Array
2624
- ? emitTypedArrayChunk(request, id, "G", value)
2625
- : value instanceof Float64Array
2626
- ? emitTypedArrayChunk(request, id, "g", value)
2627
- : value instanceof BigInt64Array
2628
- ? emitTypedArrayChunk(request, id, "M", value)
2629
- : value instanceof BigUint64Array
2630
- ? emitTypedArrayChunk(request, id, "m", value)
2631
- : value instanceof DataView
2632
- ? emitTypedArrayChunk(request, id, "V", value)
2633
- : ((value = stringify(value, task.toJSON)),
2634
- emitModelChunk(request, task.id, value));
2635
- }
2636
- function erroredTask(request, task, error) {
2637
- task.status = ERRORED$1;
2638
- var digest = logRecoverableError(request, error, task);
2639
- emitErrorChunk(request, task.id, digest, error);
2640
- request.abortableTasks.delete(task);
2641
- callOnAllReadyIfReady(request);
2642
- }
2643
- function retryTask(request, task) {
2644
- if (task.status === PENDING$1) {
2645
- var prevDebugID = debugID;
2646
- task.status = RENDERING;
2647
- var parentSerializedSize = serializedSize;
2648
- try {
2649
- modelRoot = task.model;
2650
- debugID = task.id;
2651
- var resolvedModel = renderModelDestructive(
2652
- request,
2653
- task,
2654
- emptyRoot,
2655
- "",
2656
- task.model
2657
- );
2658
- debugID = null;
2659
- modelRoot = resolvedModel;
2660
- task.keyPath = null;
2661
- task.implicitSlot = !1;
2662
- var currentEnv = (0, request.environmentName)();
2663
- currentEnv !== task.environmentName &&
2664
- (request.pendingChunks++,
2665
- emitDebugChunk(request, task.id, { env: currentEnv }));
2666
- if ("object" === typeof resolvedModel && null !== resolvedModel)
2667
- request.writtenObjects.set(
2668
- resolvedModel,
2669
- serializeByValueID(task.id)
2670
- ),
2671
- emitChunk(request, task, resolvedModel);
2672
- else {
2673
- var json = stringify(resolvedModel);
2674
- emitModelChunk(request, task.id, json);
2675
- }
2676
- task.status = COMPLETED;
2677
- request.abortableTasks.delete(task);
2678
- callOnAllReadyIfReady(request);
2679
- } catch (thrownValue) {
2680
- if (request.status === ABORTING) {
2681
- request.abortableTasks.delete(task);
2682
- task.status = ABORTED;
2683
- var model = stringify(serializeByValueID(request.fatalError));
2684
- emitModelChunk(request, task.id, model);
2685
- } else {
2686
- var x =
2687
- thrownValue === SuspenseException
2688
- ? getSuspendedThenable()
2689
- : thrownValue;
2690
- if (
2691
- "object" === typeof x &&
2692
- null !== x &&
2693
- "function" === typeof x.then
2694
- ) {
2695
- task.status = PENDING$1;
2696
- task.thenableState = getThenableStateAfterSuspending();
2697
- var ping = task.ping;
2698
- x.then(ping, ping);
2699
- } else erroredTask(request, task, x);
2700
- }
2701
- } finally {
2702
- (debugID = prevDebugID), (serializedSize = parentSerializedSize);
2703
- }
2704
- }
2705
- }
2706
- function tryStreamTask(request, task) {
2707
- var prevDebugID = debugID;
2708
- debugID = null;
2709
- var parentSerializedSize = serializedSize;
2710
- try {
2711
- emitChunk(request, task, task.model);
2712
- } finally {
2713
- (serializedSize = parentSerializedSize), (debugID = prevDebugID);
2714
- }
2715
- }
2716
- function performWork(request) {
2717
- var prevDispatcher = ReactSharedInternalsServer.H;
2718
- ReactSharedInternalsServer.H = HooksDispatcher;
2719
- var prevRequest = currentRequest;
2720
- currentRequest$1 = currentRequest = request;
2721
- try {
2722
- var pingedTasks = request.pingedTasks;
2723
- request.pingedTasks = [];
2724
- for (var i = 0; i < pingedTasks.length; i++)
2725
- retryTask(request, pingedTasks[i]);
2726
- null !== request.destination &&
2727
- flushCompletedChunks(request, request.destination);
2728
- } catch (error) {
2729
- logRecoverableError(request, error, null), fatalError(request, error);
2730
- } finally {
2731
- (ReactSharedInternalsServer.H = prevDispatcher),
2732
- (currentRequest$1 = null),
2733
- (currentRequest = prevRequest);
2734
- }
2735
- }
2736
- function flushCompletedChunks(request, destination) {
2737
- currentView = new Uint8Array(2048);
2738
- writtenBytes = 0;
2739
- try {
2740
- for (
2741
- var importsChunks = request.completedImportChunks, i = 0;
2742
- i < importsChunks.length;
2743
- i++
2744
- )
2745
- if (
2746
- (request.pendingChunks--,
2747
- !writeChunkAndReturn(destination, importsChunks[i]))
2748
- ) {
2749
- request.destination = null;
2750
- i++;
2751
- break;
2752
- }
2753
- importsChunks.splice(0, i);
2754
- var hintChunks = request.completedHintChunks;
2755
- for (i = 0; i < hintChunks.length; i++)
2756
- if (!writeChunkAndReturn(destination, hintChunks[i])) {
2757
- request.destination = null;
2758
- i++;
2759
- break;
2760
- }
2761
- hintChunks.splice(0, i);
2762
- var regularChunks = request.completedRegularChunks;
2763
- for (i = 0; i < regularChunks.length; i++)
2764
- if (
2765
- (request.pendingChunks--,
2766
- !writeChunkAndReturn(destination, regularChunks[i]))
2767
- ) {
2768
- request.destination = null;
2769
- i++;
2770
- break;
2771
- }
2772
- regularChunks.splice(0, i);
2773
- var errorChunks = request.completedErrorChunks;
2774
- for (i = 0; i < errorChunks.length; i++)
2775
- if (
2776
- (request.pendingChunks--,
2777
- !writeChunkAndReturn(destination, errorChunks[i]))
2778
- ) {
2779
- request.destination = null;
2780
- i++;
2781
- break;
2782
- }
2783
- errorChunks.splice(0, i);
2784
- } finally {
2785
- (request.flushScheduled = !1),
2786
- currentView &&
2787
- 0 < writtenBytes &&
2788
- (destination.enqueue(
2789
- new Uint8Array(currentView.buffer, 0, writtenBytes)
2790
- ),
2791
- (currentView = null),
2792
- (writtenBytes = 0));
2793
- }
2794
- 0 === request.pendingChunks &&
2795
- ((request.status = CLOSED),
2796
- destination.close(),
2797
- (request.destination = null));
2798
- }
2799
- function startWork(request) {
2800
- request.flushScheduled = null !== request.destination;
2801
- scheduleMicrotask(function () {
2802
- requestStorage.run(request, performWork, request);
2803
- });
2804
- setImmediate(function () {
2805
- request.status === OPENING && (request.status = 11);
2806
- });
2807
- }
2808
- function enqueueFlush(request) {
2809
- !1 === request.flushScheduled &&
2810
- 0 === request.pingedTasks.length &&
2811
- null !== request.destination &&
2812
- ((request.flushScheduled = !0),
2813
- setImmediate(function () {
2814
- request.flushScheduled = !1;
2815
- var destination = request.destination;
2816
- destination && flushCompletedChunks(request, destination);
2817
- }));
2818
- }
2819
- function callOnAllReadyIfReady(request) {
2820
- if (
2821
- 0 === request.abortableTasks.size &&
2822
- 0 === request.abortListeners.size
2823
- )
2824
- request.onAllReady();
2825
- }
2826
- function startFlowing(request, destination) {
2827
- if (request.status === CLOSING)
2828
- (request.status = CLOSED),
2829
- closeWithError(destination, request.fatalError);
2830
- else if (request.status !== CLOSED && null === request.destination) {
2831
- request.destination = destination;
2832
- try {
2833
- flushCompletedChunks(request, destination);
2834
- } catch (error) {
2835
- logRecoverableError(request, error, null), fatalError(request, error);
2836
- }
2837
- }
2838
- }
2839
- function abort(request, reason) {
2840
- try {
2841
- 11 >= request.status && (request.status = ABORTING);
2842
- var abortableTasks = request.abortableTasks;
2843
- if (0 < abortableTasks.size) {
2844
- var error =
2845
- void 0 === reason
2846
- ? Error(
2847
- "The render was aborted by the server without a reason."
2848
- )
2849
- : "object" === typeof reason &&
2850
- null !== reason &&
2851
- "function" === typeof reason.then
2852
- ? Error(
2853
- "The render was aborted by the server with a promise."
2854
- )
2855
- : reason,
2856
- digest = logRecoverableError(request, error, null),
2857
- _errorId2 = request.nextChunkId++;
2858
- request.fatalError = _errorId2;
2859
- request.pendingChunks++;
2860
- emitErrorChunk(request, _errorId2, digest, error);
2861
- abortableTasks.forEach(function (task) {
2862
- if (task.status !== RENDERING) {
2863
- task.status = ABORTED;
2864
- var ref = serializeByValueID(_errorId2);
2865
- task = encodeReferenceChunk(request, task.id, ref);
2866
- request.completedErrorChunks.push(task);
2867
- }
2868
- });
2869
- abortableTasks.clear();
2870
- callOnAllReadyIfReady(request);
2871
- }
2872
- var abortListeners = request.abortListeners;
2873
- if (0 < abortListeners.size) {
2874
- var _error =
2875
- void 0 === reason
2876
- ? Error("The render was aborted by the server without a reason.")
2877
- : "object" === typeof reason &&
2878
- null !== reason &&
2879
- "function" === typeof reason.then
2880
- ? Error("The render was aborted by the server with a promise.")
2881
- : reason;
2882
- abortListeners.forEach(function (callback) {
2883
- return callback(_error);
2884
- });
2885
- abortListeners.clear();
2886
- callOnAllReadyIfReady(request);
2887
- }
2888
- null !== request.destination &&
2889
- flushCompletedChunks(request, request.destination);
2890
- } catch (error$2) {
2891
- logRecoverableError(request, error$2, null),
2892
- fatalError(request, error$2);
2893
- }
2894
- }
2895
- function resolveServerReference(bundlerConfig, id) {
2896
- var name = "",
2897
- resolvedModuleData = bundlerConfig[id];
2898
- if (resolvedModuleData) name = resolvedModuleData.name;
2899
- else {
2900
- var idx = id.lastIndexOf("#");
2901
- -1 !== idx &&
2902
- ((name = id.slice(idx + 1)),
2903
- (resolvedModuleData = bundlerConfig[id.slice(0, idx)]));
2904
- if (!resolvedModuleData)
2905
- throw Error(
2906
- 'Could not find the module "' +
2907
- id +
2908
- '" in the React Server Manifest. This is probably a bug in the React Server Components bundler.'
2909
- );
2910
- }
2911
- return resolvedModuleData.async
2912
- ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
2913
- : [resolvedModuleData.id, resolvedModuleData.chunks, name];
2914
- }
2915
- function requireAsyncModule(id) {
2916
- var promise = __webpack_require__(id);
2917
- if ("function" !== typeof promise.then || "fulfilled" === promise.status)
2918
- return null;
2919
- promise.then(
2920
- function (value) {
2921
- promise.status = "fulfilled";
2922
- promise.value = value;
2923
- },
2924
- function (reason) {
2925
- promise.status = "rejected";
2926
- promise.reason = reason;
2927
- }
2928
- );
2929
- return promise;
2930
- }
2931
- function ignoreReject() {}
2932
- function preloadModule(metadata) {
2933
- for (
2934
- var chunks = metadata[1], promises = [], i = 0;
2935
- i < chunks.length;
2936
-
2937
- ) {
2938
- var chunkId = chunks[i++];
2939
- chunks[i++];
2940
- var entry = chunkCache.get(chunkId);
2941
- if (void 0 === entry) {
2942
- entry = __webpack_chunk_load__(chunkId);
2943
- promises.push(entry);
2944
- var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
2945
- entry.then(resolve, ignoreReject);
2946
- chunkCache.set(chunkId, entry);
2947
- } else null !== entry && promises.push(entry);
2948
- }
2949
- return 4 === metadata.length
2950
- ? 0 === promises.length
2951
- ? requireAsyncModule(metadata[0])
2952
- : Promise.all(promises).then(function () {
2953
- return requireAsyncModule(metadata[0]);
2954
- })
2955
- : 0 < promises.length
2956
- ? Promise.all(promises)
2957
- : null;
2958
- }
2959
- function requireModule(metadata) {
2960
- var moduleExports = __webpack_require__(metadata[0]);
2961
- if (4 === metadata.length && "function" === typeof moduleExports.then)
2962
- if ("fulfilled" === moduleExports.status)
2963
- moduleExports = moduleExports.value;
2964
- else throw moduleExports.reason;
2965
- return "*" === metadata[2]
2966
- ? moduleExports
2967
- : "" === metadata[2]
2968
- ? moduleExports.__esModule
2969
- ? moduleExports.default
2970
- : moduleExports
2971
- : moduleExports[metadata[2]];
2972
- }
2973
- function Chunk(status, value, reason, response) {
2974
- this.status = status;
2975
- this.value = value;
2976
- this.reason = reason;
2977
- this._response = response;
2978
- }
2979
- function createPendingChunk(response) {
2980
- return new Chunk("pending", null, null, response);
2981
- }
2982
- function wakeChunk(listeners, value) {
2983
- for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
2984
- }
2985
- function triggerErrorOnChunk(chunk, error) {
2986
- if ("pending" !== chunk.status && "blocked" !== chunk.status)
2987
- chunk.reason.error(error);
2988
- else {
2989
- var listeners = chunk.reason;
2990
- chunk.status = "rejected";
2991
- chunk.reason = error;
2992
- null !== listeners && wakeChunk(listeners, error);
2993
- }
2994
- }
2995
- function resolveModelChunk(chunk, value, id) {
2996
- if ("pending" !== chunk.status)
2997
- (chunk = chunk.reason),
2998
- "C" === value[0]
2999
- ? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
3000
- : chunk.enqueueModel(value);
3001
- else {
3002
- var resolveListeners = chunk.value,
3003
- rejectListeners = chunk.reason;
3004
- chunk.status = "resolved_model";
3005
- chunk.value = value;
3006
- chunk.reason = id;
3007
- if (null !== resolveListeners)
3008
- switch ((initializeModelChunk(chunk), chunk.status)) {
3009
- case "fulfilled":
3010
- wakeChunk(resolveListeners, chunk.value);
3011
- break;
3012
- case "pending":
3013
- case "blocked":
3014
- case "cyclic":
3015
- if (chunk.value)
3016
- for (value = 0; value < resolveListeners.length; value++)
3017
- chunk.value.push(resolveListeners[value]);
3018
- else chunk.value = resolveListeners;
3019
- if (chunk.reason) {
3020
- if (rejectListeners)
3021
- for (value = 0; value < rejectListeners.length; value++)
3022
- chunk.reason.push(rejectListeners[value]);
3023
- } else chunk.reason = rejectListeners;
3024
- break;
3025
- case "rejected":
3026
- rejectListeners && wakeChunk(rejectListeners, chunk.reason);
3027
- }
3028
- }
3029
- }
3030
- function createResolvedIteratorResultChunk(response, value, done) {
3031
- return new Chunk(
3032
- "resolved_model",
3033
- (done ? '{"done":true,"value":' : '{"done":false,"value":') +
3034
- value +
3035
- "}",
3036
- -1,
3037
- response
3038
- );
3039
- }
3040
- function resolveIteratorResultChunk(chunk, value, done) {
3041
- resolveModelChunk(
3042
- chunk,
3043
- (done ? '{"done":true,"value":' : '{"done":false,"value":') +
3044
- value +
3045
- "}",
3046
- -1
3047
- );
3048
- }
3049
- function loadServerReference$1(
3050
- response,
3051
- id,
3052
- bound,
3053
- parentChunk,
3054
- parentObject,
3055
- key
3056
- ) {
3057
- var serverReference = resolveServerReference(response._bundlerConfig, id);
3058
- id = preloadModule(serverReference);
3059
- if (bound)
3060
- bound = Promise.all([bound, id]).then(function (_ref) {
3061
- _ref = _ref[0];
3062
- var fn = requireModule(serverReference);
3063
- return fn.bind.apply(fn, [null].concat(_ref));
3064
- });
3065
- else if (id)
3066
- bound = Promise.resolve(id).then(function () {
3067
- return requireModule(serverReference);
3068
- });
3069
- else return requireModule(serverReference);
3070
- bound.then(
3071
- createModelResolver(
3072
- parentChunk,
3073
- parentObject,
3074
- key,
3075
- !1,
3076
- response,
3077
- createModel,
3078
- []
3079
- ),
3080
- createModelReject(parentChunk)
3081
- );
3082
- return null;
3083
- }
3084
- function reviveModel(response, parentObj, parentKey, value, reference) {
3085
- if ("string" === typeof value)
3086
- return parseModelString(
3087
- response,
3088
- parentObj,
3089
- parentKey,
3090
- value,
3091
- reference
3092
- );
3093
- if ("object" === typeof value && null !== value)
3094
- if (
3095
- (void 0 !== reference &&
3096
- void 0 !== response._temporaryReferences &&
3097
- response._temporaryReferences.set(value, reference),
3098
- Array.isArray(value))
3099
- )
3100
- for (var i = 0; i < value.length; i++)
3101
- value[i] = reviveModel(
3102
- response,
3103
- value,
3104
- "" + i,
3105
- value[i],
3106
- void 0 !== reference ? reference + ":" + i : void 0
3107
- );
3108
- else
3109
- for (i in value)
3110
- hasOwnProperty.call(value, i) &&
3111
- ((parentObj =
3112
- void 0 !== reference && -1 === i.indexOf(":")
3113
- ? reference + ":" + i
3114
- : void 0),
3115
- (parentObj = reviveModel(
3116
- response,
3117
- value,
3118
- i,
3119
- value[i],
3120
- parentObj
3121
- )),
3122
- void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
3123
- return value;
3124
- }
3125
- function initializeModelChunk(chunk) {
3126
- var prevChunk = initializingChunk,
3127
- prevBlocked = initializingChunkBlockedModel;
3128
- initializingChunk = chunk;
3129
- initializingChunkBlockedModel = null;
3130
- var rootReference =
3131
- -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
3132
- resolvedModel = chunk.value;
3133
- chunk.status = "cyclic";
3134
- chunk.value = null;
3135
- chunk.reason = null;
3136
- try {
3137
- var rawModel = JSON.parse(resolvedModel),
3138
- value = reviveModel(
3139
- chunk._response,
3140
- { "": rawModel },
3141
- "",
3142
- rawModel,
3143
- rootReference
3144
- );
3145
- if (
3146
- null !== initializingChunkBlockedModel &&
3147
- 0 < initializingChunkBlockedModel.deps
3148
- )
3149
- (initializingChunkBlockedModel.value = value),
3150
- (chunk.status = "blocked");
3151
- else {
3152
- var resolveListeners = chunk.value;
3153
- chunk.status = "fulfilled";
3154
- chunk.value = value;
3155
- null !== resolveListeners && wakeChunk(resolveListeners, value);
3156
- }
3157
- } catch (error) {
3158
- (chunk.status = "rejected"), (chunk.reason = error);
3159
- } finally {
3160
- (initializingChunk = prevChunk),
3161
- (initializingChunkBlockedModel = prevBlocked);
3162
- }
3163
- }
3164
- function reportGlobalError(response, error) {
3165
- response._closed = !0;
3166
- response._closedReason = error;
3167
- response._chunks.forEach(function (chunk) {
3168
- "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
3169
- });
3170
- }
3171
- function getChunk(response, id) {
3172
- var chunks = response._chunks,
3173
- chunk = chunks.get(id);
3174
- chunk ||
3175
- ((chunk = response._formData.get(response._prefix + id)),
3176
- (chunk =
3177
- null != chunk
3178
- ? new Chunk("resolved_model", chunk, id, response)
3179
- : response._closed
3180
- ? new Chunk("rejected", null, response._closedReason, response)
3181
- : createPendingChunk(response)),
3182
- chunks.set(id, chunk));
3183
- return chunk;
3184
- }
3185
- function createModelResolver(
3186
- chunk,
3187
- parentObject,
3188
- key,
3189
- cyclic,
3190
- response,
3191
- map,
3192
- path
3193
- ) {
3194
- if (initializingChunkBlockedModel) {
3195
- var blocked = initializingChunkBlockedModel;
3196
- cyclic || blocked.deps++;
3197
- } else
3198
- blocked = initializingChunkBlockedModel = {
3199
- deps: cyclic ? 0 : 1,
3200
- value: null
3201
- };
3202
- return function (value) {
3203
- for (var i = 1; i < path.length; i++) value = value[path[i]];
3204
- parentObject[key] = map(response, value);
3205
- "" === key &&
3206
- null === blocked.value &&
3207
- (blocked.value = parentObject[key]);
3208
- blocked.deps--;
3209
- 0 === blocked.deps &&
3210
- "blocked" === chunk.status &&
3211
- ((value = chunk.value),
3212
- (chunk.status = "fulfilled"),
3213
- (chunk.value = blocked.value),
3214
- null !== value && wakeChunk(value, blocked.value));
3215
- };
3216
- }
3217
- function createModelReject(chunk) {
3218
- return function (error) {
3219
- return triggerErrorOnChunk(chunk, error);
3220
- };
3221
- }
3222
- function getOutlinedModel(response, reference, parentObject, key, map) {
3223
- reference = reference.split(":");
3224
- var id = parseInt(reference[0], 16);
3225
- id = getChunk(response, id);
3226
- switch (id.status) {
3227
- case "resolved_model":
3228
- initializeModelChunk(id);
3229
- }
3230
- switch (id.status) {
3231
- case "fulfilled":
3232
- parentObject = id.value;
3233
- for (key = 1; key < reference.length; key++)
3234
- parentObject = parentObject[reference[key]];
3235
- return map(response, parentObject);
3236
- case "pending":
3237
- case "blocked":
3238
- case "cyclic":
3239
- var parentChunk = initializingChunk;
3240
- id.then(
3241
- createModelResolver(
3242
- parentChunk,
3243
- parentObject,
3244
- key,
3245
- "cyclic" === id.status,
3246
- response,
3247
- map,
3248
- reference
3249
- ),
3250
- createModelReject(parentChunk)
3251
- );
3252
- return null;
3253
- default:
3254
- throw id.reason;
3255
- }
3256
- }
3257
- function createMap(response, model) {
3258
- return new Map(model);
3259
- }
3260
- function createSet(response, model) {
3261
- return new Set(model);
3262
- }
3263
- function extractIterator(response, model) {
3264
- return model[Symbol.iterator]();
3265
- }
3266
- function createModel(response, model) {
3267
- return model;
3268
- }
3269
- function parseTypedArray(
3270
- response,
3271
- reference,
3272
- constructor,
3273
- bytesPerElement,
3274
- parentObject,
3275
- parentKey
3276
- ) {
3277
- reference = parseInt(reference.slice(2), 16);
3278
- reference = response._formData.get(response._prefix + reference);
3279
- reference =
3280
- constructor === ArrayBuffer
3281
- ? reference.arrayBuffer()
3282
- : reference.arrayBuffer().then(function (buffer) {
3283
- return new constructor(buffer);
3284
- });
3285
- bytesPerElement = initializingChunk;
3286
- reference.then(
3287
- createModelResolver(
3288
- bytesPerElement,
3289
- parentObject,
3290
- parentKey,
3291
- !1,
3292
- response,
3293
- createModel,
3294
- []
3295
- ),
3296
- createModelReject(bytesPerElement)
3297
- );
3298
- return null;
3299
- }
3300
- function resolveStream(response, id, stream, controller) {
3301
- var chunks = response._chunks;
3302
- stream = new Chunk("fulfilled", stream, controller, response);
3303
- chunks.set(id, stream);
3304
- response = response._formData.getAll(response._prefix + id);
3305
- for (id = 0; id < response.length; id++)
3306
- (chunks = response[id]),
3307
- "C" === chunks[0]
3308
- ? controller.close(
3309
- "C" === chunks ? '"$undefined"' : chunks.slice(1)
3310
- )
3311
- : controller.enqueueModel(chunks);
3312
- }
3313
- function parseReadableStream(response, reference, type) {
3314
- reference = parseInt(reference.slice(2), 16);
3315
- var controller = null;
3316
- type = new ReadableStream({
3317
- type: type,
3318
- start: function (c) {
3319
- controller = c;
3320
- }
3321
- });
3322
- var previousBlockedChunk = null;
3323
- resolveStream(response, reference, type, {
3324
- enqueueModel: function (json) {
3325
- if (null === previousBlockedChunk) {
3326
- var chunk = new Chunk("resolved_model", json, -1, response);
3327
- initializeModelChunk(chunk);
3328
- "fulfilled" === chunk.status
3329
- ? controller.enqueue(chunk.value)
3330
- : (chunk.then(
3331
- function (v) {
3332
- return controller.enqueue(v);
3333
- },
3334
- function (e) {
3335
- return controller.error(e);
3336
- }
3337
- ),
3338
- (previousBlockedChunk = chunk));
3339
- } else {
3340
- chunk = previousBlockedChunk;
3341
- var _chunk = createPendingChunk(response);
3342
- _chunk.then(
3343
- function (v) {
3344
- return controller.enqueue(v);
3345
- },
3346
- function (e) {
3347
- return controller.error(e);
3348
- }
3349
- );
3350
- previousBlockedChunk = _chunk;
3351
- chunk.then(function () {
3352
- previousBlockedChunk === _chunk && (previousBlockedChunk = null);
3353
- resolveModelChunk(_chunk, json, -1);
3354
- });
3355
- }
3356
- },
3357
- close: function () {
3358
- if (null === previousBlockedChunk) controller.close();
3359
- else {
3360
- var blockedChunk = previousBlockedChunk;
3361
- previousBlockedChunk = null;
3362
- blockedChunk.then(function () {
3363
- return controller.close();
3364
- });
3365
- }
3366
- },
3367
- error: function (error) {
3368
- if (null === previousBlockedChunk) controller.error(error);
3369
- else {
3370
- var blockedChunk = previousBlockedChunk;
3371
- previousBlockedChunk = null;
3372
- blockedChunk.then(function () {
3373
- return controller.error(error);
3374
- });
3375
- }
3376
- }
3377
- });
3378
- return type;
3379
- }
3380
- function asyncIterator() {
3381
- return this;
3382
- }
3383
- function createIterator(next) {
3384
- next = { next: next };
3385
- next[ASYNC_ITERATOR] = asyncIterator;
3386
- return next;
3387
- }
3388
- function parseAsyncIterable(response, reference, iterator) {
3389
- reference = parseInt(reference.slice(2), 16);
3390
- var buffer = [],
3391
- closed = !1,
3392
- nextWriteIndex = 0,
3393
- iterable = _defineProperty({}, ASYNC_ITERATOR, function () {
3394
- var nextReadIndex = 0;
3395
- return createIterator(function (arg) {
3396
- if (void 0 !== arg)
3397
- throw Error(
3398
- "Values cannot be passed to next() of AsyncIterables passed to Client Components."
3399
- );
3400
- if (nextReadIndex === buffer.length) {
3401
- if (closed)
3402
- return new Chunk(
3403
- "fulfilled",
3404
- { done: !0, value: void 0 },
3405
- null,
3406
- response
3407
- );
3408
- buffer[nextReadIndex] = createPendingChunk(response);
3409
- }
3410
- return buffer[nextReadIndex++];
3411
- });
3412
- });
3413
- iterator = iterator ? iterable[ASYNC_ITERATOR]() : iterable;
3414
- resolveStream(response, reference, iterator, {
3415
- enqueueModel: function (value) {
3416
- nextWriteIndex === buffer.length
3417
- ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
3418
- response,
3419
- value,
3420
- !1
3421
- ))
3422
- : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
3423
- nextWriteIndex++;
3424
- },
3425
- close: function (value) {
3426
- closed = !0;
3427
- nextWriteIndex === buffer.length
3428
- ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
3429
- response,
3430
- value,
3431
- !0
3432
- ))
3433
- : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
3434
- for (nextWriteIndex++; nextWriteIndex < buffer.length; )
3435
- resolveIteratorResultChunk(
3436
- buffer[nextWriteIndex++],
3437
- '"$undefined"',
3438
- !0
3439
- );
3440
- },
3441
- error: function (error) {
3442
- closed = !0;
3443
- for (
3444
- nextWriteIndex === buffer.length &&
3445
- (buffer[nextWriteIndex] = createPendingChunk(response));
3446
- nextWriteIndex < buffer.length;
3447
-
3448
- )
3449
- triggerErrorOnChunk(buffer[nextWriteIndex++], error);
3450
- }
3451
- });
3452
- return iterator;
3453
- }
3454
- function parseModelString(response, obj, key, value, reference) {
3455
- if ("$" === value[0]) {
3456
- switch (value[1]) {
3457
- case "$":
3458
- return value.slice(1);
3459
- case "@":
3460
- return (
3461
- (obj = parseInt(value.slice(2), 16)), getChunk(response, obj)
3462
- );
3463
- case "F":
3464
- return (
3465
- (value = value.slice(2)),
3466
- (value = getOutlinedModel(
3467
- response,
3468
- value,
3469
- obj,
3470
- key,
3471
- createModel
3472
- )),
3473
- loadServerReference$1(
3474
- response,
3475
- value.id,
3476
- value.bound,
3477
- initializingChunk,
3478
- obj,
3479
- key
3480
- )
3481
- );
3482
- case "T":
3483
- if (
3484
- void 0 === reference ||
3485
- void 0 === response._temporaryReferences
3486
- )
3487
- throw Error(
3488
- "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
3489
- );
3490
- return createTemporaryReference(
3491
- response._temporaryReferences,
3492
- reference
3493
- );
3494
- case "Q":
3495
- return (
3496
- (value = value.slice(2)),
3497
- getOutlinedModel(response, value, obj, key, createMap)
3498
- );
3499
- case "W":
3500
- return (
3501
- (value = value.slice(2)),
3502
- getOutlinedModel(response, value, obj, key, createSet)
3503
- );
3504
- case "K":
3505
- obj = value.slice(2);
3506
- var formPrefix = response._prefix + obj + "_",
3507
- data = new FormData();
3508
- response._formData.forEach(function (entry, entryKey) {
3509
- entryKey.startsWith(formPrefix) &&
3510
- data.append(entryKey.slice(formPrefix.length), entry);
3511
- });
3512
- return data;
3513
- case "i":
3514
- return (
3515
- (value = value.slice(2)),
3516
- getOutlinedModel(response, value, obj, key, extractIterator)
3517
- );
3518
- case "I":
3519
- return Infinity;
3520
- case "-":
3521
- return "$-0" === value ? -0 : -Infinity;
3522
- case "N":
3523
- return NaN;
3524
- case "u":
3525
- return;
3526
- case "D":
3527
- return new Date(Date.parse(value.slice(2)));
3528
- case "n":
3529
- return BigInt(value.slice(2));
3530
- }
3531
- switch (value[1]) {
3532
- case "A":
3533
- return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
3534
- case "O":
3535
- return parseTypedArray(response, value, Int8Array, 1, obj, key);
3536
- case "o":
3537
- return parseTypedArray(response, value, Uint8Array, 1, obj, key);
3538
- case "U":
3539
- return parseTypedArray(
3540
- response,
3541
- value,
3542
- Uint8ClampedArray,
3543
- 1,
3544
- obj,
3545
- key
3546
- );
3547
- case "S":
3548
- return parseTypedArray(response, value, Int16Array, 2, obj, key);
3549
- case "s":
3550
- return parseTypedArray(response, value, Uint16Array, 2, obj, key);
3551
- case "L":
3552
- return parseTypedArray(response, value, Int32Array, 4, obj, key);
3553
- case "l":
3554
- return parseTypedArray(response, value, Uint32Array, 4, obj, key);
3555
- case "G":
3556
- return parseTypedArray(response, value, Float32Array, 4, obj, key);
3557
- case "g":
3558
- return parseTypedArray(response, value, Float64Array, 8, obj, key);
3559
- case "M":
3560
- return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
3561
- case "m":
3562
- return parseTypedArray(
3563
- response,
3564
- value,
3565
- BigUint64Array,
3566
- 8,
3567
- obj,
3568
- key
3569
- );
3570
- case "V":
3571
- return parseTypedArray(response, value, DataView, 1, obj, key);
3572
- case "B":
3573
- return (
3574
- (obj = parseInt(value.slice(2), 16)),
3575
- response._formData.get(response._prefix + obj)
3576
- );
3577
- }
3578
- switch (value[1]) {
3579
- case "R":
3580
- return parseReadableStream(response, value, void 0);
3581
- case "r":
3582
- return parseReadableStream(response, value, "bytes");
3583
- case "X":
3584
- return parseAsyncIterable(response, value, !1);
3585
- case "x":
3586
- return parseAsyncIterable(response, value, !0);
3587
- }
3588
- value = value.slice(1);
3589
- return getOutlinedModel(response, value, obj, key, createModel);
3590
- }
3591
- return value;
3592
- }
3593
- function createResponse(
3594
- bundlerConfig,
3595
- formFieldPrefix,
3596
- temporaryReferences
3597
- ) {
3598
- var backingFormData =
3599
- 3 < arguments.length && void 0 !== arguments[3]
3600
- ? arguments[3]
3601
- : new FormData(),
3602
- chunks = new Map();
3603
- return {
3604
- _bundlerConfig: bundlerConfig,
3605
- _prefix: formFieldPrefix,
3606
- _formData: backingFormData,
3607
- _chunks: chunks,
3608
- _closed: !1,
3609
- _closedReason: null,
3610
- _temporaryReferences: temporaryReferences
3611
- };
3612
- }
3613
- function close(response) {
3614
- reportGlobalError(response, Error("Connection closed."));
3615
- }
3616
- function loadServerReference(bundlerConfig, id, bound) {
3617
- var serverReference = resolveServerReference(bundlerConfig, id);
3618
- bundlerConfig = preloadModule(serverReference);
3619
- return bound
3620
- ? Promise.all([bound, bundlerConfig]).then(function (_ref) {
3621
- _ref = _ref[0];
3622
- var fn = requireModule(serverReference);
3623
- return fn.bind.apply(fn, [null].concat(_ref));
3624
- })
3625
- : bundlerConfig
3626
- ? Promise.resolve(bundlerConfig).then(function () {
3627
- return requireModule(serverReference);
3628
- })
3629
- : Promise.resolve(requireModule(serverReference));
3630
- }
3631
- function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
3632
- body = createResponse(serverManifest, formFieldPrefix, void 0, body);
3633
- close(body);
3634
- body = getChunk(body, 0);
3635
- body.then(function () {});
3636
- if ("fulfilled" !== body.status) throw body.reason;
3637
- return body.value;
3638
- }
3639
- var util = require("util");
3640
- require("crypto");
3641
- var async_hooks = require("async_hooks"),
3642
- ReactDOM = require("react-dom"),
3643
- React = require("react"),
3644
- REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
3645
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
3646
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
3647
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
3648
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
3649
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
3650
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
3651
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
3652
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
3653
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
3654
- Symbol.for("react.postpone");
3655
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3656
- ASYNC_ITERATOR = Symbol.asyncIterator,
3657
- scheduleMicrotask = queueMicrotask,
3658
- currentView = null,
3659
- writtenBytes = 0,
3660
- textEncoder = new util.TextEncoder(),
3661
- CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
3662
- SERVER_REFERENCE_TAG = Symbol.for("react.server.reference"),
3663
- FunctionBind = Function.prototype.bind,
3664
- ArraySlice = Array.prototype.slice,
3665
- PROMISE_PROTOTYPE = Promise.prototype,
3666
- deepProxyHandlers = {
3667
- get: function (target, name) {
3668
- switch (name) {
3669
- case "$$typeof":
3670
- return target.$$typeof;
3671
- case "$$id":
3672
- return target.$$id;
3673
- case "$$async":
3674
- return target.$$async;
3675
- case "name":
3676
- return target.name;
3677
- case "displayName":
3678
- return;
3679
- case "defaultProps":
3680
- return;
3681
- case "toJSON":
3682
- return;
3683
- case Symbol.toPrimitive:
3684
- return Object.prototype[Symbol.toPrimitive];
3685
- case Symbol.toStringTag:
3686
- return Object.prototype[Symbol.toStringTag];
3687
- case "Provider":
3688
- throw Error(
3689
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3690
- );
3691
- case "then":
3692
- throw Error(
3693
- "Cannot await or return from a thenable. You cannot await a client module from a server component."
3694
- );
3695
- }
3696
- throw Error(
3697
- "Cannot access " +
3698
- (String(target.name) + "." + String(name)) +
3699
- " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
3700
- );
3701
- },
3702
- set: function () {
3703
- throw Error("Cannot assign to a client module from a server module.");
3704
- }
3705
- },
3706
- proxyHandlers$1 = {
3707
- get: function (target, name) {
3708
- return getReference(target, name);
3709
- },
3710
- getOwnPropertyDescriptor: function (target, name) {
3711
- var descriptor = Object.getOwnPropertyDescriptor(target, name);
3712
- descriptor ||
3713
- ((descriptor = {
3714
- value: getReference(target, name),
3715
- writable: !1,
3716
- configurable: !1,
3717
- enumerable: !1
3718
- }),
3719
- Object.defineProperty(target, name, descriptor));
3720
- return descriptor;
3721
- },
3722
- getPrototypeOf: function () {
3723
- return PROMISE_PROTOTYPE;
3724
- },
3725
- set: function () {
3726
- throw Error("Cannot assign to a client module from a server module.");
3727
- }
3728
- },
3729
- ReactDOMSharedInternals =
3730
- ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
3731
- previousDispatcher = ReactDOMSharedInternals.d;
3732
- ReactDOMSharedInternals.d = {
3733
- f: previousDispatcher.f,
3734
- r: previousDispatcher.r,
3735
- D: function (href) {
3736
- if ("string" === typeof href && href) {
3737
- var request = resolveRequest();
3738
- if (request) {
3739
- var hints = request.hints,
3740
- key = "D|" + href;
3741
- hints.has(key) || (hints.add(key), emitHint(request, "D", href));
3742
- } else previousDispatcher.D(href);
3743
- }
3744
- },
3745
- C: function (href, crossOrigin) {
3746
- if ("string" === typeof href) {
3747
- var request = resolveRequest();
3748
- if (request) {
3749
- var hints = request.hints,
3750
- key =
3751
- "C|" +
3752
- (null == crossOrigin ? "null" : crossOrigin) +
3753
- "|" +
3754
- href;
3755
- hints.has(key) ||
3756
- (hints.add(key),
3757
- "string" === typeof crossOrigin
3758
- ? emitHint(request, "C", [href, crossOrigin])
3759
- : emitHint(request, "C", href));
3760
- } else previousDispatcher.C(href, crossOrigin);
3761
- }
3762
- },
3763
- L: function (href, as, options) {
3764
- if ("string" === typeof href) {
3765
- var request = resolveRequest();
3766
- if (request) {
3767
- var hints = request.hints,
3768
- key = "L";
3769
- if ("image" === as && options) {
3770
- var imageSrcSet = options.imageSrcSet,
3771
- imageSizes = options.imageSizes,
3772
- uniquePart = "";
3773
- "string" === typeof imageSrcSet && "" !== imageSrcSet
3774
- ? ((uniquePart += "[" + imageSrcSet + "]"),
3775
- "string" === typeof imageSizes &&
3776
- (uniquePart += "[" + imageSizes + "]"))
3777
- : (uniquePart += "[][]" + href);
3778
- key += "[image]" + uniquePart;
3779
- } else key += "[" + as + "]" + href;
3780
- hints.has(key) ||
3781
- (hints.add(key),
3782
- (options = trimOptions(options))
3783
- ? emitHint(request, "L", [href, as, options])
3784
- : emitHint(request, "L", [href, as]));
3785
- } else previousDispatcher.L(href, as, options);
3786
- }
3787
- },
3788
- m: function (href, options) {
3789
- if ("string" === typeof href) {
3790
- var request = resolveRequest();
3791
- if (request) {
3792
- var hints = request.hints,
3793
- key = "m|" + href;
3794
- if (hints.has(key)) return;
3795
- hints.add(key);
3796
- return (options = trimOptions(options))
3797
- ? emitHint(request, "m", [href, options])
3798
- : emitHint(request, "m", href);
3799
- }
3800
- previousDispatcher.m(href, options);
3801
- }
3802
- },
3803
- X: function (src, options) {
3804
- if ("string" === typeof src) {
3805
- var request = resolveRequest();
3806
- if (request) {
3807
- var hints = request.hints,
3808
- key = "X|" + src;
3809
- if (hints.has(key)) return;
3810
- hints.add(key);
3811
- return (options = trimOptions(options))
3812
- ? emitHint(request, "X", [src, options])
3813
- : emitHint(request, "X", src);
3814
- }
3815
- previousDispatcher.X(src, options);
3816
- }
3817
- },
3818
- S: function (href, precedence, options) {
3819
- if ("string" === typeof href) {
3820
- var request = resolveRequest();
3821
- if (request) {
3822
- var hints = request.hints,
3823
- key = "S|" + href;
3824
- if (hints.has(key)) return;
3825
- hints.add(key);
3826
- return (options = trimOptions(options))
3827
- ? emitHint(request, "S", [
3828
- href,
3829
- "string" === typeof precedence ? precedence : 0,
3830
- options
3831
- ])
3832
- : "string" === typeof precedence
3833
- ? emitHint(request, "S", [href, precedence])
3834
- : emitHint(request, "S", href);
3835
- }
3836
- previousDispatcher.S(href, precedence, options);
3837
- }
3838
- },
3839
- M: function (src, options) {
3840
- if ("string" === typeof src) {
3841
- var request = resolveRequest();
3842
- if (request) {
3843
- var hints = request.hints,
3844
- key = "M|" + src;
3845
- if (hints.has(key)) return;
3846
- hints.add(key);
3847
- return (options = trimOptions(options))
3848
- ? emitHint(request, "M", [src, options])
3849
- : emitHint(request, "M", src);
3850
- }
3851
- previousDispatcher.M(src, options);
3852
- }
3853
- }
3854
- };
3855
- var currentOwner = null,
3856
- framesToSkip = 0,
3857
- collectedStackTrace = null,
3858
- identifierRegExp = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/,
3859
- frameRegExp =
3860
- /^ {3} at (?:(.+) \((?:(.+):(\d+):(\d+)|<anonymous>)\)|(?:async )?(.+):(\d+):(\d+)|<anonymous>)$/,
3861
- stackTraceCache = new WeakMap(),
3862
- requestStorage = new async_hooks.AsyncLocalStorage(),
3863
- componentStorage = new async_hooks.AsyncLocalStorage(),
3864
- TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
3865
- proxyHandlers = {
3866
- get: function (target, name) {
3867
- switch (name) {
3868
- case "$$typeof":
3869
- return target.$$typeof;
3870
- case "name":
3871
- return;
3872
- case "displayName":
3873
- return;
3874
- case "defaultProps":
3875
- return;
3876
- case "toJSON":
3877
- return;
3878
- case Symbol.toPrimitive:
3879
- return Object.prototype[Symbol.toPrimitive];
3880
- case Symbol.toStringTag:
3881
- return Object.prototype[Symbol.toStringTag];
3882
- case "Provider":
3883
- throw Error(
3884
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3885
- );
3886
- }
3887
- throw Error(
3888
- "Cannot access " +
3889
- String(name) +
3890
- " on the server. You cannot dot into a temporary client reference from a server component. You can only pass the value through to the client."
3891
- );
3892
- },
3893
- set: function () {
3894
- throw Error(
3895
- "Cannot assign to a temporary client reference from a server module."
3896
- );
3897
- }
3898
- },
3899
- SuspenseException = Error(
3900
- "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
3901
- ),
3902
- suspendedThenable = null,
3903
- currentRequest$1 = null,
3904
- thenableIndexCounter = 0,
3905
- thenableState = null,
3906
- currentComponentDebugInfo = null,
3907
- HooksDispatcher = {
3908
- readContext: unsupportedContext,
3909
- use: function (usable) {
3910
- if (
3911
- (null !== usable && "object" === typeof usable) ||
3912
- "function" === typeof usable
3913
- ) {
3914
- if ("function" === typeof usable.then) {
3915
- var index = thenableIndexCounter;
3916
- thenableIndexCounter += 1;
3917
- null === thenableState && (thenableState = []);
3918
- return trackUsedThenable(thenableState, usable, index);
3919
- }
3920
- usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
3921
- }
3922
- if (isClientReference(usable)) {
3923
- if (
3924
- null != usable.value &&
3925
- usable.value.$$typeof === REACT_CONTEXT_TYPE
3926
- )
3927
- throw Error(
3928
- "Cannot read a Client Context from a Server Component."
3929
- );
3930
- throw Error("Cannot use() an already resolved Client Reference.");
3931
- }
3932
- throw Error(
3933
- "An unsupported type was passed to use(): " + String(usable)
3934
- );
3935
- },
3936
- useCallback: function (callback) {
3937
- return callback;
3938
- },
3939
- useContext: unsupportedContext,
3940
- useEffect: unsupportedHook,
3941
- useImperativeHandle: unsupportedHook,
3942
- useLayoutEffect: unsupportedHook,
3943
- useInsertionEffect: unsupportedHook,
3944
- useMemo: function (nextCreate) {
3945
- return nextCreate();
3946
- },
3947
- useReducer: unsupportedHook,
3948
- useRef: unsupportedHook,
3949
- useState: unsupportedHook,
3950
- useDebugValue: function () {},
3951
- useDeferredValue: unsupportedHook,
3952
- useTransition: unsupportedHook,
3953
- useSyncExternalStore: unsupportedHook,
3954
- useId: function () {
3955
- if (null === currentRequest$1)
3956
- throw Error("useId can only be used while React is rendering");
3957
- var id = currentRequest$1.identifierCount++;
3958
- return (
3959
- "_" +
3960
- currentRequest$1.identifierPrefix +
3961
- "S_" +
3962
- id.toString(32) +
3963
- "_"
3964
- );
3965
- },
3966
- useHostTransitionStatus: unsupportedHook,
3967
- useFormState: unsupportedHook,
3968
- useActionState: unsupportedHook,
3969
- useOptimistic: unsupportedHook,
3970
- useMemoCache: function (size) {
3971
- for (var data = Array(size), i = 0; i < size; i++)
3972
- data[i] = REACT_MEMO_CACHE_SENTINEL;
3973
- return data;
3974
- },
3975
- useCacheRefresh: function () {
3976
- return unsupportedRefresh;
3977
- }
3978
- },
3979
- DefaultAsyncDispatcher = {
3980
- getCacheForType: function (resourceType) {
3981
- var cache = (cache = resolveRequest()) ? cache.cache : new Map();
3982
- var entry = cache.get(resourceType);
3983
- void 0 === entry &&
3984
- ((entry = resourceType()), cache.set(resourceType, entry));
3985
- return entry;
3986
- }
3987
- };
3988
- DefaultAsyncDispatcher.getOwner = resolveOwner;
3989
- var ReactSharedInternalsServer =
3990
- React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
3991
- if (!ReactSharedInternalsServer)
3992
- throw Error(
3993
- 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
3994
- );
3995
- var prefix, suffix;
3996
- new ("function" === typeof WeakMap ? WeakMap : Map)();
3997
- var lastResetTime = 0;
3998
- if (
3999
- "object" === typeof performance &&
4000
- "function" === typeof performance.now
4001
- ) {
4002
- var localPerformance = performance;
4003
- var getCurrentTime = function () {
4004
- return localPerformance.now();
4005
- };
4006
- } else {
4007
- var localDate = Date;
4008
- getCurrentTime = function () {
4009
- return localDate.now();
4010
- };
4011
- }
4012
- var callComponent = {
4013
- "react-stack-bottom-frame": function (
4014
- Component,
4015
- props,
4016
- componentDebugInfo
4017
- ) {
4018
- currentOwner = componentDebugInfo;
4019
- try {
4020
- return Component(props, void 0);
4021
- } finally {
4022
- currentOwner = null;
4023
- }
4024
- }
4025
- },
4026
- callComponentInDEV =
4027
- callComponent["react-stack-bottom-frame"].bind(callComponent),
4028
- callLazyInit = {
4029
- "react-stack-bottom-frame": function (lazy) {
4030
- var init = lazy._init;
4031
- return init(lazy._payload);
4032
- }
4033
- },
4034
- callLazyInitInDEV =
4035
- callLazyInit["react-stack-bottom-frame"].bind(callLazyInit),
4036
- callIterator = {
4037
- "react-stack-bottom-frame": function (iterator, progress, error) {
4038
- iterator.next().then(progress, error);
4039
- }
4040
- },
4041
- callIteratorInDEV =
4042
- callIterator["react-stack-bottom-frame"].bind(callIterator),
4043
- isArrayImpl = Array.isArray,
4044
- getPrototypeOf = Object.getPrototypeOf,
4045
- jsxPropsParents = new WeakMap(),
4046
- jsxChildrenParents = new WeakMap(),
4047
- CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
4048
- doNotLimit = new WeakSet();
4049
- "object" === typeof console &&
4050
- null !== console &&
4051
- (patchConsole(console, "assert"),
4052
- patchConsole(console, "debug"),
4053
- patchConsole(console, "dir"),
4054
- patchConsole(console, "dirxml"),
4055
- patchConsole(console, "error"),
4056
- patchConsole(console, "group"),
4057
- patchConsole(console, "groupCollapsed"),
4058
- patchConsole(console, "groupEnd"),
4059
- patchConsole(console, "info"),
4060
- patchConsole(console, "log"),
4061
- patchConsole(console, "table"),
4062
- patchConsole(console, "trace"),
4063
- patchConsole(console, "warn"));
4064
- var ObjectPrototype = Object.prototype,
4065
- stringify = JSON.stringify,
4066
- PENDING$1 = 0,
4067
- COMPLETED = 1,
4068
- ABORTED = 3,
4069
- ERRORED$1 = 4,
4070
- RENDERING = 5,
4071
- OPENING = 10,
4072
- ABORTING = 12,
4073
- CLOSING = 13,
4074
- CLOSED = 14,
4075
- PRERENDER = 21,
4076
- defaultPostponeHandler = noop,
4077
- currentRequest = null,
4078
- debugID = null,
4079
- serializedSize = 0,
4080
- MAX_ROW_SIZE = 3200,
4081
- modelRoot = !1,
4082
- emptyRoot = {},
4083
- chunkCache = new Map(),
4084
- hasOwnProperty = Object.prototype.hasOwnProperty;
4085
- Chunk.prototype = Object.create(Promise.prototype);
4086
- Chunk.prototype.then = function (resolve, reject) {
4087
- switch (this.status) {
4088
- case "resolved_model":
4089
- initializeModelChunk(this);
4090
- }
4091
- switch (this.status) {
4092
- case "fulfilled":
4093
- resolve(this.value);
4094
- break;
4095
- case "pending":
4096
- case "blocked":
4097
- case "cyclic":
4098
- resolve &&
4099
- (null === this.value && (this.value = []),
4100
- this.value.push(resolve));
4101
- reject &&
4102
- (null === this.reason && (this.reason = []),
4103
- this.reason.push(reject));
4104
- break;
4105
- default:
4106
- reject(this.reason);
4107
- }
4108
- };
4109
- var initializingChunk = null,
4110
- initializingChunkBlockedModel = null;
4111
- exports.createClientModuleProxy = function (moduleId) {
4112
- moduleId = registerClientReferenceImpl({}, moduleId, !1);
4113
- return new Proxy(moduleId, proxyHandlers$1);
4114
- };
4115
- exports.createTemporaryReferenceSet = function () {
4116
- return new WeakMap();
4117
- };
4118
- exports.decodeAction = function (body, serverManifest) {
4119
- var formData = new FormData(),
4120
- action = null;
4121
- body.forEach(function (value, key) {
4122
- key.startsWith("$ACTION_")
4123
- ? key.startsWith("$ACTION_REF_")
4124
- ? ((value = "$ACTION_" + key.slice(12) + ":"),
4125
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
4126
- (action = loadServerReference(
4127
- serverManifest,
4128
- value.id,
4129
- value.bound
4130
- )))
4131
- : key.startsWith("$ACTION_ID_") &&
4132
- ((value = key.slice(11)),
4133
- (action = loadServerReference(serverManifest, value, null)))
4134
- : formData.append(key, value);
4135
- });
4136
- return null === action
4137
- ? null
4138
- : action.then(function (fn) {
4139
- return fn.bind(null, formData);
4140
- });
4141
- };
4142
- exports.decodeFormState = function (actionResult, body, serverManifest) {
4143
- var keyPath = body.get("$ACTION_KEY");
4144
- if ("string" !== typeof keyPath) return Promise.resolve(null);
4145
- var metaData = null;
4146
- body.forEach(function (value, key) {
4147
- key.startsWith("$ACTION_REF_") &&
4148
- ((value = "$ACTION_" + key.slice(12) + ":"),
4149
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
4150
- });
4151
- if (null === metaData) return Promise.resolve(null);
4152
- var referenceId = metaData.id;
4153
- return Promise.resolve(metaData.bound).then(function (bound) {
4154
- return null === bound
4155
- ? null
4156
- : [actionResult, keyPath, referenceId, bound.length - 1];
4157
- });
4158
- };
4159
- exports.decodeReply = function (body, webpackMap, options) {
4160
- if ("string" === typeof body) {
4161
- var form = new FormData();
4162
- form.append("0", body);
4163
- body = form;
4164
- }
4165
- body = createResponse(
4166
- webpackMap,
4167
- "",
4168
- options ? options.temporaryReferences : void 0,
4169
- body
4170
- );
4171
- webpackMap = getChunk(body, 0);
4172
- close(body);
4173
- return webpackMap;
4174
- };
4175
- exports.decodeReplyFromAsyncIterable = function (
4176
- iterable,
4177
- webpackMap,
4178
- options
4179
- ) {
4180
- function progress(entry) {
4181
- if (entry.done) close(response$jscomp$0);
4182
- else {
4183
- entry = entry.value;
4184
- var name = entry[0];
4185
- entry = entry[1];
4186
- if ("string" === typeof entry) {
4187
- var response = response$jscomp$0;
4188
- response._formData.append(name, entry);
4189
- var prefix = response._prefix;
4190
- name.startsWith(prefix) &&
4191
- ((response = response._chunks),
4192
- (name = +name.slice(prefix.length)),
4193
- (prefix = response.get(name)) &&
4194
- resolveModelChunk(prefix, entry, name));
4195
- } else response$jscomp$0._formData.append(name, entry);
4196
- iterator.next().then(progress, error);
4197
- }
4198
- }
4199
- function error(reason) {
4200
- reportGlobalError(response$jscomp$0, reason);
4201
- "function" === typeof iterator.throw &&
4202
- iterator.throw(reason).then(error, error);
4203
- }
4204
- var iterator = iterable[ASYNC_ITERATOR](),
4205
- response$jscomp$0 = createResponse(
4206
- webpackMap,
4207
- "",
4208
- options ? options.temporaryReferences : void 0
4209
- );
4210
- iterator.next().then(progress, error);
4211
- return getChunk(response$jscomp$0, 0);
4212
- };
4213
- exports.registerClientReference = function (
4214
- proxyImplementation,
4215
- id,
4216
- exportName
4217
- ) {
4218
- return registerClientReferenceImpl(
4219
- proxyImplementation,
4220
- id + "#" + exportName,
4221
- !1
4222
- );
4223
- };
4224
- exports.registerServerReference = function (reference, id, exportName) {
4225
- return Object.defineProperties(reference, {
4226
- $$typeof: { value: SERVER_REFERENCE_TAG },
4227
- $$id: {
4228
- value: null === exportName ? id : id + "#" + exportName,
4229
- configurable: !0
4230
- },
4231
- $$bound: { value: null, configurable: !0 },
4232
- $$location: { value: Error("react-stack-top-frame"), configurable: !0 },
4233
- bind: { value: bind, configurable: !0 }
4234
- });
4235
- };
4236
- exports.renderToReadableStream = function (model, webpackMap, options) {
4237
- var request = createRequest(
4238
- model,
4239
- webpackMap,
4240
- options ? options.onError : void 0,
4241
- options ? options.identifierPrefix : void 0,
4242
- options ? options.onPostpone : void 0,
4243
- options ? options.temporaryReferences : void 0,
4244
- options ? options.environmentName : void 0,
4245
- options ? options.filterStackFrame : void 0
4246
- );
4247
- if (options && options.signal) {
4248
- var signal = options.signal;
4249
- if (signal.aborted) abort(request, signal.reason);
4250
- else {
4251
- var listener = function () {
4252
- abort(request, signal.reason);
4253
- signal.removeEventListener("abort", listener);
4254
- };
4255
- signal.addEventListener("abort", listener);
4256
- }
4257
- }
4258
- return new ReadableStream(
4259
- {
4260
- type: "bytes",
4261
- start: function () {
4262
- startWork(request);
4263
- },
4264
- pull: function (controller) {
4265
- startFlowing(request, controller);
4266
- },
4267
- cancel: function (reason) {
4268
- request.destination = null;
4269
- abort(request, reason);
4270
- }
4271
- },
4272
- { highWaterMark: 0 }
4273
- );
4274
- };
4275
- exports.unstable_prerender = function (model, webpackMap, options) {
4276
- return new Promise(function (resolve, reject) {
4277
- var request = createPrerenderRequest(
4278
- model,
4279
- webpackMap,
4280
- function () {
4281
- var stream = new ReadableStream(
4282
- {
4283
- type: "bytes",
4284
- pull: function (controller) {
4285
- startFlowing(request, controller);
4286
- },
4287
- cancel: function (reason) {
4288
- request.destination = null;
4289
- abort(request, reason);
4290
- }
4291
- },
4292
- { highWaterMark: 0 }
4293
- );
4294
- resolve({ prelude: stream });
4295
- },
4296
- reject,
4297
- options ? options.onError : void 0,
4298
- options ? options.identifierPrefix : void 0,
4299
- options ? options.onPostpone : void 0,
4300
- options ? options.temporaryReferences : void 0,
4301
- options ? options.environmentName : void 0,
4302
- options ? options.filterStackFrame : void 0
4303
- );
4304
- if (options && options.signal) {
4305
- var signal = options.signal;
4306
- if (signal.aborted) abort(request, signal.reason);
4307
- else {
4308
- var listener = function () {
4309
- abort(request, signal.reason);
4310
- signal.removeEventListener("abort", listener);
4311
- };
4312
- signal.addEventListener("abort", listener);
4313
- }
4314
- }
4315
- startWork(request);
4316
- });
4317
- };
4318
- })();