octane 0.3.2 → 0.3.4

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.
package/dist/runtime.js CHANGED
@@ -544,7 +544,8 @@ function scopeSignalOwner(scope) {
544
544
  }
545
545
  function runWithBlockSignalOwner(scope, callback) {
546
546
  const owner = scopeSignalOwner(scope);
547
- if (owner !== void 0) STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
547
+ if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
548
+ STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
548
549
  return owner === void 0 || currentSignalOwner() === owner ? callback() : runWithSignalOwner(owner, callback);
549
550
  }
550
551
  import { readNativeDomStyle as readNativeDomStyle2, readNativeDomProps } from "./signals/read-protocol.js";
@@ -639,6 +640,8 @@ function nativeProjectionBinding(owner, slotIndex, el, compute, fields) {
639
640
  nativePresentationBinding(owner, slotIndex, el, nativeProjectionBody, { el, compute, fields });
640
641
  }
641
642
  function nativePresentationBinding(owner, slotIndex, el, body, props) {
643
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && el.ownerDocument !== hydrateAttributeProbe.document)
644
+ throw new PresentationAdoptionMiss(void 0, false);
642
645
  let binding = owner.slots[slotIndex];
643
646
  if (binding === void 0) {
644
647
  const block = createBlock("control-flow", owner.block, el, null, null, body, props);
@@ -670,6 +673,8 @@ function enableNativeReadCollection(abi = 1) {
670
673
  ensureNativeReadDriver();
671
674
  }
672
675
  function beginNativeReadScope(scope, abi = 1) {
676
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null)
677
+ throw new PresentationAdoptionMiss(void 0, false);
673
678
  if (abi !== 1) throw new Error(formatClientError(58));
674
679
  const block = CURRENT_BLOCK;
675
680
  const owner = scope ?? CURRENT_SCOPE;
@@ -677,6 +682,7 @@ function beginNativeReadScope(scope, abi = 1) {
677
682
  return ensureNativeReadDriver().beginScope(owner, block);
678
683
  }
679
684
  function beginActiveNativeReadScope(scope) {
685
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return -1;
680
686
  const block = CURRENT_BLOCK;
681
687
  return block === null ? -1 : NATIVE_READ_DRIVER.beginScope(scope, block);
682
688
  }
@@ -911,13 +917,13 @@ function hydrationMismatchMode(el) {
911
917
  }
912
918
  function warnHydrationValueMismatch(loc, what, serverVal, clientVal) {
913
919
  if (process.env.NODE_ENV === "production") return;
914
- if (!loc) return;
920
+ if (!loc || hydrateAttributeProbe !== null) return;
915
921
  console.error(
916
922
  `Octane hydration mismatch at ${loc}: server rendered ${what} ${JSON.stringify(serverVal)} but the client rendered ${JSON.stringify(clientVal)}. The client value was used. If this difference is intentional (e.g. a timestamp or random id), add suppressHydrationWarning to the element.`
917
923
  );
918
924
  }
919
925
  function warnHydrationKeptServerValue(loc, what, serverVal, clientVal) {
920
- if (process.env.NODE_ENV === "production" || !loc) return;
926
+ if (process.env.NODE_ENV === "production" || !loc || hydrateAttributeProbe !== null) return;
921
927
  console.error(
922
928
  `Octane hydration mismatch at ${loc}: server rendered ${what} ${JSON.stringify(serverVal)} but the client rendered ${JSON.stringify(clientVal)}. The server value was kept. If this difference is intentional, add suppressHydrationWarning to the element.`
923
929
  );
@@ -936,7 +942,7 @@ function describeHydrationNode(node) {
936
942
  }
937
943
  function warnHydrationStructuralMismatch(loc, expected, actual) {
938
944
  if (process.env.NODE_ENV === "production") return;
939
- if (!loc) return;
945
+ if (!loc || hydrateAttributeProbe !== null) return;
940
946
  console.error(
941
947
  `Octane hydration mismatch at ${loc}: the client expected ${expected} but the server rendered ${actual}. The mismatched subtree was rebuilt on the client.`
942
948
  );
@@ -6426,7 +6432,8 @@ function captureRenderPhaseUpdate(cell, key) {
6426
6432
  function renderBlock(block) {
6427
6433
  if (signalDocumentEnabled || block.idState.renderOwner?.signalOwner !== void 0) {
6428
6434
  const owner = scopeSignalOwner(block);
6429
- if (owner !== void 0) STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
6435
+ if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
6436
+ STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
6430
6437
  if (owner !== void 0 && currentSignalOwner() !== owner) {
6431
6438
  runWithSignalOwner(owner, () => renderBlock(block));
6432
6439
  return;
@@ -6585,7 +6592,13 @@ function renderBlockInner(block) {
6585
6592
  block.__thenableDone = false;
6586
6593
  }
6587
6594
  if (block.$$ctxReads !== null) block.$$ctxReads.clear();
6588
- if (block.$$ctxDirect !== null) block.$$ctxDirect.clear();
6595
+ if (block.$$ctxDirect !== null) {
6596
+ const state = block.slots[0];
6597
+ if (state?.__kind === "hydrateBlockSlot" && state.parentBlock === block && !state.independent && !state.hydrated) {
6598
+ state.contextChanged = block.$$ctxDepsEpoch !== contextEpochNow() && ctxDirectChanged(block);
6599
+ }
6600
+ block.$$ctxDirect.clear();
6601
+ }
6589
6602
  block.$$ctxDepsEpoch = contextEpochNow();
6590
6603
  block.currentRenderMode = urgentTransitionRender !== null ? "urgent" : block.pendingMode ?? prevBlock?.currentRenderMode ?? "urgent";
6591
6604
  block.currentRenderDeferred = urgentTransitionRender !== null ? false : block.pendingMode !== null ? block.pendingDeferred : prevBlock?.currentRenderDeferred ?? false;
@@ -6610,7 +6623,9 @@ function renderBlockInner(block) {
6610
6623
  renderRetry = true;
6611
6624
  return true;
6612
6625
  }
6613
- if (out !== void 0 && block.outputHandler !== null) block.outputHandler(block, out);
6626
+ if (block.outputHandler !== null && (out !== void 0 || block.slots[0]?.returnedOutput === true)) {
6627
+ block.outputHandler(block, out ?? null);
6628
+ }
6614
6629
  finishEffectRender(block);
6615
6630
  if (!block.mounted) block.mounted = true;
6616
6631
  if (block.renderStatus === RENDER_RETRYING) block.renderStatus = RENDER_VALID;
@@ -6669,6 +6684,14 @@ function renderBlockInner(block) {
6669
6684
  }
6670
6685
  }
6671
6686
  }
6687
+ let RETURNED_OUTPUT_SCOPE = null;
6688
+ function setReturnedOutputOwner(state, returned) {
6689
+ if (state.returnedOutput === returned) return;
6690
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
6691
+ TRANSITION_JOURNAL.push(JOURNAL_PROP, state, "returnedOutput", state.returnedOutput);
6692
+ }
6693
+ state.returnedOutput = returned;
6694
+ }
6672
6695
  function returnSlotTail(block, state) {
6673
6696
  const candidates = [
6674
6697
  state?.end,
@@ -6685,59 +6708,82 @@ function returnSlotTail(block, state) {
6685
6708
  }
6686
6709
  return null;
6687
6710
  }
6688
- function renderReturnedValue(block, out) {
6689
- const isComponentDescriptor = out !== null && out.$$kind === ELEMENT_TAG && out.key == null && typeof out.type === "function";
6690
- const existingRet = block.slots[0];
6691
- let replacedStart = null;
6692
- let replacedEnd = null;
6693
- const useSingleRoot = isComponentDescriptor && (out.type.$$singleRoot === true || activeHydration()?.passthroughRanges === true || // STICKY regime: a return slot mounted through the componentSlot route
6694
- // (most importantly by the passthrough-hydration branch above, whose
6695
- // condition is false again once hydration ends) keeps that route while
6696
- // the returned component identity is unchanged. Falling through to the
6697
- // childSlot route would dispose the slot for a mere kind flip — tearing
6698
- // down the very subtree hydration just adopted on its FIRST update. An
6699
- // identity change still disposes below (matching remount semantics).
6700
- existingRet !== void 0 && existingRet.__kind === "componentSlotSlot" && existingRet.currentComp === out.type);
6701
- if (existingRet !== void 0 && existingRet.__kind !== (useSingleRoot ? "componentSlotSlot" : "childSlot")) {
6702
- const swapDriver = TRANSITION_SWAP_DRIVER;
6703
- const transitionMode = block.currentRenderMode === "transition";
6704
- const committedSuspense = swapDriver !== null && activeHydration() === null && preservesCommittedSuspense(block);
6705
- const transitionSwap = ROOT_RENDER_TRANSACTION === null || committedSuspense ? swapDriver : null;
6706
- const suspenseSwap = transitionSwap !== null && !transitionMode && activeHydration() === null && committedSuspense;
6707
- if (transitionSwap !== null && activeHydration() === null && (transitionMode || suspenseSwap)) {
6708
- const tail = returnSlotTail(block, existingRet);
6709
- if (tail !== null) {
6710
- const probe = transitionSwap.render(
6711
- block,
6712
- block.parentNode,
6713
- tail,
6714
- ROOT_RENDERABLE_BODY,
6715
- out,
6716
- renderReturnedValue
6717
- );
6718
- transitionSwap.dispose(probe.wip);
6719
- if (probe.failed) throw probe.error;
6720
- if (probe.suspended) throw new SuspenseException(probe.suspended);
6721
- }
6711
+ function renderReturnedValue(block, out, reset) {
6712
+ const previous = RETURNED_OUTPUT_SCOPE;
6713
+ RETURNED_OUTPUT_SCOPE = block;
6714
+ try {
6715
+ if (reset === true) {
6716
+ const state2 = block.slots[0];
6717
+ if (state2 !== void 0) disposeReturnSlot(block, state2);
6718
+ return;
6722
6719
  }
6723
- if (ROOT_RENDER_TRANSACTION !== null && !existingRet.inherited && !existingRet.borrowed && existingRet.ownerHost == null) {
6724
- const first = existingRet.start ?? existingRet.hostNode ?? existingRet.text ?? existingRet.block?.startMarker ?? existingRet.end ?? null;
6725
- const last = existingRet.end ?? existingRet.block?.endMarker ?? first;
6726
- if (sharesBlockBoundary(block, first, last)) {
6727
- replacedStart = first;
6728
- replacedEnd = last;
6720
+ const isComponentDescriptor = out !== null && out.$$kind === ELEMENT_TAG && out.key == null && typeof out.type === "function";
6721
+ const existingRet = block.slots[0];
6722
+ let replacedStart = null;
6723
+ let replacedEnd = null;
6724
+ const useSingleRoot = isComponentDescriptor && (out.type.$$singleRoot === true || activeHydration()?.passthroughRanges === true || // STICKY regime: a return slot mounted through the componentSlot route
6725
+ // (most importantly by the passthrough-hydration branch above, whose
6726
+ // condition is false again once hydration ends) keeps that route while
6727
+ // the returned component identity is unchanged. Falling through to the
6728
+ // childSlot route would dispose the slot for a mere kind flip — tearing
6729
+ // down the very subtree hydration just adopted on its FIRST update. An
6730
+ // identity change still disposes below (matching remount semantics).
6731
+ existingRet !== void 0 && existingRet.__kind === "componentSlotSlot" && existingRet.currentComp === out.type);
6732
+ if (existingRet !== void 0 && existingRet.__kind !== (useSingleRoot ? "componentSlotSlot" : "childSlot")) {
6733
+ const swapDriver = TRANSITION_SWAP_DRIVER;
6734
+ const transitionMode = block.currentRenderMode === "transition";
6735
+ const committedSuspense = swapDriver !== null && activeHydration() === null && preservesCommittedSuspense(block);
6736
+ const transitionSwap = ROOT_RENDER_TRANSACTION === null || committedSuspense ? swapDriver : null;
6737
+ const suspenseSwap = transitionSwap !== null && !transitionMode && activeHydration() === null && committedSuspense;
6738
+ if (transitionSwap !== null && activeHydration() === null && (transitionMode || suspenseSwap)) {
6739
+ const tail = returnSlotTail(block, existingRet);
6740
+ if (tail !== null) {
6741
+ const probe = transitionSwap.render(
6742
+ block,
6743
+ block.parentNode,
6744
+ tail,
6745
+ ROOT_RENDERABLE_BODY,
6746
+ out,
6747
+ renderReturnedValue
6748
+ );
6749
+ transitionSwap.dispose(probe.wip);
6750
+ if (probe.failed) throw probe.error;
6751
+ if (probe.suspended) throw new SuspenseException(probe.suspended);
6752
+ }
6729
6753
  }
6754
+ if (ROOT_RENDER_TRANSACTION !== null && !existingRet.inherited && !existingRet.borrowed && existingRet.ownerHost == null) {
6755
+ const first = existingRet.start ?? existingRet.hostNode ?? existingRet.text ?? existingRet.block?.startMarker ?? existingRet.end ?? null;
6756
+ const last = existingRet.end ?? existingRet.block?.endMarker ?? first;
6757
+ if (sharesBlockBoundary(block, first, last)) {
6758
+ replacedStart = first;
6759
+ replacedEnd = last;
6760
+ }
6761
+ }
6762
+ disposeReturnSlot(block, existingRet);
6763
+ if (block.disposed) return;
6730
6764
  }
6731
- disposeReturnSlot(block, existingRet);
6732
- if (block.disposed) return;
6733
- }
6734
- if (useSingleRoot) {
6735
- const d = out;
6736
- if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && !__profileHasComponentMetadata(d.type)) {
6737
- withProfileComponentOverride(
6738
- d.type,
6739
- null,
6740
- () => componentSlot(
6765
+ if (useSingleRoot) {
6766
+ const d = out;
6767
+ if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && !__profileHasComponentMetadata(d.type)) {
6768
+ withProfileComponentOverride(
6769
+ d.type,
6770
+ null,
6771
+ () => componentSlot(
6772
+ block,
6773
+ 0,
6774
+ block.parentNode,
6775
+ d.type,
6776
+ d.props,
6777
+ block.endMarker,
6778
+ d.key ?? void 0,
6779
+ true,
6780
+ void 0,
6781
+ activeHydration() !== null && elementKeyWasProvided(d),
6782
+ d.__octaneInvocationSite
6783
+ )
6784
+ );
6785
+ } else {
6786
+ componentSlot(
6741
6787
  block,
6742
6788
  0,
6743
6789
  block.parentNode,
@@ -6749,66 +6795,63 @@ function renderReturnedValue(block, out) {
6749
6795
  void 0,
6750
6796
  activeHydration() !== null && elementKeyWasProvided(d),
6751
6797
  d.__octaneInvocationSite
6752
- )
6753
- );
6798
+ );
6799
+ }
6754
6800
  } else {
6755
- componentSlot(
6756
- block,
6757
- 0,
6758
- block.parentNode,
6759
- d.type,
6760
- d.props,
6761
- block.endMarker,
6762
- d.key ?? void 0,
6763
- true,
6764
- void 0,
6765
- activeHydration() !== null && elementKeyWasProvided(d),
6766
- d.__octaneInvocationSite
6767
- );
6801
+ const returnHydration = activeHydration();
6802
+ if (returnHydration !== null && block.slots[0] === void 0 && block.startMarker !== null && block.endMarker !== null && block.startMarker !== block.endMarker && block.startMarker.nodeType === 8 && block.endMarker.nodeType === 8 && (getNextSibling(block.startMarker) === block.endMarker || returnHydration.isUnframedRootRange(block.startMarker, block.endMarker))) {
6803
+ const borrowed = {
6804
+ __kind: "childSlot",
6805
+ start: block.startMarker,
6806
+ end: block.endMarker,
6807
+ ownerHost: null,
6808
+ borrowed: true,
6809
+ compactable: false,
6810
+ block: null,
6811
+ text: null,
6812
+ currentComp: null,
6813
+ currentIsBodyFn: false,
6814
+ forSlot: null,
6815
+ hostNode: null,
6816
+ portal: null
6817
+ };
6818
+ block.slots[0] = borrowed;
6819
+ registerSlot(block, borrowed);
6820
+ }
6821
+ childSlot(block, 0, block.parentNode, out, block.endMarker);
6768
6822
  }
6769
- } else {
6770
- const returnHydration = activeHydration();
6771
- if (returnHydration !== null && block.slots[0] === void 0 && block.startMarker !== null && block.endMarker !== null && block.startMarker !== block.endMarker && block.startMarker.nodeType === 8 && block.endMarker.nodeType === 8 && (getNextSibling(block.startMarker) === block.endMarker || returnHydration.isUnframedRootRange(block.startMarker, block.endMarker))) {
6772
- const borrowed = {
6773
- __kind: "childSlot",
6774
- start: block.startMarker,
6775
- end: block.endMarker,
6776
- ownerHost: null,
6777
- borrowed: true,
6778
- compactable: false,
6779
- block: null,
6780
- text: null,
6781
- currentComp: null,
6782
- currentIsBodyFn: false,
6783
- forSlot: null,
6784
- hostNode: null,
6785
- portal: null
6786
- };
6787
- block.slots[0] = borrowed;
6788
- registerSlot(block, borrowed);
6823
+ if (replacedStart !== null) {
6824
+ const incoming = block.slots[0];
6825
+ const first = incoming.start ?? incoming.hostNode ?? incoming.text ?? incoming.block?.startMarker ?? incoming.end ?? null;
6826
+ const last = incoming.end ?? incoming.block?.endMarker ?? first;
6827
+ replaceSharedBlockBoundary(block, replacedStart, replacedEnd, first, last);
6789
6828
  }
6790
- childSlot(block, 0, block.parentNode, out, block.endMarker);
6791
- }
6792
- if (replacedStart !== null) {
6793
- const incoming = block.slots[0];
6794
- const first = incoming.start ?? incoming.hostNode ?? incoming.text ?? incoming.block?.startMarker ?? incoming.end ?? null;
6795
- const last = incoming.end ?? incoming.block?.endMarker ?? first;
6796
- replaceSharedBlockBoundary(block, replacedStart, replacedEnd, first, last);
6829
+ const state = block.slots[0];
6830
+ if (!block.disposed && state !== void 0 && state.returnedOutput !== true) {
6831
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
6832
+ TRANSITION_JOURNAL.push(JOURNAL_PROP, state, "returnedOutput", state.returnedOutput);
6833
+ }
6834
+ state.returnedOutput = true;
6835
+ }
6836
+ } finally {
6837
+ RETURNED_OUTPUT_SCOPE = previous;
6797
6838
  }
6798
6839
  }
6799
6840
  function disposeReturnSlot(block, state) {
6841
+ const kind = state.__kind;
6842
+ const end = (kind === "ifBlockSlot" || kind === "switchBlockSlot") && state.start === null && state.block?.endMarker != null ? state.block.endMarker : state.end;
6800
6843
  const transaction = ROOT_RENDER_TRANSACTION;
6801
6844
  if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK) {
6802
6845
  const parent = state.ownerHost ?? block.parentNode;
6803
6846
  const borrowed = state.inherited === true || state.borrowed === true;
6804
- let first = state.ownerHost != null || borrowed && state.start === null ? getFirstChild(parent) : borrowed ? getNextSibling(state.start) : state.start ?? state.hostNode ?? state.text ?? state.block?.startMarker ?? state.end ?? null;
6805
- if (borrowed && first === state.end) first = null;
6806
- const last = first === null ? null : state.ownerHost != null || borrowed && state.end === null ? (STAGED_DOM?.view(parent) ?? parent).lastChild : borrowed ? domNode(state.end).previousSibling : state.end ?? state.block?.endMarker ?? first;
6847
+ let first = state.ownerHost != null || borrowed && state.start === null ? getFirstChild(parent) : borrowed ? getNextSibling(state.start) : state.start ?? state.hostNode ?? state.text ?? state.block?.startMarker ?? end ?? null;
6848
+ if (borrowed && first === end) first = null;
6849
+ const last = first === null ? null : state.ownerHost != null || borrowed && end === null ? (STAGED_DOM?.view(parent) ?? parent).lastChild : borrowed ? domNode(end).previousSibling : end ?? state.block?.endMarker ?? first;
6807
6850
  journalRootSlot(
6808
6851
  state,
6809
6852
  parent,
6810
6853
  borrowed ? state.start : first !== null ? (STAGED_DOM?.view(first) ?? first).previousSibling : (STAGED_DOM?.view(parent) ?? parent).lastChild,
6811
- borrowed ? state.end : (STAGED_DOM?.view(last) ?? last)?.nextSibling ?? null
6854
+ borrowed ? end : (STAGED_DOM?.view(last) ?? last)?.nextSibling ?? null
6812
6855
  );
6813
6856
  const retiredBlock = state.block ?? state.portal?.block;
6814
6857
  if (retiredBlock != null) retireRootBlock(retiredBlock);
@@ -6831,7 +6874,7 @@ function disposeReturnSlot(block, state) {
6831
6874
  block.slots[0] = void 0;
6832
6875
  return;
6833
6876
  }
6834
- if (state.__kind === "childSlot") {
6877
+ if (kind === "childSlot") {
6835
6878
  if (state.portal) {
6836
6879
  teardownPortalState(state.portal);
6837
6880
  state.portal = null;
@@ -6845,13 +6888,17 @@ function disposeReturnSlot(block, state) {
6845
6888
  clearChildContent(state);
6846
6889
  if (!state.borrowed) {
6847
6890
  domNode(state.start)?.remove();
6848
- domNode(state.end)?.remove();
6891
+ domNode(end)?.remove();
6849
6892
  }
6850
6893
  } else {
6851
- if (state.block) unmountBlock(state.block, true);
6852
- if (!state.inherited) {
6894
+ if (kind === "componentSlotSlot") {
6895
+ if (state.block) unmountBlock(state.block, true);
6896
+ } else {
6897
+ unmountSlot(state, true);
6898
+ }
6899
+ if (!state.inherited && !state.borrowed) {
6853
6900
  domNode(state.start)?.remove?.();
6854
- domNode(state.end)?.remove?.();
6901
+ domNode(end)?.remove?.();
6855
6902
  }
6856
6903
  }
6857
6904
  const reg = block._slots;
@@ -7239,6 +7286,8 @@ function resolveSlot(slot) {
7239
7286
  return typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ ? __profileResolveHook(resolved, typeof slot === "symbol" ? slot : void 0) : resolved;
7240
7287
  }
7241
7288
  function nativeLocalHook(name, initialize, dispose, slot) {
7289
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null)
7290
+ throw new PresentationAdoptionMiss(void 0, false);
7242
7291
  slot = resolveSlot(slot);
7243
7292
  if (slot === void 0 || CURRENT_SCOPE === null) missingSlot(name);
7244
7293
  const scope = CURRENT_SCOPE;
@@ -8349,6 +8398,10 @@ function renderSharedBody(body, props, scope, extra) {
8349
8398
  }
8350
8399
  }
8351
8400
  function invalidateSharedBodyOutput(scope) {
8401
+ const state = scope.slots[0];
8402
+ if (scope === scope.block && scope.block.outputHandler !== null && (state?.__kind === "childSlot" || state?.__kind === "componentSlotSlot" || state?.__kind === "ifBlockSlot" || state?.__kind === "switchBlockSlot" || state?.__kind === "activityBlockSlot")) {
8403
+ setReturnedOutputOwner(state, true);
8404
+ }
8352
8405
  const first = scope.compilerMemo;
8353
8406
  if (first === null) return;
8354
8407
  invalidateSharedBodyMemoRegion(first);
@@ -8374,13 +8427,16 @@ function provideContext(scope, context, value) {
8374
8427
  if (had) values.set(context, previous);
8375
8428
  else values.delete(context);
8376
8429
  });
8377
- if (had) {
8430
+ if (had && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
8378
8431
  context.$$version++;
8379
8432
  bumpContextEpoch();
8380
8433
  }
8381
8434
  values.set(context, value);
8382
8435
  }
8383
8436
  const CHILDREN_BODY = /* @__PURE__ */ Symbol.for("octane.childrenBody");
8437
+ const CHILDREN_DIAGNOSTIC_CAPTURES = /* @__PURE__ */ Symbol.for(
8438
+ "octane.childrenDiagnosticCaptures"
8439
+ );
8384
8440
  function markSingleRoot(component) {
8385
8441
  component.$$singleRoot = true;
8386
8442
  return component;
@@ -8389,6 +8445,10 @@ function markChildrenBlock(fn, body) {
8389
8445
  if (typeof fn === "function") {
8390
8446
  fn[CHILDREN_BLOCK] = true;
8391
8447
  if (body !== void 0) fn[CHILDREN_BODY] = body;
8448
+ if (process.env.NODE_ENV !== "production") {
8449
+ const captures = arguments[2];
8450
+ if (captures !== void 0) fn[CHILDREN_DIAGNOSTIC_CAPTURES] = captures;
8451
+ }
8392
8452
  }
8393
8453
  return fn;
8394
8454
  }
@@ -8538,6 +8598,233 @@ const HYDRATE_STREAM_SCAN_MASK = 1 | 128;
8538
8598
  let hydrateStreamWaitCleanups = null;
8539
8599
  let preservedHydrateActivations = null;
8540
8600
  let preservedHydrateActivationCount = 0;
8601
+ let initialHydrateAttributes = null;
8602
+ let hydrateAttributeProbe = null;
8603
+ function copyHydrateDiagnosticIds(ids) {
8604
+ const first = { prefix: ids.prefix, next: ids.next };
8605
+ let copy = first;
8606
+ while (true) {
8607
+ if (ids.limit !== void 0) copy.limit = ids.limit;
8608
+ if (ids.signalState !== void 0) copy.signalState = { ...ids.signalState };
8609
+ if (ids.overflow === void 0) return first;
8610
+ ids = ids.overflow;
8611
+ copy = copy.overflow = { prefix: ids.prefix, next: ids.next };
8612
+ }
8613
+ }
8614
+ function copyHydrateDiagnosticContexts(scope) {
8615
+ let contexts = null;
8616
+ const add = (values) => {
8617
+ if (values === null) return;
8618
+ for (const [context, value] of values) {
8619
+ contexts ??= /* @__PURE__ */ new Map();
8620
+ if (!contexts.has(context)) contexts.set(context, value);
8621
+ }
8622
+ };
8623
+ for (let current = scope; current !== null; current = current.parent)
8624
+ add(current.$$ctxValues);
8625
+ for (let block = scope.block.parentBlock; block !== null; block = block.parentBlock)
8626
+ add(block.$$ctxValues);
8627
+ return contexts;
8628
+ }
8629
+ function changedHydrateDiagnosticContexts(initial, next) {
8630
+ if ((initial?.size ?? 0) !== (next?.size ?? 0)) return true;
8631
+ if (initial !== null) {
8632
+ for (const [context, value] of initial) {
8633
+ if (next === null || !next.has(context) || !Object.is(value, next.get(context))) return true;
8634
+ }
8635
+ }
8636
+ return false;
8637
+ }
8638
+ function changedHydrateDiagnosticCaptures(initial, next) {
8639
+ if (initial.__data === void 0 || next.__data === void 0)
8640
+ return changedHydrateDiagnosticChildren(initial.children, next.children);
8641
+ if (initial.__data.length !== next.__data.length) return true;
8642
+ for (let i = 0; i < initial.__data.length; i++) {
8643
+ if (!Object.is(initial.__data[i], next.__data[i])) return true;
8644
+ }
8645
+ return false;
8646
+ }
8647
+ function changedHydrateDiagnosticChildren(initial, next) {
8648
+ if (initial === next) return false;
8649
+ if (typeof initial !== "function" || typeof next !== "function") return true;
8650
+ try {
8651
+ const body = initial[CHILDREN_BODY];
8652
+ const initialCaptures = initial[CHILDREN_DIAGNOSTIC_CAPTURES];
8653
+ const nextCaptures = next[CHILDREN_DIAGNOSTIC_CAPTURES];
8654
+ if (initialCaptures === void 0 && nextCaptures === void 0 && isChildrenBlock(initial) && isChildrenBlock(next))
8655
+ return false;
8656
+ if (body === void 0 || body !== next[CHILDREN_BODY] || initialCaptures == null || nextCaptures == null)
8657
+ return true;
8658
+ const before = initialCaptures();
8659
+ const after = nextCaptures();
8660
+ if (before.length !== after.length) return true;
8661
+ for (let i = 0; i < before.length; i++) {
8662
+ if (!Object.is(before[i], after[i])) return true;
8663
+ }
8664
+ return false;
8665
+ } catch {
8666
+ return true;
8667
+ }
8668
+ }
8669
+ function recordInitialHydrateAttribute(el, name, server, next) {
8670
+ const probe = hydrateAttributeProbe;
8671
+ const original = probe?.originals.get(el);
8672
+ if (original === void 0) return;
8673
+ let values = probe.attributes.get(original);
8674
+ if (values === void 0) probe.attributes.set(original, values = /* @__PURE__ */ new Map());
8675
+ const previous = values.get(name);
8676
+ values.set(name, {
8677
+ server: previous === void 0 ? server : previous.server,
8678
+ next,
8679
+ suppressed: isHydrationSuppressed(el),
8680
+ checked: false
8681
+ });
8682
+ }
8683
+ function checkInitialHydrateAttribute(hydration, el, name, server) {
8684
+ const initial = hydration.attributeBaselines?.attributes.get(el)?.get(name);
8685
+ if (initial === void 0) return false;
8686
+ if (initial.checked) return true;
8687
+ initial.checked = true;
8688
+ if (!initial.suppressed && initial.server !== initial.next && !(name !== "class" && name !== "style" && initial.next !== null && isAttributeParserNormalizedMatch(initial.server, initial.next)) && domBindingClaims.get(el)?.get(name) !== server) {
8689
+ warnHydrationValueMismatch(
8690
+ el.__oct_loc,
8691
+ name === "style" ? "style" : `attribute \`${name}\``,
8692
+ name === "style" ? initial.server ?? "" : initial.server,
8693
+ name === "style" ? initial.next ?? "" : initial.next
8694
+ );
8695
+ }
8696
+ return true;
8697
+ }
8698
+ function probeInitialHydrateAttributes(state) {
8699
+ const snapshot = initialHydrateAttributes?.get(state);
8700
+ if (snapshot === void 0 || !changedHydrateDiagnosticCaptures(snapshot.props, state.props) && !changedHydrateDiagnosticContexts(
8701
+ snapshot.contexts,
8702
+ copyHydrateDiagnosticContexts(
8703
+ CURRENT_SCOPE?.block === state.parentBlock ? CURRENT_SCOPE : state.parentBlock
8704
+ )
8705
+ ))
8706
+ return;
8707
+ try {
8708
+ return collectInitialHydrateAttributes(state, snapshot);
8709
+ } catch {
8710
+ return;
8711
+ }
8712
+ }
8713
+ function collectInitialHydrateAttributes(state, snapshot) {
8714
+ const ownerDocument = document.implementation.createHTMLDocument("");
8715
+ const originalWrapper = state.wrapper;
8716
+ const source = STAGED_DOM?.view(originalWrapper) ?? originalWrapper;
8717
+ const template2 = ownerDocument.createElement("template");
8718
+ template2.innerHTML = source.outerHTML;
8719
+ const wrapper = ownerDocument.adoptNode(template2.content.firstElementChild);
8720
+ const probe = {
8721
+ document: ownerDocument,
8722
+ originals: /* @__PURE__ */ new WeakMap(),
8723
+ attributes: /* @__PURE__ */ new WeakMap(),
8724
+ boundaries: /* @__PURE__ */ new WeakMap()
8725
+ };
8726
+ probe.originals.set(wrapper, originalWrapper);
8727
+ const originals = source.querySelectorAll("*");
8728
+ const copies = wrapper.querySelectorAll("*");
8729
+ if (originals.length !== copies.length) return;
8730
+ for (let i = 0; i < originals.length; i++) {
8731
+ const original = originals[i];
8732
+ const copy = copies[i];
8733
+ if (copy.localName !== original.localName || copy.namespaceURI !== original.namespaceURI || probe.originals.get(copy.parentElement) !== (STAGED_DOM?.view(original) ?? original).parentElement)
8734
+ return;
8735
+ probe.originals.set(copy, original);
8736
+ }
8737
+ const start = wrapper.firstChild;
8738
+ if (start === null || !isBlockOpen(start)) return;
8739
+ const end = findMatchingClose(start, /* @__PURE__ */ new WeakMap());
8740
+ const initialChild = (_props, scope, extra) => {
8741
+ if (state.loadedBody !== null) state.loadedBody(snapshot.props.__data, scope, extra);
8742
+ else childrenAsBody(snapshot.props.children)(void 0, scope, extra);
8743
+ };
8744
+ const body = (_props, scope) => {
8745
+ tryBlock(scope, 0, wrapper, initialChild, null, null, end);
8746
+ };
8747
+ const block = createBlock("control-flow", null, wrapper, start, end, body, void 0);
8748
+ block.idState = copyHydrateDiagnosticIds(snapshot.ids);
8749
+ block.$$ctxValues = snapshot.contexts === null ? null : new Map(snapshot.contexts);
8750
+ const hydration = new HydrationCapability(block, start.nextSibling, null);
8751
+ if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
8752
+ hydration.protectRootAnchor(end);
8753
+ const capture = createOffscreenCapture();
8754
+ const previousHydration = currentHydration;
8755
+ const previousCapture = WIP_CAPTURE;
8756
+ const previousProbe = hydrateAttributeProbe;
8757
+ const previousTransaction = ROOT_RENDER_TRANSACTION;
8758
+ const previousJournal = TRANSITION_JOURNAL;
8759
+ const previousAttempt = ACTIVE_TRANSITION_ATTEMPT;
8760
+ const previousScopedReadTracking = SCOPED_READ_TRACKING;
8761
+ const previousScopedReads = SCOPED_READS;
8762
+ const previousWarm = CURRENT_WARM;
8763
+ const previousWarmClaims = CURRENT_WARM_CLAIMS;
8764
+ const previousWarmEpisode = CURRENT_WARM_EPISODE;
8765
+ const previousWarmPlans = ACTIVE_WARM_PLANS.splice(0);
8766
+ const previousStagedDom = STAGED_DOM;
8767
+ const previousStagedCapture = STAGED_COMMIT_CAPTURE;
8768
+ const previousPresentation = PRESENTATION_HYDRATION;
8769
+ const previousSelectSyncs = SELECT_SYNCS;
8770
+ const previousSelectDefaultSyncs = SELECT_DEFAULT_SYNCS;
8771
+ const previousFormChecks = DEV_FORM_CHECKS;
8772
+ const previousAutofocus = AUTOFOCUS_QUEUE;
8773
+ const previousNative = setNativeAdoptionResolver(null);
8774
+ const refDetachCheckpoint = refDetachQueue.length;
8775
+ currentHydration = hydration;
8776
+ WIP_CAPTURE = capture;
8777
+ hydrateAttributeProbe = probe;
8778
+ ROOT_RENDER_TRANSACTION = null;
8779
+ TRANSITION_JOURNAL = null;
8780
+ ACTIVE_TRANSITION_ATTEMPT = null;
8781
+ SCOPED_READ_TRACKING = false;
8782
+ SCOPED_READS = null;
8783
+ CURRENT_WARM = null;
8784
+ CURRENT_WARM_CLAIMS = null;
8785
+ CURRENT_WARM_EPISODE = 0;
8786
+ STAGED_DOM = null;
8787
+ STAGED_COMMIT_CAPTURE = null;
8788
+ PRESENTATION_HYDRATION = null;
8789
+ SELECT_SYNCS = [];
8790
+ SELECT_DEFAULT_SYNCS = [];
8791
+ DEV_FORM_CHECKS = [];
8792
+ AUTOFOCUS_QUEUE = [];
8793
+ try {
8794
+ renderBlock(block);
8795
+ drainHydrationRenderPhaseUpdates(block);
8796
+ hydration.flushClassWrites();
8797
+ } catch {
8798
+ } finally {
8799
+ try {
8800
+ disposeWip({ block, start, end, capture, domParent: wrapper, refDetachCheckpoint });
8801
+ drainHydrationRenderPhaseUpdates(block);
8802
+ } finally {
8803
+ setNativeAdoptionResolver(previousNative);
8804
+ currentHydration = previousHydration;
8805
+ WIP_CAPTURE = previousCapture;
8806
+ hydrateAttributeProbe = previousProbe;
8807
+ ROOT_RENDER_TRANSACTION = previousTransaction;
8808
+ TRANSITION_JOURNAL = previousJournal;
8809
+ ACTIVE_TRANSITION_ATTEMPT = previousAttempt;
8810
+ SCOPED_READ_TRACKING = previousScopedReadTracking;
8811
+ SCOPED_READS = previousScopedReads;
8812
+ CURRENT_WARM = previousWarm;
8813
+ CURRENT_WARM_CLAIMS = previousWarmClaims;
8814
+ CURRENT_WARM_EPISODE = previousWarmEpisode;
8815
+ ACTIVE_WARM_PLANS.length = 0;
8816
+ ACTIVE_WARM_PLANS.push(...previousWarmPlans);
8817
+ STAGED_DOM = previousStagedDom;
8818
+ STAGED_COMMIT_CAPTURE = previousStagedCapture;
8819
+ PRESENTATION_HYDRATION = previousPresentation;
8820
+ SELECT_SYNCS = previousSelectSyncs;
8821
+ SELECT_DEFAULT_SYNCS = previousSelectDefaultSyncs;
8822
+ DEV_FORM_CHECKS = previousFormChecks;
8823
+ AUTOFOCUS_QUEUE = previousAutofocus;
8824
+ }
8825
+ }
8826
+ return probe;
8827
+ }
8541
8828
  function releasePreservedHydrateActivation(state) {
8542
8829
  if (preservedHydrateActivations?.delete(state)) preservedHydrateActivationCount--;
8543
8830
  }
@@ -8720,6 +9007,7 @@ function createHydrateBoundaryBody(state, renderChild, pendingBody) {
8720
9007
  }
8721
9008
  function failHydrateBoundary(state, error) {
8722
9009
  if (state.hasError || state.block.disposed) return;
9010
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8723
9011
  cleanupHydrateStreamWait(state);
8724
9012
  state.hasError = true;
8725
9013
  state.error = error;
@@ -8837,6 +9125,7 @@ function teardownHydrateBoundary(state) {
8837
9125
  }
8838
9126
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => teardownHydrateBoundary(state), true) === true)
8839
9127
  return;
9128
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8840
9129
  cleanupHydrateInstallers(state);
8841
9130
  cleanupHydrateStreamWait(state);
8842
9131
  if (preserved !== void 0) {
@@ -9187,6 +9476,7 @@ function createHydrateSlot(props, scope, boundaryId, boundaryBody) {
9187
9476
  end,
9188
9477
  parentBlock,
9189
9478
  props,
9479
+ contextChanged: false,
9190
9480
  boundaryId: (STAGED_DOM?.view(wrapper) ?? wrapper).getAttribute(HYDRATE_ID_ATTR) ?? boundaryId,
9191
9481
  intentBoundary,
9192
9482
  delegatedDynamicIntent: takeDelegatedDynamicHydrationIntent(wrapper),
@@ -9216,10 +9506,22 @@ function createHydrateSlot(props, scope, boundaryId, boundaryBody) {
9216
9506
  independent: props.__independent !== void 0
9217
9507
  };
9218
9508
  if (nativeSeedRaw !== null) state.nativeSeedRaw = nativeSeedRaw;
9509
+ if (process.env.NODE_ENV !== "production" && serverPreserved && !state.independent) {
9510
+ const original = hydrateAttributeProbe?.originals.get(wrapper);
9511
+ const inherited = hydration?.attributeBaselines?.boundaries.get(wrapper);
9512
+ const snapshot = inherited ?? {
9513
+ props,
9514
+ ids: copyHydrateDiagnosticIds(idState),
9515
+ contexts: copyHydrateDiagnosticContexts(scope)
9516
+ };
9517
+ (initialHydrateAttributes ??= /* @__PURE__ */ new WeakMap()).set(state, snapshot);
9518
+ if (original !== void 0) hydrateAttributeProbe.boundaries.set(original, snapshot);
9519
+ }
9219
9520
  scope.slots[0] = state;
9220
9521
  registerSlot(scope, state);
9221
9522
  if (!state.independent) registerHydrationIntentBoundary(wrapper, intentBoundary);
9222
9523
  block.body = boundaryBody(state);
9524
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return state;
9223
9525
  const initialStrategy = resolveHydrateStrategy(state);
9224
9526
  const pendingIntents = state.independent ? void 0 : takePendingHydrationIntents(wrapper);
9225
9527
  if (state.independent) {
@@ -9247,6 +9549,8 @@ function activateHydrateBoundary(state) {
9247
9549
  }
9248
9550
  const hydration = preserved?.hydration ?? new HydrationCapability(block, getNextSibling(state.start), null);
9249
9551
  if (preserved === void 0) {
9552
+ if (process.env.NODE_ENV !== "production")
9553
+ hydration.attributeBaselines = probeInitialHydrateAttributes(state);
9250
9554
  if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
9251
9555
  hydration.protectRootAnchor(state.end);
9252
9556
  }
@@ -9321,6 +9625,7 @@ function activateHydrateBoundary(state) {
9321
9625
  if (nativeRecovery !== void 0) {
9322
9626
  noteRecoverableHydrationError(() => nativeRecovery, block);
9323
9627
  state.serverPreserved = false;
9628
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9324
9629
  state.serverActivationStarted = false;
9325
9630
  state.seedRaw = null;
9326
9631
  state.nativeSeedRaw = void 0;
@@ -9351,6 +9656,7 @@ function activateHydrateBoundary(state) {
9351
9656
  return;
9352
9657
  }
9353
9658
  if (completed) {
9659
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9354
9660
  releasePreservedHydrateActivation(state);
9355
9661
  spliceOffscreenCapture(capture);
9356
9662
  }
@@ -9460,6 +9766,7 @@ function notifyHydrateBoundary(state, scope) {
9460
9766
  return;
9461
9767
  }
9462
9768
  state.didNotify = true;
9769
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9463
9770
  cleanupHydrateInstallers(state);
9464
9771
  state.props.onHydrated?.();
9465
9772
  domNode(state.wrapper).removeAttribute(HYDRATE_WHEN_ATTR);
@@ -9489,6 +9796,7 @@ function initializeHydrateComponent(boundaryBody) {
9489
9796
  if (state.independent !== (props.__independent !== void 0)) {
9490
9797
  throw new Error(formatClientError(66));
9491
9798
  }
9799
+ const surroundingUpdate = state.props !== props || state.contextChanged;
9492
9800
  state.props = props;
9493
9801
  if (!state.independent && !state.hydrated) {
9494
9802
  const strategy = resolveHydrateStrategy(state);
@@ -9496,7 +9804,8 @@ function initializeHydrateComponent(boundaryBody) {
9496
9804
  cleanupHydrateStrategy(state);
9497
9805
  invalidateHydrateActivation(state);
9498
9806
  } else if (!state.activationRequested) {
9499
- requestHydrateBoundary(state);
9807
+ const shouldDefer = surroundingUpdate ? false : strategy._d ? strategy._d() : strategy._t !== "load";
9808
+ if (!shouldDefer) requestHydrateBoundary(state);
9500
9809
  }
9501
9810
  }
9502
9811
  }
@@ -11388,13 +11697,20 @@ class HydrationCapability {
11388
11697
  ns,
11389
11698
  name.indexOf(":") >= 0 ? name.slice(name.indexOf(":") + 1) : name
11390
11699
  ) : (STAGED_DOM?.view(el) ?? el).getAttribute(name);
11700
+ if (process.env.NODE_ENV !== "production") {
11701
+ if (hydrateAttributeProbe !== null) {
11702
+ recordInitialHydrateAttribute(el, name, server, next);
11703
+ } else {
11704
+ checkInitialHydrateAttribute(this, el, name, server);
11705
+ }
11706
+ }
11391
11707
  if (server === next) return false;
11392
11708
  if (domBindingClaims.get(el)?.get(name) === server) return false;
11393
11709
  if (next !== null && isAttributeParserNormalizedMatch(server, next)) return false;
11394
11710
  const mode = hydrationMismatchMode(el);
11395
11711
  if (mode === 0) return true;
11396
11712
  if (mode === 1) return false;
11397
- if (process.env.NODE_ENV !== "production")
11713
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, name, server))
11398
11714
  warnHydrationValueMismatch(el.__oct_loc, `attribute \`${name}\``, server, next);
11399
11715
  return true;
11400
11716
  }
@@ -11402,11 +11718,15 @@ class HydrationCapability {
11402
11718
  const mode = hydrationMismatchMode(el);
11403
11719
  const rawServer = (STAGED_DOM?.view(el) ?? el).getAttribute("class");
11404
11720
  const server = absentIsEmpty && rawServer === null ? "" : rawServer;
11721
+ if (process.env.NODE_ENV !== "production") {
11722
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "class", server, next);
11723
+ else checkInitialHydrateAttribute(this, el, "class", rawServer);
11724
+ }
11405
11725
  if (server === next) return true;
11406
11726
  if (domBindingClaims.get(el)?.get("class") === rawServer) return false;
11407
11727
  if (mode === 0) return true;
11408
11728
  if (mode === 1) return false;
11409
- if (process.env.NODE_ENV !== "production")
11729
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "class", rawServer))
11410
11730
  warnHydrationValueMismatch(el.__oct_loc, "attribute `class`", server, next);
11411
11731
  return true;
11412
11732
  }
@@ -11417,7 +11737,11 @@ class HydrationCapability {
11417
11737
  try {
11418
11738
  for (const [el, write] of this.classWrites) {
11419
11739
  const rawTarget = write.remove ? null : write.next;
11420
- if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) continue;
11740
+ if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) {
11741
+ if (process.env.NODE_ENV !== "production")
11742
+ this.allowClass(el, write.next, write.absentIsEmpty);
11743
+ continue;
11744
+ }
11421
11745
  if (!this.allowClass(el, write.next, write.absentIsEmpty)) continue;
11422
11746
  if (write.remove) (STAGED_DOM?.view(el) ?? el).removeAttribute("class");
11423
11747
  else if (write.useAttribute)
@@ -11430,7 +11754,21 @@ class HydrationCapability {
11430
11754
  }
11431
11755
  applyStyle(el, value, _prev, staticCss, entries) {
11432
11756
  const mode = hydrationMismatchMode(el);
11433
- if (mode === 1) return true;
11757
+ if (mode === 1) {
11758
+ if (process.env.NODE_ENV !== "production") {
11759
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "style", null, null);
11760
+ else {
11761
+ const current = STAGED_DOM?.view(el) ?? el;
11762
+ checkInitialHydrateAttribute(
11763
+ this,
11764
+ el,
11765
+ "style",
11766
+ current.hasAttribute("style") ? current.style.cssText : null
11767
+ );
11768
+ }
11769
+ }
11770
+ return true;
11771
+ }
11434
11772
  const style = (STAGED_DOM?.view(el) ?? el).style;
11435
11773
  const hadStyleAttribute = (STAGED_DOM?.view(el) ?? el).hasAttribute("style");
11436
11774
  const before = style.cssText;
@@ -11446,7 +11784,11 @@ class HydrationCapability {
11446
11784
  applyStyleProperty(el, expectedStyle, entries[i], entry);
11447
11785
  }
11448
11786
  }
11449
- const claims = domBindingClaims.get(el);
11787
+ let claims = domBindingClaims.get(el);
11788
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) {
11789
+ const original = hydrateAttributeProbe.originals.get(el);
11790
+ if (original !== void 0) claims = domBindingClaims.get(original);
11791
+ }
11450
11792
  if (claims !== void 0) {
11451
11793
  for (const [channel, published] of claims) {
11452
11794
  if (!channel.startsWith("style:")) continue;
@@ -11460,10 +11802,20 @@ class HydrationCapability {
11460
11802
  }
11461
11803
  const expected = expectedStyle.cssText;
11462
11804
  const expectsStyleAttribute = expected !== "";
11805
+ if (process.env.NODE_ENV !== "production") {
11806
+ if (hydrateAttributeProbe !== null)
11807
+ recordInitialHydrateAttribute(
11808
+ el,
11809
+ "style",
11810
+ hadStyleAttribute ? before : null,
11811
+ expectsStyleAttribute ? expected : null
11812
+ );
11813
+ else checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null);
11814
+ }
11463
11815
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
11464
11816
  if (expectsStyleAttribute) style.cssText = expected;
11465
11817
  else (STAGED_DOM?.view(el) ?? el).removeAttribute("style");
11466
- if (mode === 2 && process.env.NODE_ENV !== "production") {
11818
+ if (mode === 2 && process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null)) {
11467
11819
  warnHydrationValueMismatch(el.__oct_loc, "style", before, expected);
11468
11820
  }
11469
11821
  return true;
@@ -12729,6 +13081,8 @@ function bindDirectSignal(scope, previous, target, value, site, policy, name, at
12729
13081
  const kind = policy.kind;
12730
13082
  const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_BINDING] === true ? previous : null;
12731
13083
  const handle = isSignalHandle(value) ? value : null;
13084
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && handle !== null)
13085
+ throw new PresentationAdoptionMiss(void 0, false);
12732
13086
  if (handle !== null && (!signalDocumentEnabled || currentSignalOwner() !== SCOPE_SIGNAL_OWNERS.get(scope))) {
12733
13087
  if (!signalDocumentEnabled) enableSignalBindings();
12734
13088
  return runWithBlockSignalOwner(
@@ -15052,6 +15406,7 @@ function namespaceHeadElement(headKey, tag, attrs, text, authoredKey) {
15052
15406
  return createElement(namespaceHead, config);
15053
15407
  }
15054
15408
  function injectStyle(id, css, nonce) {
15409
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
15055
15410
  if (typeof document === "undefined") {
15056
15411
  _injectedStyles.add(id);
15057
15412
  return;
@@ -17265,6 +17620,8 @@ function registerValuePortalFragmentOwners(portal2, parentBlock, anchor) {
17265
17620
  }
17266
17621
  }
17267
17622
  function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, env, key = null) {
17623
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && target.ownerDocument !== hydrateAttributeProbe.document)
17624
+ target = hydrateAttributeProbe.document.createDocumentFragment();
17268
17625
  const hydration = activeHydration();
17269
17626
  if (hydration !== null) {
17270
17627
  return hydration.suspend(
@@ -17981,6 +18338,18 @@ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor,
17981
18338
  }
17982
18339
  function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body, identity, props, renderProps, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
17983
18340
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
18341
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE) {
18342
+ const state2 = parentScope.slots[0];
18343
+ if (state2?.returnedOutput === true) {
18344
+ if (state2.__kind === "componentSlotSlot") {
18345
+ setReturnedOutputOwner(state2, false);
18346
+ } else {
18347
+ const block = parentScope.block;
18348
+ block.outputHandler(block, null, true);
18349
+ if (block.disposed) return;
18350
+ }
18351
+ }
18352
+ }
17984
18353
  const parentBlock = parentScope.block;
17985
18354
  const hydration = activeHydration();
17986
18355
  if (hydration !== null && (anchor != null && hydration.isFresh(anchor) || hydration.isFresh(domParent))) {
@@ -20222,6 +20591,18 @@ function bindingChildSlot(parentScope, slotKey, domParent, value, marker, anchor
20222
20591
  }
20223
20592
  function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable, includeKeyedSingle = true, compiledMapBody, compiledMapKey, compiledMapFlags, compiledMapDeps, mappedFallback, bindingMarker) {
20224
20593
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
20594
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE) {
20595
+ const state2 = parentScope.slots[0];
20596
+ if (state2?.returnedOutput === true) {
20597
+ if (state2.__kind === "childSlot") {
20598
+ setReturnedOutputOwner(state2, false);
20599
+ } else {
20600
+ const block = parentScope.block;
20601
+ block.outputHandler(block, null, true);
20602
+ if (block.disposed) return;
20603
+ }
20604
+ }
20605
+ }
20225
20606
  if (IMPLICIT_SIGNAL_CHILD_DEPTH === 0) {
20226
20607
  const existing = parentScope.slots[slotKey];
20227
20608
  const previous = existing?.implicitSignal;
@@ -20850,6 +21231,9 @@ function textSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, compac
20850
21231
  childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, void 0, compactable);
20851
21232
  return;
20852
21233
  }
21234
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE && state.returnedOutput === true) {
21235
+ setReturnedOutputOwner(state, false);
21236
+ }
20853
21237
  const str = vt === "string" ? value : vt === "boolean" || value == null ? "" : String(value);
20854
21238
  if (state.text !== null) {
20855
21239
  updateTextValue(state.text, str);
@@ -21241,7 +21625,8 @@ function hmr(fn) {
21241
21625
  }
21242
21626
  };
21243
21627
  function wrapper(props, scope, extra) {
21244
- if (scope !== void 0) meta.liveBlocks.add(scope.block);
21628
+ if (scope !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
21629
+ meta.liveBlocks.add(scope.block);
21245
21630
  return meta.fn(props, scope, extra);
21246
21631
  }
21247
21632
  Object.defineProperty(wrapper, HMR, {
@@ -21640,7 +22025,8 @@ function mountPassthroughPending(state, thenable) {
21640
22025
  setTryBranch(state, -1);
21641
22026
  scheduleRender(state.parentBlock);
21642
22027
  };
21643
- thenable.then(retry, retry);
22028
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22029
+ thenable.then(retry, retry);
21644
22030
  }
21645
22031
  function renderPassthroughTry(state) {
21646
22032
  if (state.branch === 0 && state.block !== null) {
@@ -22143,10 +22529,10 @@ function takeInitialSuspenseHydration(state, hydration) {
22143
22529
  if (payload === void 0) {
22144
22530
  payload = {
22145
22531
  seedRaw: typeof stash?.[boundaryId] === "string" ? stash[boundaryId] : null,
22146
- nativeRaw: typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22532
+ nativeRaw: (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null) && typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22147
22533
  };
22148
22534
  (initialStreamedPayloads ??= /* @__PURE__ */ new WeakMap()).set(owner, payload);
22149
- if (stash !== void 0) {
22535
+ if (stash !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
22150
22536
  delete stash[boundaryId];
22151
22537
  delete stash[boundaryId + "$signals"];
22152
22538
  }
@@ -22183,7 +22569,8 @@ function takeInitialSuspenseHydration(state, hydration) {
22183
22569
  continue;
22184
22570
  if (attr === SUSPENSE_RESOLVED_SEED_ATTR)
22185
22571
  seedRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22186
- else nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22572
+ else if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22573
+ nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22187
22574
  sidecars.push(script);
22188
22575
  cursor = getNextSibling(script);
22189
22576
  }
@@ -22224,6 +22611,8 @@ function renderInitialSuspenseHydration(state, initial) {
22224
22611
  hydration.claimRootRemainder(initial.end);
22225
22612
  hydration.protectRootAnchor(initial.end);
22226
22613
  const previousHydration = currentHydration;
22614
+ if (process.env.NODE_ENV !== "production")
22615
+ hydration.attributeBaselines = previousHydration?.attributeBaselines;
22227
22616
  if (previousHydration?.retryPresentation !== void 0)
22228
22617
  hydration.retryPresentation = previousHydration.retryPresentation;
22229
22618
  const previousCapture = WIP_CAPTURE;
@@ -22292,7 +22681,8 @@ function renderInitialSuspenseHydration(state, initial) {
22292
22681
  return;
22293
22682
  scheduleRender(state.parentBlock);
22294
22683
  };
22295
- suspended.then(resume, resume);
22684
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22685
+ suspended.then(resume, resume);
22296
22686
  return;
22297
22687
  }
22298
22688
  initialSuspenseHydrations?.delete(state);
@@ -22359,7 +22749,8 @@ function mountTry(state) {
22359
22749
  const raw = stash !== void 0 ? stash[streamedBoundaryId] : void 0;
22360
22750
  if (typeof raw === "string") scopedSeeds = hydration.parseSeeds(raw);
22361
22751
  const nativeRaw = stash?.[streamedBoundaryId + "$signals"];
22362
- if (typeof nativeRaw === "string") scopedNativeRaw = nativeRaw;
22752
+ if (typeof nativeRaw === "string" && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
22753
+ scopedNativeRaw = nativeRaw;
22363
22754
  adoptCursor = getNextSibling(adoptCursor);
22364
22755
  } else if (
22365
22756
  // A shell hydrated before its streamed segment swaps still has the
@@ -23311,6 +23702,7 @@ function flushStagedReveals() {
23311
23702
  }
23312
23703
  }
23313
23704
  function attachResume(state, thenable) {
23705
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
23314
23706
  if (state.pendingThenable === thenable) return;
23315
23707
  state.pendingThenable = thenable;
23316
23708
  const retry = () => {
@@ -24350,6 +24742,17 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
24350
24742
  }
24351
24743
  function ifBlock(parentScope, slotKey, domParent, cond, thenBody, elseBody, anchor, env) {
24352
24744
  let state = parentScope.slots[slotKey];
24745
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE && state?.returnedOutput === true) {
24746
+ if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
24747
+ if (state.__kind === "ifBlockSlot") {
24748
+ setReturnedOutputOwner(state, false);
24749
+ } else {
24750
+ const block = parentScope.block;
24751
+ block.outputHandler(block, null, true);
24752
+ if (block.disposed) return;
24753
+ state = void 0;
24754
+ }
24755
+ }
24353
24756
  if (state === void 0) {
24354
24757
  const hydration = activeHydration();
24355
24758
  let start = null;
@@ -24615,6 +25018,7 @@ function queueCurrentActivityRefs(activity) {
24615
25018
  }
24616
25019
  }
24617
25020
  function suspendHiddenActivity(state, thenable) {
25021
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
24618
25022
  if (state.pendingThenable === thenable) return;
24619
25023
  state.pendingThenable = thenable;
24620
25024
  const block = state.block;
@@ -24696,6 +25100,18 @@ function queueActivityDeactivation(state, block, commitVersion) {
24696
25100
  }
24697
25101
  function activityBlock(parentScope, slotKey, domParent, mode, body, anchor, env) {
24698
25102
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
25103
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE) {
25104
+ const state2 = parentScope.slots[0];
25105
+ if (state2?.returnedOutput === true) {
25106
+ if (state2.__kind === "activityBlockSlot") {
25107
+ setReturnedOutputOwner(state2, false);
25108
+ } else {
25109
+ const block = parentScope.block;
25110
+ block.outputHandler(block, null, true);
25111
+ if (block.disposed) return;
25112
+ }
25113
+ }
25114
+ }
24699
25115
  if (mode === "hidden") ensureScheduledVisibilityDriver();
24700
25116
  const parentBlock = parentScope.block;
24701
25117
  const hydration = activeHydration();
@@ -24952,6 +25368,17 @@ function deactivateScope(scope, disconnectPassive = true) {
24952
25368
  }
24953
25369
  function switchBlock(parentScope, slotKey, domParent, discriminant, cases, defaultBody, anchor, env) {
24954
25370
  let state = parentScope.slots[slotKey];
25371
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE && state?.returnedOutput === true) {
25372
+ if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
25373
+ if (state.__kind === "switchBlockSlot") {
25374
+ setReturnedOutputOwner(state, false);
25375
+ } else {
25376
+ const block = parentScope.block;
25377
+ block.outputHandler(block, null, true);
25378
+ if (block.disposed) return;
25379
+ state = void 0;
25380
+ }
25381
+ }
24955
25382
  if (state === void 0) {
24956
25383
  const hydration = activeHydration();
24957
25384
  let start = null;
@@ -25341,7 +25768,8 @@ function fastMapSlot(scopeOrItems, slotOrMethod, domParent, items, method, nativ
25341
25768
  callback = native;
25342
25769
  native = mapSlot(items, method);
25343
25770
  }
25344
- const state = scopeOrItems.slots[slotOrMethod]?.forSlot;
25771
+ const slot = scopeOrItems.slots[slotOrMethod];
25772
+ const state = slot?.forSlot;
25345
25773
  const parent = native === true ? fastHostListParent(state, items, flags) : null;
25346
25774
  if (parent === null) {
25347
25775
  return mapSlot(
@@ -25360,6 +25788,9 @@ function fastMapSlot(scopeOrItems, slotOrMethod, domParent, items, method, nativ
25360
25788
  ownEnd
25361
25789
  );
25362
25790
  }
25791
+ if (slotOrMethod === 0 && scopeOrItems !== RETURNED_OUTPUT_SCOPE && slot.returnedOutput === true) {
25792
+ setReturnedOutputOwner(slot, false);
25793
+ }
25363
25794
  mountFastHostItems(
25364
25795
  scopeOrItems,
25365
25796
  state,
@@ -26277,6 +26708,10 @@ function moveFocusedNodeBefore(parent, node, anchor, snapshots) {
26277
26708
  moveBefore.call(parent, node, anchor);
26278
26709
  return;
26279
26710
  }
26711
+ if (STAGED_DOM.view(node).parentNode !== parent || anchor !== null && STAGED_DOM.view(anchor).parentNode !== parent) {
26712
+ STAGED_DOM.view(parent).insertBefore(node, anchor);
26713
+ return;
26714
+ }
26280
26715
  if (node === anchor || getNextSibling(node) === anchor) return;
26281
26716
  if (anchor === null || ((STAGED_DOM?.view(node) ?? node).compareDocumentPosition(anchor) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0) {
26282
26717
  let cursor = getNextSibling(node);
@@ -27602,6 +28037,7 @@ function applyHintAttrs(el, opts) {
27602
28037
  }
27603
28038
  }
27604
28039
  function preload(href, options) {
28040
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27605
28041
  if (process.env.NODE_ENV !== "production") {
27606
28042
  const warning = resourceHintWarning("preload", href, options);
27607
28043
  if (warning !== null) console.error(warning);
@@ -27639,6 +28075,7 @@ function preload(href, options) {
27639
28075
  });
27640
28076
  }
27641
28077
  function preinit(href, options) {
28078
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27642
28079
  if (process.env.NODE_ENV !== "production") {
27643
28080
  const warning = resourceHintWarning("preinit", href, options);
27644
28081
  if (warning !== null) console.error(warning);
@@ -27663,6 +28100,7 @@ function preinit(href, options) {
27663
28100
  }
27664
28101
  }
27665
28102
  function preconnect(href, options) {
28103
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27666
28104
  if (process.env.NODE_ENV !== "production") {
27667
28105
  const warning = resourceHintWarning("preconnect", href, options);
27668
28106
  if (warning !== null) console.error(warning);
@@ -27684,6 +28122,7 @@ function preconnect(href, options) {
27684
28122
  });
27685
28123
  }
27686
28124
  function prefetchDNS(href) {
28125
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27687
28126
  if (process.env.NODE_ENV !== "production") {
27688
28127
  const warning = resourceHintWarning("prefetchDNS", href, arguments[1], arguments.length > 1);
27689
28128
  if (warning !== null) console.error(warning);
@@ -27699,6 +28138,7 @@ function prefetchDNS(href) {
27699
28138
  });
27700
28139
  }
27701
28140
  function preloadModule(href, options) {
28141
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27702
28142
  if (process.env.NODE_ENV !== "production") {
27703
28143
  const warning = resourceHintWarning("preloadModule", href, options);
27704
28144
  if (warning !== null) console.error(warning);
@@ -27720,6 +28160,7 @@ function preloadModule(href, options) {
27720
28160
  });
27721
28161
  }
27722
28162
  function preinitModule(href, options) {
28163
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27723
28164
  if (process.env.NODE_ENV !== "production") {
27724
28165
  const warning = resourceHintWarning("preinitModule", href, options);
27725
28166
  if (warning !== null) console.error(warning);
@@ -27828,6 +28269,7 @@ function warnInvalidStylesheetResource(reason) {
27828
28269
  );
27829
28270
  }
27830
28271
  function stylesheetResource(attrs, invalidReason) {
28272
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27831
28273
  if (process.env.NODE_ENV !== "production" && invalidReason !== void 0) {
27832
28274
  warnInvalidStylesheetResource(invalidReason);
27833
28275
  return;
@@ -27847,6 +28289,7 @@ function stylesheetResource(attrs, invalidReason) {
27847
28289
  state.sheets.add(href);
27848
28290
  }
27849
28291
  function styleResource(attrs, css, development) {
28292
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27850
28293
  if (typeof document === "undefined" || attrs == null) return;
27851
28294
  const href = attrs.href;
27852
28295
  if (typeof href !== "string" || href === "") return;
@@ -27877,6 +28320,7 @@ function resetFloatResourceState() {
27877
28320
  if (typeof window !== "undefined") delete window.$OCTFR;
27878
28321
  }
27879
28322
  function scriptResource(attrs) {
28323
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27880
28324
  if (typeof document === "undefined" || attrs == null) return;
27881
28325
  const src = attrs.src;
27882
28326
  if (typeof src !== "string" || src === "") return;