octane 0.6.2 → 0.7.0

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.
Files changed (200) hide show
  1. package/dist/cjs/constants.cjs +3 -0
  2. package/dist/cjs/dom-binding-handoff.cjs +2 -1
  3. package/dist/cjs/dom-binding-protocol.cjs +4 -3
  4. package/dist/cjs/dom-binding-styles.cjs +3 -2
  5. package/dist/cjs/dom-bindings.cjs +24 -23
  6. package/dist/cjs/error-codes.client.generated.cjs +7 -1
  7. package/dist/cjs/error-codes.server.generated.cjs +27 -1
  8. package/dist/cjs/hydration/event-capture.cjs +2 -1
  9. package/dist/cjs/independent-hydration-protocol.cjs +3 -2
  10. package/dist/cjs/index.cjs +2 -0
  11. package/dist/cjs/runtime.cjs +866 -370
  12. package/dist/cjs/runtime.server.cjs +250 -62
  13. package/dist/cjs/server/index.cjs +2 -0
  14. package/dist/cjs/server/rpc-stream.cjs +19 -12
  15. package/dist/cjs/server/streamed-signals.cjs +18 -1
  16. package/dist/cjs/shared-value-helpers.cjs +24 -2
  17. package/dist/cjs/signals/control-binding.cjs +7 -6
  18. package/dist/cjs/signals/derived-facade.cjs +2 -1
  19. package/dist/cjs/signals/document-owner.cjs +4 -3
  20. package/dist/cjs/signals/facade.cjs +10 -9
  21. package/dist/cjs/signals/graph.cjs +5 -4
  22. package/dist/cjs/signals/native-read-client.cjs +4 -3
  23. package/dist/cjs/signals/owner-context.cjs +4 -3
  24. package/dist/cjs/signals/query-attempt-observer.cjs +2 -1
  25. package/dist/cjs/signals/query-facade.cjs +2 -1
  26. package/dist/cjs/signals/scalar-computations.cjs +2 -1
  27. package/dist/cjs/signals/transition-action.cjs +10 -9
  28. package/dist/cjs/signals/transition-candidate.cjs +2 -1
  29. package/dist/cjs/version.cjs +1 -1
  30. package/dist/compiler/arm-exits.js +151 -0
  31. package/dist/compiler/compile-universal.js +262 -65
  32. package/dist/compiler/compile.js +1929 -306
  33. package/dist/compiler/deferred-snapshots.js +791 -0
  34. package/dist/compiler/strong-mode.js +59 -10
  35. package/dist/constants.d.ts +5 -1
  36. package/dist/constants.js +2 -0
  37. package/dist/error-codes.client.generated.d.ts +1 -0
  38. package/dist/error-codes.client.generated.js +5 -0
  39. package/dist/error-codes.server.generated.d.ts +5 -0
  40. package/dist/error-codes.server.generated.js +25 -0
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +2 -0
  43. package/dist/node/aria-diagnostics.js +92 -0
  44. package/dist/node/behavior-form-submissions.js +228 -0
  45. package/dist/node/behavior-root-types.js +0 -0
  46. package/dist/node/behavior-root.js +746 -0
  47. package/dist/node/class-names.js +25 -0
  48. package/dist/node/compatibility.js +10 -0
  49. package/dist/node/component-flags.js +23 -0
  50. package/dist/node/constants.js +115 -0
  51. package/dist/node/context-epoch.js +13 -0
  52. package/dist/node/context-identity.js +46 -0
  53. package/dist/node/css.js +80 -0
  54. package/dist/node/data-encoding.js +134 -0
  55. package/dist/node/devtools-hook.js +229 -0
  56. package/dist/node/dom-binding-claims.js +4 -0
  57. package/dist/node/dom-binding-classes.js +152 -0
  58. package/dist/node/dom-binding-controls.js +6 -0
  59. package/dist/node/dom-binding-handoff.js +77 -0
  60. package/dist/node/dom-binding-program.js +1617 -0
  61. package/dist/node/dom-binding-projections.js +204 -0
  62. package/dist/node/dom-binding-protocol.js +130 -0
  63. package/dist/node/dom-binding-signals.js +135 -0
  64. package/dist/node/dom-binding-styles.js +280 -0
  65. package/dist/node/dom-bindings.js +1087 -0
  66. package/dist/node/dom-focused-move.js +46 -0
  67. package/dist/node/dom-stage.js +878 -0
  68. package/dist/node/dom-tables.js +382 -0
  69. package/dist/node/error-codes.client.generated.js +1071 -0
  70. package/dist/node/error-codes.server.generated.js +761 -0
  71. package/dist/node/error-message.js +27 -0
  72. package/dist/node/event-names.js +15 -0
  73. package/dist/node/form-diagnostics.js +96 -0
  74. package/dist/node/form-submission.js +43 -0
  75. package/dist/node/has-own.js +4 -0
  76. package/dist/node/head-ownership.js +31 -0
  77. package/dist/node/hook-slot-cache.js +91 -0
  78. package/dist/node/host-property-diagnostics.js +189 -0
  79. package/dist/node/html-tree-validation.js +193 -0
  80. package/dist/node/hydration/condition.js +15 -0
  81. package/dist/node/hydration/control-capture.js +237 -0
  82. package/dist/node/hydration/document-lifecycle.js +89 -0
  83. package/dist/node/hydration/event-capture.js +362 -0
  84. package/dist/node/hydration/idle.js +23 -0
  85. package/dist/node/hydration/independent-island.js +317 -0
  86. package/dist/node/hydration/index.js +74 -0
  87. package/dist/node/hydration/interaction-config.js +61 -0
  88. package/dist/node/hydration/interaction.js +35 -0
  89. package/dist/node/hydration/load.js +15 -0
  90. package/dist/node/hydration/media.js +33 -0
  91. package/dist/node/hydration/native-intent.js +68 -0
  92. package/dist/node/hydration/never.js +12 -0
  93. package/dist/node/hydration/stream-delivery.js +345 -0
  94. package/dist/node/hydration/stream-receiver.js +190 -0
  95. package/dist/node/hydration/stream-result-receiver.js +276 -0
  96. package/dist/node/hydration/streamed-signals.js +186 -0
  97. package/dist/node/hydration/types.js +0 -0
  98. package/dist/node/hydration/visible.js +69 -0
  99. package/dist/node/hydration-markers.js +44 -0
  100. package/dist/node/independent-hydration-protocol.js +91 -0
  101. package/dist/node/index.js +463 -0
  102. package/dist/node/internal/client.js +7 -0
  103. package/dist/node/internal/context.js +5 -0
  104. package/dist/node/internal/server.js +5 -0
  105. package/dist/node/internal/signal-read.js +4 -0
  106. package/dist/node/method-dep.js +25 -0
  107. package/dist/node/profiling.js +432 -0
  108. package/dist/node/public-types.js +0 -0
  109. package/dist/node/react/fiber-adapter.js +57 -0
  110. package/dist/node/react/index.js +397 -0
  111. package/dist/node/react/react-compat-envelope.js +78 -0
  112. package/dist/node/react/react-compat-server.js +129 -0
  113. package/dist/node/react/react-compat-shared.js +104 -0
  114. package/dist/node/react/react-compat.js +223 -0
  115. package/dist/node/react/server.js +81 -0
  116. package/dist/node/react/shared.js +75 -0
  117. package/dist/node/renderer-bridge.js +35 -0
  118. package/dist/node/resize-observer.js +105 -0
  119. package/dist/node/resource-hint-diagnostics.js +67 -0
  120. package/dist/node/runtime-tags.js +22 -0
  121. package/dist/node/runtime.js +29364 -0
  122. package/dist/node/runtime.server.js +8200 -0
  123. package/dist/node/sanitize-url.js +34 -0
  124. package/dist/node/server/early-signals.js +54 -0
  125. package/dist/node/server/index.js +338 -0
  126. package/dist/node/server/rpc-batch.js +129 -0
  127. package/dist/node/server/rpc-stream.js +132 -0
  128. package/dist/node/server/rpc.js +48 -0
  129. package/dist/node/server/signal-query-observation.js +134 -0
  130. package/dist/node/server/streamed-region.js +31 -0
  131. package/dist/node/server/streamed-signals.js +574 -0
  132. package/dist/node/server-call.js +75 -0
  133. package/dist/node/server-rpc-batch-client.js +119 -0
  134. package/dist/node/server-rpc-client.js +108 -0
  135. package/dist/node/server-rpc-protocol.js +109 -0
  136. package/dist/node/server-rpc-stream-client.js +98 -0
  137. package/dist/node/shared-value-helpers.js +60 -0
  138. package/dist/node/signals/actions.js +463 -0
  139. package/dist/node/signals/client.js +22 -0
  140. package/dist/node/signals/computations.js +452 -0
  141. package/dist/node/signals/control-binding.js +388 -0
  142. package/dist/node/signals/control-handoff.js +12 -0
  143. package/dist/node/signals/derived-facade.js +25 -0
  144. package/dist/node/signals/document-owner.js +48 -0
  145. package/dist/node/signals/early-values.js +124 -0
  146. package/dist/node/signals/encoding.js +6 -0
  147. package/dist/node/signals/engine.js +668 -0
  148. package/dist/node/signals/errors.js +54 -0
  149. package/dist/node/signals/facade.js +441 -0
  150. package/dist/node/signals/graph.js +817 -0
  151. package/dist/node/signals/handle-protocol.js +11 -0
  152. package/dist/node/signals/index.js +87 -0
  153. package/dist/node/signals/native-read-client.js +319 -0
  154. package/dist/node/signals/native-read-collector.js +132 -0
  155. package/dist/node/signals/native-read-events.js +45 -0
  156. package/dist/node/signals/native-read-inspection.js +20 -0
  157. package/dist/node/signals/native-read-retry.js +30 -0
  158. package/dist/node/signals/native-read-seeds.js +243 -0
  159. package/dist/node/signals/native-read-server.js +99 -0
  160. package/dist/node/signals/owner-context.js +88 -0
  161. package/dist/node/signals/query-attempt-observer.js +42 -0
  162. package/dist/node/signals/query-facade.js +41 -0
  163. package/dist/node/signals/read-protocol.js +125 -0
  164. package/dist/node/signals/requests.js +716 -0
  165. package/dist/node/signals/scalar-computations.js +57 -0
  166. package/dist/node/signals/scope-streams.js +147 -0
  167. package/dist/node/signals/server.js +22 -0
  168. package/dist/node/signals/transition-action.js +555 -0
  169. package/dist/node/signals/transition-candidate.js +101 -0
  170. package/dist/node/signals/transition-coordinator.js +255 -0
  171. package/dist/node/signals/transition-state.js +82 -0
  172. package/dist/node/signals/types.js +20 -0
  173. package/dist/node/static/index.js +10 -0
  174. package/dist/node/stream-protocol.js +114 -0
  175. package/dist/node/streamed-signals-protocol.js +130 -0
  176. package/dist/node/style-values.js +96 -0
  177. package/dist/node/sub-slot.js +35 -0
  178. package/dist/node/testing.js +14 -0
  179. package/dist/node/trusted-html.js +6 -0
  180. package/dist/node/tsrx-iterable.js +5 -0
  181. package/dist/node/tsrx-spread.js +10 -0
  182. package/dist/node/universal-core.js +10138 -0
  183. package/dist/node/universal-dom-boundary.js +237 -0
  184. package/dist/node/universal-native.js +28 -0
  185. package/dist/node/universal.js +17 -0
  186. package/dist/node/version.js +4 -0
  187. package/dist/runtime.d.ts +219 -8
  188. package/dist/runtime.js +714 -220
  189. package/dist/runtime.server.d.ts +33 -2
  190. package/dist/runtime.server.js +217 -29
  191. package/dist/server/index.d.ts +1 -1
  192. package/dist/server/index.js +2 -0
  193. package/dist/server/rpc-stream.js +19 -12
  194. package/dist/server/streamed-signals.js +18 -1
  195. package/dist/shared-value-helpers.d.ts +11 -0
  196. package/dist/shared-value-helpers.js +21 -1
  197. package/dist/universal-core.d.ts +3 -1
  198. package/dist/universal-core.js +178 -50
  199. package/dist/version.js +1 -1
  200. package/package.json +62 -1
package/dist/runtime.js CHANGED
@@ -69,8 +69,10 @@ import {
69
69
  applyElementDefaultProps,
70
70
  childElementKey,
71
71
  childrenIterator,
72
+ describeTextareaChild,
72
73
  escapeMappedElementKey,
73
- resolveLazyDefaultProps as lazyResolvedProps
74
+ resolveLazyDefaultProps as lazyResolvedProps,
75
+ textareaChildText
74
76
  } from "./shared-value-helpers.js";
