react-server-dom-webpack 18.3.0-next-fa4314841-20230502 → 19.0.0-beta-4508873393-20240430

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/cjs/react-server-dom-webpack-client.browser.development.js +1893 -1200
  2. package/cjs/react-server-dom-webpack-client.browser.production.js +931 -0
  3. package/cjs/react-server-dom-webpack-client.edge.development.js +1888 -241
  4. package/cjs/react-server-dom-webpack-client.edge.production.js +1093 -0
  5. package/cjs/react-server-dom-webpack-client.node.development.js +1876 -259
  6. package/cjs/react-server-dom-webpack-client.node.production.js +1070 -0
  7. package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +1833 -212
  8. package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +1049 -0
  9. package/cjs/react-server-dom-webpack-node-register.js +59 -10
  10. package/cjs/react-server-dom-webpack-plugin.js +389 -11
  11. package/cjs/react-server-dom-webpack-server.browser.development.js +2187 -937
  12. package/cjs/react-server-dom-webpack-server.browser.production.js +1935 -0
  13. package/cjs/react-server-dom-webpack-server.edge.development.js +2183 -941
  14. package/cjs/react-server-dom-webpack-server.edge.production.js +1956 -0
  15. package/cjs/react-server-dom-webpack-server.node.development.js +2169 -929
  16. package/cjs/react-server-dom-webpack-server.node.production.js +2083 -0
  17. package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2116 -881
  18. package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +2051 -0
  19. package/client.browser.js +1 -1
  20. package/client.edge.js +1 -1
  21. package/client.node.js +1 -1
  22. package/client.node.unbundled.js +1 -1
  23. package/esm/{react-server-dom-webpack-node-loader.production.min.js → react-server-dom-webpack-node-loader.production.js} +20 -13
  24. package/package.json +8 -15
  25. package/server.browser.js +1 -1
  26. package/server.edge.js +1 -1
  27. package/server.node.js +1 -1
  28. package/server.node.unbundled.js +1 -1
  29. package/cjs/react-server-dom-webpack-client.browser.production.min.js +0 -34
  30. package/cjs/react-server-dom-webpack-client.edge.production.min.js +0 -28
  31. package/cjs/react-server-dom-webpack-client.node.production.min.js +0 -28
  32. package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +0 -26
  33. package/cjs/react-server-dom-webpack-server.browser.production.min.js +0 -62
  34. package/cjs/react-server-dom-webpack-server.edge.production.min.js +0 -62
  35. package/cjs/react-server-dom-webpack-server.node.production.min.js +0 -67
  36. package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0 -65
  37. package/umd/react-server-dom-webpack-client.browser.development.js +0 -1731
  38. package/umd/react-server-dom-webpack-client.browser.production.min.js +0 -29
  39. package/umd/react-server-dom-webpack-server.browser.development.js +0 -2904
  40. package/umd/react-server-dom-webpack-server.browser.production.min.js +0 -51
