react-dom 19.1.0-canary-d46b04a2-20250117 → 19.1.0-canary-18eaf51b-20250118

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.
@@ -854,8 +854,7 @@
854
854
  segmentPrefix: stringToPrecomputedChunk(idPrefix + "S:"),
855
855
  boundaryPrefix: stringToPrecomputedChunk(idPrefix + "B:"),
856
856
  startInlineScript: inlineScriptWithNonce,
857
- htmlChunks: null,
858
- headChunks: null,
857
+ preamble: createPreambleState(),
859
858
  externalRuntimeScript: null,
860
859
  bootstrapChunks: externalRuntimeConfig,
861
860
  importMapChunks: bootstrapScriptContent,
@@ -1021,6 +1020,9 @@
1021
1020
  moduleScriptResources: {}
1022
1021
  };
1023
1022
  }
1023
+ function createPreambleState() {
1024
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
1025
+ }
1024
1026
  function createFormatContext(insertionMode, selectedValue, tagScope) {
1025
1027
  return {
1026
1028
  insertionMode: insertionMode,
@@ -1091,16 +1093,26 @@
1091
1093
  null,
1092
1094
  parentContext.tagScope
1093
1095
  );
1096
+ case "head":
1097
+ if (parentContext.insertionMode < HTML_MODE)
1098
+ return createFormatContext(
1099
+ HTML_HEAD_MODE,
1100
+ null,
1101
+ parentContext.tagScope
1102
+ );
1103
+ break;
1104
+ case "html":
1105
+ if (parentContext.insertionMode === ROOT_HTML_MODE)
1106
+ return createFormatContext(
1107
+ HTML_HTML_MODE,
1108
+ null,
1109
+ parentContext.tagScope
1110
+ );
1094
1111
  }
1095
- return parentContext.insertionMode >= HTML_TABLE_MODE
1112
+ return parentContext.insertionMode >= HTML_TABLE_MODE ||
1113
+ parentContext.insertionMode < HTML_MODE
1096
1114
  ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
1097
- : parentContext.insertionMode === ROOT_HTML_MODE
1098
- ? "html" === type
1099
- ? createFormatContext(HTML_HTML_MODE, null, parentContext.tagScope)
1100
- : createFormatContext(HTML_MODE, null, parentContext.tagScope)
1101
- : parentContext.insertionMode === HTML_HTML_MODE
1102
- ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
1103
- : parentContext;
1115
+ : parentContext;
1104
1116
  }
1105
1117
  function pushTextInstance(target, text, renderState, textEmbedded) {
1106
1118
  if ("" === text) return textEmbedded;
@@ -1791,6 +1803,7 @@
1791
1803
  props,
1792
1804
  resumableState,
1793
1805
  renderState,
1806
+ preambleState,
1794
1807
  hoistableState,
1795
1808
  formatContext,
1796
1809
  textEmbedded,
@@ -2959,13 +2972,13 @@
2959
2972
  case "missing-glyph":
2960
2973
  break;
2961
2974
  case "head":
2962
- if (
2963
- formatContext.insertionMode < HTML_MODE &&
2964
- null === renderState.headChunks
2965
- ) {
2966
- renderState.headChunks = [];
2975
+ if (formatContext.insertionMode < HTML_MODE) {
2976
+ var preamble = preambleState || renderState.preamble;
2977
+ if (preamble.headChunks)
2978
+ throw Error("The `<head>` tag may only be rendered once.");
2979
+ preamble.headChunks = [];
2967
2980
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
2968
- renderState.headChunks,
2981
+ preamble.headChunks,
2969
2982
  props,
2970
2983
  "head"
2971
2984
  );
@@ -2976,24 +2989,42 @@
2976
2989
  "head"
2977
2990
  );
2978
2991
  return JSCompiler_inline_result$jscomp$9;
2979
- case "html":
2980
- if (
2981
- formatContext.insertionMode === ROOT_HTML_MODE &&
2982
- null === renderState.htmlChunks
2983
- ) {
2984
- renderState.htmlChunks = [doctypeChunk];
2992
+ case "body":
2993
+ if (formatContext.insertionMode < HTML_MODE) {
2994
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
2995
+ if (preamble$jscomp$0.bodyChunks)
2996
+ throw Error("The `<body>` tag may only be rendered once.");
2997
+ preamble$jscomp$0.bodyChunks = [];
2985
2998
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2986
- renderState.htmlChunks,
2999
+ preamble$jscomp$0.bodyChunks,
2987
3000
  props,
2988
- "html"
3001
+ "body"
2989
3002
  );
2990
3003
  } else
2991
3004
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2992
3005
  target$jscomp$0,
2993
3006
  props,
2994
- "html"
3007
+ "body"
2995
3008
  );
