react-dom 19.1.0-canary-5b51a2b9-20250116 → 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.
@@ -758,6 +758,9 @@
758
758
  moduleScriptResources: {}
759
759
  };
760
760
  }
761
+ function createPreambleState() {
762
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
763
+ }
761
764
  function createFormatContext(insertionMode, selectedValue, tagScope) {
762
765
  return {
763
766
  insertionMode: insertionMode,
@@ -817,16 +820,26 @@
817
820
  null,
818
821
  parentContext.tagScope
819
822
  );
823
+ case "head":
824
+ if (parentContext.insertionMode < HTML_MODE)
825
+ return createFormatContext(
826
+ HTML_HEAD_MODE,
827
+ null,
828
+ parentContext.tagScope
829
+ );
830
+ break;
831
+ case "html":
832
+ if (parentContext.insertionMode === ROOT_HTML_MODE)
833
+ return createFormatContext(
834
+ HTML_HTML_MODE,
835
+ null,
836
+ parentContext.tagScope
837
+ );
820
838
  }
821
- return parentContext.insertionMode >= HTML_TABLE_MODE
839
+ return parentContext.insertionMode >= HTML_TABLE_MODE ||
840
+ parentContext.insertionMode < HTML_MODE
822
841
  ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
823
- : parentContext.insertionMode === ROOT_HTML_MODE
824
- ? "html" === type
825
- ? createFormatContext(HTML_HTML_MODE, null, parentContext.tagScope)
826
- : createFormatContext(HTML_MODE, null, parentContext.tagScope)
827
- : parentContext.insertionMode === HTML_HTML_MODE
828
- ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
829
- : parentContext;
842
+ : parentContext;
830
843
  }
831
844
  function pushStyleAttribute(target, style) {
832
845
  if ("object" !== typeof style)
@@ -1494,6 +1507,7 @@
1494
1507
  props,
1495
1508
  resumableState,
1496
1509
  renderState,
1510
+ preambleState,
1497
1511
  hoistableState,
1498
1512
  formatContext,
1499
1513
  textEmbedded,
@@ -2648,13 +2662,13 @@
2648
2662
  case "missing-glyph":
2649
2663
  break;
2650
2664
  case "head":
2651
- if (
2652
- formatContext.insertionMode < HTML_MODE &&
2653
- null === renderState.headChunks
2654
- ) {
2655
- renderState.headChunks = [];
2665
+ if (formatContext.insertionMode < HTML_MODE) {
2666
+ var preamble = preambleState || renderState.preamble;
2667
+ if (preamble.headChunks)
2668
+ throw Error("The `<head>` tag may only be rendered once.");
2669
+ preamble.headChunks = [];
2656
2670
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
2657
- renderState.headChunks,
2671
+ preamble.headChunks,
2658
2672
  props,
2659
2673
  "head"
2660
2674
  );
@@ -2665,24 +2679,42 @@
2665
2679
  "head"
2666
2680
  );
2667
2681
  return JSCompiler_inline_result$jscomp$9;
2668
- case "html":
2669
- if (
2670
- formatContext.insertionMode === ROOT_HTML_MODE &&
2671
- null === renderState.htmlChunks
2672
- ) {
2673
- renderState.htmlChunks = [doctypeChunk];
2682
+ case "body":
2683
+ if (formatContext.insertionMode < HTML_MODE) {
2684
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
2685
+ if (preamble$jscomp$0.bodyChunks)
2686
+ throw Error("The `<body>` tag may only be rendered once.");
2687
+ preamble$jscomp$0.bodyChunks = [];
2674
2688
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2675
- renderState.htmlChunks,
2689
+ preamble$jscomp$0.bodyChunks,
2676
2690
  props,
2677
- "html"
2691
+ "body"
2678
2692
  );
2679
2693
  } else
2680
2694
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2681
2695
  target$jscomp$0,
2682
2696
  props,
2683
- "html"
2697
+ "body"
2684
2698
  );
