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