@vitejs/plugin-rsc 0.5.33 → 0.5.35

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 (81) hide show
  1. package/README.md +18 -2
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/{cjs-AWVWfddx.js → cjs-DhDj_zQT.js} +2 -2
  4. package/dist/client-Dq3oGLRS.d.ts +8 -0
  5. package/dist/{client-reference-DEZtXTv1.d.ts → client-reference-Bk5pzNGN.d.ts} +1 -1
  6. package/dist/client.node-BEQT2PT-.d.ts +9 -0
  7. package/dist/client.shared-D1HxyClg.js +10 -0
  8. package/dist/client.shared-VT232QCM.d.ts +16 -0
  9. package/dist/core/browser.js +1 -1
  10. package/dist/core/plugin.d.ts +2 -3
  11. package/dist/core/rsc.d.ts +1 -1
  12. package/dist/core/rsc.js +1 -1
  13. package/dist/core/ssr.d.ts +1 -7
  14. package/dist/core/ssr.js +1 -1
  15. package/dist/{index-C5IY2S-e.d.ts → index-CROaL0MT.d.ts} +34 -8
  16. package/dist/index.js +1 -1
  17. package/dist/{picocolors-D28_L_A0.js → picocolors-DCTC64Zv.js} +1 -1
  18. package/dist/{plugin-DarRieDr.js → plugin-CLvIS10V.js} +38 -32
  19. package/dist/plugin.js +1 -1
  20. package/dist/plugins/cjs.d.ts +2 -3
  21. package/dist/plugins/cjs.js +1 -1
  22. package/dist/react/browser.d.ts +10 -10
  23. package/dist/react/rsc/client.d.ts +1 -1
  24. package/dist/react/rsc/client.js +2 -5
  25. package/dist/react/rsc/client.node.d.ts +2 -0
  26. package/dist/react/rsc/client.node.js +16 -0
  27. package/dist/react/rsc/server.d.ts +2 -2
  28. package/dist/react/rsc/server.node.d.ts +3 -0
  29. package/dist/react/rsc/server.node.js +24 -0
  30. package/dist/react/rsc/static.d.ts +4 -5
  31. package/dist/react/rsc/static.node.d.ts +6 -0
  32. package/dist/react/rsc/static.node.js +11 -0
  33. package/dist/react/rsc.d.ts +3 -3
  34. package/dist/react/ssr.d.ts +9 -9
  35. package/dist/react/ssr.node.d.ts +12 -0
  36. package/dist/react/ssr.node.js +21 -0
  37. package/dist/rsc/client.d.ts +1 -1
  38. package/dist/rsc/client.node.d.ts +2 -0
  39. package/dist/rsc/client.node.js +3 -0
  40. package/dist/rsc/server.d.ts +5 -5
  41. package/dist/rsc/server.node.d.ts +19 -0
  42. package/dist/rsc/server.node.js +13 -0
  43. package/dist/rsc/static.d.ts +4 -5
  44. package/dist/rsc/static.node.d.ts +16 -0
  45. package/dist/rsc/static.node.js +12 -0
  46. package/dist/{rsc-C3UdJLOW.d.ts → rsc-D8UlANI2.d.ts} +1 -1
  47. package/dist/rsc.d.ts +3 -3
  48. package/dist/rsc.node.d.ts +6 -0
  49. package/dist/rsc.node.js +7 -0
  50. package/dist/{scope-Bdx33sQv.js → scope-Ck0n25my.js} +2 -4
  51. package/dist/{server-ZBjqNTqU.d.ts → server-YwgjVtsE.d.ts} +2 -2
  52. package/dist/server.node-DU77AeKU.d.ts +15 -0
  53. package/dist/shared-BWJvctW6.js +34 -0
  54. package/dist/shared-CXQb6hk9.js +89 -0
  55. package/dist/shared-DJBuYpZL.d.ts +20 -0
  56. package/dist/ssr-C-U7jY5S.d.ts +8 -0
  57. package/dist/ssr.d.ts +3 -21
  58. package/dist/ssr.js +1 -87
  59. package/dist/ssr.node.d.ts +5 -0
  60. package/dist/ssr.node.js +4 -0
  61. package/dist/transforms/index.js +91 -62
  62. package/dist/utils/encryption-runtime.d.ts +3 -4
  63. package/dist/utils/encryption-runtime.js +4 -2
  64. package/dist/utils/rpc.d.ts +3 -4
  65. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.development.js +909 -495
  66. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.production.js +399 -265
  67. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.development.js +901 -477
  68. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.production.js +380 -219
  69. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.development.js +925 -484
  70. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.production.js +385 -221
  71. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.development.js +726 -388
  72. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.production.js +566 -397
  73. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.development.js +734 -397
  74. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.production.js +477 -238
  75. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.development.js +1029 -620
  76. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.production.js +481 -261
  77. package/dist/vendor/react-server-dom/esm/react-server-dom-webpack-node-loader.production.js +2 -2
  78. package/dist/vendor/react-server-dom/package.json +3 -3
  79. package/package.json +15 -15
  80. package/dist/client-Bhch3O41.d.ts +0 -19
  81. package/dist/dist-uqdtSkzK.js +0 -64
@@ -21,40 +21,19 @@
21
21
  maybeIterable["@@iterator"];
22
22
  return "function" === typeof maybeIterable ? maybeIterable : null;
23
23
  }
24
- function _defineProperty(obj, key, value) {
25
- a: if ("object" == typeof key && key) {
26
- var e = key[Symbol.toPrimitive];
27
- if (void 0 !== e) {
28
- key = e.call(key, "string");
29
- if ("object" != typeof key) break a;
30
- throw new TypeError("@@toPrimitive must return a primitive value.");
31
- }
32
- key = String(key);
33
- }
34
- key = "symbol" == typeof key ? key : key + "";
35
- key in obj
36
- ? Object.defineProperty(obj, key, {
37
- value: value,
38
- enumerable: !0,
39
- configurable: !0,
40
- writable: !0
41
- })
42
- : (obj[key] = value);
43
- return obj;
44
- }
45
24
  function handleErrorInNextTick(error) {
46
25
  setTimeout(function () {
47
26
  throw error;
48
27
  });
49
28
  }
50
- function writeChunkAndReturn(destination, chunk) {
29
+ function writeChunk(destination, chunk) {
51
30
  if (0 !== chunk.byteLength)
52
- if (2048 < chunk.byteLength)
31
+ if (4096 < chunk.byteLength)
53
32
  0 < writtenBytes &&
54
33
  (destination.enqueue(
55
34
  new Uint8Array(currentView.buffer, 0, writtenBytes)
56
35
  ),
57
- (currentView = new Uint8Array(2048)),
36
+ (currentView = new Uint8Array(4096)),
58
37
  (writtenBytes = 0)),
59
38
  destination.enqueue(chunk);
60
39
  else {
@@ -68,11 +47,14 @@
68
47
  ),
69
48
  destination.enqueue(currentView),
70
49
  (chunk = chunk.subarray(allowableBytes))),
71
- (currentView = new Uint8Array(2048)),
50
+ (currentView = new Uint8Array(4096)),
72
51
  (writtenBytes = 0));
73
52
  currentView.set(chunk, writtenBytes);
74
53
  writtenBytes += chunk.byteLength;
75
54
  }
55
+ }
56
+ function writeChunkAndReturn(destination, chunk) {
57
+ writeChunk(destination, chunk);
76
58
  return !0;
77
59
  }
78
60
  function completeWriting(destination) {
@@ -360,7 +342,7 @@
360
342
  });
361
343
  break;
362
344
  case "stylesheet":