2996
3009
  return JSCompiler_inline_result$jscomp$10;
3010
+ case "html":
3011
+ if (formatContext.insertionMode === ROOT_HTML_MODE) {
3012
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
3013
+ if (preamble$jscomp$1.htmlChunks)
3014
+ throw Error("The `<html>` tag may only be rendered once.");
3015
+ preamble$jscomp$1.htmlChunks = [doctypeChunk];
3016
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
3017
+ preamble$jscomp$1.htmlChunks,
3018
+ props,
3019
+ "html"
3020
+ );
3021
+ } else
3022
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
3023
+ target$jscomp$0,
3024
+ props,
3025
+ "html"
3026
+ );
3027
+ return JSCompiler_inline_result$jscomp$11;
2997
3028
  default:
2998
3029
  if (-1 !== type.indexOf("-")) {
2999
3030
  target$jscomp$0.push(startChunkForTag(type));
@@ -3063,6 +3094,15 @@
3063
3094
  endTagCache.set(tag, chunk));
3064
3095
  return chunk;
3065
3096
  }
3097
+ function hoistPreambleState(renderState, preambleState) {
3098
+ renderState = renderState.preamble;
3099
+ null === renderState.htmlChunks &&
3100
+ (renderState.htmlChunks = preambleState.htmlChunks);
3101
+ null === renderState.headChunks &&
3102
+ (renderState.headChunks = preambleState.headChunks);
3103
+ null === renderState.bodyChunks &&
3104
+ (renderState.bodyChunks = preambleState.bodyChunks);
3105
+ }
3066
3106
  function writeBootstrap(destination, renderState) {
3067
3107
  renderState = renderState.bootstrapChunks;
3068
3108
  for (var i = 0; i < renderState.length - 1; i++)
@@ -3087,6 +3127,7 @@
3087
3127
  switch (formatContext.insertionMode) {
3088
3128
  case ROOT_HTML_MODE:
3089
3129
  case HTML_HTML_MODE:
3130
+ case HTML_HEAD_MODE:
3090
3131
  case HTML_MODE:
3091
3132
  return (
3092
3133
  writeChunk(destination, startSegmentHTML),
@@ -3144,6 +3185,7 @@
3144
3185
  switch (formatContext.insertionMode) {
3145
3186
  case ROOT_HTML_MODE:
3146
3187
  case HTML_HTML_MODE:
3188
+ case HTML_HEAD_MODE:
3147
3189
  case HTML_MODE:
3148
3190
  return writeChunkAndReturn(destination, endSegmentHTML);
3149
3191
  case SVG_MODE:
@@ -4346,7 +4388,7 @@
4346
4388
  this.status = 10;
4347
4389
  this.fatalError = null;
4348
4390
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
4349
- this.completedRootSegment = null;
4391
+ this.completedPreambleSegments = this.completedRootSegment = null;
4350
4392
  this.abortableTasks = abortSet;
4351
4393
  this.pingedTasks = [];
4352
4394
  this.clientRenderedBoundaries = [];
@@ -4406,6 +4448,7 @@
4406
4448
  null,
4407
4449
  renderState,
4408
4450
  null,
4451
+ null,
4409
4452
  resumableState.abortableTasks,
4410
4453
  null,
4411
4454
  rootFormatContext,
@@ -4464,7 +4507,12 @@
4464
4507
  return performWork(request);
4465
4508
  }));
4466
4509
  }