2685
2699
  return JSCompiler_inline_result$jscomp$10;
2700
+ case "html":
2701
+ if (formatContext.insertionMode === ROOT_HTML_MODE) {
2702
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
2703
+ if (preamble$jscomp$1.htmlChunks)
2704
+ throw Error("The `<html>` tag may only be rendered once.");
2705
+ preamble$jscomp$1.htmlChunks = [doctypeChunk];
2706
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2707
+ preamble$jscomp$1.htmlChunks,
2708
+ props,
2709
+ "html"
2710
+ );
2711
+ } else
2712
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2713
+ target$jscomp$0,
2714
+ props,
2715
+ "html"
2716
+ );
2717
+ return JSCompiler_inline_result$jscomp$11;
2686
2718
  default:
2687
2719
  if (-1 !== type.indexOf("-")) {
2688
2720
  target$jscomp$0.push(startChunkForTag(type));
@@ -2749,6 +2781,15 @@
2749
2781
  ((chunk = "</" + tag + ">"), endTagCache.set(tag, chunk));
2750
2782
  return chunk;
2751
2783
  }
2784
+ function hoistPreambleState(renderState, preambleState) {
2785
+ renderState = renderState.preamble;
2786
+ null === renderState.htmlChunks &&
2787
+ (renderState.htmlChunks = preambleState.htmlChunks);
2788
+ null === renderState.headChunks &&
2789
+ (renderState.headChunks = preambleState.headChunks);
2790
+ null === renderState.bodyChunks &&
2791
+ (renderState.bodyChunks = preambleState.bodyChunks);
2792
+ }
2752
2793
  function writeBootstrap(destination, renderState) {
2753
2794
  renderState = renderState.bootstrapChunks;
2754
2795
  for (var i = 0; i < renderState.length - 1; i++)
@@ -2772,6 +2813,7 @@
2772
2813
  switch (formatContext.insertionMode) {
2773
2814
  case ROOT_HTML_MODE:
2774
2815
  case HTML_HTML_MODE:
2816
+ case HTML_HEAD_MODE:
2775
2817
  case HTML_MODE:
2776
2818
  return (
2777
2819
  destination.push(startSegmentHTML),
@@ -2836,6 +2878,7 @@
2836
2878
  switch (formatContext.insertionMode) {
2837
2879
  case ROOT_HTML_MODE:
2838
2880
  case HTML_HTML_MODE:
2881
+ case HTML_HEAD_MODE:
2839
2882
  case HTML_MODE:
2840
2883
  return destination.push(endSegmentHTML);
2841
2884
  case SVG_MODE:
@@ -3229,8 +3272,7 @@
3229
3272
  segmentPrefix: idPrefix + "S:",
3230
3273
  boundaryPrefix: idPrefix + "B:",
3231
3274
  startInlineScript: "<script>",
3232
- htmlChunks: null,
3233
- headChunks: null,
3275
+ preamble: createPreambleState(),
3234
3276
  externalRuntimeScript: null,
3235
3277
  bootstrapChunks: bootstrapChunks,
3236
3278
  importMapChunks: [],
@@ -3360,8 +3402,7 @@
3360
3402
  segmentPrefix: idPrefix.segmentPrefix,
3361
3403
  boundaryPrefix: idPrefix.boundaryPrefix,
3362
3404
  startInlineScript: idPrefix.startInlineScript,
3363
- htmlChunks: idPrefix.htmlChunks,
3364
- headChunks: idPrefix.headChunks,
3405
+ preamble: idPrefix.preamble,
3365
3406
  externalRuntimeScript: idPrefix.externalRuntimeScript,
3366
3407
  bootstrapChunks: idPrefix.bootstrapChunks,
3367
3408
  importMapChunks: idPrefix.importMapChunks,
@@ -4199,7 +4240,7 @@
4199
4240
  this.status = 10;
4200
4241
  this.fatalError = null;
4201
4242
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
4202
- this.completedRootSegment = null;
4243
+ this.completedPreambleSegments = this.completedRootSegment = null;
4203
4244
  this.abortableTasks = abortSet;
4204
4245
  this.pingedTasks = [];
4205
4246
  this.clientRenderedBoundaries = [];
@@ -4259,6 +4300,7 @@
4259
4300
  null,
4260
4301
  renderState,
4261
4302
  null,
4303
+ null,
4262
4304
  resumableState.abortableTasks,
4263
4305
  null,
4264
4306
  rootFormatContext,
@@ -4277,7 +4319,12 @@
4277
4319
  ((request.flushScheduled = null !== request.destination),
4278
4320
  performWork(request));
4279
4321
  }
4280
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
4322
+ function createSuspenseBoundary(
4323
+ request,
4324
+ fallbackAbortableTasks,
4325
+ contentPreamble,
4326
+ fallbackPreamble
4327
+ ) {
4281
4328
  return {
4282
4329
  status: PENDING,
4283
4330
  rootSegmentID: -1,
@@ -4289,6 +4336,8 @@
4289
4336
  errorDigest: null,
4290
4337
  contentState: createHoistableState(),
4291
4338
  fallbackState: createHoistableState(),
4339
+ contentPreamble: contentPreamble,
4340
+ fallbackPreamble: fallbackPreamble,
4292
4341
  trackedContentKeyPath: null,
4293
4342
  trackedFallbackNode: null,
4294
4343
  errorMessage: null,
@@ -4303,6 +4352,7 @@
4303
4352
  childIndex,
4304
4353
  blockedBoundary,
4305
4354
  blockedSegment,
4355
+ blockedPreamble,
4306
4356
  hoistableState,
4307
4357
  abortSet,
4308
4358
  keyPath,
@@ -4325,6 +4375,7 @@
4325
4375
  },
4326
4376
  blockedBoundary: blockedBoundary,
4327
4377
  blockedSegment: blockedSegment,
4378
+ blockedPreamble: blockedPreamble,
4328
4379
  hoistableState: hoistableState,
4329
4380
  abortSet: abortSet,
4330
4381
  keyPath: keyPath,
@@ -4368,6 +4419,7 @@
4368
4419
  },
4369
4420
  blockedBoundary: blockedBoundary,
4370
4421
  blockedSegment: null,
4422
+ blockedPreamble: null,
4371
4423
  hoistableState: hoistableState,
4372
4424
  abortSet: abortSet,
4373
4425
  keyPath: keyPath,
@@ -4391,11 +4443,12 @@
4391
4443
  ) {
4392
4444
  return {
4393
4445
  status: PENDING,
4446
+ parentFlushed: !1,
4394
4447
  id: -1,
4395
4448
  index: index,
4396
- parentFlushed: !1,
4397
4449
  chunks: [],
4398
4450
  children: [],
4451
+ preambleChildren: [],
4399
4452
  parentFormatContext: parentFormatContext,
4400
4453
  boundary: boundary,
4401
4454
  lastPushedText: lastPushedText,
@@ -5035,6 +5088,7 @@
5035
5088
  props,
5036
5089
  request.resumableState,
5037
5090
  request.renderState,
5091
+ task.blockedPreamble,
5038
5092
  task.hoistableState,
5039
5093
  task.formatContext,
5040
5094
  segment.lastPushedText,
@@ -5043,9 +5097,43 @@
5043
5097
  segment.lastPushedText = !1;
5044
5098
  var _prevContext = task.formatContext,
5045
5099
  _prevKeyPath2 = task.keyPath;
5046
- task.formatContext = getChildFormatContext(_prevContext, type, props);
5047
5100
  task.keyPath = keyPath;
5048
- renderNode(request, task, _children, -1);
5101
+ if (
5102
+ (task.formatContext = getChildFormatContext(
5103
+ _prevContext,
5104
+ type,
5105
+ props
5106
+ )).insertionMode === HTML_HEAD_MODE
5107
+ ) {
5108
+ var preambleSegment = createPendingSegment(
5109
+ request,
5110
+ 0,
5111
+ null,
5112
+ task.formatContext,
5113
+ !1,
5114
+ !1
5115
+ );
5116
+ segment.preambleChildren.push(preambleSegment);
5117
+ var preambleTask = createRenderTask(
5118
+ request,
5119
+ null,
5120
+ _children,
5121
+ -1,
5122
+ task.blockedBoundary,
5123
+ preambleSegment,
5124
+ task.blockedPreamble,
5125
+ task.hoistableState,
5126
+ request.abortableTasks,
5127
+ task.keyPath,
5128
+ task.formatContext,
5129
+ task.context,
5130
+ task.treeContext,
5131
+ task.componentStack,
5132
+ task.isFallback
5133
+ );
5134
+ pushComponentStack(preambleTask);
5135
+ request.pingedTasks.push(preambleTask);
5136
+ } else renderNode(request, task, _children, -1);
5049
5137
  task.formatContext = _prevContext;
5050
5138
  task.keyPath = _prevKeyPath2;
5051
5139
  a: {
@@ -5082,6 +5170,9 @@
5082
5170
  resumableState.hasHtml = !0;
5083
5171
  break a;
5084
5172
  }
5173
+ break;
5174
+ case "head":
5175
+ if (_prevContext.insertionMode <= HTML_HTML_MODE) break a;
5085
5176
  }
5086
5177
  target.push(endChunkForTag(type));
5087
5178
  }
@@ -5130,12 +5221,26 @@
5130
5221
  } else {
5131
5222
  var prevKeyPath$jscomp$3 = task.keyPath,
5132
5223
  parentBoundary = task.blockedBoundary,
5224
+ parentPreamble = task.blockedPreamble,
5133
5225
  parentHoistableState = task.hoistableState,
5134
5226
  parentSegment = task.blockedSegment,
5135
5227
  fallback = props.fallback,
5136
5228
  content = props.children,
5137
- fallbackAbortSet = new Set(),
5138
- newBoundary = createSuspenseBoundary(request, fallbackAbortSet);
5229
+ fallbackAbortSet = new Set();
5230
+ var newBoundary =
5231
+ task.formatContext.insertionMode < HTML_MODE
5232
+ ? createSuspenseBoundary(
5233
+ request,
5234
+ fallbackAbortSet,
5235
+ createPreambleState(),
5236
+ createPreambleState()
5237
+ )
5238
+ : createSuspenseBoundary(
5239
+ request,
5240
+ fallbackAbortSet,
5241
+ null,
5242
+ null
5243
+ );
5139
5244
  null !== request.trackedPostpones &&
5140
5245
  (newBoundary.trackedContentKeyPath = keyPath);
5141
5246
  var boundarySegment = createPendingSegment(
@@ -5175,6 +5280,7 @@
5175
5280
  );
5176
5281
  newBoundary.trackedFallbackNode = fallbackReplayNode;
5177
5282
  task.blockedSegment = boundarySegment;
5283
+ task.blockedPreamble = newBoundary.fallbackPreamble;
5178
5284
  task.keyPath = fallbackKeyPath;
5179
5285
  boundarySegment.status = 6;
5180
5286
  try {
@@ -5193,6 +5299,7 @@
5193
5299
  );
5194
5300
  } finally {
5195
5301
  (task.blockedSegment = parentSegment),
5302
+ (task.blockedPreamble = parentPreamble),
5196
5303
  (task.keyPath = prevKeyPath$jscomp$3);
5197
5304
  }
5198
5305
  var suspendedPrimaryTask = createRenderTask(
@@ -5202,6 +5309,7 @@
5202
5309
  -1,
5203
5310
  newBoundary,
5204
5311
  contentRootSegment,
5312
+ newBoundary.contentPreamble,
5205
5313
  newBoundary.contentState,
5206
5314
  task.abortSet,
5207
5315
  keyPath,
@@ -5215,6 +5323,7 @@
5215
5323
  request.pingedTasks.push(suspendedPrimaryTask);
5216
5324
  } else {
5217
5325
  task.blockedBoundary = newBoundary;
5326
+ task.blockedPreamble = newBoundary.contentPreamble;
5218
5327
  task.hoistableState = newBoundary.contentState;
5219
5328
  task.blockedSegment = contentRootSegment;
5220
5329
  task.keyPath = keyPath;
@@ -5234,6 +5343,9 @@
5234
5343
  newBoundary.status === PENDING)
5235
5344
  ) {
5236
5345
  newBoundary.status = COMPLETED;
5346
+ 0 === request.pendingRootTasks &&
5347
+ task.blockedPreamble &&
5348
+ preparePreamble(request);
5237
5349
  break a;
5238
5350
  }
