octane 0.3.2 → 0.3.3

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;
@@ -7386,6 +7393,8 @@ function resolveSlot(slot) {
7386
7393
  return typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ ? (0, import_profiling.__profileResolveHook)(resolved, typeof slot === "symbol" ? slot : void 0) : resolved;
7387
7394
  }
7388
7395
  function nativeLocalHook(name, initialize, dispose, slot) {
7396
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null)
7397
+ throw new PresentationAdoptionMiss(void 0, false);
7389
7398
  slot = resolveSlot(slot);
7390
7399
  if (slot === void 0 || CURRENT_SCOPE === null) missingSlot(name);
7391
7400
  const scope = CURRENT_SCOPE;
@@ -8521,13 +8530,16 @@ function provideContext(scope, context, value) {
8521
8530
  if (had) values.set(context, previous);
8522
8531
  else values.delete(context);
8523
8532
  });
8524
- if (had) {
8533
+ if (had && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
8525
8534
  context.$$version++;
8526
8535
  (0, import_context_epoch.bumpContextEpoch)();
8527
8536
  }
8528
8537
  values.set(context, value);
8529
8538
  }
8530
8539
  const CHILDREN_BODY = /* @__PURE__ */ Symbol.for("octane.childrenBody");
8540
+ const CHILDREN_DIAGNOSTIC_CAPTURES = /* @__PURE__ */ Symbol.for(
8541
+ "octane.childrenDiagnosticCaptures"
8542
+ );
8531
8543
  function markSingleRoot(component) {
8532
8544
  component.$$singleRoot = true;
8533
8545
  return component;
@@ -8536,6 +8548,10 @@ function markChildrenBlock(fn, body) {
8536
8548
  if (typeof fn === "function") {
8537
8549
  fn[import_runtime_tags.CHILDREN_BLOCK_TAG] = true;
8538
8550
  if (body !== void 0) fn[CHILDREN_BODY] = body;
8551
+ if (process.env.NODE_ENV !== "production") {
8552
+ const captures = arguments[2];
8553
+ if (captures !== void 0) fn[CHILDREN_DIAGNOSTIC_CAPTURES] = captures;
8554
+ }
8539
8555
  }
8540
8556
  return fn;
8541
8557
  }
@@ -8685,6 +8701,233 @@ const HYDRATE_STREAM_SCAN_MASK = 1 | 128;
8685
8701
  let hydrateStreamWaitCleanups = null;
8686
8702
  let preservedHydrateActivations = null;
8687
8703
  let preservedHydrateActivationCount = 0;
8704
+ let initialHydrateAttributes = null;
8705
+ let hydrateAttributeProbe = null;
8706
+ function copyHydrateDiagnosticIds(ids) {
8707
+ const first = { prefix: ids.prefix, next: ids.next };
8708
+ let copy = first;
8709
+ while (true) {
8710
+ if (ids.limit !== void 0) copy.limit = ids.limit;
8711
+ if (ids.signalState !== void 0) copy.signalState = { ...ids.signalState };
8712
+ if (ids.overflow === void 0) return first;
8713
+ ids = ids.overflow;
8714
+ copy = copy.overflow = { prefix: ids.prefix, next: ids.next };
8715
+ }
8716
+ }
8717
+ function copyHydrateDiagnosticContexts(scope) {
8718
+ let contexts = null;
8719
+ const add = (values) => {
8720
+ if (values === null) return;
8721
+ for (const [context, value] of values) {
8722
+ contexts ??= /* @__PURE__ */ new Map();
8723
+ if (!contexts.has(context)) contexts.set(context, value);
8724
+ }
8725
+ };
8726
+ for (let current = scope; current !== null; current = current.parent)
8727
+ add(current.$$ctxValues);
8728
+ for (let block = scope.block.parentBlock; block !== null; block = block.parentBlock)
8729
+ add(block.$$ctxValues);
8730
+ return contexts;
8731
+ }
8732
+ function changedHydrateDiagnosticContexts(initial, next) {
8733
+ if ((initial?.size ?? 0) !== (next?.size ?? 0)) return true;
8734
+ if (initial !== null) {
8735
+ for (const [context, value] of initial) {
8736
+ if (next === null || !next.has(context) || !Object.is(value, next.get(context))) return true;
8737
+ }
8738
+ }
8739
+ return false;
8740
+ }
8741
+ function changedHydrateDiagnosticCaptures(initial, next) {
8742
+ if (initial.__data === void 0 || next.__data === void 0)
8743
+ return changedHydrateDiagnosticChildren(initial.children, next.children);
8744
+ if (initial.__data.length !== next.__data.length) return true;
8745
+ for (let i = 0; i < initial.__data.length; i++) {
8746
+ if (!Object.is(initial.__data[i], next.__data[i])) return true;
8747
+ }
8748
+ return false;
8749
+ }
8750
+ function changedHydrateDiagnosticChildren(initial, next) {
8751
+ if (initial === next) return false;
8752
+ if (typeof initial !== "function" || typeof next !== "function") return true;
8753
+ try {
8754
+ const body = initial[CHILDREN_BODY];
8755
+ const initialCaptures = initial[CHILDREN_DIAGNOSTIC_CAPTURES];
8756
+ const nextCaptures = next[CHILDREN_DIAGNOSTIC_CAPTURES];
8757
+ if (initialCaptures === void 0 && nextCaptures === void 0 && isChildrenBlock(initial) && isChildrenBlock(next))
8758
+ return false;
8759
+ if (body === void 0 || body !== next[CHILDREN_BODY] || initialCaptures == null || nextCaptures == null)
8760
+ return true;
8761
+ const before = initialCaptures();
8762
+ const after = nextCaptures();
8763
+ if (before.length !== after.length) return true;
8764
+ for (let i = 0; i < before.length; i++) {
8765
+ if (!Object.is(before[i], after[i])) return true;
8766
+ }
8767
+ return false;
8768
+ } catch {
8769
+ return true;
8770
+ }
8771
+ }
8772
+ function recordInitialHydrateAttribute(el, name, server, next) {
8773
+ const probe = hydrateAttributeProbe;
8774
+ const original = probe?.originals.get(el);
8775
+ if (original === void 0) return;
8776
+ let values = probe.attributes.get(original);
8777
+ if (values === void 0) probe.attributes.set(original, values = /* @__PURE__ */ new Map());
8778
+ const previous = values.get(name);
8779
+ values.set(name, {
8780
+ server: previous === void 0 ? server : previous.server,
8781
+ next,
8782
+ suppressed: isHydrationSuppressed(el),
8783
+ checked: false
8784
+ });
8785
+ }
8786
+ function checkInitialHydrateAttribute(hydration, el, name, server) {
8787
+ const initial = hydration.attributeBaselines?.attributes.get(el)?.get(name);
8788
+ if (initial === void 0) return false;
8789
+ if (initial.checked) return true;
8790
+ initial.checked = true;
8791
+ 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) {
8792
+ warnHydrationValueMismatch(
8793
+ el.__oct_loc,
8794
+ name === "style" ? "style" : `attribute \`${name}\``,
8795
+ name === "style" ? initial.server ?? "" : initial.server,
8796
+ name === "style" ? initial.next ?? "" : initial.next
8797
+ );
8798
+ }
8799
+ return true;
8800
+ }
8801
+ function probeInitialHydrateAttributes(state) {
8802
+ const snapshot = initialHydrateAttributes?.get(state);
8803
+ if (snapshot === void 0 || !changedHydrateDiagnosticCaptures(snapshot.props, state.props) && !changedHydrateDiagnosticContexts(
8804
+ snapshot.contexts,
8805
+ copyHydrateDiagnosticContexts(
8806
+ CURRENT_SCOPE?.block === state.parentBlock ? CURRENT_SCOPE : state.parentBlock
8807
+ )
8808
+ ))
8809
+ return;
8810
+ try {
8811
+ return collectInitialHydrateAttributes(state, snapshot);
8812
+ } catch {
8813
+ return;
8814
+ }
8815
+ }
8816
+ function collectInitialHydrateAttributes(state, snapshot) {
8817
+ const ownerDocument = document.implementation.createHTMLDocument("");
8818
+ const originalWrapper = state.wrapper;
8819
+ const source = STAGED_DOM?.view(originalWrapper) ?? originalWrapper;
8820
+ const template2 = ownerDocument.createElement("template");
8821
+ template2.innerHTML = source.outerHTML;
8822
+ const wrapper = ownerDocument.adoptNode(template2.content.firstElementChild);
8823
+ const probe = {
8824
+ document: ownerDocument,
8825
+ originals: /* @__PURE__ */ new WeakMap(),
8826
+ attributes: /* @__PURE__ */ new WeakMap(),
8827
+ boundaries: /* @__PURE__ */ new WeakMap()
8828
+ };
8829
+ probe.originals.set(wrapper, originalWrapper);
8830
+ const originals = source.querySelectorAll("*");
8831
+ const copies = wrapper.querySelectorAll("*");
8832
+ if (originals.length !== copies.length) return;
8833
+ for (let i = 0; i < originals.length; i++) {
8834
+ const original = originals[i];
8835
+ const copy = copies[i];
8836
+ if (copy.localName !== original.localName || copy.namespaceURI !== original.namespaceURI || probe.originals.get(copy.parentElement) !== (STAGED_DOM?.view(original) ?? original).parentElement)
8837
+ return;
8838
+ probe.originals.set(copy, original);
8839
+ }
8840
+ const start = wrapper.firstChild;
8841
+ if (start === null || !isBlockOpen(start)) return;
8842
+ const end = findMatchingClose(start, /* @__PURE__ */ new WeakMap());
8843
+ const initialChild = (_props, scope, extra) => {
8844
+ if (state.loadedBody !== null) state.loadedBody(snapshot.props.__data, scope, extra);
8845
+ else childrenAsBody(snapshot.props.children)(void 0, scope, extra);
8846
+ };
8847
+ const body = (_props, scope) => {
8848
+ tryBlock(scope, 0, wrapper, initialChild, null, null, end);
8849
+ };
8850
+ const block = createBlock("control-flow", null, wrapper, start, end, body, void 0);
8851
+ block.idState = copyHydrateDiagnosticIds(snapshot.ids);
8852
+ block.$$ctxValues = snapshot.contexts === null ? null : new Map(snapshot.contexts);
8853
+ const hydration = new HydrationCapability(block, start.nextSibling, null);
8854
+ if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
8855
+ hydration.protectRootAnchor(end);
8856
+ const capture = createOffscreenCapture();
8857
+ const previousHydration = currentHydration;
8858
+ const previousCapture = WIP_CAPTURE;
8859
+ const previousProbe = hydrateAttributeProbe;
8860
+ const previousTransaction = ROOT_RENDER_TRANSACTION;
8861
+ const previousJournal = TRANSITION_JOURNAL;
8862
+ const previousAttempt = ACTIVE_TRANSITION_ATTEMPT;
8863
+ const previousScopedReadTracking = SCOPED_READ_TRACKING;
8864
+ const previousScopedReads = SCOPED_READS;
8865
+ const previousWarm = CURRENT_WARM;
8866
+ const previousWarmClaims = CURRENT_WARM_CLAIMS;
8867
+ const previousWarmEpisode = CURRENT_WARM_EPISODE;
8868
+ const previousWarmPlans = ACTIVE_WARM_PLANS.splice(0);
8869
+ const previousStagedDom = STAGED_DOM;
8870
+ const previousStagedCapture = STAGED_COMMIT_CAPTURE;
8871
+ const previousPresentation = PRESENTATION_HYDRATION;
8872
+ const previousSelectSyncs = SELECT_SYNCS;
8873
+ const previousSelectDefaultSyncs = SELECT_DEFAULT_SYNCS;
8874
+ const previousFormChecks = DEV_FORM_CHECKS;
8875
+ const previousAutofocus = AUTOFOCUS_QUEUE;
8876
+ const previousNative = (0, import_read_protocol.setNativeAdoptionResolver)(null);
8877
+ const refDetachCheckpoint = refDetachQueue.length;
8878
+ currentHydration = hydration;
8879
+ WIP_CAPTURE = capture;
8880
+ hydrateAttributeProbe = probe;
8881
+ ROOT_RENDER_TRANSACTION = null;
8882
+ TRANSITION_JOURNAL = null;
8883
+ ACTIVE_TRANSITION_ATTEMPT = null;
8884
+ SCOPED_READ_TRACKING = false;
8885
+ SCOPED_READS = null;
8886
+ CURRENT_WARM = null;
8887
+ CURRENT_WARM_CLAIMS = null;
8888
+ CURRENT_WARM_EPISODE = 0;
8889
+ STAGED_DOM = null;
8890
+ STAGED_COMMIT_CAPTURE = null;
8891
+ PRESENTATION_HYDRATION = null;
8892
+ SELECT_SYNCS = [];
8893
+ SELECT_DEFAULT_SYNCS = [];
8894
+ DEV_FORM_CHECKS = [];
8895
+ AUTOFOCUS_QUEUE = [];
8896
+ try {
8897
+ renderBlock(block);
8898
+ drainHydrationRenderPhaseUpdates(block);
8899
+ hydration.flushClassWrites();
8900
+ } catch {
8901
+ } finally {
8902
+ try {
8903
+ disposeWip({ block, start, end, capture, domParent: wrapper, refDetachCheckpoint });
8904
+ drainHydrationRenderPhaseUpdates(block);
8905
+ } finally {
8906
+ (0, import_read_protocol.setNativeAdoptionResolver)(previousNative);
8907
+ currentHydration = previousHydration;
8908
+ WIP_CAPTURE = previousCapture;
8909
+ hydrateAttributeProbe = previousProbe;
8910
+ ROOT_RENDER_TRANSACTION = previousTransaction;
8911
+ TRANSITION_JOURNAL = previousJournal;
8912
+ ACTIVE_TRANSITION_ATTEMPT = previousAttempt;
8913
+ SCOPED_READ_TRACKING = previousScopedReadTracking;
8914
+ SCOPED_READS = previousScopedReads;
8915
+ CURRENT_WARM = previousWarm;
8916
+ CURRENT_WARM_CLAIMS = previousWarmClaims;
8917
+ CURRENT_WARM_EPISODE = previousWarmEpisode;
8918
+ ACTIVE_WARM_PLANS.length = 0;
8919
+ ACTIVE_WARM_PLANS.push(...previousWarmPlans);
8920
+ STAGED_DOM = previousStagedDom;
8921
+ STAGED_COMMIT_CAPTURE = previousStagedCapture;
8922
+ PRESENTATION_HYDRATION = previousPresentation;
8923
+ SELECT_SYNCS = previousSelectSyncs;
8924
+ SELECT_DEFAULT_SYNCS = previousSelectDefaultSyncs;
8925
+ DEV_FORM_CHECKS = previousFormChecks;
8926
+ AUTOFOCUS_QUEUE = previousAutofocus;
8927
+ }
8928
+ }
8929
+ return probe;
8930
+ }
8688
8931
  function releasePreservedHydrateActivation(state) {
8689
8932
  if (preservedHydrateActivations?.delete(state)) preservedHydrateActivationCount--;
8690
8933
  }