4467
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
4510
+ function createSuspenseBoundary(
4511
+ request,
4512
+ fallbackAbortableTasks,
4513
+ contentPreamble,
4514
+ fallbackPreamble
4515
+ ) {
4468
4516
  return {
4469
4517
  status: PENDING,
4470
4518
  rootSegmentID: -1,
@@ -4476,6 +4524,8 @@
4476
4524
  errorDigest: null,
4477
4525
  contentState: createHoistableState(),
4478
4526
  fallbackState: createHoistableState(),
4527
+ contentPreamble: contentPreamble,
4528
+ fallbackPreamble: fallbackPreamble,
4479
4529
  trackedContentKeyPath: null,
4480
4530
  trackedFallbackNode: null,
4481
4531
  errorMessage: null,
@@ -4490,6 +4540,7 @@
4490
4540
  childIndex,
4491
4541
  blockedBoundary,
4492
4542
  blockedSegment,
4543
+ blockedPreamble,
4493
4544
  hoistableState,
4494
4545
  abortSet,
4495
4546
  keyPath,
@@ -4512,6 +4563,7 @@
4512
4563
  },
4513
4564
  blockedBoundary: blockedBoundary,
4514
4565
  blockedSegment: blockedSegment,
4566
+ blockedPreamble: blockedPreamble,
4515
4567
  hoistableState: hoistableState,
4516
4568
  abortSet: abortSet,
4517
4569
  keyPath: keyPath,
@@ -4555,6 +4607,7 @@
4555
4607
  },
4556
4608
  blockedBoundary: blockedBoundary,
4557
4609
  blockedSegment: null,
4610
+ blockedPreamble: null,
4558
4611
  hoistableState: hoistableState,
4559
4612
  abortSet: abortSet,
4560
4613
  keyPath: keyPath,
@@ -4578,11 +4631,12 @@
4578
4631
  ) {
4579
4632
  return {
4580
4633
  status: PENDING,
4634
+ parentFlushed: !1,
4581
4635
  id: -1,
4582
4636
  index: index,
4583
- parentFlushed: !1,
4584
4637
  chunks: [],
4585
4638
  children: [],
4639
+ preambleChildren: [],
4586
4640
  parentFormatContext: parentFormatContext,
4587
4641
  boundary: boundary,
4588
4642
  lastPushedText: lastPushedText,
@@ -5223,6 +5277,7 @@
5223
5277
  props,
5224
5278
  request.resumableState,
5225
5279
  request.renderState,
5280
+ task.blockedPreamble,
5226
5281
  task.hoistableState,
5227
5282
  task.formatContext,
5228
5283
  segment.lastPushedText,
@@ -5231,9 +5286,43 @@
5231
5286
  segment.lastPushedText = !1;
5232
5287
  var _prevContext = task.formatContext,
5233
5288
  _prevKeyPath2 = task.keyPath;
5234
- task.formatContext = getChildFormatContext(_prevContext, type, props);
5235
5289
  task.keyPath = keyPath;
5236
- renderNode(request, task, _children, -1);
5290
+ if (
5291
+ (task.formatContext = getChildFormatContext(
5292
+ _prevContext,
5293
+ type,
5294
+ props
5295
+ )).insertionMode === HTML_HEAD_MODE
5296
+ ) {
5297
+ var preambleSegment = createPendingSegment(
5298
+ request,
5299
+ 0,
5300
+ null,
5301
+ task.formatContext,
5302
+ !1,
5303
+ !1
5304
+ );
5305
+ segment.preambleChildren.push(preambleSegment);
5306
+ var preambleTask = createRenderTask(
5307
+ request,
5308
+ null,
5309
+ _children,
5310
+ -1,
5311
+ task.blockedBoundary,
5312
+ preambleSegment,
5313
+ task.blockedPreamble,
5314
+ task.hoistableState,
5315
+ request.abortableTasks,
5316
+ task.keyPath,
5317
+ task.formatContext,
5318
+ task.context,
5319
+ task.treeContext,
5320
+ task.componentStack,
5321
+ task.isFallback
5322
+ );
5323
+ pushComponentStack(preambleTask);
5324
+ request.pingedTasks.push(preambleTask);
5325
+ } else renderNode(request, task, _children, -1);
5237
5326
  task.formatContext = _prevContext;
5238
5327
  task.keyPath = _prevKeyPath2;
5239
5328
  a: {
@@ -5270,6 +5359,9 @@
5270
5359
  resumableState.hasHtml = !0;
5271
5360
  break a;
5272
5361
  }
5362
+ break;
5363
+ case "head":
5364
+ if (_prevContext.insertionMode <= HTML_HTML_MODE) break a;
5273
5365
  }
5274
5366
  target.push(endChunkForTag(type));
5275
5367
  }
