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.
package/dist/runtime.js CHANGED
@@ -544,7 +544,8 @@ function scopeSignalOwner(scope) {
544
544
  }
545
545
  function runWithBlockSignalOwner(scope, callback) {
546
546
  const owner = scopeSignalOwner(scope);
547
- if (owner !== void 0) STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
547
+ if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
548
+ STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
548
549
  return owner === void 0 || currentSignalOwner() === owner ? callback() : runWithSignalOwner(owner, callback);
549
550
  }
550
551
  import { readNativeDomStyle as readNativeDomStyle2, readNativeDomProps } from "./signals/read-protocol.js";
@@ -639,6 +640,8 @@ function nativeProjectionBinding(owner, slotIndex, el, compute, fields) {
639
640
  nativePresentationBinding(owner, slotIndex, el, nativeProjectionBody, { el, compute, fields });
640
641
  }
641
642
  function nativePresentationBinding(owner, slotIndex, el, body, props) {
643
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && el.ownerDocument !== hydrateAttributeProbe.document)
644
+ throw new PresentationAdoptionMiss(void 0, false);
642
645
  let binding = owner.slots[slotIndex];
643
646
  if (binding === void 0) {
644
647
  const block = createBlock("control-flow", owner.block, el, null, null, body, props);
@@ -670,6 +673,8 @@ function enableNativeReadCollection(abi = 1) {
670
673
  ensureNativeReadDriver();
671
674
  }
672
675
  function beginNativeReadScope(scope, abi = 1) {
676
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null)
677
+ throw new PresentationAdoptionMiss(void 0, false);
673
678
  if (abi !== 1) throw new Error(formatClientError(58));
674
679
  const block = CURRENT_BLOCK;
675
680
  const owner = scope ?? CURRENT_SCOPE;
@@ -677,6 +682,7 @@ function beginNativeReadScope(scope, abi = 1) {
677
682
  return ensureNativeReadDriver().beginScope(owner, block);
678
683
  }
679
684
  function beginActiveNativeReadScope(scope) {
685
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return -1;
680
686
  const block = CURRENT_BLOCK;
681
687
  return block === null ? -1 : NATIVE_READ_DRIVER.beginScope(scope, block);
682
688
  }
@@ -911,13 +917,13 @@ function hydrationMismatchMode(el) {
911
917
  }
912
918
  function warnHydrationValueMismatch(loc, what, serverVal, clientVal) {
913
919
  if (process.env.NODE_ENV === "production") return;
914
- if (!loc) return;
920
+ if (!loc || hydrateAttributeProbe !== null) return;
915
921
  console.error(
916
922
  `Octane hydration mismatch at ${loc}: server rendered ${what} ${JSON.stringify(serverVal)} but the client rendered ${JSON.stringify(clientVal)}. The client value was used. If this difference is intentional (e.g. a timestamp or random id), add suppressHydrationWarning to the element.`
917
923
  );
918
924
  }
919
925
  function warnHydrationKeptServerValue(loc, what, serverVal, clientVal) {
920
- if (process.env.NODE_ENV === "production" || !loc) return;
926
+ if (process.env.NODE_ENV === "production" || !loc || hydrateAttributeProbe !== null) return;
921
927
  console.error(
922
928
  `Octane hydration mismatch at ${loc}: server rendered ${what} ${JSON.stringify(serverVal)} but the client rendered ${JSON.stringify(clientVal)}. The server value was kept. If this difference is intentional, add suppressHydrationWarning to the element.`
923
929
  );
@@ -936,7 +942,7 @@ function describeHydrationNode(node) {
936
942
  }
937
943
  function warnHydrationStructuralMismatch(loc, expected, actual) {
938
944
  if (process.env.NODE_ENV === "production") return;
939
- if (!loc) return;
945
+ if (!loc || hydrateAttributeProbe !== null) return;
940
946
  console.error(
941
947
  `Octane hydration mismatch at ${loc}: the client expected ${expected} but the server rendered ${actual}. The mismatched subtree was rebuilt on the client.`
942
948
  );
@@ -6426,7 +6432,8 @@ function captureRenderPhaseUpdate(cell, key) {
6426
6432
  function renderBlock(block) {
6427
6433
  if (signalDocumentEnabled || block.idState.renderOwner?.signalOwner !== void 0) {
6428
6434
  const owner = scopeSignalOwner(block);
6429
- if (owner !== void 0) STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
6435
+ if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
6436
+ STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
6430
6437
  if (owner !== void 0 && currentSignalOwner() !== owner) {
6431
6438
  runWithSignalOwner(owner, () => renderBlock(block));
6432
6439
  return;
@@ -7239,6 +7246,8 @@ function resolveSlot(slot) {
7239
7246
  return typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ ? __profileResolveHook(resolved, typeof slot === "symbol" ? slot : void 0) : resolved;
7240
7247
  }
7241
7248
  function nativeLocalHook(name, initialize, dispose, slot) {
7249
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null)
7250
+ throw new PresentationAdoptionMiss(void 0, false);
7242
7251
  slot = resolveSlot(slot);
7243
7252
  if (slot === void 0 || CURRENT_SCOPE === null) missingSlot(name);
7244
7253
  const scope = CURRENT_SCOPE;
@@ -8374,13 +8383,16 @@ function provideContext(scope, context, value) {
8374
8383
  if (had) values.set(context, previous);
8375
8384
  else values.delete(context);
8376
8385
  });
8377
- if (had) {
8386
+ if (had && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
8378
8387
  context.$$version++;
8379
8388
  bumpContextEpoch();
8380
8389
  }
8381
8390
  values.set(context, value);
8382
8391
  }
8383
8392
  const CHILDREN_BODY = /* @__PURE__ */ Symbol.for("octane.childrenBody");
8393
+ const CHILDREN_DIAGNOSTIC_CAPTURES = /* @__PURE__ */ Symbol.for(
8394
+ "octane.childrenDiagnosticCaptures"
8395
+ );
8384
8396
  function markSingleRoot(component) {
8385
8397
  component.$$singleRoot = true;
8386
8398
  return component;
@@ -8389,6 +8401,10 @@ function markChildrenBlock(fn, body) {
8389
8401
  if (typeof fn === "function") {
8390
8402
  fn[CHILDREN_BLOCK] = true;
8391
8403
  if (body !== void 0) fn[CHILDREN_BODY] = body;
8404
+ if (process.env.NODE_ENV !== "production") {
8405
+ const captures = arguments[2];
8406
+ if (captures !== void 0) fn[CHILDREN_DIAGNOSTIC_CAPTURES] = captures;
8407
+ }
8392
8408
  }
8393
8409
  return fn;
8394
8410
  }
@@ -8538,6 +8554,233 @@ const HYDRATE_STREAM_SCAN_MASK = 1 | 128;
8538
8554
  let hydrateStreamWaitCleanups = null;
8539
8555
  let preservedHydrateActivations = null;
8540
8556
  let preservedHydrateActivationCount = 0;
8557
+ let initialHydrateAttributes = null;
8558
+ let hydrateAttributeProbe = null;
8559
+ function copyHydrateDiagnosticIds(ids) {
8560
+ const first = { prefix: ids.prefix, next: ids.next };
8561
+ let copy = first;
8562
+ while (true) {
8563
+ if (ids.limit !== void 0) copy.limit = ids.limit;
8564
+ if (ids.signalState !== void 0) copy.signalState = { ...ids.signalState };
8565
+ if (ids.overflow === void 0) return first;
8566
+ ids = ids.overflow;
8567
+ copy = copy.overflow = { prefix: ids.prefix, next: ids.next };
8568
+ }
8569
+ }
8570
+ function copyHydrateDiagnosticContexts(scope) {
8571
+ let contexts = null;
8572
+ const add = (values) => {
8573
+ if (values === null) return;
8574
+ for (const [context, value] of values) {
8575
+ contexts ??= /* @__PURE__ */ new Map();
8576
+ if (!contexts.has(context)) contexts.set(context, value);
8577
+ }
8578
+ };
8579
+ for (let current = scope; current !== null; current = current.parent)
8580
+ add(current.$$ctxValues);
8581
+ for (let block = scope.block.parentBlock; block !== null; block = block.parentBlock)
8582
+ add(block.$$ctxValues);
8583
+ return contexts;
8584
+ }
8585
+ function changedHydrateDiagnosticContexts(initial, next) {
8586
+ if ((initial?.size ?? 0) !== (next?.size ?? 0)) return true;
8587
+ if (initial !== null) {
8588
+ for (const [context, value] of initial) {
8589
+ if (next === null || !next.has(context) || !Object.is(value, next.get(context))) return true;
8590
+ }
8591
+ }
8592
+ return false;
8593
+ }
8594
+ function changedHydrateDiagnosticCaptures(initial, next) {
8595
+ if (initial.__data === void 0 || next.__data === void 0)
8596
+ return changedHydrateDiagnosticChildren(initial.children, next.children);
8597
+ if (initial.__data.length !== next.__data.length) return true;
8598
+ for (let i = 0; i < initial.__data.length; i++) {
8599
+ if (!Object.is(initial.__data[i], next.__data[i])) return true;
8600
+ }
8601
+ return false;
8602
+ }
8603
+ function changedHydrateDiagnosticChildren(initial, next) {
8604
+ if (initial === next) return false;
8605
+ if (typeof initial !== "function" || typeof next !== "function") return true;
8606
+ try {
8607
+ const body = initial[CHILDREN_BODY];
8608
+ const initialCaptures = initial[CHILDREN_DIAGNOSTIC_CAPTURES];
8609
+ const nextCaptures = next[CHILDREN_DIAGNOSTIC_CAPTURES];
8610
+ if (initialCaptures === void 0 && nextCaptures === void 0 && isChildrenBlock(initial) && isChildrenBlock(next))
8611
+ return false;
8612
+ if (body === void 0 || body !== next[CHILDREN_BODY] || initialCaptures == null || nextCaptures == null)
8613
+ return true;
8614
+ const before = initialCaptures();
8615
+ const after = nextCaptures();
8616
+ if (before.length !== after.length) return true;
8617
+ for (let i = 0; i < before.length; i++) {
8618
+ if (!Object.is(before[i], after[i])) return true;
8619
+ }
8620
+ return false;
8621
+ } catch {
8622
+ return true;
8623
+ }
8624
+ }
8625
+ function recordInitialHydrateAttribute(el, name, server, next) {
8626
+ const probe = hydrateAttributeProbe;
8627
+ const original = probe?.originals.get(el);
8628
+ if (original === void 0) return;
8629
+ let values = probe.attributes.get(original);
8630
+ if (values === void 0) probe.attributes.set(original, values = /* @__PURE__ */ new Map());
8631
+ const previous = values.get(name);
8632
+ values.set(name, {
8633
+ server: previous === void 0 ? server : previous.server,
8634
+ next,
8635
+ suppressed: isHydrationSuppressed(el),
8636
+ checked: false
8637
+ });
8638
+ }
8639
+ function checkInitialHydrateAttribute(hydration, el, name, server) {
8640
+ const initial = hydration.attributeBaselines?.attributes.get(el)?.get(name);
8641
+ if (initial === void 0) return false;
8642
+ if (initial.checked) return true;
8643
+ initial.checked = true;
8644
+ if (!initial.suppressed && initial.server !== initial.next && !(name !== "class" && name !== "style" && initial.next !== null && isAttributeParserNormalizedMatch(initial.server, initial.next)) && domBindingClaims.get(el)?.get(name) !== server) {
8645
+ warnHydrationValueMismatch(
8646
+ el.__oct_loc,
8647
+ name === "style" ? "style" : `attribute \`${name}\``,
8648
+ name === "style" ? initial.server ?? "" : initial.server,
8649
+ name === "style" ? initial.next ?? "" : initial.next
8650
+ );
8651
+ }
8652
+ return true;
8653
+ }
8654
+ function probeInitialHydrateAttributes(state) {
8655
+ const snapshot = initialHydrateAttributes?.get(state);
8656
+ if (snapshot === void 0 || !changedHydrateDiagnosticCaptures(snapshot.props, state.props) && !changedHydrateDiagnosticContexts(
8657
+ snapshot.contexts,
8658
+ copyHydrateDiagnosticContexts(
8659
+ CURRENT_SCOPE?.block === state.parentBlock ? CURRENT_SCOPE : state.parentBlock
8660
+ )
8661
+ ))
8662
+ return;
8663
+ try {
8664
+ return collectInitialHydrateAttributes(state, snapshot);
8665
+ } catch {
8666
+ return;
8667
+ }
8668
+ }
8669
+ function collectInitialHydrateAttributes(state, snapshot) {
8670
+ const ownerDocument = document.implementation.createHTMLDocument("");
8671
+ const originalWrapper = state.wrapper;
8672
+ const source = STAGED_DOM?.view(originalWrapper) ?? originalWrapper;
8673
+ const template2 = ownerDocument.createElement("template");
8674
+ template2.innerHTML = source.outerHTML;
8675
+ const wrapper = ownerDocument.adoptNode(template2.content.firstElementChild);
8676
+ const probe = {
8677
+ document: ownerDocument,
8678
+ originals: /* @__PURE__ */ new WeakMap(),
8679
+ attributes: /* @__PURE__ */ new WeakMap(),
8680
+ boundaries: /* @__PURE__ */ new WeakMap()
8681
+ };
8682
+ probe.originals.set(wrapper, originalWrapper);
8683
+ const originals = source.querySelectorAll("*");
8684
+ const copies = wrapper.querySelectorAll("*");
8685
+ if (originals.length !== copies.length) return;
8686
+ for (let i = 0; i < originals.length; i++) {
8687
+ const original = originals[i];
8688
+ const copy = copies[i];
8689
+ if (copy.localName !== original.localName || copy.namespaceURI !== original.namespaceURI || probe.originals.get(copy.parentElement) !== (STAGED_DOM?.view(original) ?? original).parentElement)
8690
+ return;
8691
+ probe.originals.set(copy, original);
8692
+ }
8693
+ const start = wrapper.firstChild;
8694
+ if (start === null || !isBlockOpen(start)) return;
8695
+ const end = findMatchingClose(start, /* @__PURE__ */ new WeakMap());
8696
+ const initialChild = (_props, scope, extra) => {
8697
+ if (state.loadedBody !== null) state.loadedBody(snapshot.props.__data, scope, extra);
8698
+ else childrenAsBody(snapshot.props.children)(void 0, scope, extra);
8699
+ };
8700
+ const body = (_props, scope) => {
8701
+ tryBlock(scope, 0, wrapper, initialChild, null, null, end);
8702
+ };
8703
+ const block = createBlock("control-flow", null, wrapper, start, end, body, void 0);
8704
+ block.idState = copyHydrateDiagnosticIds(snapshot.ids);
8705
+ block.$$ctxValues = snapshot.contexts === null ? null : new Map(snapshot.contexts);
8706
+ const hydration = new HydrationCapability(block, start.nextSibling, null);
8707
+ if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
8708
+ hydration.protectRootAnchor(end);
8709
+ const capture = createOffscreenCapture();
8710
+ const previousHydration = currentHydration;
8711
+ const previousCapture = WIP_CAPTURE;
8712
+ const previousProbe = hydrateAttributeProbe;
8713
+ const previousTransaction = ROOT_RENDER_TRANSACTION;
8714
+ const previousJournal = TRANSITION_JOURNAL;
8715
+ const previousAttempt = ACTIVE_TRANSITION_ATTEMPT;
8716
+ const previousScopedReadTracking = SCOPED_READ_TRACKING;
8717
+ const previousScopedReads = SCOPED_READS;
8718
+ const previousWarm = CURRENT_WARM;
8719
+ const previousWarmClaims = CURRENT_WARM_CLAIMS;
8720
+ const previousWarmEpisode = CURRENT_WARM_EPISODE;
8721
+ const previousWarmPlans = ACTIVE_WARM_PLANS.splice(0);
8722
+ const previousStagedDom = STAGED_DOM;
8723
+ const previousStagedCapture = STAGED_COMMIT_CAPTURE;
8724
+ const previousPresentation = PRESENTATION_HYDRATION;
8725
+ const previousSelectSyncs = SELECT_SYNCS;
8726
+ const previousSelectDefaultSyncs = SELECT_DEFAULT_SYNCS;
8727
+ const previousFormChecks = DEV_FORM_CHECKS;
8728
+ const previousAutofocus = AUTOFOCUS_QUEUE;
8729
+ const previousNative = setNativeAdoptionResolver(null);
8730
+ const refDetachCheckpoint = refDetachQueue.length;
8731
+ currentHydration = hydration;
8732
+ WIP_CAPTURE = capture;
8733
+ hydrateAttributeProbe = probe;
8734
+ ROOT_RENDER_TRANSACTION = null;
8735
+ TRANSITION_JOURNAL = null;
8736
+ ACTIVE_TRANSITION_ATTEMPT = null;
8737
+ SCOPED_READ_TRACKING = false;
8738
+ SCOPED_READS = null;
8739
+ CURRENT_WARM = null;
8740
+ CURRENT_WARM_CLAIMS = null;
8741
+ CURRENT_WARM_EPISODE = 0;
8742
+ STAGED_DOM = null;
8743
+ STAGED_COMMIT_CAPTURE = null;
8744
+ PRESENTATION_HYDRATION = null;
8745
+ SELECT_SYNCS = [];
8746
+ SELECT_DEFAULT_SYNCS = [];
8747
+ DEV_FORM_CHECKS = [];
8748
+ AUTOFOCUS_QUEUE = [];
8749
+ try {
8750
+ renderBlock(block);
8751
+ drainHydrationRenderPhaseUpdates(block);
8752
+ hydration.flushClassWrites();
8753
+ } catch {
8754
+ } finally {
8755
+ try {
8756
+ disposeWip({ block, start, end, capture, domParent: wrapper, refDetachCheckpoint });
8757
+ drainHydrationRenderPhaseUpdates(block);
8758
+ } finally {
8759
+ setNativeAdoptionResolver(previousNative);
8760
+ currentHydration = previousHydration;
8761
+ WIP_CAPTURE = previousCapture;
8762
+ hydrateAttributeProbe = previousProbe;
8763
+ ROOT_RENDER_TRANSACTION = previousTransaction;
8764
+ TRANSITION_JOURNAL = previousJournal;
8765
+ ACTIVE_TRANSITION_ATTEMPT = previousAttempt;
8766
+ SCOPED_READ_TRACKING = previousScopedReadTracking;
8767
+ SCOPED_READS = previousScopedReads;
8768
+ CURRENT_WARM = previousWarm;
8769
+ CURRENT_WARM_CLAIMS = previousWarmClaims;
8770
+ CURRENT_WARM_EPISODE = previousWarmEpisode;
8771
+ ACTIVE_WARM_PLANS.length = 0;
8772
+ ACTIVE_WARM_PLANS.push(...previousWarmPlans);
8773
+ STAGED_DOM = previousStagedDom;
8774
+ STAGED_COMMIT_CAPTURE = previousStagedCapture;
8775
+ PRESENTATION_HYDRATION = previousPresentation;
8776
+ SELECT_SYNCS = previousSelectSyncs;
8777
+ SELECT_DEFAULT_SYNCS = previousSelectDefaultSyncs;
8778
+ DEV_FORM_CHECKS = previousFormChecks;
8779
+ AUTOFOCUS_QUEUE = previousAutofocus;
8780
+ }
8781
+ }
8782
+ return probe;
8783
+ }
8541
8784
  function releasePreservedHydrateActivation(state) {
8542
8785
  if (preservedHydrateActivations?.delete(state)) preservedHydrateActivationCount--;
8543
8786
  }
@@ -8720,6 +8963,7 @@ function createHydrateBoundaryBody(state, renderChild, pendingBody) {
8720
8963
  }
8721
8964
  function failHydrateBoundary(state, error) {
8722
8965
  if (state.hasError || state.block.disposed) return;
8966
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8723
8967
  cleanupHydrateStreamWait(state);
8724
8968
  state.hasError = true;
8725
8969
  state.error = error;
@@ -8837,6 +9081,7 @@ function teardownHydrateBoundary(state) {
8837
9081
  }
8838
9082
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => teardownHydrateBoundary(state), true) === true)
8839
9083
  return;
9084
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
8840
9085
  cleanupHydrateInstallers(state);
8841
9086
  cleanupHydrateStreamWait(state);
8842
9087
  if (preserved !== void 0) {
@@ -9216,10 +9461,22 @@ function createHydrateSlot(props, scope, boundaryId, boundaryBody) {
9216
9461
  independent: props.__independent !== void 0
9217
9462
  };
9218
9463
  if (nativeSeedRaw !== null) state.nativeSeedRaw = nativeSeedRaw;
9464
+ if (process.env.NODE_ENV !== "production" && serverPreserved && !state.independent) {
9465
+ const original = hydrateAttributeProbe?.originals.get(wrapper);
9466
+ const inherited = hydration?.attributeBaselines?.boundaries.get(wrapper);
9467
+ const snapshot = inherited ?? {
9468
+ props,
9469
+ ids: copyHydrateDiagnosticIds(idState),
9470
+ contexts: copyHydrateDiagnosticContexts(scope)
9471
+ };
9472
+ (initialHydrateAttributes ??= /* @__PURE__ */ new WeakMap()).set(state, snapshot);
9473
+ if (original !== void 0) hydrateAttributeProbe.boundaries.set(original, snapshot);
9474
+ }
9219
9475
  scope.slots[0] = state;
9220
9476
  registerSlot(scope, state);
9221
9477
  if (!state.independent) registerHydrationIntentBoundary(wrapper, intentBoundary);
9222
9478
  block.body = boundaryBody(state);
9479
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return state;
9223
9480
  const initialStrategy = resolveHydrateStrategy(state);
9224
9481
  const pendingIntents = state.independent ? void 0 : takePendingHydrationIntents(wrapper);
9225
9482
  if (state.independent) {
@@ -9247,6 +9504,8 @@ function activateHydrateBoundary(state) {
9247
9504
  }
9248
9505
  const hydration = preserved?.hydration ?? new HydrationCapability(block, getNextSibling(state.start), null);
9249
9506
  if (preserved === void 0) {
9507
+ if (process.env.NODE_ENV !== "production")
9508
+ hydration.attributeBaselines = probeInitialHydrateAttributes(state);
9250
9509
  if (state.seedRaw !== null) hydration.seeds = hydration.parseSeeds(state.seedRaw);
9251
9510
  hydration.protectRootAnchor(state.end);
9252
9511
  }
@@ -9321,6 +9580,7 @@ function activateHydrateBoundary(state) {
9321
9580
  if (nativeRecovery !== void 0) {
9322
9581
  noteRecoverableHydrationError(() => nativeRecovery, block);
9323
9582
  state.serverPreserved = false;
9583
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9324
9584
  state.serverActivationStarted = false;
9325
9585
  state.seedRaw = null;
9326
9586
  state.nativeSeedRaw = void 0;
@@ -9351,6 +9611,7 @@ function activateHydrateBoundary(state) {
9351
9611
  return;
9352
9612
  }
9353
9613
  if (completed) {
9614
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9354
9615
  releasePreservedHydrateActivation(state);
9355
9616
  spliceOffscreenCapture(capture);
9356
9617
  }
@@ -9460,6 +9721,7 @@ function notifyHydrateBoundary(state, scope) {
9460
9721
  return;
9461
9722
  }
9462
9723
  state.didNotify = true;
9724
+ if (process.env.NODE_ENV !== "production") initialHydrateAttributes?.delete(state);
9463
9725
  cleanupHydrateInstallers(state);
9464
9726
  state.props.onHydrated?.();
9465
9727
  domNode(state.wrapper).removeAttribute(HYDRATE_WHEN_ATTR);
@@ -11388,13 +11650,20 @@ class HydrationCapability {
11388
11650
  ns,
11389
11651
  name.indexOf(":") >= 0 ? name.slice(name.indexOf(":") + 1) : name
11390
11652
  ) : (STAGED_DOM?.view(el) ?? el).getAttribute(name);
11653
+ if (process.env.NODE_ENV !== "production") {
11654
+ if (hydrateAttributeProbe !== null) {
11655
+ recordInitialHydrateAttribute(el, name, server, next);
11656
+ } else {
11657
+ checkInitialHydrateAttribute(this, el, name, server);
11658
+ }
11659
+ }
11391
11660
  if (server === next) return false;
11392
11661
  if (domBindingClaims.get(el)?.get(name) === server) return false;
11393
11662
  if (next !== null && isAttributeParserNormalizedMatch(server, next)) return false;
11394
11663
  const mode = hydrationMismatchMode(el);
11395
11664
  if (mode === 0) return true;
11396
11665
  if (mode === 1) return false;
11397
- if (process.env.NODE_ENV !== "production")
11666
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, name, server))
11398
11667
  warnHydrationValueMismatch(el.__oct_loc, `attribute \`${name}\``, server, next);
11399
11668
  return true;
11400
11669
  }
@@ -11402,11 +11671,15 @@ class HydrationCapability {
11402
11671
  const mode = hydrationMismatchMode(el);
11403
11672
  const rawServer = (STAGED_DOM?.view(el) ?? el).getAttribute("class");
11404
11673
  const server = absentIsEmpty && rawServer === null ? "" : rawServer;
11674
+ if (process.env.NODE_ENV !== "production") {
11675
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "class", server, next);
11676
+ else checkInitialHydrateAttribute(this, el, "class", rawServer);
11677
+ }
11405
11678
  if (server === next) return true;
11406
11679
  if (domBindingClaims.get(el)?.get("class") === rawServer) return false;
11407
11680
  if (mode === 0) return true;
11408
11681
  if (mode === 1) return false;
11409
- if (process.env.NODE_ENV !== "production")
11682
+ if (process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "class", rawServer))
11410
11683
  warnHydrationValueMismatch(el.__oct_loc, "attribute `class`", server, next);
11411
11684
  return true;
11412
11685
  }
@@ -11417,7 +11690,11 @@ class HydrationCapability {
11417
11690
  try {
11418
11691
  for (const [el, write] of this.classWrites) {
11419
11692
  const rawTarget = write.remove ? null : write.next;
11420
- if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) continue;
11693
+ if ((STAGED_DOM?.view(el) ?? el).getAttribute("class") === rawTarget) {
11694
+ if (process.env.NODE_ENV !== "production")
11695
+ this.allowClass(el, write.next, write.absentIsEmpty);
11696
+ continue;
11697
+ }
11421
11698
  if (!this.allowClass(el, write.next, write.absentIsEmpty)) continue;
11422
11699
  if (write.remove) (STAGED_DOM?.view(el) ?? el).removeAttribute("class");
11423
11700
  else if (write.useAttribute)
@@ -11430,7 +11707,21 @@ class HydrationCapability {
11430
11707
  }
11431
11708
  applyStyle(el, value, _prev, staticCss, entries) {
11432
11709
  const mode = hydrationMismatchMode(el);
11433
- if (mode === 1) return true;
11710
+ if (mode === 1) {
11711
+ if (process.env.NODE_ENV !== "production") {
11712
+ if (hydrateAttributeProbe !== null) recordInitialHydrateAttribute(el, "style", null, null);
11713
+ else {
11714
+ const current = STAGED_DOM?.view(el) ?? el;
11715
+ checkInitialHydrateAttribute(
11716
+ this,
11717
+ el,
11718
+ "style",
11719
+ current.hasAttribute("style") ? current.style.cssText : null
11720
+ );
11721
+ }
11722
+ }
11723
+ return true;
11724
+ }
11434
11725
  const style = (STAGED_DOM?.view(el) ?? el).style;
11435
11726
  const hadStyleAttribute = (STAGED_DOM?.view(el) ?? el).hasAttribute("style");
11436
11727
  const before = style.cssText;
@@ -11446,7 +11737,11 @@ class HydrationCapability {
11446
11737
  applyStyleProperty(el, expectedStyle, entries[i], entry);
11447
11738
  }
11448
11739
  }
11449
- const claims = domBindingClaims.get(el);
11740
+ let claims = domBindingClaims.get(el);
11741
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) {
11742
+ const original = hydrateAttributeProbe.originals.get(el);
11743
+ if (original !== void 0) claims = domBindingClaims.get(original);
11744
+ }
11450
11745
  if (claims !== void 0) {
11451
11746
  for (const [channel, published] of claims) {
11452
11747
  if (!channel.startsWith("style:")) continue;
@@ -11460,10 +11755,20 @@ class HydrationCapability {
11460
11755
  }
11461
11756
  const expected = expectedStyle.cssText;
11462
11757
  const expectsStyleAttribute = expected !== "";
11758
+ if (process.env.NODE_ENV !== "production") {
11759
+ if (hydrateAttributeProbe !== null)
11760
+ recordInitialHydrateAttribute(
11761
+ el,
11762
+ "style",
11763
+ hadStyleAttribute ? before : null,
11764
+ expectsStyleAttribute ? expected : null
11765
+ );
11766
+ else checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null);
11767
+ }
11463
11768
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
11464
11769
  if (expectsStyleAttribute) style.cssText = expected;
11465
11770
  else (STAGED_DOM?.view(el) ?? el).removeAttribute("style");
11466
- if (mode === 2 && process.env.NODE_ENV !== "production") {
11771
+ if (mode === 2 && process.env.NODE_ENV !== "production" && !checkInitialHydrateAttribute(this, el, "style", hadStyleAttribute ? before : null)) {
11467
11772
  warnHydrationValueMismatch(el.__oct_loc, "style", before, expected);
11468
11773
  }
11469
11774
  return true;
@@ -12729,6 +13034,8 @@ function bindDirectSignal(scope, previous, target, value, site, policy, name, at
12729
13034
  const kind = policy.kind;
12730
13035
  const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_BINDING] === true ? previous : null;
12731
13036
  const handle = isSignalHandle(value) ? value : null;
13037
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && handle !== null)
13038
+ throw new PresentationAdoptionMiss(void 0, false);
12732
13039
  if (handle !== null && (!signalDocumentEnabled || currentSignalOwner() !== SCOPE_SIGNAL_OWNERS.get(scope))) {
12733
13040
  if (!signalDocumentEnabled) enableSignalBindings();
12734
13041
  return runWithBlockSignalOwner(
@@ -15052,6 +15359,7 @@ function namespaceHeadElement(headKey, tag, attrs, text, authoredKey) {
15052
15359
  return createElement(namespaceHead, config);
15053
15360
  }
15054
15361
  function injectStyle(id, css, nonce) {
15362
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
15055
15363
  if (typeof document === "undefined") {
15056
15364
  _injectedStyles.add(id);
15057
15365
  return;
@@ -17265,6 +17573,8 @@ function registerValuePortalFragmentOwners(portal2, parentBlock, anchor) {
17265
17573
  }
17266
17574
  }
17267
17575
  function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, env, key = null) {
17576
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null && target.ownerDocument !== hydrateAttributeProbe.document)
17577
+ target = hydrateAttributeProbe.document.createDocumentFragment();
17268
17578
  const hydration = activeHydration();
17269
17579
  if (hydration !== null) {
17270
17580
  return hydration.suspend(
@@ -21241,7 +21551,8 @@ function hmr(fn) {
21241
21551
  }
21242
21552
  };
21243
21553
  function wrapper(props, scope, extra) {
21244
- if (scope !== void 0) meta.liveBlocks.add(scope.block);
21554
+ if (scope !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
21555
+ meta.liveBlocks.add(scope.block);
21245
21556
  return meta.fn(props, scope, extra);
21246
21557
  }
21247
21558
  Object.defineProperty(wrapper, HMR, {
@@ -21640,7 +21951,8 @@ function mountPassthroughPending(state, thenable) {
21640
21951
  setTryBranch(state, -1);
21641
21952
  scheduleRender(state.parentBlock);
21642
21953
  };
21643
- thenable.then(retry, retry);
21954
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
21955
+ thenable.then(retry, retry);
21644
21956
  }
21645
21957
  function renderPassthroughTry(state) {
21646
21958
  if (state.branch === 0 && state.block !== null) {
@@ -22143,10 +22455,10 @@ function takeInitialSuspenseHydration(state, hydration) {
22143
22455
  if (payload === void 0) {
22144
22456
  payload = {
22145
22457
  seedRaw: typeof stash?.[boundaryId] === "string" ? stash[boundaryId] : null,
22146
- nativeRaw: typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22458
+ nativeRaw: (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null) && typeof stash?.[boundaryId + "$signals"] === "string" ? stash[boundaryId + "$signals"] : null
22147
22459
  };
22148
22460
  (initialStreamedPayloads ??= /* @__PURE__ */ new WeakMap()).set(owner, payload);
22149
- if (stash !== void 0) {
22461
+ if (stash !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)) {
22150
22462
  delete stash[boundaryId];
22151
22463
  delete stash[boundaryId + "$signals"];
22152
22464
  }
@@ -22183,7 +22495,8 @@ function takeInitialSuspenseHydration(state, hydration) {
22183
22495
  continue;
22184
22496
  if (attr === SUSPENSE_RESOLVED_SEED_ATTR)
22185
22497
  seedRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22186
- else nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22498
+ else if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22499
+ nativeRaw = (STAGED_DOM?.view(script) ?? script).textContent;
22187
22500
  sidecars.push(script);
22188
22501
  cursor = getNextSibling(script);
22189
22502
  }
@@ -22224,6 +22537,8 @@ function renderInitialSuspenseHydration(state, initial) {
22224
22537
  hydration.claimRootRemainder(initial.end);
22225
22538
  hydration.protectRootAnchor(initial.end);
22226
22539
  const previousHydration = currentHydration;
22540
+ if (process.env.NODE_ENV !== "production")
22541
+ hydration.attributeBaselines = previousHydration?.attributeBaselines;
22227
22542
  if (previousHydration?.retryPresentation !== void 0)
22228
22543
  hydration.retryPresentation = previousHydration.retryPresentation;
22229
22544
  const previousCapture = WIP_CAPTURE;
@@ -22292,7 +22607,8 @@ function renderInitialSuspenseHydration(state, initial) {
22292
22607
  return;
22293
22608
  scheduleRender(state.parentBlock);
22294
22609
  };
22295
- suspended.then(resume, resume);
22610
+ if (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null)
22611
+ suspended.then(resume, resume);
22296
22612
  return;
22297
22613
  }
22298
22614
  initialSuspenseHydrations?.delete(state);
@@ -22359,7 +22675,8 @@ function mountTry(state) {
22359
22675
  const raw = stash !== void 0 ? stash[streamedBoundaryId] : void 0;
22360
22676
  if (typeof raw === "string") scopedSeeds = hydration.parseSeeds(raw);
22361
22677
  const nativeRaw = stash?.[streamedBoundaryId + "$signals"];
22362
- if (typeof nativeRaw === "string") scopedNativeRaw = nativeRaw;
22678
+ if (typeof nativeRaw === "string" && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
22679
+ scopedNativeRaw = nativeRaw;
22363
22680
  adoptCursor = getNextSibling(adoptCursor);
22364
22681
  } else if (
22365
22682
  // A shell hydrated before its streamed segment swaps still has the
@@ -23311,6 +23628,7 @@ function flushStagedReveals() {
23311
23628
  }
23312
23629
  }
23313
23630
  function attachResume(state, thenable) {
23631
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
23314
23632
  if (state.pendingThenable === thenable) return;
23315
23633
  state.pendingThenable = thenable;
23316
23634
  const retry = () => {
@@ -24615,6 +24933,7 @@ function queueCurrentActivityRefs(activity) {
24615
24933
  }
24616
24934
  }
24617
24935
  function suspendHiddenActivity(state, thenable) {
24936
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
24618
24937
  if (state.pendingThenable === thenable) return;
24619
24938
  state.pendingThenable = thenable;
24620
24939
  const block = state.block;
@@ -27602,6 +27921,7 @@ function applyHintAttrs(el, opts) {
27602
27921
  }
27603
27922
  }
27604
27923
  function preload(href, options) {
27924
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27605
27925
  if (process.env.NODE_ENV !== "production") {
27606
27926
  const warning = resourceHintWarning("preload", href, options);
27607
27927
  if (warning !== null) console.error(warning);
@@ -27639,6 +27959,7 @@ function preload(href, options) {
27639
27959
  });
27640
27960
  }
27641
27961
  function preinit(href, options) {
27962
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27642
27963
  if (process.env.NODE_ENV !== "production") {
27643
27964
  const warning = resourceHintWarning("preinit", href, options);
27644
27965
  if (warning !== null) console.error(warning);
@@ -27663,6 +27984,7 @@ function preinit(href, options) {
27663
27984
  }
27664
27985
  }
27665
27986
  function preconnect(href, options) {
27987
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27666
27988
  if (process.env.NODE_ENV !== "production") {
27667
27989
  const warning = resourceHintWarning("preconnect", href, options);
27668
27990
  if (warning !== null) console.error(warning);
@@ -27684,6 +28006,7 @@ function preconnect(href, options) {
27684
28006
  });
27685
28007
  }
27686
28008
  function prefetchDNS(href) {
28009
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27687
28010
  if (process.env.NODE_ENV !== "production") {
27688
28011
  const warning = resourceHintWarning("prefetchDNS", href, arguments[1], arguments.length > 1);
27689
28012
  if (warning !== null) console.error(warning);
@@ -27699,6 +28022,7 @@ function prefetchDNS(href) {
27699
28022
  });
27700
28023
  }
27701
28024
  function preloadModule(href, options) {
28025
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27702
28026
  if (process.env.NODE_ENV !== "production") {
27703
28027
  const warning = resourceHintWarning("preloadModule", href, options);
27704
28028
  if (warning !== null) console.error(warning);
@@ -27720,6 +28044,7 @@ function preloadModule(href, options) {
27720
28044
  });
27721
28045
  }
27722
28046
  function preinitModule(href, options) {
28047
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27723
28048
  if (process.env.NODE_ENV !== "production") {
27724
28049
  const warning = resourceHintWarning("preinitModule", href, options);
27725
28050
  if (warning !== null) console.error(warning);
@@ -27828,6 +28153,7 @@ function warnInvalidStylesheetResource(reason) {
27828
28153
  );
27829
28154
  }
27830
28155
  function stylesheetResource(attrs, invalidReason) {
28156
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27831
28157
  if (process.env.NODE_ENV !== "production" && invalidReason !== void 0) {
27832
28158
  warnInvalidStylesheetResource(invalidReason);
27833
28159
  return;
@@ -27847,6 +28173,7 @@ function stylesheetResource(attrs, invalidReason) {
27847
28173
  state.sheets.add(href);
27848
28174
  }
27849
28175
  function styleResource(attrs, css, development) {
28176
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27850
28177
  if (typeof document === "undefined" || attrs == null) return;
27851
28178
  const href = attrs.href;
27852
28179
  if (typeof href !== "string" || href === "") return;
@@ -27877,6 +28204,7 @@ function resetFloatResourceState() {
27877
28204
  if (typeof window !== "undefined") delete window.$OCTFR;
27878
28205
  }
27879
28206
  function scriptResource(attrs) {
28207
+ if (process.env.NODE_ENV !== "production" && hydrateAttributeProbe !== null) return;
27880
28208
  if (typeof document === "undefined" || attrs == null) return;
27881
28209
  const src = attrs.src;
27882
28210
  if (typeof src !== "string" || src === "") return;