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