react-server-dom-parcel 0.0.0

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