@modern-js/utils 2.65.0 → 2.65.2

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/dist/compiled/react-server-dom-webpack/LICENSE +21 -0
  2. package/dist/compiled/react-server-dom-webpack/README.md +5 -0
  3. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +2553 -0
  4. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +1637 -0
  5. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +2709 -0
  6. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +1800 -0
  7. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +2752 -0
  8. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +1849 -0
  9. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +2714 -0
  10. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +1814 -0
  11. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-node-register.js +69 -0
  12. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +399 -0
  13. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +3782 -0
  14. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +2777 -0
  15. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +3812 -0
  16. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +2779 -0
  17. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +3869 -0
  18. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +2871 -0
  19. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +3832 -0
  20. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +2837 -0
  21. package/dist/compiled/react-server-dom-webpack/client.browser.js +7 -0
  22. package/dist/compiled/react-server-dom-webpack/client.edge.js +7 -0
  23. package/dist/compiled/react-server-dom-webpack/client.js +3 -0
  24. package/dist/compiled/react-server-dom-webpack/client.node.js +7 -0
  25. package/dist/compiled/react-server-dom-webpack/client.node.unbundled.js +7 -0
  26. package/dist/compiled/react-server-dom-webpack/index.js +12 -0
  27. package/dist/compiled/react-server-dom-webpack/package.json +111 -0
  28. package/dist/compiled/react-server-dom-webpack/server.browser.js +17 -0
  29. package/dist/compiled/react-server-dom-webpack/server.edge.js +17 -0
  30. package/dist/compiled/react-server-dom-webpack/server.js +6 -0
  31. package/dist/compiled/react-server-dom-webpack/server.node.js +18 -0
  32. package/dist/compiled/react-server-dom-webpack/server.node.unbundled.js +18 -0
  33. package/package.json +34 -5