@@ -0,0 +1,1956 @@
1
+ /**
2
+ * @license React
3
+ * react-server-dom-webpack-server.edge.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ "use strict";
12
+ var ReactDOM = require("react-dom"),
13
+ React = require("react"),
14
+ currentView = null,
15
+ writtenBytes = 0;
16
+ function writeChunkAndReturn(destination, chunk) {
17
+ if (0 !== chunk.byteLength)
18
+ if (2048 < chunk.byteLength)
19
+ 0 < writtenBytes &&
20
+ (destination.enqueue(
21
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
22
+ ),
23
+ (currentView = new Uint8Array(2048)),
24
+ (writtenBytes = 0)),
25
+ destination.enqueue(chunk);
26
+ else {
27
+ var allowableBytes = currentView.length - writtenBytes;
28
+ allowableBytes < chunk.byteLength &&
29
+ (0 === allowableBytes
30
+ ? destination.enqueue(currentView)
31
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
32
+ destination.enqueue(currentView),
33
+ (chunk = chunk.subarray(allowableBytes))),
34
+ (currentView = new Uint8Array(2048)),
35
+ (writtenBytes = 0));
36
+ currentView.set(chunk, writtenBytes);
37
+ writtenBytes += chunk.byteLength;
38
+ }
39
+ return !0;
40
+ }
41
+ var textEncoder = new TextEncoder();
42
+ function closeWithError(destination, error) {
43
+ "function" === typeof destination.error
44
+ ? destination.error(error)
45
+ : destination.close();
46
+ }
47
+ var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
48
+ SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
49
+ function registerClientReferenceImpl(proxyImplementation, id, async) {
50
+ return Object.defineProperties(proxyImplementation, {
51
+ $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
52
+ $$id: { value: id },
53
+ $$async: { value: async }
54
+ });
55
+ }
56
+ var FunctionBind = Function.prototype.bind,
57
+ ArraySlice = Array.prototype.slice;
58
+ function bind() {
59
+ var newFn = FunctionBind.apply(this, arguments);
60
+ if (this.$$typeof === SERVER_REFERENCE_TAG) {
61
+ var args = ArraySlice.call(arguments, 1);
62
+ return Object.defineProperties(newFn, {
63
+ $$typeof: { value: SERVER_REFERENCE_TAG },
64
+ $$id: { value: this.$$id },
65
+ $$bound: { value: this.$$bound ? this.$$bound.concat(args) : args },
66
+ bind: { value: bind }
67
+ });
68
+ }
69
+ return newFn;
70
+ }
71
+ var PROMISE_PROTOTYPE = Promise.prototype,
72
+ deepProxyHandlers = {
73
+ get: function (target, name) {
74
+ switch (name) {
75
+ case "$$typeof":
76
+ return target.$$typeof;
77
+ case "$$id":
78
+ return target.$$id;
79
+ case "$$async":
80
+ return target.$$async;
81
+ case "name":
82
+ return target.name;
83
+ case "displayName":
84
+ return;
85
+ case "defaultProps":
86
+ return;
87
+ case "toJSON":
88
+ return;
89
+ case Symbol.toPrimitive:
90
+ return Object.prototype[Symbol.toPrimitive];
91
+ case Symbol.toStringTag:
92
+ return Object.prototype[Symbol.toStringTag];
93
+ case "Provider":
94
+ throw Error(
95
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
96
+ );
97
+ }
98
+ throw Error(
99
+ "Cannot access " +
100
+ (String(target.name) + "." + String(name)) +
101
+ " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
102
+ );
103
+ },
104
+ set: function () {
105
+ throw Error("Cannot assign to a client module from a server module.");
106
+ }
107
+ };
108
+ function getReference(target, name) {
109
+ switch (name) {
110
+ case "$$typeof":
111
+ return target.$$typeof;
112
+ case "$$id":
113
+ return target.$$id;
114
+ case "$$async":
115
+ return target.$$async;
116
+ case "name":
117
+ return target.name;
118
+ case "defaultProps":
119
+ return;
120
+ case "toJSON":
121
+ return;
122
+ case Symbol.toPrimitive:
123
+ return Object.prototype[Symbol.toPrimitive];
124
+ case Symbol.toStringTag:
125
+ return Object.prototype[Symbol.toStringTag];
126
+ case "__esModule":
127
+ var moduleId = target.$$id;
128
+ target.default = registerClientReferenceImpl(
129
+ function () {
130
+ throw Error(
131
+ "Attempted to call the default export of " +
132
+ moduleId +
133
+ " from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
134
+ );
135
+ },
136
+ target.$$id + "#",
137
+ target.$$async
138
+ );
139
+ return !0;
140
+ case "then":
141
+ if (target.then) return target.then;
142
+ if (target.$$async) return;
143
+ var clientReference = registerClientReferenceImpl({}, target.$$id, !0),
144
+ proxy = new Proxy(clientReference, proxyHandlers$1);
145
+ target.status = "fulfilled";
146
+ target.value = proxy;
147
+ return (target.then = registerClientReferenceImpl(
148
+ function (resolve) {
149
+ return Promise.resolve(resolve(proxy));
150
+ },
151
+ target.$$id + "#then",
152
+ !1
153
+ ));
154
+ }
155
+ if ("symbol" === typeof name)
156
+ throw Error(
157
+ "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
158
+ );
159
+ clientReference = target[name];
160
+ clientReference ||
161
+ ((clientReference = registerClientReferenceImpl(
162
+ function () {
163
+ throw Error(
164
+ "Attempted to call " +
165
+ String(name) +
166
+ "() from the server but " +
167
+ String(name) +
168
+ " 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."
169
+ );
170
+ },
171
+ target.$$id + "#" + name,
172
+ target.$$async
173
+ )),
174
+ Object.defineProperty(clientReference, "name", { value: name }),
175
+ (clientReference = target[name] =
176
+ new Proxy(clientReference, deepProxyHandlers)));
177
+ return clientReference;
178
+ }
179
+ var proxyHandlers$1 = {
180
+ get: function (target, name) {
181
+ return getReference(target, name);
182
+ },
183
+ getOwnPropertyDescriptor: function (target, name) {
184
+ var descriptor = Object.getOwnPropertyDescriptor(target, name);
185
+ descriptor ||
186
+ ((descriptor = {
187
+ value: getReference(target, name),
188
+ writable: !1,
189
+ configurable: !1,
190
+ enumerable: !1
191
+ }),
192
+ Object.defineProperty(target, name, descriptor));
193
+ return descriptor;
194
+ },
195
+ getPrototypeOf: function () {
196
+ return PROMISE_PROTOTYPE;
197
+ },
198
+ set: function () {
199
+ throw Error("Cannot assign to a client module from a server module.");
200
+ }
201
+ },
202
+ ReactDOMSharedInternals =
203
+ ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
204
+ previousDispatcher = ReactDOMSharedInternals.d;
205
+ ReactDOMSharedInternals.d = {
206
+ f: previousDispatcher.f,
207
+ r: previousDispatcher.r,
208
+ D: prefetchDNS,
209
+ C: preconnect,
210
+ L: preload,
211
+ m: preloadModule$1,
212
+ X: preinitScript,
213
+ S: preinitStyle,
214
+ M: preinitModuleScript
215
+ };
216
+ function prefetchDNS(href) {
217
+ if ("string" === typeof href && href) {
218
+ var request = resolveRequest();
219
+ if (request) {
220
+ var hints = request.hints,
221
+ key = "D|" + href;
222
+ hints.has(key) || (hints.add(key), emitHint(request, "D", href));
223
+ } else previousDispatcher.D(href);
224
+ }
225
+ }
226
+ function preconnect(href, crossOrigin) {
227
+ if ("string" === typeof href) {
228
+ var request = resolveRequest();
229
+ if (request) {
230
+ var hints = request.hints,
231
+ key = "C|" + (null == crossOrigin ? "null" : crossOrigin) + "|" + href;
232
+ hints.has(key) ||
233
+ (hints.add(key),
234
+ "string" === typeof crossOrigin
235
+ ? emitHint(request, "C", [href, crossOrigin])
236
+ : emitHint(request, "C", href));
237
+ } else previousDispatcher.C(href, crossOrigin);
238
+ }
239
+ }
240
+ function preload(href, as, options) {
241
+ if ("string" === typeof href) {
242
+ var request = resolveRequest();
243
+ if (request) {
244
+ var hints = request.hints,
245
+ key = "L";
246
+ if ("image" === as && options) {
247
+ var imageSrcSet = options.imageSrcSet,
248
+ imageSizes = options.imageSizes,
249
+ uniquePart = "";
250
+ "string" === typeof imageSrcSet && "" !== imageSrcSet
251
+ ? ((uniquePart += "[" + imageSrcSet + "]"),
252
+ "string" === typeof imageSizes &&
253
+ (uniquePart += "[" + imageSizes + "]"))
254
+ : (uniquePart += "[][]" + href);
255
+ key += "[image]" + uniquePart;
256
+ } else key += "[" + as + "]" + href;
257
+ hints.has(key) ||
258
+ (hints.add(key),
259
+ (options = trimOptions(options))
260
+ ? emitHint(request, "L", [href, as, options])
261
+ : emitHint(request, "L", [href, as]));
262
+ } else previousDispatcher.L(href, as, options);
263
+ }
264
+ }
265
+ function preloadModule$1(href, options) {
266
+ if ("string" === typeof href) {
267
+ var request = resolveRequest();
268
+ if (request) {
269
+ var hints = request.hints,
270
+ key = "m|" + href;
271
+ if (hints.has(key)) return;
272
+ hints.add(key);
273
+ return (options = trimOptions(options))
274
+ ? emitHint(request, "m", [href, options])
275
+ : emitHint(request, "m", href);
276
+ }
277
+ previousDispatcher.m(href, options);
278
+ }
279
+ }
280
+ function preinitStyle(href, precedence, options) {
281
+ if ("string" === typeof href) {
282
+ var request = resolveRequest();
283
+ if (request) {
284
+ var hints = request.hints,
285
+ key = "S|" + href;
286
+ if (hints.has(key)) return;
287
+ hints.add(key);
288
+ return (options = trimOptions(options))
289
+ ? emitHint(request, "S", [
290
+ href,
291
+ "string" === typeof precedence ? precedence : 0,
292
+ options
293
+ ])
294
+ : "string" === typeof precedence
295
+ ? emitHint(request, "S", [href, precedence])
296
+ : emitHint(request, "S", href);
297
+ }
298
+ previousDispatcher.S(href, precedence, options);
299
+ }
300
+ }
301
+ function preinitScript(src, options) {
302
+ if ("string" === typeof src) {
303
+ var request = resolveRequest();
304
+ if (request) {
305
+ var hints = request.hints,
306
+ key = "X|" + src;
307
+ if (hints.has(key)) return;
308
+ hints.add(key);
309
+ return (options = trimOptions(options))
310
+ ? emitHint(request, "X", [src, options])
311
+ : emitHint(request, "X", src);
312
+ }
313
+ previousDispatcher.X(src, options);
314
+ }
315
+ }
316
+ function preinitModuleScript(src, options) {
317
+ if ("string" === typeof src) {
318
+ var request = resolveRequest();
319
+ if (request) {
320
+ var hints = request.hints,
321
+ key = "M|" + src;
322
+ if (hints.has(key)) return;
323
+ hints.add(key);
324
+ return (options = trimOptions(options))
325
+ ? emitHint(request, "M", [src, options])
326
+ : emitHint(request, "M", src);
327
+ }
328
+ previousDispatcher.M(src, options);
329
+ }
330
+ }
331
+ function trimOptions(options) {
332
+ if (null == options) return null;
333
+ var hasProperties = !1,
334
+ trimmed = {},
335
+ key;
336
+ for (key in options)
337
+ null != options[key] &&
338
+ ((hasProperties = !0), (trimmed[key] = options[key]));
339
+ return hasProperties ? trimmed : null;
340
+ }
341
+ var supportsRequestStorage = "function" === typeof AsyncLocalStorage,
342
+ requestStorage = supportsRequestStorage ? new AsyncLocalStorage() : null;
343
+ "object" === typeof async_hooks
344
+ ? async_hooks.createHook
345
+ : function () {
346
+ return { enable: function () {}, disable: function () {} };
347
+ };
348
+ "object" === typeof async_hooks ? async_hooks.executionAsyncId : null;
349
+ var TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
350
+ proxyHandlers = {
351
+ get: function (target, name) {
352
+ switch (name) {
353
+ case "$$typeof":
354
+ return target.$$typeof;
355
+ case "$$id":
356
+ return target.$$id;
357
+ case "$$async":
358
+ return target.$$async;
359
+ case "name":
360
+ return;
361
+ case "displayName":
362
+ return;
363
+ case "defaultProps":
364
+ return;
365
+ case "toJSON":
366
+ return;
367
+ case Symbol.toPrimitive:
368
+ return Object.prototype[Symbol.toPrimitive];
369
+ case Symbol.toStringTag:
370
+ return Object.prototype[Symbol.toStringTag];
371
+ case "Provider":
372
+ throw Error(
373
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
374
+ );
375
+ }
376
+ throw Error(
377
+ "Cannot access " +
378
+ String(name) +
379
+ " 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."
380
+ );
381
+ },
382
+ set: function () {
383
+ throw Error(
384
+ "Cannot assign to a temporary client reference from a server module."
385
+ );
386
+ }
387
+ };
388
+ function createTemporaryReference(id) {
389
+ id = Object.defineProperties(
390
+ function () {
391
+ throw Error(
392
+ "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."
393
+ );
394
+ },
395
+ { $$typeof: { value: TEMPORARY_REFERENCE_TAG }, $$id: { value: id } }
396
+ );
397
+ return new Proxy(id, proxyHandlers);
398
+ }
399
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
400
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
401
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
402
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
403
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
404
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
405
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
406
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
407
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
408
+ Symbol.for("react.postpone");
409
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
410
+ function getIteratorFn(maybeIterable) {
411
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
412
+ maybeIterable =
413
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
414
+ maybeIterable["@@iterator"];
415
+ return "function" === typeof maybeIterable ? maybeIterable : null;
416
+ }
417
+ var SuspenseException = Error(
418
+ "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`"
419
+ );
420
+ function noop() {}
421
+ function trackUsedThenable(thenableState, thenable, index) {
422
+ index = thenableState[index];
423
+ void 0 === index
424
+ ? thenableState.push(thenable)
425
+ : index !== thenable && (thenable.then(noop, noop), (thenable = index));
426
+ switch (thenable.status) {
427
+ case "fulfilled":
428
+ return thenable.value;
429
+ case "rejected":
430
+ throw thenable.reason;
431
+ default:
432
+ "string" === typeof thenable.status
433
+ ? thenable.then(noop, noop)
434
+ : ((thenableState = thenable),
435
+ (thenableState.status = "pending"),
436
+ thenableState.then(
437
+ function (fulfilledValue) {
438
+ if ("pending" === thenable.status) {
439
+ var fulfilledThenable = thenable;
440
+ fulfilledThenable.status = "fulfilled";
441
+ fulfilledThenable.value = fulfilledValue;
442
+ }
443
+ },
444
+ function (error) {
445
+ if ("pending" === thenable.status) {
446
+ var rejectedThenable = thenable;
447
+ rejectedThenable.status = "rejected";
448
+ rejectedThenable.reason = error;
449
+ }
450
+ }
451
+ ));
452
+ switch (thenable.status) {
453
+ case "fulfilled":
454
+ return thenable.value;
455
+ case "rejected":
456
+ throw thenable.reason;
457
+ }
458
+ suspendedThenable = thenable;
459
+ throw SuspenseException;
460
+ }
461
+ }
462
+ var suspendedThenable = null;
463
+ function getSuspendedThenable() {
464
+ if (null === suspendedThenable)
465
+ throw Error(
466
+ "Expected a suspended thenable. This is a bug in React. Please file an issue."
467
+ );
468
+ var thenable = suspendedThenable;
469
+ suspendedThenable = null;
470
+ return thenable;
471
+ }
472
+ var currentRequest$1 = null,
473
+ thenableIndexCounter = 0,
474
+ thenableState = null;
475
+ function getThenableStateAfterSuspending() {
476
+ var state = thenableState || [];
477
+ thenableState = null;
478
+ return state;
479
+ }
480
+ var HooksDispatcher = {
481
+ useMemo: function (nextCreate) {
482
+ return nextCreate();
483
+ },
484
+ useCallback: function (callback) {
485
+ return callback;
486
+ },
487
+ useDebugValue: function () {},
488
+ useDeferredValue: unsupportedHook,
489
+ useTransition: unsupportedHook,
490
+ readContext: unsupportedContext,
491
+ useContext: unsupportedContext,
492
+ useReducer: unsupportedHook,
493
+ useRef: unsupportedHook,
494
+ useState: unsupportedHook,
495
+ useInsertionEffect: unsupportedHook,
496
+ useLayoutEffect: unsupportedHook,
497
+ useImperativeHandle: unsupportedHook,
498
+ useEffect: unsupportedHook,
499
+ useId: useId,
500
+ useSyncExternalStore: unsupportedHook,
501
+ useCacheRefresh: function () {
502
+ return unsupportedRefresh;
503
+ },
504
+ useMemoCache: function (size) {
505
+ for (var data = Array(size), i = 0; i < size; i++)
506
+ data[i] = REACT_MEMO_CACHE_SENTINEL;
507
+ return data;
508
+ },
509
+ use: use
510
+ };
511
+ function unsupportedHook() {
512
+ throw Error("This Hook is not supported in Server Components.");
513
+ }
514
+ function unsupportedRefresh() {
515
+ throw Error("Refreshing the cache is not supported in Server Components.");
516
+ }
517
+ function unsupportedContext() {
518
+ throw Error("Cannot read a Client Context from a Server Component.");
519
+ }
520
+ function useId() {
521
+ if (null === currentRequest$1)
522
+ throw Error("useId can only be used while React is rendering");
523
+ var id = currentRequest$1.identifierCount++;
524
+ return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":";
525
+ }
526
+ function use(usable) {
527
+ if (
528
+ (null !== usable && "object" === typeof usable) ||
529
+ "function" === typeof usable
530
+ ) {
531
+ if ("function" === typeof usable.then) {
532
+ var index = thenableIndexCounter;
533
+ thenableIndexCounter += 1;
534
+ null === thenableState && (thenableState = []);
535
+ return trackUsedThenable(thenableState, usable, index);
536
+ }
537
+ usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
538
+ }
539
+ if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
540
+ if (null != usable.value && usable.value.$$typeof === REACT_CONTEXT_TYPE)
541
+ throw Error("Cannot read a Client Context from a Server Component.");
542
+ throw Error("Cannot use() an already resolved Client Reference.");
543
+ }
544
+ throw Error("An unsupported type was passed to use(): " + String(usable));
545
+ }
546
+ var DefaultAsyncDispatcher = {
547
+ getCacheForType: function (resourceType) {
548
+ var JSCompiler_inline_result = (JSCompiler_inline_result =
549
+ resolveRequest())
550
+ ? JSCompiler_inline_result.cache
551
+ : new Map();
552
+ var entry = JSCompiler_inline_result.get(resourceType);
553
+ void 0 === entry &&
554
+ ((entry = resourceType()),
555
+ JSCompiler_inline_result.set(resourceType, entry));
556
+ return entry;
557
+ }
558
+ },
559
+ isArrayImpl = Array.isArray,
560
+ getPrototypeOf = Object.getPrototypeOf;
561
+ function objectName(object) {
562
+ return Object.prototype.toString
563
+ .call(object)
564
+ .replace(/^\[object (.*)\]$/, function (m, p0) {
565
+ return p0;
566
+ });
567
+ }
568
+ function describeValueForErrorMessage(value) {
569
+ switch (typeof value) {
570
+ case "string":
571
+ return JSON.stringify(
572
+ 10 >= value.length ? value : value.slice(0, 10) + "..."
573
+ );
574
+ case "object":
575
+ if (isArrayImpl(value)) return "[...]";
576
+ if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
577
+ return "client";
578
+ value = objectName(value);
579
+ return "Object" === value ? "{...}" : value;
580
+ case "function":
581
+ return value.$$typeof === CLIENT_REFERENCE_TAG
582
+ ? "client"
583
+ : (value = value.displayName || value.name)
584
+ ? "function " + value
585
+ : "function";
586
+ default:
587
+ return String(value);
588
+ }
589
+ }
590
+ function describeElementType(type) {
591
+ if ("string" === typeof type) return type;
592
+ switch (type) {
593
+ case REACT_SUSPENSE_TYPE:
594
+ return "Suspense";
595
+ case REACT_SUSPENSE_LIST_TYPE:
596
+ return "SuspenseList";
597
+ }
598
+ if ("object" === typeof type)
599
+ switch (type.$$typeof) {
600
+ case REACT_FORWARD_REF_TYPE:
601
+ return describeElementType(type.render);
602
+ case REACT_MEMO_TYPE:
603
+ return describeElementType(type.type);
604
+ case REACT_LAZY_TYPE:
605
+ var payload = type._payload;
606
+ type = type._init;
607
+ try {
608
+ return describeElementType(type(payload));
609
+ } catch (x) {}
610
+ }
611
+ return "";
612
+ }
613
+ var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
614
+ function describeObjectForErrorMessage(objectOrArray, expandedName) {
615
+ var objKind = objectName(objectOrArray);
616
+ if ("Object" !== objKind && "Array" !== objKind) return objKind;
617
+ objKind = -1;
618
+ var length = 0;
619
+ if (isArrayImpl(objectOrArray)) {
620
+ var str = "[";
621
+ for (var i = 0; i < objectOrArray.length; i++) {
622
+ 0 < i && (str += ", ");
623
+ var value = objectOrArray[i];
624
+ value =
625
+ "object" === typeof value && null !== value
626
+ ? describeObjectForErrorMessage(value)
627
+ : describeValueForErrorMessage(value);
628
+ "" + i === expandedName
629
+ ? ((objKind = str.length), (length = value.length), (str += value))
630
+ : (str =
631
+ 10 > value.length && 40 > str.length + value.length
632
+ ? str + value
633
+ : str + "...");
634
+ }
635
+ str += "]";
636
+ } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
637
+ str = "<" + describeElementType(objectOrArray.type) + "/>";
638
+ else {
639
+ if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
640
+ str = "{";
641
+ i = Object.keys(objectOrArray);
642
+ for (value = 0; value < i.length; value++) {
643
+ 0 < value && (str += ", ");
644
+ var name = i[value],
645
+ encodedKey = JSON.stringify(name);
646
+ str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": ";
647
+ encodedKey = objectOrArray[name];
648
+ encodedKey =
649
+ "object" === typeof encodedKey && null !== encodedKey
650
+ ? describeObjectForErrorMessage(encodedKey)
651
+ : describeValueForErrorMessage(encodedKey);
652
+ name === expandedName
653
+ ? ((objKind = str.length),
654
+ (length = encodedKey.length),
655
+ (str += encodedKey))
656
+ : (str =
657
+ 10 > encodedKey.length && 40 > str.length + encodedKey.length
658
+ ? str + encodedKey
659
+ : str + "...");
660
+ }
661
+ str += "}";
662
+ }
663
+ return void 0 === expandedName
664
+ ? str
665
+ : -1 < objKind && 0 < length
666
+ ? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)),
667
+ "\n " + str + "\n " + objectOrArray)
668
+ : "\n " + str;
669
+ }
670
+ var ReactSharedInternalsServer =
671
+ React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
672
+ if (!ReactSharedInternalsServer)
673
+ throw Error(
674
+ '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.'
675
+ );
676
+ var ObjectPrototype = Object.prototype,
677
+ stringify = JSON.stringify;
678
+ function defaultErrorHandler(error) {
679
+ console.error(error);
680
+ }
681
+ function defaultPostponeHandler() {}
682
+ function createRequest(
683
+ model,
684
+ bundlerConfig,
685
+ onError,
686
+ identifierPrefix,
687
+ onPostpone
688
+ ) {
689
+ if (
690
+ null !== ReactSharedInternalsServer.A &&
691
+ ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
692
+ )
693
+ throw Error("Currently React only supports one RSC renderer at a time.");
694
+ ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
695
+ var abortSet = new Set(),
696
+ pingedTasks = [],
697
+ hints = new Set();
698
+ bundlerConfig = {
699
+ status: 0,
700
+ flushScheduled: !1,
701
+ fatalError: null,
702
+ destination: null,
703
+ bundlerConfig: bundlerConfig,
704
+ cache: new Map(),
705
+ nextChunkId: 0,
706
+ pendingChunks: 0,
707
+ hints: hints,
708
+ abortListeners: new Set(),
709
+ abortableTasks: abortSet,
710
+ pingedTasks: pingedTasks,
711
+ completedImportChunks: [],
712
+ completedHintChunks: [],
713
+ completedRegularChunks: [],
714
+ completedErrorChunks: [],
715
+ writtenSymbols: new Map(),
716
+ writtenClientReferences: new Map(),
717
+ writtenServerReferences: new Map(),
718
+ writtenObjects: new WeakMap(),
719
+ identifierPrefix: identifierPrefix || "",
720
+ identifierCount: 1,
721
+ taintCleanupQueue: [],
722
+ onError: void 0 === onError ? defaultErrorHandler : onError,
723
+ onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone
724
+ };
725
+ model = createTask(bundlerConfig, model, null, !1, abortSet);
726
+ pingedTasks.push(model);
727
+ return bundlerConfig;
728
+ }
729
+ var currentRequest = null;
730
+ function resolveRequest() {
731
+ if (currentRequest) return currentRequest;
732
+ if (supportsRequestStorage) {
733
+ var store = requestStorage.getStore();
734
+ if (store) return store;
735
+ }
736
+ return null;
737
+ }
738
+ function serializeThenable(request, task, thenable) {
739
+ var newTask = createTask(
740
+ request,
741
+ null,
742
+ task.keyPath,
743
+ task.implicitSlot,
744
+ request.abortableTasks
745
+ );
746
+ switch (thenable.status) {
747
+ case "fulfilled":
748
+ return (
749
+ (newTask.model = thenable.value), pingTask(request, newTask), newTask.id
750
+ );
751
+ case "rejected":
752
+ return (
753
+ (task = logRecoverableError(request, thenable.reason)),
754
+ emitErrorChunk(request, newTask.id, task),
755
+ newTask.id
756
+ );
757
+ default:
758
+ "string" !== typeof thenable.status &&
759
+ ((thenable.status = "pending"),
760
+ thenable.then(
761
+ function (fulfilledValue) {
762
+ "pending" === thenable.status &&
763
+ ((thenable.status = "fulfilled"),
764
+ (thenable.value = fulfilledValue));
765
+ },
766
+ function (error) {
767
+ "pending" === thenable.status &&
768
+ ((thenable.status = "rejected"), (thenable.reason = error));
769
+ }
770
+ ));
771
+ }
772
+ thenable.then(
773
+ function (value) {
774
+ newTask.model = value;
775
+ pingTask(request, newTask);
776
+ },
777
+ function (reason) {
778
+ newTask.status = 4;
779
+ reason = logRecoverableError(request, reason);
780
+ emitErrorChunk(request, newTask.id, reason);
781
+ request.abortableTasks.delete(newTask);
782
+ enqueueFlush(request);
783
+ }
784
+ );
785
+ return newTask.id;
786
+ }
787
+ function emitHint(request, code, model) {
788
+ model = stringify(model);
789
+ var id = request.nextChunkId++;
790
+ code = "H" + code;
791
+ code = id.toString(16) + ":" + code;
792
+ model = textEncoder.encode(code + model + "\n");
793
+ request.completedHintChunks.push(model);
794
+ enqueueFlush(request);
795
+ }
796
+ function readThenable(thenable) {
797
+ if ("fulfilled" === thenable.status) return thenable.value;
798
+ if ("rejected" === thenable.status) throw thenable.reason;
799
+ throw thenable;
800
+ }
801
+ function createLazyWrapperAroundWakeable(wakeable) {
802
+ switch (wakeable.status) {
803
+ case "fulfilled":
804
+ case "rejected":
805
+ break;
806
+ default:
807
+ "string" !== typeof wakeable.status &&
808
+ ((wakeable.status = "pending"),
809
+ wakeable.then(
810
+ function (fulfilledValue) {
811
+ "pending" === wakeable.status &&
812
+ ((wakeable.status = "fulfilled"),
813
+ (wakeable.value = fulfilledValue));
814
+ },
815
+ function (error) {
816
+ "pending" === wakeable.status &&
817
+ ((wakeable.status = "rejected"), (wakeable.reason = error));
818
+ }
819
+ ));
820
+ }
821
+ return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
822
+ }
823
+ function renderFunctionComponent(request, task, key, Component, props) {
824
+ var prevThenableState = task.thenableState;
825
+ task.thenableState = null;
826
+ thenableIndexCounter = 0;
827
+ thenableState = prevThenableState;
828
+ Component = Component(props, void 0);
829
+ if ("object" === typeof Component && null !== Component) {
830
+ if ("function" === typeof Component.then) {
831
+ props = Component;
832
+ if ("fulfilled" === props.status) return props.value;
833
+ Component = createLazyWrapperAroundWakeable(Component);
834
+ }
835
+ var iteratorFn = getIteratorFn(Component);
836
+ if (iteratorFn) {
837
+ var iterableChild = Component;
838
+ Component = {};
839
+ Component =
840
+ ((Component[Symbol.iterator] = function () {
841
+ return iteratorFn.call(iterableChild);
842
+ }),
843
+ Component);
844
+ }
845
+ }
846
+ props = task.keyPath;
847
+ prevThenableState = task.implicitSlot;
848
+ null !== key
849
+ ? (task.keyPath = null === props ? key : props + "," + key)
850
+ : null === props && (task.implicitSlot = !0);
851
+ request = renderModelDestructive(request, task, emptyRoot, "", Component);
852
+ task.keyPath = props;
853
+ task.implicitSlot = prevThenableState;
854
+ return request;
855
+ }
856
+ function renderFragment(request, task, children) {
857
+ return null !== task.keyPath
858
+ ? ((request = [
859
+ REACT_ELEMENT_TYPE,
860
+ REACT_FRAGMENT_TYPE,
861
+ task.keyPath,
862
+ { children: children }
863
+ ]),
864
+ task.implicitSlot ? [request] : request)
865
+ : children;
866
+ }
867
+ function renderClientElement(task, type, key, props) {
868
+ var keyPath = task.keyPath;
869
+ null === key
870
+ ? (key = keyPath)
871
+ : null !== keyPath && (key = keyPath + "," + key);
872
+ type = [REACT_ELEMENT_TYPE, type, key, props];
873
+ return task.implicitSlot && null !== key ? [type] : type;
874
+ }
875
+ function renderElement(request, task, type, key, ref, props) {
876
+ if (null !== ref && void 0 !== ref)
877
+ throw Error(
878
+ "Refs cannot be used in Server Components, nor passed to Client Components."
879
+ );
880
+ if ("function" === typeof type)
881
+ return type.$$typeof === CLIENT_REFERENCE_TAG$1 ||
882
+ type.$$typeof === TEMPORARY_REFERENCE_TAG
883
+ ? renderClientElement(task, type, key, props)
884
+ : renderFunctionComponent(request, task, key, type, props);
885
+ if ("string" === typeof type)
886
+ return renderClientElement(task, type, key, props);
887
+ if ("symbol" === typeof type)
888
+ return type === REACT_FRAGMENT_TYPE && null === key
889
+ ? ((key = task.implicitSlot),
890
+ null === task.keyPath && (task.implicitSlot = !0),
891
+ (request = renderModelDestructive(
892
+ request,
893
+ task,
894
+ emptyRoot,
895
+ "",
896
+ props.children
897
+ )),
898
+ (task.implicitSlot = key),
899
+ request)
900
+ : renderClientElement(task, type, key, props);
901
+ if (null != type && "object" === typeof type) {
902
+ if (type.$$typeof === CLIENT_REFERENCE_TAG$1)
903
+ return renderClientElement(task, type, key, props);
904
+ switch (type.$$typeof) {
905
+ case REACT_LAZY_TYPE:
906
+ var init = type._init;
907
+ type = init(type._payload);
908
+ return renderElement(request, task, type, key, ref, props);
909
+ case REACT_FORWARD_REF_TYPE:
910
+ return renderFunctionComponent(request, task, key, type.render, props);
911
+ case REACT_MEMO_TYPE:
912
+ return renderElement(request, task, type.type, key, ref, props);
913
+ }
914
+ }
915
+ throw Error(
916
+ "Unsupported Server Component type: " + describeValueForErrorMessage(type)
917
+ );
918
+ }
919
+ function pingTask(request, task) {
920
+ var pingedTasks = request.pingedTasks;
921
+ pingedTasks.push(task);
922
+ 1 === pingedTasks.length &&
923
+ ((request.flushScheduled = null !== request.destination),
924
+ setTimeout(function () {
925
+ return performWork(request);
926
+ }, 0));
927
+ }
928
+ function createTask(request, model, keyPath, implicitSlot, abortSet) {
929
+ request.pendingChunks++;
930
+ var id = request.nextChunkId++;
931
+ "object" !== typeof model ||
932
+ null === model ||
933
+ null !== keyPath ||
934
+ implicitSlot ||
935
+ request.writtenObjects.set(model, id);
936
+ var task = {
937
+ id: id,
938
+ status: 0,
939
+ model: model,
940
+ keyPath: keyPath,
941
+ implicitSlot: implicitSlot,
942
+ ping: function () {
943
+ return pingTask(request, task);
944
+ },
945
+ toJSON: function (parentPropertyName, value) {
946
+ var prevKeyPath = task.keyPath,
947
+ prevImplicitSlot = task.implicitSlot;
948
+ try {
949
+ var JSCompiler_inline_result = renderModelDestructive(
950
+ request,
951
+ task,
952
+ this,
953
+ parentPropertyName,
954
+ value
955
+ );
956
+ } catch (thrownValue) {
957
+ if (
958
+ ((parentPropertyName =
959
+ thrownValue === SuspenseException
960
+ ? getSuspendedThenable()
961
+ : thrownValue),
962
+ (value = task.model),
963
+ (value =
964
+ "object" === typeof value &&
965
+ null !== value &&
966
+ (value.$$typeof === REACT_ELEMENT_TYPE ||
967
+ value.$$typeof === REACT_LAZY_TYPE)),
968
+ "object" === typeof parentPropertyName &&
969
+ null !== parentPropertyName &&
970
+ "function" === typeof parentPropertyName.then)
971
+ ) {
972
+ JSCompiler_inline_result = createTask(
973
+ request,
974
+ task.model,
975
+ task.keyPath,
976
+ task.implicitSlot,
977
+ request.abortableTasks
978
+ );
979
+ var ping = JSCompiler_inline_result.ping;
980
+ parentPropertyName.then(ping, ping);
981
+ JSCompiler_inline_result.thenableState =
982
+ getThenableStateAfterSuspending();
983
+ task.keyPath = prevKeyPath;
984
+ task.implicitSlot = prevImplicitSlot;
985
+ JSCompiler_inline_result = value
986
+ ? "$L" + JSCompiler_inline_result.id.toString(16)
987
+ : serializeByValueID(JSCompiler_inline_result.id);
988
+ } else if (
989
+ ((task.keyPath = prevKeyPath),
990
+ (task.implicitSlot = prevImplicitSlot),
991
+ value)
992
+ )
993
+ request.pendingChunks++,
994
+ (prevKeyPath = request.nextChunkId++),
995
+ (prevImplicitSlot = logRecoverableError(
996
+ request,
997
+ parentPropertyName
998
+ )),
999
+ emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1000
+ (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
1001
+ else throw parentPropertyName;
1002
+ }
1003
+ return JSCompiler_inline_result;
1004
+ },
1005
+ thenableState: null
1006
+ };
1007
+ abortSet.add(task);
1008
+ return task;
1009
+ }
1010
+ function serializeByValueID(id) {
1011
+ return "$" + id.toString(16);
1012
+ }
1013
+ function encodeReferenceChunk(request, id, reference) {
1014
+ request = stringify(reference);
1015
+ id = id.toString(16) + ":" + request + "\n";
1016
+ return textEncoder.encode(id);
1017
+ }
1018
+ function serializeClientReference(
1019
+ request,
1020
+ parent,
1021
+ parentPropertyName,
1022
+ clientReference
1023
+ ) {
1024
+ var clientReferenceKey = clientReference.$$async
1025
+ ? clientReference.$$id + "#async"
1026
+ : clientReference.$$id,
1027
+ writtenClientReferences = request.writtenClientReferences,
1028
+ existingId = writtenClientReferences.get(clientReferenceKey);
1029
+ if (void 0 !== existingId)
1030
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1031
+ ? "$L" + existingId.toString(16)
1032
+ : serializeByValueID(existingId);
1033
+ try {
1034
+ var config = request.bundlerConfig,
1035
+ modulePath = clientReference.$$id;
1036
+ existingId = "";
1037
+ var resolvedModuleData = config[modulePath];
1038
+ if (resolvedModuleData) existingId = resolvedModuleData.name;
1039
+ else {
1040
+ var idx = modulePath.lastIndexOf("#");
1041
+ -1 !== idx &&
1042
+ ((existingId = modulePath.slice(idx + 1)),
1043
+ (resolvedModuleData = config[modulePath.slice(0, idx)]));
1044
+ if (!resolvedModuleData)
1045
+ throw Error(
1046
+ 'Could not find the module "' +
1047
+ modulePath +
1048
+ '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
1049
+ );
1050
+ }
1051
+ var JSCompiler_inline_result =
1052
+ !0 === clientReference.$$async
1053
+ ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1054
+ : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
1055
+ request.pendingChunks++;
1056
+ var importId = request.nextChunkId++,
1057
+ json = stringify(JSCompiler_inline_result),
1058
+ row = importId.toString(16) + ":I" + json + "\n",
1059
+ processedChunk = textEncoder.encode(row);
1060
+ request.completedImportChunks.push(processedChunk);
1061
+ writtenClientReferences.set(clientReferenceKey, importId);
1062
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1063
+ ? "$L" + importId.toString(16)
1064
+ : serializeByValueID(importId);
1065
+ } catch (x) {
1066
+ return (
1067
+ request.pendingChunks++,
1068
+ (parent = request.nextChunkId++),
1069
+ (parentPropertyName = logRecoverableError(request, x)),
1070
+ emitErrorChunk(request, parent, parentPropertyName),
1071
+ serializeByValueID(parent)
1072
+ );
1073
+ }
1074
+ }
1075
+ function outlineModel(request, value) {
1076
+ value = createTask(request, value, null, !1, request.abortableTasks);
1077
+ retryTask(request, value);
1078
+ return value.id;
1079
+ }
1080
+ var modelRoot = !1;
1081
+ function renderModelDestructive(
1082
+ request,
1083
+ task,
1084
+ parent,
1085
+ parentPropertyName,
1086
+ value
1087
+ ) {
1088
+ task.model = value;
1089
+ if (value === REACT_ELEMENT_TYPE) return "$";
1090
+ if (null === value) return null;
1091
+ if ("object" === typeof value) {
1092
+ switch (value.$$typeof) {
1093
+ case REACT_ELEMENT_TYPE:
1094
+ parent = request.writtenObjects;
1095
+ parentPropertyName = parent.get(value);
1096
+ if (void 0 !== parentPropertyName) {
1097
+ if (null === task.keyPath && !task.implicitSlot)
1098
+ if (modelRoot === value) modelRoot = null;
1099
+ else
1100
+ return -1 === parentPropertyName
1101
+ ? ((request = outlineModel(request, value)),
1102
+ serializeByValueID(request))
1103
+ : serializeByValueID(parentPropertyName);
1104
+ } else parent.set(value, -1), parent.set(value.props, -2);
1105
+ parent = value.props;
1106
+ parentPropertyName = parent.ref;
1107
+ return renderElement(
1108
+ request,
1109
+ task,
1110
+ value.type,
1111
+ value.key,
1112
+ void 0 !== parentPropertyName ? parentPropertyName : null,
1113
+ parent
1114
+ );
1115
+ case REACT_LAZY_TYPE:
1116
+ return (
1117
+ (task.thenableState = null),
1118
+ (parent = value._init),
1119
+ (value = parent(value._payload)),
1120
+ renderModelDestructive(request, task, emptyRoot, "", value)
1121
+ );
1122
+ }
1123
+ if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1124
+ return serializeClientReference(
1125
+ request,
1126
+ parent,
1127
+ parentPropertyName,
1128
+ value
1129
+ );
1130
+ parent = request.writtenObjects;
1131
+ parentPropertyName = parent.get(value);
1132
+ if ("function" === typeof value.then) {
1133
+ if (void 0 !== parentPropertyName) {
1134
+ if (null !== task.keyPath || task.implicitSlot)
1135
+ return "$@" + serializeThenable(request, task, value).toString(16);
1136
+ if (modelRoot === value) modelRoot = null;
1137
+ else return "$@" + parentPropertyName.toString(16);
1138
+ }
1139
+ request = serializeThenable(request, task, value);
1140
+ parent.set(value, request);
1141
+ return "$@" + request.toString(16);
1142
+ }
1143
+ if (void 0 !== parentPropertyName)
1144
+ if (modelRoot === value) modelRoot = null;
1145
+ else {
1146
+ if (-1 === parentPropertyName)
1147
+ return (
1148
+ (request = outlineModel(request, value)),
1149
+ serializeByValueID(request)
1150
+ );
1151
+ if (-2 !== parentPropertyName)
1152
+ return serializeByValueID(parentPropertyName);
1153
+ }
1154
+ else parent.set(value, -1);
1155
+ if (isArrayImpl(value)) return renderFragment(request, task, value);
1156
+ if (value instanceof Map) {
1157
+ value = Array.from(value);
1158
+ for (task = 0; task < value.length; task++)
1159
+ (parent = value[task][0]),
1160
+ "object" === typeof parent &&
1161
+ null !== parent &&
1162
+ ((parentPropertyName = request.writtenObjects),
1163
+ void 0 === parentPropertyName.get(parent) &&
1164
+ parentPropertyName.set(parent, -1));
1165
+ return "$Q" + outlineModel(request, value).toString(16);
1166
+ }
1167
+ if (value instanceof Set) {
1168
+ value = Array.from(value);
1169
+ for (task = 0; task < value.length; task++)
1170
+ (parent = value[task]),
1171
+ "object" === typeof parent &&
1172
+ null !== parent &&
1173
+ ((parentPropertyName = request.writtenObjects),
1174
+ void 0 === parentPropertyName.get(parent) &&
1175
+ parentPropertyName.set(parent, -1));
1176
+ return "$W" + outlineModel(request, value).toString(16);
1177
+ }
1178
+ if ("function" === typeof FormData && value instanceof FormData)
1179
+ return (
1180
+ (value = Array.from(value.entries())),
1181
+ "$K" + outlineModel(request, value).toString(16)
1182
+ );
1183
+ if ((parent = getIteratorFn(value)))
1184
+ return (
1185
+ (parent = parent.call(value)),
1186
+ parent === value
1187
+ ? "$i" + outlineModel(request, Array.from(parent)).toString(16)
1188
+ : renderFragment(request, task, Array.from(parent))
1189
+ );
1190
+ request = getPrototypeOf(value);
1191
+ if (
1192
+ request !== ObjectPrototype &&
1193
+ (null === request || null !== getPrototypeOf(request))
1194
+ )
1195
+ throw Error(
1196
+ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported."
1197
+ );
1198
+ return value;
1199
+ }
1200
+ if ("string" === typeof value) {
1201
+ if (
1202
+ "Z" === value[value.length - 1] &&
1203
+ parent[parentPropertyName] instanceof Date
1204
+ )
1205
+ return "$D" + value;
1206
+ if (1024 <= value.length)
1207
+ return (
1208
+ request.pendingChunks++,
1209
+ (task = request.nextChunkId++),
1210
+ emitTextChunk(request, task, value),
1211
+ serializeByValueID(task)
1212
+ );
1213
+ request = "$" === value[0] ? "$" + value : value;
1214
+ return request;
1215
+ }
1216
+ if ("boolean" === typeof value) return value;
1217
+ if ("number" === typeof value)
1218
+ return Number.isFinite(value)
1219
+ ? 0 === value && -Infinity === 1 / value
1220
+ ? "$-0"
1221
+ : value
1222
+ : Infinity === value
1223
+ ? "$Infinity"
1224
+ : -Infinity === value
1225
+ ? "$-Infinity"
1226
+ : "$NaN";
1227
+ if ("undefined" === typeof value) return "$undefined";
1228
+ if ("function" === typeof value) {
1229
+ if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1230
+ return serializeClientReference(
1231
+ request,
1232
+ parent,
1233
+ parentPropertyName,
1234
+ value
1235
+ );
1236
+ if (value.$$typeof === SERVER_REFERENCE_TAG)
1237
+ return (
1238
+ (task = request.writtenServerReferences),
1239
+ (parent = task.get(value)),
1240
+ void 0 !== parent
1241
+ ? (request = "$F" + parent.toString(16))
1242
+ : ((parent = value.$$bound),
1243
+ (parent = {
1244
+ id: value.$$id,
1245
+ bound: parent ? Promise.resolve(parent) : null
1246
+ }),
1247
+ (request = outlineModel(request, parent)),
1248
+ task.set(value, request),
1249
+ (request = "$F" + request.toString(16))),
1250
+ request
1251
+ );
1252
+ if (value.$$typeof === TEMPORARY_REFERENCE_TAG) return "$T" + value.$$id;
1253
+ if (/^on[A-Z]/.test(parentPropertyName))
1254
+ throw Error(
1255
+ "Event handlers cannot be passed to Client Component props." +
1256
+ describeObjectForErrorMessage(parent, parentPropertyName) +
1257
+ "\nIf you need interactivity, consider converting part of this to a Client Component."
1258
+ );
1259
+ throw Error(
1260
+ '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.' +
1261
+ describeObjectForErrorMessage(parent, parentPropertyName)
1262
+ );
1263
+ }
1264
+ if ("symbol" === typeof value) {
1265
+ task = request.writtenSymbols;
1266
+ var existingId$10 = task.get(value);
1267
+ if (void 0 !== existingId$10) return serializeByValueID(existingId$10);
1268
+ existingId$10 = value.description;
1269
+ if (Symbol.for(existingId$10) !== value)
1270
+ throw Error(
1271
+ "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1272
+ (value.description + ") cannot be found among global symbols.") +
1273
+ describeObjectForErrorMessage(parent, parentPropertyName)
1274
+ );
1275
+ request.pendingChunks++;
1276
+ parent = request.nextChunkId++;
1277
+ parentPropertyName = encodeReferenceChunk(
1278
+ request,
1279
+ parent,
1280
+ "$S" + existingId$10
1281
+ );
1282
+ request.completedImportChunks.push(parentPropertyName);
1283
+ task.set(value, parent);
1284
+ return serializeByValueID(parent);
1285
+ }
1286
+ if ("bigint" === typeof value) return "$n" + value.toString(10);
1287
+ throw Error(
1288
+ "Type " +
1289
+ typeof value +
1290
+ " is not supported in Client Component props." +
1291
+ describeObjectForErrorMessage(parent, parentPropertyName)
1292
+ );
1293
+ }
1294
+ function logRecoverableError(request, error) {
1295
+ var prevRequest = currentRequest;
1296
+ currentRequest = null;
1297
+ try {
1298
+ var onError = request.onError;
1299
+ var errorDigest = supportsRequestStorage
1300
+ ? requestStorage.run(void 0, onError, error)
1301
+ : onError(error);
1302
+ } finally {
1303
+ currentRequest = prevRequest;
1304
+ }
1305
+ if (null != errorDigest && "string" !== typeof errorDigest)
1306
+ throw Error(
1307
+ '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 "' +
1308
+ typeof errorDigest +
1309
+ '" instead'
1310
+ );
1311
+ return errorDigest || "";
1312
+ }
1313
+ function fatalError(request, error) {
1314
+ null !== request.destination
1315
+ ? ((request.status = 2), closeWithError(request.destination, error))
1316
+ : ((request.status = 1), (request.fatalError = error));
1317
+ }
1318
+ function emitErrorChunk(request, id, digest) {
1319
+ digest = { digest: digest };
1320
+ id = id.toString(16) + ":E" + stringify(digest) + "\n";
1321
+ id = textEncoder.encode(id);
1322
+ request.completedErrorChunks.push(id);
1323
+ }
1324
+ function emitModelChunk(request, id, json) {
1325
+ id = id.toString(16) + ":" + json + "\n";
1326
+ id = textEncoder.encode(id);
1327
+ request.completedRegularChunks.push(id);
1328
+ }
1329
+ function emitTextChunk(request, id, text) {
1330
+ request.pendingChunks++;
1331
+ text = textEncoder.encode(text);
1332
+ var binaryLength = text.byteLength;
1333
+ id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1334
+ id = textEncoder.encode(id);
1335
+ request.completedRegularChunks.push(id, text);
1336
+ }
1337
+ var emptyRoot = {};
1338
+ function retryTask(request, task) {
1339
+ if (0 === task.status)
1340
+ try {
1341
+ modelRoot = task.model;
1342
+ var resolvedModel = renderModelDestructive(
1343
+ request,
1344
+ task,
1345
+ emptyRoot,
1346
+ "",
1347
+ task.model
1348
+ );
1349
+ modelRoot = resolvedModel;
1350
+ task.keyPath = null;
1351
+ task.implicitSlot = !1;
1352
+ if ("object" === typeof resolvedModel && null !== resolvedModel) {
1353
+ var id = task.id;
1354
+ if ("string" === typeof resolvedModel)
1355
+ emitTextChunk(request, id, resolvedModel);
1356
+ else {
1357
+ var json = stringify(resolvedModel, task.toJSON);
1358
+ emitModelChunk(request, task.id, json);
1359
+ }
1360
+ } else {
1361
+ var json$jscomp$0 = stringify(resolvedModel);
1362
+ emitModelChunk(request, task.id, json$jscomp$0);
1363
+ }
1364
+ request.abortableTasks.delete(task);
1365
+ task.status = 1;
1366
+ } catch (thrownValue) {
1367
+ var x =
1368
+ thrownValue === SuspenseException
1369
+ ? getSuspendedThenable()
1370
+ : thrownValue;
1371
+ if ("object" === typeof x && null !== x && "function" === typeof x.then) {
1372
+ var ping = task.ping;
1373
+ x.then(ping, ping);
1374
+ task.thenableState = getThenableStateAfterSuspending();
1375
+ } else {
1376
+ request.abortableTasks.delete(task);
1377
+ task.status = 4;
1378
+ var digest = logRecoverableError(request, x);
1379
+ emitErrorChunk(request, task.id, digest);
1380
+ }
1381
+ } finally {
1382
+ }
1383
+ }
1384
+ function performWork(request) {
1385
+ var prevDispatcher = ReactSharedInternalsServer.H;
1386
+ ReactSharedInternalsServer.H = HooksDispatcher;
1387
+ var prevRequest = currentRequest;
1388
+ currentRequest$1 = currentRequest = request;
1389
+ try {
1390
+ var pingedTasks = request.pingedTasks;
1391
+ request.pingedTasks = [];
1392
+ for (var i = 0; i < pingedTasks.length; i++)
1393
+ retryTask(request, pingedTasks[i]);
1394
+ null !== request.destination &&
1395
+ flushCompletedChunks(request, request.destination);
1396
+ } catch (error) {
1397
+ logRecoverableError(request, error), fatalError(request, error);
1398
+ } finally {
1399
+ (ReactSharedInternalsServer.H = prevDispatcher),
1400
+ (currentRequest$1 = null),
1401
+ (currentRequest = prevRequest);
1402
+ }
1403
+ }
1404
+ function flushCompletedChunks(request, destination) {
1405
+ currentView = new Uint8Array(2048);
1406
+ writtenBytes = 0;
1407
+ try {
1408
+ for (
1409
+ var importsChunks = request.completedImportChunks, i = 0;
1410
+ i < importsChunks.length;
1411
+ i++
1412
+ )
1413
+ request.pendingChunks--,
1414
+ writeChunkAndReturn(destination, importsChunks[i]);
1415
+ importsChunks.splice(0, i);
1416
+ var hintChunks = request.completedHintChunks;
1417
+ for (i = 0; i < hintChunks.length; i++)
1418
+ writeChunkAndReturn(destination, hintChunks[i]);
1419
+ hintChunks.splice(0, i);
1420
+ var regularChunks = request.completedRegularChunks;
1421
+ for (i = 0; i < regularChunks.length; i++)
1422
+ request.pendingChunks--,
1423
+ writeChunkAndReturn(destination, regularChunks[i]);
1424
+ regularChunks.splice(0, i);
1425
+ var errorChunks = request.completedErrorChunks;
1426
+ for (i = 0; i < errorChunks.length; i++)
1427
+ request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]);
1428
+ errorChunks.splice(0, i);
1429
+ } finally {
1430
+ (request.flushScheduled = !1),
1431
+ currentView &&
1432
+ 0 < writtenBytes &&
1433
+ (destination.enqueue(
1434
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
1435
+ ),
1436
+ (currentView = null),
1437
+ (writtenBytes = 0));
1438
+ }
1439
+ 0 === request.pendingChunks &&
1440
+ (destination.close(), (request.destination = null));
1441
+ }
1442
+ function startWork(request) {
1443
+ request.flushScheduled = null !== request.destination;
1444
+ supportsRequestStorage
1445
+ ? setTimeout(function () {
1446
+ return requestStorage.run(request, performWork, request);
1447
+ }, 0)
1448
+ : setTimeout(function () {
1449
+ return performWork(request);
1450
+ }, 0);
1451
+ }
1452
+ function enqueueFlush(request) {
1453
+ if (
1454
+ !1 === request.flushScheduled &&
1455
+ 0 === request.pingedTasks.length &&
1456
+ null !== request.destination
1457
+ ) {
1458
+ var destination = request.destination;
1459
+ request.flushScheduled = !0;
1460
+ setTimeout(function () {
1461
+ return flushCompletedChunks(request, destination);
1462
+ }, 0);
1463
+ }
1464
+ }
1465
+ function abort(request, reason) {
1466
+ try {
1467
+ var abortableTasks = request.abortableTasks;
1468
+ if (0 < abortableTasks.size) {
1469
+ request.pendingChunks++;
1470
+ var errorId = request.nextChunkId++,
1471
+ error =
1472
+ void 0 === reason
1473
+ ? Error("The render was aborted by the server without a reason.")
1474
+ : reason,
1475
+ digest = logRecoverableError(request, error);
1476
+ emitErrorChunk(request, errorId, digest, error);
1477
+ abortableTasks.forEach(function (task) {
1478
+ task.status = 3;
1479
+ var ref = serializeByValueID(errorId);
1480
+ task = encodeReferenceChunk(request, task.id, ref);
1481
+ request.completedErrorChunks.push(task);
1482
+ });
1483
+ abortableTasks.clear();
1484
+ }
1485
+ var abortListeners = request.abortListeners;
1486
+ if (0 < abortListeners.size) {
1487
+ var error$17 =
1488
+ void 0 === reason
1489
+ ? Error("The render was aborted by the server without a reason.")
1490
+ : reason;
1491
+ abortListeners.forEach(function (callback) {
1492
+ return callback(error$17);
1493
+ });
1494
+ abortListeners.clear();
1495
+ }
1496
+ null !== request.destination &&
1497
+ flushCompletedChunks(request, request.destination);
1498
+ } catch (error$18) {
1499
+ logRecoverableError(request, error$18), fatalError(request, error$18);
1500
+ }
1501
+ }
1502
+ function resolveServerReference(bundlerConfig, id) {
1503
+ var name = "",
1504
+ resolvedModuleData = bundlerConfig[id];
1505
+ if (resolvedModuleData) name = resolvedModuleData.name;
1506
+ else {
1507
+ var idx = id.lastIndexOf("#");
1508
+ -1 !== idx &&
1509
+ ((name = id.slice(idx + 1)),
1510
+ (resolvedModuleData = bundlerConfig[id.slice(0, idx)]));
1511
+ if (!resolvedModuleData)
1512
+ throw Error(
1513
+ 'Could not find the module "' +
1514
+ id +
1515
+ '" in the React Server Manifest. This is probably a bug in the React Server Components bundler.'
1516
+ );
1517
+ }
1518
+ return [resolvedModuleData.id, resolvedModuleData.chunks, name];
1519
+ }
1520
+ var chunkCache = new Map();
1521
+ function requireAsyncModule(id) {
1522
+ var promise = __webpack_require__(id);
1523
+ if ("function" !== typeof promise.then || "fulfilled" === promise.status)
1524
+ return null;
1525
+ promise.then(
1526
+ function (value) {
1527
+ promise.status = "fulfilled";
1528
+ promise.value = value;
1529
+ },
1530
+ function (reason) {
1531
+ promise.status = "rejected";
1532
+ promise.reason = reason;
1533
+ }
1534
+ );
1535
+ return promise;
1536
+ }
1537
+ function ignoreReject() {}
1538
+ function preloadModule(metadata) {
1539
+ for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; ) {
1540
+ var chunkId = chunks[i++];
1541
+ chunks[i++];
1542
+ var entry = chunkCache.get(chunkId);
1543
+ if (void 0 === entry) {
1544
+ entry = __webpack_chunk_load__(chunkId);
1545
+ promises.push(entry);
1546
+ var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
1547
+ entry.then(resolve, ignoreReject);
1548
+ chunkCache.set(chunkId, entry);
1549
+ } else null !== entry && promises.push(entry);
1550
+ }
1551
+ return 4 === metadata.length
1552
+ ? 0 === promises.length
1553
+ ? requireAsyncModule(metadata[0])
1554
+ : Promise.all(promises).then(function () {
1555
+ return requireAsyncModule(metadata[0]);
1556
+ })
1557
+ : 0 < promises.length
1558
+ ? Promise.all(promises)
1559
+ : null;
1560
+ }
1561
+ function requireModule(metadata) {
1562
+ var moduleExports = __webpack_require__(metadata[0]);
1563
+ if (4 === metadata.length && "function" === typeof moduleExports.then)
1564
+ if ("fulfilled" === moduleExports.status)
1565
+ moduleExports = moduleExports.value;
1566
+ else throw moduleExports.reason;
1567
+ return "*" === metadata[2]
1568
+ ? moduleExports
1569
+ : "" === metadata[2]
1570
+ ? moduleExports.__esModule
1571
+ ? moduleExports.default
1572
+ : moduleExports
1573
+ : moduleExports[metadata[2]];
1574
+ }
1575
+ function Chunk(status, value, reason, response) {
1576
+ this.status = status;
1577
+ this.value = value;
1578
+ this.reason = reason;
1579
+ this._response = response;
1580
+ }
1581
+ Chunk.prototype = Object.create(Promise.prototype);
1582
+ Chunk.prototype.then = function (resolve, reject) {
1583
+ switch (this.status) {
1584
+ case "resolved_model":
1585
+ initializeModelChunk(this);
1586
+ }
1587
+ switch (this.status) {
1588
+ case "fulfilled":
1589
+ resolve(this.value);
1590
+ break;
1591
+ case "pending":
1592
+ case "blocked":
1593
+ resolve &&
1594
+ (null === this.value && (this.value = []), this.value.push(resolve));
1595
+ reject &&
1596
+ (null === this.reason && (this.reason = []), this.reason.push(reject));
1597
+ break;
1598
+ default:
1599
+ reject(this.reason);
1600
+ }
1601
+ };
1602
+ function wakeChunk(listeners, value) {
1603
+ for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
1604
+ }
1605
+ function triggerErrorOnChunk(chunk, error) {
1606
+ if ("pending" === chunk.status || "blocked" === chunk.status) {
1607
+ var listeners = chunk.reason;
1608
+ chunk.status = "rejected";
1609
+ chunk.reason = error;
1610
+ null !== listeners && wakeChunk(listeners, error);
1611
+ }
1612
+ }
1613
+ function loadServerReference$1(
1614
+ response,
1615
+ id,
1616
+ bound,
1617
+ parentChunk,
1618
+ parentObject,
1619
+ key
1620
+ ) {
1621
+ var serverReference = resolveServerReference(response._bundlerConfig, id);
1622
+ response = preloadModule(serverReference);
1623
+ if (bound)
1624
+ bound = Promise.all([bound, response]).then(function (_ref) {
1625
+ _ref = _ref[0];
1626
+ var fn = requireModule(serverReference);
1627
+ return fn.bind.apply(fn, [null].concat(_ref));
1628
+ });
1629
+ else if (response)
1630
+ bound = Promise.resolve(response).then(function () {
1631
+ return requireModule(serverReference);
1632
+ });
1633
+ else return requireModule(serverReference);
1634
+ bound.then(
1635
+ createModelResolver(parentChunk, parentObject, key),
1636
+ createModelReject(parentChunk)
1637
+ );
1638
+ return null;
1639
+ }
1640
+ var initializingChunk = null,
1641
+ initializingChunkBlockedModel = null;
1642
+ function initializeModelChunk(chunk) {
1643
+ var prevChunk = initializingChunk,
1644
+ prevBlocked = initializingChunkBlockedModel;
1645
+ initializingChunk = chunk;
1646
+ initializingChunkBlockedModel = null;
1647
+ try {
1648
+ var value = JSON.parse(chunk.value, chunk._response._fromJSON);
1649
+ null !== initializingChunkBlockedModel &&
1650
+ 0 < initializingChunkBlockedModel.deps
1651
+ ? ((initializingChunkBlockedModel.value = value),
1652
+ (chunk.status = "blocked"),
1653
+ (chunk.value = null),
1654
+ (chunk.reason = null))
1655
+ : ((chunk.status = "fulfilled"), (chunk.value = value));
1656
+ } catch (error) {
1657
+ (chunk.status = "rejected"), (chunk.reason = error);
1658
+ } finally {
1659
+ (initializingChunk = prevChunk),
1660
+ (initializingChunkBlockedModel = prevBlocked);
1661
+ }
1662
+ }
1663
+ function reportGlobalError(response, error) {
1664
+ response._chunks.forEach(function (chunk) {
1665
+ "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
1666
+ });
1667
+ }
1668
+ function getChunk(response, id) {
1669
+ var chunks = response._chunks,
1670
+ chunk = chunks.get(id);
1671
+ chunk ||
1672
+ ((chunk = response._formData.get(response._prefix + id)),
1673
+ (chunk =
1674
+ null != chunk
1675
+ ? new Chunk("resolved_model", chunk, null, response)
1676
+ : new Chunk("pending", null, null, response)),
1677
+ chunks.set(id, chunk));
1678
+ return chunk;
1679
+ }
1680
+ function createModelResolver(chunk, parentObject, key) {
1681
+ if (initializingChunkBlockedModel) {
1682
+ var blocked = initializingChunkBlockedModel;
1683
+ blocked.deps++;
1684
+ } else blocked = initializingChunkBlockedModel = { deps: 1, value: null };
1685
+ return function (value) {
1686
+ parentObject[key] = value;
1687
+ blocked.deps--;
1688
+ 0 === blocked.deps &&
1689
+ "blocked" === chunk.status &&
1690
+ ((value = chunk.value),
1691
+ (chunk.status = "fulfilled"),
1692
+ (chunk.value = blocked.value),
1693
+ null !== value && wakeChunk(value, blocked.value));
1694
+ };
1695
+ }
1696
+ function createModelReject(chunk) {
1697
+ return function (error) {
1698
+ return triggerErrorOnChunk(chunk, error);
1699
+ };
1700
+ }
1701
+ function getOutlinedModel(response, id) {
1702
+ response = getChunk(response, id);
1703
+ "resolved_model" === response.status && initializeModelChunk(response);
1704
+ if ("fulfilled" !== response.status) throw response.reason;
1705
+ return response.value;
1706
+ }
1707
+ function parseModelString(response, obj, key, value) {
1708
+ if ("$" === value[0]) {
1709
+ switch (value[1]) {
1710
+ case "$":
1711
+ return value.slice(1);
1712
+ case "@":
1713
+ return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
1714
+ case "F":
1715
+ return (
1716
+ (value = parseInt(value.slice(2), 16)),
1717
+ (value = getOutlinedModel(response, value)),
1718
+ loadServerReference$1(
1719
+ response,
1720
+ value.id,
1721
+ value.bound,
1722
+ initializingChunk,
1723
+ obj,
1724
+ key
1725
+ )
1726
+ );
1727
+ case "T":
1728
+ return createTemporaryReference(value.slice(2));
1729
+ case "Q":
1730
+ return (
1731
+ (obj = parseInt(value.slice(2), 16)),
1732
+ (response = getOutlinedModel(response, obj)),
1733
+ new Map(response)
1734
+ );
1735
+ case "W":
1736
+ return (
1737
+ (obj = parseInt(value.slice(2), 16)),
1738
+ (response = getOutlinedModel(response, obj)),
1739
+ new Set(response)
1740
+ );
1741
+ case "K":
1742
+ obj = value.slice(2);
1743
+ var formPrefix = response._prefix + obj + "_",
1744
+ data$23 = new FormData();
1745
+ response._formData.forEach(function (entry, entryKey) {
1746
+ entryKey.startsWith(formPrefix) &&
1747
+ data$23.append(entryKey.slice(formPrefix.length), entry);
1748
+ });
1749
+ return data$23;
1750
+ case "i":
1751
+ return (
1752
+ (obj = parseInt(value.slice(2), 16)),
1753
+ getOutlinedModel(response, obj)[Symbol.iterator]()
1754
+ );
1755
+ case "I":
1756
+ return Infinity;
1757
+ case "-":
1758
+ return "$-0" === value ? -0 : -Infinity;
1759
+ case "N":
1760
+ return NaN;
1761
+ case "u":
1762
+ return;
1763
+ case "D":
1764
+ return new Date(Date.parse(value.slice(2)));
1765
+ case "n":
1766
+ return BigInt(value.slice(2));
1767
+ }
1768
+ value = parseInt(value.slice(1), 16);
1769
+ response = getChunk(response, value);
1770
+ switch (response.status) {
1771
+ case "resolved_model":
1772
+ initializeModelChunk(response);
1773
+ }
1774
+ switch (response.status) {
1775
+ case "fulfilled":
1776
+ return response.value;
1777
+ case "pending":
1778
+ case "blocked":
1779
+ return (
1780
+ (value = initializingChunk),
1781
+ response.then(
1782
+ createModelResolver(value, obj, key),
1783
+ createModelReject(value)
1784
+ ),
1785
+ null
1786
+ );
1787
+ default:
1788
+ throw response.reason;
1789
+ }
1790
+ }
1791
+ return value;
1792
+ }
1793
+ function createResponse(bundlerConfig, formFieldPrefix) {
1794
+ var backingFormData =
1795
+ 2 < arguments.length && void 0 !== arguments[2]
1796
+ ? arguments[2]
1797
+ : new FormData(),
1798
+ chunks = new Map(),
1799
+ response = {
1800
+ _bundlerConfig: bundlerConfig,
1801
+ _prefix: formFieldPrefix,
1802
+ _formData: backingFormData,
1803
+ _chunks: chunks,
1804
+ _fromJSON: function (key, value) {
1805
+ return "string" === typeof value
1806
+ ? parseModelString(response, this, key, value)
1807
+ : value;
1808
+ }
1809
+ };
1810
+ return response;
1811
+ }
1812
+ function close(response) {
1813
+ reportGlobalError(response, Error("Connection closed."));
1814
+ }
1815
+ function loadServerReference(bundlerConfig, id, bound) {
1816
+ var serverReference = resolveServerReference(bundlerConfig, id);
1817
+ bundlerConfig = preloadModule(serverReference);
1818
+ return bound
1819
+ ? Promise.all([bound, bundlerConfig]).then(function (_ref) {
1820
+ _ref = _ref[0];
1821
+ var fn = requireModule(serverReference);
1822
+ return fn.bind.apply(fn, [null].concat(_ref));
1823
+ })
1824
+ : bundlerConfig
1825
+ ? Promise.resolve(bundlerConfig).then(function () {
1826
+ return requireModule(serverReference);
1827
+ })
1828
+ : Promise.resolve(requireModule(serverReference));
1829
+ }
1830
+ function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
1831
+ body = createResponse(serverManifest, formFieldPrefix, body);
1832
+ close(body);
1833
+ body = getChunk(body, 0);
1834
+ body.then(function () {});
1835
+ if ("fulfilled" !== body.status) throw body.reason;
1836
+ return body.value;
1837
+ }
1838
+ exports.createClientModuleProxy = function (moduleId) {
1839
+ moduleId = registerClientReferenceImpl({}, moduleId, !1);
1840
+ return new Proxy(moduleId, proxyHandlers$1);
1841
+ };
1842
+ exports.decodeAction = function (body, serverManifest) {
1843
+ var formData = new FormData(),
1844
+ action = null;
1845
+ body.forEach(function (value, key) {
1846
+ key.startsWith("$ACTION_")
1847
+ ? key.startsWith("$ACTION_REF_")
1848
+ ? ((value = "$ACTION_" + key.slice(12) + ":"),
1849
+ (value = decodeBoundActionMetaData(body, serverManifest, value)),
1850
+ (action = loadServerReference(serverManifest, value.id, value.bound)))
1851
+ : key.startsWith("$ACTION_ID_") &&
1852
+ ((value = key.slice(11)),
1853
+ (action = loadServerReference(serverManifest, value, null)))
1854
+ : formData.append(key, value);
1855
+ });
1856
+ return null === action
1857
+ ? null
1858
+ : action.then(function (fn) {
1859
+ return fn.bind(null, formData);
1860
+ });
1861
+ };
1862
+ exports.decodeFormState = function (actionResult, body, serverManifest) {
1863
+ var keyPath = body.get("$ACTION_KEY");
1864
+ if ("string" !== typeof keyPath) return Promise.resolve(null);
1865
+ var metaData = null;
1866
+ body.forEach(function (value, key) {
1867
+ key.startsWith("$ACTION_REF_") &&
1868
+ ((value = "$ACTION_" + key.slice(12) + ":"),
1869
+ (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
1870
+ });
1871
+ if (null === metaData) return Promise.resolve(null);
1872
+ var referenceId = metaData.id;
1873
+ return Promise.resolve(metaData.bound).then(function (bound) {
1874
+ return null === bound
1875
+ ? null
1876
+ : [actionResult, keyPath, referenceId, bound.length - 1];
1877
+ });
1878
+ };
1879
+ exports.decodeReply = function (body, webpackMap) {
1880
+ if ("string" === typeof body) {
1881
+ var form = new FormData();
1882
+ form.append("0", body);
1883
+ body = form;
1884
+ }
1885
+ body = createResponse(webpackMap, "", body);
1886
+ webpackMap = getChunk(body, 0);
1887
+ close(body);
1888
+ return webpackMap;
1889
+ };
1890
+ exports.registerClientReference = function (
1891
+ proxyImplementation,
1892
+ id,
1893
+ exportName
1894
+ ) {
1895
+ return registerClientReferenceImpl(
1896
+ proxyImplementation,
1897
+ id + "#" + exportName,
1898
+ !1
1899
+ );
1900
+ };
1901
+ exports.registerServerReference = function (reference, id, exportName) {
1902
+ return Object.defineProperties(reference, {
1903
+ $$typeof: { value: SERVER_REFERENCE_TAG },
1904
+ $$id: {
1905
+ value: null === exportName ? id : id + "#" + exportName,
1906
+ configurable: !0
1907
+ },
1908
+ $$bound: { value: null, configurable: !0 },
1909
+ bind: { value: bind, configurable: !0 }
1910
+ });
1911
+ };
1912
+ exports.renderToReadableStream = function (model, webpackMap, options) {
1913
+ var request = createRequest(
1914
+ model,
1915
+ webpackMap,
1916
+ options ? options.onError : void 0,
1917
+ options ? options.identifierPrefix : void 0,
1918
+ options ? options.onPostpone : void 0
1919
+ );
1920
+ if (options && options.signal) {
1921
+ var signal = options.signal;
1922
+ if (signal.aborted) abort(request, signal.reason);
1923
+ else {
1924
+ var listener = function () {
1925
+ abort(request, signal.reason);
1926
+ signal.removeEventListener("abort", listener);
1927
+ };
1928
+ signal.addEventListener("abort", listener);
1929
+ }
1930
+ }
1931
+ return new ReadableStream(
1932
+ {
1933
+ type: "bytes",
1934
+ start: function () {
1935
+ startWork(request);
1936
+ },
1937
+ pull: function (controller) {
1938
+ if (1 === request.status)
1939
+ (request.status = 2), closeWithError(controller, request.fatalError);
1940
+ else if (2 !== request.status && null === request.destination) {
1941
+ request.destination = controller;
1942
+ try {
1943
+ flushCompletedChunks(request, controller);
1944
+ } catch (error) {
1945
+ logRecoverableError(request, error), fatalError(request, error);
1946
+ }
1947
+ }
1948
+ },
1949
+ cancel: function (reason) {
1950
+ request.destination = null;
1951
+ abort(request, reason);
1952
+ }
1953
+ },
1954
+ { highWaterMark: 0 }
1955
+ );
1956
+ };