5239
5351
  } catch (thrownValue$2) {
@@ -5259,6 +5371,7 @@
5259
5371
  untrackBoundary(request, newBoundary);
5260
5372
  } finally {
5261
5373
  (task.blockedBoundary = parentBoundary),
5374
+ (task.blockedPreamble = parentPreamble),
5262
5375
  (task.hoistableState = parentHoistableState),
5263
5376
  (task.blockedSegment = parentSegment),
5264
5377
  (task.keyPath = prevKeyPath$jscomp$3);
@@ -5270,6 +5383,7 @@
5270
5383
  -1,
5271
5384
  parentBoundary,
5272
5385
  boundarySegment,
5386
+ newBoundary.fallbackPreamble,
5273
5387
  newBoundary.fallbackState,
5274
5388
  fallbackAbortSet,
5275
5389
  [keyPath[0], "Suspense Fallback", keyPath[2]],
@@ -5527,17 +5641,27 @@
5527
5641
  previousReplaySet = task.replay,
5528
5642
  parentBoundary = task.blockedBoundary,
5529
5643
  parentHoistableState = task.hoistableState,
5530
- content = props.children;
5531
- props = props.fallback;
5532
- var fallbackAbortSet = new Set(),
5533
- resumedBoundary = createSuspenseBoundary(
5534
- request,
5535
- fallbackAbortSet
5536
- );
5537
- resumedBoundary.parentFlushed = !0;
5538
- resumedBoundary.rootSegmentID = ref;
5539
- task.blockedBoundary = resumedBoundary;
5540
- task.hoistableState = resumedBoundary.contentState;
5644
+ content = props.children,
5645
+ fallback = props.fallback,
5646
+ fallbackAbortSet = new Set();
5647
+ props =
5648
+ task.formatContext.insertionMode < HTML_MODE
5649
+ ? createSuspenseBoundary(
5650
+ request,
5651
+ fallbackAbortSet,
5652
+ createPreambleState(),
5653
+ createPreambleState()
5654
+ )
5655
+ : createSuspenseBoundary(
5656
+ request,
5657
+ fallbackAbortSet,
5658
+ null,
5659
+ null
5660
+ );
5661
+ props.parentFlushed = !0;
5662
+ props.rootSegmentID = ref;
5663
+ task.blockedBoundary = props;
5664
+ task.hoistableState = props.contentState;
5541
5665
  task.keyPath = keyPath;
5542
5666
  task.replay = {
5543
5667
  nodes: replay,
@@ -5555,15 +5679,15 @@
5555
5679
  );
5556
5680
  task.replay.pendingTasks--;
5557
5681
  if (
5558
- 0 === resumedBoundary.pendingTasks &&
5559
- resumedBoundary.status === PENDING
5682
+ 0 === props.pendingTasks &&
5683
+ props.status === PENDING
5560
5684
  ) {
5561
- resumedBoundary.status = COMPLETED;
5562
- request.completedBoundaries.push(resumedBoundary);
5685
+ props.status = COMPLETED;
5686
+ request.completedBoundaries.push(props);
5563
5687
  break a;
5564
5688
  }
5565
5689
  } catch (error) {
5566
- (resumedBoundary.status = CLIENT_RENDERED),
5690
+ (props.status = CLIENT_RENDERED),
5567
5691
  (childNodes = getThrownInfo(task.componentStack)),
5568
5692
  (type = logRecoverableError(
5569
5693
  request,
@@ -5571,16 +5695,14 @@
5571
5695
  childNodes
5572
5696
  )),
5573
5697
  encodeErrorForBoundary(
5574
- resumedBoundary,
5698
+ props,
5575
5699
  type,
5576
5700
  error,
5577
5701
  childNodes,
5578
5702
  !1
5579
5703
  ),
5580
5704
  task.replay.pendingTasks--,
5581
- request.clientRenderedBoundaries.push(
5582
- resumedBoundary
5583
- );
5705
+ request.clientRenderedBoundaries.push(props);
5584
5706
  } finally {
5585
5707
  (task.blockedBoundary = parentBoundary),
5586
5708
  (task.hoistableState = parentHoistableState),
@@ -5591,10 +5713,10 @@
5591
5713
  request,
5592
5714
  null,
5593
5715
  { nodes: keyOrIndex, slots: key, pendingTasks: 0 },
5594
- props,
5716
+ fallback,
5595
5717
  -1,
5596
5718
  parentBoundary,
5597
- resumedBoundary.fallbackState,
5719
+ props.fallbackState,
5598
5720
  fallbackAbortSet,
5599
5721
  [keyPath[0], "Suspense Fallback", keyPath[2]],
5600
5722
  task.formatContext,
@@ -5923,6 +6045,7 @@
5923
6045
  task.childIndex,
5924
6046
  task.blockedBoundary,
5925
6047
  newSegment,
6048
+ task.blockedPreamble,
5926
6049
  task.hoistableState,
5927
6050
  task.abortSet,
5928
6051
  task.keyPath,
@@ -6091,7 +6214,12 @@
6091
6214
  errorDigest = errorDigest$jscomp$0,
6092
6215
  errorInfo = errorInfo$jscomp$0,
6093
6216
  wasAborted = aborted,
6094
- resumedBoundary = createSuspenseBoundary(request, new Set());
6217
+ resumedBoundary = createSuspenseBoundary(
6218
+ request,
6219
+ new Set(),
6220
+ null,
6221
+ null
6222
+ );
6095
6223
  resumedBoundary.parentFlushed = !0;
6096
6224
  resumedBoundary.rootSegmentID = node;
6097
6225
  resumedBoundary.status = CLIENT_RENDERED;
@@ -6244,6 +6372,7 @@
6244
6372
  }