@@ -5318,12 +5410,26 @@
5318
5410
  } else {
5319
5411
  var prevKeyPath$jscomp$3 = task.keyPath,
5320
5412
  parentBoundary = task.blockedBoundary,
5413
+ parentPreamble = task.blockedPreamble,
5321
5414
  parentHoistableState = task.hoistableState,
5322
5415
  parentSegment = task.blockedSegment,
5323
5416
  fallback = props.fallback,
5324
5417
  content = props.children,
5325
- fallbackAbortSet = new Set(),
5326
- newBoundary = createSuspenseBoundary(request, fallbackAbortSet);
5418
+ fallbackAbortSet = new Set();
5419
+ var newBoundary =
5420
+ task.formatContext.insertionMode < HTML_MODE
5421
+ ? createSuspenseBoundary(
5422
+ request,
5423
+ fallbackAbortSet,
5424
+ createPreambleState(),
5425
+ createPreambleState()
5426
+ )
5427
+ : createSuspenseBoundary(
5428
+ request,
5429
+ fallbackAbortSet,
5430
+ null,
5431
+ null
5432
+ );
5327
5433
  null !== request.trackedPostpones &&
5328
5434
  (newBoundary.trackedContentKeyPath = keyPath);
5329
5435
  var boundarySegment = createPendingSegment(
@@ -5363,6 +5469,7 @@
5363
5469
  );
5364
5470
  newBoundary.trackedFallbackNode = fallbackReplayNode;
5365
5471
  task.blockedSegment = boundarySegment;
5472
+ task.blockedPreamble = newBoundary.fallbackPreamble;
5366
5473
  task.keyPath = fallbackKeyPath;
5367
5474
  boundarySegment.status = 6;
5368
5475
  try {
@@ -5378,6 +5485,7 @@
5378
5485
  );
5379
5486
  } finally {
5380
5487
  (task.blockedSegment = parentSegment),
5488
+ (task.blockedPreamble = parentPreamble),
5381
5489
  (task.keyPath = prevKeyPath$jscomp$3);
5382
5490
  }
5383
5491
  var suspendedPrimaryTask = createRenderTask(
@@ -5387,6 +5495,7 @@
5387
5495
  -1,
5388
5496
  newBoundary,
5389
5497
  contentRootSegment,
5498
+ newBoundary.contentPreamble,
5390
5499
  newBoundary.contentState,
5391
5500
  task.abortSet,
5392
5501
  keyPath,
@@ -5400,6 +5509,7 @@
5400
5509
  request.pingedTasks.push(suspendedPrimaryTask);
5401
5510
  } else {
5402
5511
  task.blockedBoundary = newBoundary;
5512
+ task.blockedPreamble = newBoundary.contentPreamble;
5403
5513
  task.hoistableState = newBoundary.contentState;
5404
5514
  task.blockedSegment = contentRootSegment;
5405
5515
  task.keyPath = keyPath;
@@ -5416,6 +5526,9 @@
5416
5526
  newBoundary.status === PENDING)
