@vitejs/plugin-rsc 0.4.10-alpha.1 → 0.4.10

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