6245
6373
  function completeShell(request) {
6246
6374
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
6375
+ null === request.trackedPostpones && preparePreamble(request);
6247
6376
  request.onShellError = noop;
6248
6377
  request = request.onShellReady;
6249
6378
  request();
@@ -6256,6 +6385,7 @@
6256
6385
  : null === request.completedRootSegment ||
6257
6386
  request.completedRootSegment.status !== POSTPONED
6258
6387
  );
6388
+ preparePreamble(request);
6259
6389
  request = request.onAllReady;
6260
6390
  request();
6261
6391
  }
@@ -6300,7 +6430,11 @@
6300
6430
  abortTaskSoft,
6301
6431
  request
6302
6432
  ),
6303
- boundary.fallbackAbortableTasks.clear()))
6433
+ boundary.fallbackAbortableTasks.clear(),
6434
+ 0 === request.pendingRootTasks &&
6435
+ null === request.trackedPostpones &&
6436
+ null !== boundary.contentPreamble &&
6437
+ preparePreamble(request)))
6304
6438
  : null !== segment &&
6305
6439
  segment.parentFlushed &&
6306
6440
  segment.status === COMPLETED &&
@@ -6473,7 +6607,11 @@
6473
6607
  ),
6474
6608
  untrackBoundary(request, boundary),