75
77
  import {
76
78
  __profileBail,
@@ -236,10 +238,10 @@ function profileTrackComponent(subject, fallback) {
236
238
  override !== null && override.target === fallback ? override.component : fallback
237
239
  );
238
240
  }
239
- function profilePortalComponent(rawBody) {
241
+ function profilePortalComponent(rawBody, body) {
240
242
  if (typeof rawBody === "function" && __profileHasComponentMetadata(rawBody)) return rawBody;
241
243
  const descriptor = rawBody;
242
- return descriptor != null && descriptor.$$kind === ELEMENT_TAG && typeof descriptor.type === "function" ? descriptor.type : null;
244
+ return descriptor != null && descriptor.$$kind === ELEMENT_TAG && descriptor.type === body ? body : null;
243
245
  }
244
246
  function ensureHooks(scope) {
245
247
  return scope.hooks ?? (scope.hooks = /* @__PURE__ */ new Map());
@@ -1007,6 +1009,7 @@ function siteLoc(scope, slotKey) {
1007
1009
  if (lc === void 0) return "";
1008
1010
  return `${scope.locFile ?? "<unknown>"}:${lc[0]}:${lc[1]}`;
1009
1011
  }
1012
+ const COMPONENT_SOURCE_LOCS = process.env.NODE_ENV === "production" ? null : /* @__PURE__ */ new WeakMap();
1010
1013
  function componentSourceLoc(body) {
1011
1014
  if (typeof body !== "function") return void 0;
1012
1015
  try {
@@ -1014,13 +1017,17 @@ function componentSourceLoc(body) {
1014
1017
  if (typeof stamped === "string") return stamped;
1015
1018
  } catch {
1016
1019
  }
1020
+ const cache = COMPONENT_SOURCE_LOCS;
1021
+ if (cache !== null && cache.has(body)) return cache.get(body);
1022
+ let loc;
1017
1023
  try {
1018
1024
  const source = Function.prototype.toString.call(body);
1019
1025
  const match = /["']__octane_loc:([^"'\\\s]+)["']/.exec(source);
1020
- if (match !== null) return decodeURIComponent(match[1]);
1026
+ if (match !== null) loc = decodeURIComponent(match[1]);
1021
1027
  } catch {
1022
1028
  }
1023
- return void 0;
1029
+ cache?.set(body, loc);
1030
+ return loc;
1024
1031
  }
1025
1032
  function isHydrationSuppressed(el) {
1026
1033
  return el !== null && el.__oct_suppress === true;
@@ -1096,6 +1103,10 @@ function hydrationNodeMatches(server, template2, partialStyles, path = "") {
1096
1103
  }
1097
1104
  return true;
1098
1105
  }
1106
+ function fragmentRootMatches(server, fragment, partialStyles) {
1107
+ const first = getFirstChild(fragment);
1108
+ return first.nodeType === 8 || hydrationNodeMatches(server, first, partialStyles, "0");
1109
+ }
1099
1110
  function removeHydrationRange(start, end) {
1100
1111
  let n = start;
1101
1112
  while (n !== null) {
@@ -2357,7 +2368,7 @@ function suspendRootRender(block, wakeable, attempt) {
2357
2368
  owner.retry();
2358
2369
  });
2359
2370
  };
2360
- wakeable.then(ping, ping);
2371
+ resumeOnSettle(wakeable, ping);
2361
2372
  return true;
2362
2373
  }
2363
2374
  const BINDING_BAG_ARITY = /* @__PURE__ */ Symbol();
@@ -2968,8 +2979,8 @@ function vtScopeForBlock(block) {
2968
2979
  const host = vtScopeHost(ancestor);
2969
2980
  if (host === null) return null;
2970
2981
  if (ancestor !== block) {
2971
- const parent2 = block.parentNode;
2972
- if (parent2 !== host && !(STAGED_DOM?.view(host) ?? host).contains(parent2)) {
2982
+ const parent = block.parentNode;
2983
+ if (parent !== host && !(STAGED_DOM?.view(host) ?? host).contains(parent)) {
2973
2984
  const elements = vtRangeElements(block);
2974
2985
  if (elements.length === 0 || elements.some(
2975
2986
  (element) => element !== host && !(STAGED_DOM?.view(host) ?? host).contains(element)
@@ -2979,10 +2990,14 @@ function vtScopeForBlock(block) {
2979
2990
  }
2980
2991
  return host;
2981
2992
  }
2982
- const parent = block.parentNode;
2983
- const physical = vtClosestScope(parent);
2984
- if (physical !== null) return physical;
2985
- return parent.nodeType === 9 ? parent : parent.ownerDocument;
2993
+ for (let current = block; current !== null; current = current.parentBlock) {
2994
+ const parent = current.parentNode;
2995
+ const physical = vtClosestScope(parent);
2996
+ if (physical !== null) return physical;
2997
+ const owner = parent.nodeType === 9 ? parent : parent.ownerDocument;
2998
+ if (owner.defaultView !== null) return owner;
2999
+ }
3000
+ return null;
2986
3001
  }
2987
3002
  function vtCaptureElements(block, owner) {
2988
3003
  return vtRangeElements(block).filter((element) => {
@@ -4691,6 +4706,8 @@ function vtFinalizeGroup(group, types) {
4691
4706
  while (ancestor !== null && !active.has(ancestor))
4692
4707
  ancestor = vtNearestBoundaryAncestor(ancestor);
4693
4708
  if (ancestor === null) vtCancelOldCapture(rec, cancelledAnimations);
4709
+ else if (visibleAfter.has(rec.block))
4710
+ vtApplyStyles(rec, vtResolveClass(rec.props, "update", types));
4694
4711
  }
4695
4712
  vtCheckNames(group);
4696
4713
  const root = owner.documentElement;
@@ -6904,12 +6921,12 @@ function renderReturnedValue(block, out, reset) {
6904
6921
  block.parentNode,
6905
6922
  d.type,
6906
6923
  d.props,
6924
+ d.__octaneInvocationSite,
6907
6925
  block.endMarker,
6908
- d.key ?? void 0,
6909
6926
  true,
6910
6927
  void 0,
6911
- activeHydration() !== null && elementKeyWasProvided(d),
6912
- d.__octaneInvocationSite
6928
+ d.key ?? void 0,
6929
+ activeHydration() !== null && elementKeyWasProvided(d)
6913
6930
  )
6914
6931
  );
6915
6932
  } else {
@@ -6919,32 +6936,21 @@ function renderReturnedValue(block, out, reset) {
6919
6936
  block.parentNode,
6920
6937
  d.type,
6921
6938
  d.props,
6939
+ d.__octaneInvocationSite,
6922
6940
  block.endMarker,
6923
- d.key ?? void 0,
6924
6941
  true,
6925
6942
  void 0,
6926
- activeHydration() !== null && elementKeyWasProvided(d),
6927
- d.__octaneInvocationSite
6943
+ d.key ?? void 0,
6944
+ activeHydration() !== null && elementKeyWasProvided(d)
6928
6945
  );
6929
6946
  }
6930
6947
  } else {
6931
6948
  const returnHydration = activeHydration();
6932
- 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))) {
6933
- const borrowed = {
6934
- __kind: "childSlot",
6935
- start: block.startMarker,
6936
- end: block.endMarker,
6937
- ownerHost: null,
6938
- borrowed: true,
6939
- compactable: false,
6940
- block: null,
6941
- text: null,
6942
- currentComp: null,
6943
- currentIsBodyFn: false,
6944
- forSlot: null,
6945
- hostNode: null,
6946
- portal: null
6947
- };
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) || isComponentDescriptor && returnHydration.holdsServerText(block))) {
6950
+ const borrowed = returnHydration.lendRange(
6951
+ block.startMarker,
6952
+ block.endMarker
6953
+ );
6948
6954
  block.slots[0] = borrowed;
6949
6955
  registerSlot(block, borrowed);
6950
6956
  }
@@ -7052,7 +7058,7 @@ class LiteBlockImpl {
7052
7058
  this.signalInstanceResolved = void 0;
7053
7059
  }
7054
7060
  }
7055
- function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite) {
7061
+ function componentSlotLite(parentScope, slotKey, host, comp, props, invocationSite, anchor) {
7056
7062
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
7057
7063
  if (parentScope === SHARED_BODY_SCOPE) {
7058
7064
  componentSlotImpl(
@@ -7082,8 +7088,8 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invo
7082
7088
  host,
7083
7089
  comp,
7084
7090
  props,
7085
- anchor,
7086
- invocationSite
7091
+ invocationSite,
7092
+ anchor
7087
7093
  );
7088
7094
  return;
7089
7095
  }
@@ -7152,9 +7158,9 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invo
7152
7158
  }
7153
7159
  if (hydration !== null && adoptedClose !== null) hydration.node = getNextSibling(adoptedClose);
7154
7160
  }
7155
- function suspendFreshLiteComponent(hydration, parentScope, slotKey, host, comp, props, anchor, invocationSite) {
7161
+ function suspendFreshLiteComponent(hydration, parentScope, slotKey, host, comp, props, invocationSite, anchor) {
7156
7162
  hydration.suspend(
7157
- () => componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite)
7163
+ () => componentSlotLite(parentScope, slotKey, host, comp, props, invocationSite, anchor)
7158
7164
  );
7159
7165
  }
7160
7166
  let TEARDOWN_DEPTH = 0;
@@ -8840,7 +8846,7 @@ function preserveSuspendedHydrateActivation(state, hydration, thenable) {
8840
8846
  state.serverActivationStarted = false;
8841
8847
  scheduleRender(state.parentBlock);
8842
8848
  };
8843
- thenable.then(resume, resume);
8849
+ resumeOnSettle(thenable, resume);
8844
8850
  }
8845
8851
  function hydrateStrategyType(when) {
8846
8852
  return typeof when === "function" ? "dynamic" : when?._t ?? "dynamic";
@@ -10331,6 +10337,14 @@ function useThenable(thenable, replaceOnResume = false) {
10331
10337
  warnUseWaterfall(block, idx);
10332
10338
  throw new SuspenseException(thenable);
10333
10339
  }
10340
+ let SETTLED_WAKEABLES = null;
10341
+ function resumeOnSettle(wakeable, retry) {
10342
+ const onSettle = SETTLED_WAKEABLES?.has(wakeable) === true ? () => void setTimeout(retry, 0) : () => {
10343
+ (SETTLED_WAKEABLES ??= /* @__PURE__ */ new WeakSet()).add(wakeable);
10344
+ retry();
10345
+ };
10346
+ wakeable.then(onSettle, onSettle);
10347
+ }
10334
10348
  function trackThenable(thenable) {
10335
10349
  if (thenable.status !== void 0) return;
10336
10350
  thenable.status = "pending";
@@ -11183,16 +11197,16 @@ function template(html, ns = 0, frag = 0) {
11183
11197
  }
11184
11198
  };
11185
11199
  }
11186
- function templateRootDescriptor(html) {
11187
- if (html.charCodeAt(0) !== 60) return 3;
11188
- const c = html.charCodeAt(1);
11200
+ function templateRootDescriptor(html, at = 0) {
11201
+ if (html.charCodeAt(at) !== 60) return 3;
11202
+ const c = html.charCodeAt(at + 1);
11189
11203
  if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90)) return 8;
11190
- let i = 2;
11204
+ let i = at + 2;
11191
11205
  for (; i < html.length; i++) {
11192
11206
  const cc = html.charCodeAt(i);
11193
11207
  if (cc === 62 || cc === 47 || cc <= 32) break;
11194
11208
  }
11195
- return html.slice(1, i);
11209
+ return html.slice(at + 1, i);
11196
11210
  }