@@ -8867,6 +9110,7 @@ function createHydrateBoundaryBody(state, renderChild, pendingBody) {
8867
9110
  }
8868
9111
  function failHydrateBoundary(state, error) {
8869
9112
  if (state.hasError || state.block.disposed) return;
9113
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8870
9114
  cleanupHydrateStreamWait(state);
8871
9115
  state.hasError = true;
8872
9116
  state.error = error;
@@ -8984,6 +9228,7 @@ function teardownHydrateBoundary(state) {
8984
9228
  }
8985
9229
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => teardownHydrateBoundary(state), true) === true)
8986
9230
  return;
9231
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8987
9232
  cleanupHydrateInstallers(state);
8988
9233
  cleanupHydrateStreamWait(state);
8989
9234
  if (preserved !== void 0) {
@@ -9363,10 +9608,22 @@ function createHydrateSlot(props, scope, boundaryId, boundaryBody) {
9363
9608
  independent: props.__independent !== void 0
9364
9609
  };
9365
9610
  if (nativeSeedRaw !== null) state.nativeSeedRaw = nativeSeedRaw;
9611
+ if (process.env.NODE_ENV !== "production" && serverPreserved && !state.independent) {
9612
+ const original = hydrateAttributeProbe?.originals.get(wrapper);
9613
+ const inherited = hydration?.attributeBaselines?.boundaries.get(wrapper);
9614
+ const snapshot = inherited ?? {
9615
+ props,
9616
+ ids: copyHydrateDiagnosticIds(idState),
9617
+ contexts: copyHydrateDiagnosticContexts(scope)
9618
+ };
9619
+ (initialHydrateAttributes ??= /* @__PURE__ */ new WeakMap()).set(state, snapshot);
9620
+ if (original !== void 0) hydrateAttributeProbe.boundaries.set(original, snapshot);
9621
+ }
9366
9622
  scope.slots[0] = state;
9367
9623
  registerSlot(scope, state);
9368
9624
  if (!state.independent) (0, import_event_capture.registerHydrationIntentBoundary)(wrapper, intentBoundary);
9369
9625
  block.body = boundaryBody(state);
9626
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return state;
9370
9627
  const initialStrategy = resolveHydrateStrategy(state);
9371
9628
  const pendingIntents = state.independent ? void 0 : (0, import_event_capture.takePendingHydrationIntents)(wrapper);
9372
9629
  if (state.independent) {
@@ -9394,6 +9651,8 @@ function activateHydrateBoundary(state) {
9394
9651
  }
9395
9652
  const hydration = preserved?.hydration ?? new HydrationCapability(block, getNextSibling(state.start), null);
9396
9653
  if (preserved === void 0) {
9654
+ if (process.env.NODE_ENV !== "production")
9655
+ hydration.attributeBaselines = probeInitialHydrateAttributes(state);
9397
9656
  if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
9398
9657
  hydration.protectRootAnchor(state.end);
9399
9658
  }
@@ -9468,6 +9727,7 @@ function activateHydrateBoundary(state) {
9468
9727
  if (nativeRecovery !== void 0) {
9469
9728
  noteRecoverableHydrationError(() => nativeRecovery, block);
9470
9729
  state.serverPreserved = false;
9730
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9471
9731
  state.serverActivationStarted = false;
9472
9732
  state.seedRaw = null;
9473
9733
  state.nativeSeedRaw = void 0;
@@ -9498,6 +9758,7 @@ function activateHydrateBoundary(state) {
9498
9758
  return;
9499
9759
  }
9500
9760
  if (completed) {
9761
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9501
9762
  releasePreservedHydrateActivation(state);
9502
9763
  spliceOffscreenCapture(capture);
9503
9764
  }
@@ -9607,6 +9868,7 @@ function notifyHydrateBoundary(state, scope) {
9607
9868
  return;
9608
9869
  }
9609
9870
  state.didNotify = true;
9871
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9610
9872
  cleanupHydrateInstallers(state);
9611
9873
  state.props.onHydrated?.();
9612
9874
  domNode(state.wrapper).removeAttribute(import_constants.HYDRATE_WHEN_ATTR);
@@ -11535,13 +11797,20 @@ class HydrationCapability {
11535
11797
  ns,
11536
11798
  name.indexOf(":") >= 0 ? name.slice(name.indexOf(":") + 1) : name
11537
11799
  ) : (STAGED_DOM?.view(el) ?? el).getAttribute(name);
11800
+ if (process.env.NODE_ENV !== "production") {
11801
+ if (hydrateAttributeProbe !== null) {
11802
+ recordInitialHydrateAttribute(el, name, server, next);
11803
+ } else {
11804
+ checkInitialHydrateAttribute(this, el, name, server);
11805
+ }
11806
+ }
11538
11807
  if (server === next) return false;
11539
11808
  if (import_dom_binding_claims.domBindingClaims.get(el)?.get(name) === server) return false;
11540
11809
  if (next !== null && isAttributeParserNormalizedMatch(server, next)) return false;
11541
11810
  const mode = hydrationMismatchMode(el);
11542
11811
  if (mode === 0) return true;
11543
11812
  if (mode === 1) return false;
11544
- if (process.env.NODE_ENV !== "production")
11813
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, name, server))
11545
11814
  warnHydrationValueMismatch(el.__oct_loc, `attribute \`${name}\``, server, next);
11546
11815
  return true;
11547
11816
  }
@@ -11549,11 +11818,15 @@ class HydrationCapability {
11549
11818
  const mode = hydrationMismatchMode(el);
11550
11819
  const rawServer = (STAGED_DOM?.view(el) ?? el).getAttribute("class");
11551
11820
  const server = absentIsEmpty && rawServer === null ? "" : rawServer;
11821
+ if (process.env.NODE_ENV !== "production") {
11822
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "class", server, next);
11823
+ else checkInitialHydrateAttribute(this, el, "class", rawServer);
11824
+ }
11552
11825
  if (server === next) return true;
11553
11826
  if (import_dom_binding_claims.domBindingClaims.get(el)?.get("class") === rawServer) return false;
11554
11827
  if (mode === 0) return true;
11555
11828
  if (mode === 1) return false;
11556
- if (process.env.NODE_ENV !== "production")
11829
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "class", rawServer))
11557
11830
  warnHydrationValueMismatch(el.__oct_loc, "attribute `class`", server, next);
