vite-plugin-react-server 1.2.5 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/package.json +8 -3
  2. package/dist/plugin/orchestrator/createPluginOrchestrator.client.d.ts.map +1 -1
  3. package/dist/plugin/orchestrator/createPluginOrchestrator.client.js +3 -0
  4. package/dist/plugin/orchestrator/createPluginOrchestrator.server.d.ts.map +1 -1
  5. package/dist/plugin/orchestrator/createPluginOrchestrator.server.js +3 -0
  6. package/dist/plugin/vendor/vendor-alias.d.ts +12 -0
  7. package/dist/plugin/vendor/vendor-alias.d.ts.map +1 -0
  8. package/dist/plugin/vendor/vendor-alias.js +87 -0
  9. package/dist/plugin/vendor/vendor.client.d.ts +1 -1
  10. package/dist/plugin/vendor/vendor.client.d.ts.map +1 -1
  11. package/dist/plugin/vendor/vendor.client.js +19 -6
  12. package/dist/plugin/vendor/vendor.server.d.ts.map +1 -1
  13. package/dist/plugin/vendor/vendor.server.js +18 -5
  14. package/dist/plugin/vendor/vendor.static.d.ts.map +1 -1
  15. package/dist/plugin/vendor/vendor.static.js +18 -5
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/oss-experimental/react-server-dom-esm/LICENSE +21 -0
  18. package/oss-experimental/react-server-dom-esm/README.md +5 -0
  19. package/oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +2996 -0
  20. package/oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.js +1612 -0
  21. package/oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +3124 -0
  22. package/oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.js +1752 -0
  23. package/oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +4213 -0
  24. package/oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js +2857 -0
  25. package/oss-experimental/react-server-dom-esm/client.browser.js +7 -0
  26. package/oss-experimental/react-server-dom-esm/client.js +3 -0
  27. package/oss-experimental/react-server-dom-esm/client.node.js +7 -0
  28. package/oss-experimental/react-server-dom-esm/esm/package.json +3 -0
  29. package/oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +3969 -0
  30. package/oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js +2347 -0
  31. package/oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-node-loader.production.js +515 -0
  32. package/oss-experimental/react-server-dom-esm/index.js +12 -0
  33. package/oss-experimental/react-server-dom-esm/package.json +63 -0
  34. package/oss-experimental/react-server-dom-esm/server.js +6 -0
  35. package/oss-experimental/react-server-dom-esm/server.node.js +17 -0
  36. package/oss-experimental/react-server-dom-esm/static.js +6 -0
  37. package/oss-experimental/react-server-dom-esm/static.node.js +12 -0
  38. package/package.json +8 -3
  39. package/plugin/orchestrator/createPluginOrchestrator.client.ts +4 -0
  40. package/plugin/orchestrator/createPluginOrchestrator.server.ts +4 -0
  41. package/plugin/vendor/vendor-alias.ts +102 -0
  42. package/plugin/vendor/vendor.client.ts +24 -9
  43. package/plugin/vendor/vendor.server.ts +22 -7
  44. package/plugin/vendor/vendor.static.ts +21 -7
  45. package/scripts/build-oss-experimental.sh +161 -0