11197
11211
  function lazyRootDescriptor(lazy2) {
11198
11212
  const root = lazy2.root;
@@ -11208,6 +11222,16 @@ function lazyRootMatches(server, lazy2) {
11208
11222
  if (server.nodeType !== 1) return false;
11209
11223
  return server.localName === root;
11210
11224
  }
11225
+ function lazyFragmentRootMatches(server, lazy2) {
11226
+ const root = lazy2.frag !== 0 ? lazyRootDescriptor(lazy2) : templateRootDescriptor(
11227
+ lazy2.html,
11228
+ 13
11229
+ /* '<octane-frag>'.length */
11230
+ );
11231
+ if (root === 8) return true;
11232
+ if (root === 3) return server.nodeType === 3;
11233
+ return server.nodeType === 1 && server.localName === root;
11234
+ }
11211
11235
  function resolveLazyTemplate(lazy2) {
11212
11236
  let ns;
11213
11237
  if (lazy2.ns === 3) {
@@ -11224,6 +11248,8 @@ function resolveLazyTemplate(lazy2) {
11224
11248
  return parsed;
11225
11249
  }
11226
11250
  let currentHydration = null;
11251
+ let HYDRATION_REBUILT = null;
11252
+ let HYDRATION_REBUILT_HOSTS = null;
11227
11253
  function activeHydration() {
11228
11254
  const hydration = currentHydration;
11229
11255
  return hydration !== null && hydration.isActive() ? hydration : null;
@@ -11231,6 +11257,31 @@ function activeHydration() {
11231
11257
  function isRendererHydrationStyle(node) {
11232
11258
  return node.nodeType === 1 && node.localName === "style" && (STAGED_DOM?.view(node) ?? node).hasAttribute("data-octane");
11233
11259
  }
11260
+ function isFloatHeadResource(node) {
11261
+ if (node.nodeType !== 1) return false;
11262
+ const el = STAGED_DOM?.view(node) ?? node;
11263
+ const tag = el.localName;
11264
+ return (tag === "link" || tag === "style" || tag === "script") && (el.hasAttribute("data-precedence") || el.hasAttribute("data-oct-hint") || el.hasAttribute("data-oct-res"));
11265
+ }
11266
+ function skipFoldedHeadPrefix(container, node) {
11267
+ const head = container.nodeType === 9 ? null : container.ownerDocument.head;
11268
+ while (node !== null) {
11269
+ if (node.nodeType === 10 || isRendererHydrationStyle(node) || isFloatHeadResource(node)) {
11270
+ node = getNextSibling(node);
11271
+ continue;
11272
+ }
11273
+ const el = head !== null && node.nodeType === 8 ? getNextSibling(node) : null;
11274
+ const end = el === null ? null : getNextSibling(el);
11275
+ if (end === null || end.nodeType !== 8) return node;
11276
+ const key = (STAGED_DOM?.view(node) ?? node).data;
11277
+ if (!key.startsWith("rnh-") || (STAGED_DOM?.view(end) ?? end).data !== "/" + key)
11278
+ return node;
11279
+ const next = getNextSibling(end);
11280
+ (STAGED_DOM?.view(head) ?? head).append(node, el, end);
11281
+ node = next;
11282
+ }
11283
+ return null;
11284
+ }
11234
11285
  class HydrationCapability {
11235
11286
  constructor(rootBlock, node, seeds) {
11236
11287
  this.rootBlock = rootBlock;
@@ -11260,6 +11311,8 @@ class HydrationCapability {
11260
11311
  textWarnings = /* @__PURE__ */ new Map();
11261
11312
  /** Skip component-frame adoption until the declared container owner. */
11262
11313
  passthroughRanges = false;
11314
+ /** A slot lent a server range whose first render has yet to claim it. */
11315
+ lentSlot = null;
11263
11316
  nativeAdoption;
11264
11317
  retryPresentation;
11265
11318
  presentation;
@@ -11313,6 +11366,147 @@ class HydrationCapability {
11313
11366
  warnStructural(loc, expected, actual) {
11314
11367
  warnHydrationStructuralMismatch(loc, expected, actual);
11315
11368
  }
11369
+ /**
11370
+ * A slot for the range `start`…`end` that a list item or a returning
11371
+ * component adopted, lent to the child slot that renders its value, so that
11372
+ * the value hydrates inside that range rather than claiming a range of its
11373
+ * own. The slot's first render claims the server range as an adopted one.
11374
+ */
11375
+ lendRange(start, end) {
11376
+ const slot = {
11377
+ __kind: "childSlot",
11378
+ start,
11379
+ end,
11380
+ ownerHost: null,
11381
+ borrowed: true,
11382
+ compactable: false,
11383
+ block: null,
11384
+ text: null,
11385
+ currentComp: null,
11386
+ currentIsBodyFn: false,
11387
+ forSlot: null,
11388
+ hostNode: null,
11389
+ portal: null
11390
+ };
11391
+ if (this.isOpen(start)) this.lentSlot = slot;
11392
+ return slot;
11393
+ }
11394
+ /**
11395
+ * Before a child slot's first hydrating render of the server range
11396
+ * `start`…`end`, which it adopted or was lent, check that `value` can adopt
11397
+ * what the range holds. A host descriptor serializes as exactly one element
11398
+ * of its tag. A list (`list`, from prepareDeoptList) frames or self-delimits
11399
+ * each of its items, so it neither leaves the range empty nor opens it with
11400
+ * text, unless it has no items, and then the range is empty. A portal does
11401
+ * not open it with text either. Anything else is server content the client
11402
+ * cannot adopt: what the server rendered for another value, or invalid
11403
+ * nesting that the HTML parser repaired (`<p><div></div></p>` arrives as
11404
+ * `<p></p><div></div><p></p>`, all inside the range). Discard it, as
11405
+ * renderBranchSlot's rebuild does. Returns whether it did, in which case the
11406
+ * caller builds the value as a client mount would.
11407
+ */
11408
+ claimRange(scope, slotKey, start, end, value, list) {
11409
+ const rebuilt = HYDRATION_REBUILT?.has(end) === true;
11410
+ const type = list === null && isHostDescriptor(value) ? value.type : null;
11411
+ if (!rebuilt && type === null && list === null && value?.$$kind !== PORTAL_TAG)
11412
+ return false;
11413
+ const first = getNextSibling(start);
11414
+ const matches = type !== null && first !== end && first.nodeType === 1 && isHostElementOfType(first, type);
11415
+ if (!rebuilt && (type !== null ? matches && getNextSibling(first) === end : list !== null && first === end ? list.items.length === 0 : first.nodeType !== 3 && list?.items.length !== 0))
11416
+ return false;
11417
+ return this.discard(
11418
+ scope,
11419
+ slotKey,
11420
+ first,
11421
+ end,
11422
+ // Items that render nothing differ from an empty range only in the
11423
+ // frames the server would have given them: rebuild those quietly.
11424
+ rebuilt || list !== null && first === end && !list.items.some((item) => item != null && typeof item !== "boolean" && item !== ""),
11425
+ process.env.NODE_ENV !== "production" ? type !== null ? matches ? `the end of <${type}>` : `<${type}>` : list?.items.length === 0 ? "nothing" : list !== null ? "a renderable list range" : "a portal" : "",
11426
+ matches ? getNextSibling(first) : first === end ? null : first
11427
+ );
11428
+ }
11429
+ /**
11430
+ * A child slot's first hydrating render without a server range of its own,
11431
+ * such as a return slot's when its component's range holds server text. A
11432
+ * list, a fragment, a keyed or lone element, and a portal never serialize as
11433
+ * bare text, so a lone text node before `end` in `parent` is what the server
11434
+ * rendered for a primitive, which the value cannot adopt. Discard it; returns
11435
+ * whether it did. An earlier attempt that did so left its own content there.
11436
+ */
11437
+ discardServerText(scope, slotKey, parent, end, value, list) {
11438
+ const text = this.node;
11439
+ if (end !== null && HYDRATION_REBUILT?.has(end) === true) {
11440
+ let node = text;
11441
+ while (node !== null && node !== end) node = getNextSibling(node);
11442
+ return this.discard(scope, slotKey, node === end ? text : null, end, true, "", null);
11443
+ }
11444
+ if (text === null || text.nodeType !== 3 || !(list || value?.$$kind === PORTAL_TAG || isHostDescriptor(value)) || domNode(text).parentNode !== parent || getNextSibling(text) !== end)
11445
+ return false;
11446
+ return this.discard(
11447
+ scope,
11448
+ slotKey,
11449
+ text,
11450
+ end,
11451
+ false,
11452
+ process.env.NODE_ENV !== "production" ? list ? "a renderable list range" : value.$$kind === PORTAL_TAG ? "a portal" : `<${value.type}>` : "",
11453
+ text
11454
+ );
11455
+ }
11456
+ /**
11457
+ * A list item's first hydrating render where the server content at the
11458
+ * cursor cannot be that item: the server rendered fewer items, a bare item
11459
+ * where this one needs a range of its own, or an item of another tag.
11460
+ * Discard the list's server content from the cursor to its `end`, so that
11461
+ * this item and every later one build as a client mount would. The list
11462
+ * reports once, and an earlier attempt that rebuilt it left its own content.
11463
+ */
11464
+ discardItems(end, expected) {
11465
+ const from = this.node;
11466
+ let node = from;
11467
+ while (node !== null && node !== end) node = getNextSibling(node);
11468
+ const stale = node === end && from !== end ? from : null;
11469
+ this.discard(null, 0, stale, end, HYDRATION_REBUILT?.has(end) === true, expected, stale);
11470
+ }
11471
+ /**
11472
+ * STRUCTURAL recovery for a list where the SERVER rendered MORE items than the
11473
+ * client now renders: after its first fill adopts the client's items, the
11474
+ * cursor sits on the first unconsumed server item (or at `end`). Discard
11475
+ * everything between the cursor and `end` so the extra server items don't
11476
+ * linger. Only when the cursor precedes `end`; stops AT `end`.
11477
+ */
11478
+ discardLeftoverItems(end) {
11479
+ const from = this.node;
11480
+ if (from === end) return;
11481
+ let node = from;
11482
+ while (node !== null && node !== end) node = getNextSibling(node);
11483
+ if (node === null) return;
11484
+ if (!this.staleServerValues)
11485
+ noteRecoverableHydrationError(() => new Error(formatClientError(56)));
11486
+ removeRange(from, end);
11487
+ }
11488
+ /**
11489
+ * Remove the server content from `from` up to `end` that a child slot's
11490
+ * value cannot adopt, and point the cursor at `end`. Reports the structural
11491
+ * mismatch (`expected`, and the `actual` server node, describe it in
11492
+ * development) unless it is `quiet`, as it is when an earlier attempt already
11493
+ * rebuilt this content, or the captures legitimately changed before a dormant
11494
+ * boundary activated. Remembers `end` for later attempts.
11495
+ */
11496
+ discard(scope, slotKey, from, end, quiet, expected, actual) {
11497
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11498
+ if (!quiet && !this.staleServerValues) {
11499
+ noteRecoverableHydrationError(() => new Error(formatClientError(51)));
11500
+ if (process.env.NODE_ENV !== "production") {
11501
+ const loc = scope !== null && (siteLoc(scope, slotKey) || componentSourceLoc(scope.block.body)) || domNode(from ?? end).parentNode?.__oct_loc;
11502
+ if (loc) warnHydrationStructuralMismatch(loc, expected, describeHydrationNode(actual));
11503
+ }
11504
+ }
11505
+ removeRange(from, end);
11506
+ if (end !== null) (HYDRATION_REBUILT ??= /* @__PURE__ */ new WeakSet()).add(end);
11507
+ this.node = end;
11508
+ return true;
11509
+ }
11316
11510
  recordTextMismatch(node, loc, server) {
11317
11511
  if (this.staleServerValues) return;
11318
11512
  if (process.env.NODE_ENV === "production" && ROOT_ERROR_HANDLERS === null) return;
@@ -11333,6 +11527,35 @@ class HydrationCapability {
11333
11527
  removeRange(start, end) {
11334
11528
  removeHydrationRange(start, end);
11335
11529
  }
11530
+ /**
11531
+ * Runs before the first hydrating render of a text or empty value `str` in a
11532
+ * child slot that adopted the server's `<!--[-->…<!--]-->` range. The value
11533
+ * serializes as at most one text node there, which the slot adopts when it
11534
+ * leads the range. Anything else in the range is server content the client
11535
+ * cannot adopt, such as an element or component the server rendered for a
11536
+ * value the client renders as text or nothing. Discard it and report the
11537
+ * recovery, as claimRange does for a host descriptor.
11538
+ */
11539
+ discardUnadoptedText(scope, slotKey, state, str) {
11540
+ const end = state.end;
11541
+ const first = getNextSibling(state.start);
11542
+ const kept = str !== "" && first.nodeType === 3;
11543
+ const stale = kept ? getNextSibling(first) : first;
11544
+ if (stale === end) return;
11545
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11546
+ if (!this.staleServerValues) {
11547
+ noteRecoverableHydrationError(() => new Error(formatClientError(51)));
11548
+ if (process.env.NODE_ENV !== "production") {
11549
+ const loc = siteLoc(scope, slotKey);
11550
+ if (loc) {
11551
+ const client = str === "" ? "nothing" : `text ${JSON.stringify(str)}`;
11552
+ this.warnStructural(loc, kept ? `the end of ${client}` : client, this.describe(stale));
11553
+ }
11554
+ }
11555
+ }
11556
+ removeRange(stale, end);
11557
+ if (!kept) this.node = end;
11558
+ }
11336
11559
  parseSeeds(raw) {
11337
11560
  return parseSeedJson(raw);
11338
11561
  }
@@ -11428,6 +11651,14 @@ class HydrationCapability {
11428
11651
  isUnframedRootRange(start, end) {
11429
11652
  return this.unframedRootRanges.get(start) === end;
11430
11653
  }
11654
+ /**
11655
+ * Whether `block`'s server range holds only unclaimed text at the cursor:
11656
+ * what the server rendered for a primitive.
11657
+ */
11658
+ holdsServerText(block) {
11659
+ const text = this.node;
11660
+ return text !== null && text.nodeType === 3 && getNextSibling(block.startMarker) === text && getNextSibling(text) === block.endMarker;
11661
+ }
11431
11662
  /** Record the first node outside a root-owned range exactly once. */
11432
11663
  claimRootRemainder(node) {
11433
11664
  if (this.rootRemainder === void 0) this.rootRemainder = node;
@@ -11570,14 +11801,7 @@ class HydrationCapability {
11570
11801
  const target = CURRENT_BLOCK?.parentNode;
11571
11802
  if (!claimsRoot && target != null && (STAGED_DOM?.view(cursor) ?? cursor).parentNode !== target)
11572
11803
  return this.freshClone(template2);
11573
- if (isBlockOpen(cursor)) {
11574
- const close = this.close(cursor);
11575
- this.node = getNextSibling(close);
11576
- removeHydrationRange(cursor, close);
11577
- } else {
11578
- this.node = getNextSibling(cursor);
11579
- (STAGED_DOM?.view(cursor) ?? cursor).remove();
11580
- }
11804
+ this.discardCursor(cursor);
11581
11805
  if (claimsRoot)
11582
11806
  this.claimRootRemainder(
11583
11807
  framedRemainder === void 0 ? unframedRemainder ?? null : framedRemainder
@@ -11585,7 +11809,9 @@ class HydrationCapability {
11585
11809
  return this.freshClone(template2);
11586
11810
  }
11587
11811
  if (isFragment) {
11588
- return { __oct_vfrag: true, firstChild: cursor };
11812
+ if (claimsRoot || (template2 !== null ? fragmentRootMatches(cursor, template2, partialStyles) : lazyFragmentRootMatches(cursor, lazy2)))
11813
+ return { __oct_vfrag: true, firstChild: cursor };
11814
+ return this.rebuildFragment(template2 ?? resolveLazyTemplate(lazy2), cursor, loc);
11589
11815
  }
11590
11816
  if (claimsRoot)
11591
11817
  this.claimRootRemainder(
@@ -11593,6 +11819,52 @@ class HydrationCapability {
11593
11819
  );
11594
11820
  return cursor;
11595
11821
  }
11822
+ /**
11823
+ * The server rendered something other than this nested fragment at the
11824
+ * cursor (a text value, another component's roots). Report it once and build
11825
+ * the fragment on the client. The fragment's block owns the server nodes from
11826
+ * the cursor up to its end marker, where drainFrag inserts the fresh roots, so
11827
+ * discard them. When the end marker does not follow the cursor inside the
11828
+ * block's range, discard only the cursor node or its range, as a single-root
11829
+ * mismatch does.
11830
+ */
11831
+ rebuildFragment(template2, cursor, loc) {
11832
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11833
+ if (!this.staleServerValues) {
11834
+ noteRecoverableHydrationError(() => new Error(formatClientError(51)));
11835
+ if (process.env.NODE_ENV !== "production")
11836
+ warnHydrationStructuralMismatch(
11837
+ loc ?? componentSourceLoc(CURRENT_BLOCK?.body) ?? CURRENT_SCOPE?.locFile,
11838
+ `a fragment starting with ${describeHydrationNode(getFirstChild(template2))}`,
11839
+ describeHydrationNode(cursor)
11840
+ );
11841
+ }
11842
+ const block = CURRENT_SCOPE?.block;
11843
+ const parent = block?.parentNode;
11844
+ const end = block?.endMarker ?? null;
11845
+ if (parent == null || cursor === end || (STAGED_DOM?.view(cursor) ?? cursor).parentNode !== parent)
11846
+ return this.freshClone(template2);
11847
+ let node = cursor;
11848
+ if (end !== null)
11849
+ while (node !== null && node !== end && node !== block.startMarker)
11850
+ node = getNextSibling(node);
11851
+ if (node === end) {
11852
+ this.node = end;
11853
+ removeHydrationRange(cursor, (STAGED_DOM?.view(end) ?? end).previousSibling);
11854
+ } else this.discardCursor(cursor);
11855
+ return this.freshClone(template2);
11856
+ }
11857
+ /** Discard a mismatched server node (or the marker range it opens) and step past it. */
11858
+ discardCursor(cursor) {
11859
+ if (isBlockOpen(cursor)) {
11860
+ const close = this.close(cursor);
11861
+ this.node = getNextSibling(close);
11862
+ removeHydrationRange(cursor, close);
11863
+ } else {
11864
+ this.node = getNextSibling(cursor);
11865
+ (STAGED_DOM?.view(cursor) ?? cursor).remove();
11866
+ }
11867
+ }
11596
11868
  /** Remove server siblings left after the root's complete client shape was adopted. */
11597
11869
  finishRoot() {
11598
11870
  if (this.abandoned) return;
@@ -11616,6 +11888,18 @@ class HydrationCapability {
11616
11888
  this.node = null;
11617
11889
  this.rootRemainder = null;
11618
11890
  }
11891
+ /**
11892
+ * Whether the server framed `el`'s only child in a `<!--[-->…<!--]-->` range
11893
+ * holding something other than one text node or nothing. htext unwraps a
11894
+ * text-only frame; any other framed content belongs to a child slot.
11895
+ */
11896
+ framesSlotContent(el) {
11897
+ const first = getFirstChild(el);
11898
+ if (!this.isOpen(first)) return false;
11899
+ let next = getNextSibling(first);
11900
+ if (next !== null && next.nodeType === 3) next = getNextSibling(next);
11901
+ return !this.isClose(next);
11902
+ }
11619
11903
  htext(el, text, loc) {
11620
11904
  const first = getFirstChild(el);
11621
11905
  if (first !== null && first.nodeType === 3) {
@@ -11651,6 +11935,78 @@ class HydrationCapability {
11651
11935
  (STAGED_DOM?.view(el) ?? el).appendChild(created);
11652
11936
  return created;
11653
11937
  }
11938
+ /**
11939
+ * childTextHole's first hydrating render of an element, a component, or a
11940
+ * list. The server frames such a value in a `<!--[-->…<!--]-->` range, which
11941
+ * the hole's child slot adopts from the cursor. Anything else in the host is
11942
+ * the text, or nothing, that the server rendered for a primitive value, which
11943
+ * none of these values can adopt: discard it, report the recovery, and build
11944
+ * the value as a client mount would. A textarea's text is its default value,
11945
+ * which its value props own, so it stays. `render` is the hole's childSlot
11946
+ * call, passed in so that hydration alone never retains the child-slot graph.
11947
+ */
11948
+ hydrateOnlyChild(scope, slotKey, el, render) {
11949
+ let stale = getFirstChild(el);
11950
+ const rebuilt = HYDRATION_REBUILT_HOSTS?.has(el) === true;
11951
+ if (!rebuilt && this.isOpen(stale)) {
11952
+ this.node = stale;
11953
+ render();
11954
+ return;
11955
+ }
11956
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11957
+ if (stale !== null) {
11958
+ if (el.localName === "textarea") stale = getNextSibling(stale);
11959
+ else if (!rebuilt && !this.staleServerValues) {
11960
+ noteRecoverableHydrationError(() => new Error(formatClientError(51)), this.rootBlock);
11961
+ if (process.env.NODE_ENV !== "production")
11962
+ warnHydrationStructuralMismatch(
11963
+ siteLoc(scope, slotKey) || el.__oct_loc,
11964
+ "a renderable range",
11965
+ describeHydrationNode(stale)
11966
+ );
11967
+ }
11968
+ }
11969
+ while (stale !== null) {
11970
+ const next = getNextSibling(stale);
11971
+ (STAGED_DOM?.view(el) ?? el).removeChild(stale);
11972
+ stale = next;
11973
+ }
11974
+ (HYDRATION_REBUILT_HOSTS ??= /* @__PURE__ */ new WeakSet()).add(el);
11975
+ this.suspend(render);
11976
+ }
11977
+ /**
11978
+ * htext's counterpart for an only-child hole whose first hydrating value
11979
+ * renders nothing (`null`, `undefined`, a boolean, or `''`). The server
11980
+ * serializes that as no children, or as an empty `<!--[--><!--]-->` frame,
11981
+ * which unwraps like htext's text-only frame. Anything else is server content
11982
+ * the client renders no node for, so a later value would land beside it.
11983
+ * Discard it and report the recovery as htext reports extra children.
11984
+ * A textarea's text is its default value, which its value props own.
11985
+ */
11986
+ hempty(el, loc) {
11987
+ const first = getFirstChild(el);
11988
+ if (first === null || el.localName === "textarea") return;
11989
+ const next = getNextSibling(first);
11990
+ const framed = this.isOpen(first);
11991
+ if (framed && this.isClose(next) && getNextSibling(next) === null) {
11992
+ (STAGED_DOM?.view(first) ?? first).remove();
11993
+ (STAGED_DOM?.view(next) ?? next).remove();
11994
+ return;
11995
+ }
11996
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
11997
+ if (!this.staleServerValues) {
11998
+ noteRecoverableHydrationError(() => new Error(formatClientError(62)), this.rootBlock);
11999
+ if (process.env.NODE_ENV !== "production") {
12000
+ warnHydrationStructuralMismatch(
12001
+ loc || el.__oct_loc,
12002
+ "nothing",
12003
+ describeHydrationNode(framed && next !== null ? next : first)
12004
+ );
12005
+ }
12006
+ }
12007
+ for (let n = getFirstChild(el); n !== null; n = getFirstChild(el))
12008
+ (STAGED_DOM?.view(el) ?? el).removeChild(n);
12009
+ }
11654
12010
  htextSwap(posNode, text) {
11655
12011
  if (isEmptyTextSlot(posNode)) {
11656
12012
  const empty = (STAGED_DOM?.view(document) ?? document).createTextNode("");
@@ -12019,6 +12375,43 @@ function htextSwap(posNode, value) {
12019
12375
  (STAGED_DOM?.view(parent) ?? parent).replaceChild(t, posNode);
12020
12376
  return t;
12021
12377
  }
12378
+ function rejectTextareaChild(child2) {
12379
+ throw new Error(formatClientError(336, describeTextareaChild(child2, isElementDescriptor)));
12380
+ }
12381
+ function textareaPartText(part, textHole2) {
12382
+ return textHole2 ? coerceText(part) : textareaChildText(part, rejectTextareaChild);
12383
+ }
12384
+ function joinTextareaParts(parts, textHoles, read) {
12385
+ let text = "";
12386
+ for (let i = 0; i < parts.length; i++) {
12387
+ const part = parts[i];
12388
+ text += textareaPartText(
12389
+ isSignalHandle(part) ? read(part) : part,
12390
+ textHoles !== void 0 && textHoles.charCodeAt(i) === 116
12391
+ // 't'
12392
+ );
12393
+ }
12394
+ return text;
12395
+ }
12396
+ function textareaText(parts, textHoles) {
12397
+ let handles;
12398
+ for (const part of parts) if (isSignalHandle(part)) (handles ??= []).push(part);
12399
+ if (handles === void 0) return joinTextareaParts(parts, textHoles, readSignalBinding);
12400
+ const signals = handles;
12401
+ return {
12402
+ [SIGNAL_HANDLE]: true,
12403
+ kind: "derived",
12404
+ key: signals.map((handle) => handle.key).join("+"),
12405
+ [SIGNAL_BINDING_READ]: () => joinTextareaParts(parts, textHoles, readSignalBinding),
12406
+ get: () => joinTextareaParts(parts, textHoles, (handle) => handle.get()),
12407
+ [SIGNAL_BINDING_SUBSCRIBE](notify, onRetire) {
12408
+ const stops = signals.map((handle) => handle[SIGNAL_BINDING_SUBSCRIBE](notify, onRetire));
12409
+ return () => {
12410
+ for (const stop of stops) stop();
12411
+ };
12412
+ }
12413
+ };
12414
+ }
12022
12415
  function bindingText(posNode, value, marker) {
12023
12416
  const text = coerceText(value);
12024
12417
  const hydration = activeHydration();
@@ -12323,9 +12716,9 @@ function preparePresentationSignalBinding(args, frame, text = false) {
12323
12716
  if (witness >= 0)
12324
12717
  frame.witnesses.set(handle, finishNativeReadWitness(witness, readCompleted));
12325
12718
  }
12326
- if (text && (current !== null && (typeof current === "object" || typeof current === "function") || typeof args[7] !== "string"))
12719
+ if (text && (current !== null && (typeof current === "object" || typeof current === "function") || typeof args[8] !== "string"))
12327
12720
  presentationMiss(false);
12328
- const prepared = text ? bindingText(element, current, args[7]) : preparedPresentationAttribute(element, name, current, attributeKind);
12721
+ const prepared = text ? bindingText(element, current, args[8]) : preparedPresentationAttribute(element, name, current, attributeKind);
12329
12722
  if (handle === null) {
12330
12723
  if (text) {
12331
12724
  frame.writes.get(element)?.delete("signalText");
@@ -12615,8 +13008,7 @@ function presentationStructure(writer, kind, marker, ...args) {
12615
13008
  if (frame?.revision === void 0) return writer(...args);
12616
13009
  const hydration = activeHydration();
12617
13010
  if (hydration === null) presentationMiss(false);
12618
- const anchorIndex = kind === "if" ? 6 : 5;
12619
- const start = hydration.resolveOpen(args[anchorIndex] ?? null, args[2]);
13011
+ const start = hydration.resolveOpen(args[6] ?? null, args[2]);
12620
13012
  if (kind === "if") {
12621
13013
  const arm = args[3] ? args[4] === null ? -1 : 0 : args[5] === null ? -1 : 1;
12622
13014
  const range2 = presentationRange(frame, start, marker + arm, kind);
@@ -13109,8 +13501,8 @@ function bindDirectSignal(scope, previous, target, value, site, policy, name, at
13109
13501
  }
13110
13502
  return binding;
13111
13503
  }
13112
- function bindSignalText(scope, previous, position, value, site, onlyChild = false, seededText = void 0, bindingMarker, previousValue) {
13113
- if (previous instanceof Text && arguments.length > 8 && previousValue === value && !isSignalHandle(value))
13504
+ function bindSignalText(scope, previous, position, value, site, onlyChild = false, previousValue, seededText = void 0, bindingMarker) {
13505
+ if (previous instanceof Text && arguments.length > 6 && previousValue === value && !isSignalHandle(value))
13114
13506
  return previous;
13115
13507
  if (previous === void 0 && bindingMarker !== void 0) {
13116
13508
  const existing = activeHydration() !== null ? getNextSibling(position) : null;
@@ -13629,15 +14021,16 @@ class FragmentInstance {
13629
14021
  }
13630
14022
  /**
13631
14023
  * Blur the focused element only when a logical fragment child owns it,
13632
- * including children rendered into foreign portal containers.
14024
+ * including children rendered into foreign portal containers. Each child is
14025
+ * checked against its own focus root, so shadow-root and iframe portal
14026
+ * children resolve to the owned element rather than their host or frame.
13633
14027
  */
13634
14028
  blur() {
13635
14029
  if (this._destroyed) return;
13636
- const doc = this._startMarker.ownerDocument || document;
13637
- const active = doc.activeElement;
13638
- if (!active || active === doc.body) return;
13639
14030
  for (const child2 of fragmentDirectChildren(this)) {
13640
- if (child2 === active || (STAGED_DOM?.view(child2) ?? child2).contains(active)) {
14031
+ const root = (STAGED_DOM?.view(child2) ?? child2).getRootNode();
14032
+ const active = root.activeElement;
14033
+ if (active && (child2 === active || (STAGED_DOM?.view(child2) ?? child2).contains(active))) {
13641
14034
  (STAGED_DOM?.view(active) ?? active).blur();
13642
14035
  return;
13643
14036
  }
@@ -14004,6 +14397,10 @@ const HTML_NS = "http://www.w3.org/1999/xhtml";
14004
14397
  function isHtmlCustomElement(el) {
14005
14398
  return el.namespaceURI === HTML_NS && el.localName.indexOf("-") !== -1;
14006
14399
  }
14400
+ function isHostElementOfType(el, type) {
14401
+ const name = el.localName;
14402
+ return name === type || name === type.toLowerCase() && el.namespaceURI === HTML_NS;
14403
+ }
14007
14404
  function inferTagNs(tag, inherited) {
14008
14405
  if (tag === "svg") return SVG_NS;
14009
14406
  if (tag === "math") return MATHML_NS;
@@ -14701,7 +15098,8 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false,
14701
15098
  props.get("defaultValue")?.value,
14702
15099
  props.get("checked")?.value,
14703
15100
  props.get("defaultChecked")?.value,
14704
- props.get("multiple")?.value
15101
+ props.get("multiple")?.value,
15102
+ hasNestedChildren || props.has("children")
14705
15103
  );
14706
15104
  return resolved;
14707
15105
  }
@@ -16608,7 +17006,8 @@ function armControlledBase(el) {
16608
17006
  compositionEndTask: void 0,
16609
17007
  queued: false,
16610
17008
  formSeen: false,
16611
- formMultiple: false
17009
+ formMultiple: false,
17010
+ formChildren: false
16612
17011
  };
16613
17012
  (STAGED_DOM?.view(el) ?? el).$$ctrl = ctrl;
16614
17013
  delegateEvents(RESTORE_EVENT_LIST);
@@ -17071,7 +17470,7 @@ function setFormControlSources(el, sources) {
17071
17470
  }
17072
17471
  applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple);
17073
17472
  }
17074
- function applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple) {
17473
+ function applyFormControlValues(el, tag, value, defaultValue, checked, defaultChecked, multiple, hasChildren = false) {
17075
17474
  const ctrl = armControlled(el);
17076
17475
  const first = !ctrl.formSeen;
17077
17476
  const previousMultiple = ctrl.formMultiple;
@@ -17101,10 +17500,12 @@ function applyFormControlValues(el, tag, value, defaultValue, checked, defaultCh
17101
17500
  }
17102
17501
  if (tag === "textarea") {
17103
17502
  const textarea = el;
17503
+ const childrenOwned = ctrl.formChildren;
17504
+ ctrl.formChildren = hasChildren;
17104
17505
  setValue(textarea, value);
17105
17506
  if (value == null) {
17106
17507
  if (defaultValue != null) setDefaultValue(textarea, defaultValue, first);
17107
- else if (!first && (STAGED_DOM?.view(textarea) ?? textarea).defaultValue !== "")
17508
+ else if (!first && !childrenOwned && (STAGED_DOM?.view(textarea) ?? textarea).defaultValue !== "")
17108
17509
  (STAGED_DOM?.view(textarea) ?? textarea).defaultValue = "";
17109
17510
  }
17110
17511
  return;
@@ -17455,7 +17856,8 @@ function portal(parentScope, slotKey, target, body, props, host, env, fragmentOw
17455
17856
  if (prev !== state) {
17456
17857
  journalRootProperty(parentScope.slots, slotKey, parentScope.slots[slotKey]);
17457
17858
  parentScope.slots[slotKey] = state;
17458
- registerSlot(parentScope, state);
17859
+ if (prev === void 0) registerSlot(parentScope, state);
17860
+ else replacePortalSlot(parentScope, prev, state);
17459
17861
  }
17460
17862
  if (fragmentOwners !== void 0 && fragmentAnchor !== void 0) {
17461
17863
  registerFragmentPortalOwners(state, fragmentOwners, fragmentAnchor);
@@ -17475,6 +17877,16 @@ function portal(parentScope, slotKey, target, body, props, host, env, fragmentOw
17475
17877
  }
17476
17878
  }
17477
17879
  }
17880
+ function replacePortalSlot(scope, prev, state) {
17881
+ const slots = scope._slots;
17882
+ const index = slots === null ? -1 : slots.indexOf(prev);
17883
+ if (index === -1) {
17884
+ registerSlot(scope, state);
17885
+ return;
17886
+ }
17887
+ journalRootProperty(slots, index, prev);
17888
+ slots[index] = state;
17889
+ }
17478
17890
  function prepareFragmentPortalInterleaving(portal2) {
17479
17891
  const start = portal2.start;
17480
17892
  const end = portal2.end;
@@ -17622,8 +18034,9 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
17622
18034
  );
17623
18035
  }
17624
18036
  const norm = normalizePortalBody(rawBody, rawProps);
18037
+ const childType = portalChildType(rawBody, norm.body);
17625
18038
  let state = prev;
17626
- if (state === null || state.target !== target || state.key !== key) {
18039
+ if (state === null || state.target !== target || state.key !== key || state.childType !== childType) {
17627
18040
  if (state !== null) teardownPortalState(state);
17628
18041
  const start = (STAGED_DOM?.view(document) ?? document).createComment("portal");
17629
18042
  const end = (STAGED_DOM?.view(document) ?? document).createComment("/portal");
@@ -17642,9 +18055,9 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
17642
18055
  renderReturnedValue
17643
18056
  );
17644
18057
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
17645
- __profileTrackComponent(block, profilePortalComponent(rawBody));
18058
+ __profileTrackComponent(block, profilePortalComponent(rawBody, norm.body));
17646
18059
  }
17647
- state = { __kind: "portalSlotSlot", block, target, key, host, start, end };
18060
+ state = { __kind: "portalSlotSlot", block, target, key, childType, host, start, end };
17648
18061
  registerPortalEventRange(target, state);
17649
18062
  activityPortalCreated?.(block);
17650
18063
  registerDelegationTarget(target);
@@ -17668,7 +18081,7 @@ function renderPortalState(prev, parentBlock, target, rawBody, rawProps, host, e
17668
18081
  state.block.props = norm.props;
17669
18082
  state.block.extra = env;
17670
18083
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
17671
- __profileTrackComponent(state.block, profilePortalComponent(rawBody));
18084
+ __profileTrackComponent(state.block, profilePortalComponent(rawBody, norm.body));
17672
18085
  }
17673
18086
  renderBlock(state.block);
17674
18087
  }
@@ -17713,7 +18126,7 @@ function normalizePortalBody(rawBody, rawProps) {
17713
18126
  if (typeof rawBody === "function") {
17714
18127
  return { body: rawBody, props: rawProps };
17715
18128
  }
17716
- if (rawBody != null && rawBody.$$kind === ELEMENT_TAG && typeof rawBody.type === "function") {
18129
+ if (rawBody != null && rawBody.$$kind === ELEMENT_TAG && typeof rawBody.type === "function" && rawBody.key === null) {
17717
18130
  return {
17718
18131
  body: rawBody.type,
17719
18132
  props: rawBody.props
@@ -17724,6 +18137,9 @@ function normalizePortalBody(rawBody, rawProps) {
17724
18137
  props: rawBody
17725
18138
  };
17726
18139
  }
18140
+ function portalChildType(rawBody, body) {
18141
+ return typeof rawBody === "function" ? null : body;
18142
+ }
17727
18143
  function genericPortalBody(value, scope) {
17728
18144
  childSlot(scope, 0, scope.parentNode, value, scope.endMarker);
17729
18145
  }
@@ -17889,6 +18305,12 @@ const SCOPED_VALUE_PROPERTIES = {
17889
18305
  function createScopedValue(readElement) {
17890
18306
  return scopedValueDescriptor(createScopedResolver(readElement));
17891
18307
  }
18308
+ function isRenderCall(scope) {
18309
+ return scope === CURRENT_SCOPE && scope !== null;
18310
+ }
18311
+ function deferRecord(read, ...locals) {
18312
+ return createScopedValue(() => read(...locals));
18313
+ }
17892
18314
  function nativeCreateScopedValue(readElement) {
17893
18315
  return scopedValueDescriptor(createNativeScopedResolver(readElement));
17894
18316
  }
@@ -18270,7 +18692,7 @@ const Children = {
18270
18692
  }
18271
18693
  };
18272
18694
  const NO_KEY = /* @__PURE__ */ Symbol("NO_KEY");
18273
- function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
18695
+ function componentSlot(parentScope, slotKey, domParent, comp, props, invocationSite, anchor, singleRoot, inherit, key, hasKey) {
18274
18696
  const dispatch = activityDescriptorDispatch;
18275
18697
  const activity = dispatch !== null && comp === dispatch.type;
18276
18698
  if (!activity && typeof comp !== "function" && typeof comp !== "string") {
@@ -18310,7 +18732,7 @@ function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key
18310
18732
  invocationSite
18311
18733
  );
18312
18734
  }
18313
- function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
18735
+ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, invocationSite, anchor, singleRoot, inherit, key, hasKey) {
18314
18736
  if (typeof comp !== "function") throw invalidElementTypeError(comp);
18315
18737
  componentSlotImpl(
18316
18738
  null,
@@ -19044,7 +19466,7 @@ function hasDangerHTML(props) {
19044
19466
  return true;
19045
19467
  }
19046
19468
  function hasHostPropContent(descriptor) {
19047
- return hasDangerHTML(descriptor.props) || descriptor.type === "textarea" && (descriptor.props?.value != null || descriptor.props?.defaultValue != null);
19469
+ return hasDangerHTML(descriptor.props) || isTextareaTag(descriptor.type) && (descriptor.props?.value != null || descriptor.props?.defaultValue != null);
19048
19470
  }
19049
19471
  function markInputCheckedness(input) {
19050
19472
  (STAGED_DOM?.view(input) ?? input).checked = (STAGED_DOM?.view(input) ?? input).checked;
@@ -19477,7 +19899,7 @@ function reconcileDeoptNode(prev, value, ownerBlock, ns) {
19477
19899
  if (isHostDescriptor(value)) {
19478
19900
  const elNs = inferTagNs(value.type, ns);
19479
19901
  let el;
19480
- if (prev !== null && prev.nodeType === 1 && prev.localName === value.type && prev.namespaceURI === (elNs ?? HTML_NS)) {
19902
+ if (prev !== null && prev.nodeType === 1 && isHostElementOfType(prev, value.type) && prev.namespaceURI === (elNs ?? HTML_NS)) {
19481
19903
  el = prev;
19482
19904
  patchDeoptProps(el, getDeoptDesc(el)?.props ?? null, value.props, ownerBlock);
19483
19905
  } else {
@@ -19487,7 +19909,11 @@ function reconcileDeoptNode(prev, value, ownerBlock, ns) {
19487
19909
  }
19488
19910
  setDeoptDesc(el, value);
19489
19911
  if (!hasHostPropContent(value)) {
19490
- reconcileDeoptChildren(el, value.children, ownerBlock);
19912
+ reconcileDeoptChildren(
19913
+ el,
19914
+ isHtmlTextareaType(value.type, elNs) ? textareaChildText(value.children, rejectTextareaChild) : value.children,
19915
+ ownerBlock
19916
+ );
19491
19917
  }
19492
19918
  return el;
19493
19919
  }
@@ -19548,7 +19974,7 @@ function reconcileDeoptChildren(el, children, ownerBlock) {
19548
19974
  }
19549
19975
  const stampedKey = scan.$$deoptKey;
19550
19976
  const descriptor = stampedKey === void 0 ? getDeoptDesc(scan) : void 0;
19551
- if (stampedKey === void 0 && descriptor === void 0 && !(hydrationOwnsUnstamped ??= activeHydration() !== null)) {
19977
+ if (stampedKey === void 0 && descriptor === void 0 && (!(hydrationOwnsUnstamped ??= activeHydration() !== null) || isTextSeparator(scan))) {
19552
19978
  hasForeign = true;
19553
19979
  scan = getNextSibling(scan);
19554
19980
  continue;
@@ -19627,7 +20053,7 @@ function nextDeoptOwnedChild(scan, adoptHydrationChildren) {
19627
20053
  scan = nodeAfterPortalRange(scan, rangeEnd);
19628
20054
  continue;
19629
20055
  }
19630
- if (!adoptHydrationChildren && scan.$$deoptKey === void 0 && getDeoptDesc(scan) === void 0) {
20056
+ if (adoptHydrationChildren ? isTextSeparator(scan) : scan.$$deoptKey === void 0 && getDeoptDesc(scan) === void 0) {
19631
20057
  scan = getNextSibling(scan);
19632
20058
  continue;
19633
20059
  }
@@ -19660,7 +20086,7 @@ function deoptItemBody(item, scope) {
19660
20086
  let transfer = null;
19661
20087
  if (stale != null) {
19662
20088
  journalRootProperty(block, "deoptNode", block.deoptNode);
19663
- if (scope.slots[0] === void 0 && stale.nodeType === 1 && isHostDescriptor(item) && stale.localName === item.type && (STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode) {
20089
+ if (scope.slots[0] === void 0 && stale.nodeType === 1 && isHostDescriptor(item) && isHostElementOfType(stale, item.type) && (STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode) {
19664
20090
  transfer = stale;
19665
20091
  } else if ((STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode) {
19666
20092
  if (ROOT_RENDER_TRANSACTION !== null) {
@@ -19679,21 +20105,7 @@ function deoptItemBody(item, scope) {
19679
20105
  block.deoptNode = null;
19680
20106
  }
19681
20107
  if (hydration !== null && scope.slots[0] === void 0 && hydration.isOpen(block.startMarker)) {
19682
- const seeded = {
19683
- __kind: "childSlot",
19684
- start: block.startMarker,
19685
- end: block.endMarker,
19686
- ownerHost: null,
19687
- borrowed: true,
19688
- compactable: false,
19689
- block: null,
19690
- text: null,
19691
- currentComp: null,
19692
- currentIsBodyFn: false,
19693
- forSlot: null,
19694
- hostNode: null,
19695
- portal: null
19696
- };
20108
+ const seeded = hydration.lendRange(block.startMarker, block.endMarker);
19697
20109
  scope.slots[0] = seeded;
19698
20110
  registerSlot(scope, seeded);
19699
20111
  }
@@ -19810,12 +20222,10 @@ function mappedDeoptItemBody(item, scope) {
19810
20222
  block.parentNode,
19811
20223
  item.type,
19812
20224
  item.props,
20225
+ item.__octaneInvocationSite,
19813
20226
  block.endMarker,
19814
- void 0,
19815
- true,
19816
20227
  true,
19817
- void 0,
19818
- item.__octaneInvocationSite
20228
+ true
19819
20229
  );
19820
20230
  return;
19821
20231
  }
@@ -19853,11 +20263,31 @@ function descNeedsBlocks(value) {
19853
20263
  if (value.$$kind === PORTAL_TAG) return true;
19854
20264
  return false;
19855
20265
  }
20266
+ function isTextareaTag(type) {
20267
+ return type === "textarea" || type.length === 8 && type.toLowerCase() === "textarea";
20268
+ }
20269
+ function isHtmlTextareaType(type, elNs) {
20270
+ return elNs === void 0 && isTextareaTag(type);
20271
+ }
20272
+ function deoptHostChildren(block, el, d, elNs, adopt = false) {
20273
+ if (!isHtmlTextareaType(d.type, elNs)) {
20274
+ childSlot(block, 0, el, d.children, null, false, el);
20275
+ return;
20276
+ }
20277
+ const text = adopt ? null : getFirstChild(el);
20278
+ childTextHole(
20279
+ block,
20280
+ 0,
20281
+ el,
20282
+ textareaChildText(d.children, rejectTextareaChild),
20283
+ text?.nodeType === 3 ? text : null
20284
+ );
20285
+ }
19856
20286
  function hostElementBody(d, block) {
19857
20287
  let el = block.deoptNode;
19858
20288
  const hydration = activeHydration();
19859
20289
  const elNs = inferTagNs(d.type, deoptChildNamespace(block.parentNode));
19860
- if (el === null && hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && hydration.node.localName === d.type && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
20290
+ if (el === null && hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && isHostElementOfType(hydration.node, d.type) && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
19861
20291
  el = hydration.node;
19862
20292
  block.deoptNode = el;
19863
20293
  applyDeoptProps(el, d.props, block);
@@ -19865,7 +20295,7 @@ function hostElementBody(d, block) {
19865
20295
  const savedCursor = getNextSibling(hydration.node);
19866
20296
  if (!hasHostPropContent(d)) {
19867
20297
  hydration.node = getFirstChild(el);
19868
- childSlot(block, 0, el, d.children, null, false, el);
20298
+ deoptHostChildren(block, el, d, elNs, true);
19869
20299
  }
19870
20300
  hydration.node = savedCursor;
19871
20301
  return;
@@ -19893,11 +20323,11 @@ function hostElementBody(d, block) {
19893
20323
  applyDeoptProps(el, d.props, block);
19894
20324
  setDeoptDesc(el, d);
19895
20325
  if (!hasHostPropContent(d)) {
19896
- hydration.suspend(() => childSlot(block, 0, el, d.children, null, false, el));
20326
+ hydration.suspend(() => deoptHostChildren(block, el, d, elNs));
19897
20327
  }
19898
20328
  return;
19899
20329
  }
19900
- if (el === null || el.localName !== d.type || elNs !== void 0 && el.namespaceURI !== elNs) {
20330
+ if (el === null || !isHostElementOfType(el, d.type) || elNs !== void 0 && el.namespaceURI !== elNs) {
19901
20331
  if (el !== null) {
19902
20332
  const retired = el;
19903
20333
  if (ROOT_RENDER_TRANSACTION !== null) {
@@ -19933,7 +20363,7 @@ function hostElementBody(d, block) {
19933
20363
  patchDeoptProps(el, getDeoptDesc(el)?.props ?? null, d.props, block);
19934
20364
  }
19935
20365
  setDeoptDesc(el, d);
19936
- if (!hasHostPropContent(d)) childSlot(block, 0, el, d.children, null, false, el);
20366
+ if (!hasHostPropContent(d)) deoptHostChildren(block, el, d, elNs);
19937
20367
  }
19938
20368
  function hostStringTagBody(d, block) {
19939
20369
  const tag = d.type;
@@ -19941,7 +20371,7 @@ function hostStringTagBody(d, block) {
19941
20371
  const hydration = activeHydration();
19942
20372
  const elNs = inferTagNs(tag, deoptChildNamespace(block.parentNode));
19943
20373
  if (el === null) {
19944
- if (hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && hydration.node.localName === tag && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
20374
+ if (hydration !== null && hydration.node !== null && hydration.node.nodeType === 1 && isHostElementOfType(hydration.node, tag) && (elNs === void 0 || hydration.node.namespaceURI === elNs)) {
19945
20375
  el = hydration.node;
19946
20376
  block.deoptNode = el;
19947
20377
  applyDeoptProps(el, d.props, block);
@@ -20061,7 +20491,7 @@ function buildDeoptAdoptQueue(oldChildren, start, end) {
20061
20491
  if (cursor === null || cursor === end) break;
20062
20492
  const t = typeof v;
20063
20493
  const isText = t === "string" || t === "number" || t === "bigint";
20064
- const compatible = isText ? cursor.nodeType === 3 : isHostDescriptor(v) ? cursor.nodeType === 1 && cursor.localName === v.type : false;
20494
+ const compatible = isText ? cursor.nodeType === 3 : isHostDescriptor(v) ? cursor.nodeType === 1 && isHostElementOfType(cursor, v.type) : false;
20065
20495
  if (!compatible) break;
20066
20496
  queue.push({ key: keys[i], node: cursor });
20067
20497
  cursor = getNextSibling(cursor);
@@ -20486,6 +20916,7 @@ function renderPreparedChildList(state, parentBlock, domParent, preparedList, hy
20486
20916
  if (passthroughStart !== null || passthroughEnd !== null) state.forSlot = null;
20487
20917
  throw error;
20488
20918
  }
20919
+ if (hydration !== null && !passthroughList) hydration.discardLeftoverItems(state.forSlot.end);
20489
20920
  } else {
20490
20921
  reconcileKeyed(
20491
20922
  parentBlock,
@@ -20736,7 +21167,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20736
21167
  const component = pureHost || preparedList !== null ? null : isHostDescriptor(value) ? hostElementBody : valueComponent;
20737
21168
  const unchangedList = preparedList !== null && state.forSlot !== null;
20738
21169
  const unchangedComponent = state.block !== null && component !== null && (component === state.currentComp || typeof value === "function" && state.currentIsBodyFn);
20739
- const unchangedHost = pureHost && state.hostNode !== null && state.block === null && state.hostNode.nodeType === 1 && state.hostNode.localName === value.type;
21170
+ const unchangedHost = pureHost && state.hostNode !== null && state.block === null && state.hostNode.nodeType === 1 && isHostElementOfType(state.hostNode, value.type);
20740
21171
  const primitive = value == null || typeof value !== "object" && typeof value !== "function";
20741
21172
  const text = primitive ? coerceChildText(value) : null;
20742
21173
  const unchangedText = primitive && state.block === null && state.forSlot === null && state.hostNode === null && state.portal === null && state.text === null === (text === "");
@@ -20778,6 +21209,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20778
21209
  return;
20779
21210
  }
20780
21211
  }
21212
+ let adoptedRange = false;
21213
+ let rebuild = false;
20781
21214
  if (state === void 0) {
20782
21215
  const transaction = ROOT_RENDER_TRANSACTION;
20783
21216
  if (transaction !== null && !transaction.aborted && !ROOT_RENDER_ROLLBACK && parentScope.mounted && !isCreatedInRootRender(transaction, parentBlock)) {
@@ -20798,6 +21231,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20798
21231
  end = hydration.close(anchor);
20799
21232
  if (parentBlock === hydration.rootBlock) hydration.claimRootRemainder(getNextSibling(end));
20800
21233
  hydration.node = getNextSibling(start);
21234
+ adoptedRange = true;
20801
21235
  } else if (hydration !== null && hydration.isOpen(hydration.node)) {
20802
21236
  start = hydration.node;
20803
21237
  end = hydration.close(hydration.node);
@@ -20806,6 +21240,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20806
21240
  hydration.claimRootRemainder(getNextSibling(end));
20807
21241
  }
20808
21242
  hydration.node = getNextSibling(start);
21243
+ adoptedRange = true;
20809
21244
  } else if (bindingMarker !== void 0) {
20810
21245
  start = (STAGED_DOM?.view(document) ?? document).createComment(bindingMarker);
20811
21246
  end = ownEnd && anchor != null ? anchor : (STAGED_DOM?.view(document) ?? document).createComment(HYDRATION_END);
@@ -20824,6 +21259,15 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20824
21259
  end = null;
20825
21260
  } else {
20826
21261
  start = null;
21262
+ if (hydration !== null && ownsHost === void 0)
21263
+ rebuild = hydration.discardServerText(
21264
+ parentScope,
21265
+ slotKey,
21266
+ domParent,
21267
+ anchor ?? null,
21268
+ value,
21269
+ preparedList !== null && compiledMapBody === void 0 && mappedFallback !== true
21270
+ );
20827
21271
  end = (STAGED_DOM?.view(document) ?? document).createComment("");
20828
21272
  (STAGED_DOM?.view(domParent) ?? domParent).insertBefore(end, anchor ?? null);
20829
21273
  if (hydration !== null && parentBlock === hydration.rootBlock)
@@ -20847,7 +21291,19 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20847
21291
  };
20848
21292
  parentScope.slots[slotKey] = state;
20849
21293
  registerSlot(parentScope, state);
21294
+ } else if (hydration !== null && hydration.lentSlot === state) {
21295
+ hydration.lentSlot = null;
21296
+ adoptedRange = true;
20850
21297
  }
21298
+ if (adoptedRange)
21299
+ rebuild = hydration.claimRange(
21300
+ parentScope,
21301
+ slotKey,
21302
+ state.start,
21303
+ state.end,
21304
+ value,
21305
+ compiledMapBody === void 0 && mappedFallback !== true ? preparedList : null
21306
+ );
20851
21307
  if (compactable === true) state.compactable = true;
20852
21308
  let upgradeChildren = void 0;
20853
21309
  let upgradeArmed = false;
@@ -20903,6 +21359,21 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
20903
21359
  return;
20904
21360
  }
20905
21361
  if (preparedList !== null) {
21362
+ if (rebuild) {
21363
+ const slot = state;
21364
+ hydration.suspend(
21365
+ () => renderPreparedChildList(
21366
+ slot,
21367
+ parentBlock,
21368
+ domParent,
21369
+ preparedList,
21370
+ null,
21371
+ upgradeArmed,
21372
+ upgradeChildren
21373
+ )
21374
+ );
21375
+ return;
21376
+ }
20906
21377
  renderPreparedChildList(
20907
21378
  state,
20908
21379
  parentBlock,
@@ -21114,7 +21585,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21114
21585
  return;
21115
21586
  }
21116
21587
  }
21117
- if (hydration === null && comp === hostElementBody && state.block === null && state.hostNode !== null && state.hostNode.nodeType === 1 && state.hostNode.localName === props.type && state.hostNode.namespaceURI === (inferTagNs(props.type, deoptChildNamespace(domParent)) ?? HTML_NS) && !hasDangerHTML(props.props) && !hasDangerHTML(getDeoptDesc(state.hostNode)?.props ?? null)) {
21588
+ if (hydration === null && comp === hostElementBody && state.block === null && state.hostNode !== null && state.hostNode.nodeType === 1 && isHostElementOfType(state.hostNode, props.type) && state.hostNode.namespaceURI === (inferTagNs(props.type, deoptChildNamespace(domParent)) ?? HTML_NS) && !hasDangerHTML(props.props) && !hasDangerHTML(getDeoptDesc(state.hostNode)?.props ?? null)) {
21118
21589
  const el = state.hostNode;
21119
21590
  state.hostNode = null;
21120
21591
  state.currentComp = comp;
@@ -21235,7 +21706,11 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21235
21706
  b.memoInChain = true;
21236
21707
  }
21237
21708
  state.block = b;
21238
- renderBlock(b);
21709
+ if (rebuild) {
21710
+ hydration.suspend(() => renderBlock(b));
21711
+ } else {
21712
+ renderBlock(b);
21713
+ }
21239
21714
  if (hydration !== null && !state.borrowed && state.end !== null) {
21240
21715
  hydration.node = getNextSibling(state.end);
21241
21716
  }
@@ -21244,6 +21719,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21244
21719
  if (value !== null && typeof value === "object") throw invalidChildError(value);
21245
21720
  if (state.block !== null || state.hostNode !== null) clearChildContent(state);
21246
21721
  const str = coerceChildText(value);
21722
+ if (adoptedRange) hydration.discardUnadoptedText(parentScope, slotKey, state, str);
21247
21723
  if (str === "") {
21248
21724
  if (state.text !== null) {
21249
21725
  if (ROOT_RENDER_TRANSACTION !== null) clearChildContent(state);
@@ -21329,17 +21805,22 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
21329
21805
  throw new Error(formatClientError(26, domParent.localName));
21330
21806
  }
21331
21807
  if (dangerouslySetInnerHTMLOwnsChild(domParent, value)) return null;
21332
- const vt = typeof value;
21808
+ let vt = typeof value;
21333
21809
  const state = parentScope.slots[slotKey];
21810
+ if (state === void 0 && (vt === "object" || vt === "function") && domParent.nodeType === 1 && domParent.localName === "textarea" && domParent.namespaceURI === HTML_NS && !isSignalHandle(value)) {
21811
+ value = textareaChildText(value, rejectTextareaChild);
21812
+ vt = "string";
21813
+ }
21334
21814
  if (ROOT_RENDER_TRANSACTION !== null && state === void 0 && parentScope.mounted) {
21335
21815
  journalBag();
21336
21816
  journalRootRange(domParent, null, null);
21337
21817
  journalRootProperty(parentScope.slots, slotKey, parentScope.slots[slotKey]);
21338
21818
  }
21339
- if (state === void 0 && vt !== "object" && vt !== "function") {
21819
+ if (state === void 0 && (value === null || vt !== "object" && vt !== "function")) {
21340
21820
  const str = value == null || value === false || value === true ? "" : vt === "string" ? value : String(value);
21341
21821
  if (str === "") {
21342
21822
  if (cachedNode !== null) (STAGED_DOM?.view(cachedNode) ?? cachedNode).remove();
21823
+ else activeHydration()?.hempty(domParent, siteLoc(parentScope, slotKey));
21343
21824
  return null;
21344
21825
  }
21345
21826
  if (cachedNode !== null) {
@@ -21347,16 +21828,25 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
21347
21828
  return cachedNode;
21348
21829
  }
21349
21830
  const hydration2 = activeHydration();
21350
- if (hydration2 !== null) return hydration2.htext(domParent, str, siteLoc(parentScope, slotKey));
21351
- const tn = (STAGED_DOM?.view(document) ?? document).createTextNode(str);
21352
- (STAGED_DOM?.view(domParent) ?? domParent).appendChild(tn);
21353
- return tn;
21831
+ if (hydration2 === null) {
21832
+ const tn = (STAGED_DOM?.view(document) ?? document).createTextNode(str);
21833
+ (STAGED_DOM?.view(domParent) ?? domParent).appendChild(tn);
21834
+ return tn;
21835
+ }
21836
+ if (!hydration2.framesSlotContent(domParent))
21837
+ return hydration2.htext(domParent, str, siteLoc(parentScope, slotKey));
21354
21838
  }
21355
21839
  if (state === void 0 && cachedNode !== null)
21356
21840
  (STAGED_DOM?.view(cachedNode) ?? cachedNode).remove();
21357
21841
  const hydration = activeHydration();
21358
- if (hydration !== null && state === void 0) hydration.node = getFirstChild(domParent);
21359
- childSlot(parentScope, slotKey, domParent, value, null, false, domParent);
21842
+ if (hydration !== null && state === void 0)
21843
+ hydration.hydrateOnlyChild(
21844
+ parentScope,
21845
+ slotKey,
21846
+ domParent,
21847
+ () => childSlot(parentScope, slotKey, domParent, value, null, false, domParent)
21848
+ );
21849
+ else childSlot(parentScope, slotKey, domParent, value, null, false, domParent);
21360
21850
  const s = parentScope.slots[slotKey];
21361
21851
  return s.block === null && s.forSlot === null && s.hostNode === null ? s.text : null;
21362
21852
  }
@@ -21677,8 +22167,11 @@ function hmr(fn) {
21677
22167
  }
21678
22168
  };
21679
22169
  function wrapper(props, scope, extra) {
21680
- if (scope !== void 0) meta.liveBlocks.add(scope.block);
21681
- return meta.fn(props, scope, extra);
22170
+ if (scope === CURRENT_SCOPE && scope !== null) {
22171
+ meta.liveBlocks.add(scope.block);
22172
+ return meta.fn(props, scope, extra);
22173
+ }
22174
+ return Reflect.apply(meta.fn, this, arguments);
21682
22175
  }
21683
22176
  Object.defineProperty(wrapper, HMR, {
21684
22177
  get() {
@@ -22086,7 +22579,7 @@ function mountPassthroughPending(state, thenable) {
22086
22579
  setTryBranch(state, -1);
22087
22580
  scheduleRender(state.parentBlock);
22088
22581
  };
22089
- thenable.then(retry, retry);
22582
+ resumeOnSettle(thenable, retry);
22090
22583
  }
22091
22584
  function renderPassthroughTry(state) {
22092
22585
  if (state.branch === 0 && state.block !== null) {
@@ -22743,7 +23236,7 @@ function renderInitialSuspenseHydration(state, initial) {
22743
23236
  return;
22744
23237
  scheduleRender(state.parentBlock);
22745
23238
  };
22746
- suspended.then(resume, resume);
23239
+ resumeOnSettle(suspended, resume);
22747
23240
  return;
22748
23241
  }
22749
23242
  initialSuspenseHydrations?.delete(state);
@@ -23812,7 +24305,7 @@ function attachResume(state, thenable) {
23812
24305
  commitResume(state);
23813
24306
  }
23814
24307
  };
23815
- thenable.then(retry, retry);
24308
+ resumeOnSettle(thenable, retry);
23816
24309
  }
23817
24310
  function startTransition(fn) {
23818
24311
  runTransition(fn);
@@ -23977,6 +24470,7 @@ function useActionState(action, initialState, permalinkOrSlot, slot) {
23977
24470
  };
23978
24471
  const dispatch = ((payload) => {
23979
24472
  const outsideTransition = process.env.NODE_ENV !== "production" && transitionActionBatchForUpdate() === null && ACTIVE_SUBMIT_DISPATCH?.intercepted !== true;
24473
+ const run = slotRef.action;
23980
24474
  slotRef.pendingCount++;
23981
24475
  setPending(true);
23982
24476
  slotRef.chain = slotRef.chain.then(
@@ -23988,7 +24482,7 @@ function useActionState(action, initialState, permalinkOrSlot, slot) {
23988
24482
  startTransition(() => {
23989
24483
  let p;
23990
24484
  try {
23991
- const result = slotRef.action(prevState, payload);
24485
+ const result = run(prevState, payload);
23992
24486
  if (process.env.NODE_ENV !== "production" && outsideTransition && result != null && typeof result.then === "function") {
23993
24487
  console.error(
23994
24488
  "An async useActionState action was dispatched outside a transition or action. Use an action/formAction prop or wrap the dispatch in startTransition."
@@ -24084,6 +24578,9 @@ function useFormStatus(slot) {
24084
24578
  }
24085
24579
  return s.form ? FORM_STATUS.get(s.form) ?? IDLE_FORM_STATUS : IDLE_FORM_STATUS;
24086
24580
  }
24581
+ function basicOptimisticReducer(state, value) {
24582
+ return typeof value === "function" ? value(state) : value;
24583
+ }
24087
24584
  function useOptimistic(passthrough, updateFnOrSlot, slot) {
24088
24585
  let updateFn;
24089
24586
  if (typeof updateFnOrSlot === "symbol") slot = updateFnOrSlot;
@@ -24107,7 +24604,6 @@ function useOptimistic(passthrough, updateFnOrSlot, slot) {
24107
24604
  };
24108
24605
  const slotRef = {
24109
24606
  queue: [],
24110
- updateFn,
24111
24607
  armed: false,
24112
24608
  add: (value) => {
24113
24609
  if (process.env.NODE_ENV !== "production" && TRANSITION_DEPTH === 0 && ASYNC_TRANSITION_COUNT === 0) {
@@ -24136,11 +24632,9 @@ function useOptimistic(passthrough, updateFnOrSlot, slot) {
24136
24632
  TRANSITION_LISTENERS.add(listener);
24137
24633
  registerHookCleanup(scope, () => TRANSITION_LISTENERS.delete(listener));
24138
24634
  }
24139
- s.updateFn = updateFn;
24140
24635
  let optimistic = passthrough;
24141
- for (let i = 0; i < s.queue.length; i++) {
24142
- optimistic = s.updateFn ? s.updateFn(optimistic, s.queue[i]) : s.queue[i];
24143
- }
24636
+ const reduce = updateFn ?? basicOptimisticReducer;
24637
+ for (let i = 0; i < s.queue.length; i++) optimistic = reduce(optimistic, s.queue[i]);
24144
24638
  return [optimistic, s.add];
24145
24639
  }
24146
24640
  function spawnDeferredSwap(s) {
@@ -24798,7 +25292,13 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
24798
25292
  );
24799
25293
  state.block = b;
24800
25294
  state.markerlessBefore = before;
24801
- renderBlock(b);
25295
+ try {
25296
+ renderBlock(b);
25297
+ } catch (error) {
25298
+ if ((before ? getNextSibling(before) : getFirstChild(domParent)) !== after)
25299
+ finalizeMarkerlessBranch(state, domParent, b, marker, before, after);
25300
+ throw error;
25301
+ }
24802
25302
  finalizeMarkerlessBranch(state, domParent, b, marker, before, after);
24803
25303
  replaceSharedBlockBoundary(
24804
25304
  parentBlock,
@@ -25126,7 +25626,7 @@ function suspendHiddenActivity(state, thenable) {
25126
25626
  if (state.pendingThenable !== thenable || !state.hidden || blockSubtreeDisposed(block)) return;
25127
25627
  scheduleRender(block);
25128
25628
  };
25129
- thenable.then(retry, retry);
25629
+ resumeOnSettle(thenable, retry);
25130
25630
  }
25131
25631
  function renderHiddenActivity(state, replay = false, block = state.block) {
25132
25632
  const previousReplay = RESUME_REPLAY;
@@ -25659,7 +26159,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
25659
26159
  (f & 2) !== 0,
25660
26160
  (f & 16) !== 0
25661
26161
  );
25662
- if (hydration !== null) discardLeftoverHydrationItems(state.end, hydration);
26162
+ if (hydration !== null) hydration.discardLeftoverItems(state.end);
25663
26163
  } else {
25664
26164
  reconcileKeyed(
25665
26165
  parentBlock,
@@ -25905,13 +26405,6 @@ function fastMapSlot(scopeOrItems, slotOrMethod, domParent, items, method, nativ
25905
26405
  true
25906
26406
  );
25907
26407
  }
25908
- function discardLeftoverHydrationItems(end, hydration) {
25909
- const n = hydration.node;
25910
- if (n === null || n === end || (STAGED_DOM?.view(n) ?? n).parentNode !== (STAGED_DOM?.view(end) ?? end).parentNode)
25911
- return;
25912
- noteRecoverableHydrationError(() => new Error(formatClientError(56)));
25913
- removeRange(n, end);
25914
- }
25915
26408
  function removeRange(from, end) {
25916
26409
  let n = from;
25917
26410
  while (n !== null && n !== end) {
@@ -26661,87 +27154,65 @@ function batchClearItems(state, oldItems, ownedRootClear = false) {
26661
27154
  function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forSlot, singleRoot, ssrMarkerless, adoptNode = null) {
26662
27155
  const hydration = activeHydration();
26663
27156
  if (hydration !== null) {
26664
- if (ssrMarkerless && !hydration.isOpen(hydration.node) && (singleRoot !== 2 || forSlot.plainDeopt !== true || isHostDescriptor(item) && !descNeedsBlocks(item))) {
26665
- if (hydration.node !== null && hydration.node !== forSlot.end && (singleRoot !== 2 || forSlot.plainDeopt !== true || hydration.node.nodeType === 1 && domNode(hydration.node).parentNode === parentNode)) {
26666
- const root = hydration.node;
26667
- const block3 = createBlock(
27157
+ const node = hydration.node;
27158
+ if (ssrMarkerless && !hydration.isOpen(node) && (singleRoot !== 2 || forSlot.plainDeopt !== true || isHostDescriptor(item) && !descNeedsBlocks(item))) {
27159
+ if (node !== null && node !== forSlot.end && (singleRoot !== 2 || forSlot.plainDeopt !== true || node.nodeType === 1 && domNode(node).parentNode === parentNode && isHostElementOfType(node, item.type))) {
27160
+ const block2 = createBlock(
26668
27161
  "control-flow",
26669
27162
  parentBlock,
26670
27163
  parentNode,
26671
- root,
26672
- root,
27164
+ node,
27165
+ node,
26673
27166
  body,
26674
27167
  item,
26675
27168
  forSlot.env
26676
27169
  );
26677
- block3.forSlot = forSlot;
26678
- block3.key = key;
26679
- block3.itemIndex = index;
26680
- if (singleRoot === 2 && forSlot.plainDeopt === true) block3.deoptNode = root;
26681
- renderBlock(block3);
26682
- hydration.node = domNode(block3.endMarker)?.nextSibling ?? getNextSibling(root);
26683
- return block3;
26684
- }
26685
- if (process.env.NODE_ENV !== "production") {
26686
- const mmLoc = parentNode.__oct_loc;
26687
- if (mmLoc)
26688
- hydration.warnStructural(mmLoc, "another list item", hydration.describe(hydration.node));
26689
- }
26690
- return hydration.suspend(
26691
- () => mountItem(
26692
- parentBlock,
26693
- parentNode,
26694
- anchor,
26695
- item,
26696
- index,
26697
- key,
26698
- body,
26699
- forSlot,
26700
- singleRoot,
26701
- ssrMarkerless
26702
- )
26703
- );
26704
- }
26705
- if (!hydration.isOpen(hydration.node)) {
26706
- if (process.env.NODE_ENV !== "production") {
26707
- const mmLoc = parentNode.__oct_loc;
26708
- if (mmLoc)
26709
- hydration.warnStructural(mmLoc, "another list item", hydration.describe(hydration.node));
26710
- }
26711
- return hydration.suspend(
26712
- () => mountItem(
26713
- parentBlock,
26714
- parentNode,
26715
- anchor,
26716
- item,
26717
- index,
26718
- key,
26719
- body,
26720
- forSlot,
26721
- singleRoot,
26722
- ssrMarkerless
26723
- )
27170
+ block2.forSlot = forSlot;
27171
+ block2.key = key;
27172
+ block2.itemIndex = index;
27173
+ if (singleRoot === 2 && forSlot.plainDeopt === true) block2.deoptNode = node;
27174
+ renderBlock(block2);
27175
+ hydration.node = domNode(block2.endMarker)?.nextSibling ?? getNextSibling(node);
27176
+ return block2;
27177
+ }
27178
+ } else if (hydration.isOpen(node)) {
27179
+ const itemEnd = hydration.close(node);
27180
+ hydration.node = getNextSibling(node);
27181
+ const block2 = createBlock(
27182
+ "control-flow",
27183
+ parentBlock,
27184
+ parentNode,
27185
+ node,
27186
+ itemEnd,
27187
+ body,
27188
+ item,
27189
+ forSlot.env
26724
27190
  );
26725
- }
26726
- const itemStart = hydration.node;
26727
- const itemEnd = hydration.close(itemStart);
26728
- hydration.node = getNextSibling(itemStart);
26729
- const block2 = createBlock(
26730
- "control-flow",
26731
- parentBlock,
26732
- parentNode,
26733
- itemStart,
26734
- itemEnd,
26735
- body,
26736
- item,
26737
- forSlot.env
27191
+ block2.forSlot = forSlot;
27192
+ block2.key = key;
27193
+ block2.itemIndex = index;
27194
+ renderBlock(block2);
27195
+ hydration.node = getNextSibling(itemEnd);
27196
+ return block2;
27197
+ }
27198
+ hydration.discardItems(
27199
+ forSlot.end,
27200
+ process.env.NODE_ENV !== "production" ? forSlot.plainDeopt === true && isHostDescriptor(item) && !descNeedsBlocks(item) ? `<${item.type}>` : "another list item" : ""
27201
+ );
27202
+ return hydration.suspend(
27203
+ () => mountItem(
27204
+ parentBlock,
27205
+ parentNode,
27206
+ anchor,
27207
+ item,
27208
+ index,
27209
+ key,
27210
+ body,
27211
+ forSlot,
27212
+ singleRoot,
27213
+ ssrMarkerless
27214
+ )
26738
27215
  );
26739
- block2.forSlot = forSlot;
26740
- block2.key = key;
26741
- block2.itemIndex = index;
26742
- renderBlock(block2);
26743
- hydration.node = getNextSibling(itemEnd);
26744
- return block2;
26745
27216
  }
26746
27217
  if (singleRoot === true || singleRoot === 2 && isHostDescriptor(item) && !descNeedsBlocks(item)) {
26747
27218
  if (adoptNode !== null) {
@@ -26776,7 +27247,12 @@ function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forS
26776
27247
  block2.forSlot = forSlot;
26777
27248
  block2.key = key;
26778
27249
  block2.itemIndex = index;
26779
- renderBlock(block2);
27250
+ try {
27251
+ renderBlock(block2);
27252
+ } catch (error) {
27253
+ discardThrownItem(block2, error, anchor);
27254
+ throw error;
27255
+ }
26780
27256
  const root = (STAGED_DOM?.view(anchor) ?? anchor).previousSibling;
26781
27257
  block2.startMarker = root;
26782
27258
  block2.endMarker = root;
@@ -26811,12 +27287,21 @@ function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forS
26811
27287
  try {
26812
27288
  renderBlock(block);
26813
27289
  } catch (error) {
26814
- if (isSuspenseException(error)) retainDiscardedWarmMemos(block);
26815
- unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
27290
+ discardThrownItem(block, error, null);
26816
27291
  throw error;
26817
27292
  }
26818
27293
  return block;
26819
27294
  }
27295
+ function discardThrownItem(block, error, selfMarkedAnchor) {
27296
+ const bag = block.slots[0];
27297
+ if (selfMarkedAnchor !== null && bag != null && bag.__kind === void 0) {
27298
+ const root = (STAGED_DOM?.view(selfMarkedAnchor) ?? selfMarkedAnchor).previousSibling;
27299
+ block.startMarker = root;
27300
+ block.endMarker = root;
27301
+ }
27302
+ if (isSuspenseException(error)) retainDiscardedWarmMemos(block);
27303
+ unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
27304
+ }
26820
27305
  function moveBlockBefore(block, anchor) {
26821
27306
  const parent = domNode(block.startMarker).parentNode;
26822
27307
  const end = block.endMarker;
@@ -28034,9 +28519,7 @@ function hydrateRootWithOutputHandler(container, bodyOrElement, propsOrOptions,
28034
28519
  createdInRootRender(rootBlock);
28035
28520
  journalRootProperty(idState, "next", idState.next);
28036
28521
  idState.next = rootOptions?.identifierSeed ?? 0;
28037
- let firstNode = getFirstChild(container);
28038
- while (firstNode !== null && (firstNode.nodeType === 10 || isRendererHydrationStyle(firstNode)))
28039
- firstNode = getNextSibling(firstNode);
28522
+ const firstNode = skipFoldedHeadPrefix(container, getFirstChild(container));
28040
28523
  const hydration = new HydrationCapability(rootBlock, firstNode, seeds);
28041
28524
  if (bindingLeases?.length) {
28042
28525
  const attempted = rootBlock;
@@ -28185,7 +28668,15 @@ function createIndependentHydrateActivator(body) {
28185
28668
  tryBlock(scope, 0, scope.block.parentNode, content, null, null, scope.block.endMarker);
28186
28669
  };
28187
28670
  const adapter = (_props, scope) => {
28188
- componentSlotVoid(scope, 0, scope.block.parentNode, framed, void 0, scope.block.endMarker);
28671
+ componentSlotVoid(
28672
+ scope,
28673
+ 0,
28674
+ scope.block.parentNode,
28675
+ framed,
28676
+ void 0,
28677
+ void 0,
28678
+ scope.block.endMarker
28679
+ );
28189
28680
  };
28190
28681
  const root = hydrateRoot(element, adapter, captures, {
28191
28682
  identifierPrefix: manifest.boundaryId + "-",
@@ -28651,6 +29142,7 @@ export {
28651
29142
  createRoot,
28652
29143
  createScopedElement,
28653
29144
  createScopedValue,
29145
+ deferRecord,
28654
29146
  delegateCaptureEvents,
28655
29147
  delegateEvents,
28656
29148
  descriptorChildren,
@@ -28708,6 +29200,7 @@ export {
28708
29200
  isChildrenBlock,
28709
29201
  isHydratingStyle,
28710
29202
  isInActScope,
29203
+ isRenderCall,
28711
29204
  isValidElement,
28712
29205
  keyedForBlock,
28713
29206
  lazy,
@@ -28836,6 +29329,7 @@ export {
28836
29329
  textHole,
28837
29330
  textHoleUpdate,
28838
29331
  textSlot,
29332
+ textareaText,
28839
29333
  tryBlock,
28840
29334
  updateFreshClassAttr,
28841
29335
  updateFreshClassName,