@modern-js/utils 2.69.4 → 2.69.6

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