@modern-js/utils 2.65.0 → 2.65.2

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