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,2842 +0,0 @@
1
- /**
2
- * @license React
3
- * react-server-dom-webpack-server.node-webstreams.production.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
- var util = require("util");
13
- require("crypto");
14
- var async_hooks = require("async_hooks"),
15
- ReactDOM = require("react-dom"),
16
- React = require("react"),
17
- REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
18
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
19
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
20
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
21
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
22
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
23
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
24
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
25
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
26
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
27
- Symbol.for("react.postpone");
28
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
29
- function getIteratorFn(maybeIterable) {
30
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
31
- maybeIterable =
32
- (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
33
- maybeIterable["@@iterator"];
34
- return "function" === typeof maybeIterable ? maybeIterable : null;
35
- }
36
- var ASYNC_ITERATOR = Symbol.asyncIterator,
37
- scheduleMicrotask = queueMicrotask,
38
- currentView = null,
39
- writtenBytes = 0;
40
- function writeChunkAndReturn(destination, chunk) {
41
- if (0 !== chunk.byteLength)
42
- if (2048 < chunk.byteLength)
43
- 0 < writtenBytes &&
44
- (destination.enqueue(
45
- new Uint8Array(currentView.buffer, 0, writtenBytes)
46
- ),
47
- (currentView = new Uint8Array(2048)),
48
- (writtenBytes = 0)),
49
- destination.enqueue(chunk);
50
- else {
51
- var allowableBytes = currentView.length - writtenBytes;
52
- allowableBytes < chunk.byteLength &&
53
- (0 === allowableBytes
54
- ? destination.enqueue(currentView)
55
- : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
56
- destination.enqueue(currentView),
57
- (chunk = chunk.subarray(allowableBytes))),
58
- (currentView = new Uint8Array(2048)),
59
- (writtenBytes = 0));
60
- currentView.set(chunk, writtenBytes);
61
- writtenBytes += chunk.byteLength;
62
- }
63
- return !0;
64
- }
65
- var textEncoder = new util.TextEncoder();
66
- function stringToChunk(content) {
67
- return textEncoder.encode(content);
68
- }
69
- function byteLengthOfChunk(chunk) {
70
- return chunk.byteLength;
71
- }
72
- function closeWithError(destination, error) {
73
- "function" === typeof destination.error
74
- ? destination.error(error)
75
- : destination.close();
76
- }
77
- var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
78
- SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
79
- function registerClientReferenceImpl(proxyImplementation, id, async) {
80
- return Object.defineProperties(proxyImplementation, {
81
- $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
82
- $$id: { value: id },
83
- $$async: { value: async }
84
- });
85
- }
86
- var FunctionBind = Function.prototype.bind,
87
- ArraySlice = Array.prototype.slice;
88
- function bind() {
89
- var newFn = FunctionBind.apply(this, arguments);
90
- if (this.$$typeof === SERVER_REFERENCE_TAG) {
91
- var args = ArraySlice.call(arguments, 1),
92
- $$typeof = { value: SERVER_REFERENCE_TAG },
93
- $$id = { value: this.$$id };
94
- args = { value: this.$$bound ? this.$$bound.concat(args) : args };
95
- return Object.defineProperties(newFn, {
96
- $$typeof: $$typeof,
97
- $$id: $$id,
98
- $$bound: args,
99
- bind: { value: bind, configurable: !0 }
100
- });
101
- }
102
- return newFn;
103
- }
104
- var PROMISE_PROTOTYPE = Promise.prototype,
105
- deepProxyHandlers = {
106
- get: function (target, name) {
107
- switch (name) {
108
- case "$$typeof":
109
- return target.$$typeof;
110
- case "$$id":
111
- return target.$$id;
112
- case "$$async":
113
- return target.$$async;
114
- case "name":
115
- return target.name;
116
- case "displayName":
117
- return;
118
- case "defaultProps":
119
- return;
120
- case "toJSON":
121
- return;
122
- case Symbol.toPrimitive:
123
- return Object.prototype[Symbol.toPrimitive];
124
- case Symbol.toStringTag:
125
- return Object.prototype[Symbol.toStringTag];
126
- case "Provider":
127
- throw Error(
128
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
129
- );
130
- case "then":
131
- throw Error(
132
- "Cannot await or return from a thenable. You cannot await a client module from a server component."
133
- );
134
- }
135
- throw Error(
136
- "Cannot access " +
137
- (String(target.name) + "." + String(name)) +
138
- " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
139
- );
140
- },
141
- set: function () {
142
- throw Error("Cannot assign to a client module from a server module.");
143
- }
144
- };
145
- function getReference(target, name) {
146
- switch (name) {
147
- case "$$typeof":
148
- return target.$$typeof;
149
- case "$$id":
150
- return target.$$id;
151
- case "$$async":
152
- return target.$$async;
153
- case "name":
154
- return target.name;
155
- case "defaultProps":
156
- return;
157
- case "toJSON":
158
- return;
159
- case Symbol.toPrimitive:
160
- return Object.prototype[Symbol.toPrimitive];
161
- case Symbol.toStringTag:
162
- return Object.prototype[Symbol.toStringTag];
163
- case "__esModule":
164
- var moduleId = target.$$id;
165
- target.default = registerClientReferenceImpl(
166
- function () {
167
- throw Error(
168
- "Attempted to call the default export of " +
169
- moduleId +
170
- " 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."
171
- );
172
- },
173
- target.$$id + "#",
174
- target.$$async
175
- );
176
- return !0;
177
- case "then":
178
- if (target.then) return target.then;
179
- if (target.$$async) return;
180
- var clientReference = registerClientReferenceImpl({}, target.$$id, !0),
181
- proxy = new Proxy(clientReference, proxyHandlers$1);
182
- target.status = "fulfilled";
183
- target.value = proxy;
184
- return (target.then = registerClientReferenceImpl(
185
- function (resolve) {
186
- return Promise.resolve(resolve(proxy));
187
- },
188
- target.$$id + "#then",
189
- !1
190
- ));
191
- }
192
- if ("symbol" === typeof name)
193
- throw Error(
194
- "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
195
- );
196
- clientReference = target[name];
197
- clientReference ||
198
- ((clientReference = registerClientReferenceImpl(
199
- function () {
200
- throw Error(
201
- "Attempted to call " +
202
- String(name) +
203
- "() from the server but " +
204
- String(name) +
205
- " 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."
206
- );
207
- },
208
- target.$$id + "#" + name,
209
- target.$$async
210
- )),
211
- Object.defineProperty(clientReference, "name", { value: name }),
212
- (clientReference = target[name] =
213
- new Proxy(clientReference, deepProxyHandlers)));
214
- return clientReference;
215
- }
216
- var proxyHandlers$1 = {
217
- get: function (target, name) {
218
- return getReference(target, name);
219
- },
220
- getOwnPropertyDescriptor: function (target, name) {
221
- var descriptor = Object.getOwnPropertyDescriptor(target, name);
222
- descriptor ||
223
- ((descriptor = {
224
- value: getReference(target, name),
225
- writable: !1,
226
- configurable: !1,
227
- enumerable: !1
228
- }),
229
- Object.defineProperty(target, name, descriptor));
230
- return descriptor;
231
- },
232
- getPrototypeOf: function () {
233
- return PROMISE_PROTOTYPE;
234
- },
235
- set: function () {
236
- throw Error("Cannot assign to a client module from a server module.");
237
- }
238
- },
239
- ReactDOMSharedInternals =
240
- ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
241
- previousDispatcher = ReactDOMSharedInternals.d;
242
- ReactDOMSharedInternals.d = {
243
- f: previousDispatcher.f,
244
- r: previousDispatcher.r,
245
- D: prefetchDNS,
246
- C: preconnect,
247
- L: preload,
248
- m: preloadModule$1,
249
- X: preinitScript,
250
- S: preinitStyle,
251
- M: preinitModuleScript
252
- };
253
- function prefetchDNS(href) {
254
- if ("string" === typeof href && href) {
255
- var request = resolveRequest();
256
- if (request) {
257
- var hints = request.hints,
258
- key = "D|" + href;
259
- hints.has(key) || (hints.add(key), emitHint(request, "D", href));
260
- } else previousDispatcher.D(href);
261
- }
262
- }
263
- function preconnect(href, crossOrigin) {
264
- if ("string" === typeof href) {
265
- var request = resolveRequest();
266
- if (request) {
267
- var hints = request.hints,
268
- key = "C|" + (null == crossOrigin ? "null" : crossOrigin) + "|" + href;
269
- hints.has(key) ||
270
- (hints.add(key),
271
- "string" === typeof crossOrigin
272
- ? emitHint(request, "C", [href, crossOrigin])
273
- : emitHint(request, "C", href));
274
- } else previousDispatcher.C(href, crossOrigin);
275
- }
276
- }
277
- function preload(href, as, options) {
278
- if ("string" === typeof href) {
279
- var request = resolveRequest();
280
- if (request) {
281
- var hints = request.hints,
282
- key = "L";
283
- if ("image" === as && options) {
284
- var imageSrcSet = options.imageSrcSet,
285
- imageSizes = options.imageSizes,
286
- uniquePart = "";
287
- "string" === typeof imageSrcSet && "" !== imageSrcSet
288
- ? ((uniquePart += "[" + imageSrcSet + "]"),
289
- "string" === typeof imageSizes &&
290
- (uniquePart += "[" + imageSizes + "]"))
291
- : (uniquePart += "[][]" + href);
292
- key += "[image]" + uniquePart;
293
- } else key += "[" + as + "]" + href;
294
- hints.has(key) ||
295
- (hints.add(key),
296
- (options = trimOptions(options))
297
- ? emitHint(request, "L", [href, as, options])
298
- : emitHint(request, "L", [href, as]));
299
- } else previousDispatcher.L(href, as, options);
300
- }
301
- }
302
- function preloadModule$1(href, options) {
303
- if ("string" === typeof href) {
304
- var request = resolveRequest();
305
- if (request) {
306
- var hints = request.hints,
307
- key = "m|" + href;
308
- if (hints.has(key)) return;
309
- hints.add(key);
310
- return (options = trimOptions(options))
311
- ? emitHint(request, "m", [href, options])
312
- : emitHint(request, "m", href);
313
- }
314
- previousDispatcher.m(href, options);
315
- }
316
- }
317
- function preinitStyle(href, precedence, options) {
318
- if ("string" === typeof href) {
319
- var request = resolveRequest();
320
- if (request) {
321
- var hints = request.hints,
322
- key = "S|" + href;
323
- if (hints.has(key)) return;
324
- hints.add(key);
325
- return (options = trimOptions(options))
326
- ? emitHint(request, "S", [
327
- href,
328
- "string" === typeof precedence ? precedence : 0,
329
- options
330
- ])
331
- : "string" === typeof precedence
332
- ? emitHint(request, "S", [href, precedence])
333
- : emitHint(request, "S", href);
334
- }
335
- previousDispatcher.S(href, precedence, options);
336
- }
337
- }
338
- function preinitScript(src, options) {
339
- if ("string" === typeof src) {
340
- var request = resolveRequest();
341
- if (request) {
342
- var hints = request.hints,
343
- key = "X|" + src;
344
- if (hints.has(key)) return;
345
- hints.add(key);
346
- return (options = trimOptions(options))
347
- ? emitHint(request, "X", [src, options])
348
- : emitHint(request, "X", src);
349
- }
350
- previousDispatcher.X(src, options);
351
- }
352
- }
353
- function preinitModuleScript(src, options) {
354
- if ("string" === typeof src) {
355
- var request = resolveRequest();
356
- if (request) {
357
- var hints = request.hints,
358
- key = "M|" + src;
359
- if (hints.has(key)) return;
360
- hints.add(key);
361
- return (options = trimOptions(options))
362
- ? emitHint(request, "M", [src, options])
363
- : emitHint(request, "M", src);
364
- }
365
- previousDispatcher.M(src, options);
366
- }
367
- }
368
- function trimOptions(options) {
369
- if (null == options) return null;
370
- var hasProperties = !1,
371
- trimmed = {},
372
- key;
373
- for (key in options)
374
- null != options[key] &&
375
- ((hasProperties = !0), (trimmed[key] = options[key]));
376
- return hasProperties ? trimmed : null;
377
- }
378
- var requestStorage = new async_hooks.AsyncLocalStorage(),
379
- TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
380
- proxyHandlers = {
381
- get: function (target, name) {
382
- switch (name) {
383
- case "$$typeof":
384
- return target.$$typeof;
385
- case "name":
386
- return;
387
- case "displayName":
388
- return;
389
- case "defaultProps":
390
- return;
391
- case "toJSON":
392
- return;
393
- case Symbol.toPrimitive:
394
- return Object.prototype[Symbol.toPrimitive];
395
- case Symbol.toStringTag:
396
- return Object.prototype[Symbol.toStringTag];
397
- case "Provider":
398
- throw Error(
399
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
400
- );
401
- }
402
- throw Error(
403
- "Cannot access " +
404
- String(name) +
405
- " 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."
406
- );
407
- },
408
- set: function () {
409
- throw Error(
410
- "Cannot assign to a temporary client reference from a server module."
411
- );
412
- }
413
- };
414
- function createTemporaryReference(temporaryReferences, id) {
415
- var reference = Object.defineProperties(
416
- function () {
417
- throw Error(
418
- "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."
419
- );
420
- },
421
- { $$typeof: { value: TEMPORARY_REFERENCE_TAG } }
422
- );
423
- reference = new Proxy(reference, proxyHandlers);
424
- temporaryReferences.set(reference, id);
425
- return reference;
426
- }
427
- function noop() {}
428
- var SuspenseException = Error(
429
- "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`."
430
- );
431
- function trackUsedThenable(thenableState, thenable, index) {
432
- index = thenableState[index];
433
- void 0 === index
434
- ? thenableState.push(thenable)
435
- : index !== thenable && (thenable.then(noop, noop), (thenable = index));
436
- switch (thenable.status) {
437
- case "fulfilled":
438
- return thenable.value;
439
- case "rejected":
440
- throw thenable.reason;
441
- default:
442
- "string" === typeof thenable.status
443
- ? thenable.then(noop, noop)
444
- : ((thenableState = thenable),
445
- (thenableState.status = "pending"),
446
- thenableState.then(
447
- function (fulfilledValue) {
448
- if ("pending" === thenable.status) {
449
- var fulfilledThenable = thenable;
450
- fulfilledThenable.status = "fulfilled";
451
- fulfilledThenable.value = fulfilledValue;
452
- }
453
- },
454
- function (error) {
455
- if ("pending" === thenable.status) {
456
- var rejectedThenable = thenable;
457
- rejectedThenable.status = "rejected";
458
- rejectedThenable.reason = error;
459
- }
460
- }
461
- ));
462
- switch (thenable.status) {
463
- case "fulfilled":
464
- return thenable.value;
465
- case "rejected":
466
- throw thenable.reason;
467
- }
468
- suspendedThenable = thenable;
469
- throw SuspenseException;
470
- }
471
- }
472
- var suspendedThenable = null;
473
- function getSuspendedThenable() {
474
- if (null === suspendedThenable)
475
- throw Error(
476
- "Expected a suspended thenable. This is a bug in React. Please file an issue."
477
- );
478
- var thenable = suspendedThenable;
479
- suspendedThenable = null;
480
- return thenable;
481
- }
482
- var currentRequest$1 = null,
483
- thenableIndexCounter = 0,
484
- thenableState = null;
485
- function getThenableStateAfterSuspending() {
486
- var state = thenableState || [];
487
- thenableState = null;
488
- return state;
489
- }
490
- var HooksDispatcher = {
491
- readContext: unsupportedContext,
492
- use: use,
493
- useCallback: function (callback) {
494
- return callback;
495
- },
496
- useContext: unsupportedContext,
497
- useEffect: unsupportedHook,
498
- useImperativeHandle: unsupportedHook,
499
- useLayoutEffect: unsupportedHook,
500
- useInsertionEffect: unsupportedHook,
501
- useMemo: function (nextCreate) {
502
- return nextCreate();
503
- },
504
- useReducer: unsupportedHook,
505
- useRef: unsupportedHook,
506
- useState: unsupportedHook,
507
- useDebugValue: function () {},
508
- useDeferredValue: unsupportedHook,
509
- useTransition: unsupportedHook,
510
- useSyncExternalStore: unsupportedHook,
511
- useId: useId,
512
- useHostTransitionStatus: unsupportedHook,
513
- useFormState: unsupportedHook,
514
- useActionState: unsupportedHook,
515
- useOptimistic: unsupportedHook,
516
- useMemoCache: function (size) {
517
- for (var data = Array(size), i = 0; i < size; i++)
518
- data[i] = REACT_MEMO_CACHE_SENTINEL;
519
- return data;
520
- },
521
- useCacheRefresh: function () {
522
- return unsupportedRefresh;
523
- }
524
- };
525
- function unsupportedHook() {
526
- throw Error("This Hook is not supported in Server Components.");
527
- }
528
- function unsupportedRefresh() {
529
- throw Error("Refreshing the cache is not supported in Server Components.");
530
- }
531
- function unsupportedContext() {
532
- throw Error("Cannot read a Client Context from a Server Component.");
533
- }
534
- function useId() {
535
- if (null === currentRequest$1)
536
- throw Error("useId can only be used while React is rendering");
537
- var id = currentRequest$1.identifierCount++;
538
- return "_" + currentRequest$1.identifierPrefix + "S_" + id.toString(32) + "_";
539
- }
540
- function use(usable) {
541
- if (
542
- (null !== usable && "object" === typeof usable) ||
543
- "function" === typeof usable
544
- ) {
545
- if ("function" === typeof usable.then) {
546
- var index = thenableIndexCounter;
547
- thenableIndexCounter += 1;
548
- null === thenableState && (thenableState = []);
549
- return trackUsedThenable(thenableState, usable, index);
550
- }
551
- usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
552
- }
553
- if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
554
- if (null != usable.value && usable.value.$$typeof === REACT_CONTEXT_TYPE)
555
- throw Error("Cannot read a Client Context from a Server Component.");
556
- throw Error("Cannot use() an already resolved Client Reference.");
557
- }
558
- throw Error("An unsupported type was passed to use(): " + String(usable));
559
- }
560
- var DefaultAsyncDispatcher = {
561
- getCacheForType: function (resourceType) {
562
- var JSCompiler_inline_result = (JSCompiler_inline_result =
563
- resolveRequest())
564
- ? JSCompiler_inline_result.cache
565
- : new Map();
566
- var entry = JSCompiler_inline_result.get(resourceType);
567
- void 0 === entry &&
568
- ((entry = resourceType()),
569
- JSCompiler_inline_result.set(resourceType, entry));
570
- return entry;
571
- }
572
- },
573
- ReactSharedInternalsServer =
574
- React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
575
- if (!ReactSharedInternalsServer)
576
- throw Error(
577
- '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.'
578
- );
579
- var isArrayImpl = Array.isArray,
580
- getPrototypeOf = Object.getPrototypeOf;
581
- function objectName(object) {
582
- return Object.prototype.toString
583
- .call(object)
584
- .replace(/^\[object (.*)\]$/, function (m, p0) {
585
- return p0;
586
- });
587
- }
588
- function describeValueForErrorMessage(value) {
589
- switch (typeof value) {
590
- case "string":
591
- return JSON.stringify(
592
- 10 >= value.length ? value : value.slice(0, 10) + "..."
593
- );
594
- case "object":
595
- if (isArrayImpl(value)) return "[...]";
596
- if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
597
- return "client";
598
- value = objectName(value);
599
- return "Object" === value ? "{...}" : value;
600
- case "function":
601
- return value.$$typeof === CLIENT_REFERENCE_TAG
602
- ? "client"
603
- : (value = value.displayName || value.name)
604
- ? "function " + value
605
- : "function";
606
- default:
607
- return String(value);
608
- }
609
- }
610
- function describeElementType(type) {
611
- if ("string" === typeof type) return type;
612
- switch (type) {
613
- case REACT_SUSPENSE_TYPE:
614
- return "Suspense";
615
- case REACT_SUSPENSE_LIST_TYPE:
616
- return "SuspenseList";
617
- }
618
- if ("object" === typeof type)
619
- switch (type.$$typeof) {
620
- case REACT_FORWARD_REF_TYPE:
621
- return describeElementType(type.render);
622
- case REACT_MEMO_TYPE:
623
- return describeElementType(type.type);
624
- case REACT_LAZY_TYPE:
625
- var payload = type._payload;
626
- type = type._init;
627
- try {
628
- return describeElementType(type(payload));
629
- } catch (x) {}
630
- }
631
- return "";
632
- }
633
- var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
634
- function describeObjectForErrorMessage(objectOrArray, expandedName) {
635
- var objKind = objectName(objectOrArray);
636
- if ("Object" !== objKind && "Array" !== objKind) return objKind;
637
- objKind = -1;
638
- var length = 0;
639
- if (isArrayImpl(objectOrArray)) {
640
- var str = "[";
641
- for (var i = 0; i < objectOrArray.length; i++) {
642
- 0 < i && (str += ", ");
643
- var value = objectOrArray[i];
644
- value =
645
- "object" === typeof value && null !== value
646
- ? describeObjectForErrorMessage(value)
647
- : describeValueForErrorMessage(value);
648
- "" + i === expandedName
649
- ? ((objKind = str.length), (length = value.length), (str += value))
650
- : (str =
651
- 10 > value.length && 40 > str.length + value.length
652
- ? str + value
653
- : str + "...");
654
- }
655
- str += "]";
656
- } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
657
- str = "<" + describeElementType(objectOrArray.type) + "/>";
658
- else {
659
- if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
660
- str = "{";
661
- i = Object.keys(objectOrArray);
662
- for (value = 0; value < i.length; value++) {
663
- 0 < value && (str += ", ");
664
- var name = i[value],
665
- encodedKey = JSON.stringify(name);
666
- str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": ";
667
- encodedKey = objectOrArray[name];
668
- encodedKey =
669
- "object" === typeof encodedKey && null !== encodedKey
670
- ? describeObjectForErrorMessage(encodedKey)
671
- : describeValueForErrorMessage(encodedKey);
672
- name === expandedName
673
- ? ((objKind = str.length),
674
- (length = encodedKey.length),
675
- (str += encodedKey))
676
- : (str =
677
- 10 > encodedKey.length && 40 > str.length + encodedKey.length
678
- ? str + encodedKey
679
- : str + "...");
680
- }
681
- str += "}";
682
- }
683
- return void 0 === expandedName
684
- ? str
685
- : -1 < objKind && 0 < length
686
- ? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)),
687
- "\n " + str + "\n " + objectOrArray)
688
- : "\n " + str;
689
- }
690
- var ObjectPrototype = Object.prototype,
691
- stringify = JSON.stringify;
692
- function defaultErrorHandler(error) {
693
- console.error(error);
694
- }
695
- function RequestInstance(
696
- type,
697
- model,
698
- bundlerConfig,
699
- onError,
700
- identifierPrefix,
701
- onPostpone,
702
- temporaryReferences,
703
- environmentName,
704
- filterStackFrame,
705
- onAllReady,
706
- onFatalError
707
- ) {
708
- if (
709
- null !== ReactSharedInternalsServer.A &&
710
- ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
711
- )
712
- throw Error("Currently React only supports one RSC renderer at a time.");
713
- ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
714
- filterStackFrame = new Set();
715
- environmentName = [];
716
- var hints = new Set();
717
- this.type = type;
718
- this.status = 10;
719
- this.flushScheduled = !1;
720
- this.destination = this.fatalError = null;
721
- this.bundlerConfig = bundlerConfig;
722
- this.cache = new Map();
723
- this.pendingChunks = this.nextChunkId = 0;
724
- this.hints = hints;
725
- this.abortListeners = new Set();
726
- this.abortableTasks = filterStackFrame;
727
- this.pingedTasks = environmentName;
728
- this.completedImportChunks = [];
729
- this.completedHintChunks = [];
730
- this.completedRegularChunks = [];
731
- this.completedErrorChunks = [];
732
- this.writtenSymbols = new Map();
733
- this.writtenClientReferences = new Map();
734
- this.writtenServerReferences = new Map();
735
- this.writtenObjects = new WeakMap();
736
- this.temporaryReferences = temporaryReferences;
737
- this.identifierPrefix = identifierPrefix || "";
738
- this.identifierCount = 1;
739
- this.taintCleanupQueue = [];
740
- this.onError = void 0 === onError ? defaultErrorHandler : onError;
741
- this.onPostpone = void 0 === onPostpone ? noop : onPostpone;
742
- this.onAllReady = onAllReady;
743
- this.onFatalError = onFatalError;
744
- type = createTask(this, model, null, !1, filterStackFrame);
745
- environmentName.push(type);
746
- }
747
- var currentRequest = null;
748
- function resolveRequest() {
749
- if (currentRequest) return currentRequest;
750
- var store = requestStorage.getStore();
751
- return store ? store : null;
752
- }
753
- function serializeThenable(request, task, thenable) {
754
- var newTask = createTask(
755
- request,
756
- null,
757
- task.keyPath,
758
- task.implicitSlot,
759
- request.abortableTasks
760
- );
761
- switch (thenable.status) {
762
- case "fulfilled":
763
- return (
764
- (newTask.model = thenable.value), pingTask(request, newTask), newTask.id
765
- );
766
- case "rejected":
767
- return erroredTask(request, newTask, thenable.reason), newTask.id;
768
- default:
769
- if (12 === request.status)
770
- return (
771
- request.abortableTasks.delete(newTask),
772
- (newTask.status = 3),
773
- (task = stringify(serializeByValueID(request.fatalError))),
774
- emitModelChunk(request, newTask.id, task),
775
- newTask.id
776
- );
777
- "string" !== typeof thenable.status &&
778
- ((thenable.status = "pending"),
779
- thenable.then(
780
- function (fulfilledValue) {
781
- "pending" === thenable.status &&
782
- ((thenable.status = "fulfilled"),
783
- (thenable.value = fulfilledValue));
784
- },
785
- function (error) {
786
- "pending" === thenable.status &&
787
- ((thenable.status = "rejected"), (thenable.reason = error));
788
- }
789
- ));
790
- }
791
- thenable.then(
792
- function (value) {
793
- newTask.model = value;
794
- pingTask(request, newTask);
795
- },
796
- function (reason) {
797
- 0 === newTask.status &&
798
- (erroredTask(request, newTask, reason), enqueueFlush(request));
799
- }
800
- );
801
- return newTask.id;
802
- }
803
- function serializeReadableStream(request, task, stream) {
804
- function progress(entry) {
805
- if (!aborted)
806
- if (entry.done)
807
- (entry = streamTask.id.toString(16) + ":C\n"),
808
- request.completedRegularChunks.push(stringToChunk(entry)),
809
- enqueueFlush(request),
810
- request.abortListeners.delete(abortStream),
811
- callOnAllReadyIfReady(request),
812
- (aborted = !0);
813
- else
814
- try {
815
- (streamTask.model = entry.value),
816
- request.pendingChunks++,
817
- tryStreamTask(request, streamTask),
818
- enqueueFlush(request),
819
- reader.read().then(progress, error);
820
- } catch (x$9) {
821
- error(x$9);
822
- }
823
- }
824
- function error(reason) {
825
- aborted ||
826
- ((aborted = !0),
827
- request.abortListeners.delete(abortStream),
828
- erroredTask(request, streamTask, reason),
829
- enqueueFlush(request),
830
- reader.cancel(reason).then(error, error));
831
- }
832
- function abortStream(reason) {
833
- aborted ||
834
- ((aborted = !0),
835
- request.abortListeners.delete(abortStream),
836
- erroredTask(request, streamTask, reason),
837
- enqueueFlush(request),
838
- reader.cancel(reason).then(error, error));
839
- }
840
- var supportsBYOB = stream.supportsBYOB;
841
- if (void 0 === supportsBYOB)
842
- try {
843
- stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0);
844
- } catch (x) {
845
- supportsBYOB = !1;
846
- }
847
- var reader = stream.getReader(),
848
- streamTask = createTask(
849
- request,
850
- task.model,
851
- task.keyPath,
852
- task.implicitSlot,
853
- request.abortableTasks
854
- );
855
- request.abortableTasks.delete(streamTask);
856
- request.pendingChunks++;
857
- task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
858
- request.completedRegularChunks.push(stringToChunk(task));
859
- var aborted = !1;
860
- request.abortListeners.add(abortStream);
861
- reader.read().then(progress, error);
862
- return serializeByValueID(streamTask.id);
863
- }
864
- function serializeAsyncIterable(request, task, iterable, iterator) {
865
- function progress(entry) {
866
- if (!aborted)
867
- if (entry.done) {
868
- if (void 0 === entry.value)
869
- var endStreamRow = streamTask.id.toString(16) + ":C\n";
870
- else
871
- try {
872
- var chunkId = outlineModel(request, entry.value);
873
- endStreamRow =
874
- streamTask.id.toString(16) +
875
- ":C" +
876
- stringify(serializeByValueID(chunkId)) +
877
- "\n";
878
- } catch (x) {
879
- error(x);
880
- return;
881
- }
882
- request.completedRegularChunks.push(stringToChunk(endStreamRow));
883
- enqueueFlush(request);
884
- request.abortListeners.delete(abortIterable);
885
- callOnAllReadyIfReady(request);
886
- aborted = !0;
887
- } else
888
- try {
889
- (streamTask.model = entry.value),
890
- request.pendingChunks++,
891
- tryStreamTask(request, streamTask),
892
- enqueueFlush(request),
893
- iterator.next().then(progress, error);
894
- } catch (x$10) {
895
- error(x$10);
896
- }
897
- }
898
- function error(reason) {
899
- aborted ||
900
- ((aborted = !0),
901
- request.abortListeners.delete(abortIterable),
902
- erroredTask(request, streamTask, reason),
903
- enqueueFlush(request),
904
- "function" === typeof iterator.throw &&
905
- iterator.throw(reason).then(error, error));
906
- }
907
- function abortIterable(reason) {
908
- aborted ||
909
- ((aborted = !0),
910
- request.abortListeners.delete(abortIterable),
911
- erroredTask(request, streamTask, reason),
912
- enqueueFlush(request),
913
- "function" === typeof iterator.throw &&
914
- iterator.throw(reason).then(error, error));
915
- }
916
- iterable = iterable === iterator;
917
- var streamTask = createTask(
918
- request,
919
- task.model,
920
- task.keyPath,
921
- task.implicitSlot,
922
- request.abortableTasks
923
- );
924
- request.abortableTasks.delete(streamTask);
925
- request.pendingChunks++;
926
- task = streamTask.id.toString(16) + ":" + (iterable ? "x" : "X") + "\n";
927
- request.completedRegularChunks.push(stringToChunk(task));
928
- var aborted = !1;
929
- request.abortListeners.add(abortIterable);
930
- iterator.next().then(progress, error);
931
- return serializeByValueID(streamTask.id);
932
- }
933
- function emitHint(request, code, model) {
934
- model = stringify(model);
935
- code = stringToChunk(":H" + code + model + "\n");
936
- request.completedHintChunks.push(code);
937
- enqueueFlush(request);
938
- }
939
- function readThenable(thenable) {
940
- if ("fulfilled" === thenable.status) return thenable.value;
941
- if ("rejected" === thenable.status) throw thenable.reason;
942
- throw thenable;
943
- }
944
- function createLazyWrapperAroundWakeable(wakeable) {
945
- switch (wakeable.status) {
946
- case "fulfilled":
947
- case "rejected":
948
- break;
949
- default:
950
- "string" !== typeof wakeable.status &&
951
- ((wakeable.status = "pending"),
952
- wakeable.then(
953
- function (fulfilledValue) {
954
- "pending" === wakeable.status &&
955
- ((wakeable.status = "fulfilled"),
956
- (wakeable.value = fulfilledValue));
957
- },
958
- function (error) {
959
- "pending" === wakeable.status &&
960
- ((wakeable.status = "rejected"), (wakeable.reason = error));
961
- }
962
- ));
963
- }
964
- return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
965
- }
966
- function voidHandler() {}
967
- function processServerComponentReturnValue(request, task, Component, result) {
968
- if (
969
- "object" !== typeof result ||
970
- null === result ||
971
- result.$$typeof === CLIENT_REFERENCE_TAG$1
972
- )
973
- return result;
974
- if ("function" === typeof result.then)
975
- return "fulfilled" === result.status
976
- ? result.value
977
- : createLazyWrapperAroundWakeable(result);
978
- var iteratorFn = getIteratorFn(result);
979
- return iteratorFn
980
- ? ((request = {}),
981
- (request[Symbol.iterator] = function () {
982
- return iteratorFn.call(result);
983
- }),
984
- request)
985
- : "function" !== typeof result[ASYNC_ITERATOR] ||
986
- ("function" === typeof ReadableStream &&
987
- result instanceof ReadableStream)
988
- ? result
989
- : ((request = {}),
990
- (request[ASYNC_ITERATOR] = function () {
991
- return result[ASYNC_ITERATOR]();
992
- }),
993
- request);
994
- }
995
- function renderFunctionComponent(request, task, key, Component, props) {
996
- var prevThenableState = task.thenableState;
997
- task.thenableState = null;
998
- thenableIndexCounter = 0;
999
- thenableState = prevThenableState;
1000
- props = Component(props, void 0);
1001
- if (12 === request.status)
1002
- throw (
1003
- ("object" === typeof props &&
1004
- null !== props &&
1005
- "function" === typeof props.then &&
1006
- props.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
1007
- props.then(voidHandler, voidHandler),
1008
- null)
1009
- );
1010
- props = processServerComponentReturnValue(request, task, Component, props);
1011
- Component = task.keyPath;
1012
- prevThenableState = task.implicitSlot;
1013
- null !== key
1014
- ? (task.keyPath = null === Component ? key : Component + "," + key)
1015
- : null === Component && (task.implicitSlot = !0);
1016
- request = renderModelDestructive(request, task, emptyRoot, "", props);
1017
- task.keyPath = Component;
1018
- task.implicitSlot = prevThenableState;
1019
- return request;
1020
- }
1021
- function renderFragment(request, task, children) {
1022
- return null !== task.keyPath
1023
- ? ((request = [
1024
- REACT_ELEMENT_TYPE,
1025
- REACT_FRAGMENT_TYPE,
1026
- task.keyPath,
1027
- { children: children }
1028
- ]),
1029
- task.implicitSlot ? [request] : request)
1030
- : children;
1031
- }
1032
- var serializedSize = 0;
1033
- function deferTask(request, task) {
1034
- task = createTask(
1035
- request,
1036
- task.model,
1037
- task.keyPath,
1038
- task.implicitSlot,
1039
- request.abortableTasks
1040
- );
1041
- pingTask(request, task);
1042
- return "$L" + task.id.toString(16);
1043
- }
1044
- function renderElement(request, task, type, key, ref, props) {
1045
- if (null !== ref && void 0 !== ref)
1046
- throw Error(
1047
- "Refs cannot be used in Server Components, nor passed to Client Components."
1048
- );
1049
- if (
1050
- "function" === typeof type &&
1051
- type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
1052
- type.$$typeof !== TEMPORARY_REFERENCE_TAG
1053
- )
1054
- return renderFunctionComponent(request, task, key, type, props);
1055
- if (type === REACT_FRAGMENT_TYPE && null === key)
1056
- return (
1057
- (type = task.implicitSlot),
1058
- null === task.keyPath && (task.implicitSlot = !0),
1059
- (props = renderModelDestructive(
1060
- request,
1061
- task,
1062
- emptyRoot,
1063
- "",
1064
- props.children
1065
- )),
1066
- (task.implicitSlot = type),
1067
- props
1068
- );
1069
- if (
1070
- null != type &&
1071
- "object" === typeof type &&
1072
- type.$$typeof !== CLIENT_REFERENCE_TAG$1
1073
- )
1074
- switch (type.$$typeof) {
1075
- case REACT_LAZY_TYPE:
1076
- var init = type._init;
1077
- type = init(type._payload);
1078
- if (12 === request.status) throw null;
1079
- return renderElement(request, task, type, key, ref, props);
1080
- case REACT_FORWARD_REF_TYPE:
1081
- return renderFunctionComponent(request, task, key, type.render, props);
1082
- case REACT_MEMO_TYPE:
1083
- return renderElement(request, task, type.type, key, ref, props);
1084
- }
1085
- request = key;
1086
- key = task.keyPath;
1087
- null === request
1088
- ? (request = key)
1089
- : null !== key && (request = key + "," + request);
1090
- props = [REACT_ELEMENT_TYPE, type, request, props];
1091
- task = task.implicitSlot && null !== request ? [props] : props;
1092
- return task;
1093
- }
1094
- function pingTask(request, task) {
1095
- var pingedTasks = request.pingedTasks;
1096
- pingedTasks.push(task);
1097
- 1 === pingedTasks.length &&
1098
- ((request.flushScheduled = null !== request.destination),
1099
- 21 === request.type || 10 === request.status
1100
- ? scheduleMicrotask(function () {
1101
- return performWork(request);
1102
- })
1103
- : setImmediate(function () {
1104
- return performWork(request);
1105
- }));
1106
- }
1107
- function createTask(request, model, keyPath, implicitSlot, abortSet) {
1108
- request.pendingChunks++;
1109
- var id = request.nextChunkId++;
1110
- "object" !== typeof model ||
1111
- null === model ||
1112
- null !== keyPath ||
1113
- implicitSlot ||
1114
- request.writtenObjects.set(model, serializeByValueID(id));
1115
- var task = {
1116
- id: id,
1117
- status: 0,
1118
- model: model,
1119
- keyPath: keyPath,
1120
- implicitSlot: implicitSlot,
1121
- ping: function () {
1122
- return pingTask(request, task);
1123
- },
1124
- toJSON: function (parentPropertyName, value) {
1125
- serializedSize += parentPropertyName.length;
1126
- var prevKeyPath = task.keyPath,
1127
- prevImplicitSlot = task.implicitSlot;
1128
- try {
1129
- var JSCompiler_inline_result = renderModelDestructive(
1130
- request,
1131
- task,
1132
- this,
1133
- parentPropertyName,
1134
- value
1135
- );
1136
- } catch (thrownValue) {
1137
- if (
1138
- ((parentPropertyName = task.model),
1139
- (parentPropertyName =
1140
- "object" === typeof parentPropertyName &&
1141
- null !== parentPropertyName &&
1142
- (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
1143
- parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
1144
- 12 === request.status)
1145
- )
1146
- (task.status = 3),
1147
- (prevKeyPath = request.fatalError),
1148
- (JSCompiler_inline_result = parentPropertyName
1149
- ? "$L" + prevKeyPath.toString(16)
1150
- : serializeByValueID(prevKeyPath));
1151
- else if (
1152
- ((value =
1153
- thrownValue === SuspenseException
1154
- ? getSuspendedThenable()
1155
- : thrownValue),
1156
- "object" === typeof value &&
1157
- null !== value &&
1158
- "function" === typeof value.then)
1159
- ) {
1160
- JSCompiler_inline_result = createTask(
1161
- request,
1162
- task.model,
1163
- task.keyPath,
1164
- task.implicitSlot,
1165
- request.abortableTasks
1166
- );
1167
- var ping = JSCompiler_inline_result.ping;
1168
- value.then(ping, ping);
1169
- JSCompiler_inline_result.thenableState =
1170
- getThenableStateAfterSuspending();
1171
- task.keyPath = prevKeyPath;
1172
- task.implicitSlot = prevImplicitSlot;
1173
- JSCompiler_inline_result = parentPropertyName
1174
- ? "$L" + JSCompiler_inline_result.id.toString(16)
1175
- : serializeByValueID(JSCompiler_inline_result.id);
1176
- } else
1177
- (task.keyPath = prevKeyPath),
1178
- (task.implicitSlot = prevImplicitSlot),
1179
- request.pendingChunks++,
1180
- (prevKeyPath = request.nextChunkId++),
1181
- (prevImplicitSlot = logRecoverableError(request, value, task)),
1182
- emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1183
- (JSCompiler_inline_result = parentPropertyName
1184
- ? "$L" + prevKeyPath.toString(16)
1185
- : serializeByValueID(prevKeyPath));
1186
- }
1187
- return JSCompiler_inline_result;
1188
- },
1189
- thenableState: null
1190
- };
1191
- abortSet.add(task);
1192
- return task;
1193
- }
1194
- function serializeByValueID(id) {
1195
- return "$" + id.toString(16);
1196
- }
1197
- function encodeReferenceChunk(request, id, reference) {
1198
- request = stringify(reference);
1199
- id = id.toString(16) + ":" + request + "\n";
1200
- return stringToChunk(id);
1201
- }
1202
- function serializeClientReference(
1203
- request,
1204
- parent,
1205
- parentPropertyName,
1206
- clientReference
1207
- ) {
1208
- var clientReferenceKey = clientReference.$$async
1209
- ? clientReference.$$id + "#async"
1210
- : clientReference.$$id,
1211
- writtenClientReferences = request.writtenClientReferences,
1212
- existingId = writtenClientReferences.get(clientReferenceKey);
1213
- if (void 0 !== existingId)
1214
- return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1215
- ? "$L" + existingId.toString(16)
1216
- : serializeByValueID(existingId);
1217
- try {
1218
- var config = request.bundlerConfig,
1219
- modulePath = clientReference.$$id;
1220
- existingId = "";
1221
- var resolvedModuleData = config[modulePath];
1222
- if (resolvedModuleData) existingId = resolvedModuleData.name;
1223
- else {
1224
- var idx = modulePath.lastIndexOf("#");
1225
- -1 !== idx &&
1226
- ((existingId = modulePath.slice(idx + 1)),
1227
- (resolvedModuleData = config[modulePath.slice(0, idx)]));
1228
- if (!resolvedModuleData)
1229
- throw Error(
1230
- 'Could not find the module "' +
1231
- modulePath +
1232
- '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
1233
- );
1234
- }
1235
- if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
1236
- throw Error(
1237
- 'The module "' +
1238
- modulePath +
1239
- '" 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.'
1240
- );
1241
- var JSCompiler_inline_result =
1242
- !0 === resolvedModuleData.async || !0 === clientReference.$$async
1243
- ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1244
- : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
1245
- request.pendingChunks++;
1246
- var importId = request.nextChunkId++,
1247
- json = stringify(JSCompiler_inline_result),
1248
- row = importId.toString(16) + ":I" + json + "\n",
1249
- processedChunk = stringToChunk(row);
1250
- request.completedImportChunks.push(processedChunk);
1251
- writtenClientReferences.set(clientReferenceKey, importId);
1252
- return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1253
- ? "$L" + importId.toString(16)
1254
- : serializeByValueID(importId);
1255
- } catch (x) {
1256
- return (
1257
- request.pendingChunks++,
1258
- (parent = request.nextChunkId++),
1259
- (parentPropertyName = logRecoverableError(request, x, null)),
1260
- emitErrorChunk(request, parent, parentPropertyName),
1261
- serializeByValueID(parent)
1262
- );
1263
- }
1264
- }
1265
- function outlineModel(request, value) {
1266
- value = createTask(request, value, null, !1, request.abortableTasks);
1267
- retryTask(request, value);
1268
- return value.id;
1269
- }
1270
- function serializeTypedArray(request, tag, typedArray) {
1271
- request.pendingChunks++;
1272
- var bufferId = request.nextChunkId++;
1273
- emitTypedArrayChunk(request, bufferId, tag, typedArray);
1274
- return serializeByValueID(bufferId);
1275
- }
1276
- function serializeBlob(request, blob) {
1277
- function progress(entry) {
1278
- if (!aborted)
1279
- if (entry.done)
1280
- request.abortListeners.delete(abortBlob),
1281
- (aborted = !0),
1282
- pingTask(request, newTask);
1283
- else
1284
- return (
1285
- model.push(entry.value), reader.read().then(progress).catch(error)
1286
- );
1287
- }
1288
- function error(reason) {
1289
- aborted ||
1290
- ((aborted = !0),
1291
- request.abortListeners.delete(abortBlob),
1292
- erroredTask(request, newTask, reason),
1293
- enqueueFlush(request),
1294
- reader.cancel(reason).then(error, error));
1295
- }
1296
- function abortBlob(reason) {
1297
- aborted ||
1298
- ((aborted = !0),
1299
- request.abortListeners.delete(abortBlob),
1300
- erroredTask(request, newTask, reason),
1301
- enqueueFlush(request),
1302
- reader.cancel(reason).then(error, error));
1303
- }
1304
- var model = [blob.type],
1305
- newTask = createTask(request, model, null, !1, request.abortableTasks),
1306
- reader = blob.stream().getReader(),
1307
- aborted = !1;
1308
- request.abortListeners.add(abortBlob);
1309
- reader.read().then(progress).catch(error);
1310
- return "$B" + newTask.id.toString(16);
1311
- }
1312
- var modelRoot = !1;
1313
- function renderModelDestructive(
1314
- request,
1315
- task,
1316
- parent,
1317
- parentPropertyName,
1318
- value
1319
- ) {
1320
- task.model = value;
1321
- if (value === REACT_ELEMENT_TYPE) return "$";
1322
- if (null === value) return null;
1323
- if ("object" === typeof value) {
1324
- switch (value.$$typeof) {
1325
- case REACT_ELEMENT_TYPE:
1326
- var elementReference = null,
1327
- writtenObjects = request.writtenObjects;
1328
- if (null === task.keyPath && !task.implicitSlot) {
1329
- var existingReference = writtenObjects.get(value);
1330
- if (void 0 !== existingReference)
1331
- if (modelRoot === value) modelRoot = null;
1332
- else return existingReference;
1333
- else
1334
- -1 === parentPropertyName.indexOf(":") &&
1335
- ((parent = writtenObjects.get(parent)),
1336
- void 0 !== parent &&
1337
- ((elementReference = parent + ":" + parentPropertyName),
1338
- writtenObjects.set(value, elementReference)));
1339
- }
1340
- if (3200 < serializedSize) return deferTask(request, task);
1341
- parentPropertyName = value.props;
1342
- parent = parentPropertyName.ref;
1343
- request = renderElement(
1344
- request,
1345
- task,
1346
- value.type,
1347
- value.key,
1348
- void 0 !== parent ? parent : null,
1349
- parentPropertyName
1350
- );
1351
- "object" === typeof request &&
1352
- null !== request &&
1353
- null !== elementReference &&
1354
- (writtenObjects.has(request) ||
1355
- writtenObjects.set(request, elementReference));
1356
- return request;
1357
- case REACT_LAZY_TYPE:
1358
- if (3200 < serializedSize) return deferTask(request, task);
1359
- task.thenableState = null;
1360
- parentPropertyName = value._init;
1361
- value = parentPropertyName(value._payload);
1362
- if (12 === request.status) throw null;
1363
- return renderModelDestructive(request, task, emptyRoot, "", value);
1364
- case REACT_LEGACY_ELEMENT_TYPE:
1365
- throw Error(
1366
- '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.'
1367
- );
1368
- }
1369
- if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1370
- return serializeClientReference(
1371
- request,
1372
- parent,
1373
- parentPropertyName,
1374
- value
1375
- );
1376
- if (
1377
- void 0 !== request.temporaryReferences &&
1378
- ((elementReference = request.temporaryReferences.get(value)),
1379
- void 0 !== elementReference)
1380
- )
1381
- return "$T" + elementReference;
1382
- elementReference = request.writtenObjects;
1383
- writtenObjects = elementReference.get(value);
1384
- if ("function" === typeof value.then) {
1385
- if (void 0 !== writtenObjects) {
1386
- if (null !== task.keyPath || task.implicitSlot)
1387
- return "$@" + serializeThenable(request, task, value).toString(16);
1388
- if (modelRoot === value) modelRoot = null;
1389
- else return writtenObjects;
1390
- }
1391
- request = "$@" + serializeThenable(request, task, value).toString(16);
1392
- elementReference.set(value, request);
1393
- return request;
1394
- }
1395
- if (void 0 !== writtenObjects)
1396
- if (modelRoot === value) modelRoot = null;
1397
- else return writtenObjects;
1398
- else if (
1399
- -1 === parentPropertyName.indexOf(":") &&
1400
- ((writtenObjects = elementReference.get(parent)),
1401
- void 0 !== writtenObjects)
1402
- ) {
1403
- existingReference = parentPropertyName;
1404
- if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1405
- switch (parentPropertyName) {
1406
- case "1":
1407
- existingReference = "type";
1408
- break;
1409
- case "2":
1410
- existingReference = "key";
1411
- break;
1412
- case "3":
1413
- existingReference = "props";
1414
- break;
1415
- case "4":
1416
- existingReference = "_owner";
1417
- }
1418
- elementReference.set(value, writtenObjects + ":" + existingReference);
1419
- }
1420
- if (isArrayImpl(value)) return renderFragment(request, task, value);
1421
- if (value instanceof Map)
1422
- return (
1423
- (value = Array.from(value)),
1424
- "$Q" + outlineModel(request, value).toString(16)
1425
- );
1426
- if (value instanceof Set)
1427
- return (
1428
- (value = Array.from(value)),
1429
- "$W" + outlineModel(request, value).toString(16)
1430
- );
1431
- if ("function" === typeof FormData && value instanceof FormData)
1432
- return (
1433
- (value = Array.from(value.entries())),
1434
- "$K" + outlineModel(request, value).toString(16)
1435
- );
1436
- if (value instanceof Error) return "$Z";
1437
- if (value instanceof ArrayBuffer)
1438
- return serializeTypedArray(request, "A", new Uint8Array(value));
1439
- if (value instanceof Int8Array)
1440
- return serializeTypedArray(request, "O", value);
1441
- if (value instanceof Uint8Array)
1442
- return serializeTypedArray(request, "o", value);
1443
- if (value instanceof Uint8ClampedArray)
1444
- return serializeTypedArray(request, "U", value);
1445
- if (value instanceof Int16Array)
1446
- return serializeTypedArray(request, "S", value);
1447
- if (value instanceof Uint16Array)
1448
- return serializeTypedArray(request, "s", value);
1449
- if (value instanceof Int32Array)
1450
- return serializeTypedArray(request, "L", value);
1451
- if (value instanceof Uint32Array)
1452
- return serializeTypedArray(request, "l", value);
1453
- if (value instanceof Float32Array)
1454
- return serializeTypedArray(request, "G", value);
1455
- if (value instanceof Float64Array)
1456
- return serializeTypedArray(request, "g", value);
1457
- if (value instanceof BigInt64Array)
1458
- return serializeTypedArray(request, "M", value);
1459
- if (value instanceof BigUint64Array)
1460
- return serializeTypedArray(request, "m", value);
1461
- if (value instanceof DataView)
1462
- return serializeTypedArray(request, "V", value);
1463
- if ("function" === typeof Blob && value instanceof Blob)
1464
- return serializeBlob(request, value);
1465
- if ((elementReference = getIteratorFn(value)))
1466
- return (
1467
- (parentPropertyName = elementReference.call(value)),
1468
- parentPropertyName === value
1469
- ? "$i" +
1470
- outlineModel(request, Array.from(parentPropertyName)).toString(16)
1471
- : renderFragment(request, task, Array.from(parentPropertyName))
1472
- );
1473
- if ("function" === typeof ReadableStream && value instanceof ReadableStream)
1474
- return serializeReadableStream(request, task, value);
1475
- elementReference = value[ASYNC_ITERATOR];
1476
- if ("function" === typeof elementReference)
1477
- return (
1478
- null !== task.keyPath
1479
- ? ((request = [
1480
- REACT_ELEMENT_TYPE,
1481
- REACT_FRAGMENT_TYPE,
1482
- task.keyPath,
1483
- { children: value }
1484
- ]),
1485
- (request = task.implicitSlot ? [request] : request))
1486
- : ((parentPropertyName = elementReference.call(value)),
1487
- (request = serializeAsyncIterable(
1488
- request,
1489
- task,
1490
- value,
1491
- parentPropertyName
1492
- ))),
1493
- request
1494
- );
1495
- if (value instanceof Date) return "$D" + value.toJSON();
1496
- request = getPrototypeOf(value);
1497
- if (
1498
- request !== ObjectPrototype &&
1499
- (null === request || null !== getPrototypeOf(request))
1500
- )
1501
- throw Error(
1502
- "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." +
1503
- describeObjectForErrorMessage(parent, parentPropertyName)
1504
- );
1505
- return value;
1506
- }
1507
- if ("string" === typeof value) {
1508
- serializedSize += value.length;
1509
- if (
1510
- "Z" === value[value.length - 1] &&
1511
- parent[parentPropertyName] instanceof Date
1512
- )
1513
- return "$D" + value;
1514
- if (1024 <= value.length && null !== byteLengthOfChunk)
1515
- return (
1516
- request.pendingChunks++,
1517
- (task = request.nextChunkId++),
1518
- emitTextChunk(request, task, value),
1519
- serializeByValueID(task)
1520
- );
1521
- request = "$" === value[0] ? "$" + value : value;
1522
- return request;
1523
- }
1524
- if ("boolean" === typeof value) return value;
1525
- if ("number" === typeof value)
1526
- return Number.isFinite(value)
1527
- ? 0 === value && -Infinity === 1 / value
1528
- ? "$-0"
1529
- : value
1530
- : Infinity === value
1531
- ? "$Infinity"
1532
- : -Infinity === value
1533
- ? "$-Infinity"
1534
- : "$NaN";
1535
- if ("undefined" === typeof value) return "$undefined";
1536
- if ("function" === typeof value) {
1537
- if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1538
- return serializeClientReference(
1539
- request,
1540
- parent,
1541
- parentPropertyName,
1542
- value
1543
- );
1544
- if (value.$$typeof === SERVER_REFERENCE_TAG)
1545
- return (
1546
- (task = request.writtenServerReferences),
1547
- (parentPropertyName = task.get(value)),
1548
- void 0 !== parentPropertyName
1549
- ? (request = "$F" + parentPropertyName.toString(16))
1550
- : ((parentPropertyName = value.$$bound),
1551
- (parentPropertyName =
1552
- null === parentPropertyName
1553
- ? null
1554
- : Promise.resolve(parentPropertyName)),
1555
- (request = outlineModel(request, {
1556
- id: value.$$id,
1557
- bound: parentPropertyName
1558
- })),
1559
- task.set(value, request),
1560
- (request = "$F" + request.toString(16))),
1561
- request
1562
- );
1563
- if (
1564
- void 0 !== request.temporaryReferences &&
1565
- ((request = request.temporaryReferences.get(value)), void 0 !== request)
1566
- )
1567
- return "$T" + request;
1568
- if (value.$$typeof === TEMPORARY_REFERENCE_TAG)
1569
- throw Error(
1570
- "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
1571
- );
1572
- if (/^on[A-Z]/.test(parentPropertyName))
1573
- throw Error(
1574
- "Event handlers cannot be passed to Client Component props." +
1575
- describeObjectForErrorMessage(parent, parentPropertyName) +
1576
- "\nIf you need interactivity, consider converting part of this to a Client Component."
1577
- );
1578
- throw Error(
1579
- '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.' +
1580
- describeObjectForErrorMessage(parent, parentPropertyName)
1581
- );
1582
- }
1583
- if ("symbol" === typeof value) {
1584
- task = request.writtenSymbols;
1585
- elementReference = task.get(value);
1586
- if (void 0 !== elementReference)
1587
- return serializeByValueID(elementReference);
1588
- elementReference = value.description;
1589
- if (Symbol.for(elementReference) !== value)
1590
- throw Error(
1591
- "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1592
- (value.description + ") cannot be found among global symbols.") +
1593
- describeObjectForErrorMessage(parent, parentPropertyName)
1594
- );
1595
- request.pendingChunks++;
1596
- parentPropertyName = request.nextChunkId++;
1597
- parent = encodeReferenceChunk(
1598
- request,
1599
- parentPropertyName,
1600
- "$S" + elementReference
1601
- );
1602
- request.completedImportChunks.push(parent);
1603
- task.set(value, parentPropertyName);
1604
- return serializeByValueID(parentPropertyName);
1605
- }
1606
- if ("bigint" === typeof value) return "$n" + value.toString(10);
1607
- throw Error(
1608
- "Type " +
1609
- typeof value +
1610
- " is not supported in Client Component props." +
1611
- describeObjectForErrorMessage(parent, parentPropertyName)
1612
- );
1613
- }
1614
- function logRecoverableError(request, error) {
1615
- var prevRequest = currentRequest;
1616
- currentRequest = null;
1617
- try {
1618
- var errorDigest = requestStorage.run(void 0, request.onError, error);
1619
- } finally {
1620
- currentRequest = prevRequest;
1621
- }
1622
- if (null != errorDigest && "string" !== typeof errorDigest)
1623
- throw Error(
1624
- '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 "' +
1625
- typeof errorDigest +
1626
- '" instead'
1627
- );
1628
- return errorDigest || "";
1629
- }
1630
- function fatalError(request, error) {
1631
- var onFatalError = request.onFatalError;
1632
- onFatalError(error);
1633
- null !== request.destination
1634
- ? ((request.status = 14), closeWithError(request.destination, error))
1635
- : ((request.status = 13), (request.fatalError = error));
1636
- }
1637
- function emitErrorChunk(request, id, digest) {
1638
- digest = { digest: digest };
1639
- id = id.toString(16) + ":E" + stringify(digest) + "\n";
1640
- id = stringToChunk(id);
1641
- request.completedErrorChunks.push(id);
1642
- }
1643
- function emitModelChunk(request, id, json) {
1644
- id = id.toString(16) + ":" + json + "\n";
1645
- id = stringToChunk(id);
1646
- request.completedRegularChunks.push(id);
1647
- }
1648
- function emitTypedArrayChunk(request, id, tag, typedArray) {
1649
- request.pendingChunks++;
1650
- var buffer = new Uint8Array(
1651
- typedArray.buffer,
1652
- typedArray.byteOffset,
1653
- typedArray.byteLength
1654
- );
1655
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
1656
- buffer = typedArray.byteLength;
1657
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
1658
- id = stringToChunk(id);
1659
- request.completedRegularChunks.push(id, typedArray);
1660
- }
1661
- function emitTextChunk(request, id, text) {
1662
- if (null === byteLengthOfChunk)
1663
- throw Error(
1664
- "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1665
- );
1666
- request.pendingChunks++;
1667
- text = stringToChunk(text);
1668
- var binaryLength = text.byteLength;
1669
- id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1670
- id = stringToChunk(id);
1671
- request.completedRegularChunks.push(id, text);
1672
- }
1673
- function emitChunk(request, task, value) {
1674
- var id = task.id;
1675
- "string" === typeof value && null !== byteLengthOfChunk
1676
- ? emitTextChunk(request, id, value)
1677
- : value instanceof ArrayBuffer
1678
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
1679
- : value instanceof Int8Array
1680
- ? emitTypedArrayChunk(request, id, "O", value)
1681
- : value instanceof Uint8Array
1682
- ? emitTypedArrayChunk(request, id, "o", value)
1683
- : value instanceof Uint8ClampedArray
1684
- ? emitTypedArrayChunk(request, id, "U", value)
1685
- : value instanceof Int16Array
1686
- ? emitTypedArrayChunk(request, id, "S", value)
1687
- : value instanceof Uint16Array
1688
- ? emitTypedArrayChunk(request, id, "s", value)
1689
- : value instanceof Int32Array
1690
- ? emitTypedArrayChunk(request, id, "L", value)
1691
- : value instanceof Uint32Array
1692
- ? emitTypedArrayChunk(request, id, "l", value)
1693
- : value instanceof Float32Array
1694
- ? emitTypedArrayChunk(request, id, "G", value)
1695
- : value instanceof Float64Array
1696
- ? emitTypedArrayChunk(request, id, "g", value)
1697
- : value instanceof BigInt64Array
1698
- ? emitTypedArrayChunk(request, id, "M", value)
1699
- : value instanceof BigUint64Array
1700
- ? emitTypedArrayChunk(request, id, "m", value)
1701
- : value instanceof DataView
1702
- ? emitTypedArrayChunk(request, id, "V", value)
1703
- : ((value = stringify(value, task.toJSON)),
1704
- emitModelChunk(request, task.id, value));
1705
- }
1706
- function erroredTask(request, task, error) {
1707
- task.status = 4;
1708
- error = logRecoverableError(request, error, task);
1709
- emitErrorChunk(request, task.id, error);
1710
- request.abortableTasks.delete(task);
1711
- callOnAllReadyIfReady(request);
1712
- }
1713
- var emptyRoot = {};
1714
- function retryTask(request, task) {
1715
- if (0 === task.status) {
1716
- task.status = 5;
1717
- var parentSerializedSize = serializedSize;
1718
- try {
1719
- modelRoot = task.model;
1720
- var resolvedModel = renderModelDestructive(
1721
- request,
1722
- task,
1723
- emptyRoot,
1724
- "",
1725
- task.model
1726
- );
1727
- modelRoot = resolvedModel;
1728
- task.keyPath = null;
1729
- task.implicitSlot = !1;
1730
- if ("object" === typeof resolvedModel && null !== resolvedModel)
1731
- request.writtenObjects.set(resolvedModel, serializeByValueID(task.id)),
1732
- emitChunk(request, task, resolvedModel);
1733
- else {
1734
- var json = stringify(resolvedModel);
1735
- emitModelChunk(request, task.id, json);
1736
- }
1737
- task.status = 1;
1738
- request.abortableTasks.delete(task);
1739
- callOnAllReadyIfReady(request);
1740
- } catch (thrownValue) {
1741
- if (12 === request.status) {
1742
- request.abortableTasks.delete(task);
1743
- task.status = 3;
1744
- var model = stringify(serializeByValueID(request.fatalError));
1745
- emitModelChunk(request, task.id, model);
1746
- } else {
1747
- var x =
1748
- thrownValue === SuspenseException
1749
- ? getSuspendedThenable()
1750
- : thrownValue;
1751
- if (
1752
- "object" === typeof x &&
1753
- null !== x &&
1754
- "function" === typeof x.then
1755
- ) {
1756
- task.status = 0;
1757
- task.thenableState = getThenableStateAfterSuspending();
1758
- var ping = task.ping;
1759
- x.then(ping, ping);
1760
- } else erroredTask(request, task, x);
1761
- }
1762
- } finally {
1763
- serializedSize = parentSerializedSize;
1764
- }
1765
- }
1766
- }
1767
- function tryStreamTask(request, task) {
1768
- var parentSerializedSize = serializedSize;
1769
- try {
1770
- emitChunk(request, task, task.model);
1771
- } finally {
1772
- serializedSize = parentSerializedSize;
1773
- }
1774
- }
1775
- function performWork(request) {
1776
- var prevDispatcher = ReactSharedInternalsServer.H;
1777
- ReactSharedInternalsServer.H = HooksDispatcher;
1778
- var prevRequest = currentRequest;
1779
- currentRequest$1 = currentRequest = request;
1780
- try {
1781
- var pingedTasks = request.pingedTasks;
1782
- request.pingedTasks = [];
1783
- for (var i = 0; i < pingedTasks.length; i++)
1784
- retryTask(request, pingedTasks[i]);
1785
- null !== request.destination &&
1786
- flushCompletedChunks(request, request.destination);
1787
- } catch (error) {
1788
- logRecoverableError(request, error, null), fatalError(request, error);
1789
- } finally {
1790
- (ReactSharedInternalsServer.H = prevDispatcher),
1791
- (currentRequest$1 = null),
1792
- (currentRequest = prevRequest);
1793
- }
1794
- }
1795
- function flushCompletedChunks(request, destination) {
1796
- currentView = new Uint8Array(2048);
1797
- writtenBytes = 0;
1798
- try {
1799
- for (
1800
- var importsChunks = request.completedImportChunks, i = 0;
1801
- i < importsChunks.length;
1802
- i++
1803
- )
1804
- request.pendingChunks--,
1805
- writeChunkAndReturn(destination, importsChunks[i]);
1806
- importsChunks.splice(0, i);
1807
- var hintChunks = request.completedHintChunks;
1808
- for (i = 0; i < hintChunks.length; i++)
1809
- writeChunkAndReturn(destination, hintChunks[i]);
1810
- hintChunks.splice(0, i);
1811
- var regularChunks = request.completedRegularChunks;
1812
- for (i = 0; i < regularChunks.length; i++)
1813
- request.pendingChunks--,
1814
- writeChunkAndReturn(destination, regularChunks[i]);
1815
- regularChunks.splice(0, i);
1816
- var errorChunks = request.completedErrorChunks;
1817
- for (i = 0; i < errorChunks.length; i++)
1818
- request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]);
1819
- errorChunks.splice(0, i);
1820
- } finally {
1821
- (request.flushScheduled = !1),
1822
- currentView &&
1823
- 0 < writtenBytes &&
1824
- (destination.enqueue(
1825
- new Uint8Array(currentView.buffer, 0, writtenBytes)
1826
- ),
1827
- (currentView = null),
1828
- (writtenBytes = 0));
1829
- }
1830
- 0 === request.pendingChunks &&
1831
- ((request.status = 14), destination.close(), (request.destination = null));
1832
- }
1833
- function startWork(request) {
1834
- request.flushScheduled = null !== request.destination;
1835
- scheduleMicrotask(function () {
1836
- requestStorage.run(request, performWork, request);
1837
- });
1838
- setImmediate(function () {
1839
- 10 === request.status && (request.status = 11);
1840
- });
1841
- }
1842
- function enqueueFlush(request) {
1843
- !1 === request.flushScheduled &&
1844
- 0 === request.pingedTasks.length &&
1845
- null !== request.destination &&
1846
- ((request.flushScheduled = !0),
1847
- setImmediate(function () {
1848
- request.flushScheduled = !1;
1849
- var destination = request.destination;
1850
- destination && flushCompletedChunks(request, destination);
1851
- }));
1852
- }
1853
- function callOnAllReadyIfReady(request) {
1854
- if (0 === request.abortableTasks.size && 0 === request.abortListeners.size)
1855
- request.onAllReady();
1856
- }
1857
- function startFlowing(request, destination) {
1858
- if (13 === request.status)
1859
- (request.status = 14), closeWithError(destination, request.fatalError);
1860
- else if (14 !== request.status && null === request.destination) {
1861
- request.destination = destination;
1862
- try {
1863
- flushCompletedChunks(request, destination);
1864
- } catch (error) {
1865
- logRecoverableError(request, error, null), fatalError(request, error);
1866
- }
1867
- }
1868
- }
1869
- function abort(request, reason) {
1870
- try {
1871
- 11 >= request.status && (request.status = 12);
1872
- var abortableTasks = request.abortableTasks;
1873
- if (0 < abortableTasks.size) {
1874
- var error =
1875
- void 0 === reason
1876
- ? Error("The render was aborted by the server without a reason.")
1877
- : "object" === typeof reason &&
1878
- null !== reason &&
1879
- "function" === typeof reason.then
1880
- ? Error("The render was aborted by the server with a promise.")
1881
- : reason,
1882
- digest = logRecoverableError(request, error, null),
1883
- errorId = request.nextChunkId++;
1884
- request.fatalError = errorId;
1885
- request.pendingChunks++;
1886
- emitErrorChunk(request, errorId, digest, error);
1887
- abortableTasks.forEach(function (task) {
1888
- if (5 !== task.status) {
1889
- task.status = 3;
1890
- var ref = serializeByValueID(errorId);
1891
- task = encodeReferenceChunk(request, task.id, ref);
1892
- request.completedErrorChunks.push(task);
1893
- }
1894
- });
1895
- abortableTasks.clear();
1896
- callOnAllReadyIfReady(request);
1897
- }
1898
- var abortListeners = request.abortListeners;
1899
- if (0 < abortListeners.size) {
1900
- var error$24 =
1901
- void 0 === reason
1902
- ? Error("The render was aborted by the server without a reason.")
1903
- : "object" === typeof reason &&
1904
- null !== reason &&
1905
- "function" === typeof reason.then
1906
- ? Error("The render was aborted by the server with a promise.")
1907
- : reason;
1908
- abortListeners.forEach(function (callback) {
1909
- return callback(error$24);
1910
- });
1911
- abortListeners.clear();
1912
- callOnAllReadyIfReady(request);
1913
- }
1914
- null !== request.destination &&
1915
- flushCompletedChunks(request, request.destination);
1916
- } catch (error$25) {
1917
- logRecoverableError(request, error$25, null), fatalError(request, error$25);
1918
- }
1919
- }
1920
- function resolveServerReference(bundlerConfig, id) {
1921
- var name = "",
1922
- resolvedModuleData = bundlerConfig[id];
1923
- if (resolvedModuleData) name = resolvedModuleData.name;
1924
- else {
1925
- var idx = id.lastIndexOf("#");
1926
- -1 !== idx &&
1927
- ((name = id.slice(idx + 1)),
1928
- (resolvedModuleData = bundlerConfig[id.slice(0, idx)]));
1929
- if (!resolvedModuleData)
1930
- throw Error(
1931
- 'Could not find the module "' +
1932
- id +
1933
- '" in the React Server Manifest. This is probably a bug in the React Server Components bundler.'
1934
- );
1935
- }
1936
- return resolvedModuleData.async
1937
- ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
1938
- : [resolvedModuleData.id, resolvedModuleData.chunks, name];
1939
- }
1940
- var chunkCache = new Map();
1941
- function requireAsyncModule(id) {
1942
- var promise = __webpack_require__(id);
1943
- if ("function" !== typeof promise.then || "fulfilled" === promise.status)
1944
- return null;
1945
- promise.then(
1946
- function (value) {
1947
- promise.status = "fulfilled";
1948
- promise.value = value;
1949
- },
1950
- function (reason) {
1951
- promise.status = "rejected";
1952
- promise.reason = reason;
1953
- }
1954
- );
1955
- return promise;
1956
- }
1957
- function ignoreReject() {}
1958
- function preloadModule(metadata) {
1959
- for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; ) {
1960
- var chunkId = chunks[i++];
1961
- chunks[i++];
1962
- var entry = chunkCache.get(chunkId);
1963
- if (void 0 === entry) {
1964
- entry = __webpack_chunk_load__(chunkId);
1965
- promises.push(entry);
1966
- var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
1967
- entry.then(resolve, ignoreReject);
1968
- chunkCache.set(chunkId, entry);
1969
- } else null !== entry && promises.push(entry);
1970
- }
1971
- return 4 === metadata.length
1972
- ? 0 === promises.length
1973
- ? requireAsyncModule(metadata[0])
1974
- : Promise.all(promises).then(function () {
1975
- return requireAsyncModule(metadata[0]);
1976
- })
1977
- : 0 < promises.length
1978
- ? Promise.all(promises)
1979
- : null;
1980
- }
1981
- function requireModule(metadata) {
1982
- var moduleExports = __webpack_require__(metadata[0]);
1983
- if (4 === metadata.length && "function" === typeof moduleExports.then)
1984
- if ("fulfilled" === moduleExports.status)
1985
- moduleExports = moduleExports.value;
1986
- else throw moduleExports.reason;
1987
- return "*" === metadata[2]
1988
- ? moduleExports
1989
- : "" === metadata[2]
1990
- ? moduleExports.__esModule
1991
- ? moduleExports.default
1992
- : moduleExports
1993
- : moduleExports[metadata[2]];
1994
- }
1995
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1996
- function Chunk(status, value, reason, response) {
1997
- this.status = status;
1998
- this.value = value;
1999
- this.reason = reason;
2000
- this._response = response;
2001
- }
2002
- Chunk.prototype = Object.create(Promise.prototype);
2003
- Chunk.prototype.then = function (resolve, reject) {
2004
- switch (this.status) {
2005
- case "resolved_model":
2006
- initializeModelChunk(this);
2007
- }
2008
- switch (this.status) {
2009
- case "fulfilled":
2010
- resolve(this.value);
2011
- break;
2012
- case "pending":
2013
- case "blocked":
2014
- case "cyclic":
2015
- resolve &&
2016
- (null === this.value && (this.value = []), this.value.push(resolve));
2017
- reject &&
2018
- (null === this.reason && (this.reason = []), this.reason.push(reject));
2019
- break;
2020
- default:
2021
- reject(this.reason);
2022
- }
2023
- };
2024
- function createPendingChunk(response) {
2025
- return new Chunk("pending", null, null, response);
2026
- }
2027
- function wakeChunk(listeners, value) {
2028
- for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
2029
- }
2030
- function triggerErrorOnChunk(chunk, error) {
2031
- if ("pending" !== chunk.status && "blocked" !== chunk.status)
2032
- chunk.reason.error(error);
2033
- else {
2034
- var listeners = chunk.reason;
2035
- chunk.status = "rejected";
2036
- chunk.reason = error;
2037
- null !== listeners && wakeChunk(listeners, error);
2038
- }
2039
- }
2040
- function resolveModelChunk(chunk, value, id) {
2041
- if ("pending" !== chunk.status)
2042
- (chunk = chunk.reason),
2043
- "C" === value[0]
2044
- ? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
2045
- : chunk.enqueueModel(value);
2046
- else {
2047
- var resolveListeners = chunk.value,
2048
- rejectListeners = chunk.reason;
2049
- chunk.status = "resolved_model";
2050
- chunk.value = value;
2051
- chunk.reason = id;
2052
- if (null !== resolveListeners)
2053
- switch ((initializeModelChunk(chunk), chunk.status)) {
2054
- case "fulfilled":
2055
- wakeChunk(resolveListeners, chunk.value);
2056
- break;
2057
- case "pending":
2058
- case "blocked":
2059
- case "cyclic":
2060
- if (chunk.value)
2061
- for (value = 0; value < resolveListeners.length; value++)
2062
- chunk.value.push(resolveListeners[value]);
2063
- else chunk.value = resolveListeners;
2064
- if (chunk.reason) {
2065
- if (rejectListeners)
2066
- for (value = 0; value < rejectListeners.length; value++)
2067
- chunk.reason.push(rejectListeners[value]);
2068
- } else chunk.reason = rejectListeners;
2069
- break;
2070
- case "rejected":
2071
- rejectListeners && wakeChunk(rejectListeners, chunk.reason);
2072
- }
2073
- }
2074
- }
2075
- function createResolvedIteratorResultChunk(response, value, done) {
2076
- return new Chunk(
2077
- "resolved_model",
2078
- (done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
2079
- -1,
2080
- response
2081
- );
2082
- }
2083
- function resolveIteratorResultChunk(chunk, value, done) {
2084
- resolveModelChunk(
2085
- chunk,
2086
- (done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
2087
- -1
2088
- );
2089
- }
2090
- function loadServerReference$1(
2091
- response,
2092
- id,
2093
- bound,
2094
- parentChunk,
2095
- parentObject,
2096
- key
2097
- ) {
2098
- var serverReference = resolveServerReference(response._bundlerConfig, id);
2099
- id = preloadModule(serverReference);
2100
- if (bound)
2101
- bound = Promise.all([bound, id]).then(function (_ref) {
2102
- _ref = _ref[0];
2103
- var fn = requireModule(serverReference);
2104
- return fn.bind.apply(fn, [null].concat(_ref));
2105
- });
2106
- else if (id)
2107
- bound = Promise.resolve(id).then(function () {
2108
- return requireModule(serverReference);
2109
- });
2110
- else return requireModule(serverReference);
2111
- bound.then(
2112
- createModelResolver(
2113
- parentChunk,
2114
- parentObject,
2115
- key,
2116
- !1,
2117
- response,
2118
- createModel,
2119
- []
2120
- ),
2121
- createModelReject(parentChunk)
2122
- );
2123
- return null;
2124
- }
2125
- function reviveModel(response, parentObj, parentKey, value, reference) {
2126
- if ("string" === typeof value)
2127
- return parseModelString(response, parentObj, parentKey, value, reference);
2128
- if ("object" === typeof value && null !== value)
2129
- if (
2130
- (void 0 !== reference &&
2131
- void 0 !== response._temporaryReferences &&
2132
- response._temporaryReferences.set(value, reference),
2133
- Array.isArray(value))
2134
- )
2135
- for (var i = 0; i < value.length; i++)
2136
- value[i] = reviveModel(
2137
- response,
2138
- value,
2139
- "" + i,
2140
- value[i],
2141
- void 0 !== reference ? reference + ":" + i : void 0
2142
- );
2143
- else
2144
- for (i in value)
2145
- hasOwnProperty.call(value, i) &&
2146
- ((parentObj =
2147
- void 0 !== reference && -1 === i.indexOf(":")
2148
- ? reference + ":" + i
2149
- : void 0),
2150
- (parentObj = reviveModel(response, value, i, value[i], parentObj)),
2151
- void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
2152
- return value;
2153
- }
2154
- var initializingChunk = null,
2155
- initializingChunkBlockedModel = null;
2156
- function initializeModelChunk(chunk) {
2157
- var prevChunk = initializingChunk,
2158
- prevBlocked = initializingChunkBlockedModel;
2159
- initializingChunk = chunk;
2160
- initializingChunkBlockedModel = null;
2161
- var rootReference = -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
2162
- resolvedModel = chunk.value;
2163
- chunk.status = "cyclic";
2164
- chunk.value = null;
2165
- chunk.reason = null;
2166
- try {
2167
- var rawModel = JSON.parse(resolvedModel),
2168
- value = reviveModel(
2169
- chunk._response,
2170
- { "": rawModel },
2171
- "",
2172
- rawModel,
2173
- rootReference
2174
- );
2175
- if (
2176
- null !== initializingChunkBlockedModel &&
2177
- 0 < initializingChunkBlockedModel.deps
2178
- )
2179
- (initializingChunkBlockedModel.value = value), (chunk.status = "blocked");
2180
- else {
2181
- var resolveListeners = chunk.value;
2182
- chunk.status = "fulfilled";
2183
- chunk.value = value;
2184
- null !== resolveListeners && wakeChunk(resolveListeners, value);
2185
- }
2186
- } catch (error) {
2187
- (chunk.status = "rejected"), (chunk.reason = error);
2188
- } finally {
2189
- (initializingChunk = prevChunk),
2190
- (initializingChunkBlockedModel = prevBlocked);
2191
- }
2192
- }
2193
- function reportGlobalError(response, error) {
2194
- response._closed = !0;
2195
- response._closedReason = error;
2196
- response._chunks.forEach(function (chunk) {
2197
- "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
2198
- });
2199
- }
2200
- function getChunk(response, id) {
2201
- var chunks = response._chunks,
2202
- chunk = chunks.get(id);
2203
- chunk ||
2204
- ((chunk = response._formData.get(response._prefix + id)),
2205
- (chunk =
2206
- null != chunk
2207
- ? new Chunk("resolved_model", chunk, id, response)
2208
- : response._closed
2209
- ? new Chunk("rejected", null, response._closedReason, response)
2210
- : createPendingChunk(response)),
2211
- chunks.set(id, chunk));
2212
- return chunk;
2213
- }
2214
- function createModelResolver(
2215
- chunk,
2216
- parentObject,
2217
- key,
2218
- cyclic,
2219
- response,
2220
- map,
2221
- path
2222
- ) {
2223
- if (initializingChunkBlockedModel) {
2224
- var blocked = initializingChunkBlockedModel;
2225
- cyclic || blocked.deps++;
2226
- } else
2227
- blocked = initializingChunkBlockedModel = {
2228
- deps: cyclic ? 0 : 1,
2229
- value: null
2230
- };
2231
- return function (value) {
2232
- for (var i = 1; i < path.length; i++) value = value[path[i]];
2233
- parentObject[key] = map(response, value);
2234
- "" === key && null === blocked.value && (blocked.value = parentObject[key]);
2235
- blocked.deps--;
2236
- 0 === blocked.deps &&
2237
- "blocked" === chunk.status &&
2238
- ((value = chunk.value),
2239
- (chunk.status = "fulfilled"),
2240
- (chunk.value = blocked.value),
2241
- null !== value && wakeChunk(value, blocked.value));
2242
- };
2243
- }
2244
- function createModelReject(chunk) {
2245
- return function (error) {
2246
- return triggerErrorOnChunk(chunk, error);
2247
- };
2248
- }
2249
- function getOutlinedModel(response, reference, parentObject, key, map) {
2250
- reference = reference.split(":");
2251
- var id = parseInt(reference[0], 16);
2252
- id = getChunk(response, id);
2253
- switch (id.status) {
2254
- case "resolved_model":
2255
- initializeModelChunk(id);
2256
- }
2257
- switch (id.status) {
2258
- case "fulfilled":
2259
- parentObject = id.value;
2260
- for (key = 1; key < reference.length; key++)
2261
- parentObject = parentObject[reference[key]];
2262
- return map(response, parentObject);
2263
- case "pending":
2264
- case "blocked":
2265
- case "cyclic":
2266
- var parentChunk = initializingChunk;
2267
- id.then(
2268
- createModelResolver(
2269
- parentChunk,
2270
- parentObject,
2271
- key,
2272
- "cyclic" === id.status,
2273
- response,
2274
- map,
2275
- reference
2276
- ),
2277
- createModelReject(parentChunk)
2278
- );
2279
- return null;
2280
- default:
2281
- throw id.reason;
2282
- }
2283
- }
2284
- function createMap(response, model) {
2285
- return new Map(model);
2286
- }
2287
- function createSet(response, model) {
2288
- return new Set(model);
2289
- }
2290
- function extractIterator(response, model) {
2291
- return model[Symbol.iterator]();
2292
- }
2293
- function createModel(response, model) {
2294
- return model;
2295
- }
2296
- function parseTypedArray(
2297
- response,
2298
- reference,
2299
- constructor,
2300
- bytesPerElement,
2301
- parentObject,
2302
- parentKey
2303
- ) {
2304
- reference = parseInt(reference.slice(2), 16);
2305
- reference = response._formData.get(response._prefix + reference);
2306
- reference =
2307
- constructor === ArrayBuffer
2308
- ? reference.arrayBuffer()
2309
- : reference.arrayBuffer().then(function (buffer) {
2310
- return new constructor(buffer);
2311
- });
2312
- bytesPerElement = initializingChunk;
2313
- reference.then(
2314
- createModelResolver(
2315
- bytesPerElement,
2316
- parentObject,
2317
- parentKey,
2318
- !1,
2319
- response,
2320
- createModel,
2321
- []
2322
- ),
2323
- createModelReject(bytesPerElement)
2324
- );
2325
- return null;
2326
- }
2327
- function resolveStream(response, id, stream, controller) {
2328
- var chunks = response._chunks;
2329
- stream = new Chunk("fulfilled", stream, controller, response);
2330
- chunks.set(id, stream);
2331
- response = response._formData.getAll(response._prefix + id);
2332
- for (id = 0; id < response.length; id++)
2333
- (chunks = response[id]),
2334
- "C" === chunks[0]
2335
- ? controller.close("C" === chunks ? '"$undefined"' : chunks.slice(1))
2336
- : controller.enqueueModel(chunks);
2337
- }
2338
- function parseReadableStream(response, reference, type) {
2339
- reference = parseInt(reference.slice(2), 16);
2340
- var controller = null;
2341
- type = new ReadableStream({
2342
- type: type,
2343
- start: function (c) {
2344
- controller = c;
2345
- }
2346
- });
2347
- var previousBlockedChunk = null;
2348
- resolveStream(response, reference, type, {
2349
- enqueueModel: function (json) {
2350
- if (null === previousBlockedChunk) {
2351
- var chunk = new Chunk("resolved_model", json, -1, response);
2352
- initializeModelChunk(chunk);
2353
- "fulfilled" === chunk.status
2354
- ? controller.enqueue(chunk.value)
2355
- : (chunk.then(
2356
- function (v) {
2357
- return controller.enqueue(v);
2358
- },
2359
- function (e) {
2360
- return controller.error(e);
2361
- }
2362
- ),
2363
- (previousBlockedChunk = chunk));
2364
- } else {
2365
- chunk = previousBlockedChunk;
2366
- var chunk$28 = createPendingChunk(response);
2367
- chunk$28.then(
2368
- function (v) {
2369
- return controller.enqueue(v);
2370
- },
2371
- function (e) {
2372
- return controller.error(e);
2373
- }
2374
- );
2375
- previousBlockedChunk = chunk$28;
2376
- chunk.then(function () {
2377
- previousBlockedChunk === chunk$28 && (previousBlockedChunk = null);
2378
- resolveModelChunk(chunk$28, json, -1);
2379
- });
2380
- }
2381
- },
2382
- close: function () {
2383
- if (null === previousBlockedChunk) controller.close();
2384
- else {
2385
- var blockedChunk = previousBlockedChunk;
2386
- previousBlockedChunk = null;
2387
- blockedChunk.then(function () {
2388
- return controller.close();
2389
- });
2390
- }
2391
- },
2392
- error: function (error) {
2393
- if (null === previousBlockedChunk) controller.error(error);
2394
- else {
2395
- var blockedChunk = previousBlockedChunk;
2396
- previousBlockedChunk = null;
2397
- blockedChunk.then(function () {
2398
- return controller.error(error);
2399
- });
2400
- }
2401
- }
2402
- });
2403
- return type;
2404
- }
2405
- function asyncIterator() {
2406
- return this;
2407
- }
2408
- function createIterator(next) {
2409
- next = { next: next };
2410
- next[ASYNC_ITERATOR] = asyncIterator;
2411
- return next;
2412
- }
2413
- function parseAsyncIterable(response, reference, iterator) {
2414
- reference = parseInt(reference.slice(2), 16);
2415
- var buffer = [],
2416
- closed = !1,
2417
- nextWriteIndex = 0,
2418
- $jscomp$compprop2 = {};
2419
- $jscomp$compprop2 =
2420
- (($jscomp$compprop2[ASYNC_ITERATOR] = function () {
2421
- var nextReadIndex = 0;
2422
- return createIterator(function (arg) {
2423
- if (void 0 !== arg)
2424
- throw Error(
2425
- "Values cannot be passed to next() of AsyncIterables passed to Client Components."
2426
- );
2427
- if (nextReadIndex === buffer.length) {
2428
- if (closed)
2429
- return new Chunk(
2430
- "fulfilled",
2431
- { done: !0, value: void 0 },
2432
- null,
2433
- response
2434
- );
2435
- buffer[nextReadIndex] = createPendingChunk(response);
2436
- }
2437
- return buffer[nextReadIndex++];
2438
- });
2439
- }),
2440
- $jscomp$compprop2);
2441
- iterator = iterator ? $jscomp$compprop2[ASYNC_ITERATOR]() : $jscomp$compprop2;
2442
- resolveStream(response, reference, iterator, {
2443
- enqueueModel: function (value) {
2444
- nextWriteIndex === buffer.length
2445
- ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
2446
- response,
2447
- value,
2448
- !1
2449
- ))
2450
- : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
2451
- nextWriteIndex++;
2452
- },
2453
- close: function (value) {
2454
- closed = !0;
2455
- nextWriteIndex === buffer.length
2456
- ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
2457
- response,
2458
- value,
2459
- !0
2460
- ))
2461
- : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
2462
- for (nextWriteIndex++; nextWriteIndex < buffer.length; )
2463
- resolveIteratorResultChunk(
2464
- buffer[nextWriteIndex++],
2465
- '"$undefined"',
2466
- !0
2467
- );
2468
- },
2469
- error: function (error) {
2470
- closed = !0;
2471
- for (
2472
- nextWriteIndex === buffer.length &&
2473
- (buffer[nextWriteIndex] = createPendingChunk(response));
2474
- nextWriteIndex < buffer.length;
2475
-
2476
- )
2477
- triggerErrorOnChunk(buffer[nextWriteIndex++], error);
2478
- }
2479
- });
2480
- return iterator;
2481
- }
2482
- function parseModelString(response, obj, key, value, reference) {
2483
- if ("$" === value[0]) {
2484
- switch (value[1]) {
2485
- case "$":
2486
- return value.slice(1);
2487
- case "@":
2488
- return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
2489
- case "F":
2490
- return (
2491
- (value = value.slice(2)),
2492
- (value = getOutlinedModel(response, value, obj, key, createModel)),
2493
- loadServerReference$1(
2494
- response,
2495
- value.id,
2496
- value.bound,
2497
- initializingChunk,
2498
- obj,
2499
- key
2500
- )
2501
- );
2502
- case "T":
2503
- if (void 0 === reference || void 0 === response._temporaryReferences)
2504
- throw Error(
2505
- "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
2506
- );
2507
- return createTemporaryReference(
2508
- response._temporaryReferences,
2509
- reference
2510
- );
2511
- case "Q":
2512
- return (
2513
- (value = value.slice(2)),
2514
- getOutlinedModel(response, value, obj, key, createMap)
2515
- );
2516
- case "W":
2517
- return (
2518
- (value = value.slice(2)),
2519
- getOutlinedModel(response, value, obj, key, createSet)
2520
- );
2521
- case "K":
2522
- obj = value.slice(2);
2523
- var formPrefix = response._prefix + obj + "_",
2524
- data = new FormData();
2525
- response._formData.forEach(function (entry, entryKey) {
2526
- entryKey.startsWith(formPrefix) &&
2527
- data.append(entryKey.slice(formPrefix.length), entry);
2528
- });
2529
- return data;
2530
- case "i":
2531
- return (
2532
- (value = value.slice(2)),
2533
- getOutlinedModel(response, value, obj, key, extractIterator)
2534
- );
2535
- case "I":
2536
- return Infinity;
2537
- case "-":
2538
- return "$-0" === value ? -0 : -Infinity;
2539
- case "N":
2540
- return NaN;
2541
- case "u":
2542
- return;
2543
- case "D":
2544
- return new Date(Date.parse(value.slice(2)));
2545
- case "n":
2546
- return BigInt(value.slice(2));
2547
- }
2548
- switch (value[1]) {
2549
- case "A":
2550
- return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
2551
- case "O":
2552
- return parseTypedArray(response, value, Int8Array, 1, obj, key);
2553
- case "o":
2554
- return parseTypedArray(response, value, Uint8Array, 1, obj, key);
2555
- case "U":
2556
- return parseTypedArray(response, value, Uint8ClampedArray, 1, obj, key);
2557
- case "S":
2558
- return parseTypedArray(response, value, Int16Array, 2, obj, key);
2559
- case "s":
2560
- return parseTypedArray(response, value, Uint16Array, 2, obj, key);
2561
- case "L":
2562
- return parseTypedArray(response, value, Int32Array, 4, obj, key);
2563
- case "l":
2564
- return parseTypedArray(response, value, Uint32Array, 4, obj, key);
2565
- case "G":
2566
- return parseTypedArray(response, value, Float32Array, 4, obj, key);
2567
- case "g":
2568
- return parseTypedArray(response, value, Float64Array, 8, obj, key);
2569
- case "M":
2570
- return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
2571
- case "m":
2572
- return parseTypedArray(response, value, BigUint64Array, 8, obj, key);
2573
- case "V":
2574
- return parseTypedArray(response, value, DataView, 1, obj, key);
2575
- case "B":
2576
- return (
2577
- (obj = parseInt(value.slice(2), 16)),
2578
- response._formData.get(response._prefix + obj)
2579
- );
2580
- }
2581
- switch (value[1]) {
2582
- case "R":
2583
- return parseReadableStream(response, value, void 0);
2584
- case "r":
2585
- return parseReadableStream(response, value, "bytes");
2586
- case "X":
2587
- return parseAsyncIterable(response, value, !1);
2588
- case "x":
2589
- return parseAsyncIterable(response, value, !0);
2590
- }
2591
- value = value.slice(1);
2592
- return getOutlinedModel(response, value, obj, key, createModel);
2593
- }
2594
- return value;
2595
- }
2596
- function createResponse(bundlerConfig, formFieldPrefix, temporaryReferences) {
2597
- var backingFormData =
2598
- 3 < arguments.length && void 0 !== arguments[3]
2599
- ? arguments[3]
2600
- : new FormData(),
2601
- chunks = new Map();
2602
- return {
2603
- _bundlerConfig: bundlerConfig,
2604
- _prefix: formFieldPrefix,
2605
- _formData: backingFormData,
2606
- _chunks: chunks,
2607
- _closed: !1,
2608
- _closedReason: null,
2609
- _temporaryReferences: temporaryReferences
2610
- };
2611
- }
2612
- function close(response) {
2613
- reportGlobalError(response, Error("Connection closed."));
2614
- }
2615
- function loadServerReference(bundlerConfig, id, bound) {
2616
- var serverReference = resolveServerReference(bundlerConfig, id);
2617
- bundlerConfig = preloadModule(serverReference);
2618
- return bound
2619
- ? Promise.all([bound, bundlerConfig]).then(function (_ref) {
2620
- _ref = _ref[0];
2621
- var fn = requireModule(serverReference);
2622
- return fn.bind.apply(fn, [null].concat(_ref));
2623
- })
2624
- : bundlerConfig
2625
- ? Promise.resolve(bundlerConfig).then(function () {
2626
- return requireModule(serverReference);
2627
- })
2628
- : Promise.resolve(requireModule(serverReference));
2629
- }
2630
- function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
2631
- body = createResponse(serverManifest, formFieldPrefix, void 0, body);
2632
- close(body);
2633
- body = getChunk(body, 0);
2634
- body.then(function () {});
2635
- if ("fulfilled" !== body.status) throw body.reason;
2636
- return body.value;
2637
- }
2638
- exports.createClientModuleProxy = function (moduleId) {
2639
- moduleId = registerClientReferenceImpl({}, moduleId, !1);
2640
- return new Proxy(moduleId, proxyHandlers$1);
2641
- };
2642
- exports.createTemporaryReferenceSet = function () {
2643
- return new WeakMap();
2644
- };
2645
- exports.decodeAction = function (body, serverManifest) {
2646
- var formData = new FormData(),
2647
- action = null;
2648
- body.forEach(function (value, key) {
2649
- key.startsWith("$ACTION_")
2650
- ? key.startsWith("$ACTION_REF_")
2651
- ? ((value = "$ACTION_" + key.slice(12) + ":"),
2652
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
2653
- (action = loadServerReference(serverManifest, value.id, value.bound)))
2654
- : key.startsWith("$ACTION_ID_") &&
2655
- ((value = key.slice(11)),
2656
- (action = loadServerReference(serverManifest, value, null)))
2657
- : formData.append(key, value);
2658
- });
2659
- return null === action
2660
- ? null
2661
- : action.then(function (fn) {
2662
- return fn.bind(null, formData);
2663
- });
2664
- };
2665
- exports.decodeFormState = function (actionResult, body, serverManifest) {
2666
- var keyPath = body.get("$ACTION_KEY");
2667
- if ("string" !== typeof keyPath) return Promise.resolve(null);
2668
- var metaData = null;
2669
- body.forEach(function (value, key) {
2670
- key.startsWith("$ACTION_REF_") &&
2671
- ((value = "$ACTION_" + key.slice(12) + ":"),
2672
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
2673
- });
2674
- if (null === metaData) return Promise.resolve(null);
2675
- var referenceId = metaData.id;
2676
- return Promise.resolve(metaData.bound).then(function (bound) {
2677
- return null === bound
2678
- ? null
2679
- : [actionResult, keyPath, referenceId, bound.length - 1];
2680
- });
2681
- };
2682
- exports.decodeReply = function (body, webpackMap, options) {
2683
- if ("string" === typeof body) {
2684
- var form = new FormData();
2685
- form.append("0", body);
2686
- body = form;
2687
- }
2688
- body = createResponse(
2689
- webpackMap,
2690
- "",
2691
- options ? options.temporaryReferences : void 0,
2692
- body
2693
- );
2694
- webpackMap = getChunk(body, 0);
2695
- close(body);
2696
- return webpackMap;
2697
- };
2698
- exports.decodeReplyFromAsyncIterable = function (
2699
- iterable,
2700
- webpackMap,
2701
- options
2702
- ) {
2703
- function progress(entry) {
2704
- if (entry.done) close(response);
2705
- else {
2706
- entry = entry.value;
2707
- var name = entry[0];
2708
- entry = entry[1];
2709
- if ("string" === typeof entry) {
2710
- response._formData.append(name, entry);
2711
- var prefix = response._prefix;
2712
- if (name.startsWith(prefix)) {
2713
- var chunks = response._chunks;
2714
- name = +name.slice(prefix.length);
2715
- (chunks = chunks.get(name)) && resolveModelChunk(chunks, entry, name);
2716
- }
2717
- } else response._formData.append(name, entry);
2718
- iterator.next().then(progress, error);
2719
- }
2720
- }
2721
- function error(reason) {
2722
- reportGlobalError(response, reason);
2723
- "function" === typeof iterator.throw &&
2724
- iterator.throw(reason).then(error, error);
2725
- }
2726
- var iterator = iterable[ASYNC_ITERATOR](),
2727
- response = createResponse(
2728
- webpackMap,
2729
- "",
2730
- options ? options.temporaryReferences : void 0
2731
- );
2732
- iterator.next().then(progress, error);
2733
- return getChunk(response, 0);
2734
- };
2735
- exports.registerClientReference = function (
2736
- proxyImplementation,
2737
- id,
2738
- exportName
2739
- ) {
2740
- return registerClientReferenceImpl(
2741
- proxyImplementation,
2742
- id + "#" + exportName,
2743
- !1
2744
- );
2745
- };
2746
- exports.registerServerReference = function (reference, id, exportName) {
2747
- return Object.defineProperties(reference, {
2748
- $$typeof: { value: SERVER_REFERENCE_TAG },
2749
- $$id: {
2750
- value: null === exportName ? id : id + "#" + exportName,
2751
- configurable: !0
2752
- },
2753
- $$bound: { value: null, configurable: !0 },
2754
- bind: { value: bind, configurable: !0 }
2755
- });
2756
- };
2757
- exports.renderToReadableStream = function (model, webpackMap, options) {
2758
- var request = new RequestInstance(
2759
- 20,
2760
- model,
2761
- webpackMap,
2762
- options ? options.onError : void 0,
2763
- options ? options.identifierPrefix : void 0,
2764
- options ? options.onPostpone : void 0,
2765
- options ? options.temporaryReferences : void 0,
2766
- void 0,
2767
- void 0,
2768
- noop,
2769
- noop
2770
- );
2771
- if (options && options.signal) {
2772
- var signal = options.signal;
2773
- if (signal.aborted) abort(request, signal.reason);
2774
- else {
2775
- var listener = function () {
2776
- abort(request, signal.reason);
2777
- signal.removeEventListener("abort", listener);
2778
- };
2779
- signal.addEventListener("abort", listener);
2780
- }
2781
- }
2782
- return new ReadableStream(
2783
- {
2784
- type: "bytes",
2785
- start: function () {
2786
- startWork(request);
2787
- },
2788
- pull: function (controller) {
2789
- startFlowing(request, controller);
2790
- },
2791
- cancel: function (reason) {
2792
- request.destination = null;
2793
- abort(request, reason);
2794
- }
2795
- },
2796
- { highWaterMark: 0 }
2797
- );
2798
- };
2799
- exports.unstable_prerender = function (model, webpackMap, options) {
2800
- return new Promise(function (resolve, reject) {
2801
- var request = new RequestInstance(
2802
- 21,
2803
- model,
2804
- webpackMap,
2805
- options ? options.onError : void 0,
2806
- options ? options.identifierPrefix : void 0,
2807
- options ? options.onPostpone : void 0,
2808
- options ? options.temporaryReferences : void 0,
2809
- void 0,
2810
- void 0,
2811
- function () {
2812
- var stream = new ReadableStream(
2813
- {
2814
- type: "bytes",
2815
- pull: function (controller) {
2816
- startFlowing(request, controller);
2817
- },
2818
- cancel: function (reason) {
2819
- request.destination = null;
2820
- abort(request, reason);
2821
- }
2822
- },
2823
- { highWaterMark: 0 }
2824
- );
2825
- resolve({ prelude: stream });
2826
- },
2827
- reject
2828
- );
2829
- if (options && options.signal) {
2830
- var signal = options.signal;
2831
- if (signal.aborted) abort(request, signal.reason);
2832
- else {
2833
- var listener = function () {
2834
- abort(request, signal.reason);
2835
- signal.removeEventListener("abort", listener);
2836
- };
2837
- signal.addEventListener("abort", listener);
2838
- }
2839
- }
2840
- startWork(request);
2841
- });
2842
- };