5417
5527
  ) {
5418
5528
  newBoundary.status = COMPLETED;
5529
+ 0 === request.pendingRootTasks &&
5530
+ task.blockedPreamble &&
5531
+ preparePreamble(request);
5419
5532
  break a;
5420
5533
  }
5421
5534
  } catch (thrownValue$2) {
@@ -5441,6 +5554,7 @@
5441
5554
  untrackBoundary(request, newBoundary);
5442
5555
  } finally {
5443
5556
  (task.blockedBoundary = parentBoundary),
5557
+ (task.blockedPreamble = parentPreamble),
5444
5558
  (task.hoistableState = parentHoistableState),
5445
5559
  (task.blockedSegment = parentSegment),
5446
5560
  (task.keyPath = prevKeyPath$jscomp$3);
@@ -5452,6 +5566,7 @@
5452
5566
  -1,
5453
5567
  parentBoundary,
5454
5568
  boundarySegment,
5569
+ newBoundary.fallbackPreamble,
5455
5570
  newBoundary.fallbackState,
5456
5571
  fallbackAbortSet,
5457
5572
  [keyPath[0], "Suspense Fallback", keyPath[2]],
@@ -5709,17 +5824,27 @@
5709
5824
  previousReplaySet = task.replay,
5710
5825
  parentBoundary = task.blockedBoundary,
5711
5826
  parentHoistableState = task.hoistableState,
5712
- content = props.children;
5713
- props = props.fallback;
5714
- var fallbackAbortSet = new Set(),
5715
- resumedBoundary = createSuspenseBoundary(
5716
- request,
5717
- fallbackAbortSet
5718
- );
5719
- resumedBoundary.parentFlushed = !0;
5720
- resumedBoundary.rootSegmentID = ref;
5721
- task.blockedBoundary = resumedBoundary;
5722
- task.hoistableState = resumedBoundary.contentState;
5827
+ content = props.children,
5828
+ fallback = props.fallback,
5829
+ fallbackAbortSet = new Set();
5830
+ props =
5831
+ task.formatContext.insertionMode < HTML_MODE
5832
+ ? createSuspenseBoundary(
5833
+ request,
5834
+ fallbackAbortSet,
5835
+ createPreambleState(),
5836
+ createPreambleState()
5837
+ )
5838
+ : createSuspenseBoundary(
5839
+ request,
5840
+ fallbackAbortSet,
5841
+ null,
5842
+ null
5843
+ );
5844
+ props.parentFlushed = !0;
5845
+ props.rootSegmentID = ref;
5846
+ task.blockedBoundary = props;
5847
+ task.hoistableState = props.contentState;
5723
5848
  task.keyPath = keyPath;
5724
5849
  task.replay = {
5725
5850
  nodes: replay,
@@ -5737,15 +5862,15 @@
5737
5862
  );
5738
5863
  task.replay.pendingTasks--;
5739
5864
  if (
5740
- 0 === resumedBoundary.pendingTasks &&
5741
- resumedBoundary.status === PENDING
5865
+ 0 === props.pendingTasks &&
5866
+ props.status === PENDING
5742
5867
  ) {
5743
- resumedBoundary.status = COMPLETED;
5744
- request.completedBoundaries.push(resumedBoundary);
5868
+ props.status = COMPLETED;
5869
+ request.completedBoundaries.push(props);
5745
5870
  break a;
5746
5871
  }
5747
5872
  } catch (error) {
5748
- (resumedBoundary.status = CLIENT_RENDERED),
5873
+ (props.status = CLIENT_RENDERED),
5749
5874
  (childNodes = getThrownInfo(task.componentStack)),
5750
5875
  (type = logRecoverableError(
5751
5876
  request,
@@ -5753,16 +5878,14 @@
5753
5878
  childNodes
5754
5879
  )),
5755
5880
  encodeErrorForBoundary(
5756
- resumedBoundary,
5881
+ props,
5757
5882
  type,
5758
5883
  error,
5759
5884
  childNodes,
5760
5885
  !1
5761
5886
  ),
5762
5887
  task.replay.pendingTasks--,
5763
- request.clientRenderedBoundaries.push(
5764
- resumedBoundary
5765
- );
5888
+ request.clientRenderedBoundaries.push(props);
5766
5889
  } finally {
5767
5890
  (task.blockedBoundary = parentBoundary),
5768
5891
  (task.hoistableState = parentHoistableState),
@@ -5773,10 +5896,10 @@
5773
5896
  request,
5774
5897
  null,
5775
5898
  { nodes: keyOrIndex, slots: key, pendingTasks: 0 },
5776
- props,
5899
+ fallback,
5777
5900
  -1,
5778
5901
  parentBoundary,
5779
- resumedBoundary.fallbackState,
5902
+ props.fallbackState,
5780
5903
  fallbackAbortSet,
5781
5904
  [keyPath[0], "Suspense Fallback", keyPath[2]],
5782
5905
  task.formatContext,
@@ -6105,6 +6228,7 @@
6105
6228
  task.childIndex,
6106
6229
  task.blockedBoundary,
6107
6230
  newSegment,
6231
+ task.blockedPreamble,
6108
6232
  task.hoistableState,
6109
6233
  task.abortSet,
6110
6234
  task.keyPath,
@@ -6273,7 +6397,12 @@
6273
6397
  errorDigest = errorDigest$jscomp$0,
6274
6398
  errorInfo = errorInfo$jscomp$0,
6275
6399
  wasAborted = aborted,
6276
- resumedBoundary = createSuspenseBoundary(request, new Set());
6400
+ resumedBoundary = createSuspenseBoundary(
6401
+ request,
6402
+ new Set(),
6403
+ null,
6404
+ null
6405
+ );
6277
6406
  resumedBoundary.parentFlushed = !0;
6278
6407
  resumedBoundary.rootSegmentID = node;
6279
6408
  resumedBoundary.status = CLIENT_RENDERED;
@@ -6426,6 +6555,7 @@
6426
6555
  }