11558
11831
  return true;
11559
11832
  }
@@ -11564,7 +11837,11 @@ class HydrationCapability {
11564
11837
  try {
11565
11838
  for (const [el, write] of this.classWrites) {
11566
11839
  const rawTarget = write.remove ? null : write.next;
11567
- if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) continue;
11840
+ if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) {
11841
+ if (process.env.NODE_ENV !== "production")
11842
+ this.allowClass(el, write.next, write.absentIsEmpty);
11843
+ continue;
11844
+ }
11568
11845
  if (!this.allowClass(el, write.next, write.absentIsEmpty)) continue;
11569
11846
  if (write.remove) (STAGED_DOM?.view(el) ?? el).removeAttribute("class");
11570
11847
  else if (write.useAttribute)
@@ -11577,7 +11854,21 @@ class HydrationCapability {
11577
11854
  }
11578
11855
  applyStyle(el, value, _prev, staticCss, entries) {
11579
11856
  const mode = hydrationMismatchMode(el);
11580
- if (mode === 1) return true;
11857
+ if (mode === 1) {
11858
+ if (process.env.NODE_ENV !== "production") {
11859
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "style", null, null);
11860
+ else {
11861
+ const current = STAGED_DOM?.view(el) ?? el;
11862
+ checkInitialHydrateAttribute(
11863
+ this,
11864
+ el,
11865
+ "style",
11866
+ current.hasAttribute("style") ? current.style.cssText : null
11867
+ );
11868
+ }
11869
+ }
11870
+ return true;
11871
+ }
11581
11872
  const style = (STAGED_DOM?.view(el) ?? el).style;
11582
11873
  const hadStyleAttribute = (STAGED_DOM?.view(el) ?? el).hasAttribute("style");
11583
11874
  const before = style.cssText;
@@ -11593,7 +11884,11 @@ class HydrationCapability {
11593
11884
  applyStyleProperty(el, expectedStyle, entries[i], entry);
11594
11885
  }
11595
11886
  }