@@ -0,0 +1,3812 @@
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
+ return "*" === metadata[2]
2542
+ ? moduleExports
2543
+ : "" === metadata[2]
2544
+ ? moduleExports.__esModule
2545
+ ? moduleExports.default
2546
+ : moduleExports
2547
+ : moduleExports[metadata[2]];
2548
+ }
2549
+ function Chunk(status, value, reason, response) {
2550
+ this.status = status;
2551
+ this.value = value;
2552
+ this.reason = reason;
2553
+ this._response = response;
2554
+ }
2555
+ function createPendingChunk(response) {
2556
+ return new Chunk("pending", null, null, response);
2557
+ }
2558
+ function wakeChunk(listeners, value) {
2559
+ for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
2560
+ }
2561
+ function triggerErrorOnChunk(chunk, error) {
2562
+ if ("pending" !== chunk.status && "blocked" !== chunk.status)
2563
+ chunk.reason.error(error);
2564
+ else {
2565
+ var listeners = chunk.reason;
2566
+ chunk.status = "rejected";
2567
+ chunk.reason = error;
2568
+ null !== listeners && wakeChunk(listeners, error);
2569
+ }
2570
+ }
2571
+ function resolveModelChunk(chunk, value, id) {
2572
+ if ("pending" !== chunk.status)
2573
+ (chunk = chunk.reason),
2574
+ "C" === value[0]
2575
+ ? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
2576
+ : chunk.enqueueModel(value);
2577
+ else {
2578
+ var resolveListeners = chunk.value,
2579
+ rejectListeners = chunk.reason;
2580
+ chunk.status = "resolved_model";
2581
+ chunk.value = value;
2582
+ chunk.reason = id;
2583
+ if (null !== resolveListeners)
2584
+ switch ((initializeModelChunk(chunk), chunk.status)) {
2585
+ case "fulfilled":
2586
+ wakeChunk(resolveListeners, chunk.value);
2587
+ break;
2588
+ case "pending":
2589
+ case "blocked":
2590
+ case "cyclic":
2591
+ if (chunk.value)
2592
+ for (value = 0; value < resolveListeners.length; value++)
2593
+ chunk.value.push(resolveListeners[value]);
2594
+ else chunk.value = resolveListeners;
2595
+ if (chunk.reason) {
2596
+ if (rejectListeners)
2597
+ for (value = 0; value < rejectListeners.length; value++)
2598
+ chunk.reason.push(rejectListeners[value]);
2599
+ } else chunk.reason = rejectListeners;
2600
+ break;
2601
+ case "rejected":
2602
+ rejectListeners && wakeChunk(rejectListeners, chunk.reason);
2603
+ }
2604
+ }
2605
+ }
2606
+ function createResolvedIteratorResultChunk(response, value, done) {
2607
+ return new Chunk(
2608
+ "resolved_model",
2609
+ (done ? '{"done":true,"value":' : '{"done":false,"value":') +
2610
+ value +
2611
+ "}",
2612
+ -1,
2613
+ response
2614
+ );
2615
+ }
2616
+ function resolveIteratorResultChunk(chunk, value, done) {
2617
+ resolveModelChunk(
2618
+ chunk,
2619
+ (done ? '{"done":true,"value":' : '{"done":false,"value":') +
2620
+ value +
2621
+ "}",
2622
+ -1
2623
+ );
2624
+ }
2625
+ function loadServerReference$1(
2626
+ response,
2627
+ id,
2628
+ bound,
2629
+ parentChunk,
2630
+ parentObject,
2631
+ key
2632
+ ) {
2633
+ var serverReference = resolveServerReference(response._bundlerConfig, id);
2634
+ id = preloadModule(serverReference);
2635
+ if (bound)
2636
+ bound = Promise.all([bound, id]).then(function (_ref) {
2637
+ _ref = _ref[0];
2638
+ var fn = requireModule(serverReference);
2639
+ return fn.bind.apply(fn, [null].concat(_ref));
2640
+ });
2641
+ else if (id)
2642
+ bound = Promise.resolve(id).then(function () {
2643
+ return requireModule(serverReference);
2644
+ });
2645
+ else return requireModule(serverReference);
2646
+ bound.then(
2647
+ createModelResolver(
2648
+ parentChunk,
2649
+ parentObject,
2650
+ key,
2651
+ !1,
2652
+ response,
2653
+ createModel,
2654
+ []
2655
+ ),
2656
+ createModelReject(parentChunk)
2657
+ );
2658
+ return null;
2659
+ }
2660
+ function reviveModel(response, parentObj, parentKey, value, reference) {
2661
+ if ("string" === typeof value)
2662
+ return parseModelString(
2663
+ response,
2664
+ parentObj,
2665
+ parentKey,
2666
+ value,
2667
+ reference
2668
+ );
2669
+ if ("object" === typeof value && null !== value)
2670
+ if (
2671
+ (void 0 !== reference &&
2672
+ void 0 !== response._temporaryReferences &&
2673
+ response._temporaryReferences.set(value, reference),
2674
+ Array.isArray(value))
2675
+ )
2676
+ for (var i = 0; i < value.length; i++)
2677
+ value[i] = reviveModel(
2678
+ response,
2679
+ value,
2680
+ "" + i,
2681
+ value[i],
2682
+ void 0 !== reference ? reference + ":" + i : void 0
2683
+ );
2684
+ else
2685
+ for (i in value)
2686
+ hasOwnProperty.call(value, i) &&
2687
+ ((parentObj =
2688
+ void 0 !== reference && -1 === i.indexOf(":")
2689
+ ? reference + ":" + i
2690
+ : void 0),
2691
+ (parentObj = reviveModel(
2692
+ response,
2693
+ value,
2694
+ i,
2695
+ value[i],
2696
+ parentObj
2697
+ )),
2698
+ void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
2699
+ return value;
2700
+ }
2701
+ function initializeModelChunk(chunk) {
2702
+ var prevChunk = initializingChunk,
2703
+ prevBlocked = initializingChunkBlockedModel;
2704
+ initializingChunk = chunk;
2705
+ initializingChunkBlockedModel = null;
2706
+ var rootReference =
2707
+ -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
2708
+ resolvedModel = chunk.value;
2709
+ chunk.status = "cyclic";
2710
+ chunk.value = null;
2711
+ chunk.reason = null;
2712
+ try {
2713
+ var rawModel = JSON.parse(resolvedModel),
2714
+ value = reviveModel(
2715
+ chunk._response,
2716
+ { "": rawModel },
2717
+ "",
2718
+ rawModel,
2719
+ rootReference
2720
+ );
2721
+ if (
2722
+ null !== initializingChunkBlockedModel &&
2723
+ 0 < initializingChunkBlockedModel.deps
2724
+ )
2725
+ (initializingChunkBlockedModel.value = value),
2726
+ (chunk.status = "blocked");
2727
+ else {
2728
+ var resolveListeners = chunk.value;
2729
+ chunk.status = "fulfilled";
2730
+ chunk.value = value;
2731
+ null !== resolveListeners && wakeChunk(resolveListeners, value);
2732
+ }
2733
+ } catch (error) {
2734
+ (chunk.status = "rejected"), (chunk.reason = error);
2735
+ } finally {
2736
+ (initializingChunk = prevChunk),
2737
+ (initializingChunkBlockedModel = prevBlocked);
2738
+ }
2739
+ }
2740
+ function reportGlobalError(response, error) {
2741
+ response._chunks.forEach(function (chunk) {
2742
+ "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
2743
+ });
2744
+ }
2745
+ function getChunk(response, id) {
2746
+ var chunks = response._chunks,
2747
+ chunk = chunks.get(id);
2748
+ chunk ||
2749
+ ((chunk = response._formData.get(response._prefix + id)),
2750
+ (chunk =
2751
+ null != chunk
2752
+ ? new Chunk("resolved_model", chunk, id, response)
2753
+ : createPendingChunk(response)),
2754
+ chunks.set(id, chunk));
2755
+ return chunk;
2756
+ }
2757
+ function createModelResolver(
2758
+ chunk,
2759
+ parentObject,
2760
+ key,
2761
+ cyclic,
2762
+ response,
2763
+ map,
2764
+ path
2765
+ ) {
2766
+ if (initializingChunkBlockedModel) {
2767
+ var blocked = initializingChunkBlockedModel;
2768
+ cyclic || blocked.deps++;
2769
+ } else
2770
+ blocked = initializingChunkBlockedModel = {
2771
+ deps: cyclic ? 0 : 1,
2772
+ value: null
2773
+ };
2774
+ return function (value) {
2775
+ for (var i = 1; i < path.length; i++) value = value[path[i]];
2776
+ parentObject[key] = map(response, value);
2777
+ "" === key &&
2778
+ null === blocked.value &&
2779
+ (blocked.value = parentObject[key]);
2780
+ blocked.deps--;
2781
+ 0 === blocked.deps &&
2782
+ "blocked" === chunk.status &&
2783
+ ((value = chunk.value),
2784
+ (chunk.status = "fulfilled"),
2785
+ (chunk.value = blocked.value),
2786
+ null !== value && wakeChunk(value, blocked.value));
2787
+ };
2788
+ }
2789
+ function createModelReject(chunk) {
2790
+ return function (error) {
2791
+ return triggerErrorOnChunk(chunk, error);
2792
+ };
2793
+ }
2794
+ function getOutlinedModel(response, reference, parentObject, key, map) {
2795
+ reference = reference.split(":");
2796
+ var id = parseInt(reference[0], 16);
2797
+ id = getChunk(response, id);
2798
+ switch (id.status) {
2799
+ case "resolved_model":
2800
+ initializeModelChunk(id);
2801
+ }
2802
+ switch (id.status) {
2803
+ case "fulfilled":
2804
+ parentObject = id.value;
2805
+ for (key = 1; key < reference.length; key++)
2806
+ parentObject = parentObject[reference[key]];
2807
+ return map(response, parentObject);
2808
+ case "pending":
2809
+ case "blocked":
2810
+ case "cyclic":
2811
+ var parentChunk = initializingChunk;
2812
+ id.then(
2813
+ createModelResolver(
2814
+ parentChunk,
2815
+ parentObject,
2816
+ key,
2817
+ "cyclic" === id.status,
2818
+ response,
2819
+ map,
2820
+ reference
2821
+ ),
2822
+ createModelReject(parentChunk)
2823
+ );
2824
+ return null;
2825
+ default:
2826
+ throw id.reason;
2827
+ }
2828
+ }
2829
+ function createMap(response, model) {
2830
+ return new Map(model);
2831
+ }
2832
+ function createSet(response, model) {
2833
+ return new Set(model);
2834
+ }
2835
+ function extractIterator(response, model) {
2836
+ return model[Symbol.iterator]();
2837
+ }
2838
+ function createModel(response, model) {
2839
+ return model;
2840
+ }
2841
+ function parseTypedArray(
2842
+ response,
2843
+ reference,
2844
+ constructor,
2845
+ bytesPerElement,
2846
+ parentObject,
2847
+ parentKey
2848
+ ) {
2849
+ reference = parseInt(reference.slice(2), 16);
2850
+ reference = response._formData.get(response._prefix + reference);
2851
+ reference =
2852
+ constructor === ArrayBuffer
2853
+ ? reference.arrayBuffer()
2854
+ : reference.arrayBuffer().then(function (buffer) {
2855
+ return new constructor(buffer);
2856
+ });
2857
+ bytesPerElement = initializingChunk;
2858
+ reference.then(
2859
+ createModelResolver(
2860
+ bytesPerElement,
2861
+ parentObject,
2862
+ parentKey,
2863
+ !1,
2864
+ response,
2865
+ createModel,
2866
+ []
2867
+ ),
2868
+ createModelReject(bytesPerElement)
2869
+ );
2870
+ return null;
2871
+ }
2872
+ function resolveStream(response, id, stream, controller) {
2873
+ var chunks = response._chunks;
2874
+ stream = new Chunk("fulfilled", stream, controller, response);
2875
+ chunks.set(id, stream);
2876
+ response = response._formData.getAll(response._prefix + id);
2877
+ for (id = 0; id < response.length; id++)
2878
+ (chunks = response[id]),
2879
+ "C" === chunks[0]
2880
+ ? controller.close(
2881
+ "C" === chunks ? '"$undefined"' : chunks.slice(1)
2882
+ )
2883
+ : controller.enqueueModel(chunks);
2884
+ }
2885
+ function parseReadableStream(response, reference, type) {
2886
+ reference = parseInt(reference.slice(2), 16);
2887
+ var controller = null;
2888
+ type = new ReadableStream({
2889
+ type: type,
2890
+ start: function (c) {
2891
+ controller = c;
2892
+ }
2893
+ });
2894
+ var previousBlockedChunk = null;
2895
+ resolveStream(response, reference, type, {
2896
+ enqueueModel: function (json) {
2897
+ if (null === previousBlockedChunk) {
2898
+ var chunk = new Chunk("resolved_model", json, -1, response);
2899
+ initializeModelChunk(chunk);
2900
+ "fulfilled" === chunk.status
2901
+ ? controller.enqueue(chunk.value)
2902
+ : (chunk.then(
2903
+ function (v) {
2904
+ return controller.enqueue(v);
2905
+ },
2906
+ function (e) {
2907
+ return controller.error(e);
2908
+ }
2909
+ ),
2910
+ (previousBlockedChunk = chunk));
2911
+ } else {
2912
+ chunk = previousBlockedChunk;
2913
+ var _chunk = createPendingChunk(response);
2914
+ _chunk.then(
2915
+ function (v) {
2916
+ return controller.enqueue(v);
2917
+ },
2918
+ function (e) {
2919
+ return controller.error(e);
2920
+ }
2921
+ );
2922
+ previousBlockedChunk = _chunk;
2923
+ chunk.then(function () {
2924
+ previousBlockedChunk === _chunk && (previousBlockedChunk = null);
2925
+ resolveModelChunk(_chunk, json, -1);
2926
+ });
2927
+ }
2928
+ },
2929
+ close: function () {
2930
+ if (null === previousBlockedChunk) controller.close();
2931
+ else {
2932
+ var blockedChunk = previousBlockedChunk;
2933
+ previousBlockedChunk = null;
2934
+ blockedChunk.then(function () {
2935
+ return controller.close();
2936
+ });
2937
+ }
2938
+ },
2939
+ error: function (error) {
2940
+ if (null === previousBlockedChunk) controller.error(error);
2941
+ else {
2942
+ var blockedChunk = previousBlockedChunk;
2943
+ previousBlockedChunk = null;
2944
+ blockedChunk.then(function () {
2945
+ return controller.error(error);
2946
+ });
2947
+ }
2948
+ }
2949
+ });
2950
+ return type;
2951
+ }
2952
+ function asyncIterator() {
2953
+ return this;
2954
+ }
2955
+ function createIterator(next) {
2956
+ next = { next: next };
2957
+ next[ASYNC_ITERATOR] = asyncIterator;
2958
+ return next;
2959
+ }
2960
+ function parseAsyncIterable(response, reference, iterator) {
2961
+ reference = parseInt(reference.slice(2), 16);
2962
+ var buffer = [],
2963
+ closed = !1,
2964
+ nextWriteIndex = 0,
2965
+ iterable = _defineProperty({}, ASYNC_ITERATOR, function () {
2966
+ var nextReadIndex = 0;
2967
+ return createIterator(function (arg) {
2968
+ if (void 0 !== arg)
2969
+ throw Error(
2970
+ "Values cannot be passed to next() of AsyncIterables passed to Client Components."
2971
+ );
2972
+ if (nextReadIndex === buffer.length) {
2973
+ if (closed)
2974
+ return new Chunk(
2975
+ "fulfilled",
2976
+ { done: !0, value: void 0 },
2977
+ null,
2978
+ response
2979
+ );
2980
+ buffer[nextReadIndex] = createPendingChunk(response);
2981
+ }
2982
+ return buffer[nextReadIndex++];
2983
+ });
2984
+ });
2985
+ iterator = iterator ? iterable[ASYNC_ITERATOR]() : iterable;
2986
+ resolveStream(response, reference, iterator, {
2987
+ enqueueModel: function (value) {
2988
+ nextWriteIndex === buffer.length
2989
+ ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
2990
+ response,
2991
+ value,
2992
+ !1
2993
+ ))
2994
+ : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
2995
+ nextWriteIndex++;
2996
+ },
2997
+ close: function (value) {
2998
+ closed = !0;
2999
+ nextWriteIndex === buffer.length
3000
+ ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
3001
+ response,
3002
+ value,
3003
+ !0
3004
+ ))
3005
+ : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
3006
+ for (nextWriteIndex++; nextWriteIndex < buffer.length; )
3007
+ resolveIteratorResultChunk(
3008
+ buffer[nextWriteIndex++],
3009
+ '"$undefined"',
3010
+ !0
3011
+ );
3012
+ },
3013
+ error: function (error) {
3014
+ closed = !0;
3015
+ for (
3016
+ nextWriteIndex === buffer.length &&
3017
+ (buffer[nextWriteIndex] = createPendingChunk(response));
3018
+ nextWriteIndex < buffer.length;
3019
+
3020
+ )
3021
+ triggerErrorOnChunk(buffer[nextWriteIndex++], error);
3022
+ }
3023
+ });
3024
+ return iterator;
3025
+ }
3026
+ function parseModelString(response, obj, key, value, reference) {
3027
+ if ("$" === value[0]) {
3028
+ switch (value[1]) {
3029
+ case "$":
3030
+ return value.slice(1);
3031
+ case "@":
3032
+ return (
3033
+ (obj = parseInt(value.slice(2), 16)), getChunk(response, obj)
3034
+ );
3035
+ case "F":
3036
+ return (
3037
+ (value = value.slice(2)),
3038
+ (value = getOutlinedModel(
3039
+ response,
3040
+ value,
3041
+ obj,
3042
+ key,
3043
+ createModel
3044
+ )),
3045
+ loadServerReference$1(
3046
+ response,
3047
+ value.id,
3048
+ value.bound,
3049
+ initializingChunk,
3050
+ obj,
3051
+ key
3052
+ )
3053
+ );
3054
+ case "T":
3055
+ if (
3056
+ void 0 === reference ||
3057
+ void 0 === response._temporaryReferences
3058
+ )
3059
+ throw Error(
3060
+ "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
3061
+ );
3062
+ return createTemporaryReference(
3063
+ response._temporaryReferences,
3064
+ reference
3065
+ );
3066
+ case "Q":
3067
+ return (
3068
+ (value = value.slice(2)),
3069
+ getOutlinedModel(response, value, obj, key, createMap)
3070
+ );
3071
+ case "W":
3072
+ return (
3073
+ (value = value.slice(2)),
3074
+ getOutlinedModel(response, value, obj, key, createSet)
3075
+ );
3076
+ case "K":
3077
+ obj = value.slice(2);
3078
+ var formPrefix = response._prefix + obj + "_",
3079
+ data = new FormData();
3080
+ response._formData.forEach(function (entry, entryKey) {
3081
+ entryKey.startsWith(formPrefix) &&
3082
+ data.append(entryKey.slice(formPrefix.length), entry);
3083
+ });
3084
+ return data;
3085
+ case "i":
3086
+ return (
3087
+ (value = value.slice(2)),
3088
+ getOutlinedModel(response, value, obj, key, extractIterator)
3089
+ );
3090
+ case "I":
3091
+ return Infinity;
3092
+ case "-":
3093
+ return "$-0" === value ? -0 : -Infinity;
3094
+ case "N":
3095
+ return NaN;
3096
+ case "u":
3097
+ return;
3098
+ case "D":
3099
+ return new Date(Date.parse(value.slice(2)));
3100
+ case "n":
3101
+ return BigInt(value.slice(2));
3102
+ }
3103
+ switch (value[1]) {
3104
+ case "A":
3105
+ return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
3106
+ case "O":
3107
+ return parseTypedArray(response, value, Int8Array, 1, obj, key);
3108
+ case "o":
3109
+ return parseTypedArray(response, value, Uint8Array, 1, obj, key);
3110
+ case "U":
3111
+ return parseTypedArray(
3112
+ response,
3113
+ value,
3114
+ Uint8ClampedArray,
3115
+ 1,
3116
+ obj,
3117
+ key
3118
+ );
3119
+ case "S":
3120
+ return parseTypedArray(response, value, Int16Array, 2, obj, key);
3121
+ case "s":
3122
+ return parseTypedArray(response, value, Uint16Array, 2, obj, key);
3123
+ case "L":
3124
+ return parseTypedArray(response, value, Int32Array, 4, obj, key);
3125
+ case "l":
3126
+ return parseTypedArray(response, value, Uint32Array, 4, obj, key);
3127
+ case "G":
3128
+ return parseTypedArray(response, value, Float32Array, 4, obj, key);
3129
+ case "g":
3130
+ return parseTypedArray(response, value, Float64Array, 8, obj, key);
3131
+ case "M":
3132
+ return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
3133
+ case "m":
3134
+ return parseTypedArray(
3135
+ response,
3136
+ value,
3137
+ BigUint64Array,
3138
+ 8,
3139
+ obj,
3140
+ key
3141
+ );
3142
+ case "V":
3143
+ return parseTypedArray(response, value, DataView, 1, obj, key);
3144
+ case "B":
3145
+ return (
3146
+ (obj = parseInt(value.slice(2), 16)),
3147
+ response._formData.get(response._prefix + obj)
3148
+ );
3149
+ }
3150
+ switch (value[1]) {
3151
+ case "R":
3152
+ return parseReadableStream(response, value, void 0);
3153
+ case "r":
3154
+ return parseReadableStream(response, value, "bytes");
3155
+ case "X":
3156
+ return parseAsyncIterable(response, value, !1);
3157
+ case "x":
3158
+ return parseAsyncIterable(response, value, !0);
3159
+ }
3160
+ value = value.slice(1);
3161
+ return getOutlinedModel(response, value, obj, key, createModel);
3162
+ }
3163
+ return value;
3164
+ }
3165
+ function createResponse(
3166
+ bundlerConfig,
3167
+ formFieldPrefix,
3168
+ temporaryReferences
3169
+ ) {
3170
+ var backingFormData =
3171
+ 3 < arguments.length && void 0 !== arguments[3]
3172
+ ? arguments[3]
3173
+ : new FormData(),
3174
+ chunks = new Map();
3175
+ return {
3176
+ _bundlerConfig: bundlerConfig,
3177
+ _prefix: formFieldPrefix,
3178
+ _formData: backingFormData,
3179
+ _chunks: chunks,
3180
+ _temporaryReferences: temporaryReferences
3181
+ };
3182
+ }
3183
+ function close(response) {
3184
+ reportGlobalError(response, Error("Connection closed."));
3185
+ }
3186
+ function loadServerReference(bundlerConfig, id, bound) {
3187
+ var serverReference = resolveServerReference(bundlerConfig, id);
3188
+ bundlerConfig = preloadModule(serverReference);
3189
+ return bound
3190
+ ? Promise.all([bound, bundlerConfig]).then(function (_ref) {
3191
+ _ref = _ref[0];
3192
+ var fn = requireModule(serverReference);
3193
+ return fn.bind.apply(fn, [null].concat(_ref));
3194
+ })
3195
+ : bundlerConfig
3196
+ ? Promise.resolve(bundlerConfig).then(function () {
3197
+ return requireModule(serverReference);
3198
+ })
3199
+ : Promise.resolve(requireModule(serverReference));
3200
+ }
3201
+ function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
3202
+ body = createResponse(serverManifest, formFieldPrefix, void 0, body);
3203
+ close(body);
3204
+ body = getChunk(body, 0);
3205
+ body.then(function () {});
3206
+ if ("fulfilled" !== body.status) throw body.reason;
3207
+ return body.value;
3208
+ }
3209
+ var ReactDOM = require("react-dom"),
3210
+ React = require("react"),
3211
+ LocalPromise = Promise,
3212
+ scheduleMicrotask =
3213
+ "function" === typeof queueMicrotask
3214
+ ? queueMicrotask
3215
+ : function (callback) {
3216
+ LocalPromise.resolve(null)
3217
+ .then(callback)
3218
+ .catch(handleErrorInNextTick);
3219
+ },
3220
+ currentView = null,
3221
+ writtenBytes = 0,
3222
+ textEncoder = new TextEncoder(),
3223
+ CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
3224
+ SERVER_REFERENCE_TAG = Symbol.for("react.server.reference"),
3225
+ FunctionBind = Function.prototype.bind,
3226
+ ArraySlice = Array.prototype.slice,
3227
+ PROMISE_PROTOTYPE = Promise.prototype,
3228
+ deepProxyHandlers = {
3229
+ get: function (target, name) {
3230
+ switch (name) {
3231
+ case "$$typeof":
3232
+ return target.$$typeof;
3233
+ case "$$id":
3234
+ return target.$$id;
3235
+ case "$$async":
3236
+ return target.$$async;
3237
+ case "name":
3238
+ return target.name;
3239
+ case "displayName":
3240
+ return;
3241
+ case "defaultProps":
3242
+ return;
3243
+ case "toJSON":
3244
+ return;
3245
+ case Symbol.toPrimitive:
3246
+ return Object.prototype[Symbol.toPrimitive];
3247
+ case Symbol.toStringTag:
3248
+ return Object.prototype[Symbol.toStringTag];
3249
+ case "Provider":
3250
+ throw Error(
3251
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3252
+ );
3253
+ case "then":
3254
+ throw Error(
3255
+ "Cannot await or return from a thenable. You cannot await a client module from a server component."
3256
+ );
3257
+ }
3258
+ throw Error(
3259
+ "Cannot access " +
3260
+ (String(target.name) + "." + String(name)) +
3261
+ " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
3262
+ );
3263
+ },
3264
+ set: function () {
3265
+ throw Error("Cannot assign to a client module from a server module.");
3266
+ }
3267
+ },
3268
+ proxyHandlers$1 = {
3269
+ get: function (target, name) {
3270
+ return getReference(target, name);
3271
+ },
3272
+ getOwnPropertyDescriptor: function (target, name) {
3273
+ var descriptor = Object.getOwnPropertyDescriptor(target, name);
3274
+ descriptor ||
3275
+ ((descriptor = {
3276
+ value: getReference(target, name),
3277
+ writable: !1,
3278
+ configurable: !1,
3279
+ enumerable: !1
3280
+ }),
3281
+ Object.defineProperty(target, name, descriptor));
3282
+ return descriptor;
3283
+ },
3284
+ getPrototypeOf: function () {
3285
+ return PROMISE_PROTOTYPE;
3286
+ },
3287
+ set: function () {
3288
+ throw Error("Cannot assign to a client module from a server module.");
3289
+ }
3290
+ },
3291
+ ReactDOMSharedInternals =
3292
+ ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
3293
+ previousDispatcher = ReactDOMSharedInternals.d;
3294
+ ReactDOMSharedInternals.d = {
3295
+ f: previousDispatcher.f,
3296
+ r: previousDispatcher.r,
3297
+ D: function (href) {
3298
+ if ("string" === typeof href && href) {
3299
+ var request = resolveRequest();
3300
+ if (request) {
3301
+ var hints = request.hints,
3302
+ key = "D|" + href;
3303
+ hints.has(key) || (hints.add(key), emitHint(request, "D", href));
3304
+ } else previousDispatcher.D(href);
3305
+ }
3306
+ },
3307
+ C: function (href, crossOrigin) {
3308
+ if ("string" === typeof href) {
3309
+ var request = resolveRequest();
3310
+ if (request) {
3311
+ var hints = request.hints,
3312
+ key =
3313
+ "C|" +
3314
+ (null == crossOrigin ? "null" : crossOrigin) +
3315
+ "|" +
3316
+ href;
3317
+ hints.has(key) ||
3318
+ (hints.add(key),
3319
+ "string" === typeof crossOrigin
3320
+ ? emitHint(request, "C", [href, crossOrigin])
3321
+ : emitHint(request, "C", href));
3322
+ } else previousDispatcher.C(href, crossOrigin);
3323
+ }
3324
+ },
3325
+ L: function (href, as, options) {
3326
+ if ("string" === typeof href) {
3327
+ var request = resolveRequest();
3328
+ if (request) {
3329
+ var hints = request.hints,
3330
+ key = "L";
3331
+ if ("image" === as && options) {
3332
+ var imageSrcSet = options.imageSrcSet,
3333
+ imageSizes = options.imageSizes,
3334
+ uniquePart = "";
3335
+ "string" === typeof imageSrcSet && "" !== imageSrcSet
3336
+ ? ((uniquePart += "[" + imageSrcSet + "]"),
3337
+ "string" === typeof imageSizes &&
3338
+ (uniquePart += "[" + imageSizes + "]"))
3339
+ : (uniquePart += "[][]" + href);
3340
+ key += "[image]" + uniquePart;
3341
+ } else key += "[" + as + "]" + href;
3342
+ hints.has(key) ||
3343
+ (hints.add(key),
3344
+ (options = trimOptions(options))
3345
+ ? emitHint(request, "L", [href, as, options])
3346
+ : emitHint(request, "L", [href, as]));
3347
+ } else previousDispatcher.L(href, as, options);
3348
+ }
3349
+ },
3350
+ m: function (href, options) {
3351
+ if ("string" === typeof href) {
3352
+ var request = resolveRequest();
3353
+ if (request) {
3354
+ var hints = request.hints,
3355
+ key = "m|" + href;
3356
+ if (hints.has(key)) return;
3357
+ hints.add(key);
3358
+ return (options = trimOptions(options))
3359
+ ? emitHint(request, "m", [href, options])
3360
+ : emitHint(request, "m", href);
3361
+ }
3362
+ previousDispatcher.m(href, options);
3363
+ }
3364
+ },
3365
+ X: function (src, options) {
3366
+ if ("string" === typeof src) {
3367
+ var request = resolveRequest();
3368
+ if (request) {
3369
+ var hints = request.hints,
3370
+ key = "X|" + src;
3371
+ if (hints.has(key)) return;
3372
+ hints.add(key);
3373
+ return (options = trimOptions(options))
3374
+ ? emitHint(request, "X", [src, options])
3375
+ : emitHint(request, "X", src);
3376
+ }
3377
+ previousDispatcher.X(src, options);
3378
+ }
3379
+ },
3380
+ S: function (href, precedence, options) {
3381
+ if ("string" === typeof href) {
3382
+ var request = resolveRequest();
3383
+ if (request) {
3384
+ var hints = request.hints,
3385
+ key = "S|" + href;
3386
+ if (hints.has(key)) return;
3387
+ hints.add(key);
3388
+ return (options = trimOptions(options))
3389
+ ? emitHint(request, "S", [
3390
+ href,
3391
+ "string" === typeof precedence ? precedence : 0,
3392
+ options
3393
+ ])
3394
+ : "string" === typeof precedence
3395
+ ? emitHint(request, "S", [href, precedence])
3396
+ : emitHint(request, "S", href);
3397
+ }
3398
+ previousDispatcher.S(href, precedence, options);
3399
+ }
3400
+ },
3401
+ M: function (src, options) {
3402
+ if ("string" === typeof src) {
3403
+ var request = resolveRequest();
3404
+ if (request) {
3405
+ var hints = request.hints,
3406
+ key = "M|" + src;
3407
+ if (hints.has(key)) return;
3408
+ hints.add(key);
3409
+ return (options = trimOptions(options))
3410
+ ? emitHint(request, "M", [src, options])
3411
+ : emitHint(request, "M", src);
3412
+ }
3413
+ previousDispatcher.M(src, options);
3414
+ }
3415
+ }
3416
+ };
3417
+ var frameRegExp =
3418
+ /^ {3} at (?:(.+) \((?:(.+):(\d+):(\d+)|<anonymous>)\)|(?:async )?(.+):(\d+):(\d+)|<anonymous>)$/,
3419
+ supportsRequestStorage = "function" === typeof AsyncLocalStorage,
3420
+ requestStorage = supportsRequestStorage ? new AsyncLocalStorage() : null,
3421
+ supportsComponentStorage = supportsRequestStorage,
3422
+ componentStorage = supportsComponentStorage
3423
+ ? new AsyncLocalStorage()
3424
+ : null;
3425
+ "object" === typeof async_hooks
3426
+ ? async_hooks.createHook
3427
+ : function () {
3428
+ return { enable: function () {}, disable: function () {} };
3429
+ };
3430
+ "object" === typeof async_hooks ? async_hooks.executionAsyncId : null;
3431
+ var TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
3432
+ proxyHandlers = {
3433
+ get: function (target, name) {
3434
+ switch (name) {
3435
+ case "$$typeof":
3436
+ return target.$$typeof;
3437
+ case "name":
3438
+ return;
3439
+ case "displayName":
3440
+ return;
3441
+ case "defaultProps":
3442
+ return;
3443
+ case "toJSON":
3444
+ return;
3445
+ case Symbol.toPrimitive:
3446
+ return Object.prototype[Symbol.toPrimitive];
3447
+ case Symbol.toStringTag:
3448
+ return Object.prototype[Symbol.toStringTag];
3449
+ case "Provider":
3450
+ throw Error(
3451
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3452
+ );
3453
+ }
3454
+ throw Error(
3455
+ "Cannot access " +
3456
+ String(name) +
3457
+ " 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."
3458
+ );
3459
+ },
3460
+ set: function () {
3461
+ throw Error(
3462
+ "Cannot assign to a temporary client reference from a server module."
3463
+ );
3464
+ }
3465
+ },
3466
+ REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
3467
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
3468
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
3469
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
3470
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
3471
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
3472
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
3473
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
3474
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
3475
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
3476
+ Symbol.for("react.postpone");
3477
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3478
+ ASYNC_ITERATOR = Symbol.asyncIterator,
3479
+ SuspenseException = Error(
3480
+ "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`"
3481
+ ),
3482
+ suspendedThenable = null,
3483
+ currentRequest$1 = null,
3484
+ thenableIndexCounter = 0,
3485
+ thenableState = null,
3486
+ currentComponentDebugInfo = null,
3487
+ HooksDispatcher = {
3488
+ useMemo: function (nextCreate) {
3489
+ return nextCreate();
3490
+ },
3491
+ useCallback: function (callback) {
3492
+ return callback;
3493
+ },
3494
+ useDebugValue: function () {},
3495
+ useDeferredValue: unsupportedHook,
3496
+ useTransition: unsupportedHook,
3497
+ readContext: unsupportedContext,
3498
+ useContext: unsupportedContext,
3499
+ useReducer: unsupportedHook,
3500
+ useRef: unsupportedHook,
3501
+ useState: unsupportedHook,
3502
+ useInsertionEffect: unsupportedHook,
3503
+ useLayoutEffect: unsupportedHook,
3504
+ useImperativeHandle: unsupportedHook,
3505
+ useEffect: unsupportedHook,
3506
+ useId: function () {
3507
+ if (null === currentRequest$1)
3508
+ throw Error("useId can only be used while React is rendering");
3509
+ var id = currentRequest$1.identifierCount++;
3510
+ return (
3511
+ ":" +
3512
+ currentRequest$1.identifierPrefix +
3513
+ "S" +
3514
+ id.toString(32) +
3515
+ ":"
3516
+ );
3517
+ },
3518
+ useSyncExternalStore: unsupportedHook,
3519
+ useCacheRefresh: function () {
3520
+ return unsupportedRefresh;
3521
+ },
3522
+ useMemoCache: function (size) {
3523
+ for (var data = Array(size), i = 0; i < size; i++)
3524
+ data[i] = REACT_MEMO_CACHE_SENTINEL;
3525
+ return data;
3526
+ },
3527
+ use: function (usable) {
3528
+ if (
3529
+ (null !== usable && "object" === typeof usable) ||
3530
+ "function" === typeof usable
3531
+ ) {
3532
+ if ("function" === typeof usable.then) {
3533
+ var index = thenableIndexCounter;
3534
+ thenableIndexCounter += 1;
3535
+ null === thenableState && (thenableState = []);
3536
+ return trackUsedThenable(thenableState, usable, index);
3537
+ }
3538
+ usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
3539
+ }
3540
+ if (isClientReference(usable)) {
3541
+ if (
3542
+ null != usable.value &&
3543
+ usable.value.$$typeof === REACT_CONTEXT_TYPE
3544
+ )
3545
+ throw Error(
3546
+ "Cannot read a Client Context from a Server Component."
3547
+ );
3548
+ throw Error("Cannot use() an already resolved Client Reference.");
3549
+ }
3550
+ throw Error(
3551
+ "An unsupported type was passed to use(): " + String(usable)
3552
+ );
3553
+ }
3554
+ },
3555
+ currentOwner = null,
3556
+ DefaultAsyncDispatcher = {
3557
+ getCacheForType: function (resourceType) {
3558
+ var cache = (cache = resolveRequest()) ? cache.cache : new Map();
3559
+ var entry = cache.get(resourceType);
3560
+ void 0 === entry &&
3561
+ ((entry = resourceType()), cache.set(resourceType, entry));
3562
+ return entry;
3563
+ }
3564
+ };
3565
+ DefaultAsyncDispatcher.getOwner = resolveOwner;
3566
+ var ReactSharedInternalsServer =
3567
+ React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
3568
+ if (!ReactSharedInternalsServer)
3569
+ throw Error(
3570
+ '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.'
3571
+ );
3572
+ new ("function" === typeof WeakMap ? WeakMap : Map)();
3573
+ var callComponent = {
3574
+ "react-stack-bottom-frame": function (
3575
+ Component,
3576
+ props,
3577
+ componentDebugInfo
3578
+ ) {
3579
+ currentOwner = componentDebugInfo;
3580
+ try {
3581
+ return Component(props, void 0);
3582
+ } finally {
3583
+ currentOwner = null;
3584
+ }
3585
+ }
3586
+ },
3587
+ callComponentInDEV =
3588
+ callComponent["react-stack-bottom-frame"].bind(callComponent),
3589
+ callLazyInit = {
3590
+ "react-stack-bottom-frame": function (lazy) {
3591
+ var init = lazy._init;
3592
+ return init(lazy._payload);
3593
+ }
3594
+ },
3595
+ callLazyInitInDEV =
3596
+ callLazyInit["react-stack-bottom-frame"].bind(callLazyInit),
3597
+ callIterator = {
3598
+ "react-stack-bottom-frame": function (iterator, progress, error) {
3599
+ iterator.next().then(progress, error);
3600
+ }
3601
+ },
3602
+ callIteratorInDEV =
3603
+ callIterator["react-stack-bottom-frame"].bind(callIterator),
3604
+ isArrayImpl = Array.isArray,
3605
+ getPrototypeOf = Object.getPrototypeOf,
3606
+ jsxPropsParents = new WeakMap(),
3607
+ jsxChildrenParents = new WeakMap(),
3608
+ CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
3609
+ doNotLimit = new WeakSet();
3610
+ "object" === typeof console &&
3611
+ null !== console &&
3612
+ (patchConsole(console, "assert"),
3613
+ patchConsole(console, "debug"),
3614
+ patchConsole(console, "dir"),
3615
+ patchConsole(console, "dirxml"),
3616
+ patchConsole(console, "error"),
3617
+ patchConsole(console, "group"),
3618
+ patchConsole(console, "groupCollapsed"),
3619
+ patchConsole(console, "groupEnd"),
3620
+ patchConsole(console, "info"),
3621
+ patchConsole(console, "log"),
3622
+ patchConsole(console, "table"),
3623
+ patchConsole(console, "trace"),
3624
+ patchConsole(console, "warn"));
3625
+ var ObjectPrototype = Object.prototype,
3626
+ stringify = JSON.stringify,
3627
+ PENDING$1 = 0,
3628
+ COMPLETED = 1,
3629
+ ABORTED = 3,
3630
+ ERRORED$1 = 4,
3631
+ RENDERING = 5,
3632
+ OPENING = 10,
3633
+ ABORTING = 12,
3634
+ CLOSING = 13,
3635
+ CLOSED = 14,
3636
+ PRERENDER = 21,
3637
+ currentRequest = null,
3638
+ debugID = null,
3639
+ modelRoot = !1,
3640
+ emptyRoot = {},
3641
+ chunkCache = new Map(),
3642
+ hasOwnProperty = Object.prototype.hasOwnProperty;
3643
+ Chunk.prototype = Object.create(Promise.prototype);
3644
+ Chunk.prototype.then = function (resolve, reject) {
3645
+ switch (this.status) {
3646
+ case "resolved_model":
3647
+ initializeModelChunk(this);
3648
+ }
3649
+ switch (this.status) {
3650
+ case "fulfilled":
3651
+ resolve(this.value);
3652
+ break;
3653
+ case "pending":
3654
+ case "blocked":
3655
+ case "cyclic":
3656
+ resolve &&
3657
+ (null === this.value && (this.value = []),
3658
+ this.value.push(resolve));
3659
+ reject &&
3660
+ (null === this.reason && (this.reason = []),
3661
+ this.reason.push(reject));
3662
+ break;
3663
+ default:
3664
+ reject(this.reason);
3665
+ }
3666
+ };
3667
+ var initializingChunk = null,
3668
+ initializingChunkBlockedModel = null;
3669
+ exports.createClientModuleProxy = function (moduleId) {
3670
+ moduleId = registerClientReferenceImpl({}, moduleId, !1);
3671
+ return new Proxy(moduleId, proxyHandlers$1);
3672
+ };
3673
+ exports.createTemporaryReferenceSet = function () {
3674
+ return new WeakMap();
3675
+ };
3676
+ exports.decodeAction = function (body, serverManifest) {
3677
+ var formData = new FormData(),
3678
+ action = null;
3679
+ body.forEach(function (value, key) {
3680
+ key.startsWith("$ACTION_")
3681
+ ? key.startsWith("$ACTION_REF_")
3682
+ ? ((value = "$ACTION_" + key.slice(12) + ":"),
3683
+ (value = decodeBoundActionMetaData(body, serverManifest, value)),
3684
+ (action = loadServerReference(
3685
+ serverManifest,
3686
+ value.id,
3687
+ value.bound
3688
+ )))
3689
+ : key.startsWith("$ACTION_ID_") &&
3690
+ ((value = key.slice(11)),
3691
+ (action = loadServerReference(serverManifest, value, null)))
3692
+ : formData.append(key, value);
3693
+ });
3694
+ return null === action
3695
+ ? null
3696
+ : action.then(function (fn) {
3697
+ return fn.bind(null, formData);
3698
+ });
3699
+ };
3700
+ exports.decodeFormState = function (actionResult, body, serverManifest) {
3701
+ var keyPath = body.get("$ACTION_KEY");
3702
+ if ("string" !== typeof keyPath) return Promise.resolve(null);
3703
+ var metaData = null;
3704
+ body.forEach(function (value, key) {
3705
+ key.startsWith("$ACTION_REF_") &&
3706
+ ((value = "$ACTION_" + key.slice(12) + ":"),
3707
+ (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
3708
+ });
3709
+ if (null === metaData) return Promise.resolve(null);
3710
+ var referenceId = metaData.id;
3711
+ return Promise.resolve(metaData.bound).then(function (bound) {
3712
+ return null === bound
3713
+ ? null
3714
+ : [actionResult, keyPath, referenceId, bound.length - 1];
3715
+ });
3716
+ };
3717
+ exports.decodeReply = function (body, webpackMap, options) {
3718
+ if ("string" === typeof body) {
3719
+ var form = new FormData();
3720
+ form.append("0", body);
3721
+ body = form;
3722
+ }
3723
+ body = createResponse(
3724
+ webpackMap,
3725
+ "",
3726
+ options ? options.temporaryReferences : void 0,
3727
+ body
3728
+ );
3729
+ webpackMap = getChunk(body, 0);
3730
+ close(body);
3731
+ return webpackMap;
3732
+ };
3733
+ exports.registerClientReference = function (
3734
+ proxyImplementation,
3735
+ id,
3736
+ exportName
3737
+ ) {
3738
+ return registerClientReferenceImpl(
3739
+ proxyImplementation,
3740
+ id + "#" + exportName,
3741
+ !1
3742
+ );
3743
+ };
3744
+ exports.registerServerReference = function (reference, id, exportName) {
3745
+ return Object.defineProperties(reference, {
3746
+ $$typeof: { value: SERVER_REFERENCE_TAG },
3747
+ $$id: {
3748
+ value: null === exportName ? id : id + "#" + exportName,
3749
+ configurable: !0
3750
+ },
3751
+ $$bound: { value: null, configurable: !0 },
3752
+ $$location: { value: Error("react-stack-top-frame"), configurable: !0 },
3753
+ bind: { value: bind, configurable: !0 }
3754
+ });
3755
+ };
3756
+ exports.renderToReadableStream = function (model, webpackMap, options) {
3757
+ var request = new RequestInstance(
3758
+ 20,
3759
+ model,
3760
+ webpackMap,
3761
+ options ? options.onError : void 0,
3762
+ options ? options.identifierPrefix : void 0,
3763
+ options ? options.onPostpone : void 0,
3764
+ options ? options.temporaryReferences : void 0,
3765
+ options ? options.environmentName : void 0,
3766
+ options ? options.filterStackFrame : void 0,
3767
+ noop,
3768
+ noop
3769
+ );
3770
+ if (options && options.signal) {
3771
+ var signal = options.signal;
3772
+ if (signal.aborted) abort(request, signal.reason);
3773
+ else {
3774
+ var listener = function () {
3775
+ abort(request, signal.reason);
3776
+ signal.removeEventListener("abort", listener);
3777
+ };
3778
+ signal.addEventListener("abort", listener);
3779
+ }
3780
+ }
3781
+ return new ReadableStream(
3782
+ {
3783
+ type: "bytes",
3784
+ start: function () {
3785
+ startWork(request);
3786
+ },
3787
+ pull: function (controller) {
3788
+ if (request.status === CLOSING)
3789
+ (request.status = CLOSED),
3790
+ closeWithError(controller, request.fatalError);
3791
+ else if (
3792
+ request.status !== CLOSED &&
3793
+ null === request.destination
3794
+ ) {
3795
+ request.destination = controller;
3796
+ try {
3797
+ flushCompletedChunks(request, controller);
3798
+ } catch (error) {
3799
+ logRecoverableError(request, error, null),
3800
+ fatalError(request, error);
3801
+ }
3802
+ }
3803
+ },
3804
+ cancel: function (reason) {
3805
+ request.destination = null;
3806
+ abort(request, reason);
3807
+ }
3808
+ },
3809
+ { highWaterMark: 0 }
3810
+ );
3811
+ };
3812
+ })();