363
- preload(srcSet, "stylesheet", {
345
+ preload(srcSet, "style", {
364
346
  crossOrigin: props.crossOrigin,
365
347
  integrity: props.integrity,
366
348
  nonce: props.nonce,
@@ -525,7 +507,12 @@
525
507
  case "fulfilled":
526
508
  return thenable.value;
527
509
  case "rejected":
528
- throw thenable.reason;
510
+ thenableState = thenable.reason;
511
+ if (void 0 === thenableState && !("reason" in thenable))
512
+ throw Error(
513
+ "A rejected Promise was passed to React without a `reason` property. React threw a generic error from where the Promise was used to assist in identifying the problematic Promise. Make sure that instrumented Promises correctly set the `reason` property when setting `status` to `'rejected'`."
514
+ );
515
+ throw thenableState;
529
516
  default:
530
517
  "string" === typeof thenable.status
531
518
  ? thenable.then(noop, noop)
@@ -675,6 +662,8 @@
675
662
  return "Suspense";
676
663
  case REACT_SUSPENSE_LIST_TYPE:
677
664
  return "SuspenseList";
665
+ case REACT_VIEW_TRANSITION_TYPE:
666
+ return "ViewTransition";
678
667
  }
679
668
  if ("object" === typeof type)
680
669
  switch (type.$$typeof) {
@@ -983,11 +972,11 @@
983
972
  model,
984
973
  bundlerConfig,
985
974
  onError,
986
- onPostpone,
987
975
  onAllReady,
988
976
  onFatalError,
989
977
  identifierPrefix,
990
978
  temporaryReferences,
979
+ debugStartTime,
991
980
  environmentName,
992
981
  filterStackFrame,
993
982
  keepDebugAlive
@@ -1005,7 +994,7 @@
1005
994
  pingedTasks = [],
1006
995
  hints = new Set();
1007
996
  this.type = type;
1008
- this.status = 10;
997
+ this.status = OPENING;
1009
998
  this.flushScheduled = !1;
1010
999
  this.destination = this.fatalError = null;
1011
1000
  this.bundlerConfig = bundlerConfig;
@@ -1023,13 +1012,13 @@
1023
1012
  this.writtenClientReferences = new Map();
1024
1013
  this.writtenServerReferences = new Map();
1025
1014
  this.writtenObjects = new WeakMap();
1015
+ this.writtenImportStrings = new Map();
1016
+ this.writtenImportStringsSize = 0;
1026
1017
  this.temporaryReferences = temporaryReferences;
1027
1018
  this.identifierPrefix = identifierPrefix || "";
1028
1019
  this.identifierCount = 1;
1029
1020
  this.taintCleanupQueue = [];
1030
1021
  this.onError = void 0 === onError ? defaultErrorHandler : onError;
1031
- this.onPostpone =
1032
- void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
1033
1022
  this.onAllReady = onAllReady;
1034
1023
  this.onFatalError = onFatalError;
1035
1024
  this.pendingDebugChunks = 0;
@@ -1054,7 +1043,10 @@
1054
1043
  this.deferredDebugObjects = keepDebugAlive
1055
1044
  ? { retained: new Map(), existing: new Map() }
1056
1045
  : null;
1057
- type = this.timeOrigin = performance.now();
1046
+ type =
1047
+ "number" === typeof debugStartTime
1048
+ ? (this.timeOrigin = debugStartTime - performance.timeOrigin)
1049
+ : (this.timeOrigin = performance.now());
1058
1050
  emitTimeOriginChunk(this, type + performance.timeOrigin);
1059
1051
  this.abortTime = -0;
1060
1052
  model = createTask(
@@ -1076,8 +1068,8 @@
1076
1068
  bundlerConfig,
1077
1069
  onError,
1078
1070
  identifierPrefix,
1079
- onPostpone,
1080
1071
  temporaryReferences,
1072
+ debugStartTime,
1081
1073
  environmentName,
1082
1074
  filterStackFrame,
1083
1075
  keepDebugAlive
@@ -1088,11 +1080,11 @@
1088
1080
  model,
1089
1081
  bundlerConfig,
1090
1082
  onError,
1091
- onPostpone,
1092
1083
  noop,
1093
1084
  noop,
1094
1085
  identifierPrefix,
1095
1086
  temporaryReferences,
1087
+ debugStartTime,
1096
1088
  environmentName,
1097
1089
  filterStackFrame,
1098
1090
  keepDebugAlive
@@ -1105,23 +1097,23 @@
1105
1097
  onFatalError,
1106
1098
  onError,
1107
1099
  identifierPrefix,
1108
- onPostpone,
1109
1100
  temporaryReferences,
1101
+ debugStartTime,
1110
1102
  environmentName,
1111
1103
  filterStackFrame,
1112
1104
  keepDebugAlive
1113
1105
  ) {
1114
1106
  resetOwnerStackLimit();
1115
1107
  return new RequestInstance(
1116
- 21,
1108
+ PRERENDER,
1117
1109
  model,
1118
1110
  bundlerConfig,
1119
1111
  onError,
1120
- onPostpone,
1121
1112
  onAllReady,
1122
1113
  onFatalError,
1123
1114
  identifierPrefix,
1124
1115
  temporaryReferences,
1116
+ debugStartTime,
1125
1117
  environmentName,
1126
1118
  filterStackFrame,
1127
1119
  keepDebugAlive
@@ -1168,7 +1160,23 @@
1168
1160
  ((cancelled = !0),
1169
1161
  request.status === ABORTING
1170
1162
  ? emitDebugHaltChunk(request, id)
1171
- : emitOutlinedDebugModelChunk(request, id, counter, value),
1163
+ : (isArrayImpl(value) && 200 < value.length) ||
1164
+ ((value instanceof ArrayBuffer ||
1165
+ value instanceof Int8Array ||
1166
+ value instanceof Uint8Array ||
1167
+ value instanceof Uint8ClampedArray ||
1168
+ value instanceof Int16Array ||
1169
+ value instanceof Uint16Array ||
1170
+ value instanceof Int32Array ||
1171
+ value instanceof Uint32Array ||
1172
+ value instanceof Float32Array ||
1173
+ value instanceof Float64Array ||
1174
+ value instanceof BigInt64Array ||
1175
+ value instanceof BigUint64Array ||
1176
+ value instanceof DataView) &&
1177
+ 1e3 < value.byteLength)
1178
+ ? emitDebugHaltChunk(request, id)
1179
+ : emitOutlinedDebugModelChunk(request, id, counter, value),
1172
1180
  enqueueFlush(request));
1173
1181
  },
1174
1182
  function (reason) {
@@ -1205,8 +1213,8 @@
1205
1213
  }
1206
1214
  );
1207
1215
  }
1208
- function serializeThenable(request, task, thenable) {
1209
- var newTask = createTask(
1216
+ function createThenableTask(request, task, thenable) {
1217
+ return createTask(
1210
1218
  request,
1211
1219
  thenable,
1212
1220
  task.keyPath,
@@ -1218,42 +1226,35 @@
1218
1226
  task.debugStack,
1219
1227
  task.debugTask
1220
1228
  );
1229
+ }
1230
+ function serializeThenable(request, task, thenable) {
1221
1231
  switch (thenable.status) {
1222
1232
  case "fulfilled":
1223
1233
  return (
1224
- forwardDebugInfoFromThenable(
1225
- request,
1226
- newTask,
1227
- thenable,
1228
- null,
1229
- null
1230
- ),
1231
- (newTask.model = thenable.value),
1232
- pingTask(request, newTask),
1233
- newTask.id
1234
+ (task = createThenableTask(request, task, thenable)),
1235
+ forwardDebugInfoFromThenable(request, task, thenable, null, null),
1236
+ (task.model = thenable.value),
1237
+ pingTask(request, task),
1238
+ task.id
1234
1239
  );
1235
1240
  case "rejected":
1236
1241
  return (
1237
- forwardDebugInfoFromThenable(
1238
- request,
1239
- newTask,
1240
- thenable,
1241
- null,
1242
- null
1243
- ),
1244
- erroredTask(request, newTask, thenable.reason),
1245
- newTask.id
1242
+ (task = createThenableTask(request, task, thenable)),
1243
+ forwardDebugInfoFromThenable(request, task, thenable, null, null),
1244
+ erroredTask(request, task, thenable.reason),
1245
+ task.id
1246
1246
  );
1247
1247
  default:
1248
+ var _newTask2 = createThenableTask(request, task, thenable);
1248
1249
  if (request.status === ABORTING)
1249
1250
  return (
1250
- request.abortableTasks.delete(newTask),
1251
- 21 === request.type
1252
- ? (haltTask(newTask), finishHaltedTask(newTask, request))
1251
+ request.abortableTasks.delete(_newTask2),
1252
+ request.type === PRERENDER
1253
+ ? (haltTask(_newTask2), finishHaltedTask(_newTask2, request))
1253
1254
  : ((task = request.fatalError),
1254
- abortTask(newTask),
1255
- finishAbortedTask(newTask, request, task)),
1256
- newTask.id
1255
+ abortTask(_newTask2),
1256
+ finishAbortedTask(_newTask2, request, task)),
1257
+ _newTask2.id
1257
1258
  );
1258
1259
  "string" !== typeof thenable.status &&
1259
1260
  ((thenable.status = "pending"),
@@ -1268,27 +1269,27 @@
1268
1269
  ((thenable.status = "rejected"), (thenable.reason = error));
1269
1270
  }
1270
1271
  ));
1272
+ thenable.then(
1273
+ function (value) {
1274
+ forwardDebugInfoFromCurrentContext(request, _newTask2, thenable);
1275
+ _newTask2.model = value;
1276
+ pingTask(request, _newTask2);
1277
+ },
1278
+ function (reason) {
1279
+ _newTask2.status === PENDING$1 &&
1280
+ ((_newTask2.timed = !0),
1281
+ erroredTask(request, _newTask2, reason),
1282
+ enqueueFlush(request));
1283
+ }
1284
+ );
1285
+ return _newTask2.id;
1271
1286
  }
1272
- thenable.then(
1273
- function (value) {
1274
- forwardDebugInfoFromCurrentContext(request, newTask, thenable);
1275
- newTask.model = value;
1276
- pingTask(request, newTask);
1277
- },
1278
- function (reason) {
1279
- 0 === newTask.status &&
1280
- ((newTask.timed = !0),
1281
- erroredTask(request, newTask, reason),
1282
- enqueueFlush(request));
1283
- }
1284
- );
1285
- return newTask.id;
1286
1287
  }
1287
1288
  function serializeReadableStream(request, task, stream) {
1288
1289
  function progress(entry) {
1289
- if (0 === streamTask.status)
1290
+ if (streamTask.status === PENDING$1)
1290
1291
  if (entry.done)
1291
- (streamTask.status = 1),
1292
+ (streamTask.status = COMPLETED),
1292
1293
  (entry = streamTask.id.toString(16) + ":C\n"),
1293
1294
  request.completedRegularChunks.push(stringToChunk(entry)),
1294
1295
  request.abortableTasks.delete(streamTask),
@@ -1300,17 +1301,25 @@
1300
1301
  callOnAllReadyIfReady(request);
1301
1302
  else
1302
1303
  try {
1303
- (streamTask.model = entry.value),
1304
- request.pendingChunks++,
1305
- tryStreamTask(request, streamTask),
1304
+ request.pendingChunks++,
1305
+ (streamTask.model = entry.value),
1306
+ isByteStream
1307
+ ? emitTypedArrayChunk(
1308
+ request,
1309
+ streamTask.id,
1310
+ "b",
1311
+ streamTask.model,
1312
+ !1
1313
+ )
1314
+ : tryStreamTask(request, streamTask),
1306
1315
  enqueueFlush(request),
1307
1316
  reader.read().then(progress, error);
1308
- } catch (x$0) {
1309
- error(x$0);
1317
+ } catch (x$6) {
1318
+ error(x$6);
1310
1319
  }
1311
1320
  }
1312
1321
  function error(reason) {
1313
- 0 === streamTask.status &&
1322
+ streamTask.status === PENDING$1 &&
1314
1323
  (request.cacheController.signal.removeEventListener(
1315
1324
  "abort",
1316
1325
  abortStream
@@ -1320,11 +1329,11 @@
1320
1329
  reader.cancel(reason).then(error, error));
1321
1330
  }
1322
1331
  function abortStream() {
1323
- if (0 === streamTask.status) {
1332
+ if (streamTask.status === PENDING$1) {
1324
1333
  var signal = request.cacheController.signal;
1325
1334
  signal.removeEventListener("abort", abortStream);
1326
1335
  signal = signal.reason;
1327
- 21 === request.type
1336
+ request.type === PRERENDER
1328
1337
  ? (request.abortableTasks.delete(streamTask),
1329
1338
  haltTask(streamTask),
1330
1339
  finishHaltedTask(streamTask, request))
@@ -1339,7 +1348,8 @@
1339
1348
  } catch (x) {
1340
1349
  supportsBYOB = !1;
1341
1350
  }
1342
- var reader = stream.getReader(),
1351
+ var isByteStream = supportsBYOB,
1352
+ reader = stream.getReader(),
1343
1353
  streamTask = createTask(
1344
1354
  request,
1345
1355
  task.model,
@@ -1354,7 +1364,7 @@
1354
1364
  );
1355
1365
  request.pendingChunks++;
1356
1366
  task =
1357
- streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
1367
+ streamTask.id.toString(16) + ":" + (isByteStream ? "r" : "R") + "\n";
1358
1368
  request.completedRegularChunks.push(stringToChunk(task));
1359
1369
  request.cacheController.signal.addEventListener("abort", abortStream);
1360
1370
  reader.read().then(progress, error);
@@ -1362,9 +1372,9 @@
1362
1372
  }
1363
1373
  function serializeAsyncIterable(request, task, iterable, iterator) {
1364
1374
  function progress(entry) {
1365
- if (0 === streamTask.status)
1375
+ if (streamTask.status === PENDING$1)
1366
1376
  if (entry.done) {
1367
- streamTask.status = 1;
1377
+ streamTask.status = COMPLETED;
1368
1378
  if (void 0 === entry.value)
1369
1379
  var endStreamRow = streamTask.id.toString(16) + ":C\n";
1370
1380
  else
@@ -1394,12 +1404,12 @@
1394
1404
  tryStreamTask(request, streamTask),
1395
1405
  enqueueFlush(request),
1396
1406
  callIteratorInDEV(iterator, progress, error);
1397
- } catch (x$1) {
1398
- error(x$1);
1407
+ } catch (x$7) {
1408
+ error(x$7);
1399
1409
  }
1400
1410
  }
1401
1411
  function error(reason) {
1402
- 0 === streamTask.status &&
1412
+ streamTask.status === PENDING$1 &&
1403
1413
  (request.cacheController.signal.removeEventListener(
1404
1414
  "abort",
1405
1415
  abortIterable
@@ -1410,11 +1420,11 @@
1410
1420
  iterator.throw(reason).then(noop, noop));
1411
1421
  }
1412
1422
  function abortIterable() {
1413
- if (0 === streamTask.status) {
1423
+ if (streamTask.status === PENDING$1) {
1414
1424
  var signal = request.cacheController.signal;
1415
1425
  signal.removeEventListener("abort", abortIterable);
1416
1426
  var reason = signal.reason;
1417
- 21 === request.type
1427
+ request.type === PRERENDER
1418
1428
  ? (request.abortableTasks.delete(streamTask),
1419
1429
  haltTask(streamTask),
1420
1430
  finishHaltedTask(streamTask, request))
@@ -1536,43 +1546,49 @@
1536
1546
  result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1);
1537
1547
  var iteratorFn = getIteratorFn(result);
1538
1548
  if (iteratorFn) {
1539
- var multiShot = _defineProperty({}, Symbol.iterator, function () {
1540
- var iterator = iteratorFn.call(result);
1541
- iterator !== result ||
1542
- ("[object GeneratorFunction]" ===
1543
- Object.prototype.toString.call(Component) &&
1544
- "[object Generator]" ===
1545
- Object.prototype.toString.call(result)) ||
1546
- callWithDebugContextInDEV(request, task, function () {
1547
- console.error(
1548
- "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
1549
- );
1550
- });
1551
- return iterator;
1552
- });
1553
- multiShot._debugInfo = result._debugInfo;
1554
- return multiShot;
1555
- }
1556
- return "function" !== typeof result[ASYNC_ITERATOR] ||
1557
- ("function" === typeof ReadableStream &&
1558
- result instanceof ReadableStream)
1559
- ? result
1560
- : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () {
1561
- var iterator = result[ASYNC_ITERATOR]();
1549
+ var $jscomp$compprop0 = {};
1550
+ $jscomp$compprop0 =
1551
+ (($jscomp$compprop0[Symbol.iterator] = function () {
1552
+ var iterator = iteratorFn.call(result);
1562
1553
  iterator !== result ||
1563
- ("[object AsyncGeneratorFunction]" ===
1554
+ ("[object GeneratorFunction]" ===
1564
1555
  Object.prototype.toString.call(Component) &&
1565
- "[object AsyncGenerator]" ===
1556
+ "[object Generator]" ===
1566
1557
  Object.prototype.toString.call(result)) ||
1567
1558
  callWithDebugContextInDEV(request, task, function () {
1568
1559
  console.error(
1569
- "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1560
+ "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
1570
1561
  );
1571
1562
  });
1572
1563
  return iterator;
1573
- })),
1574
- (multiShot._debugInfo = result._debugInfo),
1575
- multiShot);
1564
+ }),
1565
+ $jscomp$compprop0);
1566
+ $jscomp$compprop0._debugInfo = result._debugInfo;
1567
+ return $jscomp$compprop0;
1568
+ }
1569
+ return "function" !== typeof result[ASYNC_ITERATOR] ||
1570
+ ("function" === typeof ReadableStream &&
1571
+ result instanceof ReadableStream)
1572
+ ? result
1573
+ : (($jscomp$compprop0 = {}),
1574
+ ($jscomp$compprop0 =
1575
+ (($jscomp$compprop0[ASYNC_ITERATOR] = function () {
1576
+ var iterator = result[ASYNC_ITERATOR]();
1577
+ iterator !== result ||
1578
+ ("[object AsyncGeneratorFunction]" ===
1579
+ Object.prototype.toString.call(Component) &&
1580
+ "[object AsyncGenerator]" ===
1581
+ Object.prototype.toString.call(result)) ||
1582
+ callWithDebugContextInDEV(request, task, function () {
1583
+ console.error(
1584
+ "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1585
+ );
1586
+ });
1587
+ return iterator;
1588
+ }),
1589
+ $jscomp$compprop0)),
1590
+ ($jscomp$compprop0._debugInfo = result._debugInfo),
1591
+ $jscomp$compprop0);
1576
1592
  }
1577
1593
  function renderFunctionComponent(
1578
1594
  request,
@@ -1686,7 +1702,12 @@
1686
1702
  Component = task.keyPath;
1687
1703
  componentDebugInfo = task.implicitSlot;
1688
1704
  null !== key
1689
- ? (task.keyPath = null === Component ? key : Component + "," + key)
1705
+ ? (task.keyPath =
1706
+ key === REACT_OPTIMISTIC_KEY || Component === REACT_OPTIMISTIC_KEY
1707
+ ? REACT_OPTIMISTIC_KEY
1708
+ : null === Component
1709
+ ? key
1710
+ : Component + "," + key)
1690
1711
  : null === Component && (task.implicitSlot = !0);
1691
1712
  request = renderModelDestructive(request, task, emptyRoot, "", props);
1692
1713
  task.keyPath = Component;
@@ -1815,7 +1836,7 @@
1815
1836
  task.debugTask
1816
1837
  );
1817
1838
  retryTask(request, task);
1818
- return 1 === task.status
1839
+ return task.status === COMPLETED
1819
1840
  ? serializeByValueID(task.id)
1820
1841
  : serializeLazyID(task.id);
1821
1842
  }
@@ -1926,7 +1947,13 @@
1926
1947
  validated
1927
1948
  );
1928
1949
  ref = task.keyPath;
1929
- null === key ? (key = ref) : null !== ref && (key = ref + "," + key);
1950
+ null === key
1951
+ ? (key = ref)
1952
+ : null !== ref &&
1953
+ (key =
1954
+ ref === REACT_OPTIMISTIC_KEY || key === REACT_OPTIMISTIC_KEY
1955
+ ? REACT_OPTIMISTIC_KEY
1956
+ : ref + "," + key);
1930
1957
  newFormatContext = null;
1931
1958
  ref = task.debugOwner;
1932
1959
  null !== ref && outlineComponentInfo(request, ref);
@@ -1960,7 +1987,7 @@
1960
1987
  pingedTasks.push(task);
1961
1988
  1 === pingedTasks.length &&
1962
1989
  ((request.flushScheduled = null !== request.destination),
1963
- 21 === request.type || 10 === request.status
1990
+ request.type === PRERENDER || request.status === OPENING
1964
1991
  ? scheduleMicrotask(function () {
1965
1992
  return performWork(request);
1966
1993
  })
@@ -1979,9 +2006,35 @@
1979
2006
  debugOwner,
1980
2007
  debugStack,
1981
2008
  debugTask
2009
+ ) {
2010
+ return createTaskWithID(
2011
+ request,
2012
+ request.nextChunkId++,
2013
+ model,
2014
+ keyPath,
2015
+ implicitSlot,
2016
+ formatContext,
2017
+ abortSet,
2018
+ lastTimestamp,
2019
+ debugOwner,
2020
+ debugStack,
2021
+ debugTask
2022
+ );
2023
+ }
2024
+ function createTaskWithID(
2025
+ request,
2026
+ id,
2027
+ model,
2028
+ keyPath,
2029
+ implicitSlot,
2030
+ formatContext,
2031
+ abortSet,
2032
+ lastTimestamp,
2033
+ debugOwner,
2034
+ debugStack,
2035
+ debugTask
1982
2036
  ) {
1983
2037
  request.pendingChunks++;
1984
- var id = request.nextChunkId++;
1985
2038
  "object" !== typeof model ||
1986
2039
  null === model ||
1987
2040
  null !== keyPath ||
@@ -1989,7 +2042,7 @@
1989
2042
  request.writtenObjects.set(model, serializeByValueID(id));
1990
2043
  var task = {
1991
2044
  id: id,
1992
- status: 0,
2045
+ status: PENDING$1,
1993
2046
  model: model,
1994
2047
  keyPath: keyPath,
1995
2048
  implicitSlot: implicitSlot,
@@ -1997,32 +2050,6 @@
1997
2050
  ping: function () {
1998
2051
  return pingTask(request, task);
1999
2052
  },
2000
- toJSON: function (parentPropertyName, value) {
2001
- var parent = this,
2002
- originalValue = parent[parentPropertyName];
2003
- "object" !== typeof originalValue ||
2004
- originalValue === value ||
2005
- originalValue instanceof Date ||
2006
- callWithDebugContextInDEV(request, task, function () {
2007
- "Object" !== objectName(originalValue)
2008
- ? "string" === typeof jsxChildrenParents.get(parent)
2009
- ? console.error(
2010
- "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
2011
- objectName(originalValue),
2012
- describeObjectForErrorMessage(parent, parentPropertyName)
2013
- )
2014
- : console.error(
2015
- "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
2016
- objectName(originalValue),
2017
- describeObjectForErrorMessage(parent, parentPropertyName)
2018
- )
2019
- : console.error(
2020
- "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",
2021
- describeObjectForErrorMessage(parent, parentPropertyName)
2022
- );
2023
- });
2024
- return renderModel(request, task, parent, parentPropertyName, value);
2025
- },
2026
2053
  thenableState: null,
2027
2054
  timed: !1
2028
2055
  };
@@ -2034,6 +2061,74 @@
2034
2061
  abortSet.add(task);
2035
2062
  return task;
2036
2063
  }
2064
+ function resolveModel(request, task, parent, parentPropertyName, value) {
2065
+ var jsonValue = value;
2066
+ null !== value &&
2067
+ "object" === typeof value &&
2068
+ "function" === typeof value.toJSON &&
2069
+ (jsonValue = value.toJSON(parentPropertyName));
2070
+ var originalValue = parent[parentPropertyName];
2071
+ "object" !== typeof originalValue ||
2072
+ originalValue === jsonValue ||
2073
+ originalValue instanceof Date ||
2074
+ callWithDebugContextInDEV(request, task, function () {
2075
+ ArrayBuffer.isView(originalValue)
2076
+ ? console.error(
2077
+ "Binary data with a toJSON method, such as a Node.js Buffer, is serialized through toJSON instead of as binary. Pass a Uint8Array or ArrayBuffer to send binary data.%s",
2078
+ describeObjectForErrorMessage(parent, parentPropertyName)
2079
+ )
2080
+ : "Object" !== objectName(originalValue)
2081
+ ? "string" === typeof jsxChildrenParents.get(parent)
2082
+ ? console.error(
2083
+ "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
2084
+ objectName(originalValue),
2085
+ describeObjectForErrorMessage(parent, parentPropertyName)
2086
+ )
2087
+ : console.error(
2088
+ "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
2089
+ objectName(originalValue),
2090
+ describeObjectForErrorMessage(parent, parentPropertyName)
2091
+ )
2092
+ : console.error(
2093
+ "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",
2094
+ describeObjectForErrorMessage(parent, parentPropertyName)
2095
+ );
2096
+ });
2097
+ value = renderModel(request, task, parent, parentPropertyName, jsonValue);
2098
+ if (null === value || "object" !== typeof value) return value;
2099
+ if (isArrayImpl(value)) {
2100
+ var _resolved = [];
2101
+ for (jsonValue = 0; jsonValue < value.length; jsonValue++)
2102
+ _resolved[jsonValue] = resolveModel(
2103
+ request,
2104
+ task,
2105
+ value,
2106
+ "" + jsonValue,
2107
+ value[jsonValue]
2108
+ );
2109
+ return _resolved;
2110
+ }
2111
+ jsonValue = {};
2112
+ for (_resolved in value)
2113
+ if (hasOwnProperty.call(value, _resolved)) {
2114
+ var resolvedValue = resolveModel(
2115
+ request,
2116
+ task,
2117
+ value,
2118
+ _resolved,
2119
+ value[_resolved]
2120
+ );
2121
+ _resolved === __PROTO__$1
2122
+ ? Object.defineProperty(jsonValue, _resolved, {
2123
+ value: resolvedValue,
2124
+ enumerable: !0,
2125
+ writable: !0,
2126
+ configurable: !0
2127
+ })
2128
+ : (jsonValue[_resolved] = resolvedValue);
2129
+ }
2130
+ return jsonValue;
2131
+ }
2037
2132
  function serializeByValueID(id) {
2038
2133
  return "$" + id.toString(16);
2039
2134
  }
@@ -2083,12 +2178,13 @@
2083
2178
  : serializeByValueID(existingId);
2084
2179
  try {
2085
2180
  var clientReferenceMetadata = resolveClientReferenceMetadata(
2086
- request.bundlerConfig,
2087
- clientReference
2088
- );
2181
+ request.bundlerConfig,
2182
+ clientReference
2183
+ ),
2184
+ json = stringifyImportMetadata(request, clientReferenceMetadata, !1);
2089
2185
  request.pendingChunks++;
2090
2186
  var importId = request.nextChunkId++;
2091
- emitImportChunk(request, importId, clientReferenceMetadata, !1);
2187
+ emitImportChunk(request, importId, json, !1);
2092
2188
  writtenClientReferences.set(clientReferenceKey, importId);
2093
2189
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2094
2190
  ? serializeLazyID(importId)
@@ -2120,12 +2216,13 @@
2120
2216
  : serializeByValueID(existingId);
2121
2217
  try {
2122
2218
  var clientReferenceMetadata = resolveClientReferenceMetadata(
2123
- request.bundlerConfig,
2124
- clientReference
2125
- );
2219
+ request.bundlerConfig,
2220
+ clientReference
2221
+ ),
2222
+ json = stringifyImportMetadata(request, clientReferenceMetadata, !0);
2126
2223
  request.pendingDebugChunks++;
2127
2224
  var importId = request.nextChunkId++;
2128
- emitImportChunk(request, importId, clientReferenceMetadata, !0);
2225
+ emitImportChunk(request, importId, json, !0);
2129
2226
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2130
2227
  ? serializeLazyID(importId)
2131
2228
  : serializeByValueID(importId);
@@ -2214,6 +2311,8 @@
2214
2311
  return serializeByValueID(bufferId);
2215
2312
  }
2216
2313
  function serializeDebugTypedArray(request, tag, typedArray) {
2314
+ if (1e3 < typedArray.byteLength && !doNotLimit.has(typedArray))
2315
+ return serializeDeferredObject(request, typedArray);
2217
2316
  request.pendingDebugChunks++;
2218
2317
  var bufferId = request.nextChunkId++;
2219
2318
  emitTypedArrayChunk(request, bufferId, tag, typedArray, !0);
@@ -2248,7 +2347,7 @@
2248
2347
  }
2249
2348
  function serializeBlob(request, blob) {
2250
2349
  function progress(entry) {
2251
- if (0 === newTask.status)
2350
+ if (newTask.status === PENDING$1)
2252
2351
  if (entry.done)
2253
2352
  request.cacheController.signal.removeEventListener(
2254
2353
  "abort",
@@ -2261,7 +2360,7 @@
2261
2360
  );
2262
2361
  }
2263
2362
  function error(reason) {
2264
- 0 === newTask.status &&
2363
+ newTask.status === PENDING$1 &&
2265
2364
  (request.cacheController.signal.removeEventListener(
2266
2365
  "abort",
2267
2366
  abortBlob
@@ -2271,11 +2370,11 @@
2271
2370
  reader.cancel(reason).then(error, error));
2272
2371
  }
2273
2372
  function abortBlob() {
2274
- if (0 === newTask.status) {
2373
+ if (newTask.status === PENDING$1) {
2275
2374
  var signal = request.cacheController.signal;
2276
2375
  signal.removeEventListener("abort", abortBlob);
2277
2376
  signal = signal.reason;
2278
- 21 === request.type
2377
+ request.type === PRERENDER
2279
2378
  ? (request.abortableTasks.delete(newTask),
2280
2379
  haltTask(newTask),
2281
2380
  finishHaltedTask(newTask, request))
@@ -2301,6 +2400,29 @@
2301
2400
  reader.read().then(progress).catch(error);
2302
2401
  return "$B" + newTask.id.toString(16);
2303
2402
  }
2403
+ function escapeStringValue(value) {
2404
+ return "$" === value[0] ? "$" + value : value;
2405
+ }
2406
+ function serializeImportString(request, value) {
2407
+ if (value.length < MIN_DEDUPLICATED_IMPORT_STRING_LENGTH)
2408
+ return escapeStringValue(value);
2409
+ var writtenStrings = request.writtenImportStrings,
2410
+ existing = writtenStrings.get(value);
2411
+ if (void 0 !== existing) return existing;
2412
+ existing = request.writtenImportStringsSize + value.length;
2413
+ if (existing > MAX_DEDUPLICATED_IMPORT_STRINGS_SIZE)
2414
+ return escapeStringValue(value);
2415
+ request.writtenImportStringsSize = existing;
2416
+ request.pendingChunks++;
2417
+ existing = request.nextChunkId++;
2418
+ var json = stringify(escapeStringValue(value));
2419
+ request.completedImportChunks.push(
2420
+ stringToChunk(existing.toString(16) + ":" + json + "\n")
2421
+ );
2422
+ request = serializeByValueID(existing);
2423
+ writtenStrings.set(value, request);
2424
+ return request;
2425
+ }
2304
2426
  function renderModel(request, task, parent, key, value) {
2305
2427
  serializedSize += key.length;
2306
2428
  var prevKeyPath = task.keyPath,
@@ -2315,8 +2437,8 @@
2315
2437
  (parent.$$typeof === REACT_ELEMENT_TYPE ||
2316
2438
  parent.$$typeof === REACT_LAZY_TYPE);
2317
2439
  if (request.status === ABORTING) {
2318
- task.status = 3;
2319
- if (21 === request.type)
2440
+ task.status = ABORTED;
2441
+ if (request.type === PRERENDER)
2320
2442
  return (
2321
2443
  (task = request.nextChunkId++),
2322
2444
  (task = parent
@@ -2384,7 +2506,7 @@
2384
2506
  value
2385
2507
  ) {
2386
2508
  task.model = value;
2387
- "__proto__" === parentPropertyName &&
2509
+ parentPropertyName === __PROTO__$1 &&
2388
2510
  callWithDebugContextInDEV(request, task, function () {
2389
2511
  console.error(
2390
2512
  "Expected not to serialize an object with own property `__proto__`. When parsed this property will be omitted.%s",
@@ -2428,7 +2550,9 @@
2428
2550
  void 0 === value._debugTask
2429
2551
  ) {
2430
2552
  var key = "";
2431
- null !== value.key && (key = ' key="' + value.key + '"');
2553
+ null !== value.key &&
2554
+ value.key !== REACT_OPTIMISTIC_KEY &&
2555
+ (key = ' key="' + value.key + '"');
2432
2556
  console.error(
2433
2557
  "Attempted to render <%s%s> without development properties. This is not supported. It can happen if:\n- The element is created with a production version of React but rendered in development.\n- The element was cloned with a custom function instead of `React.cloneElement`.\nThe props of this element may help locate this element: %o",
2434
2558
  value.type,
@@ -2463,8 +2587,8 @@
2463
2587
  return renderModelDestructive(
2464
2588
  request,
2465
2589
  task,
2466
- emptyRoot,
2467
- "",
2590
+ parent,
2591
+ parentPropertyName,
2468
2592
  elementReference
2469
2593
  );
2470
2594
  case REACT_LEGACY_ELEMENT_TYPE:
@@ -2628,9 +2752,7 @@
2628
2752
  ? "$D" + value
2629
2753
  : 1024 <= value.length && null !== byteLengthOfChunk
2630
2754
  ? serializeLargeTextString(request, value)
2631
- : "$" === value[0]
2632
- ? "$" + value
2633
- : value
2755
+ : escapeStringValue(value)
2634
2756
  );
2635
2757
  if ("boolean" === typeof value) return value;
2636
2758
  if ("number" === typeof value) return serializeNumber(value);
@@ -2744,7 +2866,7 @@
2744
2866
  null !== request.destination
2745
2867
  ? ((request.status = CLOSED),
2746
2868
  closeWithError(request.destination, error))
2747
- : ((request.status = 13), (request.fatalError = error));
2869
+ : ((request.status = CLOSING), (request.fatalError = error));
2748
2870
  request.cacheController.abort(
2749
2871
  Error("The render was aborted due to a fatal error.", { cause: error })
2750
2872
  );
@@ -2763,19 +2885,21 @@
2763
2885
  "An error occurred but serializing the error message failed."),
2764
2886
  (stack = []);
2765
2887
  }
2766
- return (
2767
- "$Z" +
2768
- outlineModel(request, {
2769
- name: name,
2770
- message: message,
2771
- stack: stack,
2772
- env: env
2773
- }).toString(16)
2774
- );
2888
+ name = { name: name, message: message, stack: stack, env: env };
2889
+ "cause" in error &&
2890
+ ((message = outlineModel(request, error.cause)),
2891
+ (name.cause = serializeByValueID(message)));
2892
+ "undefined" !== typeof AggregateError &&
2893
+ error instanceof AggregateError &&
2894
+ ((error = outlineModel(request, error.errors)),
2895
+ (name.errors = serializeByValueID(error)));
2896
+ return "$Z" + outlineModel(request, name).toString(16);
2775
2897
  }
2776
2898
  function emitErrorChunk(request, id, digest, error, debug, owner) {
2777
2899
  var name = "Error",
2778
- env = (0, request.environmentName)();
2900
+ env = (0, request.environmentName)(),
2901
+ causeReference = null,
2902
+ errorsReference = null;
2779
2903
  try {
2780
2904
  if (error instanceof Error) {
2781
2905
  name = error.name;
@@ -2783,6 +2907,23 @@
2783
2907
  var stack = filterStackTrace(request, parseStackTrace(error, 0));
2784
2908
  var errorEnv = error.environmentName;
2785
2909
  "string" === typeof errorEnv && (env = errorEnv);
2910
+ if ("cause" in error) {
2911
+ var cause = error.cause,
2912
+ causeId = debug
2913
+ ? outlineDebugModel(request, { objectLimit: 5 }, cause)
2914
+ : outlineModel(request, cause);
2915
+ causeReference = serializeByValueID(causeId);
2916
+ }
2917
+ if (
2918
+ "undefined" !== typeof AggregateError &&
2919
+ error instanceof AggregateError
2920
+ ) {
2921
+ var errors = error.errors,
2922
+ errorsId = debug
2923
+ ? outlineDebugModel(request, { objectLimit: 5 }, errors)
2924
+ : outlineModel(request, errors);
2925
+ errorsReference = serializeByValueID(errorsId);
2926
+ }
2786
2927
  } else
2787
2928
  (message =
2788
2929
  "object" === typeof error && null !== error
@@ -2803,15 +2944,101 @@
2803
2944
  env: env,
2804
2945
  owner: error
2805
2946
  };
2947
+ null !== causeReference && (digest.cause = causeReference);
2948
+ null !== errorsReference && (digest.errors = errorsReference);
2806
2949
  id = id.toString(16) + ":E" + stringify(digest) + "\n";
2807
2950
  id = stringToChunk(id);
2808
2951
  debug
2809
2952
  ? request.completedDebugChunks.push(id)
2810
2953
  : request.completedErrorChunks.push(id);
2811
2954
  }
2812
- function emitImportChunk(request, id, clientReferenceMetadata, debug) {
2813
- clientReferenceMetadata = stringify(clientReferenceMetadata);
2814
- id = id.toString(16) + ":I" + clientReferenceMetadata + "\n";
2955
+ function importMetadataReplacer(key, value) {
2956
+ return "string" === typeof value
2957
+ ? ((key = importStringRequest),
2958
+ null === key
2959
+ ? escapeStringValue(value)
2960
+ : serializeImportString(key, value))
2961
+ : value;
2962
+ }
2963
+ function transformImportMetadata(request, value, depth) {
2964
+ switch (typeof value) {
2965
+ case "string":
2966
+ return serializeImportString(request, value);
2967
+ case "number":
2968
+ case "boolean":
2969
+ case "undefined":
2970
+ return value;
2971
+ case "object":
2972
+ if (null === value) return null;
2973
+ if (
2974
+ depth > MAX_IMPORT_METADATA_DEPTH ||
2975
+ "function" === typeof value.toJSON
2976
+ )
2977
+ return NOT_PLAIN_IMPORT_METADATA;
2978
+ if (isArrayImpl(value)) {
2979
+ for (
2980
+ var length = value.length, _copy = Array(length), i = 0;
2981
+ i < length;
2982
+ i++
2983
+ ) {
2984
+ var element = value[i];
2985
+ if ("string" === typeof element)
2986
+ _copy[i] = serializeImportString(request, element);
2987
+ else {
2988
+ element = transformImportMetadata(request, element, depth + 1);
2989
+ if (element === NOT_PLAIN_IMPORT_METADATA)
2990
+ return NOT_PLAIN_IMPORT_METADATA;
2991
+ _copy[i] = element;
2992
+ }
2993
+ }
2994
+ return _copy;
2995
+ }
2996
+ length = getPrototypeOf(value);
2997
+ if (length !== ObjectPrototype$1 && null !== length)
2998
+ return NOT_PLAIN_IMPORT_METADATA;
2999
+ length = Object.keys(value);
3000
+ _copy = {};
3001
+ for (i = 0; i < length.length; i++) {
3002
+ element = length[i];
3003
+ if (element in ObjectPrototype$1) return NOT_PLAIN_IMPORT_METADATA;
3004
+ var _element = value[element];
3005
+ if ("string" === typeof _element)
3006
+ _copy[element] = serializeImportString(request, _element);
3007
+ else {
3008
+ _element = transformImportMetadata(request, _element, depth + 1);
3009
+ if (_element === NOT_PLAIN_IMPORT_METADATA)
3010
+ return NOT_PLAIN_IMPORT_METADATA;
3011
+ _copy[element] = _element;
3012
+ }
3013
+ }
3014
+ return _copy;
3015
+ default:
3016
+ return NOT_PLAIN_IMPORT_METADATA;
3017
+ }
3018
+ }
3019
+ function stringifyImportMetadata(request, clientReferenceMetadata, debug) {
3020
+ if (!debug) {
3021
+ var copy = transformImportMetadata(request, clientReferenceMetadata, 0);
3022
+ if (copy !== NOT_PLAIN_IMPORT_METADATA) return stringify(copy);
3023
+ }
3024
+ a: {
3025
+ copy = importStringRequest;
3026
+ importStringRequest = debug ? null : request;
3027
+ try {
3028
+ var JSCompiler_inline_result = stringify(
3029
+ clientReferenceMetadata,
3030
+ importMetadataReplacer
3031
+ );
3032
+ break a;
3033
+ } finally {
3034
+ importStringRequest = copy;
3035
+ }
3036
+ JSCompiler_inline_result = void 0;
3037
+ }
3038
+ return JSCompiler_inline_result;
3039
+ }
3040
+ function emitImportChunk(request, id, json, debug) {
3041
+ id = id.toString(16) + ":I" + json + "\n";
2815
3042
  id = stringToChunk(id);
2816
3043
  debug
2817
3044
  ? request.completedDebugChunks.push(id)
@@ -2834,12 +3061,15 @@
2834
3061
  function emitDebugChunk(request, id, debugInfo) {
2835
3062
  var json = serializeDebugModel(request, 500, debugInfo);
2836
3063
  null !== request.debugDestination
2837
- ? ((debugInfo = request.nextChunkId++),
2838
- (json = debugInfo.toString(16) + ":" + json + "\n"),
2839
- request.pendingDebugChunks++,
2840
- request.completedDebugChunks.push(stringToChunk(json)),
2841
- (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'),
2842
- request.completedRegularChunks.push(stringToChunk(id)))
3064
+ ? '"' === json[0] && "$" === json[1]
3065
+ ? ((id = id.toString(16) + ":D" + json + "\n"),
3066
+ request.completedRegularChunks.push(stringToChunk(id)))
3067
+ : ((debugInfo = request.nextChunkId++),
3068
+ (json = debugInfo.toString(16) + ":" + json + "\n"),
3069
+ request.pendingDebugChunks++,
3070
+ request.completedDebugChunks.push(stringToChunk(json)),
3071
+ (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'),
3072
+ request.completedRegularChunks.push(stringToChunk(id)))
2843
3073
  : ((id = id.toString(16) + ":D" + json + "\n"),
2844
3074
  request.completedRegularChunks.push(stringToChunk(id)));
2845
3075
  }
@@ -2875,18 +3105,25 @@
2875
3105
  }
2876
3106
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
2877
3107
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2878
- var buffer = new Uint8Array(
3108
+ typedArray = new Uint8Array(
2879
3109
  typedArray.buffer,
2880
3110
  typedArray.byteOffset,
2881
3111
  typedArray.byteLength
2882
3112
  );
2883
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2884
- buffer = typedArray.byteLength;
2885
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
3113
+ var binaryLength = typedArray.byteLength;
3114
+ id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ",";
2886
3115
  id = stringToChunk(id);
2887
3116
  debug
2888
- ? request.completedDebugChunks.push(id, typedArray)
2889
- : request.completedRegularChunks.push(id, typedArray);
3117
+ ? request.completedDebugChunks.push(
3118
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3119
+ id,
3120
+ typedArray
3121
+ )
3122
+ : request.completedRegularChunks.push(
3123
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3124
+ id,
3125
+ typedArray
3126
+ );
2890
3127
  }
2891
3128
  function emitTextChunk(request, id, text, debug) {
2892
3129
  if (null === byteLengthOfChunk)
@@ -2899,8 +3136,16 @@
2899
3136
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
2900
3137
  id = stringToChunk(id);
2901
3138
  debug
2902
- ? request.completedDebugChunks.push(id, text)
2903
- : request.completedRegularChunks.push(id, text);
3139
+ ? request.completedDebugChunks.push(
3140
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3141
+ id,
3142
+ text
3143
+ )
3144
+ : request.completedRegularChunks.push(
3145
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3146
+ id,
3147
+ text
3148
+ );
2904
3149
  }
2905
3150
  function renderDebugModel(
2906
3151
  request,
@@ -3079,7 +3324,11 @@
3079
3324
  }
3080
3325
  if ("function" === typeof value.then)
3081
3326
  return serializeDebugThenable(request, counter, value);
3082
- if (isArrayImpl(value)) return value;
3327
+ if (isArrayImpl(value))
3328
+ return 200 < value.length && !doNotLimit.has(value)
3329
+ ? serializeDeferredObject(request, value)
3330
+ : value;
3331
+ if (value instanceof Date) return "$D" + value.toJSON();
3083
3332
  if (value instanceof Map) {
3084
3333
  value = Array.from(value);
3085
3334
  counter.objectLimit++;
@@ -3114,25 +3363,35 @@
3114
3363
  ).toString(16)
3115
3364
  );
3116
3365
  if (value instanceof Error) {
3117
- counter = "Error";
3118
- var env = (0, request.environmentName)();
3366
+ var name = "Error";
3367
+ parent = (0, request.environmentName)();
3119
3368
  try {
3120
- (counter = value.name),
3121
- (ref = String(value.message)),
3122
- (key = filterStackTrace(request, parseStackTrace(value, 0))),
3369
+ (name = value.name),
3370
+ (key = String(value.message)),
3371
+ (ref = filterStackTrace(request, parseStackTrace(value, 0))),
3123
3372
  (entry = value.environmentName),
3124
- "string" === typeof entry && (env = entry);
3373
+ "string" === typeof entry && (parent = entry);
3125
3374
  } catch (x) {
3126
- (ref =
3375
+ (key =
3127
3376
  "An error occurred but serializing the error message failed."),
3128
- (key = []);
3377
+ (ref = []);
3129
3378
  }
3379
+ key = { name: name, message: key, stack: ref, env: parent };
3380
+ "cause" in value &&
3381
+ (counter.objectLimit--,
3382
+ (entry = outlineDebugModel(request, counter, value.cause)),
3383
+ (key.cause = serializeByValueID(entry)));
3384
+ "undefined" !== typeof AggregateError &&
3385
+ value instanceof AggregateError &&
3386
+ (counter.objectLimit--,
3387
+ (value = outlineDebugModel(request, counter, value.errors)),
3388
+ (key.errors = serializeByValueID(value)));
3130
3389
  request =
3131
3390
  "$Z" +
3132
3391
  outlineDebugModel(
3133
3392
  request,
3134
- { objectLimit: 2 * key.length + 1 },
3135
- { name: counter, message: ref, stack: key, env: env }
3393
+ { objectLimit: 2 * ref.length + 1 },
3394
+ key
3136
3395
  ).toString(16);
3137
3396
  return request;
3138
3397
  }
@@ -3168,9 +3427,9 @@
3168
3427
  request = getPrototypeOf(value);
3169
3428
  if (request !== ObjectPrototype$1 && null !== request) {
3170
3429
  counter = Object.create(null);
3171
- for (env in value)
3172
- if (hasOwnProperty.call(value, env) || isGetter(request, env))
3173
- counter[env] = value[env];
3430
+ for (name in value)
3431
+ if (hasOwnProperty.call(value, name) || isGetter(request, name))
3432
+ counter[name] = value[name];
3174
3433
  ref = request.constructor;
3175
3434
  "function" !== typeof ref ||
3176
3435
  ref.prototype !== request ||
@@ -3182,11 +3441,12 @@
3182
3441
  return value;
3183
3442
  }
3184
3443
  if ("string" === typeof value) {
3185
- if (
3186
- "Z" === value[value.length - 1] &&
3187
- parent[parentPropertyName] instanceof Date
3188
- )
3189
- return "$D" + value;
3444
+ if (1e6 < value.length)
3445
+ return (
3446
+ "This string of length " +
3447
+ value.length +
3448
+ " has been omitted by React to avoid sending too much data from the server."
3449
+ );
3190
3450
  if (1024 <= value.length) {
3191
3451
  if (0 >= counter.objectLimit)
3192
3452
  return serializeDeferredObject(request, value);
@@ -3196,7 +3456,7 @@
3196
3456
  emitTextChunk(request, counter, value, !0);
3197
3457
  return serializeByValueID(counter);
3198
3458
  }
3199
- return "$" === value[0] ? "$" + value : value;
3459
+ return escapeStringValue(value);
3200
3460
  }
3201
3461
  if ("boolean" === typeof value) return value;
3202
3462
  if ("number" === typeof value) return serializeNumber(value);
@@ -3248,19 +3508,17 @@
3248
3508
  }
3249
3509
  return "bigint" === typeof value
3250
3510
  ? "$n" + value.toString(10)
3251
- : value instanceof Date
3252
- ? "$D" + value.toJSON()
3253
- : "unknown type " + typeof value;
3511
+ : "unknown type " + typeof value;
3254
3512
  }
3255
3513
  function serializeDebugModel(request, objectLimit, model) {
3256
- function replacer(parentPropertyName, value) {
3514
+ function replacer(parentPropertyName) {
3257
3515
  try {
3258
3516
  return renderDebugModel(
3259
3517
  request,
3260
3518
  counter,
3261
3519
  this,
3262
3520
  parentPropertyName,
3263
- value
3521
+ this[parentPropertyName]
3264
3522
  );
3265
3523
  } catch (x) {
3266
3524
  return (
@@ -3284,14 +3542,14 @@
3284
3542
  }
3285
3543
  }
3286
3544
  function emitOutlinedDebugModelChunk(request, id, counter, model) {
3287
- function replacer(parentPropertyName, value) {
3545
+ function replacer(parentPropertyName) {
3288
3546
  try {
3289
3547
  return renderDebugModel(
3290
3548
  request,
3291
3549
  counter,
3292
3550
  this,
3293
3551
  parentPropertyName,
3294
- value
3552
+ this[parentPropertyName]
3295
3553
  );
3296
3554
  } catch (x) {
3297
3555
  return (
@@ -3358,10 +3616,11 @@
3358
3616
  parseStackTrace(ioInfo$jscomp$0.debugStack, 1)
3359
3617
  )
3360
3618
  : ioInfo$jscomp$0.stack;
3619
+ var env = ioInfo$jscomp$0.env;
3620
+ null == env && (env = (0, request.environmentName)());
3361
3621
  var request$jscomp$0 = request,
3362
3622
  id$jscomp$1 = id$jscomp$0,
3363
3623
  value = ioInfo$jscomp$0.value,
3364
- env = ioInfo$jscomp$0.env,
3365
3624
  objectLimit = 10;
3366
3625
  debugStack && (objectLimit += debugStack.length);
3367
3626
  var debugIOInfo = {
@@ -3373,12 +3632,12 @@
3373
3632
  null != debugStack && (debugIOInfo.stack = debugStack);
3374
3633
  null != owner && (debugIOInfo.owner = owner);
3375
3634
  void 0 !== value && (debugIOInfo.value = value);
3376
- value = serializeDebugModel(
3635
+ env = serializeDebugModel(
3377
3636
  request$jscomp$0,
3378
3637
  objectLimit,
3379
3638
  debugIOInfo
3380
3639
  );
3381
- id$jscomp$1 = id$jscomp$1.toString(16) + ":J" + value + "\n";
3640
+ id$jscomp$1 = id$jscomp$1.toString(16) + ":J" + env + "\n";
3382
3641
  id$jscomp$1 = stringToChunk(id$jscomp$1);
3383
3642
  request$jscomp$0.completedDebugChunks.push(id$jscomp$1);
3384
3643
  request.writtenDebugObjects.set(
@@ -3396,7 +3655,10 @@
3396
3655
  )
3397
3656
  : info.stack;
3398
3657
  ioInfo = { awaited: ioInfo };
3399
- null != info.env && (ioInfo.env = info.env);
3658
+ ioInfo.env =
3659
+ null != info.env
3660
+ ? info.env
3661
+ : (0, request$jscomp$1.environmentName)();
3400
3662
  null != info.owner && (ioInfo.owner = info.owner);
3401
3663
  null != request && (ioInfo.stack = request);
3402
3664
  request$jscomp$1.pendingChunks++;
@@ -3484,21 +3746,28 @@
3484
3746
  value,
3485
3747
  !1
3486
3748
  )
3487
- : ((value = stringify(value, task.toJSON)),
3749
+ : ((value = resolveModel(
3750
+ request,
3751
+ task,
3752
+ { "": value },
3753
+ "",
3754
+ value
3755
+ )),
3756
+ (value = stringify(value)),
3488
3757
  emitModelChunk(request, task.id, value));
3489
3758
  }
3490
3759
  function erroredTask(request, task, error) {
3491
3760
  task.timed && markOperationEndTime(request, task, performance.now());
3492
- task.status = 4;
3761
+ task.status = ERRORED$1;
3493
3762
  var digest = logRecoverableError(request, error, task);
3494
3763
  emitErrorChunk(request, task.id, digest, error, !1, task.debugOwner);
3495
3764
  request.abortableTasks.delete(task);
3496
3765
  callOnAllReadyIfReady(request);
3497
3766
  }
3498
3767
  function retryTask(request, task) {
3499
- if (0 === task.status) {
3768
+ if (task.status === PENDING$1) {
3500
3769
  var prevCanEmitDebugInfo = canEmitDebugInfo;
3501
- task.status = 5;
3770
+ task.status = RENDERING;
3502
3771
  var parentSerializedSize = serializedSize;
3503
3772
  try {
3504
3773
  modelRoot = task.model;
@@ -3529,15 +3798,15 @@
3529
3798
  var json = stringify(resolvedModel);
3530
3799
  emitModelChunk(request, task.id, json);
3531
3800
  }
3532
- task.status = 1;
3801
+ task.status = COMPLETED;
3533
3802
  request.abortableTasks.delete(task);
3534
3803
  callOnAllReadyIfReady(request);
3535
3804
  } catch (thrownValue) {
3536
3805
  if (request.status === ABORTING)
3537
3806
  if (
3538
3807
  (request.abortableTasks.delete(task),
3539
- (task.status = 0),
3540
- 21 === request.type)
3808
+ (task.status = PENDING$1),
3809
+ request.type === PRERENDER)
3541
3810
  )
3542
3811
  haltTask(task), finishHaltedTask(task, request);
3543
3812
  else {
@@ -3555,7 +3824,7 @@
3555
3824
  null !== x &&
3556
3825
  "function" === typeof x.then
3557
3826
  ) {
3558
- task.status = 0;
3827
+ task.status = PENDING$1;
3559
3828
  task.thenableState = getThenableStateAfterSuspending();
3560
3829
  var ping = task.ping;
3561
3830
  x.then(ping, ping);
@@ -3598,10 +3867,10 @@
3598
3867
  }
3599
3868
  }
3600
3869
  function abortTask(task) {
3601
- 0 === task.status && (task.status = 3);
3870
+ task.status === PENDING$1 && (task.status = ABORTED);
3602
3871
  }
3603
3872
  function finishAbortedTask(task, request, errorId) {
3604
- 3 === task.status &&
3873
+ task.status === ABORTED &&
3605
3874
  (forwardDebugInfoFromAbortedTask(request, task),
3606
3875
  task.timed && markOperationEndTime(request, task, request.abortTime),
3607
3876
  (errorId = serializeByValueID(errorId)),
@@ -3609,26 +3878,37 @@
3609
3878
  request.completedErrorChunks.push(task));
3610
3879
  }
3611
3880
  function haltTask(task) {
3612
- 0 === task.status && (task.status = 3);
3881
+ task.status === PENDING$1 && (task.status = ABORTED);
3613
3882
  }
3614
3883
  function finishHaltedTask(task, request) {
3615
- 3 === task.status &&
3884
+ task.status === ABORTED &&
3616
3885
  (forwardDebugInfoFromAbortedTask(request, task),
3617
3886
  request.pendingChunks--);
3618
3887
  }
3619
3888
  function flushCompletedChunks(request) {
3620
3889
  if (null !== request.debugDestination) {
3621
3890
  var debugDestination = request.debugDestination;
3622
- currentView = new Uint8Array(2048);
3891
+ currentView = new Uint8Array(4096);
3623
3892
  writtenBytes = 0;
3624
3893
  try {
3625
3894
  for (
3626
3895
  var debugChunks = request.completedDebugChunks, i = 0;
3627
3896
  i < debugChunks.length;
3628
3897
  i++
3629
- )
3630
- request.pendingDebugChunks--,
3631
- writeChunkAndReturn(debugDestination, debugChunks[i]);
3898
+ ) {
3899
+ var item = debugChunks[i];
3900
+ if (item === NEXT_TWO_CHUNKS_ARE_ATOMIC) {
3901
+ if (i + 2 >= debugChunks.length)
3902
+ throw Error(
3903
+ "A chunk pair is incomplete. This is a bug in React."
3904
+ );
3905
+ request.pendingDebugChunks -= 2;
3906
+ writeChunk(debugDestination, debugChunks[i + 1]);
3907
+ writeChunk(debugDestination, debugChunks[i + 2]);
3908
+ i += 2;
3909
+ } else
3910
+ request.pendingDebugChunks--, writeChunk(debugDestination, item);
3911
+ }
3632
3912
  debugChunks.splice(0, i);
3633
3913
  } finally {
3634
3914
  completeWriting(debugDestination);
@@ -3636,7 +3916,7 @@
3636
3916
  }
3637
3917
  debugDestination = request.destination;
3638
3918
  if (null !== debugDestination) {
3639
- currentView = new Uint8Array(2048);
3919
+ currentView = new Uint8Array(4096);
3640
3920
  writtenBytes = 0;
3641
3921
  try {
3642
3922
  var importsChunks = request.completedImportChunks;
@@ -3673,18 +3953,33 @@
3673
3953
  debugChunks = 0;
3674
3954
  debugChunks < _debugChunks.length;
3675
3955
  debugChunks++
3676
- )
3677
- if (
3678
- (request.pendingDebugChunks--,
3679
- !writeChunkAndReturn(
3956
+ ) {
3957
+ var _item = _debugChunks[debugChunks];
3958
+ importsChunks = void 0;
3959
+ if (_item === NEXT_TWO_CHUNKS_ARE_ATOMIC) {
3960
+ if (debugChunks + 2 >= _debugChunks.length)
3961
+ throw Error(
3962
+ "A chunk pair is incomplete. This is a bug in React."
3963
+ );
3964
+ request.pendingDebugChunks -= 2;
3965
+ writeChunk(debugDestination, _debugChunks[debugChunks + 1]);
3966
+ importsChunks = writeChunkAndReturn(
3680
3967
  debugDestination,
3681
- _debugChunks[debugChunks]
3682
- ))
3683
- ) {
3968
+ _debugChunks[debugChunks + 2]
3969
+ );
3970
+ debugChunks += 2;
3971
+ } else
3972
+ request.pendingDebugChunks--,
3973
+ (importsChunks = writeChunkAndReturn(
3974
+ debugDestination,
3975
+ _item
3976
+ ));
3977
+ if (!importsChunks) {
3684
3978
  request.destination = null;
3685
3979
  debugChunks++;
3686
3980
  break;
3687
3981
  }
3982
+ }
3688
3983
  _debugChunks.splice(0, debugChunks);
3689
3984
  }
3690
3985
  var regularChunks = request.completedRegularChunks;
@@ -3692,18 +3987,30 @@
3692
3987
  debugChunks = 0;
3693
3988
  debugChunks < regularChunks.length;
3694
3989
  debugChunks++
3695
- )
3696
- if (
3697
- (request.pendingChunks--,
3698
- !writeChunkAndReturn(
3990
+ ) {
3991
+ var _item2 = regularChunks[debugChunks];
3992
+ _debugChunks = void 0;
3993
+ if (_item2 === NEXT_TWO_CHUNKS_ARE_ATOMIC) {
3994
+ if (debugChunks + 2 >= regularChunks.length)
3995
+ throw Error(
3996
+ "A chunk pair is incomplete. This is a bug in React."
3997
+ );
3998
+ request.pendingChunks -= 2;
3999
+ writeChunk(debugDestination, regularChunks[debugChunks + 1]);
4000
+ _debugChunks = writeChunkAndReturn(
3699
4001
  debugDestination,
3700
- regularChunks[debugChunks]
3701
- ))
3702
- ) {
4002
+ regularChunks[debugChunks + 2]
4003
+ );
4004
+ debugChunks += 2;
4005
+ } else
4006
+ request.pendingChunks--,
4007
+ (_debugChunks = writeChunkAndReturn(debugDestination, _item2));
4008
+ if (!_debugChunks) {
3703
4009
  request.destination = null;
3704
4010
  debugChunks++;
3705
4011
  break;
3706
4012
  }
4013
+ }
3707
4014
  regularChunks.splice(0, debugChunks);
3708
4015
  var errorChunks = request.completedErrorChunks;
3709
4016
  for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++)
@@ -3721,16 +4028,16 @@
3721
4028
  }
3722
4029
  }
3723
4030
  0 === request.pendingChunks &&
3724
- ((importsChunks = request.debugDestination),
4031
+ (request.status < ABORTING &&
4032
+ request.cacheController.abort(
4033
+ Error(
4034
+ "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources."
4035
+ )
4036
+ ),
4037
+ (regularChunks = request.debugDestination),
3725
4038
  0 === request.pendingDebugChunks
3726
- ? (null !== importsChunks &&
3727
- (importsChunks.close(), (request.debugDestination = null)),
3728
- request.status < ABORTING &&
3729
- request.cacheController.abort(
3730
- Error(
3731
- "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources."
3732
- )
3733
- ),
4039
+ ? (null !== regularChunks &&
4040
+ (regularChunks.close(), (request.debugDestination = null)),
3734
4041
  null !== request.destination &&
3735
4042
  ((request.status = CLOSED),
3736
4043
  request.destination.close(),
@@ -3738,7 +4045,7 @@
3738
4045
  null !== request.debugDestination &&
3739
4046
  (request.debugDestination.close(),
3740
4047
  (request.debugDestination = null)))
3741
- : null !== importsChunks &&
4048
+ : null !== regularChunks &&
3742
4049
  null !== request.destination &&
3743
4050
  ((request.status = CLOSED),
3744
4051
  request.destination.close(),
@@ -3754,7 +4061,7 @@
3754
4061
  return performWork(request);
3755
4062
  });
3756
4063
  setTimeout(function () {
3757
- 10 === request.status && (request.status = 11);
4064
+ request.status === OPENING && (request.status = 11);
3758
4065
  }, 0);
3759
4066
  }
3760
4067
  function enqueueFlush(request) {
@@ -3772,7 +4079,7 @@
3772
4079
  ((request = request.onAllReady), request());
3773
4080
  }
3774
4081
  function startFlowing(request, destination) {
3775
- if (13 === request.status)
4082
+ if (request.status === CLOSING)
3776
4083
  (request.status = CLOSED),
3777
4084
  closeWithError(destination, request.fatalError);
3778
4085
  else if (request.status !== CLOSED && null === request.destination) {
@@ -3808,6 +4115,17 @@
3808
4115
  logRecoverableError(request, error, null), fatalError(request, error);
3809
4116
  }
3810
4117
  }
4118
+ function attachAbortSignal(request, signal) {
4119
+ signal.aborted
4120
+ ? abort(request, signal.reason)
4121
+ : signal.addEventListener(
4122
+ "abort",
4123
+ function () {
4124
+ abort(request, signal.reason);
4125
+ },
4126
+ { signal: request.cacheController.signal }
4127
+ );
4128
+ }
3811
4129
  function abort(request, reason) {
3812
4130
  if (!(11 < request.status))
3813
4131
  try {
@@ -3816,7 +4134,7 @@
3816
4134
  request.cacheController.abort(reason);
3817
4135
  var abortableTasks = request.abortableTasks;
3818
4136
  if (0 < abortableTasks.size)
3819
- if (21 === request.type)
4137
+ if (request.type === PRERENDER)
3820
4138
  abortableTasks.forEach(function (task) {
3821
4139
  return haltTask(task, request);
3822
4140
  }),
@@ -3837,15 +4155,15 @@
3837
4155
  )
3838
4156
  : reason,
3839
4157
  digest = logRecoverableError(request, error, null),
3840
- _errorId2 = request.nextChunkId++;
3841
- request.fatalError = _errorId2;
4158
+ errorId = request.nextChunkId++;
4159
+ request.fatalError = errorId;
3842
4160
  request.pendingChunks++;
3843
- emitErrorChunk(request, _errorId2, digest, error, !1, null);
4161
+ emitErrorChunk(request, errorId, digest, error, !1, null);
3844
4162
  abortableTasks.forEach(function (task) {
3845
- return abortTask(task, request, _errorId2);
4163
+ return abortTask(task, request, errorId);
3846
4164
  });
3847
4165
  setTimeout(function () {
3848
- return finishAbort(request, abortableTasks, _errorId2);
4166
+ return finishAbort(request, abortableTasks, errorId);
3849
4167
  }, 0);
3850
4168
  }
3851
4169
  else {
@@ -3853,9 +4171,9 @@
3853
4171
  onAllReady();
3854
4172
  flushCompletedChunks(request);
3855
4173
  }
3856
- } catch (error$2) {
3857
- logRecoverableError(request, error$2, null),
3858
- fatalError(request, error$2);
4174
+ } catch (error$8) {
4175
+ logRecoverableError(request, error$8, null),
4176
+ fatalError(request, error$8);
3859
4177
  }
3860
4178
  }
3861
4179
  function fromHex(str) {
@@ -3989,6 +4307,16 @@
3989
4307
  null !== listeners && rejectChunk(response, listeners, error);
3990
4308
  }
3991
4309
  }
4310
+ function createResolvedModelChunk(response, value, id) {
4311
+ var $jscomp$compprop2 = {};
4312
+ return new ReactPromise(
4313
+ "resolved_model",
4314
+ value,
4315
+ (($jscomp$compprop2.id = id),
4316
+ ($jscomp$compprop2[RESPONSE_SYMBOL] = response),
4317
+ $jscomp$compprop2)
4318
+ );
4319
+ }
3992
4320
  function resolveModelChunk(response, chunk, value, id) {
3993
4321
  if ("pending" !== chunk.status)
3994
4322
  (chunk = chunk.reason),
@@ -4000,7 +4328,9 @@
4000
4328
  rejectListeners = chunk.reason;
4001
4329
  chunk.status = "resolved_model";
4002
4330
  chunk.value = value;
4003
- chunk.reason = _defineProperty({ id: id }, RESPONSE_SYMBOL, response);
4331
+ value = {};
4332
+ chunk.reason =
4333
+ ((value.id = id), (value[RESPONSE_SYMBOL] = response), value);
4004
4334
  if (null !== resolveListeners)
4005
4335
  switch ((initializeModelChunk(chunk), chunk.status)) {
4006
4336
  case "fulfilled":
@@ -4009,13 +4339,21 @@
4009
4339
  case "blocked":
4010
4340
  case "pending":
4011
4341
  if (chunk.value)
4012
- for (value = 0; value < resolveListeners.length; value++)
4013
- chunk.value.push(resolveListeners[value]);
4342
+ for (
4343
+ response = 0;
4344
+ response < resolveListeners.length;
4345
+ response++
4346
+ )
4347
+ chunk.value.push(resolveListeners[response]);
4014
4348
  else chunk.value = resolveListeners;
4015
4349
  if (chunk.reason) {
4016
4350
  if (rejectListeners)
4017
- for (value = 0; value < rejectListeners.length; value++)
4018
- chunk.reason.push(rejectListeners[value]);
4351
+ for (
4352
+ resolveListeners = 0;
4353
+ resolveListeners < rejectListeners.length;
4354
+ resolveListeners++
4355
+ )
4356
+ chunk.reason.push(rejectListeners[resolveListeners]);
4019
4357
  } else chunk.reason = rejectListeners;
4020
4358
  break;
4021
4359
  case "rejected":
@@ -4025,12 +4363,15 @@
4025
4363
  }
4026
4364
  }
4027
4365
  function createResolvedIteratorResultChunk(response, value, done) {
4366
+ var $jscomp$compprop4 = {};
4028
4367
  return new ReactPromise(
4029
4368
  "resolved_model",
4030
4369
  (done ? '{"done":true,"value":' : '{"done":false,"value":') +
4031
4370
  value +
4032
4371
  "}",
4033
- _defineProperty({ id: -1 }, RESPONSE_SYMBOL, response)
4372
+ (($jscomp$compprop4.id = -1),
4373
+ ($jscomp$compprop4[RESPONSE_SYMBOL] = response),
4374
+ $jscomp$compprop4)
4034
4375
  );
4035
4376
  }
4036
4377
  function resolveIteratorResultChunk(response, chunk, value, done) {
@@ -4087,7 +4428,9 @@
4087
4428
  (cachedPromise = requireModule(serverReference)),
4088
4429
  (id = blockedPromise),
4089
4430
  (id.status = "fulfilled"),
4090
- (id.value = cachedPromise)
4431
+ (id.value = cachedPromise),
4432
+ (id.reason = null),
4433
+ cachedPromise
4091
4434
  );
4092
4435
  if (initializingHandler) {
4093
4436
  var handler = initializingHandler;
@@ -4273,11 +4616,7 @@
4273
4616
  ((chunk = response._formData.data.get(response._prefix + id)),
4274
4617
  (chunk =
4275
4618
  "string" === typeof chunk
4276
- ? new ReactPromise(
4277
- "resolved_model",
4278
- chunk,
4279
- _defineProperty({ id: id }, RESPONSE_SYMBOL, response)
4280
- )
4619
+ ? createResolvedModelChunk(response, chunk, id)
4281
4620
  : response._closed
4282
4621
  ? new ReactPromise("rejected", null, response._closedReason)
4283
4622
  : new ReactPromise("pending", null, null)),
@@ -4603,11 +4942,7 @@
4603
4942
  flightController = {
4604
4943
  enqueueModel: function (json) {
4605
4944
  if (null === previousBlockedChunk) {
4606
- var chunk = new ReactPromise(
4607
- "resolved_model",
4608
- json,
4609
- _defineProperty({ id: -1 }, RESPONSE_SYMBOL, response)
4610
- );
4945
+ var chunk = createResolvedModelChunk(response, json, -1);
4611
4946
  initializeModelChunk(chunk);
4612
4947
  "fulfilled" === chunk.status
4613
4948
  ? enqueue(chunk.value)
@@ -4663,7 +4998,9 @@
4663
4998
  var buffer = [],
4664
4999
  closed = !1,
4665
5000
  nextWriteIndex = 0,
4666
- iterable = _defineProperty({}, ASYNC_ITERATOR, function () {
5001
+ $jscomp$compprop5 = {};
5002
+ $jscomp$compprop5 =
5003
+ (($jscomp$compprop5[ASYNC_ITERATOR] = function () {
4667
5004
  var nextReadIndex = 0;
4668
5005
  return new FlightIterator(function (arg) {
4669
5006
  if (void 0 !== arg)
@@ -4681,8 +5018,11 @@
4681
5018
  }
4682
5019
  return buffer[nextReadIndex++];
4683
5020
  });
4684
- });
4685
- iterator = iterator ? iterable[ASYNC_ITERATOR]() : iterable;
5021
+ }),
5022
+ $jscomp$compprop5);
5023
+ iterator = iterator
5024
+ ? $jscomp$compprop5[ASYNC_ITERATOR]()
5025
+ : $jscomp$compprop5;
4686
5026
  resolveStream(response, reference, iterator, {
4687
5027
  enqueueModel: function (value) {
4688
5028
  nextWriteIndex === buffer.length
@@ -4985,10 +5325,11 @@
4985
5325
  arrayRoot
4986
5326
  );
4987
5327
  case "B":
4988
- return (
4989
- (obj = parseInt(value.slice(2), 16)),
4990
- response._formData.data.get(response._prefix + obj)
4991
- );
5328
+ obj = parseInt(value.slice(2), 16);
5329
+ response = response._formData.data.get(response._prefix + obj);
5330
+ if (!(response instanceof Blob))
5331
+ throw Error("Referenced Blob is not a Blob.");
5332
+ return response;
4992
5333
  case "R":
4993
5334
  return parseReadableStream(response, value, void 0);
4994
5335
  case "r":
@@ -5182,10 +5523,11 @@
5182
5523
  REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
5183
5524
  REACT_MEMO_TYPE = Symbol.for("react.memo"),
5184
5525
  REACT_LAZY_TYPE = Symbol.for("react.lazy"),
5185
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
5186
- Symbol.for("react.postpone");
5187
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
5526
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
5527
+ REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
5528
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
5188
5529
  ASYNC_ITERATOR = Symbol.asyncIterator,
5530
+ REACT_OPTIMISTIC_KEY = Symbol.for("react.optimistic_key"),
5189
5531
  LocalPromise = Promise,
5190
5532
  scheduleMicrotask =
5191
5533
  "function" === typeof queueMicrotask
@@ -5211,7 +5553,7 @@
5211
5553
  },
5212
5554
  PROMISE_PROTOTYPE = Promise.prototype,
5213
5555
  deepProxyHandlers = {
5214
- get: function (target, name) {
5556
+ get: function (target, name, receiver) {
5215
5557
  switch (name) {
5216
5558
  case "$$typeof":
5217
5559
  return target.$$typeof;
@@ -5234,9 +5576,7 @@
5234
5576
  case Symbol.toStringTag:
5235
5577
  return Object.prototype[Symbol.toStringTag];
5236
5578
  case "Provider":
5237
- throw Error(
5238
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
5239
- );
5579
+ return receiver;
5240
5580
  case "then":
5241
5581
  throw Error(
5242
5582
  "Cannot await or return from a thenable. You cannot await a client module from a server component."
@@ -5377,7 +5717,7 @@
5377
5717
  : null,
5378
5718
  TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
5379
5719
  proxyHandlers = {
5380
- get: function (target, name) {
5720
+ get: function (target, name, receiver) {
5381
5721
  switch (name) {
5382
5722
  case "$$typeof":
5383
5723
  return target.$$typeof;
@@ -5396,9 +5736,7 @@
5396
5736
  case Symbol.toStringTag:
5397
5737
  return Object.prototype[Symbol.toStringTag];
5398
5738
  case "Provider":
5399
- throw Error(
5400
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
5401
- );
5739
+ return receiver;
5402
5740
  case "then":
5403
5741
  return;
5404
5742
  }
@@ -5492,10 +5830,10 @@
5492
5830
  },
5493
5831
  useCacheRefresh: function () {
5494
5832
  return unsupportedRefresh;
5495
- }
5496
- };
5497
- HooksDispatcher.useEffectEvent = unsupportedHook;
5498
- var currentOwner = null,
5833
+ },
5834
+ useEffectEvent: unsupportedHook
5835
+ },
5836
+ currentOwner = null,
5499
5837
  DefaultAsyncDispatcher = {
5500
5838
  getCacheForType: function (resourceType) {
5501
5839
  var cache = (cache = resolveRequest()) ? cache.cache : new Map();
@@ -5588,14 +5926,28 @@
5588
5926
  patchConsole(console, "warn"));
5589
5927
  var ObjectPrototype$1 = Object.prototype,
5590
5928
  stringify = JSON.stringify,
5929
+ PENDING$1 = 0,
5930
+ COMPLETED = 1,
5931
+ ABORTED = 3,
5932
+ ERRORED$1 = 4,
5933
+ RENDERING = 5,
5934
+ __PROTO__$1 = "__proto__",
5935
+ OPENING = 10,
5591
5936
  ABORTING = 12,
5937
+ CLOSING = 13,
5592
5938
  CLOSED = 14,
5593
- defaultPostponeHandler = noop,
5939
+ PRERENDER = 21,
5940
+ NEXT_TWO_CHUNKS_ARE_ATOMIC = Symbol(),
5594
5941
  currentRequest = null,
5595
5942
  canEmitDebugInfo = !1,
5596
5943
  serializedSize = 0,
5597
5944
  MAX_ROW_SIZE = 3200,
5945
+ MIN_DEDUPLICATED_IMPORT_STRING_LENGTH = 16,
5946
+ MAX_DEDUPLICATED_IMPORT_STRINGS_SIZE = 32768,
5598
5947
  modelRoot = !1,
5948
+ importStringRequest = null,
5949
+ MAX_IMPORT_METADATA_DEPTH = 16,
5950
+ NOT_PLAIN_IMPORT_METADATA = {},
5599
5951
  CONSTRUCTOR_MARKER = Symbol(),
5600
5952
  debugModelRoot = null,
5601
5953
  debugNoOutline = null,
@@ -5604,52 +5956,57 @@
5604
5956
  chunkCache = new Map(),
5605
5957
  RESPONSE_SYMBOL = Symbol();
5606
5958
  ReactPromise.prototype = Object.create(Promise.prototype);
5607
- ReactPromise.prototype.then = function (resolve, reject) {
5608
- switch (this.status) {
5609
- case "resolved_model":
5610
- initializeModelChunk(this);
5611
- }
5612
- switch (this.status) {
5613
- case "fulfilled":
5614
- if ("function" === typeof resolve) {
5615
- for (
5616
- var inspectedValue = this.value,
5617
- cycleProtection = 0,
5618
- visited = new Set();
5619
- inspectedValue instanceof ReactPromise;
5959
+ Object.defineProperty(ReactPromise.prototype, "then", {
5960
+ writable: !0,
5961
+ enumerable: !0,
5962
+ configurable: !0,
5963
+ value: function (resolve, reject) {
5964
+ switch (this.status) {
5965
+ case "resolved_model":
5966
+ initializeModelChunk(this);
5967
+ }
5968
+ switch (this.status) {
5969
+ case "fulfilled":
5970
+ if ("function" === typeof resolve) {
5971
+ for (
5972
+ var inspectedValue = this.value,
5973
+ cycleProtection = 0,
5974
+ visited = new Set();
5975
+ inspectedValue instanceof ReactPromise;
5620
5976
 
5621
- ) {
5622
- cycleProtection++;
5623
- if (
5624
- inspectedValue === this ||
5625
- visited.has(inspectedValue) ||
5626
- 1e3 < cycleProtection
5627
5977
  ) {
5628
- "function" === typeof reject &&
5629
- reject(Error("Cannot have cyclic thenables."));
5630
- return;
5978
+ cycleProtection++;
5979
+ if (
5980
+ inspectedValue === this ||
5981
+ visited.has(inspectedValue) ||
5982
+ 1e3 < cycleProtection
5983
+ ) {
5984
+ "function" === typeof reject &&
5985
+ reject(Error("Cannot have cyclic thenables."));
5986
+ return;
5987
+ }
5988
+ visited.add(inspectedValue);
5989
+ if ("fulfilled" === inspectedValue.status)
5990
+ inspectedValue = inspectedValue.value;
5991
+ else break;
5631
5992
  }
5632
- visited.add(inspectedValue);
5633
- if ("fulfilled" === inspectedValue.status)
5634
- inspectedValue = inspectedValue.value;
5635
- else break;
5993
+ resolve(this.value);
5636
5994
  }
5637
- resolve(this.value);
5638
- }
5639
- break;
5640
- case "pending":
5641
- case "blocked":
5642
- "function" === typeof resolve &&
5643
- (null === this.value && (this.value = []),
5644
- this.value.push(resolve));
5645
- "function" === typeof reject &&
5646
- (null === this.reason && (this.reason = []),
5647
- this.reason.push(reject));
5648
- break;
5649
- default:
5650
- "function" === typeof reject && reject(this.reason);
5995
+ break;
5996
+ case "pending":
5997
+ case "blocked":
5998
+ "function" === typeof resolve &&
5999
+ (null === this.value && (this.value = []),
6000
+ this.value.push(resolve));
6001
+ "function" === typeof reject &&
6002
+ (null === this.reason && (this.reason = []),
6003
+ this.reason.push(reject));
6004
+ break;
6005
+ default:
6006
+ "function" === typeof reject && reject(this.reason);
6007
+ }
5651
6008
  }
5652
- };
6009
+ });
5653
6010
  var ObjectPrototype = Object.prototype,
5654
6011
  ArrayPrototype = Array.prototype,
5655
6012
  initializingHandler = null;
@@ -5793,23 +6150,13 @@
5793
6150
  reject,
5794
6151
  options ? options.onError : void 0,
5795
6152
  options ? options.identifierPrefix : void 0,
5796
- options ? options.onPostpone : void 0,
5797
6153
  options ? options.temporaryReferences : void 0,
6154
+ options ? options.startTime : void 0,
5798
6155
  options ? options.environmentName : void 0,
5799
6156
  options ? options.filterStackFrame : void 0,
5800
6157
  !1
5801
6158
  );
5802
- if (options && options.signal) {
5803
- var signal = options.signal;
5804
- if (signal.aborted) abort(request, signal.reason);
5805
- else {
5806
- var listener = function () {
5807
- abort(request, signal.reason);
5808
- signal.removeEventListener("abort", listener);
5809
- };
5810
- signal.addEventListener("abort", listener);
5811
- }
5812
- }
6159
+ options && options.signal && attachAbortSignal(request, options.signal);
5813
6160
  startWork(request);
5814
6161
  });
5815
6162
  };
@@ -5851,29 +6198,19 @@
5851
6198
  webpackMap,
5852
6199
  options ? options.onError : void 0,
5853
6200
  options ? options.identifierPrefix : void 0,
5854
- options ? options.onPostpone : void 0,
5855
6201
  options ? options.temporaryReferences : void 0,
6202
+ options ? options.startTime : void 0,
5856
6203
  options ? options.environmentName : void 0,
5857
6204
  options ? options.filterStackFrame : void 0,
5858
6205
  void 0 !== debugChannelReadable
5859
6206
  );
5860
- if (options && options.signal) {
5861
- var signal = options.signal;
5862
- if (signal.aborted) abort(request, signal.reason);
5863
- else {
5864
- var listener = function () {
5865
- abort(request, signal.reason);
5866
- signal.removeEventListener("abort", listener);
5867
- };
5868
- signal.addEventListener("abort", listener);
5869
- }
5870
- }
6207
+ options && options.signal && attachAbortSignal(request, options.signal);
5871
6208
  void 0 !== debugChannelWritable &&
5872
6209
  new ReadableStream(
5873
6210
  {
5874
6211
  type: "bytes",
5875
6212
  pull: function (controller) {
5876
- if (13 === request.status)
6213
+ if (request.status === CLOSING)
5877
6214
  (request.status = CLOSED),
5878
6215
  closeWithError(controller, request.fatalError);
5879
6216
  else if (