@@ -0,0 +1,2857 @@
1
+ /**
2
+ * @license React
3
+ * react-server-dom-esm-server.node.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 stream = require("stream"),
13
+ util = require("util");
14
+ require("crypto");
15
+ var async_hooks = require("async_hooks"),
16
+ ReactDOM = require("react-dom"),
17
+ React = require("react"),
18
+ scheduleMicrotask = queueMicrotask,
19
+ currentView = null,
20
+ writtenBytes = 0,
21
+ destinationHasCapacity = !0;
22
+ function writeToDestination(destination, view) {
23
+ destination = destination.write(view);
24
+ destinationHasCapacity = destinationHasCapacity && destination;
25
+ }
26
+ function writeChunkAndReturn(destination, chunk) {
27
+ if ("string" === typeof chunk) {
28
+ if (0 !== chunk.length)
29
+ if (2048 < 3 * chunk.length)
30
+ 0 < writtenBytes &&
31
+ (writeToDestination(
32
+ destination,
33
+ currentView.subarray(0, writtenBytes)
34
+ ),
35
+ (currentView = new Uint8Array(2048)),
36
+ (writtenBytes = 0)),
37
+ writeToDestination(destination, chunk);
38
+ else {
39
+ var target = currentView;
40
+ 0 < writtenBytes && (target = currentView.subarray(writtenBytes));
41
+ target = textEncoder.encodeInto(chunk, target);
42
+ var read = target.read;
43
+ writtenBytes += target.written;
44
+ read < chunk.length &&
45
+ (writeToDestination(
46
+ destination,
47
+ currentView.subarray(0, writtenBytes)
48
+ ),
49
+ (currentView = new Uint8Array(2048)),
50
+ (writtenBytes = textEncoder.encodeInto(
51
+ chunk.slice(read),
52
+ currentView
53
+ ).written));
54
+ 2048 === writtenBytes &&
55
+ (writeToDestination(destination, currentView),
56
+ (currentView = new Uint8Array(2048)),
57
+ (writtenBytes = 0));
58
+ }
59
+ } else
60
+ 0 !== chunk.byteLength &&
61
+ (2048 < chunk.byteLength
62
+ ? (0 < writtenBytes &&
63
+ (writeToDestination(
64
+ destination,
65
+ currentView.subarray(0, writtenBytes)
66
+ ),
67
+ (currentView = new Uint8Array(2048)),
68
+ (writtenBytes = 0)),
69
+ writeToDestination(destination, chunk))
70
+ : ((target = currentView.length - writtenBytes),
71
+ target < chunk.byteLength &&
72
+ (0 === target
73
+ ? writeToDestination(destination, currentView)
74
+ : (currentView.set(chunk.subarray(0, target), writtenBytes),
75
+ (writtenBytes += target),
76
+ writeToDestination(destination, currentView),
77
+ (chunk = chunk.subarray(target))),
78
+ (currentView = new Uint8Array(2048)),
79
+ (writtenBytes = 0)),
80
+ currentView.set(chunk, writtenBytes),
81
+ (writtenBytes += chunk.byteLength),
82
+ 2048 === writtenBytes &&
83
+ (writeToDestination(destination, currentView),
84
+ (currentView = new Uint8Array(2048)),
85
+ (writtenBytes = 0))));
86
+ return destinationHasCapacity;
87
+ }
88
+ var textEncoder = new util.TextEncoder();
89
+ function byteLengthOfChunk(chunk) {
90
+ return "string" === typeof chunk
91
+ ? Buffer.byteLength(chunk, "utf8")
92
+ : chunk.byteLength;
93
+ }
94
+ var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
95
+ SERVER_REFERENCE_TAG = Symbol.for("react.server.reference"),
96
+ 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
+ $$typeof = { value: SERVER_REFERENCE_TAG },
103
+ $$id = { value: this.$$id };
104
+ args = { value: this.$$bound ? this.$$bound.concat(args) : args };
105
+ return Object.defineProperties(newFn, {
106
+ $$typeof: $$typeof,
107
+ $$id: $$id,
108
+ $$bound: args,
109
+ bind: { value: bind, configurable: !0 }
110
+ });
111
+ }
112
+ return newFn;
113
+ }
114
+ var ReactDOMSharedInternals =
115
+ ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
116
+ previousDispatcher = ReactDOMSharedInternals.d;
117
+ ReactDOMSharedInternals.d = {
118
+ f: previousDispatcher.f,
119
+ r: previousDispatcher.r,
120
+ D: prefetchDNS,
121
+ C: preconnect,
122
+ L: preload,
123
+ m: preloadModule$1,
124
+ X: preinitScript,
125
+ S: preinitStyle,
126
+ M: preinitModuleScript
127
+ };
128
+ function prefetchDNS(href) {
129
+ if ("string" === typeof href && href) {
130
+ var request = resolveRequest();
131
+ if (request) {
132
+ var hints = request.hints,
133
+ key = "D|" + href;
134
+ hints.has(key) || (hints.add(key), emitHint(request, "D", href));
135
+ } else previousDispatcher.D(href);
136
+ }
137
+ }
138
+ function preconnect(href, crossOrigin) {
139
+ if ("string" === typeof href) {
140
+ var request = resolveRequest();
141
+ if (request) {
142
+ var hints = request.hints,
143
+ key = "C|" + (null == crossOrigin ? "null" : crossOrigin) + "|" + href;
144
+ hints.has(key) ||
145
+ (hints.add(key),
146
+ "string" === typeof crossOrigin
147
+ ? emitHint(request, "C", [href, crossOrigin])
148
+ : emitHint(request, "C", href));
149
+ } else previousDispatcher.C(href, crossOrigin);
150
+ }
151
+ }
152
+ function preload(href, as, options) {
153
+ if ("string" === typeof href) {
154
+ var request = resolveRequest();
155
+ if (request) {
156
+ var hints = request.hints,
157
+ key = "L";
158
+ if ("image" === as && options) {
159
+ var imageSrcSet = options.imageSrcSet,
160
+ imageSizes = options.imageSizes,
161
+ uniquePart = "";
162
+ "string" === typeof imageSrcSet && "" !== imageSrcSet
163
+ ? ((uniquePart += "[" + imageSrcSet + "]"),
164
+ "string" === typeof imageSizes &&
165
+ (uniquePart += "[" + imageSizes + "]"))
166
+ : (uniquePart += "[][]" + href);
167
+ key += "[image]" + uniquePart;
168
+ } else key += "[" + as + "]" + href;
169
+ hints.has(key) ||
170
+ (hints.add(key),
171
+ (options = trimOptions(options))
172
+ ? emitHint(request, "L", [href, as, options])
173
+ : emitHint(request, "L", [href, as]));
174
+ } else previousDispatcher.L(href, as, options);
175
+ }
176
+ }
177
+ function preloadModule$1(href, options) {
178
+ if ("string" === typeof href) {
179
+ var request = resolveRequest();
180
+ if (request) {
181
+ var hints = request.hints,
182
+ key = "m|" + href;
183
+ if (hints.has(key)) return;
184
+ hints.add(key);
185
+ return (options = trimOptions(options))
186
+ ? emitHint(request, "m", [href, options])
187
+ : emitHint(request, "m", href);
188
+ }
189
+ previousDispatcher.m(href, options);
190
+ }
191
+ }
192
+ function preinitStyle(href, precedence, options) {
193
+ if ("string" === typeof href) {
194
+ var request = resolveRequest();
195
+ if (request) {
196
+ var hints = request.hints,
197
+ key = "S|" + href;
198
+ if (hints.has(key)) return;
199
+ hints.add(key);
200
+ return (options = trimOptions(options))
201
+ ? emitHint(request, "S", [
202
+ href,
203
+ "string" === typeof precedence ? precedence : 0,
204
+ options
205
+ ])
206
+ : "string" === typeof precedence
207
+ ? emitHint(request, "S", [href, precedence])
208
+ : emitHint(request, "S", href);
209
+ }
210
+ previousDispatcher.S(href, precedence, options);
211
+ }
212
+ }
213
+ function preinitScript(src, options) {
214
+ if ("string" === typeof src) {
215
+ var request = resolveRequest();
216
+ if (request) {
217
+ var hints = request.hints,
218
+ key = "X|" + src;
219
+ if (hints.has(key)) return;
220
+ hints.add(key);
221
+ return (options = trimOptions(options))
222
+ ? emitHint(request, "X", [src, options])
223
+ : emitHint(request, "X", src);
224
+ }
225
+ previousDispatcher.X(src, options);
226
+ }
227
+ }
228
+ function preinitModuleScript(src, options) {
229
+ if ("string" === typeof src) {
230
+ var request = resolveRequest();
231
+ if (request) {
232
+ var hints = request.hints,
233
+ key = "M|" + src;
234
+ if (hints.has(key)) return;
235
+ hints.add(key);
236
+ return (options = trimOptions(options))
237
+ ? emitHint(request, "M", [src, options])
238
+ : emitHint(request, "M", src);
239
+ }
240
+ previousDispatcher.M(src, options);
241
+ }
242
+ }
243
+ function trimOptions(options) {
244
+ if (null == options) return null;
245
+ var hasProperties = !1,
246
+ trimmed = {},
247
+ key;
248
+ for (key in options)
249
+ null != options[key] &&
250
+ ((hasProperties = !0), (trimmed[key] = options[key]));
251
+ return hasProperties ? trimmed : null;
252
+ }
253
+ var requestStorage = new async_hooks.AsyncLocalStorage(),
254
+ TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
255
+ proxyHandlers = {
256
+ get: function (target, name) {
257
+ switch (name) {
258
+ case "$$typeof":
259
+ return target.$$typeof;
260
+ case "name":
261
+ return;
262
+ case "displayName":
263
+ return;
264
+ case "defaultProps":
265
+ return;
266
+ case "toJSON":
267
+ return;
268
+ case Symbol.toPrimitive:
269
+ return Object.prototype[Symbol.toPrimitive];
270
+ case Symbol.toStringTag:
271
+ return Object.prototype[Symbol.toStringTag];
272
+ case "Provider":
273
+ throw Error(
274
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
275
+ );
276
+ }
277
+ throw Error(
278
+ "Cannot access " +
279
+ String(name) +
280
+ " 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."
281
+ );
282
+ },
283
+ set: function () {
284
+ throw Error(
285
+ "Cannot assign to a temporary client reference from a server module."
286
+ );
287
+ }
288
+ };
289
+ function createTemporaryReference(temporaryReferences, id) {
290
+ var reference = Object.defineProperties(
291
+ function () {
292
+ throw Error(
293
+ "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."
294
+ );
295
+ },
296
+ { $$typeof: { value: TEMPORARY_REFERENCE_TAG } }
297
+ );
298
+ reference = new Proxy(reference, proxyHandlers);
299
+ temporaryReferences.set(reference, id);
300
+ return reference;
301
+ }
302
+ var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
303
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
304
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
305
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
306
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
307
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
308
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
309
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
310
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
311
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
312
+ REACT_POSTPONE_TYPE = Symbol.for("react.postpone"),
313
+ REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
314
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
315
+ function getIteratorFn(maybeIterable) {
316
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
317
+ maybeIterable =
318
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
319
+ maybeIterable["@@iterator"];
320
+ return "function" === typeof maybeIterable ? maybeIterable : null;
321
+ }
322
+ var ASYNC_ITERATOR = Symbol.asyncIterator,
323
+ SuspenseException = Error(
324
+ "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`."
325
+ );
326
+ function noop$1() {}
327
+ function trackUsedThenable(thenableState, thenable, index) {
328
+ index = thenableState[index];
329
+ void 0 === index
330
+ ? thenableState.push(thenable)
331
+ : index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index));
332
+ switch (thenable.status) {
333
+ case "fulfilled":
334
+ return thenable.value;
335
+ case "rejected":
336
+ throw thenable.reason;
337
+ default:
338
+ "string" === typeof thenable.status
339
+ ? thenable.then(noop$1, noop$1)
340
+ : ((thenableState = thenable),
341
+ (thenableState.status = "pending"),
342
+ thenableState.then(
343
+ function (fulfilledValue) {
344
+ if ("pending" === thenable.status) {
345
+ var fulfilledThenable = thenable;
346
+ fulfilledThenable.status = "fulfilled";
347
+ fulfilledThenable.value = fulfilledValue;
348
+ }
349
+ },
350
+ function (error) {
351
+ if ("pending" === thenable.status) {
352
+ var rejectedThenable = thenable;
353
+ rejectedThenable.status = "rejected";
354
+ rejectedThenable.reason = error;
355
+ }
356
+ }
357
+ ));
358
+ switch (thenable.status) {
359
+ case "fulfilled":
360
+ return thenable.value;
361
+ case "rejected":
362
+ throw thenable.reason;
363
+ }
364
+ suspendedThenable = thenable;
365
+ throw SuspenseException;
366
+ }
367
+ }
368
+ var suspendedThenable = null;
369
+ function getSuspendedThenable() {
370
+ if (null === suspendedThenable)
371
+ throw Error(
372
+ "Expected a suspended thenable. This is a bug in React. Please file an issue."
373
+ );
374
+ var thenable = suspendedThenable;
375
+ suspendedThenable = null;
376
+ return thenable;
377
+ }
378
+ var currentRequest$1 = null,
379
+ thenableIndexCounter = 0,
380
+ thenableState = null;
381
+ function getThenableStateAfterSuspending() {
382
+ var state = thenableState || [];
383
+ thenableState = null;
384
+ return state;
385
+ }
386
+ var HooksDispatcher = {
387
+ readContext: unsupportedContext,
388
+ use: use,
389
+ useCallback: function (callback) {
390
+ return callback;
391
+ },
392
+ useContext: unsupportedContext,
393
+ useEffect: unsupportedHook,
394
+ useImperativeHandle: unsupportedHook,
395
+ useLayoutEffect: unsupportedHook,
396
+ useInsertionEffect: unsupportedHook,
397
+ useMemo: function (nextCreate) {
398
+ return nextCreate();
399
+ },
400
+ useReducer: unsupportedHook,
401
+ useRef: unsupportedHook,
402
+ useState: unsupportedHook,
403
+ useDebugValue: function () {},
404
+ useDeferredValue: unsupportedHook,
405
+ useTransition: unsupportedHook,
406
+ useSyncExternalStore: unsupportedHook,
407
+ useId: useId,
408
+ useHostTransitionStatus: unsupportedHook,
409
+ useFormState: unsupportedHook,
410
+ useActionState: unsupportedHook,
411
+ useOptimistic: unsupportedHook,
412
+ useMemoCache: function (size) {
413
+ for (var data = Array(size), i = 0; i < size; i++)
414
+ data[i] = REACT_MEMO_CACHE_SENTINEL;
415
+ return data;
416
+ },
417
+ useCacheRefresh: function () {
418
+ return unsupportedRefresh;
419
+ }
420
+ };
421
+ HooksDispatcher.useEffectEvent = unsupportedHook;
422
+ function unsupportedHook() {
423
+ throw Error("This Hook is not supported in Server Components.");
424
+ }
425
+ function unsupportedRefresh() {
426
+ throw Error("Refreshing the cache is not supported in Server Components.");
427
+ }
428
+ function unsupportedContext() {
429
+ throw Error("Cannot read a Client Context from a Server Component.");
430
+ }
431
+ function useId() {
432
+ if (null === currentRequest$1)
433
+ throw Error("useId can only be used while React is rendering");
434
+ var id = currentRequest$1.identifierCount++;
435
+ return (
436
+ "\u00ab" +
437
+ currentRequest$1.identifierPrefix +
438
+ "S" +
439
+ id.toString(32) +
440
+ "\u00bb"
441
+ );
442
+ }
443
+ function use(usable) {
444
+ if (
445
+ (null !== usable && "object" === typeof usable) ||
446
+ "function" === typeof usable
447
+ ) {
448
+ if ("function" === typeof usable.then) {
449
+ var index = thenableIndexCounter;
450
+ thenableIndexCounter += 1;
451
+ null === thenableState && (thenableState = []);
452
+ return trackUsedThenable(thenableState, usable, index);
453
+ }
454
+ usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
455
+ }
456
+ if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
457
+ if (null != usable.value && usable.value.$$typeof === REACT_CONTEXT_TYPE)
458
+ throw Error("Cannot read a Client Context from a Server Component.");
459
+ throw Error("Cannot use() an already resolved Client Reference.");
460
+ }
461
+ throw Error("An unsupported type was passed to use(): " + String(usable));
462
+ }
463
+ var DefaultAsyncDispatcher = {
464
+ getCacheForType: function (resourceType) {
465
+ var JSCompiler_inline_result = (JSCompiler_inline_result =
466
+ resolveRequest())
467
+ ? JSCompiler_inline_result.cache
468
+ : new Map();
469
+ var entry = JSCompiler_inline_result.get(resourceType);
470
+ void 0 === entry &&
471
+ ((entry = resourceType()),
472
+ JSCompiler_inline_result.set(resourceType, entry));
473
+ return entry;
474
+ }
475
+ },
476
+ ReactSharedInternalsServer =
477
+ React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
478
+ if (!ReactSharedInternalsServer)
479
+ throw Error(
480
+ '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.'
481
+ );
482
+ var isArrayImpl = Array.isArray,
483
+ getPrototypeOf = Object.getPrototypeOf;
484
+ function objectName(object) {
485
+ return Object.prototype.toString
486
+ .call(object)
487
+ .replace(/^\[object (.*)\]$/, function (m, p0) {
488
+ return p0;
489
+ });
490
+ }
491
+ function describeValueForErrorMessage(value) {
492
+ switch (typeof value) {
493
+ case "string":
494
+ return JSON.stringify(
495
+ 10 >= value.length ? value : value.slice(0, 10) + "..."
496
+ );
497
+ case "object":
498
+ if (isArrayImpl(value)) return "[...]";
499
+ if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
500
+ return "client";
501
+ value = objectName(value);
502
+ return "Object" === value ? "{...}" : value;
503
+ case "function":
504
+ return value.$$typeof === CLIENT_REFERENCE_TAG
505
+ ? "client"
506
+ : (value = value.displayName || value.name)
507
+ ? "function " + value
508
+ : "function";
509
+ default:
510
+ return String(value);
511
+ }
512
+ }
513
+ function describeElementType(type) {
514
+ if ("string" === typeof type) return type;
515
+ switch (type) {
516
+ case REACT_SUSPENSE_TYPE:
517
+ return "Suspense";
518
+ case REACT_SUSPENSE_LIST_TYPE:
519
+ return "SuspenseList";
520
+ case REACT_VIEW_TRANSITION_TYPE:
521
+ return "ViewTransition";
522
+ }
523
+ if ("object" === typeof type)
524
+ switch (type.$$typeof) {
525
+ case REACT_FORWARD_REF_TYPE:
526
+ return describeElementType(type.render);
527
+ case REACT_MEMO_TYPE:
528
+ return describeElementType(type.type);
529
+ case REACT_LAZY_TYPE:
530
+ var payload = type._payload;
531
+ type = type._init;
532
+ try {
533
+ return describeElementType(type(payload));
534
+ } catch (x) {}
535
+ }
536
+ return "";
537
+ }
538
+ var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
539
+ function describeObjectForErrorMessage(objectOrArray, expandedName) {
540
+ var objKind = objectName(objectOrArray);
541
+ if ("Object" !== objKind && "Array" !== objKind) return objKind;
542
+ objKind = -1;
543
+ var length = 0;
544
+ if (isArrayImpl(objectOrArray)) {
545
+ var str = "[";
546
+ for (var i = 0; i < objectOrArray.length; i++) {
547
+ 0 < i && (str += ", ");
548
+ var value = objectOrArray[i];
549
+ value =
550
+ "object" === typeof value && null !== value
551
+ ? describeObjectForErrorMessage(value)
552
+ : describeValueForErrorMessage(value);
553
+ "" + i === expandedName
554
+ ? ((objKind = str.length), (length = value.length), (str += value))
555
+ : (str =
556
+ 10 > value.length && 40 > str.length + value.length
557
+ ? str + value
558
+ : str + "...");
559
+ }
560
+ str += "]";
561
+ } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
562
+ str = "<" + describeElementType(objectOrArray.type) + "/>";
563
+ else {
564
+ if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
565
+ str = "{";
566
+ i = Object.keys(objectOrArray);
567
+ for (value = 0; value < i.length; value++) {
568
+ 0 < value && (str += ", ");
569
+ var name = i[value],
570
+ encodedKey = JSON.stringify(name);
571
+ str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": ";
572
+ encodedKey = objectOrArray[name];
573
+ encodedKey =
574
+ "object" === typeof encodedKey && null !== encodedKey
575
+ ? describeObjectForErrorMessage(encodedKey)
576
+ : describeValueForErrorMessage(encodedKey);
577
+ name === expandedName
578
+ ? ((objKind = str.length),
579
+ (length = encodedKey.length),
580
+ (str += encodedKey))
581
+ : (str =
582
+ 10 > encodedKey.length && 40 > str.length + encodedKey.length
583
+ ? str + encodedKey
584
+ : str + "...");
585
+ }
586
+ str += "}";
587
+ }
588
+ return void 0 === expandedName
589
+ ? str
590
+ : -1 < objKind && 0 < length
591
+ ? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)),
592
+ "\n " + str + "\n " + objectOrArray)
593
+ : "\n " + str;
594
+ }
595
+ var ObjectPrototype = Object.prototype,
596
+ stringify = JSON.stringify,
597
+ TaintRegistryObjects = ReactSharedInternalsServer.TaintRegistryObjects,
598
+ TaintRegistryValues = ReactSharedInternalsServer.TaintRegistryValues,
599
+ TaintRegistryByteLengths =
600
+ ReactSharedInternalsServer.TaintRegistryByteLengths,
601
+ TaintRegistryPendingRequests =
602
+ ReactSharedInternalsServer.TaintRegistryPendingRequests;
603
+ function throwTaintViolation(message) {
604
+ throw Error(message);
605
+ }
606
+ function cleanupTaintQueue(request) {
607
+ request = request.taintCleanupQueue;
608
+ TaintRegistryPendingRequests.delete(request);
609
+ for (var i = 0; i < request.length; i++) {
610
+ var entryValue = request[i],
611
+ entry = TaintRegistryValues.get(entryValue);
612
+ void 0 !== entry &&
613
+ (1 === entry.count
614
+ ? TaintRegistryValues.delete(entryValue)
615
+ : entry.count--);
616
+ }
617
+ request.length = 0;
618
+ }
619
+ function defaultErrorHandler(error) {
620
+ console.error(error);
621
+ }
622
+ function defaultPostponeHandler() {}
623
+ function RequestInstance(
624
+ type,
625
+ model,
626
+ bundlerConfig,
627
+ onError,
628
+ identifierPrefix,
629
+ onPostpone,
630
+ temporaryReferences,
631
+ environmentName,
632
+ filterStackFrame,
633
+ onAllReady,
634
+ onFatalError
635
+ ) {
636
+ if (
637
+ null !== ReactSharedInternalsServer.A &&
638
+ ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
639
+ )
640
+ throw Error("Currently React only supports one RSC renderer at a time.");
641
+ ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
642
+ filterStackFrame = new Set();
643
+ environmentName = [];
644
+ var cleanupQueue = [];
645
+ TaintRegistryPendingRequests.add(cleanupQueue);
646
+ var hints = new Set();
647
+ this.type = type;
648
+ this.status = 10;
649
+ this.flushScheduled = !1;
650
+ this.destination = this.fatalError = null;
651
+ this.bundlerConfig = bundlerConfig;
652
+ this.cache = new Map();
653
+ this.pendingChunks = this.nextChunkId = 0;
654
+ this.hints = hints;
655
+ this.abortListeners = new Set();
656
+ this.abortableTasks = filterStackFrame;
657
+ this.pingedTasks = environmentName;
658
+ this.completedImportChunks = [];
659
+ this.completedHintChunks = [];
660
+ this.completedRegularChunks = [];
661
+ this.completedErrorChunks = [];
662
+ this.writtenSymbols = new Map();
663
+ this.writtenClientReferences = new Map();
664
+ this.writtenServerReferences = new Map();
665
+ this.writtenObjects = new WeakMap();
666
+ this.temporaryReferences = temporaryReferences;
667
+ this.identifierPrefix = identifierPrefix || "";
668
+ this.identifierCount = 1;
669
+ this.taintCleanupQueue = cleanupQueue;
670
+ this.onError = void 0 === onError ? defaultErrorHandler : onError;
671
+ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
672
+ this.onAllReady = onAllReady;
673
+ this.onFatalError = onFatalError;
674
+ type = createTask(this, model, null, !1, filterStackFrame);
675
+ environmentName.push(type);
676
+ }
677
+ function noop() {}
678
+ var currentRequest = null;
679
+ function resolveRequest() {
680
+ if (currentRequest) return currentRequest;
681
+ var store = requestStorage.getStore();
682
+ return store ? store : null;
683
+ }
684
+ function serializeThenable(request, task, thenable) {
685
+ var newTask = createTask(
686
+ request,
687
+ null,
688
+ task.keyPath,
689
+ task.implicitSlot,
690
+ request.abortableTasks
691
+ );
692
+ switch (thenable.status) {
693
+ case "fulfilled":
694
+ return (
695
+ (newTask.model = thenable.value), pingTask(request, newTask), newTask.id
696
+ );
697
+ case "rejected":
698
+ return erroredTask(request, newTask, thenable.reason), newTask.id;
699
+ default:
700
+ if (12 === request.status)
701
+ return (
702
+ request.abortableTasks.delete(newTask),
703
+ (newTask.status = 3),
704
+ 21 === request.type
705
+ ? request.pendingChunks--
706
+ : ((task = stringify(serializeByValueID(request.fatalError))),
707
+ emitModelChunk(request, newTask.id, task)),
708
+ newTask.id
709
+ );
710
+ "string" !== typeof thenable.status &&
711
+ ((thenable.status = "pending"),
712
+ thenable.then(
713
+ function (fulfilledValue) {
714
+ "pending" === thenable.status &&
715
+ ((thenable.status = "fulfilled"),
716
+ (thenable.value = fulfilledValue));
717
+ },
718
+ function (error) {
719
+ "pending" === thenable.status &&
720
+ ((thenable.status = "rejected"), (thenable.reason = error));
721
+ }
722
+ ));
723
+ }
724
+ thenable.then(
725
+ function (value) {
726
+ newTask.model = value;
727
+ pingTask(request, newTask);
728
+ },
729
+ function (reason) {
730
+ 0 === newTask.status &&
731
+ (erroredTask(request, newTask, reason), enqueueFlush(request));
732
+ }
733
+ );
734
+ return newTask.id;
735
+ }
736
+ function serializeReadableStream(request, task, stream) {
737
+ function progress(entry) {
738
+ if (!aborted)
739
+ if (entry.done)
740
+ (entry = streamTask.id.toString(16) + ":C\n"),
741
+ request.completedRegularChunks.push(entry),
742
+ enqueueFlush(request),
743
+ request.abortListeners.delete(abortStream),
744
+ callOnAllReadyIfReady(request),
745
+ (aborted = !0);
746
+ else
747
+ try {
748
+ (streamTask.model = entry.value),
749
+ request.pendingChunks++,
750
+ emitChunk(request, streamTask, streamTask.model),
751
+ enqueueFlush(request),
752
+ reader.read().then(progress, error);
753
+ } catch (x$7) {
754
+ error(x$7);
755
+ }
756
+ }
757
+ function error(reason) {
758
+ aborted ||
759
+ ((aborted = !0),
760
+ request.abortListeners.delete(abortStream),
761
+ erroredTask(request, streamTask, reason),
762
+ enqueueFlush(request),
763
+ reader.cancel(reason).then(error, error));
764
+ }
765
+ function abortStream(reason) {
766
+ aborted ||
767
+ ((aborted = !0),
768
+ request.abortListeners.delete(abortStream),
769
+ 21 === request.type
770
+ ? request.pendingChunks--
771
+ : (erroredTask(request, streamTask, reason), enqueueFlush(request)),
772
+ reader.cancel(reason).then(error, error));
773
+ }
774
+ var supportsBYOB = stream.supportsBYOB;
775
+ if (void 0 === supportsBYOB)
776
+ try {
777
+ stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0);
778
+ } catch (x) {
779
+ supportsBYOB = !1;
780
+ }
781
+ var reader = stream.getReader(),
782
+ streamTask = createTask(
783
+ request,
784
+ task.model,
785
+ task.keyPath,
786
+ task.implicitSlot,
787
+ request.abortableTasks
788
+ );
789
+ request.abortableTasks.delete(streamTask);
790
+ request.pendingChunks++;
791
+ task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
792
+ request.completedRegularChunks.push(task);
793
+ var aborted = !1;
794
+ request.abortListeners.add(abortStream);
795
+ reader.read().then(progress, error);
796
+ return serializeByValueID(streamTask.id);
797
+ }
798
+ function serializeAsyncIterable(request, task, iterable, iterator) {
799
+ function progress(entry) {
800
+ if (!aborted)
801
+ if (entry.done) {
802
+ if (void 0 === entry.value)
803
+ var endStreamRow = streamTask.id.toString(16) + ":C\n";
804
+ else
805
+ try {
806
+ var chunkId = outlineModel(request, entry.value);
807
+ endStreamRow =
808
+ streamTask.id.toString(16) +
809
+ ":C" +
810
+ stringify(serializeByValueID(chunkId)) +
811
+ "\n";
812
+ } catch (x) {
813
+ error(x);
814
+ return;
815
+ }
816
+ request.completedRegularChunks.push(endStreamRow);
817
+ enqueueFlush(request);
818
+ request.abortListeners.delete(abortIterable);
819
+ callOnAllReadyIfReady(request);
820
+ aborted = !0;
821
+ } else
822
+ try {
823
+ (streamTask.model = entry.value),
824
+ request.pendingChunks++,
825
+ emitChunk(request, streamTask, streamTask.model),
826
+ enqueueFlush(request),
827
+ iterator.next().then(progress, error);
828
+ } catch (x$8) {
829
+ error(x$8);
830
+ }
831
+ }
832
+ function error(reason) {
833
+ aborted ||
834
+ ((aborted = !0),
835
+ request.abortListeners.delete(abortIterable),
836
+ erroredTask(request, streamTask, reason),
837
+ enqueueFlush(request),
838
+ "function" === typeof iterator.throw &&
839
+ iterator.throw(reason).then(error, error));
840
+ }
841
+ function abortIterable(reason) {
842
+ aborted ||
843
+ ((aborted = !0),
844
+ request.abortListeners.delete(abortIterable),
845
+ 21 === request.type
846
+ ? request.pendingChunks--
847
+ : (erroredTask(request, streamTask, reason), enqueueFlush(request)),
848
+ "function" === typeof iterator.throw &&
849
+ iterator.throw(reason).then(error, error));
850
+ }
851
+ iterable = iterable === iterator;
852
+ var streamTask = createTask(
853
+ request,
854
+ task.model,
855
+ task.keyPath,
856
+ task.implicitSlot,
857
+ request.abortableTasks
858
+ );
859
+ request.abortableTasks.delete(streamTask);
860
+ request.pendingChunks++;
861
+ task = streamTask.id.toString(16) + ":" + (iterable ? "x" : "X") + "\n";
862
+ request.completedRegularChunks.push(task);
863
+ var aborted = !1;
864
+ request.abortListeners.add(abortIterable);
865
+ iterator.next().then(progress, error);
866
+ return serializeByValueID(streamTask.id);
867
+ }
868
+ function emitHint(request, code, model) {
869
+ model = stringify(model);
870
+ request.completedHintChunks.push(":H" + code + model + "\n");
871
+ enqueueFlush(request);
872
+ }
873
+ function readThenable(thenable) {
874
+ if ("fulfilled" === thenable.status) return thenable.value;
875
+ if ("rejected" === thenable.status) throw thenable.reason;
876
+ throw thenable;
877
+ }
878
+ function createLazyWrapperAroundWakeable(wakeable) {
879
+ switch (wakeable.status) {
880
+ case "fulfilled":
881
+ case "rejected":
882
+ break;
883
+ default:
884
+ "string" !== typeof wakeable.status &&
885
+ ((wakeable.status = "pending"),
886
+ wakeable.then(
887
+ function (fulfilledValue) {
888
+ "pending" === wakeable.status &&
889
+ ((wakeable.status = "fulfilled"),
890
+ (wakeable.value = fulfilledValue));
891
+ },
892
+ function (error) {
893
+ "pending" === wakeable.status &&
894
+ ((wakeable.status = "rejected"), (wakeable.reason = error));
895
+ }
896
+ ));
897
+ }
898
+ return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
899
+ }
900
+ function voidHandler() {}
901
+ function processServerComponentReturnValue(request, task, Component, result) {
902
+ if (
903
+ "object" !== typeof result ||
904
+ null === result ||
905
+ result.$$typeof === CLIENT_REFERENCE_TAG$1
906
+ )
907
+ return result;
908
+ if ("function" === typeof result.then)
909
+ return "fulfilled" === result.status
910
+ ? result.value
911
+ : createLazyWrapperAroundWakeable(result);
912
+ var iteratorFn = getIteratorFn(result);
913
+ return iteratorFn
914
+ ? ((request = {}),
915
+ (request[Symbol.iterator] = function () {
916
+ return iteratorFn.call(result);
917
+ }),
918
+ request)
919
+ : "function" !== typeof result[ASYNC_ITERATOR] ||
920
+ ("function" === typeof ReadableStream &&
921
+ result instanceof ReadableStream)
922
+ ? result
923
+ : ((request = {}),
924
+ (request[ASYNC_ITERATOR] = function () {
925
+ return result[ASYNC_ITERATOR]();
926
+ }),
927
+ request);
928
+ }
929
+ function renderFunctionComponent(request, task, key, Component, props) {
930
+ var prevThenableState = task.thenableState;
931
+ task.thenableState = null;
932
+ thenableIndexCounter = 0;
933
+ thenableState = prevThenableState;
934
+ props = Component(props, void 0);
935
+ if (12 === request.status)
936
+ throw (
937
+ ("object" === typeof props &&
938
+ null !== props &&
939
+ "function" === typeof props.then &&
940
+ props.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
941
+ props.then(voidHandler, voidHandler),
942
+ null)
943
+ );
944
+ props = processServerComponentReturnValue(request, task, Component, props);
945
+ Component = task.keyPath;
946
+ prevThenableState = task.implicitSlot;
947
+ null !== key
948
+ ? (task.keyPath = null === Component ? key : Component + "," + key)
949
+ : null === Component && (task.implicitSlot = !0);
950
+ request = renderModelDestructive(request, task, emptyRoot, "", props);
951
+ task.keyPath = Component;
952
+ task.implicitSlot = prevThenableState;
953
+ return request;
954
+ }
955
+ function renderFragment(request, task, children) {
956
+ return null !== task.keyPath
957
+ ? ((request = [
958
+ REACT_ELEMENT_TYPE,
959
+ REACT_FRAGMENT_TYPE,
960
+ task.keyPath,
961
+ { children: children }
962
+ ]),
963
+ task.implicitSlot ? [request] : request)
964
+ : children;
965
+ }
966
+ var serializedSize = 0;
967
+ function deferTask(request, task) {
968
+ task = createTask(
969
+ request,
970
+ task.model,
971
+ task.keyPath,
972
+ task.implicitSlot,
973
+ request.abortableTasks
974
+ );
975
+ pingTask(request, task);
976
+ return serializeLazyID(task.id);
977
+ }
978
+ function renderElement(request, task, type, key, ref, props) {
979
+ if (null !== ref && void 0 !== ref)
980
+ throw Error(
981
+ "Refs cannot be used in Server Components, nor passed to Client Components."
982
+ );
983
+ if (
984
+ "function" === typeof type &&
985
+ type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
986
+ type.$$typeof !== TEMPORARY_REFERENCE_TAG
987
+ )
988
+ return renderFunctionComponent(request, task, key, type, props);
989
+ if (type === REACT_FRAGMENT_TYPE && null === key)
990
+ return (
991
+ (type = task.implicitSlot),
992
+ null === task.keyPath && (task.implicitSlot = !0),
993
+ (props = renderModelDestructive(
994
+ request,
995
+ task,
996
+ emptyRoot,
997
+ "",
998
+ props.children
999
+ )),
1000
+ (task.implicitSlot = type),
1001
+ props
1002
+ );
1003
+ if (
1004
+ null != type &&
1005
+ "object" === typeof type &&
1006
+ type.$$typeof !== CLIENT_REFERENCE_TAG$1
1007
+ )
1008
+ switch (type.$$typeof) {
1009
+ case REACT_LAZY_TYPE:
1010
+ var init = type._init;
1011
+ type = init(type._payload);
1012
+ if (12 === request.status) throw null;
1013
+ return renderElement(request, task, type, key, ref, props);
1014
+ case REACT_FORWARD_REF_TYPE:
1015
+ return renderFunctionComponent(request, task, key, type.render, props);
1016
+ case REACT_MEMO_TYPE:
1017
+ return renderElement(request, task, type.type, key, ref, props);
1018
+ }
1019
+ request = key;
1020
+ key = task.keyPath;
1021
+ null === request
1022
+ ? (request = key)
1023
+ : null !== key && (request = key + "," + request);
1024
+ props = [REACT_ELEMENT_TYPE, type, request, props];
1025
+ task = task.implicitSlot && null !== request ? [props] : props;
1026
+ return task;
1027
+ }
1028
+ function pingTask(request, task) {
1029
+ var pingedTasks = request.pingedTasks;
1030
+ pingedTasks.push(task);
1031
+ 1 === pingedTasks.length &&
1032
+ ((request.flushScheduled = null !== request.destination),
1033
+ 21 === request.type || 10 === request.status
1034
+ ? scheduleMicrotask(function () {
1035
+ return performWork(request);
1036
+ })
1037
+ : setImmediate(function () {
1038
+ return performWork(request);
1039
+ }));
1040
+ }
1041
+ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1042
+ request.pendingChunks++;
1043
+ var id = request.nextChunkId++;
1044
+ "object" !== typeof model ||
1045
+ null === model ||
1046
+ null !== keyPath ||
1047
+ implicitSlot ||
1048
+ request.writtenObjects.set(model, serializeByValueID(id));
1049
+ var task = {
1050
+ id: id,
1051
+ status: 0,
1052
+ model: model,
1053
+ keyPath: keyPath,
1054
+ implicitSlot: implicitSlot,
1055
+ ping: function () {
1056
+ return pingTask(request, task);
1057
+ },
1058
+ toJSON: function (parentPropertyName, value) {
1059
+ var prevKeyPath = task.keyPath,
1060
+ prevImplicitSlot = task.implicitSlot;
1061
+ try {
1062
+ var JSCompiler_inline_result = renderModelDestructive(
1063
+ request,
1064
+ task,
1065
+ this,
1066
+ parentPropertyName,
1067
+ value
1068
+ );
1069
+ } catch (thrownValue) {
1070
+ if (
1071
+ ((parentPropertyName = task.model),
1072
+ (parentPropertyName =
1073
+ "object" === typeof parentPropertyName &&
1074
+ null !== parentPropertyName &&
1075
+ (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
1076
+ parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
1077
+ 12 === request.status)
1078
+ )
1079
+ (task.status = 3),
1080
+ 21 === request.type
1081
+ ? ((prevKeyPath = request.nextChunkId++),
1082
+ (prevKeyPath = parentPropertyName
1083
+ ? serializeLazyID(prevKeyPath)
1084
+ : serializeByValueID(prevKeyPath)),
1085
+ (JSCompiler_inline_result = prevKeyPath))
1086
+ : ((prevKeyPath = request.fatalError),
1087
+ (JSCompiler_inline_result = parentPropertyName
1088
+ ? serializeLazyID(prevKeyPath)
1089
+ : serializeByValueID(prevKeyPath)));
1090
+ else if (
1091
+ ((value =
1092
+ thrownValue === SuspenseException
1093
+ ? getSuspendedThenable()
1094
+ : thrownValue),
1095
+ "object" === typeof value &&
1096
+ null !== value &&
1097
+ "function" === typeof value.then)
1098
+ ) {
1099
+ JSCompiler_inline_result = createTask(
1100
+ request,
1101
+ task.model,
1102
+ task.keyPath,
1103
+ task.implicitSlot,
1104
+ request.abortableTasks
1105
+ );
1106
+ var ping = JSCompiler_inline_result.ping;
1107
+ value.then(ping, ping);
1108
+ JSCompiler_inline_result.thenableState =
1109
+ getThenableStateAfterSuspending();
1110
+ task.keyPath = prevKeyPath;
1111
+ task.implicitSlot = prevImplicitSlot;
1112
+ JSCompiler_inline_result = parentPropertyName
1113
+ ? serializeLazyID(JSCompiler_inline_result.id)
1114
+ : serializeByValueID(JSCompiler_inline_result.id);
1115
+ } else
1116
+ (task.keyPath = prevKeyPath),
1117
+ (task.implicitSlot = prevImplicitSlot),
1118
+ request.pendingChunks++,
1119
+ (prevKeyPath = request.nextChunkId++),
1120
+ "object" === typeof value &&
1121
+ null !== value &&
1122
+ value.$$typeof === REACT_POSTPONE_TYPE
1123
+ ? (logPostpone(request, value.message, task),
1124
+ emitPostponeChunk(request, prevKeyPath))
1125
+ : ((prevImplicitSlot = logRecoverableError(request, value, task)),
1126
+ emitErrorChunk(request, prevKeyPath, prevImplicitSlot)),
1127
+ (JSCompiler_inline_result = parentPropertyName
1128
+ ? serializeLazyID(prevKeyPath)
1129
+ : serializeByValueID(prevKeyPath));
1130
+ }
1131
+ return JSCompiler_inline_result;
1132
+ },
1133
+ thenableState: null
1134
+ };
1135
+ abortSet.add(task);
1136
+ return task;
1137
+ }
1138
+ function serializeByValueID(id) {
1139
+ return "$" + id.toString(16);
1140
+ }
1141
+ function serializeLazyID(id) {
1142
+ return "$L" + id.toString(16);
1143
+ }
1144
+ function encodeReferenceChunk(request, id, reference) {
1145
+ request = stringify(reference);
1146
+ return id.toString(16) + ":" + request + "\n";
1147
+ }
1148
+ function serializeClientReference(
1149
+ request,
1150
+ parent,
1151
+ parentPropertyName,
1152
+ clientReference
1153
+ ) {
1154
+ var clientReferenceKey = clientReference.$$id,
1155
+ writtenClientReferences = request.writtenClientReferences,
1156
+ existingId = writtenClientReferences.get(clientReferenceKey);
1157
+ if (void 0 !== existingId)
1158
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1159
+ ? serializeLazyID(existingId)
1160
+ : serializeByValueID(existingId);
1161
+ try {
1162
+ var baseURL = request.bundlerConfig,
1163
+ id = clientReference.$$id,
1164
+ idx = id.lastIndexOf("#"),
1165
+ exportName = id.slice(idx + 1),
1166
+ fullURL = id.slice(0, idx);
1167
+ if (!fullURL.startsWith(baseURL))
1168
+ throw Error("Attempted to load a Client Module outside the hosted root.");
1169
+ var JSCompiler_inline_result = [fullURL.slice(baseURL.length), exportName];
1170
+ request.pendingChunks++;
1171
+ var importId = request.nextChunkId++,
1172
+ json = stringify(JSCompiler_inline_result),
1173
+ processedChunk = importId.toString(16) + ":I" + json + "\n";
1174
+ request.completedImportChunks.push(processedChunk);
1175
+ writtenClientReferences.set(clientReferenceKey, importId);
1176
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1177
+ ? serializeLazyID(importId)
1178
+ : serializeByValueID(importId);
1179
+ } catch (x) {
1180
+ return (
1181
+ request.pendingChunks++,
1182
+ (parent = request.nextChunkId++),
1183
+ (parentPropertyName = logRecoverableError(request, x, null)),
1184
+ emitErrorChunk(request, parent, parentPropertyName),
1185
+ serializeByValueID(parent)
1186
+ );
1187
+ }
1188
+ }
1189
+ function outlineModel(request, value) {
1190
+ value = createTask(request, value, null, !1, request.abortableTasks);
1191
+ retryTask(request, value);
1192
+ return value.id;
1193
+ }
1194
+ function serializeTypedArray(request, tag, typedArray) {
1195
+ request.pendingChunks++;
1196
+ var bufferId = request.nextChunkId++;
1197
+ emitTypedArrayChunk(request, bufferId, tag, typedArray);
1198
+ return serializeByValueID(bufferId);
1199
+ }
1200
+ function serializeBlob(request, blob) {
1201
+ function progress(entry) {
1202
+ if (!aborted)
1203
+ if (entry.done)
1204
+ request.abortListeners.delete(abortBlob),
1205
+ (aborted = !0),
1206
+ pingTask(request, newTask);
1207
+ else
1208
+ return (
1209
+ model.push(entry.value), reader.read().then(progress).catch(error)
1210
+ );
1211
+ }
1212
+ function error(reason) {
1213
+ aborted ||
1214
+ ((aborted = !0),
1215
+ request.abortListeners.delete(abortBlob),
1216
+ erroredTask(request, newTask, reason),
1217
+ enqueueFlush(request),
1218
+ reader.cancel(reason).then(error, error));
1219
+ }
1220
+ function abortBlob(reason) {
1221
+ aborted ||
1222
+ ((aborted = !0),
1223
+ request.abortListeners.delete(abortBlob),
1224
+ 21 === request.type
1225
+ ? request.pendingChunks--
1226
+ : (erroredTask(request, newTask, reason), enqueueFlush(request)),
1227
+ reader.cancel(reason).then(error, error));
1228
+ }
1229
+ var model = [blob.type],
1230
+ newTask = createTask(request, model, null, !1, request.abortableTasks),
1231
+ reader = blob.stream().getReader(),
1232
+ aborted = !1;
1233
+ request.abortListeners.add(abortBlob);
1234
+ reader.read().then(progress).catch(error);
1235
+ return "$B" + newTask.id.toString(16);
1236
+ }
1237
+ var modelRoot = !1;
1238
+ function renderModelDestructive(
1239
+ request,
1240
+ task,
1241
+ parent,
1242
+ parentPropertyName,
1243
+ value
1244
+ ) {
1245
+ task.model = value;
1246
+ serializedSize += parentPropertyName.length;
1247
+ if (value === REACT_ELEMENT_TYPE) return "$";
1248
+ if (null === value) return null;
1249
+ if ("object" === typeof value) {
1250
+ switch (value.$$typeof) {
1251
+ case REACT_ELEMENT_TYPE:
1252
+ var elementReference = null,
1253
+ writtenObjects = request.writtenObjects;
1254
+ if (null === task.keyPath && !task.implicitSlot) {
1255
+ var existingReference = writtenObjects.get(value);
1256
+ if (void 0 !== existingReference)
1257
+ if (modelRoot === value) modelRoot = null;
1258
+ else return existingReference;
1259
+ else
1260
+ -1 === parentPropertyName.indexOf(":") &&
1261
+ ((parent = writtenObjects.get(parent)),
1262
+ void 0 !== parent &&
1263
+ ((elementReference = parent + ":" + parentPropertyName),
1264
+ writtenObjects.set(value, elementReference)));
1265
+ }
1266
+ if (3200 < serializedSize) return deferTask(request, task);
1267
+ parentPropertyName = value.props;
1268
+ parent = parentPropertyName.ref;
1269
+ value = renderElement(
1270
+ request,
1271
+ task,
1272
+ value.type,
1273
+ value.key,
1274
+ void 0 !== parent ? parent : null,
1275
+ parentPropertyName
1276
+ );
1277
+ "object" === typeof value &&
1278
+ null !== value &&
1279
+ null !== elementReference &&
1280
+ (writtenObjects.has(value) ||
1281
+ writtenObjects.set(value, elementReference));
1282
+ return value;
1283
+ case REACT_LAZY_TYPE:
1284
+ if (3200 < serializedSize) return deferTask(request, task);
1285
+ task.thenableState = null;
1286
+ parentPropertyName = value._init;
1287
+ value = parentPropertyName(value._payload);
1288
+ if (12 === request.status) throw null;
1289
+ return renderModelDestructive(request, task, emptyRoot, "", value);
1290
+ case REACT_LEGACY_ELEMENT_TYPE:
1291
+ throw Error(
1292
+ 'A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the "react" package is used.\n- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n- A compiler tries to "inline" JSX instead of using the runtime.'
1293
+ );
1294
+ }
1295
+ if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1296
+ return serializeClientReference(
1297
+ request,
1298
+ parent,
1299
+ parentPropertyName,
1300
+ value
1301
+ );
1302
+ if (
1303
+ void 0 !== request.temporaryReferences &&
1304
+ ((elementReference = request.temporaryReferences.get(value)),
1305
+ void 0 !== elementReference)
1306
+ )
1307
+ return "$T" + elementReference;
1308
+ elementReference = TaintRegistryObjects.get(value);
1309
+ void 0 !== elementReference && throwTaintViolation(elementReference);
1310
+ elementReference = request.writtenObjects;
1311
+ writtenObjects = elementReference.get(value);
1312
+ if ("function" === typeof value.then) {
1313
+ if (void 0 !== writtenObjects) {
1314
+ if (null !== task.keyPath || task.implicitSlot)
1315
+ return "$@" + serializeThenable(request, task, value).toString(16);
1316
+ if (modelRoot === value) modelRoot = null;
1317
+ else return writtenObjects;
1318
+ }
1319
+ request = "$@" + serializeThenable(request, task, value).toString(16);
1320
+ elementReference.set(value, request);
1321
+ return request;
1322
+ }
1323
+ if (void 0 !== writtenObjects)
1324
+ if (modelRoot === value) modelRoot = null;
1325
+ else return writtenObjects;
1326
+ else if (
1327
+ -1 === parentPropertyName.indexOf(":") &&
1328
+ ((writtenObjects = elementReference.get(parent)),
1329
+ void 0 !== writtenObjects)
1330
+ ) {
1331
+ existingReference = parentPropertyName;
1332
+ if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1333
+ switch (parentPropertyName) {
1334
+ case "1":
1335
+ existingReference = "type";
1336
+ break;
1337
+ case "2":
1338
+ existingReference = "key";
1339
+ break;
1340
+ case "3":
1341
+ existingReference = "props";
1342
+ break;
1343
+ case "4":
1344
+ existingReference = "_owner";
1345
+ }
1346
+ elementReference.set(value, writtenObjects + ":" + existingReference);
1347
+ }
1348
+ if (isArrayImpl(value)) return renderFragment(request, task, value);
1349
+ if (value instanceof Map)
1350
+ return (
1351
+ (value = Array.from(value)),
1352
+ "$Q" + outlineModel(request, value).toString(16)
1353
+ );
1354
+ if (value instanceof Set)
1355
+ return (
1356
+ (value = Array.from(value)),
1357
+ "$W" + outlineModel(request, value).toString(16)
1358
+ );
1359
+ if ("function" === typeof FormData && value instanceof FormData)
1360
+ return (
1361
+ (value = Array.from(value.entries())),
1362
+ "$K" + outlineModel(request, value).toString(16)
1363
+ );
1364
+ if (value instanceof Error) return "$Z";
1365
+ if (value instanceof ArrayBuffer)
1366
+ return serializeTypedArray(request, "A", new Uint8Array(value));
1367
+ if (value instanceof Int8Array)
1368
+ return serializeTypedArray(request, "O", value);
1369
+ if (value instanceof Uint8Array)
1370
+ return serializeTypedArray(request, "o", value);
1371
+ if (value instanceof Uint8ClampedArray)
1372
+ return serializeTypedArray(request, "U", value);
1373
+ if (value instanceof Int16Array)
1374
+ return serializeTypedArray(request, "S", value);
1375
+ if (value instanceof Uint16Array)
1376
+ return serializeTypedArray(request, "s", value);
1377
+ if (value instanceof Int32Array)
1378
+ return serializeTypedArray(request, "L", value);
1379
+ if (value instanceof Uint32Array)
1380
+ return serializeTypedArray(request, "l", value);
1381
+ if (value instanceof Float32Array)
1382
+ return serializeTypedArray(request, "G", value);
1383
+ if (value instanceof Float64Array)
1384
+ return serializeTypedArray(request, "g", value);
1385
+ if (value instanceof BigInt64Array)
1386
+ return serializeTypedArray(request, "M", value);
1387
+ if (value instanceof BigUint64Array)
1388
+ return serializeTypedArray(request, "m", value);
1389
+ if (value instanceof DataView)
1390
+ return serializeTypedArray(request, "V", value);
1391
+ if ("function" === typeof Blob && value instanceof Blob)
1392
+ return serializeBlob(request, value);
1393
+ if ((elementReference = getIteratorFn(value)))
1394
+ return (
1395
+ (parentPropertyName = elementReference.call(value)),
1396
+ parentPropertyName === value
1397
+ ? "$i" +
1398
+ outlineModel(request, Array.from(parentPropertyName)).toString(16)
1399
+ : renderFragment(request, task, Array.from(parentPropertyName))
1400
+ );
1401
+ if ("function" === typeof ReadableStream && value instanceof ReadableStream)
1402
+ return serializeReadableStream(request, task, value);
1403
+ elementReference = value[ASYNC_ITERATOR];
1404
+ if ("function" === typeof elementReference)
1405
+ return (
1406
+ null !== task.keyPath
1407
+ ? ((value = [
1408
+ REACT_ELEMENT_TYPE,
1409
+ REACT_FRAGMENT_TYPE,
1410
+ task.keyPath,
1411
+ { children: value }
1412
+ ]),
1413
+ (value = task.implicitSlot ? [value] : value))
1414
+ : ((parentPropertyName = elementReference.call(value)),
1415
+ (value = serializeAsyncIterable(
1416
+ request,
1417
+ task,
1418
+ value,
1419
+ parentPropertyName
1420
+ ))),
1421
+ value
1422
+ );
1423
+ if (value instanceof Date) return "$D" + value.toJSON();
1424
+ request = getPrototypeOf(value);
1425
+ if (
1426
+ request !== ObjectPrototype &&
1427
+ (null === request || null !== getPrototypeOf(request))
1428
+ )
1429
+ throw Error(
1430
+ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." +
1431
+ describeObjectForErrorMessage(parent, parentPropertyName)
1432
+ );
1433
+ return value;
1434
+ }
1435
+ if ("string" === typeof value) {
1436
+ task = TaintRegistryValues.get(value);
1437
+ void 0 !== task && throwTaintViolation(task.message);
1438
+ serializedSize += value.length;
1439
+ if (
1440
+ "Z" === value[value.length - 1] &&
1441
+ parent[parentPropertyName] instanceof Date
1442
+ )
1443
+ return "$D" + value;
1444
+ if (1024 <= value.length && null !== byteLengthOfChunk)
1445
+ return (
1446
+ request.pendingChunks++,
1447
+ (task = request.nextChunkId++),
1448
+ emitTextChunk(request, task, value),
1449
+ serializeByValueID(task)
1450
+ );
1451
+ value = "$" === value[0] ? "$" + value : value;
1452
+ return value;
1453
+ }
1454
+ if ("boolean" === typeof value) return value;
1455
+ if ("number" === typeof value)
1456
+ return Number.isFinite(value)
1457
+ ? 0 === value && -Infinity === 1 / value
1458
+ ? "$-0"
1459
+ : value
1460
+ : Infinity === value
1461
+ ? "$Infinity"
1462
+ : -Infinity === value
1463
+ ? "$-Infinity"
1464
+ : "$NaN";
1465
+ if ("undefined" === typeof value) return "$undefined";
1466
+ if ("function" === typeof value) {
1467
+ if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1468
+ return serializeClientReference(
1469
+ request,
1470
+ parent,
1471
+ parentPropertyName,
1472
+ value
1473
+ );
1474
+ if (value.$$typeof === SERVER_REFERENCE_TAG)
1475
+ return (
1476
+ (task = request.writtenServerReferences),
1477
+ (parentPropertyName = task.get(value)),
1478
+ void 0 !== parentPropertyName
1479
+ ? (value = "$F" + parentPropertyName.toString(16))
1480
+ : ((parentPropertyName = value.$$bound),
1481
+ (parentPropertyName =
1482
+ null === parentPropertyName
1483
+ ? null
1484
+ : Promise.resolve(parentPropertyName)),
1485
+ (request = outlineModel(request, {
1486
+ id: value.$$id,
1487
+ bound: parentPropertyName
1488
+ })),
1489
+ task.set(value, request),
1490
+ (value = "$F" + request.toString(16))),
1491
+ value
1492
+ );
1493
+ if (
1494
+ void 0 !== request.temporaryReferences &&
1495
+ ((request = request.temporaryReferences.get(value)), void 0 !== request)
1496
+ )
1497
+ return "$T" + request;
1498
+ request = TaintRegistryObjects.get(value);
1499
+ void 0 !== request && throwTaintViolation(request);
1500
+ if (value.$$typeof === TEMPORARY_REFERENCE_TAG)
1501
+ throw Error(
1502
+ "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
1503
+ );
1504
+ if (/^on[A-Z]/.test(parentPropertyName))
1505
+ throw Error(
1506
+ "Event handlers cannot be passed to Client Component props." +
1507
+ describeObjectForErrorMessage(parent, parentPropertyName) +
1508
+ "\nIf you need interactivity, consider converting part of this to a Client Component."
1509
+ );
1510
+ throw Error(
1511
+ '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.' +
1512
+ describeObjectForErrorMessage(parent, parentPropertyName)
1513
+ );
1514
+ }
1515
+ if ("symbol" === typeof value) {
1516
+ task = request.writtenSymbols;
1517
+ elementReference = task.get(value);
1518
+ if (void 0 !== elementReference)
1519
+ return serializeByValueID(elementReference);
1520
+ elementReference = value.description;
1521
+ if (Symbol.for(elementReference) !== value)
1522
+ throw Error(
1523
+ "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1524
+ (value.description + ") cannot be found among global symbols.") +
1525
+ describeObjectForErrorMessage(parent, parentPropertyName)
1526
+ );
1527
+ request.pendingChunks++;
1528
+ parentPropertyName = request.nextChunkId++;
1529
+ parent = encodeReferenceChunk(
1530
+ request,
1531
+ parentPropertyName,
1532
+ "$S" + elementReference
1533
+ );
1534
+ request.completedImportChunks.push(parent);
1535
+ task.set(value, parentPropertyName);
1536
+ return serializeByValueID(parentPropertyName);
1537
+ }
1538
+ if ("bigint" === typeof value)
1539
+ return (
1540
+ (request = TaintRegistryValues.get(value)),
1541
+ void 0 !== request && throwTaintViolation(request.message),
1542
+ "$n" + value.toString(10)
1543
+ );
1544
+ throw Error(
1545
+ "Type " +
1546
+ typeof value +
1547
+ " is not supported in Client Component props." +
1548
+ describeObjectForErrorMessage(parent, parentPropertyName)
1549
+ );
1550
+ }
1551
+ function logPostpone(request, reason) {
1552
+ var prevRequest = currentRequest;
1553
+ currentRequest = null;
1554
+ try {
1555
+ requestStorage.run(void 0, request.onPostpone, reason);
1556
+ } finally {
1557
+ currentRequest = prevRequest;
1558
+ }
1559
+ }
1560
+ function logRecoverableError(request, error) {
1561
+ var prevRequest = currentRequest;
1562
+ currentRequest = null;
1563
+ try {
1564
+ var errorDigest = requestStorage.run(void 0, request.onError, error);
1565
+ } finally {
1566
+ currentRequest = prevRequest;
1567
+ }
1568
+ if (null != errorDigest && "string" !== typeof errorDigest)
1569
+ throw Error(
1570
+ '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 "' +
1571
+ typeof errorDigest +
1572
+ '" instead'
1573
+ );
1574
+ return errorDigest || "";
1575
+ }
1576
+ function fatalError(request, error) {
1577
+ var onFatalError = request.onFatalError;
1578
+ onFatalError(error);
1579
+ cleanupTaintQueue(request);
1580
+ null !== request.destination
1581
+ ? ((request.status = 14), request.destination.destroy(error))
1582
+ : ((request.status = 13), (request.fatalError = error));
1583
+ }
1584
+ function emitPostponeChunk(request, id) {
1585
+ id = id.toString(16) + ":P\n";
1586
+ request.completedErrorChunks.push(id);
1587
+ }
1588
+ function emitErrorChunk(request, id, digest) {
1589
+ digest = { digest: digest };
1590
+ id = id.toString(16) + ":E" + stringify(digest) + "\n";
1591
+ request.completedErrorChunks.push(id);
1592
+ }
1593
+ function emitModelChunk(request, id, json) {
1594
+ id = id.toString(16) + ":" + json + "\n";
1595
+ request.completedRegularChunks.push(id);
1596
+ }
1597
+ function emitTypedArrayChunk(request, id, tag, typedArray) {
1598
+ if (TaintRegistryByteLengths.has(typedArray.byteLength)) {
1599
+ var tainted = TaintRegistryValues.get(
1600
+ String.fromCharCode.apply(
1601
+ String,
1602
+ new Uint8Array(
1603
+ typedArray.buffer,
1604
+ typedArray.byteOffset,
1605
+ typedArray.byteLength
1606
+ )
1607
+ )
1608
+ );
1609
+ void 0 !== tainted && throwTaintViolation(tainted.message);
1610
+ }
1611
+ request.pendingChunks++;
1612
+ typedArray = new Uint8Array(
1613
+ typedArray.buffer,
1614
+ typedArray.byteOffset,
1615
+ typedArray.byteLength
1616
+ );
1617
+ tainted = typedArray.byteLength;
1618
+ id = id.toString(16) + ":" + tag + tainted.toString(16) + ",";
1619
+ request.completedRegularChunks.push(id, typedArray);
1620
+ }
1621
+ function emitTextChunk(request, id, text) {
1622
+ if (null === byteLengthOfChunk)
1623
+ throw Error(
1624
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1625
+ );
1626
+ request.pendingChunks++;
1627
+ var binaryLength = byteLengthOfChunk(text);
1628
+ id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1629
+ request.completedRegularChunks.push(id, text);
1630
+ }
1631
+ function emitChunk(request, task, value) {
1632
+ var id = task.id;
1633
+ if ("string" === typeof value && null !== byteLengthOfChunk)
1634
+ (task = TaintRegistryValues.get(value)),
1635
+ void 0 !== task && throwTaintViolation(task.message),
1636
+ emitTextChunk(request, id, value);
1637
+ else if (value instanceof ArrayBuffer)
1638
+ emitTypedArrayChunk(request, id, "A", new Uint8Array(value));
1639
+ else if (value instanceof Int8Array)
1640
+ emitTypedArrayChunk(request, id, "O", value);
1641
+ else if (value instanceof Uint8Array)
1642
+ emitTypedArrayChunk(request, id, "o", value);
1643
+ else if (value instanceof Uint8ClampedArray)
1644
+ emitTypedArrayChunk(request, id, "U", value);
1645
+ else if (value instanceof Int16Array)
1646
+ emitTypedArrayChunk(request, id, "S", value);
1647
+ else if (value instanceof Uint16Array)
1648
+ emitTypedArrayChunk(request, id, "s", value);
1649
+ else if (value instanceof Int32Array)
1650
+ emitTypedArrayChunk(request, id, "L", value);
1651
+ else if (value instanceof Uint32Array)
1652
+ emitTypedArrayChunk(request, id, "l", value);
1653
+ else if (value instanceof Float32Array)
1654
+ emitTypedArrayChunk(request, id, "G", value);
1655
+ else if (value instanceof Float64Array)
1656
+ emitTypedArrayChunk(request, id, "g", value);
1657
+ else if (value instanceof BigInt64Array)
1658
+ emitTypedArrayChunk(request, id, "M", value);
1659
+ else if (value instanceof BigUint64Array)
1660
+ emitTypedArrayChunk(request, id, "m", value);
1661
+ else if (value instanceof DataView)
1662
+ emitTypedArrayChunk(request, id, "V", value);
1663
+ else {
1664
+ id = serializedSize;
1665
+ try {
1666
+ var json = stringify(value, task.toJSON);
1667
+ emitModelChunk(request, task.id, json);
1668
+ } finally {
1669
+ serializedSize = id;
1670
+ }
1671
+ }
1672
+ }
1673
+ function erroredTask(request, task, error) {
1674
+ task.status = 4;
1675
+ "object" === typeof error &&
1676
+ null !== error &&
1677
+ error.$$typeof === REACT_POSTPONE_TYPE
1678
+ ? (logPostpone(request, error.message, task),
1679
+ emitPostponeChunk(request, task.id))
1680
+ : ((error = logRecoverableError(request, error, task)),
1681
+ emitErrorChunk(request, task.id, error));
1682
+ request.abortableTasks.delete(task);
1683
+ callOnAllReadyIfReady(request);
1684
+ }
1685
+ var emptyRoot = {};
1686
+ function retryTask(request, task) {
1687
+ if (0 === task.status) {
1688
+ task.status = 5;
1689
+ try {
1690
+ modelRoot = task.model;
1691
+ var resolvedModel = renderModelDestructive(
1692
+ request,
1693
+ task,
1694
+ emptyRoot,
1695
+ "",
1696
+ task.model
1697
+ );
1698
+ modelRoot = resolvedModel;
1699
+ task.keyPath = null;
1700
+ task.implicitSlot = !1;
1701
+ if ("object" === typeof resolvedModel && null !== resolvedModel)
1702
+ request.writtenObjects.set(resolvedModel, serializeByValueID(task.id)),
1703
+ emitChunk(request, task, resolvedModel);
1704
+ else {
1705
+ var json = stringify(resolvedModel);
1706
+ emitModelChunk(request, task.id, json);
1707
+ }
1708
+ task.status = 1;
1709
+ request.abortableTasks.delete(task);
1710
+ callOnAllReadyIfReady(request);
1711
+ } catch (thrownValue) {
1712
+ if (12 === request.status)
1713
+ if (
1714
+ (request.abortableTasks.delete(task),
1715
+ (task.status = 3),
1716
+ 21 === request.type)
1717
+ )
1718
+ request.pendingChunks--;
1719
+ else {
1720
+ var model = stringify(serializeByValueID(request.fatalError));
1721
+ emitModelChunk(request, task.id, model);
1722
+ }
1723
+ else {
1724
+ var x =
1725
+ thrownValue === SuspenseException
1726
+ ? getSuspendedThenable()
1727
+ : thrownValue;
1728
+ if (
1729
+ "object" === typeof x &&
1730
+ null !== x &&
1731
+ "function" === typeof x.then
1732
+ ) {
1733
+ task.status = 0;
1734
+ task.thenableState = getThenableStateAfterSuspending();
1735
+ var ping = task.ping;
1736
+ x.then(ping, ping);
1737
+ } else erroredTask(request, task, x);
1738
+ }
1739
+ } finally {
1740
+ }
1741
+ }
1742
+ }
1743
+ function performWork(request) {
1744
+ var prevDispatcher = ReactSharedInternalsServer.H;
1745
+ ReactSharedInternalsServer.H = HooksDispatcher;
1746
+ var prevRequest = currentRequest;
1747
+ currentRequest$1 = currentRequest = request;
1748
+ try {
1749
+ var pingedTasks = request.pingedTasks;
1750
+ request.pingedTasks = [];
1751
+ for (var i = 0; i < pingedTasks.length; i++)
1752
+ retryTask(request, pingedTasks[i]);
1753
+ null !== request.destination &&
1754
+ flushCompletedChunks(request, request.destination);
1755
+ } catch (error) {
1756
+ logRecoverableError(request, error, null), fatalError(request, error);
1757
+ } finally {
1758
+ (ReactSharedInternalsServer.H = prevDispatcher),
1759
+ (currentRequest$1 = null),
1760
+ (currentRequest = prevRequest);
1761
+ }
1762
+ }
1763
+ function abortTask(task, request, errorId) {
1764
+ 5 !== task.status &&
1765
+ ((task.status = 3),
1766
+ (errorId = serializeByValueID(errorId)),
1767
+ (task = encodeReferenceChunk(request, task.id, errorId)),
1768
+ request.completedErrorChunks.push(task));
1769
+ }
1770
+ function flushCompletedChunks(request, destination) {
1771
+ currentView = new Uint8Array(2048);
1772
+ writtenBytes = 0;
1773
+ destinationHasCapacity = !0;
1774
+ try {
1775
+ for (
1776
+ var importsChunks = request.completedImportChunks, i = 0;
1777
+ i < importsChunks.length;
1778
+ i++
1779
+ )
1780
+ if (
1781
+ (request.pendingChunks--,
1782
+ !writeChunkAndReturn(destination, importsChunks[i]))
1783
+ ) {
1784
+ request.destination = null;
1785
+ i++;
1786
+ break;
1787
+ }
1788
+ importsChunks.splice(0, i);
1789
+ var hintChunks = request.completedHintChunks;
1790
+ for (i = 0; i < hintChunks.length; i++)
1791
+ if (!writeChunkAndReturn(destination, hintChunks[i])) {
1792
+ request.destination = null;
1793
+ i++;
1794
+ break;
1795
+ }
1796
+ hintChunks.splice(0, i);
1797
+ var regularChunks = request.completedRegularChunks;
1798
+ for (i = 0; i < regularChunks.length; i++)
1799
+ if (
1800
+ (request.pendingChunks--,
1801
+ !writeChunkAndReturn(destination, regularChunks[i]))
1802
+ ) {
1803
+ request.destination = null;
1804
+ i++;
1805
+ break;
1806
+ }
1807
+ regularChunks.splice(0, i);
1808
+ var errorChunks = request.completedErrorChunks;
1809
+ for (i = 0; i < errorChunks.length; i++)
1810
+ if (
1811
+ (request.pendingChunks--,
1812
+ !writeChunkAndReturn(destination, errorChunks[i]))
1813
+ ) {
1814
+ request.destination = null;
1815
+ i++;
1816
+ break;
1817
+ }
1818
+ errorChunks.splice(0, i);
1819
+ } finally {
1820
+ (request.flushScheduled = !1),
1821
+ currentView &&
1822
+ 0 < writtenBytes &&
1823
+ destination.write(currentView.subarray(0, writtenBytes)),
1824
+ (currentView = null),
1825
+ (writtenBytes = 0),
1826
+ (destinationHasCapacity = !0);
1827
+ }
1828
+ "function" === typeof destination.flush && destination.flush();
1829
+ 0 === request.pendingChunks &&
1830
+ (cleanupTaintQueue(request),
1831
+ (request.status = 14),
1832
+ destination.end(),
1833
+ (request.destination = null));
1834
+ }
1835
+ function startWork(request) {
1836
+ request.flushScheduled = null !== request.destination;
1837
+ scheduleMicrotask(function () {
1838
+ requestStorage.run(request, performWork, request);
1839
+ });
1840
+ setImmediate(function () {
1841
+ 10 === request.status && (request.status = 11);
1842
+ });
1843
+ }
1844
+ function enqueueFlush(request) {
1845
+ !1 === request.flushScheduled &&
1846
+ 0 === request.pingedTasks.length &&
1847
+ null !== request.destination &&
1848
+ ((request.flushScheduled = !0),
1849
+ setImmediate(function () {
1850
+ request.flushScheduled = !1;
1851
+ var destination = request.destination;
1852
+ destination && flushCompletedChunks(request, destination);
1853
+ }));
1854
+ }
1855
+ function callOnAllReadyIfReady(request) {
1856
+ if (0 === request.abortableTasks.size && 0 === request.abortListeners.size)
1857
+ request.onAllReady();
1858
+ }
1859
+ function startFlowing(request, destination) {
1860
+ if (13 === request.status)
1861
+ (request.status = 14), destination.destroy(request.fatalError);
1862
+ else if (14 !== request.status && null === request.destination) {
1863
+ request.destination = destination;
1864
+ try {
1865
+ flushCompletedChunks(request, destination);
1866
+ } catch (error) {
1867
+ logRecoverableError(request, error, null), fatalError(request, error);
1868
+ }
1869
+ }
1870
+ }
1871
+ function abort(request, reason) {
1872
+ try {
1873
+ 11 >= request.status && (request.status = 12);
1874
+ var abortableTasks = request.abortableTasks;
1875
+ if (0 < abortableTasks.size) {
1876
+ if (21 === request.type)
1877
+ abortableTasks.forEach(function (task) {
1878
+ 5 !== task.status && ((task.status = 3), request.pendingChunks--);
1879
+ });
1880
+ else if (
1881
+ "object" === typeof reason &&
1882
+ null !== reason &&
1883
+ reason.$$typeof === REACT_POSTPONE_TYPE
1884
+ ) {
1885
+ logPostpone(request, reason.message, null);
1886
+ var errorId = request.nextChunkId++;
1887
+ request.fatalError = errorId;
1888
+ request.pendingChunks++;
1889
+ emitPostponeChunk(request, errorId, reason);
1890
+ abortableTasks.forEach(function (task) {
1891
+ return abortTask(task, request, errorId);
1892
+ });
1893
+ } else {
1894
+ var error =
1895
+ void 0 === reason
1896
+ ? Error("The render was aborted by the server without a reason.")
1897
+ : "object" === typeof reason &&
1898
+ null !== reason &&
1899
+ "function" === typeof reason.then
1900
+ ? Error("The render was aborted by the server with a promise.")
1901
+ : reason,
1902
+ digest = logRecoverableError(request, error, null),
1903
+ errorId$25 = request.nextChunkId++;
1904
+ request.fatalError = errorId$25;
1905
+ request.pendingChunks++;
1906
+ emitErrorChunk(request, errorId$25, digest, error);
1907
+ abortableTasks.forEach(function (task) {
1908
+ return abortTask(task, request, errorId$25);
1909
+ });
1910
+ }
1911
+ abortableTasks.clear();
1912
+ callOnAllReadyIfReady(request);
1913
+ }
1914
+ var abortListeners = request.abortListeners;
1915
+ if (0 < abortListeners.size) {
1916
+ var error$26 =
1917
+ "object" === typeof reason &&
1918
+ null !== reason &&
1919
+ reason.$$typeof === REACT_POSTPONE_TYPE
1920
+ ? Error("The render was aborted due to being postponed.")
1921
+ : void 0 === reason
1922
+ ? Error("The render was aborted by the server without a reason.")
1923
+ : "object" === typeof reason &&
1924
+ null !== reason &&
1925
+ "function" === typeof reason.then
1926
+ ? Error("The render was aborted by the server with a promise.")
1927
+ : reason;
1928
+ abortListeners.forEach(function (callback) {
1929
+ return callback(error$26);
1930
+ });
1931
+ abortListeners.clear();
1932
+ callOnAllReadyIfReady(request);
1933
+ }
1934
+ null !== request.destination &&
1935
+ flushCompletedChunks(request, request.destination);
1936
+ } catch (error$27) {
1937
+ logRecoverableError(request, error$27, null), fatalError(request, error$27);
1938
+ }
1939
+ }
1940
+ function resolveServerReference(config, id) {
1941
+ var idx = id.lastIndexOf("#"),
1942
+ exportName = id.slice(idx + 1);
1943
+ id = id.slice(0, idx);
1944
+ if (!id.startsWith(config))
1945
+ throw Error(
1946
+ "Attempted to load a Server Reference outside the hosted root."
1947
+ );
1948
+ return { specifier: id, name: exportName };
1949
+ }
1950
+ var asyncModuleCache = new Map();
1951
+ function preloadModule(metadata) {
1952
+ var existingPromise = asyncModuleCache.get(metadata.specifier);
1953
+ if (existingPromise)
1954
+ return "fulfilled" === existingPromise.status ? null : existingPromise;
1955
+ var modulePromise = import(metadata.specifier);
1956
+ modulePromise.then(
1957
+ function (value) {
1958
+ modulePromise.status = "fulfilled";
1959
+ modulePromise.value = value;
1960
+ },
1961
+ function (reason) {
1962
+ modulePromise.status = "rejected";
1963
+ modulePromise.reason = reason;
1964
+ }
1965
+ );
1966
+ asyncModuleCache.set(metadata.specifier, modulePromise);
1967
+ return modulePromise;
1968
+ }
1969
+ function requireModule(metadata) {
1970
+ var moduleExports = asyncModuleCache.get(metadata.specifier);
1971
+ if ("fulfilled" === moduleExports.status) moduleExports = moduleExports.value;
1972
+ else throw moduleExports.reason;
1973
+ return moduleExports[metadata.name];
1974
+ }
1975
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1976
+ function Chunk(status, value, reason, response) {
1977
+ this.status = status;
1978
+ this.value = value;
1979
+ this.reason = reason;
1980
+ this._response = response;
1981
+ }
1982
+ Chunk.prototype = Object.create(Promise.prototype);
1983
+ Chunk.prototype.then = function (resolve, reject) {
1984
+ switch (this.status) {
1985
+ case "resolved_model":
1986
+ initializeModelChunk(this);
1987
+ }
1988
+ switch (this.status) {
1989
+ case "fulfilled":
1990
+ resolve(this.value);
1991
+ break;
1992
+ case "pending":
1993
+ case "blocked":
1994
+ case "cyclic":
1995
+ resolve &&
1996
+ (null === this.value && (this.value = []), this.value.push(resolve));
1997
+ reject &&
1998
+ (null === this.reason && (this.reason = []), this.reason.push(reject));
1999
+ break;
2000
+ default:
2001
+ reject(this.reason);
2002
+ }
2003
+ };
2004
+ function createPendingChunk(response) {
2005
+ return new Chunk("pending", null, null, response);
2006
+ }
2007
+ function wakeChunk(listeners, value) {
2008
+ for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
2009
+ }
2010
+ function triggerErrorOnChunk(chunk, error) {
2011
+ if ("pending" !== chunk.status && "blocked" !== chunk.status)
2012
+ chunk.reason.error(error);
2013
+ else {
2014
+ var listeners = chunk.reason;
2015
+ chunk.status = "rejected";
2016
+ chunk.reason = error;
2017
+ null !== listeners && wakeChunk(listeners, error);
2018
+ }
2019
+ }
2020
+ function resolveModelChunk(chunk, value, id) {
2021
+ if ("pending" !== chunk.status)
2022
+ (chunk = chunk.reason),
2023
+ "C" === value[0]
2024
+ ? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
2025
+ : chunk.enqueueModel(value);
2026
+ else {
2027
+ var resolveListeners = chunk.value,
2028
+ rejectListeners = chunk.reason;
2029
+ chunk.status = "resolved_model";
2030
+ chunk.value = value;
2031
+ chunk.reason = id;
2032
+ if (null !== resolveListeners)
2033
+ switch ((initializeModelChunk(chunk), chunk.status)) {
2034
+ case "fulfilled":
2035
+ wakeChunk(resolveListeners, chunk.value);
2036
+ break;
2037
+ case "pending":
2038
+ case "blocked":
2039
+ case "cyclic":
2040
+ if (chunk.value)
2041
+ for (value = 0; value < resolveListeners.length; value++)
2042
+ chunk.value.push(resolveListeners[value]);
2043
+ else chunk.value = resolveListeners;
2044
+ if (chunk.reason) {
2045
+ if (rejectListeners)
2046
+ for (value = 0; value < rejectListeners.length; value++)
2047
+ chunk.reason.push(rejectListeners[value]);
2048
+ } else chunk.reason = rejectListeners;
2049
+ break;
2050
+ case "rejected":
2051
+ rejectListeners && wakeChunk(rejectListeners, chunk.reason);
2052
+ }
2053
+ }
2054
+ }
2055
+ function createResolvedIteratorResultChunk(response, value, done) {
2056
+ return new Chunk(
2057
+ "resolved_model",
2058
+ (done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
2059
+ -1,
2060
+ response
2061
+ );
2062
+ }
2063
+ function resolveIteratorResultChunk(chunk, value, done) {
2064
+ resolveModelChunk(
2065
+ chunk,
2066
+ (done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
2067
+ -1
2068
+ );
2069
+ }
2070
+ function loadServerReference$1(
2071
+ response,
2072
+ id,
2073
+ bound,
2074
+ parentChunk,
2075
+ parentObject,
2076
+ key
2077
+ ) {
2078
+ var serverReference = resolveServerReference(response._bundlerConfig, id);
2079
+ id = preloadModule(serverReference);
2080
+ if (bound)
2081
+ bound = Promise.all([bound, id]).then(function (_ref) {
2082
+ _ref = _ref[0];
2083
+ var fn = requireModule(serverReference);
2084
+ return fn.bind.apply(fn, [null].concat(_ref));
2085
+ });
2086
+ else if (id)
2087
+ bound = Promise.resolve(id).then(function () {
2088
+ return requireModule(serverReference);
2089
+ });
2090
+ else return requireModule(serverReference);
2091
+ bound.then(
2092
+ createModelResolver(
2093
+ parentChunk,
2094
+ parentObject,
2095
+ key,
2096
+ !1,
2097
+ response,
2098
+ createModel,
2099
+ []
2100
+ ),
2101
+ createModelReject(parentChunk)
2102
+ );
2103
+ return null;
2104
+ }
2105
+ function reviveModel(response, parentObj, parentKey, value, reference) {
2106
+ if ("string" === typeof value)
2107
+ return parseModelString(response, parentObj, parentKey, value, reference);
2108
+ if ("object" === typeof value && null !== value)
2109
+ if (
2110
+ (void 0 !== reference &&
2111
+ void 0 !== response._temporaryReferences &&
2112
+ response._temporaryReferences.set(value, reference),
2113
+ Array.isArray(value))
2114
+ )
2115
+ for (var i = 0; i < value.length; i++)
2116
+ value[i] = reviveModel(
2117
+ response,
2118
+ value,
2119
+ "" + i,
2120
+ value[i],
2121
+ void 0 !== reference ? reference + ":" + i : void 0
2122
+ );
2123
+ else
2124
+ for (i in value)
2125
+ hasOwnProperty.call(value, i) &&
2126
+ ((parentObj =
2127
+ void 0 !== reference && -1 === i.indexOf(":")
2128
+ ? reference + ":" + i
2129
+ : void 0),
2130
+ (parentObj = reviveModel(response, value, i, value[i], parentObj)),
2131
+ void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
2132
+ return value;
2133
+ }
2134
+ var initializingChunk = null,
2135
+ initializingChunkBlockedModel = null;
2136
+ function initializeModelChunk(chunk) {
2137
+ var prevChunk = initializingChunk,
2138
+ prevBlocked = initializingChunkBlockedModel;
2139
+ initializingChunk = chunk;
2140
+ initializingChunkBlockedModel = null;
2141
+ var rootReference = -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
2142
+ resolvedModel = chunk.value;
2143
+ chunk.status = "cyclic";
2144
+ chunk.value = null;
2145
+ chunk.reason = null;
2146
+ try {
2147
+ var rawModel = JSON.parse(resolvedModel),
2148
+ value = reviveModel(
2149
+ chunk._response,
2150
+ { "": rawModel },
2151
+ "",
2152
+ rawModel,
2153
+ rootReference
2154
+ );
2155
+ if (
2156
+ null !== initializingChunkBlockedModel &&
2157
+ 0 < initializingChunkBlockedModel.deps
2158
+ )
2159
+ (initializingChunkBlockedModel.value = value), (chunk.status = "blocked");
2160
+ else {
2161
+ var resolveListeners = chunk.value;
2162
+ chunk.status = "fulfilled";
2163
+ chunk.value = value;
2164
+ null !== resolveListeners && wakeChunk(resolveListeners, value);
2165
+ }
2166
+ } catch (error) {
2167
+ (chunk.status = "rejected"), (chunk.reason = error);
2168
+ } finally {
2169
+ (initializingChunk = prevChunk),
2170
+ (initializingChunkBlockedModel = prevBlocked);
2171
+ }
2172
+ }
2173
+ function reportGlobalError(response, error) {
2174
+ response._closed = !0;
2175
+ response._closedReason = error;
2176
+ response._chunks.forEach(function (chunk) {
2177
+ "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
2178
+ });
2179
+ }
2180
+ function getChunk(response, id) {
2181
+ var chunks = response._chunks,
2182
+ chunk = chunks.get(id);
2183
+ chunk ||
2184
+ ((chunk = response._formData.get(response._prefix + id)),
2185
+ (chunk =
2186
+ null != chunk
2187
+ ? new Chunk("resolved_model", chunk, id, response)
2188
+ : response._closed
2189
+ ? new Chunk("rejected", null, response._closedReason, response)
2190
+ : createPendingChunk(response)),
2191
+ chunks.set(id, chunk));
2192
+ return chunk;
2193
+ }
2194
+ function createModelResolver(
2195
+ chunk,
2196
+ parentObject,
2197
+ key,
2198
+ cyclic,
2199
+ response,
2200
+ map,
2201
+ path
2202
+ ) {
2203
+ if (initializingChunkBlockedModel) {
2204
+ var blocked = initializingChunkBlockedModel;
2205
+ cyclic || blocked.deps++;
2206
+ } else
2207
+ blocked = initializingChunkBlockedModel = {
2208
+ deps: cyclic ? 0 : 1,
2209
+ value: null
2210
+ };
2211
+ return function (value) {
2212
+ for (var i = 1; i < path.length; i++) value = value[path[i]];
2213
+ parentObject[key] = map(response, value);
2214
+ "" === key && null === blocked.value && (blocked.value = parentObject[key]);
2215
+ blocked.deps--;
2216
+ 0 === blocked.deps &&
2217
+ "blocked" === chunk.status &&
2218
+ ((value = chunk.value),
2219
+ (chunk.status = "fulfilled"),
2220
+ (chunk.value = blocked.value),
2221
+ null !== value && wakeChunk(value, blocked.value));
2222
+ };
2223
+ }
2224
+ function createModelReject(chunk) {
2225
+ return function (error) {
2226
+ return triggerErrorOnChunk(chunk, error);
2227
+ };
2228
+ }
2229
+ function getOutlinedModel(response, reference, parentObject, key, map) {
2230
+ reference = reference.split(":");
2231
+ var id = parseInt(reference[0], 16);
2232
+ id = getChunk(response, id);
2233
+ switch (id.status) {
2234
+ case "resolved_model":
2235
+ initializeModelChunk(id);
2236
+ }
2237
+ switch (id.status) {
2238
+ case "fulfilled":
2239
+ parentObject = id.value;
2240
+ for (key = 1; key < reference.length; key++)
2241
+ parentObject = parentObject[reference[key]];
2242
+ return map(response, parentObject);
2243
+ case "pending":
2244
+ case "blocked":
2245
+ case "cyclic":
2246
+ var parentChunk = initializingChunk;
2247
+ id.then(
2248
+ createModelResolver(
2249
+ parentChunk,
2250
+ parentObject,
2251
+ key,
2252
+ "cyclic" === id.status,
2253
+ response,
2254
+ map,
2255
+ reference
2256
+ ),
2257
+ createModelReject(parentChunk)
2258
+ );
2259
+ return null;
2260
+ default:
2261
+ throw id.reason;
2262
+ }
2263
+ }
2264
+ function createMap(response, model) {
2265
+ return new Map(model);
2266
+ }
2267
+ function createSet(response, model) {
2268
+ return new Set(model);
2269
+ }
2270
+ function extractIterator(response, model) {
2271
+ return model[Symbol.iterator]();
2272
+ }
2273
+ function createModel(response, model) {
2274
+ return model;
2275
+ }
2276
+ function parseTypedArray(
2277
+ response,
2278
+ reference,
2279
+ constructor,
2280
+ bytesPerElement,
2281
+ parentObject,
2282
+ parentKey
2283
+ ) {
2284
+ reference = parseInt(reference.slice(2), 16);
2285
+ reference = response._formData.get(response._prefix + reference);
2286
+ reference =
2287
+ constructor === ArrayBuffer
2288
+ ? reference.arrayBuffer()
2289
+ : reference.arrayBuffer().then(function (buffer) {
2290
+ return new constructor(buffer);
2291
+ });
2292
+ bytesPerElement = initializingChunk;
2293
+ reference.then(
2294
+ createModelResolver(
2295
+ bytesPerElement,
2296
+ parentObject,
2297
+ parentKey,
2298
+ !1,
2299
+ response,
2300
+ createModel,
2301
+ []
2302
+ ),
2303
+ createModelReject(bytesPerElement)
2304
+ );
2305
+ return null;
2306
+ }
2307
+ function resolveStream(response, id, stream, controller) {
2308
+ var chunks = response._chunks;
2309
+ stream = new Chunk("fulfilled", stream, controller, response);
2310
+ chunks.set(id, stream);
2311
+ response = response._formData.getAll(response._prefix + id);
2312
+ for (id = 0; id < response.length; id++)
2313
+ (chunks = response[id]),
2314
+ "C" === chunks[0]
2315
+ ? controller.close("C" === chunks ? '"$undefined"' : chunks.slice(1))
2316
+ : controller.enqueueModel(chunks);
2317
+ }
2318
+ function parseReadableStream(response, reference, type) {
2319
+ reference = parseInt(reference.slice(2), 16);
2320
+ var controller = null;
2321
+ type = new ReadableStream({
2322
+ type: type,
2323
+ start: function (c) {
2324
+ controller = c;
2325
+ }
2326
+ });
2327
+ var previousBlockedChunk = null;
2328
+ resolveStream(response, reference, type, {
2329
+ enqueueModel: function (json) {
2330
+ if (null === previousBlockedChunk) {
2331
+ var chunk = new Chunk("resolved_model", json, -1, response);
2332
+ initializeModelChunk(chunk);
2333
+ "fulfilled" === chunk.status
2334
+ ? controller.enqueue(chunk.value)
2335
+ : (chunk.then(
2336
+ function (v) {
2337
+ return controller.enqueue(v);
2338
+ },
2339
+ function (e) {
2340
+ return controller.error(e);
2341
+ }
2342
+ ),
2343
+ (previousBlockedChunk = chunk));
2344
+ } else {
2345
+ chunk = previousBlockedChunk;
2346
+ var chunk$30 = createPendingChunk(response);
2347
+ chunk$30.then(
2348
+ function (v) {
2349
+ return controller.enqueue(v);
2350
+ },
2351
+ function (e) {
2352
+ return controller.error(e);
2353
+ }
2354
+ );
2355
+ previousBlockedChunk = chunk$30;
2356
+ chunk.then(function () {
2357
+ previousBlockedChunk === chunk$30 && (previousBlockedChunk = null);
2358
+ resolveModelChunk(chunk$30, json, -1);
2359
+ });
2360
+ }
2361
+ },
2362
+ close: function () {
2363
+ if (null === previousBlockedChunk) controller.close();
2364
+ else {
2365
+ var blockedChunk = previousBlockedChunk;
2366
+ previousBlockedChunk = null;
2367
+ blockedChunk.then(function () {
2368
+ return controller.close();
2369
+ });
2370
+ }
2371
+ },
2372
+ error: function (error) {
2373
+ if (null === previousBlockedChunk) controller.error(error);
2374
+ else {
2375
+ var blockedChunk = previousBlockedChunk;
2376
+ previousBlockedChunk = null;
2377
+ blockedChunk.then(function () {
2378
+ return controller.error(error);
2379
+ });
2380
+ }
2381
+ }
2382
+ });
2383
+ return type;
2384
+ }
2385
+ function asyncIterator() {
2386
+ return this;
2387
+ }
2388
+ function createIterator(next) {
2389
+ next = { next: next };
2390
+ next[ASYNC_ITERATOR] = asyncIterator;
2391
+ return next;
2392
+ }
2393
+ function parseAsyncIterable(response, reference, iterator) {
2394
+ reference = parseInt(reference.slice(2), 16);
2395
+ var buffer = [],
2396
+ closed = !1,
2397
+ nextWriteIndex = 0,
2398
+ $jscomp$compprop2 = {};
2399
+ $jscomp$compprop2 =
2400
+ (($jscomp$compprop2[ASYNC_ITERATOR] = function () {
2401
+ var nextReadIndex = 0;
2402
+ return createIterator(function (arg) {
2403
+ if (void 0 !== arg)
2404
+ throw Error(
2405
+ "Values cannot be passed to next() of AsyncIterables passed to Client Components."
2406
+ );
2407
+ if (nextReadIndex === buffer.length) {
2408
+ if (closed)
2409
+ return new Chunk(
2410
+ "fulfilled",
2411
+ { done: !0, value: void 0 },
2412
+ null,
2413
+ response
2414
+ );
2415
+ buffer[nextReadIndex] = createPendingChunk(response);
2416
+ }
2417
+ return buffer[nextReadIndex++];
2418
+ });
2419
+ }),
2420
+ $jscomp$compprop2);
2421
+ iterator = iterator ? $jscomp$compprop2[ASYNC_ITERATOR]() : $jscomp$compprop2;
2422
+ resolveStream(response, reference, iterator, {
2423
+ enqueueModel: function (value) {
2424
+ nextWriteIndex === buffer.length
2425
+ ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
2426
+ response,
2427
+ value,
2428
+ !1
2429
+ ))
2430
+ : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
2431
+ nextWriteIndex++;
2432
+ },
2433
+ close: function (value) {
2434
+ closed = !0;
2435
+ nextWriteIndex === buffer.length
2436
+ ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
2437
+ response,
2438
+ value,
2439
+ !0
2440
+ ))
2441
+ : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
2442
+ for (nextWriteIndex++; nextWriteIndex < buffer.length; )
2443
+ resolveIteratorResultChunk(
2444
+ buffer[nextWriteIndex++],
2445
+ '"$undefined"',
2446
+ !0
2447
+ );
2448
+ },
2449
+ error: function (error) {
2450
+ closed = !0;
2451
+ for (
2452
+ nextWriteIndex === buffer.length &&
2453
+ (buffer[nextWriteIndex] = createPendingChunk(response));
2454
+ nextWriteIndex < buffer.length;
2455
+
2456
+ )
2457
+ triggerErrorOnChunk(buffer[nextWriteIndex++], error);
2458
+ }
2459
+ });
2460
+ return iterator;
2461
+ }
2462
+ function parseModelString(response, obj, key, value, reference) {
2463
+ if ("$" === value[0]) {
2464
+ switch (value[1]) {
2465
+ case "$":
2466
+ return value.slice(1);
2467
+ case "@":
2468
+ return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
2469
+ case "F":
2470
+ return (
2471
+ (value = value.slice(2)),
2472
+ (value = getOutlinedModel(response, value, obj, key, createModel)),
2473
+ loadServerReference$1(
2474
+ response,
2475
+ value.id,
2476
+ value.bound,
2477
+ initializingChunk,
2478
+ obj,
2479
+ key
2480
+ )
2481
+ );
2482
+ case "T":
2483
+ if (void 0 === reference || void 0 === response._temporaryReferences)
2484
+ throw Error(
2485
+ "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
2486
+ );
2487
+ return createTemporaryReference(
2488
+ response._temporaryReferences,
2489
+ reference
2490
+ );
2491
+ case "Q":
2492
+ return (
2493
+ (value = value.slice(2)),
2494
+ getOutlinedModel(response, value, obj, key, createMap)
2495
+ );
2496
+ case "W":
2497
+ return (
2498
+ (value = value.slice(2)),
2499
+ getOutlinedModel(response, value, obj, key, createSet)
2500
+ );
2501
+ case "K":
2502
+ obj = value.slice(2);
2503
+ var formPrefix = response._prefix + obj + "_",
2504
+ data = new FormData();
2505
+ response._formData.forEach(function (entry, entryKey) {
2506
+ entryKey.startsWith(formPrefix) &&
2507
+ data.append(entryKey.slice(formPrefix.length), entry);
2508
+ });
2509
+ return data;
2510
+ case "i":
2511
+ return (
2512
+ (value = value.slice(2)),
2513
+ getOutlinedModel(response, value, obj, key, extractIterator)
2514
+ );
2515
+ case "I":
2516
+ return Infinity;
2517
+ case "-":
2518
+ return "$-0" === value ? -0 : -Infinity;
2519
+ case "N":
2520
+ return NaN;
2521
+ case "u":
2522
+ return;
2523
+ case "D":
2524
+ return new Date(Date.parse(value.slice(2)));
2525
+ case "n":
2526
+ return BigInt(value.slice(2));
2527
+ }
2528
+ switch (value[1]) {
2529
+ case "A":
2530
+ return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
2531
+ case "O":
2532
+ return parseTypedArray(response, value, Int8Array, 1, obj, key);
2533
+ case "o":
2534
+ return parseTypedArray(response, value, Uint8Array, 1, obj, key);
2535
+ case "U":
2536
+ return parseTypedArray(response, value, Uint8ClampedArray, 1, obj, key);
2537
+ case "S":
2538
+ return parseTypedArray(response, value, Int16Array, 2, obj, key);
2539
+ case "s":
2540
+ return parseTypedArray(response, value, Uint16Array, 2, obj, key);
2541
+ case "L":
2542
+ return parseTypedArray(response, value, Int32Array, 4, obj, key);
2543
+ case "l":
2544
+ return parseTypedArray(response, value, Uint32Array, 4, obj, key);
2545
+ case "G":
2546
+ return parseTypedArray(response, value, Float32Array, 4, obj, key);
2547
+ case "g":
2548
+ return parseTypedArray(response, value, Float64Array, 8, obj, key);
2549
+ case "M":
2550
+ return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
2551
+ case "m":
2552
+ return parseTypedArray(response, value, BigUint64Array, 8, obj, key);
2553
+ case "V":
2554
+ return parseTypedArray(response, value, DataView, 1, obj, key);
2555
+ case "B":
2556
+ return (
2557
+ (obj = parseInt(value.slice(2), 16)),
2558
+ response._formData.get(response._prefix + obj)
2559
+ );
2560
+ }
2561
+ switch (value[1]) {
2562
+ case "R":
2563
+ return parseReadableStream(response, value, void 0);
2564
+ case "r":
2565
+ return parseReadableStream(response, value, "bytes");
2566
+ case "X":
2567
+ return parseAsyncIterable(response, value, !1);
2568
+ case "x":
2569
+ return parseAsyncIterable(response, value, !0);
2570
+ }
2571
+ value = value.slice(1);
2572
+ return getOutlinedModel(response, value, obj, key, createModel);
2573
+ }
2574
+ return value;
2575
+ }
2576
+ function createResponse(bundlerConfig, formFieldPrefix, temporaryReferences) {
2577
+ var backingFormData =
2578
+ 3 < arguments.length && void 0 !== arguments[3]
2579
+ ? arguments[3]
2580
+ : new FormData(),
2581
+ chunks = new Map();
2582
+ return {
2583
+ _bundlerConfig: bundlerConfig,
2584
+ _prefix: formFieldPrefix,
2585
+ _formData: backingFormData,
2586
+ _chunks: chunks,
2587
+ _closed: !1,
2588
+ _closedReason: null,
2589
+ _temporaryReferences: temporaryReferences
2590
+ };
2591
+ }
2592
+ function resolveField(response, key, value) {
2593
+ response._formData.append(key, value);
2594
+ var prefix = response._prefix;
2595
+ key.startsWith(prefix) &&
2596
+ ((response = response._chunks),
2597
+ (key = +key.slice(prefix.length)),
2598
+ (prefix = response.get(key)) && resolveModelChunk(prefix, value, key));
2599
+ }
2600
+ function close(response) {
2601
+ reportGlobalError(response, Error("Connection closed."));
2602
+ }
2603
+ function loadServerReference(bundlerConfig, id, bound) {
2604
+ var serverReference = resolveServerReference(bundlerConfig, id);
2605
+ bundlerConfig = preloadModule(serverReference);
2606
+ return bound
2607
+ ? Promise.all([bound, bundlerConfig]).then(function (_ref) {
2608
+ _ref = _ref[0];
2609
+ var fn = requireModule(serverReference);
2610
+ return fn.bind.apply(fn, [null].concat(_ref));
2611
+ })
2612
+ : bundlerConfig
2613
+ ? Promise.resolve(bundlerConfig).then(function () {
2614
+ return requireModule(serverReference);
2615
+ })
2616
+ : Promise.resolve(requireModule(serverReference));
2617
+ }
2618
+ function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
2619
+ body = createResponse(serverManifest, formFieldPrefix, void 0, body);
2620
+ close(body);
2621
+ body = getChunk(body, 0);
2622
+ body.then(function () {});
2623
+ if ("fulfilled" !== body.status) throw body.reason;
2624
+ return body.value;
2625
+ }
2626
+ function createDrainHandler(destination, request) {
2627
+ return function () {
2628
+ return startFlowing(request, destination);
2629
+ };
2630
+ }
2631
+ function createCancelHandler(request, reason) {
2632
+ return function () {
2633
+ request.destination = null;
2634
+ abort(request, Error(reason));
2635
+ };
2636
+ }
2637
+ function createFakeWritable(readable) {
2638
+ return {
2639
+ write: function (chunk) {
2640
+ return readable.push(chunk);
2641
+ },
2642
+ end: function () {
2643
+ readable.push(null);
2644
+ },
2645
+ destroy: function (error) {
2646
+ readable.destroy(error);
2647
+ }
2648
+ };
2649
+ }
2650
+ exports.createTemporaryReferenceSet = function () {
2651
+ return new WeakMap();
2652
+ };
2653
+ exports.decodeAction = function (body, serverManifest) {
2654
+ var formData = new FormData(),
2655
+ action = null;
2656
+ body.forEach(function (value, key) {
2657
+ key.startsWith("$ACTION_")
2658
+ ? key.startsWith("$ACTION_REF_")
2659
+ ? ((value = "$ACTION_" + key.slice(12) + ":"),
2660
+ (value = decodeBoundActionMetaData(body, serverManifest, value)),
2661
+ (action = loadServerReference(serverManifest, value.id, value.bound)))
2662
+ : key.startsWith("$ACTION_ID_") &&
2663
+ ((value = key.slice(11)),
2664
+ (action = loadServerReference(serverManifest, value, null)))
2665
+ : formData.append(key, value);
2666
+ });
2667
+ return null === action
2668
+ ? null
2669
+ : action.then(function (fn) {
2670
+ return fn.bind(null, formData);
2671
+ });
2672
+ };
2673
+ exports.decodeFormState = function (actionResult, body, serverManifest) {
2674
+ var keyPath = body.get("$ACTION_KEY");
2675
+ if ("string" !== typeof keyPath) return Promise.resolve(null);
2676
+ var metaData = null;
2677
+ body.forEach(function (value, key) {
2678
+ key.startsWith("$ACTION_REF_") &&
2679
+ ((value = "$ACTION_" + key.slice(12) + ":"),
2680
+ (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
2681
+ });
2682
+ if (null === metaData) return Promise.resolve(null);
2683
+ var referenceId = metaData.id;
2684
+ return Promise.resolve(metaData.bound).then(function (bound) {
2685
+ return null === bound
2686
+ ? null
2687
+ : [actionResult, keyPath, referenceId, bound.length - 1];
2688
+ });
2689
+ };
2690
+ exports.decodeReply = function (body, moduleBasePath, options) {
2691
+ if ("string" === typeof body) {
2692
+ var form = new FormData();
2693
+ form.append("0", body);
2694
+ body = form;
2695
+ }
2696
+ body = createResponse(
2697
+ moduleBasePath,
2698
+ "",
2699
+ options ? options.temporaryReferences : void 0,
2700
+ body
2701
+ );
2702
+ moduleBasePath = getChunk(body, 0);
2703
+ close(body);
2704
+ return moduleBasePath;
2705
+ };
2706
+ exports.decodeReplyFromBusboy = function (
2707
+ busboyStream,
2708
+ moduleBasePath,
2709
+ options
2710
+ ) {
2711
+ var response = createResponse(
2712
+ moduleBasePath,
2713
+ "",
2714
+ options ? options.temporaryReferences : void 0
2715
+ ),
2716
+ pendingFiles = 0,
2717
+ queuedFields = [];
2718
+ busboyStream.on("field", function (name, value) {
2719
+ 0 < pendingFiles
2720
+ ? queuedFields.push(name, value)
2721
+ : resolveField(response, name, value);
2722
+ });
2723
+ busboyStream.on("file", function (name, value, _ref) {
2724
+ var filename = _ref.filename,
2725
+ mimeType = _ref.mimeType;
2726
+ if ("base64" === _ref.encoding.toLowerCase())
2727
+ throw Error(
2728
+ "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."
2729
+ );
2730
+ pendingFiles++;
2731
+ var JSCompiler_object_inline_chunks_236 = [];
2732
+ value.on("data", function (chunk) {
2733
+ JSCompiler_object_inline_chunks_236.push(chunk);
2734
+ });
2735
+ value.on("end", function () {
2736
+ var blob = new Blob(JSCompiler_object_inline_chunks_236, {
2737
+ type: mimeType
2738
+ });
2739
+ response._formData.append(name, blob, filename);
2740
+ pendingFiles--;
2741
+ if (0 === pendingFiles) {
2742
+ for (blob = 0; blob < queuedFields.length; blob += 2)
2743
+ resolveField(response, queuedFields[blob], queuedFields[blob + 1]);
2744
+ queuedFields.length = 0;
2745
+ }
2746
+ });
2747
+ });
2748
+ busboyStream.on("finish", function () {
2749
+ close(response);
2750
+ });
2751
+ busboyStream.on("error", function (err) {
2752
+ reportGlobalError(response, err);
2753
+ });
2754
+ return getChunk(response, 0);
2755
+ };
2756
+ exports.registerClientReference = function (
2757
+ proxyImplementation,
2758
+ id,
2759
+ exportName
2760
+ ) {
2761
+ return Object.defineProperties(proxyImplementation, {
2762
+ $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
2763
+ $$id: { value: id + "#" + exportName }
2764
+ });
2765
+ };
2766
+ exports.registerServerReference = function (reference, id, exportName) {
2767
+ return Object.defineProperties(reference, {
2768
+ $$typeof: { value: SERVER_REFERENCE_TAG },
2769
+ $$id: { value: id + "#" + exportName, configurable: !0 },
2770
+ $$bound: { value: null, configurable: !0 },
2771
+ bind: { value: bind, configurable: !0 }
2772
+ });
2773
+ };
2774
+ exports.renderToPipeableStream = function (model, moduleBasePath, options) {
2775
+ var request = new RequestInstance(
2776
+ 20,
2777
+ model,
2778
+ moduleBasePath,
2779
+ options ? options.onError : void 0,
2780
+ options ? options.identifierPrefix : void 0,
2781
+ options ? options.onPostpone : void 0,
2782
+ options ? options.temporaryReferences : void 0,
2783
+ void 0,
2784
+ void 0,
2785
+ noop,
2786
+ noop
2787
+ ),
2788
+ hasStartedFlowing = !1;
2789
+ startWork(request);
2790
+ return {
2791
+ pipe: function (destination) {
2792
+ if (hasStartedFlowing)
2793
+ throw Error(
2794
+ "React currently only supports piping to one writable stream."
2795
+ );
2796
+ hasStartedFlowing = !0;
2797
+ startFlowing(request, destination);
2798
+ destination.on("drain", createDrainHandler(destination, request));
2799
+ destination.on(
2800
+ "error",
2801
+ createCancelHandler(
2802
+ request,
2803
+ "The destination stream errored while writing data."
2804
+ )
2805
+ );
2806
+ destination.on(
2807
+ "close",
2808
+ createCancelHandler(request, "The destination stream closed early.")
2809
+ );
2810
+ return destination;
2811
+ },
2812
+ abort: function (reason) {
2813
+ abort(request, reason);
2814
+ }
2815
+ };
2816
+ };
2817
+ exports.unstable_prerenderToNodeStream = function (
2818
+ model,
2819
+ moduleBasePath,
2820
+ options
2821
+ ) {
2822
+ return new Promise(function (resolve, reject) {
2823
+ var request = new RequestInstance(
2824
+ 21,
2825
+ model,
2826
+ moduleBasePath,
2827
+ options ? options.onError : void 0,
2828
+ options ? options.identifierPrefix : void 0,
2829
+ options ? options.onPostpone : void 0,
2830
+ options ? options.temporaryReferences : void 0,
2831
+ void 0,
2832
+ void 0,
2833
+ function () {
2834
+ var readable = new stream.Readable({
2835
+ read: function () {
2836
+ startFlowing(request, writable);
2837
+ }
2838
+ }),
2839
+ writable = createFakeWritable(readable);
2840
+ resolve({ prelude: readable });
2841
+ },
2842
+ reject
2843
+ );
2844
+ if (options && options.signal) {
2845
+ var signal = options.signal;
2846
+ if (signal.aborted) abort(request, signal.reason);
2847
+ else {
2848
+ var listener = function () {
2849
+ abort(request, signal.reason);
2850
+ signal.removeEventListener("abort", listener);
2851
+ };
2852
+ signal.addEventListener("abort", listener);
2853
+ }
2854
+ }
2855
+ startWork(request);
2856
+ });
2857
+ };