11596
- const claims = import_dom_binding_claims.domBindingClaims.get(el);
11887
+ let claims = import_dom_binding_claims.domBindingClaims.get(el);
11888
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) {
11889
+ const original = hydrateAttributeProbe.originals.get(el);
11890
+ if (original !== void 0) claims = import_dom_binding_claims.domBindingClaims.get(original);
11891
+ }
11597
11892
  if (claims !== void 0) {
11598
11893
  for (const [channel, published] of claims) {
11599
11894
  if (!channel.startsWith("style:")) continue;
@@ -11607,10 +11902,20 @@ class HydrationCapability {
11607
11902
  }
11608
11903
  const expected = expectedStyle.cssText;
11609
11904
  const expectsStyleAttribute = expected !== "";
11905
+ if (process.env.NODE_ENV !== "production") {
11906
+ if (hydrateAttributeProbe !== null)
11907
+ recordInitialHydrateAttribute(
11908
+ el,
11909
+ "style",
11910
+ hadStyleAttribute ? before : null,
11911
+ expectsStyleAttribute ? expected : null
11912
+ );
11913
+ else checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null);
11914
+ }
11610
11915
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
11611
11916
  if (expectsStyleAttribute) style.cssText = expected;
11612
11917
  else (STAGED_DOM?.view(el) ?? el).removeAttribute("style");
11613
- if (mode === 2 && process.env.NODE_ENV !== "production") {
11918
+ if (mode === 2 && process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null)) {
11614
11919
  warnHydrationValueMismatch(el.__oct_loc, "style", before, expected);
11615
11920
  }
11616
11921
  return true;
@@ -12876,6 +13181,8 @@ function bindDirectSignal(scope, previous, target, value, site, policy, name, at
12876
13181
  const kind = policy.kind;
12877
13182
  const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_BINDING] === true ? previous : null;
12878
13183
  const handle = isSignalHandle(value) ? value : null;
13184
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && handle !== null)
13185
+ throw new PresentationAdoptionMiss(void 0, false);
12879
13186
  if (handle !== null && (!import_document_owner.signalDocumentEnabled || (0, import_owner_context.currentSignalOwner)() !== SCOPE_SIGNAL_OWNERS.get(scope))) {
12880
13187
  if (!import_document_owner.signalDocumentEnabled) enableSignalBindings();
12881
13188
  return runWithBlockSignalOwner(
@@ -15190,6 +15497,7 @@ function namespaceHeadElement(headKey, tag, attrs, text, authoredKey) {
15190
15497
  return createElement(namespaceHead, config);
15191
15498
  }
15192
15499
  function injectStyle(id, css, nonce) {
15500
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
15193
15501
  if (typeof document === "undefined") {
15194
15502
  _injectedStyles.add(id);
15195
15503
  return;
@@ -17403,6 +17711,8 @@ function registerValuePortalFragmentOwners(portal2, parentBlock, anchor) {
17403
17711
  }
17404
17712
  }
17405
17713
  function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, env, key = null) {
17714
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && target.ownerDocument !== hydrateAttributeProbe.document)
17715
+ target = hydrateAttributeProbe.document.createDocumentFragment();
17406
17716
  const hydration = activeHydration();
17407
17717
  if (hydration !== null) {
17408
17718
  return hydration.suspend(
@@ -21379,7 +21689,8 @@ function hmr(fn) {
21379
21689
  }
21380
21690
  };
21381
21691
  function wrapper(props, scope, extra) {
21382
- if (scope !== void 0) meta.liveBlocks.add(scope.block);
21692
+ if (scope !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
21693
+ meta.liveBlocks.add(scope.block);
21383
21694
  return meta.fn(props, scope, extra);
21384
21695
  }
21385
21696
  Object.defineProperty(wrapper, HMR, {
@@ -21778,7 +22089,8 @@ function mountPassthroughPending(state, thenable) {
21778
22089
  setTryBranch(state, -1);
21779
22090
  scheduleRender(state.parentBlock);
21780
22091
  };
21781
- thenable.then(retry, retry);
22092
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22093
+ thenable.then(retry, retry);
21782
22094
  }
21783
22095
  function renderPassthroughTry(state) {
21784
22096
  if (state.branch === 0 && state.block !== null) {
@@ -22281,10 +22593,10 @@ function takeInitialSuspenseHydration(state, hydration) {
22281
22593
  if (payload === void 0) {
22282
22594
  payload = {
22283
22595
  seedRaw: typeof stash?.[boundaryId] === "string" ? stash[boundaryId] : null,
22284
- nativeRaw: typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22596
+ nativeRaw: (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null) && typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22285
22597
  };
22286
22598
  (initialStreamedPayloads ??= /* @__PURE__ */ new WeakMap()).set(owner, payload);
22287
- if (stash !== void 0) {
22599
+ if (stash !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
22288
22600
  delete stash[boundaryId];
22289
22601
  delete stash[boundaryId + "$signals"];
22290
22602
  }
@@ -22321,7 +22633,8 @@ function takeInitialSuspenseHydration(state, hydration) {
22321
22633
  continue;
22322
22634
  if (attr === import_constants.SUSPENSE_RESOLVED_SEED_ATTR)
22323
22635
  seedRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22324
- else nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22636
+ else if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22637
+ nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22325
22638
  sidecars.push(script);
22326
22639
  cursor = getNextSibling(script);
22327
22640
  }
@@ -22362,6 +22675,8 @@ function renderInitialSuspenseHydration(state, initial) {
22362
22675
  hydration.claimRootRemainder(initial.end);
22363
22676
  hydration.protectRootAnchor(initial.end);
22364
22677
  const previousHydration = currentHydration;
22678
+ if (process.env.NODE_ENV !== "production")
22679
+ hydration.attributeBaselines = previousHydration?.attributeBaselines;
22365
22680
  if (previousHydration?.retryPresentation !== void 0)
22366
22681
  hydration.retryPresentation = previousHydration.retryPresentation;
22367
22682
  const previousCapture = WIP_CAPTURE;
@@ -22430,7 +22745,8 @@ function renderInitialSuspenseHydration(state, initial) {
22430
22745
  return;
22431
22746
  scheduleRender(state.parentBlock);
22432
22747
  };
22433
- suspended.then(resume, resume);
22748
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22749
+ suspended.then(resume, resume);
22434
22750
  return;
22435
22751
  }
22436
22752
  initialSuspenseHydrations?.delete(state);
@@ -22497,7 +22813,8 @@ function mountTry(state) {
22497
22813
  const raw = stash !== void 0 ? stash[streamedBoundaryId] : void 0;
22498
22814
  if (typeof raw === "string") scopedSeeds = hydration.parseSeeds(raw);
22499
22815
  const nativeRaw = stash?.[streamedBoundaryId + "$signals"];
22500
- if (typeof nativeRaw === "string") scopedNativeRaw = nativeRaw;
22816
+ if (typeof nativeRaw === "string" && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
22817
+ scopedNativeRaw = nativeRaw;
22501
22818
  adoptCursor = getNextSibling(adoptCursor);
22502
22819
  } else if (
22503
22820
  // A shell hydrated before its streamed segment swaps still has the
@@ -23449,6 +23766,7 @@ function flushStagedReveals() {
23449
23766
  }
23450
23767
  }
23451
23768
  function attachResume(state, thenable) {
23769
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
23452
23770
  if (state.pendingThenable === thenable) return;
23453
23771
  state.pendingThenable = thenable;
23454
23772
  const retry = () => {
@@ -24753,6 +25071,7 @@ function queueCurrentActivityRefs(activity) {
24753
25071
  }
24754
25072
  }
24755
25073
  function suspendHiddenActivity(state, thenable) {
25074
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
24756
25075
  if (state.pendingThenable === thenable) return;
24757
25076
  state.pendingThenable = thenable;
24758
25077
  const block = state.block;
@@ -27740,6 +28059,7 @@ function applyHintAttrs(el, opts) {
27740
28059
  }
27741
28060
  }
27742
28061
  function preload(href, options) {
28062
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27743
28063
  if (process.env.NODE_ENV !== "production") {
27744
28064
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preload", href, options);
27745
28065
  if (warning !== null) console.error(warning);
@@ -27777,6 +28097,7 @@ function preload(href, options) {
27777
28097
  });
27778
28098
  }
27779
28099
  function preinit(href, options) {
28100
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27780
28101
  if (process.env.NODE_ENV !== "production") {
27781
28102
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preinit", href, options);
27782
28103
  if (warning !== null) console.error(warning);
@@ -27801,6 +28122,7 @@ function preinit(href, options) {
27801
28122
  }
27802
28123
  }
27803
28124
  function preconnect(href, options) {
28125
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27804
28126
  if (process.env.NODE_ENV !== "production") {
27805
28127
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preconnect", href, options);
27806
28128
  if (warning !== null) console.error(warning);
@@ -27822,6 +28144,7 @@ function preconnect(href, options) {
27822
28144
  });
27823
28145
  }
27824
28146
  function prefetchDNS(href) {
28147
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27825
28148
  if (process.env.NODE_ENV !== "production") {
27826
28149
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("prefetchDNS", href, arguments[1], arguments.length > 1);
27827
28150
  if (warning !== null) console.error(warning);
@@ -27837,6 +28160,7 @@ function prefetchDNS(href) {
27837
28160
  });
27838
28161
  }
27839
28162
  function preloadModule(href, options) {
28163
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27840
28164
  if (process.env.NODE_ENV !== "production") {
27841
28165
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preloadModule", href, options);
27842
28166
  if (warning !== null) console.error(warning);
@@ -27858,6 +28182,7 @@ function preloadModule(href, options) {
27858
28182
  });
27859
28183
  }
27860
28184
  function preinitModule(href, options) {
28185
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27861
28186
  if (process.env.NODE_ENV !== "production") {
27862
28187
  const warning = (0, import_resource_hint_diagnostics.resourceHintWarning)("preinitModule", href, options);
27863
28188
  if (warning !== null) console.error(warning);
@@ -27966,6 +28291,7 @@ function warnInvalidStylesheetResource(reason) {
27966
28291
  );
27967
28292
  }
27968
28293
  function stylesheetResource(attrs, invalidReason) {
28294
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27969
28295
  if (process.env.NODE_ENV !== "production" && invalidReason !== void 0) {
27970
28296
  warnInvalidStylesheetResource(invalidReason);
27971
28297
  return;
@@ -27985,6 +28311,7 @@ function stylesheetResource(attrs, invalidReason) {
27985
28311
  state.sheets.add(href);
27986
28312
  }
27987
28313
  function styleResource(attrs, css, development) {
28314
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27988
28315
  if (typeof document === "undefined" || attrs == null) return;
27989
28316
  const href = attrs.href;
27990
28317
  if (typeof href !== "string" || href === "") return;
@@ -28015,6 +28342,7 @@ function resetFloatResourceState() {
28015
28342
  if (typeof window !== "undefined") delete window.$OCTFR;
28016
28343
  }
28017
28344
  function scriptResource(attrs) {
28345
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
28018
28346
  if (typeof document === "undefined" || attrs == null) return;
28019
28347
  const src = attrs.src;
28020
28348
  if (typeof src !== "string" || src === "") return;