6427
6556
  function completeShell(request) {
6428
6557
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
6558
+ null === request.trackedPostpones && preparePreamble(request);
6429
6559
  request.onShellError = noop;
6430
6560
  request = request.onShellReady;
6431
6561
  request();
@@ -6438,6 +6568,7 @@
6438
6568
  : null === request.completedRootSegment ||
6439
6569
  request.completedRootSegment.status !== POSTPONED
6440
6570
  );
6571
+ preparePreamble(request);
6441
6572
  request = request.onAllReady;
6442
6573
  request();
6443
6574
  }
@@ -6482,7 +6613,11 @@
6482
6613
  abortTaskSoft,
6483
6614
  request
6484
6615
  ),
6485
- boundary.fallbackAbortableTasks.clear()))
6616
+ boundary.fallbackAbortableTasks.clear(),
6617
+ 0 === request.pendingRootTasks &&
6618
+ null === request.trackedPostpones &&
6619
+ null !== boundary.contentPreamble &&
6620
+ preparePreamble(request)))
6486
6621
  : null !== segment &&
6487
6622
  segment.parentFlushed &&
6488
6623
  segment.status === COMPLETED &&
@@ -6652,7 +6787,11 @@
6652
6787
  ),
6653
6788
  untrackBoundary(request, boundary),
6654
6789
  boundary.parentFlushed &&
6655
- request.clientRenderedBoundaries.push(boundary)));
6790
+ request.clientRenderedBoundaries.push(boundary),
6791
+ 0 === request.pendingRootTasks &&
6792
+ null === request.trackedPostpones &&
6793
+ null !== boundary.contentPreamble &&
6794
+ preparePreamble(request)));
6656
6795
  request.allPendingTasks--;
