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.
@@ -692,7 +692,8 @@ function scopeSignalOwner(scope) {
692
692
  }
693
693
  function runWithBlockSignalOwner(scope, callback) {
694
694
  const owner = scopeSignalOwner(scope);
695
- if (owner !== void 0) (0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
695
+ if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
696
+ (0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
696
697
  return owner === void 0 || (0, import_owner_context.currentSignalOwner)() === owner ? callback() : (0, import_owner_context.runWithSignalOwner)(owner, callback);
697
698
  }
698
699
  function disposeNativeStyleBinding(binding) {
@@ -786,6 +787,8 @@ function nativeProjectionBinding(owner, slotIndex, el, compute, fields) {
786
787
  nativePresentationBinding(owner, slotIndex, el, nativeProjectionBody, { el, compute, fields });
787
788
  }
788
789
  function nativePresentationBinding(owner, slotIndex, el, body, props) {
790
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && el.ownerDocument !== hydrateAttributeProbe.document)
791
+ throw new PresentationAdoptionMiss(void 0, false);
789
792
  let binding = owner.slots[slotIndex];
790
793
  if (binding === void 0) {
791
794
  const block = createBlock("control-flow", owner.block, el, null, null, body, props);
@@ -817,6 +820,8 @@ function enableNativeReadCollection(abi = 1) {
817
820
  ensureNativeReadDriver();
818
821
  }
819
822
  function beginNativeReadScope(scope, abi = 1) {
823
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null)
824
+ throw new PresentationAdoptionMiss(void 0, false);
820
825
  if (abi !== 1) throw new Error((0, import_error_codes_client_generated.formatClientError)(58));
821
826
  const block = CURRENT_BLOCK;
822
827
  const owner = scope ?? CURRENT_SCOPE;
@@ -824,6 +829,7 @@ function beginNativeReadScope(scope, abi = 1) {
824
829
  return ensureNativeReadDriver().beginScope(owner, block);
825
830
  }
826
831
  function beginActiveNativeReadScope(scope) {
832
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return -1;
827
833
  const block = CURRENT_BLOCK;
828
834
  return block === null ? -1 : NATIVE_READ_DRIVER.beginScope(scope, block);
829
835
  }
@@ -1058,13 +1064,13 @@ function hydrationMismatchMode(el) {
1058
1064
  }
1059
1065
  function warnHydrationValueMismatch(loc, what, serverVal, clientVal) {
1060
1066
  if (process.env.NODE_ENV === "production") return;
1061
- if (!loc) return;
1067
+ if (!loc || hydrateAttributeProbe !== null) return;
1062
1068
  console.error(
1063
1069
  `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.`
1064
1070
  );
1065
1071
  }
1066
1072
  function warnHydrationKeptServerValue(loc, what, serverVal, clientVal) {
1067
- if (process.env.NODE_ENV === "production" || !loc) return;
1073
+ if (process.env.NODE_ENV === "production" || !loc || hydrateAttributeProbe !== null) return;
1068
1074
  console.error(
1069
1075
  `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.`
1070
1076
  );
@@ -1083,7 +1089,7 @@ function describeHydrationNode(node) {
1083
1089
  }
1084
1090
  function warnHydrationStructuralMismatch(loc, expected, actual) {
1085
1091
  if (process.env.NODE_ENV === "production") return;
1086
- if (!loc) return;
1092
+ if (!loc || hydrateAttributeProbe !== null) return;
1087
1093
  console.error(
1088
1094
  `Octane hydration mismatch at ${loc}: the client expected ${expected} but the server rendered ${actual}. The mismatched subtree was rebuilt on the client.`
1089
1095
  );
@@ -6573,7 +6579,8 @@ function captureRenderPhaseUpdate(cell, key) {
6573
6579
  function renderBlock(block) {
6574
6580
  if (import_document_owner.signalDocumentEnabled || block.idState.renderOwner?.signalOwner !== void 0) {
6575
6581
  const owner = scopeSignalOwner(block);
6576
- if (owner !== void 0) (0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
6582
+ if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
6583
+ (0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
6577
6584
  if (owner !== void 0 && (0, import_owner_context.currentSignalOwner)() !== owner) {
6578
6585
  (0, import_owner_context.runWithSignalOwner)(owner, () => renderBlock(block));
6579
6586
  return;
@@ -6732,7 +6739,13 @@ function renderBlockInner(block) {
6732
6739
  block.__thenableDone = false;
6733
6740
  }
6734
6741
  if (block.$$ctxReads !== null) block.$$ctxReads.clear();
6735
- if (block.$$ctxDirect !== null) block.$$ctxDirect.clear();
6742
+ if (block.$$ctxDirect !== null) {
6743
+ const state = block.slots[0];
6744
+ if (state?.__kind === "hydrateBlockSlot" && state.parentBlock === block && !state.independent && !state.hydrated) {
6745
+ state.contextChanged = block.$$ctxDepsEpoch !== (0, import_context_epoch.contextEpochNow)() && ctxDirectChanged(block);
6746
+ }
6747
+ block.$$ctxDirect.clear();
6748
+ }
6736
6749
  block.$$ctxDepsEpoch = (0, import_context_epoch.contextEpochNow)();
6737
6750
  block.currentRenderMode = urgentTransitionRender !== null ? "urgent" : block.pendingMode ?? prevBlock?.currentRenderMode ?? "urgent";
6738
6751
  block.currentRenderDeferred = urgentTransitionRender !== null ? false : block.pendingMode !== null ? block.pendingDeferred : prevBlock?.currentRenderDeferred ?? false;
@@ -6757,7 +6770,9 @@ function renderBlockInner(block) {
6757
6770
  renderRetry = true;
6758
6771
  return true;
6759
6772
  }
6760
- if (out !== void 0 && block.outputHandler !== null) block.outputHandler(block, out);
6773
+ if (block.outputHandler !== null && (out !== void 0 || block.slots[0]?.returnedOutput === true)) {
6774
+ block.outputHandler(block, out ?? null);
6775
+ }
6761
6776
  finishEffectRender(block);
6762
6777
  if (!block.mounted) block.mounted = true;
6763
6778
  if (block.renderStatus === RENDER_RETRYING) block.renderStatus = RENDER_VALID;
@@ -6816,6 +6831,14 @@ function renderBlockInner(block) {
6816
6831
  }
6817
6832
  }
6818
6833
  }
6834
+ let RETURNED_OUTPUT_SCOPE = null;
6835
+ function setReturnedOutputOwner(state, returned) {
6836
+ if (state.returnedOutput === returned) return;
6837
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
6838
+ TRANSITION_JOURNAL.push(JOURNAL_PROP, state, "returnedOutput", state.returnedOutput);
6839
+ }
6840
+ state.returnedOutput = returned;
6841
+ }
6819
6842
  function returnSlotTail(block, state) {
6820
6843
  const candidates = [
6821
6844
  state?.end,
@@ -6832,59 +6855,82 @@ function returnSlotTail(block, state) {
6832
6855
  }
6833
6856
  return null;
6834
6857
  }
6835
- function renderReturnedValue(block, out) {
6836
- const isComponentDescriptor = out !== null && out.$$kind === import_runtime_tags.ELEMENT_TAG && out.key == null && typeof out.type === "function";
6837
- const existingRet = block.slots[0];
6838
- let replacedStart = null;
6839
- let replacedEnd = null;
6840
- const useSingleRoot = isComponentDescriptor && (out.type.$$singleRoot === true || activeHydration()?.passthroughRanges === true || // STICKY regime: a return slot mounted through the componentSlot route
6841
- // (most importantly by the passthrough-hydration branch above, whose
6842
- // condition is false again once hydration ends) keeps that route while
6843
- // the returned component identity is unchanged. Falling through to the
6844
- // childSlot route would dispose the slot for a mere kind flip — tearing
6845
- // down the very subtree hydration just adopted on its FIRST update. An
6846
- // identity change still disposes below (matching remount semantics).
6847
- existingRet !== void 0 && existingRet.__kind === "componentSlotSlot" && existingRet.currentComp === out.type);
6848
- if (existingRet !== void 0 && existingRet.__kind !== (useSingleRoot ? "componentSlotSlot" : "childSlot")) {
6849
- const swapDriver = TRANSITION_SWAP_DRIVER;
6850
- const transitionMode = block.currentRenderMode === "transition";
6851
- const committedSuspense = swapDriver !== null && activeHydration() === null && preservesCommittedSuspense(block);
6852
- const transitionSwap = ROOT_RENDER_TRANSACTION === null || committedSuspense ? swapDriver : null;
6853
- const suspenseSwap = transitionSwap !== null && !transitionMode && activeHydration() === null && committedSuspense;
6854
- if (transitionSwap !== null && activeHydration() === null && (transitionMode || suspenseSwap)) {
6855
- const tail = returnSlotTail(block, existingRet);
6856
- if (tail !== null) {
6857
- const probe = transitionSwap.render(
6858
- block,
6859
- block.parentNode,
6860
- tail,
6861
- ROOT_RENDERABLE_BODY,
6862
- out,
6863
- renderReturnedValue
6864
- );
6865
- transitionSwap.dispose(probe.wip);
6866
- if (probe.failed) throw probe.error;
6867
- if (probe.suspended) throw new SuspenseException(probe.suspended);
6868
- }
6858
+ function renderReturnedValue(block, out, reset) {
6859
+ const previous = RETURNED_OUTPUT_SCOPE;
6860
+ RETURNED_OUTPUT_SCOPE = block;
6861
+ try {
6862
+ if (reset === true) {
6863
+ const state2 = block.slots[0];
6864
+ if (state2 !== void 0) disposeReturnSlot(block, state2);
6865
+ return;
6869
6866
  }
6870
- if (ROOT_RENDER_TRANSACTION !== null && !existingRet.inherited && !existingRet.borrowed && existingRet.ownerHost == null) {
6871
- const first = existingRet.start ?? existingRet.hostNode ?? existingRet.text ?? existingRet.block?.startMarker ?? existingRet.end ?? null;
6872
- const last = existingRet.end ?? existingRet.block?.endMarker ?? first;
6873
- if (sharesBlockBoundary(block, first, last)) {
6874
- replacedStart = first;
6875
- replacedEnd = last;
6867
+ const isComponentDescriptor = out !== null && out.$$kind === import_runtime_tags.ELEMENT_TAG && out.key == null && typeof out.type === "function";
6868
+ const existingRet = block.slots[0];
6869
+ let replacedStart = null;
6870
+ let replacedEnd = null;
6871
+ const useSingleRoot = isComponentDescriptor && (out.type.$$singleRoot === true || activeHydration()?.passthroughRanges === true || // STICKY regime: a return slot mounted through the componentSlot route
6872
+ // (most importantly by the passthrough-hydration branch above, whose
6873
+ // condition is false again once hydration ends) keeps that route while
6874
+ // the returned component identity is unchanged. Falling through to the
6875
+ // childSlot route would dispose the slot for a mere kind flip — tearing
6876
+ // down the very subtree hydration just adopted on its FIRST update. An
6877
+ // identity change still disposes below (matching remount semantics).
6878
+ existingRet !== void 0 && existingRet.__kind === "componentSlotSlot" && existingRet.currentComp === out.type);
6879
+ if (existingRet !== void 0 && existingRet.__kind !== (useSingleRoot ? "componentSlotSlot" : "childSlot")) {
6880
+ const swapDriver = TRANSITION_SWAP_DRIVER;
6881
+ const transitionMode = block.currentRenderMode === "transition";
6882
+ const committedSuspense = swapDriver !== null && activeHydration() === null && preservesCommittedSuspense(block);
6883
+ const transitionSwap = ROOT_RENDER_TRANSACTION === null || committedSuspense ? swapDriver : null;
6884
+ const suspenseSwap = transitionSwap !== null && !transitionMode && activeHydration() === null && committedSuspense;
6885
+ if (transitionSwap !== null && activeHydration() === null && (transitionMode || suspenseSwap)) {
6886
+ const tail = returnSlotTail(block, existingRet);
6887
+ if (tail !== null) {
6888
+ const probe = transitionSwap.render(
6889
+ block,
6890
+ block.parentNode,
6891
+ tail,
6892
+ ROOT_RENDERABLE_BODY,
6893
+ out,
6894
+ renderReturnedValue
6895
+ );
6896
+ transitionSwap.dispose(probe.wip);
6897
+ if (probe.failed) throw probe.error;
6898
+ if (probe.suspended) throw new SuspenseException(probe.suspended);
6899
+ }
6876
6900
  }
6901
+ if (ROOT_RENDER_TRANSACTION !== null && !existingRet.inherited && !existingRet.borrowed && existingRet.ownerHost == null) {
6902
+ const first = existingRet.start ?? existingRet.hostNode ?? existingRet.text ?? existingRet.block?.startMarker ?? existingRet.end ?? null;
6903
+ const last = existingRet.end ?? existingRet.block?.endMarker ?? first;
6904
+ if (sharesBlockBoundary(block, first, last)) {
6905
+ replacedStart = first;
6906
+ replacedEnd = last;
6907
+ }
6908
+ }
6909
+ disposeReturnSlot(block, existingRet);
6910
+ if (block.disposed) return;
6877
6911
  }
6878
- disposeReturnSlot(block, existingRet);
6879
- if (block.disposed) return;
6880
- }
6881
- if (useSingleRoot) {
6882
- const d = out;
6883
- if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && !(0, import_profiling.__profileHasComponentMetadata)(d.type)) {
6884
- withProfileComponentOverride(
6885
- d.type,
6886
- null,
6887
- () => componentSlot(
6912
+ if (useSingleRoot) {
6913
+ const d = out;
6914
+ if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && !(0, import_profiling.__profileHasComponentMetadata)(d.type)) {
6915
+ withProfileComponentOverride(
6916
+ d.type,
6917
+ null,
6918
+ () => componentSlot(
6919
+ block,
6920
+ 0,
6921
+ block.parentNode,
6922
+ d.type,
6923
+ d.props,
6924
+ block.endMarker,
6925
+ d.key ?? void 0,
6926
+ true,
6927
+ void 0,
6928
+ activeHydration() !== null && elementKeyWasProvided(d),
6929
+ d.__octaneInvocationSite
6930
+ )
6931
+ );
6932
+ } else {
6933
+ componentSlot(
6888
6934
  block,
6889
6935
  0,
6890
6936
  block.parentNode,
@@ -6896,66 +6942,63 @@ function renderReturnedValue(block, out) {
6896
6942
  void 0,
6897
6943
  activeHydration() !== null && elementKeyWasProvided(d),
6898
6944
  d.__octaneInvocationSite
6899
- )
6900
- );
6945
+ );
6946
+ }
6901
6947
  } else {
6902
- componentSlot(
6903
- block,
6904
- 0,
6905
- block.parentNode,
6906
- d.type,
6907
- d.props,
6908
- block.endMarker,
6909
- d.key ?? void 0,
6910
- true,
6911
- void 0,
6912
- activeHydration() !== null && elementKeyWasProvided(d),
6913
- d.__octaneInvocationSite
6914
- );
6948
+ const returnHydration = activeHydration();
6949
+ 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))) {
6950
+ const borrowed = {
6951
+ __kind: "childSlot",
6952
+ start: block.startMarker,
6953
+ end: block.endMarker,
6954
+ ownerHost: null,
6955
+ borrowed: true,
6956
+ compactable: false,
6957
+ block: null,
6958
+ text: null,
6959
+ currentComp: null,
6960
+ currentIsBodyFn: false,
6961
+ forSlot: null,
6962
+ hostNode: null,
6963
+ portal: null
6964
+ };
6965
+ block.slots[0] = borrowed;
6966
+ registerSlot(block, borrowed);
6967
+ }
6968
+ childSlot(block, 0, block.parentNode, out, block.endMarker);
6915
6969
  }
6916
- } else {
6917
- const returnHydration = activeHydration();
6918
- 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))) {
6919
- const borrowed = {
6920
- __kind: "childSlot",
6921
- start: block.startMarker,
6922
- end: block.endMarker,
6923
- ownerHost: null,
6924
- borrowed: true,
6925
- compactable: false,
6926
- block: null,
6927
- text: null,
6928
- currentComp: null,
6929
- currentIsBodyFn: false,
6930
- forSlot: null,
6931
- hostNode: null,
6932
- portal: null
6933
- };
6934
- block.slots[0] = borrowed;
6935
- registerSlot(block, borrowed);
6970
+ if (replacedStart !== null) {
6971
+ const incoming = block.slots[0];
6972
+ const first = incoming.start ?? incoming.hostNode ?? incoming.text ?? incoming.block?.startMarker ?? incoming.end ?? null;
6973
+ const last = incoming.end ?? incoming.block?.endMarker ?? first;
6974
+ replaceSharedBlockBoundary(block, replacedStart, replacedEnd, first, last);
6936
6975
  }
6937
- childSlot(block, 0, block.parentNode, out, block.endMarker);
6938
- }
6939
- if (replacedStart !== null) {
6940
- const incoming = block.slots[0];
6941
- const first = incoming.start ?? incoming.hostNode ?? incoming.text ?? incoming.block?.startMarker ?? incoming.end ?? null;
6942
- const last = incoming.end ?? incoming.block?.endMarker ?? first;
6943
- replaceSharedBlockBoundary(block, replacedStart, replacedEnd, first, last);
6976
+ const state = block.slots[0];
6977
+ if (!block.disposed && state !== void 0 && state.returnedOutput !== true) {
6978
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
6979
+ TRANSITION_JOURNAL.push(JOURNAL_PROP, state, "returnedOutput", state.returnedOutput);
6980
+ }
6981
+ state.returnedOutput = true;
6982
+ }
6983
+ } finally {
6984
+ RETURNED_OUTPUT_SCOPE = previous;
6944
6985
  }
6945
6986
  }
6946
6987
  function disposeReturnSlot(block, state) {
6988
+ const kind = state.__kind;
6989
+ const end = (kind === "ifBlockSlot" || kind === "switchBlockSlot") && state.start === null && state.block?.endMarker != null ? state.block.endMarker : state.end;
6947
6990
  const transaction = ROOT_RENDER_TRANSACTION;
6948
6991
  if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK) {
6949
6992
  const parent = state.ownerHost ?? block.parentNode;
6950
6993
  const borrowed = state.inherited === true || state.borrowed === true;
6951
- 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;
6952
- if (borrowed && first === state.end) first = null;
6953
- 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;
6994
+ 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;
6995
+ if (borrowed && first === end) first = null;
6996
+ 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;
6954
6997
  journalRootSlot(
6955
6998
  state,
6956
6999
  parent,
6957
7000
  borrowed ? state.start : first !== null ? (STAGED_DOM?.view(first) ?? first).previousSibling : (STAGED_DOM?.view(parent) ?? parent).lastChild,
6958
- borrowed ? state.end : (STAGED_DOM?.view(last) ?? last)?.nextSibling ?? null
7001
+ borrowed ? end : (STAGED_DOM?.view(last) ?? last)?.nextSibling ?? null
6959
7002
  );
6960
7003
  const retiredBlock = state.block ?? state.portal?.block;
6961
7004
  if (retiredBlock != null) retireRootBlock(retiredBlock);
@@ -6978,7 +7021,7 @@ function disposeReturnSlot(block, state) {
6978
7021
  block.slots[0] = void 0;
6979
7022
  return;
6980
7023
  }
6981
- if (state.__kind === "childSlot") {
7024
+ if (kind === "childSlot") {
6982
7025
  if (state.portal) {
6983
7026
  teardownPortalState(state.portal);
6984
7027
  state.portal = null;
@@ -6992,13 +7035,17 @@ function disposeReturnSlot(block, state) {
6992
7035
  clearChildContent(state);
6993
7036
  if (!state.borrowed) {
6994
7037
  domNode(state.start)?.remove();
6995
- domNode(state.end)?.remove();
7038
+ domNode(end)?.remove();
6996
7039
  }
6997
7040
  } else {
6998
- if (state.block) unmountBlock(state.block, true);
6999
- if (!state.inherited) {
7041
+ if (kind === "componentSlotSlot") {
7042
+ if (state.block) unmountBlock(state.block, true);
7043
+ } else {
7044
+ unmountSlot(state, true);
7045
+ }
7046
+ if (!state.inherited && !state.borrowed) {
7000
7047
  domNode(state.start)?.remove?.();
7001
- domNode(state.end)?.remove?.();
7048
+ domNode(end)?.remove?.();
7002
7049
  }
7003
7050
  }
7004
7051
  const reg = block._slots;
@@ -7386,6 +7433,8 @@ function resolveSlot(slot) {
7386
7433
  return typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ ? (0, import_profiling.__profileResolveHook)(resolved, typeof slot === "symbol" ? slot : void 0) : resolved;
7387
7434
  }
7388
7435
  function nativeLocalHook(name, initialize, dispose, slot) {
7436
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null)
7437
+ throw new PresentationAdoptionMiss(void 0, false);
7389
7438
  slot = resolveSlot(slot);
7390
7439
  if (slot === void 0 || CURRENT_SCOPE === null) missingSlot(name);
7391
7440
  const scope = CURRENT_SCOPE;
@@ -8496,6 +8545,10 @@ function renderSharedBody(body, props, scope, extra) {
8496
8545
  }
8497
8546
  }
8498
8547
  function invalidateSharedBodyOutput(scope) {
8548
+ const state = scope.slots[0];
8549
+ if (scope === scope.block && scope.block.outputHandler !== null && (state?.__kind === "childSlot" || state?.__kind === "componentSlotSlot" || state?.__kind === "ifBlockSlot" || state?.__kind === "switchBlockSlot" || state?.__kind === "activityBlockSlot")) {
8550
+ setReturnedOutputOwner(state, true);
8551
+ }
8499
8552
  const first = scope.compilerMemo;
8500
8553
  if (first === null) return;
8501
8554
  invalidateSharedBodyMemoRegion(first);
@@ -8521,13 +8574,16 @@ function provideContext(scope, context, value) {
8521
8574
  if (had) values.set(context, previous);
8522
8575
  else values.delete(context);
8523
8576
  });
8524
- if (had) {
8577
+ if (had && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
8525
8578
  context.$$version++;
8526
8579
  (0, import_context_epoch.bumpContextEpoch)();
8527
8580
  }
8528
8581
  values.set(context, value);
8529
8582
  }
8530
8583
  const CHILDREN_BODY = /* @__PURE__ */ Symbol.for("octane.childrenBody");
8584
+ const CHILDREN_DIAGNOSTIC_CAPTURES = /* @__PURE__ */ Symbol.for(
8585
+ "octane.childrenDiagnosticCaptures"
8586
+ );
8531
8587
  function markSingleRoot(component) {
8532
8588
  component.$$singleRoot = true;
8533
8589
  return component;
@@ -8536,6 +8592,10 @@ function markChildrenBlock(fn, body) {
8536
8592
  if (typeof fn === "function") {
8537
8593
  fn[import_runtime_tags.CHILDREN_BLOCK_TAG] = true;
8538
8594
  if (body !== void 0) fn[CHILDREN_BODY] = body;
8595
+ if (process.env.NODE_ENV !== "production") {
8596
+ const captures = arguments[2];
8597
+ if (captures !== void 0) fn[CHILDREN_DIAGNOSTIC_CAPTURES] = captures;
8598
+ }
8539
8599
  }
8540
8600
  return fn;
8541
8601
  }
@@ -8685,6 +8745,233 @@ const HYDRATE_STREAM_SCAN_MASK = 1 | 128;
8685
8745
  let hydrateStreamWaitCleanups = null;
8686
8746
  let preservedHydrateActivations = null;
8687
8747
  let preservedHydrateActivationCount = 0;
8748
+ let initialHydrateAttributes = null;
8749
+ let hydrateAttributeProbe = null;
8750
+ function copyHydrateDiagnosticIds(ids) {
8751
+ const first = { prefix: ids.prefix, next: ids.next };
8752
+ let copy = first;
8753
+ while (true) {
8754
+ if (ids.limit !== void 0) copy.limit = ids.limit;
8755
+ if (ids.signalState !== void 0) copy.signalState = { ...ids.signalState };
8756
+ if (ids.overflow === void 0) return first;
8757
+ ids = ids.overflow;
8758
+ copy = copy.overflow = { prefix: ids.prefix, next: ids.next };
8759
+ }
8760
+ }
8761
+ function copyHydrateDiagnosticContexts(scope) {
8762
+ let contexts = null;
8763
+ const add = (values) => {
8764
+ if (values === null) return;
8765
+ for (const [context, value] of values) {
8766
+ contexts ??= /* @__PURE__ */ new Map();
8767
+ if (!contexts.has(context)) contexts.set(context, value);
8768
+ }
8769
+ };
8770
+ for (let current = scope; current !== null; current = current.parent)
8771
+ add(current.$$ctxValues);
8772
+ for (let block = scope.block.parentBlock; block !== null; block = block.parentBlock)
8773
+ add(block.$$ctxValues);
8774
+ return contexts;
8775
+ }
8776
+ function changedHydrateDiagnosticContexts(initial, next) {
8777
+ if ((initial?.size ?? 0) !== (next?.size ?? 0)) return true;
8778
+ if (initial !== null) {
8779
+ for (const [context, value] of initial) {
8780
+ if (next === null || !next.has(context) || !Object.is(value, next.get(context))) return true;
8781
+ }
8782
+ }
8783
+ return false;
8784
+ }
8785
+ function changedHydrateDiagnosticCaptures(initial, next) {
8786
+ if (initial.__data === void 0 || next.__data === void 0)
8787
+ return changedHydrateDiagnosticChildren(initial.children, next.children);
8788
+ if (initial.__data.length !== next.__data.length) return true;
8789
+ for (let i = 0; i < initial.__data.length; i++) {
8790
+ if (!Object.is(initial.__data[i], next.__data[i])) return true;
8791
+ }
8792
+ return false;
8793
+ }
8794
+ function changedHydrateDiagnosticChildren(initial, next) {
8795
+ if (initial === next) return false;
8796
+ if (typeof initial !== "function" || typeof next !== "function") return true;
8797
+ try {
8798
+ const body = initial[CHILDREN_BODY];
8799
+ const initialCaptures = initial[CHILDREN_DIAGNOSTIC_CAPTURES];
8800
+ const nextCaptures = next[CHILDREN_DIAGNOSTIC_CAPTURES];
8801
+ if (initialCaptures === void 0 && nextCaptures === void 0 && isChildrenBlock(initial) && isChildrenBlock(next))
8802
+ return false;
8803
+ if (body === void 0 || body !== next[CHILDREN_BODY] || initialCaptures == null || nextCaptures == null)
8804
+ return true;
8805
+ const before = initialCaptures();
8806
+ const after = nextCaptures();
8807
+ if (before.length !== after.length) return true;
8808
+ for (let i = 0; i < before.length; i++) {
8809
+ if (!Object.is(before[i], after[i])) return true;
8810
+ }
8811
+ return false;
8812
+ } catch {
8813
+ return true;
8814
+ }
8815
+ }
8816
+ function recordInitialHydrateAttribute(el, name, server, next) {
8817
+ const probe = hydrateAttributeProbe;
8818
+ const original = probe?.originals.get(el);
8819
+ if (original === void 0) return;
8820
+ let values = probe.attributes.get(original);
8821
+ if (values === void 0) probe.attributes.set(original, values = /* @__PURE__ */ new Map());
8822
+ const previous = values.get(name);
8823
+ values.set(name, {
8824
+ server: previous === void 0 ? server : previous.server,
8825
+ next,
8826
+ suppressed: isHydrationSuppressed(el),
8827
+ checked: false
8828
+ });
8829
+ }
8830
+ function checkInitialHydrateAttribute(hydration, el, name, server) {
8831
+ const initial = hydration.attributeBaselines?.attributes.get(el)?.get(name);
8832
+ if (initial === void 0) return false;
8833
+ if (initial.checked) return true;
8834
+ initial.checked = true;
8835
+ if (!initial.suppressed && initial.server !== initial.next && !(name !== "class" && name !== "style" && initial.next !== null && isAttributeParserNormalizedMatch(initial.server, initial.next)) && import_dom_binding_claims.domBindingClaims.get(el)?.get(name) !== server) {
8836
+ warnHydrationValueMismatch(
8837
+ el.__oct_loc,
8838
+ name === "style" ? "style" : `attribute \`${name}\``,
8839
+ name === "style" ? initial.server ?? "" : initial.server,
8840
+ name === "style" ? initial.next ?? "" : initial.next
8841
+ );
8842
+ }
8843
+ return true;
8844
+ }
8845
+ function probeInitialHydrateAttributes(state) {
8846
+ const snapshot = initialHydrateAttributes?.get(state);
8847
+ if (snapshot === void 0 || !changedHydrateDiagnosticCaptures(snapshot.props, state.props) && !changedHydrateDiagnosticContexts(
8848
+ snapshot.contexts,
8849
+ copyHydrateDiagnosticContexts(
8850
+ CURRENT_SCOPE?.block === state.parentBlock ? CURRENT_SCOPE : state.parentBlock
8851
+ )
8852
+ ))
8853
+ return;
8854
+ try {
8855
+ return collectInitialHydrateAttributes(state, snapshot);
8856
+ } catch {
8857
+ return;
8858
+ }
8859
+ }
8860
+ function collectInitialHydrateAttributes(state, snapshot) {
8861
+ const ownerDocument = document.implementation.createHTMLDocument("");
8862
+ const originalWrapper = state.wrapper;
8863
+ const source = STAGED_DOM?.view(originalWrapper) ?? originalWrapper;
8864
+ const template2 = ownerDocument.createElement("template");
8865
+ template2.innerHTML = source.outerHTML;
8866
+ const wrapper = ownerDocument.adoptNode(template2.content.firstElementChild);
8867
+ const probe = {
8868
+ document: ownerDocument,
8869
+ originals: /* @__PURE__ */ new WeakMap(),
8870
+ attributes: /* @__PURE__ */ new WeakMap(),
8871
+ boundaries: /* @__PURE__ */ new WeakMap()
8872
+ };
8873
+ probe.originals.set(wrapper, originalWrapper);
8874
+ const originals = source.querySelectorAll("*");
8875
+ const copies = wrapper.querySelectorAll("*");
8876
+ if (originals.length !== copies.length) return;
8877
+ for (let i = 0; i < originals.length; i++) {
8878
+ const original = originals[i];
8879
+ const copy = copies[i];
8880
+ if (copy.localName !== original.localName || copy.namespaceURI !== original.namespaceURI || probe.originals.get(copy.parentElement) !== (STAGED_DOM?.view(original) ?? original).parentElement)
8881
+ return;
8882
+ probe.originals.set(copy, original);
8883
+ }
8884
+ const start = wrapper.firstChild;
8885
+ if (start === null || !isBlockOpen(start)) return;
8886
+ const end = findMatchingClose(start, /* @__PURE__ */ new WeakMap());
8887
+ const initialChild = (_props, scope, extra) => {
8888
+ if (state.loadedBody !== null) state.loadedBody(snapshot.props.__data, scope, extra);
8889
+ else childrenAsBody(snapshot.props.children)(void 0, scope, extra);
8890
+ };
8891
+ const body = (_props, scope) => {
8892
+ tryBlock(scope, 0, wrapper, initialChild, null, null, end);
8893
+ };
8894
+ const block = createBlock("control-flow", null, wrapper, start, end, body, void 0);
8895
+ block.idState = copyHydrateDiagnosticIds(snapshot.ids);
8896
+ block.$$ctxValues = snapshot.contexts === null ? null : new Map(snapshot.contexts);
8897
+ const hydration = new HydrationCapability(block, start.nextSibling, null);
8898
+ if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
8899
+ hydration.protectRootAnchor(end);
8900
+ const capture = createOffscreenCapture();
8901
+ const previousHydration = currentHydration;
8902
+ const previousCapture = WIP_CAPTURE;
8903
+ const previousProbe = hydrateAttributeProbe;
8904
+ const previousTransaction = ROOT_RENDER_TRANSACTION;
8905
+ const previousJournal = TRANSITION_JOURNAL;
8906
+ const previousAttempt = ACTIVE_TRANSITION_ATTEMPT;
8907
+ const previousScopedReadTracking = SCOPED_READ_TRACKING;
8908
+ const previousScopedReads = SCOPED_READS;
8909
+ const previousWarm = CURRENT_WARM;
8910
+ const previousWarmClaims = CURRENT_WARM_CLAIMS;
8911
+ const previousWarmEpisode = CURRENT_WARM_EPISODE;
8912
+ const previousWarmPlans = ACTIVE_WARM_PLANS.splice(0);
8913
+ const previousStagedDom = STAGED_DOM;
8914
+ const previousStagedCapture = STAGED_COMMIT_CAPTURE;
8915
+ const previousPresentation = PRESENTATION_HYDRATION;
8916
+ const previousSelectSyncs = SELECT_SYNCS;
8917
+ const previousSelectDefaultSyncs = SELECT_DEFAULT_SYNCS;
8918
+ const previousFormChecks = DEV_FORM_CHECKS;
8919
+ const previousAutofocus = AUTOFOCUS_QUEUE;
8920
+ const previousNative = (0, import_read_protocol.setNativeAdoptionResolver)(null);
8921
+ const refDetachCheckpoint = refDetachQueue.length;
8922
+ currentHydration = hydration;
8923
+ WIP_CAPTURE = capture;
8924
+ hydrateAttributeProbe = probe;
8925
+ ROOT_RENDER_TRANSACTION = null;
8926
+ TRANSITION_JOURNAL = null;
8927
+ ACTIVE_TRANSITION_ATTEMPT = null;
8928
+ SCOPED_READ_TRACKING = false;
8929
+ SCOPED_READS = null;
8930
+ CURRENT_WARM = null;
8931
+ CURRENT_WARM_CLAIMS = null;
8932
+ CURRENT_WARM_EPISODE = 0;
8933
+ STAGED_DOM = null;
8934
+ STAGED_COMMIT_CAPTURE = null;
8935
+ PRESENTATION_HYDRATION = null;
8936
+ SELECT_SYNCS = [];
8937
+ SELECT_DEFAULT_SYNCS = [];
8938
+ DEV_FORM_CHECKS = [];
8939
+ AUTOFOCUS_QUEUE = [];
8940
+ try {
8941
+ renderBlock(block);
8942
+ drainHydrationRenderPhaseUpdates(block);
8943
+ hydration.flushClassWrites();
8944
+ } catch {
8945
+ } finally {
8946
+ try {
8947
+ disposeWip({ block, start, end, capture, domParent: wrapper, refDetachCheckpoint });
8948
+ drainHydrationRenderPhaseUpdates(block);
8949
+ } finally {
8950
+ (0, import_read_protocol.setNativeAdoptionResolver)(previousNative);
8951
+ currentHydration = previousHydration;
8952
+ WIP_CAPTURE = previousCapture;
8953
+ hydrateAttributeProbe = previousProbe;
8954
+ ROOT_RENDER_TRANSACTION = previousTransaction;
8955
+ TRANSITION_JOURNAL = previousJournal;
8956
+ ACTIVE_TRANSITION_ATTEMPT = previousAttempt;
8957
+ SCOPED_READ_TRACKING = previousScopedReadTracking;
8958
+ SCOPED_READS = previousScopedReads;
8959
+ CURRENT_WARM = previousWarm;
8960
+ CURRENT_WARM_CLAIMS = previousWarmClaims;
8961
+ CURRENT_WARM_EPISODE = previousWarmEpisode;
8962
+ ACTIVE_WARM_PLANS.length = 0;
8963
+ ACTIVE_WARM_PLANS.push(...previousWarmPlans);
8964
+ STAGED_DOM = previousStagedDom;
8965
+ STAGED_COMMIT_CAPTURE = previousStagedCapture;
8966
+ PRESENTATION_HYDRATION = previousPresentation;
8967
+ SELECT_SYNCS = previousSelectSyncs;
8968
+ SELECT_DEFAULT_SYNCS = previousSelectDefaultSyncs;
8969
+ DEV_FORM_CHECKS = previousFormChecks;
8970
+ AUTOFOCUS_QUEUE = previousAutofocus;
8971
+ }
8972
+ }
8973
+ return probe;
8974
+ }
8688
8975
  function releasePreservedHydrateActivation(state) {
8689
8976
  if (preservedHydrateActivations?.delete(state)) preservedHydrateActivationCount--;
8690
8977
  }
@@ -8867,6 +9154,7 @@ function createHydrateBoundaryBody(state, renderChild, pendingBody) {
8867
9154
  }
8868
9155
  function failHydrateBoundary(state, error) {
8869
9156
  if (state.hasError || state.block.disposed) return;
9157
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8870
9158
  cleanupHydrateStreamWait(state);
8871
9159
  state.hasError = true;
8872
9160
  state.error = error;
@@ -8984,6 +9272,7 @@ function teardownHydrateBoundary(state) {
8984
9272
  }
8985
9273
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => teardownHydrateBoundary(state), true) === true)
8986
9274
  return;
9275
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8987
9276
  cleanupHydrateInstallers(state);
8988
9277
  cleanupHydrateStreamWait(state);
8989
9278
  if (preserved !== void 0) {
@@ -9334,6 +9623,7 @@ function createHydrateSlot(props, scope, boundaryId, boundaryBody) {
9334
9623
  end,
9335
9624
  parentBlock,
9336
9625
  props,
9626
+ contextChanged: false,
9337
9627
  boundaryId: (STAGED_DOM?.view(wrapper) ?? wrapper).getAttribute(import_constants.HYDRATE_ID_ATTR) ?? boundaryId,
9338
9628
  intentBoundary,
9339
9629
  delegatedDynamicIntent: (0, import_event_capture.takeDelegatedDynamicHydrationIntent)(wrapper),
@@ -9363,10 +9653,22 @@ function createHydrateSlot(props, scope, boundaryId, boundaryBody) {
9363
9653
  independent: props.__independent !== void 0
9364
9654
  };
9365
9655
  if (nativeSeedRaw !== null) state.nativeSeedRaw = nativeSeedRaw;
9656
+ if (process.env.NODE_ENV !== "production" && serverPreserved && !state.independent) {
9657
+ const original = hydrateAttributeProbe?.originals.get(wrapper);
9658
+ const inherited = hydration?.attributeBaselines?.boundaries.get(wrapper);
9659
+ const snapshot = inherited ?? {
9660
+ props,
9661
+ ids: copyHydrateDiagnosticIds(idState),
9662
+ contexts: copyHydrateDiagnosticContexts(scope)
9663
+ };
9664
+ (initialHydrateAttributes ??= /* @__PURE__ */ new WeakMap()).set(state, snapshot);
9665
+ if (original !== void 0) hydrateAttributeProbe.boundaries.set(original, snapshot);
9666
+ }
9366
9667
  scope.slots[0] = state;
9367
9668
  registerSlot(scope, state);
9368
9669
  if (!state.independent) (0, import_event_capture.registerHydrationIntentBoundary)(wrapper, intentBoundary);
9369
9670
  block.body = boundaryBody(state);
9671
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return state;
9370
9672
  const initialStrategy = resolveHydrateStrategy(state);
9371
9673
  const pendingIntents = state.independent ? void 0 : (0, import_event_capture.takePendingHydrationIntents)(wrapper);
9372
9674
  if (state.independent) {
@@ -9394,6 +9696,8 @@ function activateHydrateBoundary(state) {
9394
9696
  }
9395
9697
  const hydration = preserved?.hydration ?? new HydrationCapability(block, getNextSibling(state.start), null);
9396
9698
  if (preserved === void 0) {
9699
+ if (process.env.NODE_ENV !== "production")
9700
+ hydration.attributeBaselines = probeInitialHydrateAttributes(state);
9397
9701
  if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
9398
9702
  hydration.protectRootAnchor(state.end);
9399
9703
  }
@@ -9468,6 +9772,7 @@ function activateHydrateBoundary(state) {
9468
9772
  if (nativeRecovery !== void 0) {
9469
9773
  noteRecoverableHydrationError(() => nativeRecovery, block);
9470
9774
  state.serverPreserved = false;
9775
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9471
9776
  state.serverActivationStarted = false;
9472
9777
  state.seedRaw = null;
9473
9778
  state.nativeSeedRaw = void 0;
@@ -9498,6 +9803,7 @@ function activateHydrateBoundary(state) {
9498
9803
  return;
9499
9804
  }
9500
9805
  if (completed) {
9806
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9501
9807
  releasePreservedHydrateActivation(state);
9502
9808
  spliceOffscreenCapture(capture);
9503
9809
  }
@@ -9607,6 +9913,7 @@ function notifyHydrateBoundary(state, scope) {
9607
9913
  return;
9608
9914
  }
9609
9915
  state.didNotify = true;
9916
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9610
9917
  cleanupHydrateInstallers(state);
9611
9918
  state.props.onHydrated?.();
9612
9919
  domNode(state.wrapper).removeAttribute(import_constants.HYDRATE_WHEN_ATTR);
@@ -9636,6 +9943,7 @@ function initializeHydrateComponent(boundaryBody) {
9636
9943
  if (state.independent !== (props.__independent !== void 0)) {
9637
9944
  throw new Error((0, import_error_codes_client_generated.formatClientError)(66));
9638
9945
  }
9946
+ const surroundingUpdate = state.props !== props || state.contextChanged;
9639
9947
  state.props = props;
9640
9948
  if (!state.independent && !state.hydrated) {
9641
9949
  const strategy = resolveHydrateStrategy(state);
@@ -9643,7 +9951,8 @@ function initializeHydrateComponent(boundaryBody) {
9643
9951
  cleanupHydrateStrategy(state);
9644
9952
  invalidateHydrateActivation(state);
9645
9953
  } else if (!state.activationRequested) {
9646
- requestHydrateBoundary(state);
9954
+ const shouldDefer = surroundingUpdate ? false : strategy._d ? strategy._d() : strategy._t !== "load";
9955
+ if (!shouldDefer) requestHydrateBoundary(state);
9647
9956
  }
9648
9957
  }
9649
9958
  }
@@ -11535,13 +11844,20 @@ class HydrationCapability {
11535
11844
  ns,
11536
11845
  name.indexOf(":") >= 0 ? name.slice(name.indexOf(":") + 1) : name
11537
11846
  ) : (STAGED_DOM?.view(el) ?? el).getAttribute(name);
11847
+ if (process.env.NODE_ENV !== "production") {
11848
+ if (hydrateAttributeProbe !== null) {
11849
+ recordInitialHydrateAttribute(el, name, server, next);
11850
+ } else {
11851
+ checkInitialHydrateAttribute(this, el, name, server);
11852
+ }
11853
+ }
11538
11854
  if (server === next) return false;
11539
11855
  if (import_dom_binding_claims.domBindingClaims.get(el)?.get(name) === server) return false;
11540
11856
  if (next !== null && isAttributeParserNormalizedMatch(server, next)) return false;
11541
11857
  const mode = hydrationMismatchMode(el);
11542
11858
  if (mode === 0) return true;
11543
11859
  if (mode === 1) return false;
11544
- if (process.env.NODE_ENV !== "production")
11860
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, name, server))
11545
11861
  warnHydrationValueMismatch(el.__oct_loc, `attribute \`${name}\``, server, next);
11546
11862
  return true;
11547
11863
  }
@@ -11549,11 +11865,15 @@ class HydrationCapability {
11549
11865
  const mode = hydrationMismatchMode(el);
11550
11866
  const rawServer = (STAGED_DOM?.view(el) ?? el).getAttribute("class");
11551
11867
  const server = absentIsEmpty && rawServer === null ? "" : rawServer;
11868
+ if (process.env.NODE_ENV !== "production") {
11869
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "class", server, next);
11870
+ else checkInitialHydrateAttribute(this, el, "class", rawServer);
11871
+ }
11552
11872
  if (server === next) return true;
11553
11873
  if (import_dom_binding_claims.domBindingClaims.get(el)?.get("class") === rawServer) return false;
11554
11874
  if (mode === 0) return true;
11555
11875
  if (mode === 1) return false;
11556
- if (process.env.NODE_ENV !== "production")
11876
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "class", rawServer))
11557
11877
  warnHydrationValueMismatch(el.__oct_loc, "attribute `class`", server, next);
11558
11878
  return true;
11559
11879
  }
@@ -11564,7 +11884,11 @@ class HydrationCapability {
11564
11884
  try {
11565
11885
  for (const [el, write] of this.classWrites) {
11566
11886
  const rawTarget = write.remove ? null : write.next;
11567
- if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) continue;
11887
+ if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) {
11888
+ if (process.env.NODE_ENV !== "production")
11889
+ this.allowClass(el, write.next, write.absentIsEmpty);
11890
+ continue;
11891
+ }
11568
11892
  if (!this.allowClass(el, write.next, write.absentIsEmpty)) continue;
11569
11893
  if (write.remove) (STAGED_DOM?.view(el) ?? el).removeAttribute("class");
11570
11894
  else if (write.useAttribute)
@@ -11577,7 +11901,21 @@ class HydrationCapability {
11577
11901
  }
11578
11902
  applyStyle(el, value, _prev, staticCss, entries) {
11579
11903
  const mode = hydrationMismatchMode(el);
11580
- if (mode === 1) return true;
11904
+ if (mode === 1) {
11905
+ if (process.env.NODE_ENV !== "production") {
11906
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "style", null, null);
11907
+ else {
11908
+ const current = STAGED_DOM?.view(el) ?? el;
11909
+ checkInitialHydrateAttribute(
11910
+ this,
11911
+ el,
11912
+ "style",
11913
+ current.hasAttribute("style") ? current.style.cssText : null
11914
+ );
11915
+ }
11916
+ }
11917
+ return true;
11918
+ }
11581
11919
  const style = (STAGED_DOM?.view(el) ?? el).style;
11582
11920
  const hadStyleAttribute = (STAGED_DOM?.view(el) ?? el).hasAttribute("style");
11583
11921
  const before = style.cssText;
@@ -11593,7 +11931,11 @@ class HydrationCapability {
11593
11931
  applyStyleProperty(el, expectedStyle, entries[i], entry);
11594
11932
  }
11595
11933
  }
11596
- const claims = import_dom_binding_claims.domBindingClaims.get(el);
11934
+ let claims = import_dom_binding_claims.domBindingClaims.get(el);
11935
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) {
11936
+ const original = hydrateAttributeProbe.originals.get(el);
11937
+ if (original !== void 0) claims = import_dom_binding_claims.domBindingClaims.get(original);
11938
+ }
11597
11939
  if (claims !== void 0) {
11598
11940
  for (const [channel, published] of claims) {
11599
11941
  if (!channel.startsWith("style:")) continue;
@@ -11607,10 +11949,20 @@ class HydrationCapability {
11607
11949
  }
11608
11950
  const expected = expectedStyle.cssText;
11609
11951
  const expectsStyleAttribute = expected !== "";
11952
+ if (process.env.NODE_ENV !== "production") {
11953
+ if (hydrateAttributeProbe !== null)
11954
+ recordInitialHydrateAttribute(
11955
+ el,
11956
+ "style",
11957
+ hadStyleAttribute ? before : null,
11958
+ expectsStyleAttribute ? expected : null
11959
+ );
11960
+ else checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null);
11961
+ }
11610
11962
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
11611
11963
  if (expectsStyleAttribute) style.cssText = expected;
11612
11964
  else (STAGED_DOM?.view(el) ?? el).removeAttribute("style");
11613
- if (mode === 2 && process.env.NODE_ENV !== "production") {
11965
+ if (mode === 2 && process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null)) {
11614
11966
  warnHydrationValueMismatch(el.__oct_loc, "style", before, expected);
11615
11967
  }
11616
11968
  return true;
@@ -12876,6 +13228,8 @@ function bindDirectSignal(scope, previous, target, value, site, policy, name, at
12876
13228
  const kind = policy.kind;
12877
13229
  const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_BINDING] === true ? previous : null;
12878
13230
  const handle = isSignalHandle(value) ? value : null;
13231
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && handle !== null)
13232
+ throw new PresentationAdoptionMiss(void 0, false);
12879
13233
  if (handle !== null && (!import_document_owner.signalDocumentEnabled || (0, import_owner_context.currentSignalOwner)() !== SCOPE_SIGNAL_OWNERS.get(scope))) {
12880
13234
  if (!import_document_owner.signalDocumentEnabled) enableSignalBindings();
12881
13235
  return runWithBlockSignalOwner(
@@ -15190,6 +15544,7 @@ function namespaceHeadElement(headKey, tag, attrs, text, authoredKey) {
15190
15544
  return createElement(namespaceHead, config);
15191
15545
  }
15192
15546
  function injectStyle(id, css, nonce) {
15547
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
15193
15548
  if (typeof document === "undefined") {
15194
15549
  _injectedStyles.add(id);
15195
15550
  return;
@@ -17403,6 +17758,8 @@ function registerValuePortalFragmentOwners(portal2, parentBlock, anchor) {
17403
17758
  }
17404
17759
  }
17405
17760
  function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, env, key = null) {
17761
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && target.ownerDocument !== hydrateAttributeProbe.document)
17762
+ target = hydrateAttributeProbe.document.createDocumentFragment();
17406
17763
  const hydration = activeHydration();
17407
17764
  if (hydration !== null) {
17408
17765
  return hydration.suspend(
@@ -18119,6 +18476,18 @@ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor,
18119
18476
  }
18120
18477
  function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body, identity, props, renderProps, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
18121
18478
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
18479
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE) {
18480
+ const state2 = parentScope.slots[0];
18481
+ if (state2?.returnedOutput === true) {
18482
+ if (state2.__kind === "componentSlotSlot") {
18483
+ setReturnedOutputOwner(state2, false);
18484
+ } else {
18485
+ const block = parentScope.block;
18486
+ block.outputHandler(block, null, true);
18487
+ if (block.disposed) return;
18488
+ }
18489
+ }
18490
+ }
18122
18491
  const parentBlock = parentScope.block;
18123
18492
  const hydration = activeHydration();
18124
18493
  if (hydration !== null && (anchor != null && hydration.isFresh(anchor) || hydration.isFresh(domParent))) {
@@ -20360,6 +20729,18 @@ function bindingChildSlot(parentScope, slotKey, domParent, value, marker, anchor
20360
20729
  }
20361
20730
  function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable, includeKeyedSingle = true, compiledMapBody, compiledMapKey, compiledMapFlags, compiledMapDeps, mappedFallback, bindingMarker) {
20362
20731
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
20732
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE) {
20733
+ const state2 = parentScope.slots[0];
20734
+ if (state2?.returnedOutput === true) {
20735
+ if (state2.__kind === "childSlot") {
20736
+ setReturnedOutputOwner(state2, false);
20737
+ } else {
20738
+ const block = parentScope.block;
20739
+ block.outputHandler(block, null, true);
20740
+ if (block.disposed) return;
20741
+ }
20742
+ }
20743
+ }
20363
20744
  if (IMPLICIT_SIGNAL_CHILD_DEPTH === 0) {
20364
20745
  const existing = parentScope.slots[slotKey];
20365
20746
  const previous = existing?.implicitSignal;
@@ -20988,6 +21369,9 @@ function textSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, compac
20988
21369
  childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, void 0, compactable);
20989
21370
  return;
20990
21371
  }
21372
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE && state.returnedOutput === true) {
21373
+ setReturnedOutputOwner(state, false);
21374
+ }
20991
21375
  const str = vt === "string" ? value : vt === "boolean" || value == null ? "" : String(value);
20992
21376
  if (state.text !== null) {
20993
21377
  updateTextValue(state.text, str);
@@ -21379,7 +21763,8 @@ function hmr(fn) {
21379
21763
  }
21380
21764
  };
21381
21765
  function wrapper(props, scope, extra) {
21382
- if (scope !== void 0) meta.liveBlocks.add(scope.block);
21766
+ if (scope !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
21767
+ meta.liveBlocks.add(scope.block);
21383
21768
  return meta.fn(props, scope, extra);
21384
21769
  }
21385
21770
  Object.defineProperty(wrapper, HMR, {
@@ -21778,7 +22163,8 @@ function mountPassthroughPending(state, thenable) {
21778
22163
  setTryBranch(state, -1);
21779
22164
  scheduleRender(state.parentBlock);
21780
22165
  };
21781
- thenable.then(retry, retry);
22166
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22167
+ thenable.then(retry, retry);
21782
22168
  }
21783
22169
  function renderPassthroughTry(state) {
21784
22170
  if (state.branch === 0 && state.block !== null) {
@@ -22281,10 +22667,10 @@ function takeInitialSuspenseHydration(state, hydration) {
22281
22667
  if (payload === void 0) {
22282
22668
  payload = {
22283
22669
  seedRaw: typeof stash?.[boundaryId] === "string" ? stash[boundaryId] : null,
22284
- nativeRaw: typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22670
+ nativeRaw: (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null) && typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22285
22671
  };
22286
22672
  (initialStreamedPayloads ??= /* @__PURE__ */ new WeakMap()).set(owner, payload);
22287
- if (stash !== void 0) {
22673
+ if (stash !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
22288
22674
  delete stash[boundaryId];
22289
22675
  delete stash[boundaryId + "$signals"];
22290
22676
  }
@@ -22321,7 +22707,8 @@ function takeInitialSuspenseHydration(state, hydration) {
22321
22707
  continue;
22322
22708
  if (attr === import_constants.SUSPENSE_RESOLVED_SEED_ATTR)
22323
22709
  seedRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22324
- else nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22710
+ else if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22711
+ nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22325
22712
  sidecars.push(script);
22326
22713
  cursor = getNextSibling(script);
22327
22714
  }
@@ -22362,6 +22749,8 @@ function renderInitialSuspenseHydration(state, initial) {
22362
22749
  hydration.claimRootRemainder(initial.end);
22363
22750
  hydration.protectRootAnchor(initial.end);
22364
22751
  const previousHydration = currentHydration;
22752
+ if (process.env.NODE_ENV !== "production")
22753
+ hydration.attributeBaselines = previousHydration?.attributeBaselines;
22365
22754
  if (previousHydration?.retryPresentation !== void 0)
22366
22755
  hydration.retryPresentation = previousHydration.retryPresentation;
22367
22756
  const previousCapture = WIP_CAPTURE;
@@ -22430,7 +22819,8 @@ function renderInitialSuspenseHydration(state, initial) {
22430
22819
  return;
22431
22820
  scheduleRender(state.parentBlock);
22432
22821
  };
22433
- suspended.then(resume, resume);
22822
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22823
+ suspended.then(resume, resume);
22434
22824
  return;
22435
22825
  }
22436
22826
  initialSuspenseHydrations?.delete(state);
@@ -22497,7 +22887,8 @@ function mountTry(state) {
22497
22887
  const raw = stash !== void 0 ? stash[streamedBoundaryId] : void 0;
22498
22888
  if (typeof raw === "string") scopedSeeds = hydration.parseSeeds(raw);
22499
22889
  const nativeRaw = stash?.[streamedBoundaryId + "$signals"];
22500
- if (typeof nativeRaw === "string") scopedNativeRaw = nativeRaw;
22890
+ if (typeof nativeRaw === "string" && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
22891
+ scopedNativeRaw = nativeRaw;
22501
22892
  adoptCursor = getNextSibling(adoptCursor);
22502
22893
  } else if (
22503
22894
  // A shell hydrated before its streamed segment swaps still has the
@@ -23449,6 +23840,7 @@ function flushStagedReveals() {
23449
23840
  }
23450
23841
  }
23451
23842
  function attachResume(state, thenable) {
23843
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
23452
23844
  if (state.pendingThenable === thenable) return;
23453
23845
  state.pendingThenable = thenable;
23454
23846
  const retry = () => {
@@ -24488,6 +24880,17 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
24488
24880
  }
24489
24881
  function ifBlock(parentScope, slotKey, domParent, cond, thenBody, elseBody, anchor, env) {
24490
24882
  let state = parentScope.slots[slotKey];
24883
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE && state?.returnedOutput === true) {
24884
+ if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
24885
+ if (state.__kind === "ifBlockSlot") {
24886
+ setReturnedOutputOwner(state, false);
24887
+ } else {
24888
+ const block = parentScope.block;
24889
+ block.outputHandler(block, null, true);
24890
+ if (block.disposed) return;
24891
+ state = void 0;
24892
+ }
24893
+ }
24491
24894
  if (state === void 0) {
24492
24895
  const hydration = activeHydration();
24493
24896
  let start = null;
@@ -24753,6 +25156,7 @@ function queueCurrentActivityRefs(activity) {
24753
25156
  }
24754
25157
  }
24755
25158
  function suspendHiddenActivity(state, thenable) {
25159
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
24756
25160
  if (state.pendingThenable === thenable) return;
24757
25161
  state.pendingThenable = thenable;
24758
25162
  const block = state.block;
@@ -24834,6 +25238,18 @@ function queueActivityDeactivation(state, block, commitVersion) {
24834
25238
  }
24835
25239
  function activityBlock(parentScope, slotKey, domParent, mode, body, anchor, env) {
24836
25240
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
25241
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE) {
25242
+ const state2 = parentScope.slots[0];
25243
+ if (state2?.returnedOutput === true) {
25244
+ if (state2.__kind === "activityBlockSlot") {
25245
+ setReturnedOutputOwner(state2, false);
25246
+ } else {
25247
+ const block = parentScope.block;
25248
+ block.outputHandler(block, null, true);
25249
+ if (block.disposed) return;
25250
+ }
25251
+ }
25252
+ }
24837
25253
  if (mode === "hidden") ensureScheduledVisibilityDriver();
24838
25254
  const parentBlock = parentScope.block;
24839
25255
  const hydration = activeHydration();
@@ -25090,6 +25506,17 @@ function deactivateScope(scope, disconnectPassive = true) {
25090
25506
  }
25091
25507
  function switchBlock(parentScope, slotKey, domParent, discriminant, cases, defaultBody, anchor, env) {
25092
25508
  let state = parentScope.slots[slotKey];
25509
+ if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE && state?.returnedOutput === true) {
25510
+ if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
25511
+ if (state.__kind === "switchBlockSlot") {
25512
+ setReturnedOutputOwner(state, false);
25513
+ } else {
25514
+ const block = parentScope.block;
25515
+ block.outputHandler(block, null, true);
25516
+ if (block.disposed) return;
25517
+ state = void 0;
25518
+ }
25519
+ }
25093
25520
  if (state === void 0) {
25094
25521
  const hydration = activeHydration();
25095
25522
  let start = null;
@@ -25479,7 +25906,8 @@ function fastMapSlot(scopeOrItems, slotOrMethod, domParent, items, method, nativ
25479
25906
  callback = native;
25480
25907
  native = mapSlot(items, method);
25481
25908
  }
25482
- const state = scopeOrItems.slots[slotOrMethod]?.forSlot;
25909
+ const slot = scopeOrItems.slots[slotOrMethod];
25910
+ const state = slot?.forSlot;
25483
25911
  const parent = native === true ? fastHostListParent(state, items, flags) : null;
25484
25912
  if (parent === null) {
25485
25913
  return mapSlot(
@@ -25498,6 +25926,9 @@ function fastMapSlot(scopeOrItems, slotOrMethod, domParent, items, method, nativ
25498
25926
  ownEnd
25499
25927
  );
25500
25928
  }
25929
+ if (slotOrMethod === 0 && scopeOrItems !== RETURNED_OUTPUT_SCOPE && slot.returnedOutput === true) {
25930
+ setReturnedOutputOwner(slot, false);
25931
+ }
25501
25932
  mountFastHostItems(
25502
25933
  scopeOrItems,
25503
25934
  state,
@@ -26415,6 +26846,10 @@ function moveFocusedNodeBefore(parent, node, anchor, snapshots) {
26415
26846
  moveBefore.call(parent, node, anchor);
26416
26847
  return;
26417
26848
  }
26849
+ if (STAGED_DOM.view(node).parentNode !== parent || anchor !== null && STAGED_DOM.view(anchor).parentNode !== parent) {
26850
+ STAGED_DOM.view(parent).insertBefore(node, anchor);
26851
+ return;
26852
+ }
26418
26853
  if (node === anchor || getNextSibling(node) === anchor) return;
26419
26854
  if (anchor === null || ((STAGED_DOM?.view(node) ?? node).compareDocumentPosition(anchor) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0) {
26420
26855
  let cursor = getNextSibling(node);
@@ -27740,6 +28175,7 @@ function applyHintAttrs(el, opts) {
27740
28175
  }
27741
28176
  }
27742
28177
  function preload(href, options) {
28178
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27743
28179
  if (process.env.NODE_ENV !== "production") {
27744
28180
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preload", href, options);
27745
28181
  if (warning !== null) console.error(warning);
@@ -27777,6 +28213,7 @@ function preload(href, options) {
27777
28213
  });
27778
28214
  }
27779
28215
  function preinit(href, options) {
28216
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27780
28217
  if (process.env.NODE_ENV !== "production") {
27781
28218
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preinit", href, options);
27782
28219
  if (warning !== null) console.error(warning);
@@ -27801,6 +28238,7 @@ function preinit(href, options) {
27801
28238
  }
27802
28239
  }
27803
28240
  function preconnect(href, options) {
28241
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27804
28242
  if (process.env.NODE_ENV !== "production") {
27805
28243
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preconnect", href, options);
27806
28244
  if (warning !== null) console.error(warning);
@@ -27822,6 +28260,7 @@ function preconnect(href, options) {
27822
28260
  });
27823
28261
  }
27824
28262
  function prefetchDNS(href) {
28263
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27825
28264
  if (process.env.NODE_ENV !== "production") {
27826
28265
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("prefetchDNS", href, arguments[1], arguments.length > 1);
27827
28266
  if (warning !== null) console.error(warning);
@@ -27837,6 +28276,7 @@ function prefetchDNS(href) {
27837
28276
  });
27838
28277
  }
27839
28278
  function preloadModule(href, options) {
28279
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27840
28280
  if (process.env.NODE_ENV !== "production") {
27841
28281
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preloadModule", href, options);
27842
28282
  if (warning !== null) console.error(warning);
@@ -27858,6 +28298,7 @@ function preloadModule(href, options) {
27858
28298
  });
27859
28299
  }
27860
28300
  function preinitModule(href, options) {
28301
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27861
28302
  if (process.env.NODE_ENV !== "production") {
27862
28303
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preinitModule", href, options);
27863
28304
  if (warning !== null) console.error(warning);
@@ -27966,6 +28407,7 @@ function warnInvalidStylesheetResource(reason) {
27966
28407
  );
27967
28408
  }
27968
28409
  function stylesheetResource(attrs, invalidReason) {
28410
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27969
28411
  if (process.env.NODE_ENV !== "production" && invalidReason !== void 0) {
27970
28412
  warnInvalidStylesheetResource(invalidReason);
27971
28413
  return;
@@ -27985,6 +28427,7 @@ function stylesheetResource(attrs, invalidReason) {
27985
28427
  state.sheets.add(href);
27986
28428
  }
27987
28429
  function styleResource(attrs, css, development) {
28430
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27988
28431
  if (typeof document === "undefined" || attrs == null) return;
27989
28432
  const href = attrs.href;
27990
28433
  if (typeof href !== "string" || href === "") return;
@@ -28015,6 +28458,7 @@ function resetFloatResourceState() {
28015
28458
  if (typeof window !== "undefined") delete window.$OCTFR;
28016
28459
  }
28017
28460
  function scriptResource(attrs) {
28461
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
28018
28462
  if (typeof document === "undefined" || attrs == null) return;
28019
28463
  const src = attrs.src;
28020
28464
  if (typeof src !== "string" || src === "") return;