6475
6609
  boundary.parentFlushed &&
6476
- request.clientRenderedBoundaries.push(boundary)));
6610
+ request.clientRenderedBoundaries.push(boundary),
6611
+ 0 === request.pendingRootTasks &&
6612
+ null === request.trackedPostpones &&
6613
+ null !== boundary.contentPreamble &&
6614
+ preparePreamble(request)));
6477
6615
  request.allPendingTasks--;
6478
6616
  0 === request.allPendingTasks && completeAll(request);
6479
6617
  }
@@ -6502,6 +6640,85 @@
6502
6640
  }
6503
6641
  }
6504
6642
  }
6643
+ function preparePreambleFromSubtree(
6644
+ request,
6645
+ segment,
6646
+ collectedPreambleSegments
6647
+ ) {
6648
+ segment.preambleChildren.length &&
6649
+ collectedPreambleSegments.push(segment.preambleChildren);
6650
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
6651
+ pendingPreambles =
6652
+ preparePreambleFromSegment(
6653
+ request,
6654
+ segment.children[i],
6655
+ collectedPreambleSegments
6656
+ ) || pendingPreambles;
6657
+ return pendingPreambles;
6658
+ }
6659
+ function preparePreambleFromSegment(
6660
+ request,
6661
+ segment,
6662
+ collectedPreambleSegments
6663
+ ) {
6664
+ var boundary = segment.boundary;
6665
+ if (null === boundary)
6666
+ return preparePreambleFromSubtree(
6667
+ request,
6668
+ segment,
6669
+ collectedPreambleSegments
6670
+ );
6671
+ var preamble = boundary.contentPreamble,
6672
+ fallbackPreamble = boundary.fallbackPreamble;
6673
+ if (null === preamble || null === fallbackPreamble) return !1;
6674
+ switch (boundary.status) {
6675
+ case COMPLETED:
6676
+ hoistPreambleState(request.renderState, preamble);
6677
+ segment = boundary.completedSegments[0];
6678
+ if (!segment)
6679
+ throw Error(
6680
+ "A previously unvisited boundary must have exactly one root segment. This is a bug in React."
6681
+ );
6682
+ return preparePreambleFromSubtree(
6683
+ request,
6684
+ segment,
6685
+ collectedPreambleSegments
6686
+ );
6687
+ case POSTPONED:
6688
+ if (null !== request.trackedPostpones) return !0;
6689
+ case CLIENT_RENDERED:
6690
+ if (segment.status === COMPLETED)
6691
+ return (
6692
+ hoistPreambleState(request.renderState, fallbackPreamble),
6693
+ preparePreambleFromSubtree(
6694
+ request,
6695
+ segment,
6696
+ collectedPreambleSegments
6697
+ )
6698
+ );
6699
+ default:
6700
+ return !0;
6701
+ }
6702
+ }
6703
+ function preparePreamble(request) {
6704
+ if (
6705
+ request.completedRootSegment &&
6706
+ null === request.completedPreambleSegments
6707
+ ) {
6708
+ var collectedPreambleSegments = [],
6709
+ hasPendingPreambles = preparePreambleFromSegment(
6710
+ request,
6711
+ request.completedRootSegment,
6712
+ collectedPreambleSegments
6713
+ ),
6714
+ preamble = request.renderState.preamble;
6715
+ if (
6716
+ !1 === hasPendingPreambles ||
6717
+ (preamble.headChunks && preamble.bodyChunks)
6718
+ )
6719
+ request.completedPreambleSegments = collectedPreambleSegments;
6720
+ }
6721
+ }
6505
6722
  function flushSubtree(request, destination, segment, hoistableState) {
6506
6723
  segment.parentFlushed = !0;
6507
6724
  switch (segment.status) {
@@ -6765,9 +6982,12 @@
6765
6982
  completedRootSegment = request.completedRootSegment;
6766
6983
  if (null !== completedRootSegment) {
6767
6984
  if (completedRootSegment.status === POSTPONED) return;
6985
+ var completedPreambleSegments = request.completedPreambleSegments;
6986
+ if (null === completedPreambleSegments) return;
6768
6987
  var renderState = request.renderState,
6769
- htmlChunks = renderState.htmlChunks,
6770
- headChunks = renderState.headChunks,
6988
+ preamble = renderState.preamble,
6989
+ htmlChunks = preamble.htmlChunks,
6990
+ headChunks = preamble.headChunks,
6771
6991
  i$jscomp$0;
6772
6992
  if (htmlChunks) {
6773
6993
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -6830,11 +7050,29 @@
6830
7050
  i$jscomp$0++
6831
7051
  )
6832
7052
  destination.push(hoistableChunks[i$jscomp$0]);
6833
- hoistableChunks.length = 0;
6834
- if (htmlChunks && null === headChunks) {
7053
+ for (
7054
+ renderState = hoistableChunks.length = 0;
7055
+ renderState < completedPreambleSegments.length;
7056
+ renderState++
7057
+ ) {
7058
+ var segments = completedPreambleSegments[renderState];
7059
+ for (preamble = 0; preamble < segments.length; preamble++)
7060
+ flushSegment(request, destination, segments[preamble], null);
7061
+ }
7062
+ var preamble$jscomp$0 = request.renderState.preamble,
7063
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
7064
+ if (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) {
6835
7065
  var chunk$jscomp$0 = endChunkForTag("head");
6836
7066
  destination.push(chunk$jscomp$0);
6837
7067
  }
7068
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
7069
+ if (bodyChunks)
7070
+ for (
7071
+ completedPreambleSegments = 0;
7072
+ completedPreambleSegments < bodyChunks.length;
7073
+ completedPreambleSegments++
7074
+ )
7075
+ destination.push(bodyChunks[completedPreambleSegments]);
6838
7076
  flushSegment(request, destination, completedRootSegment, null);
6839
7077
  request.completedRootSegment = null;
6840
7078
  writeBootstrap(destination, request.renderState);
@@ -8202,12 +8440,13 @@
8202
8440
  var ROOT_HTML_MODE = 0,
8203
8441
  HTML_HTML_MODE = 1,
8204
8442
  HTML_MODE = 2,
8205
- SVG_MODE = 3,
8206
- MATHML_MODE = 4,
8207
- HTML_TABLE_MODE = 5,
8208
- HTML_TABLE_BODY_MODE = 6,
8209
- HTML_TABLE_ROW_MODE = 7,
8210
- HTML_COLGROUP_MODE = 8,
8443
+ HTML_HEAD_MODE = 3,
8444
+ SVG_MODE = 4,
8445
+ MATHML_MODE = 5,
8446
+ HTML_TABLE_MODE = 6,
8447
+ HTML_TABLE_BODY_MODE = 7,
8448
+ HTML_TABLE_ROW_MODE = 8,
8449
+ HTML_COLGROUP_MODE = 9,
8211
8450
  styleNameCache = new Map(),
8212
8451
  styleAttributeStart = ' style="',
8213
8452
  styleAssign = ":",
@@ -8567,5 +8806,5 @@
8567
8806
  'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
8568
8807
  );
8569
8808
  };
8570
- exports.version = "19.1.0-canary-5b51a2b9-20250116";
8809
+ exports.version = "19.1.0-canary-18eaf51b-20250118";
8571
8810
  })();