6657
6796
  0 === request.allPendingTasks && completeAll(request);
6658
6797
  }
@@ -6681,6 +6820,85 @@
6681
6820
  }
6682
6821
  }
6683
6822
  }
6823
+ function preparePreambleFromSubtree(
6824
+ request,
6825
+ segment,
6826
+ collectedPreambleSegments
6827
+ ) {
6828
+ segment.preambleChildren.length &&
6829
+ collectedPreambleSegments.push(segment.preambleChildren);
6830
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
6831
+ pendingPreambles =
6832
+ preparePreambleFromSegment(
6833
+ request,
6834
+ segment.children[i],
6835
+ collectedPreambleSegments
6836
+ ) || pendingPreambles;
6837
+ return pendingPreambles;
6838
+ }
6839
+ function preparePreambleFromSegment(
6840
+ request,
6841
+ segment,
6842
+ collectedPreambleSegments
6843
+ ) {
6844
+ var boundary = segment.boundary;
6845
+ if (null === boundary)
6846
+ return preparePreambleFromSubtree(
6847
+ request,
6848
+ segment,
6849
+ collectedPreambleSegments
6850
+ );
6851
+ var preamble = boundary.contentPreamble,
6852
+ fallbackPreamble = boundary.fallbackPreamble;
6853
+ if (null === preamble || null === fallbackPreamble) return !1;
6854
+ switch (boundary.status) {
6855
+ case COMPLETED:
6856
+ hoistPreambleState(request.renderState, preamble);
6857
+ segment = boundary.completedSegments[0];
6858
+ if (!segment)
6859
+ throw Error(
6860
+ "A previously unvisited boundary must have exactly one root segment. This is a bug in React."
6861
+ );
6862
+ return preparePreambleFromSubtree(
6863
+ request,
6864
+ segment,
6865
+ collectedPreambleSegments
6866
+ );
6867
+ case POSTPONED:
6868
+ if (null !== request.trackedPostpones) return !0;
6869
+ case CLIENT_RENDERED:
6870
+ if (segment.status === COMPLETED)
6871
+ return (
6872
+ hoistPreambleState(request.renderState, fallbackPreamble),
6873
+ preparePreambleFromSubtree(
6874
+ request,
6875
+ segment,
6876
+ collectedPreambleSegments
6877
+ )
6878
+ );
6879
+ default:
6880
+ return !0;
6881
+ }
6882
+ }
6883
+ function preparePreamble(request) {
6884
+ if (
6885
+ request.completedRootSegment &&
6886
+ null === request.completedPreambleSegments
6887
+ ) {
6888
+ var collectedPreambleSegments = [],
6889
+ hasPendingPreambles = preparePreambleFromSegment(
6890
+ request,
6891
+ request.completedRootSegment,
6892
+ collectedPreambleSegments
6893
+ ),
6894
+ preamble = request.renderState.preamble;
6895
+ if (
6896
+ !1 === hasPendingPreambles ||
6897
+ (preamble.headChunks && preamble.bodyChunks)
6898
+ )
6899
+ request.completedPreambleSegments = collectedPreambleSegments;
6900
+ }
6901
+ }
6684
6902
  function flushSubtree(request, destination, segment, hoistableState) {
6685
6903
  segment.parentFlushed = !0;
6686
6904
  switch (segment.status) {
@@ -6947,9 +7165,12 @@
6947
7165
  completedRootSegment = request.completedRootSegment;
6948
7166
  if (null !== completedRootSegment) {
6949
7167
  if (completedRootSegment.status === POSTPONED) return;
7168
+ var completedPreambleSegments = request.completedPreambleSegments;
7169
+ if (null === completedPreambleSegments) return;
6950
7170
  var renderState = request.renderState,
6951
- htmlChunks = renderState.htmlChunks,
6952
- headChunks = renderState.headChunks,
7171
+ preamble = renderState.preamble,
7172
+ htmlChunks = preamble.htmlChunks,
7173
+ headChunks = preamble.headChunks,
6953
7174
  i$jscomp$0;
6954
7175
  if (htmlChunks) {
6955
7176
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -7010,10 +7231,27 @@
7010
7231
  i$jscomp$0++
7011
7232
  )
7012
7233
  writeChunk(destination, hoistableChunks[i$jscomp$0]);
7013
- hoistableChunks.length = 0;
7014
- htmlChunks &&
7015
- null === headChunks &&
7234
+ for (
7235
+ renderState = hoistableChunks.length = 0;
7236
+ renderState < completedPreambleSegments.length;
7237
+ renderState++
7238
+ ) {
7239
+ var segments = completedPreambleSegments[renderState];
7240
+ for (preamble = 0; preamble < segments.length; preamble++)
7241
+ flushSegment(request, destination, segments[preamble], null);
7242
+ }
7243
+ var preamble$jscomp$0 = request.renderState.preamble,
7244
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
7245
+ (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) &&
7016
7246
  writeChunk(destination, endChunkForTag("head"));
7247
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
7248
+ if (bodyChunks)
7249
+ for (
7250
+ completedPreambleSegments = 0;
7251
+ completedPreambleSegments < bodyChunks.length;
7252
+ completedPreambleSegments++
7253
+ )
7254
+ writeChunk(destination, bodyChunks[completedPreambleSegments]);
7017
7255
  flushSegment(request, destination, completedRootSegment, null);
7018
7256
  request.completedRootSegment = null;
7019
7257
  writeBootstrap(destination, request.renderState);
@@ -7296,11 +7534,11 @@
7296
7534
  }
7297
7535
  function ensureCorrectIsomorphicReactVersion() {
7298
7536
  var isomorphicReactPackageVersion = React.version;
7299
- if ("19.1.0-canary-d46b04a2-20250117" !== isomorphicReactPackageVersion)
7537
+ if ("19.1.0-canary-18eaf51b-20250118" !== isomorphicReactPackageVersion)
7300
7538
  throw Error(
7301
7539
  'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
7302
7540
  (isomorphicReactPackageVersion +
7303
- "\n - react-dom: 19.1.0-canary-d46b04a2-20250117\nLearn more: https://react.dev/warnings/version-mismatch")
7541
+ "\n - react-dom: 19.1.0-canary-18eaf51b-20250118\nLearn more: https://react.dev/warnings/version-mismatch")
7304
7542
  );
7305
7543
  }
7306
7544
  var React = require("react"),
@@ -8409,12 +8647,13 @@
8409
8647
  var ROOT_HTML_MODE = 0,
8410
8648
  HTML_HTML_MODE = 1,
8411
8649
  HTML_MODE = 2,
8412
- SVG_MODE = 3,
8413
- MATHML_MODE = 4,
8414
- HTML_TABLE_MODE = 5,
8415
- HTML_TABLE_BODY_MODE = 6,
8416
- HTML_TABLE_ROW_MODE = 7,
8417
- HTML_COLGROUP_MODE = 8,
8650
+ HTML_HEAD_MODE = 3,
8651
+ SVG_MODE = 4,
8652
+ MATHML_MODE = 5,
8653
+ HTML_TABLE_MODE = 6,
8654
+ HTML_TABLE_BODY_MODE = 7,
8655
+ HTML_TABLE_ROW_MODE = 8,
8656
+ HTML_COLGROUP_MODE = 9,
8418
8657
  textSeparator = stringToPrecomputedChunk("\x3c!-- --\x3e"),
8419
8658
  styleNameCache = new Map(),
8420
8659
  styleAttributeStart = stringToPrecomputedChunk(' style="'),
@@ -8949,5 +9188,5 @@
8949
9188
  startWork(request);
8950
9189
  });
8951
9190
  };
8952
- exports.version = "19.1.0-canary-d46b04a2-20250117";
9191
+ exports.version = "19.1.0-canary-18eaf51b-20250118";
8953
9192
  })();