octane 0.2.12 → 0.2.13

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 (243) hide show
  1. package/README.md +5 -0
  2. package/dist/behavior-root.d.ts +13 -3
  3. package/dist/behavior-root.js +28 -5
  4. package/dist/cjs/behavior-root.cjs +32 -6
  5. package/dist/cjs/class-names.cjs +49 -0
  6. package/dist/cjs/constants.cjs +9 -0
  7. package/dist/cjs/css.cjs +6 -27
  8. package/dist/cjs/data-encoding.cjs +160 -0
  9. package/dist/cjs/dom-binding-handoff.cjs +93 -0
  10. package/dist/cjs/dom-binding-protocol.cjs +115 -0
  11. package/dist/cjs/dom-binding-styles.cjs +292 -0
  12. package/dist/cjs/dom-bindings.cjs +700 -0
  13. package/dist/cjs/dom-focused-move.cjs +66 -0
  14. package/dist/cjs/dom-tables.cjs +4 -94
  15. package/dist/cjs/error-codes.client.generated.cjs +33 -0
  16. package/dist/cjs/error-codes.server.generated.cjs +19 -0
  17. package/dist/cjs/hydration/control-capture.cjs +244 -0
  18. package/dist/cjs/hydration/event-capture.cjs +125 -43
  19. package/dist/cjs/hydration/interaction-config.cjs +50 -2
  20. package/dist/cjs/hydration-markers.cjs +37 -0
  21. package/dist/cjs/independent-hydration-protocol.cjs +106 -0
  22. package/dist/cjs/index.cjs +6 -0
  23. package/dist/cjs/runtime.cjs +2791 -215
  24. package/dist/cjs/runtime.server.cjs +716 -76
  25. package/dist/cjs/server/early-signals.cjs +45 -0
  26. package/dist/cjs/server/index.cjs +44 -0
  27. package/dist/cjs/server/rpc-batch.cjs +149 -0
  28. package/dist/cjs/server/rpc-stream.cjs +146 -0
  29. package/dist/cjs/server/rpc.cjs +34 -15
  30. package/dist/cjs/server/signal-query-observation.cjs +158 -0
  31. package/dist/cjs/server/streamed-region.cjs +52 -0
  32. package/dist/cjs/server/streamed-signals.cjs +512 -0
  33. package/dist/cjs/server-call.cjs +103 -0
  34. package/dist/cjs/server-rpc-batch-client.cjs +141 -0
  35. package/dist/cjs/server-rpc-client.cjs +94 -27
  36. package/dist/cjs/server-rpc-protocol.cjs +141 -0
  37. package/dist/cjs/server-rpc-stream-client.cjs +118 -0
  38. package/dist/cjs/signals/actions.cjs +474 -0
  39. package/dist/cjs/signals/client.cjs +4 -1
  40. package/dist/cjs/signals/computations.cjs +460 -0
  41. package/dist/cjs/signals/control-binding.cjs +368 -0
  42. package/dist/cjs/signals/derived-facade.cjs +50 -0
  43. package/dist/cjs/signals/document-owner.cjs +71 -0
  44. package/dist/cjs/signals/early-values.cjs +155 -0
  45. package/dist/cjs/signals/encoding.cjs +6 -95
  46. package/dist/cjs/signals/engine.cjs +276 -12
  47. package/dist/cjs/signals/errors.cjs +18 -0
  48. package/dist/cjs/signals/facade.cjs +477 -0
  49. package/dist/cjs/signals/graph.cjs +163 -20
  50. package/dist/cjs/signals/handle-protocol.cjs +36 -0
  51. package/dist/cjs/signals/index.cjs +81 -2
  52. package/dist/cjs/signals/native-read-client.cjs +10 -0
  53. package/dist/cjs/signals/owner-context.cjs +112 -0
  54. package/dist/cjs/signals/query-attempt-observer.cjs +68 -0
  55. package/dist/cjs/signals/query-facade.cjs +72 -0
  56. package/dist/cjs/signals/read-protocol.cjs +32 -0
  57. package/dist/cjs/signals/requests.cjs +287 -14
  58. package/dist/cjs/signals/scalar-computations.cjs +76 -0
  59. package/dist/cjs/signals/server.cjs +4 -1
  60. package/dist/cjs/signals/transition-candidate.cjs +567 -0
  61. package/dist/cjs/signals/transition-state.cjs +106 -0
  62. package/dist/cjs/signals/types.cjs +50 -0
  63. package/dist/cjs/stream-protocol.cjs +3 -0
  64. package/dist/cjs/streamed-signals-protocol.cjs +159 -0
  65. package/dist/cjs/style-values.cjs +122 -0
  66. package/dist/cjs/version.cjs +1 -1
  67. package/dist/class-names.d.ts +5 -0
  68. package/dist/class-names.js +25 -0
  69. package/dist/compiler/bundler.js +34 -6
  70. package/dist/compiler/compile.js +2234 -559
  71. package/dist/compiler/dom-binding-program.js +935 -0
  72. package/dist/compiler/dom-binding-request.js +57 -0
  73. package/dist/compiler/dom-bindings.js +2245 -0
  74. package/dist/compiler/hook-deps.js +26 -0
  75. package/dist/compiler/hydrate-boundaries.js +358 -15
  76. package/dist/compiler/index.d.ts +38 -1
  77. package/dist/compiler/index.js +1 -0
  78. package/dist/compiler/native-attribute-reads.js +127 -0
  79. package/dist/compiler/native-read-diagnostics.js +48 -9
  80. package/dist/compiler/native-read-types.js +55 -32
  81. package/dist/compiler/server-context.js +118 -0
  82. package/dist/compiler/signal-attempt-reads.js +479 -0
  83. package/dist/compiler/signal-declarations.js +557 -0
  84. package/dist/compiler/signal-start-reads.js +413 -0
  85. package/dist/compiler/slot-hooks.js +57 -10
  86. package/dist/compiler/template-ir.js +200 -0
  87. package/dist/compiler/typescript.d.ts +2 -0
  88. package/dist/compiler/typescript.js +2 -0
  89. package/dist/compiler/vite.d.ts +3 -1
  90. package/dist/compiler/vite.js +122 -4
  91. package/dist/compiler/volar.d.ts +6 -1
  92. package/dist/compiler/volar.js +674 -143
  93. package/dist/constants.d.ts +1 -0
  94. package/dist/constants.js +10 -0
  95. package/dist/css.d.ts +2 -5
  96. package/dist/css.js +2 -23
  97. package/dist/data-encoding.d.ts +9 -0
  98. package/dist/data-encoding.js +134 -0
  99. package/dist/dom-binding-classes.d.ts +15 -0
  100. package/dist/dom-binding-classes.js +129 -0
  101. package/dist/dom-binding-controls.d.ts +2 -0
  102. package/dist/dom-binding-controls.js +6 -0
  103. package/dist/dom-binding-handoff.d.ts +55 -0
  104. package/dist/dom-binding-handoff.js +62 -0
  105. package/dist/dom-binding-program.d.ts +300 -0
  106. package/dist/dom-binding-program.js +1625 -0
  107. package/dist/dom-binding-projections.d.ts +15 -0
  108. package/dist/dom-binding-projections.js +187 -0
  109. package/dist/dom-binding-protocol.d.ts +13 -0
  110. package/dist/dom-binding-protocol.js +88 -0
  111. package/dist/dom-binding-signals.d.ts +21 -0
  112. package/dist/dom-binding-signals.js +109 -0
  113. package/dist/dom-binding-styles.d.ts +17 -0
  114. package/dist/dom-binding-styles.js +272 -0
  115. package/dist/dom-bindings.d.ts +89 -0
  116. package/dist/dom-bindings.js +670 -0
  117. package/dist/dom-focused-move.d.ts +6 -0
  118. package/dist/dom-focused-move.js +42 -0
  119. package/dist/dom-tables.d.ts +1 -3
  120. package/dist/dom-tables.js +1 -91
  121. package/dist/error-codes.client.generated.d.ts +9 -0
  122. package/dist/error-codes.client.generated.js +33 -0
  123. package/dist/error-codes.server.generated.d.ts +5 -0
  124. package/dist/error-codes.server.generated.js +19 -0
  125. package/dist/hydration/control-capture.d.ts +62 -0
  126. package/dist/hydration/control-capture.js +223 -0
  127. package/dist/hydration/document-lifecycle.d.ts +23 -0
  128. package/dist/hydration/document-lifecycle.js +80 -0
  129. package/dist/hydration/event-capture.d.ts +20 -1
  130. package/dist/hydration/event-capture.js +128 -42
  131. package/dist/hydration/independent-island.d.ts +45 -0
  132. package/dist/hydration/independent-island.js +233 -0
  133. package/dist/hydration/index.d.ts +8 -1
  134. package/dist/hydration/index.js +55 -1
  135. package/dist/hydration/interaction-config.d.ts +5 -0
  136. package/dist/hydration/interaction-config.js +44 -1
  137. package/dist/hydration/stream-delivery.d.ts +32 -0
  138. package/dist/hydration/stream-delivery.js +333 -0
  139. package/dist/hydration/stream-receiver.d.ts +26 -0
  140. package/dist/hydration/stream-receiver.js +204 -0
  141. package/dist/hydration/stream-result-receiver.d.ts +70 -0
  142. package/dist/hydration/stream-result-receiver.js +246 -0
  143. package/dist/hydration/streamed-signals.d.ts +44 -0
  144. package/dist/hydration/streamed-signals.js +186 -0
  145. package/dist/hydration/types.d.ts +6 -0
  146. package/dist/hydration-markers.d.ts +7 -0
  147. package/dist/hydration-markers.js +10 -0
  148. package/dist/independent-hydration-protocol.d.ts +31 -0
  149. package/dist/independent-hydration-protocol.js +80 -0
  150. package/dist/index.d.ts +2 -0
  151. package/dist/index.js +4 -0
  152. package/dist/internal/signal-read.d.ts +1 -0
  153. package/dist/internal/signal-read.js +4 -0
  154. package/dist/jsx-runtime.d.ts +45 -6
  155. package/dist/public-types.d.ts +15 -1
  156. package/dist/runtime.d.ts +259 -21
  157. package/dist/runtime.js +2812 -220
  158. package/dist/runtime.server.d.ts +86 -6
  159. package/dist/runtime.server.js +712 -76
  160. package/dist/server/early-signals.d.ts +14 -0
  161. package/dist/server/early-signals.js +34 -0
  162. package/dist/server/index.d.ts +10 -2
  163. package/dist/server/index.js +48 -1
  164. package/dist/server/rpc-batch.d.ts +17 -0
  165. package/dist/server/rpc-batch.js +129 -0
  166. package/dist/server/rpc-stream.d.ts +9 -0
  167. package/dist/server/rpc-stream.js +125 -0
  168. package/dist/server/rpc.d.ts +5 -1
  169. package/dist/server/rpc.js +37 -13
  170. package/dist/server/signal-query-observation.d.ts +3 -0
  171. package/dist/server/signal-query-observation.js +134 -0
  172. package/dist/server/streamed-region.d.ts +15 -0
  173. package/dist/server/streamed-region.js +30 -0
  174. package/dist/server/streamed-signals.d.ts +45 -0
  175. package/dist/server/streamed-signals.js +488 -0
  176. package/dist/server-call.d.ts +41 -0
  177. package/dist/server-call.js +75 -0
  178. package/dist/server-rpc-batch-client.d.ts +7 -0
  179. package/dist/server-rpc-batch-client.js +119 -0
  180. package/dist/server-rpc-client.d.ts +3 -1
  181. package/dist/server-rpc-client.js +99 -27
  182. package/dist/server-rpc-protocol.d.ts +47 -0
  183. package/dist/server-rpc-protocol.js +109 -0
  184. package/dist/server-rpc-stream-client.d.ts +5 -0
  185. package/dist/server-rpc-stream-client.js +98 -0
  186. package/dist/signals/actions.d.ts +12 -0
  187. package/dist/signals/actions.js +466 -0
  188. package/dist/signals/client.d.ts +2 -0
  189. package/dist/signals/client.js +1 -0
  190. package/dist/signals/computations.d.ts +37 -0
  191. package/dist/signals/computations.js +455 -0
  192. package/dist/signals/control-binding.d.ts +31 -0
  193. package/dist/signals/control-binding.js +353 -0
  194. package/dist/signals/derived-facade.d.ts +3 -0
  195. package/dist/signals/derived-facade.js +25 -0
  196. package/dist/signals/document-owner.d.ts +10 -0
  197. package/dist/signals/document-owner.js +43 -0
  198. package/dist/signals/early-values.d.ts +24 -0
  199. package/dist/signals/early-values.js +124 -0
  200. package/dist/signals/encoding.d.ts +1 -3
  201. package/dist/signals/encoding.js +3 -93
  202. package/dist/signals/engine.d.ts +53 -4
  203. package/dist/signals/engine.js +275 -16
  204. package/dist/signals/errors.d.ts +7 -0
  205. package/dist/signals/errors.js +16 -0
  206. package/dist/signals/facade.d.ts +74 -0
  207. package/dist/signals/facade.js +452 -0
  208. package/dist/signals/graph.d.ts +50 -5
  209. package/dist/signals/graph.js +170 -19
  210. package/dist/signals/handle-protocol.d.ts +4 -0
  211. package/dist/signals/handle-protocol.js +11 -0
  212. package/dist/signals/index.d.ts +12 -3
  213. package/dist/signals/index.js +71 -2
  214. package/dist/signals/native-read-client.d.ts +3 -0
  215. package/dist/signals/native-read-client.js +10 -0
  216. package/dist/signals/owner-context.d.ts +22 -0
  217. package/dist/signals/owner-context.js +77 -0
  218. package/dist/signals/query-attempt-observer.d.ts +49 -0
  219. package/dist/signals/query-attempt-observer.js +41 -0
  220. package/dist/signals/query-facade.d.ts +3 -0
  221. package/dist/signals/query-facade.js +49 -0
  222. package/dist/signals/read-protocol.d.ts +32 -3
  223. package/dist/signals/read-protocol.js +26 -0
  224. package/dist/signals/requests.d.ts +38 -5
  225. package/dist/signals/requests.js +298 -15
  226. package/dist/signals/scalar-computations.d.ts +2 -0
  227. package/dist/signals/scalar-computations.js +60 -0
  228. package/dist/signals/server.d.ts +2 -0
  229. package/dist/signals/server.js +1 -0
  230. package/dist/signals/transition-candidate.d.ts +71 -0
  231. package/dist/signals/transition-candidate.js +557 -0
  232. package/dist/signals/transition-state.d.ts +51 -0
  233. package/dist/signals/transition-state.js +70 -0
  234. package/dist/signals/types.d.ts +95 -5
  235. package/dist/signals/types.js +20 -0
  236. package/dist/stream-protocol.d.ts +0 -5
  237. package/dist/stream-protocol.js +3 -0
  238. package/dist/streamed-signals-protocol.d.ts +60 -0
  239. package/dist/streamed-signals-protocol.js +130 -0
  240. package/dist/style-values.d.ts +3 -0
  241. package/dist/style-values.js +96 -0
  242. package/dist/version.js +1 -1
  243. package/package.json +37 -1
package/dist/runtime.js CHANGED
@@ -1,5 +1,13 @@
1
1
  import { resolveHookPath } from "./hook-slot-cache.js";
2
2
  import { DOMStage } from "./dom-stage.js";
3
+ import { __normalizeBindingStyle } from "./dom-binding-styles.js";
4
+ import {
5
+ BINDING_HANDOFF,
6
+ claimBindingHandoff,
7
+ consumeBindingEvent,
8
+ beginBindingEvent,
9
+ releaseBindingHandoff
10
+ } from "./dom-binding-handoff.js";
3
11
  import { bumpContextEpoch, contextEpochNow } from "./context-epoch.js";
4
12
  import {
5
13
  SUSPENSE_SCRIPT_ATTR,
@@ -12,6 +20,8 @@ import {
12
20
  HYDRATE_WHEN_ATTR,
13
21
  HYDRATE_ID_COUNT_ATTR,
14
22
  HYDRATE_SEED_ATTR,
23
+ HYDRATE_INPUT_ATTR,
24
+ HYDRATE_INDEPENDENT_ATTR,
15
25
  STREAM_BOUNDARY_ATTR,
16
26
  STREAM_SCRIPT_ATTR,
17
27
  STREAM_SEED_COMMENT,
@@ -87,9 +97,12 @@ import {
87
97
  HYDRATE_SUPPORTED_INTERACTION_EVENTS,
88
98
  hydrationEventPathWithin,
89
99
  initializeHydrationEventCapture,
100
+ isHydrationSelectionIntentCurrent,
90
101
  markDelegatedDynamicHydrationIntent,
91
102
  registerHydrationIntentBoundary,
92
103
  shouldPreventHydrationInteractionDefault,
104
+ snapshotHydrationControl,
105
+ consumeHydrationControl,
93
106
  takeDelegatedDynamicHydrationIntent,
94
107
  takePendingHydrationIntents,
95
108
  unregisterHydrationIntentBoundary,
@@ -108,6 +121,8 @@ import {
108
121
  } from "./component-flags.js";
109
122
  import { formatClientError } from "./error-codes.client.generated.js";
110
123
  import { formAuthoringDiagnostics } from "./form-diagnostics.js";
124
+ import { isBindingOpenComment } from "./dom-binding-protocol.js";
125
+ import { moveNativeNodeBefore } from "./dom-focused-move.js";
111
126
  import {
112
127
  HYDRATE_STREAM_TOKEN_ATTR,
113
128
  isRendererStreamBoundaryTemplate,
@@ -120,10 +135,19 @@ import {
120
135
  validateNativeReadWitness
121
136
  } from "./signals/native-read-collector.js";
122
137
  import { createNativeReadRetry } from "./signals/native-read-retry.js";
138
+ import {
139
+ activeCandidate,
140
+ swapActiveSignalCandidate,
141
+ withoutSignalCandidate
142
+ } from "./signals/transition-state.js";
143
+ import { SignalCandidateFrame } from "./signals/transition-candidate.js";
123
144
  import {
124
145
  NativeAdoptionMiss,
146
+ NATIVE_TRANSITION_CONSUMER,
125
147
  readNativeDomStyle,
148
+ registerNativeActionResolver,
126
149
  runNativeBatch,
150
+ setNativeCandidateResolver,
127
151
  setNativeAdoptionResolver
128
152
  } from "./signals/read-protocol.js";
129
153
  import { beginNativeEventBatch, endNativeEventBatch } from "./signals/native-read-events.js";
@@ -133,6 +157,34 @@ import {
133
157
  NATIVE_SIGNAL_FRESH_COMMENT,
134
158
  parseNativeSignalManifest
135
159
  } from "./signals/native-read-seeds.js";
160
+ import {
161
+ currentExplicitSignalOwner,
162
+ activeSignalOwnerEnvironment,
163
+ activeSynchronousSignalOwner,
164
+ currentSignalOwner,
165
+ retireSignalOwnerIdentity,
166
+ runWithSignalOwner
167
+ } from "./signals/owner-context.js";
168
+ import {
169
+ documentSignalOwner,
170
+ enableSignalDocument,
171
+ signalDocumentEnabled,
172
+ streamedSignalOwnerActivator as STREAMED_SIGNAL_OWNER_ACTIVATOR
173
+ } from "./signals/document-owner.js";
174
+ import {
175
+ documentSignalOwner as documentSignalOwner2,
176
+ installStreamedSignalOwnerActivator
177
+ } from "./signals/document-owner.js";
178
+ import {
179
+ hasHydrationControlSignalWriter,
180
+ registerHydrationControlSignalWriter,
181
+ registerSignalOwnerDocument
182
+ } from "./signals/early-values.js";
183
+ import {
184
+ SIGNAL_BINDING_READ,
185
+ SIGNAL_BINDING_SUBSCRIBE,
186
+ SIGNAL_HANDLE
187
+ } from "./signals/types.js";
136
188
  let PROFILE_COMPONENT_OVERRIDE = null;
137
189
  function withProfileComponentOverride(target, component, run) {
138
190
  const previous = PROFILE_COMPONENT_OVERRIDE;
@@ -169,24 +221,395 @@ function registerHookCleanup(scope, cleanup) {
169
221
  let NATIVE_READ_DRIVER = null;
170
222
  let NATIVE_BLOCK_RETRIES = null;
171
223
  let NATIVE_ADOPTION_RELEASES = null;
224
+ let SIGNAL_BINDINGS_ENABLED = false;
225
+ const SCOPE_SIGNAL_OWNERS = /* @__PURE__ */ new WeakMap();
226
+ const SCOPE_SIGNAL_INSTANCE_KEYS = /* @__PURE__ */ new WeakMap();
227
+ let RETAINED_SIGNAL_OWNERS;
228
+ const SIGNAL_RETRY_LOCATIONS = /* @__PURE__ */ new WeakMap();
229
+ function signalRetryBoundary(block) {
230
+ let current = block;
231
+ while (current !== null) {
232
+ const state = current.__trySlot;
233
+ if (state !== void 0 && !state.propagateSuspense) return state;
234
+ current = current.parentBlock;
235
+ }
236
+ }
237
+ function retireRendererSignalOwner(owner) {
238
+ EFFECT_EVENT_LIFECYCLE_DEPTH++;
239
+ const frame = NATIVE_READ_DRIVER?.pauseLifecycle() ?? -1;
240
+ try {
241
+ retireSignalOwnerIdentity(owner);
242
+ } finally {
243
+ if (frame >= 0) NATIVE_READ_DRIVER.resumeLifecycle(frame);
244
+ EFFECT_EVENT_LIFECYCLE_DEPTH--;
245
+ }
246
+ }
247
+ function signalRetrySlot(scope, target) {
248
+ const children = scope.children;
249
+ if (children !== null) {
250
+ for (const child2 of children) {
251
+ if (child2.scope === target) return ["scope", child2.key];
252
+ const nested = signalRetrySlot(child2.scope, target);
253
+ if (nested !== null) return ["scope", child2.key, ...nested];
254
+ }
255
+ }
256
+ const block = target.block;
257
+ for (let index = 0; index < scope.slots.length; index++) {
258
+ const slot = scope.slots[index];
259
+ if (slot === null || typeof slot !== "object") continue;
260
+ if (block.forSlot !== null && (slot === block.forSlot || slot.forSlot === block.forSlot))
261
+ return ["slot", index, "item", block.key];
262
+ if (slot.block === block || slot.tryBlock === block || slot.emptyBlock === block) {
263
+ return [
264
+ "slot",
265
+ index,
266
+ slot.__kind,
267
+ slot.tryBlock === block ? "primary" : slot.branch,
268
+ slot.emptyBlock === block ? "empty" : slot.currentIsBodyFn ? void 0 : slot.currentComp,
269
+ slot.prevKey
270
+ ];
271
+ }
272
+ }
273
+ return null;
274
+ }
275
+ function signalRetryPath(scope, root) {
276
+ if (scope === root) return [];
277
+ const location = SIGNAL_RETRY_LOCATIONS.get(scope);
278
+ let parent = location?.parent ?? scope.parent ?? scope.block.parentBlock;
279
+ while (parent instanceof LiteBlockImpl) parent = parent.parentBlock;
280
+ if (parent === null) return null;
281
+ const segment = location === void 0 ? signalRetrySlot(parent, scope) : ["slot", location.slot, location.kind, location.branch, location.component, location.key];
282
+ if (segment === null) return null;
283
+ const path = signalRetryPath(parent, root);
284
+ return path === null ? null : path.concat(segment);
285
+ }
286
+ function signalRetryNode(cache, path, create) {
287
+ let node = cache.paths;
288
+ for (const key of path) {
289
+ let next = node.children?.get(key);
290
+ if (next === void 0) {
291
+ if (!create) return;
292
+ next = {};
293
+ (node.children ??= /* @__PURE__ */ new Map()).set(key, next);
294
+ }
295
+ node = next;
296
+ }
297
+ return node;
298
+ }
299
+ function retainSignalRetryScope(scope, root, holder, subtree = false) {
300
+ const owner = SCOPE_SIGNAL_OWNERS.get(scope);
301
+ if (owner) {
302
+ const path = signalRetryPath(scope, root);
303
+ if (path !== null) {
304
+ const cache = holder.retrySignalOwners ??= { paths: {}, owners: /* @__PURE__ */ new Set() };
305
+ const node = signalRetryNode(cache, path, true);
306
+ const previous = node.owner;
307
+ node.owner = owner;
308
+ cache.owners.add(owner);
309
+ if (previous !== void 0 && previous !== owner) {
310
+ cache.owners.delete(previous);
311
+ retireRendererSignalOwner(previous);
312
+ }
313
+ }
314
+ }
315
+ if (subtree)
316
+ forEachSubtreeChild(scope, (child2) => retainSignalRetryScope(child2, root, holder, true));
317
+ else if (scope.children !== null)
318
+ for (const child2 of scope.children) retainSignalRetryScope(child2.scope, root, holder);
319
+ }
320
+ function clearSignalRetryOwners(holder) {
321
+ const cache = holder.retrySignalOwners;
322
+ if (cache === void 0) return;
323
+ holder.retrySignalOwners = void 0;
324
+ for (const owner of cache.owners) retireRendererSignalOwner(owner);
325
+ }
326
+ function discardSignalRetryItem(block, error) {
327
+ const previous = RETAINED_SIGNAL_OWNERS;
328
+ if (isSuspenseException(error)) {
329
+ const owner = block.idState.renderOwner;
330
+ const boundary = signalRetryBoundary(block);
331
+ const root = boundary?.tryBlock ?? owner?.current;
332
+ const holder = boundary ?? owner;
333
+ if (holder !== void 0 && root != null) {
334
+ retainSignalRetryScope(block, root, holder, true);
335
+ RETAINED_SIGNAL_OWNERS = holder.retrySignalOwners;
336
+ }
337
+ }
338
+ try {
339
+ unmountBlock(
340
+ block,
341
+ activeHydration() === null && !ROOT_RENDER_TRANSACTION?.hydrating && !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block)
342
+ );
343
+ } finally {
344
+ RETAINED_SIGNAL_OWNERS = previous;
345
+ }
346
+ }
347
+ function signalRetryListPath(scope, state, root) {
348
+ while (scope instanceof LiteBlockImpl) scope = scope.parentBlock;
349
+ for (let index = 0; index < scope.slots.length; index++) {
350
+ const slot = scope.slots[index];
351
+ if (slot === state || slot?.forSlot === state) {
352
+ const path = signalRetryPath(scope, root);
353
+ return path === null ? null : path.concat("slot", index, "item");
354
+ }
355
+ }
356
+ if (scope.children !== null) {
357
+ for (const child2 of scope.children) {
358
+ const path = signalRetryListPath(child2.scope, state, root);
359
+ if (path !== null) return path;
360
+ }
361
+ }
362
+ return null;
363
+ }
364
+ function collectRetiredSignalRetryOwners(node, cache, retired) {
365
+ if (node.owner !== void 0) {
366
+ cache.owners.delete(node.owner);
367
+ retired.push(node.owner);
368
+ node.owner = void 0;
369
+ }
370
+ if (node.children !== void 0)
371
+ for (const child2 of node.children.values())
372
+ collectRetiredSignalRetryOwners(child2, cache, retired);
373
+ }
374
+ function trackSignalRetryListKeys(parent, state, length, source) {
375
+ const boundary = signalRetryBoundary(parent);
376
+ const owner = parent.idState.renderOwner;
377
+ const cache = boundary?.retrySignalOwners ?? owner?.retrySignalOwners;
378
+ const root = boundary?.retrySignalOwners !== void 0 ? boundary.tryBlock : owner?.current;
379
+ if (cache === void 0 || root == null) return;
380
+ const path = signalRetryListPath(parent, state, root);
381
+ const node = path === null ? void 0 : signalRetryNode(cache, path, false);
382
+ if (node?.children === void 0) return;
383
+ const prune = (keys) => {
384
+ const present = new Set(keys);
385
+ const retired = [];
386
+ for (const [key, child2] of node.children) {
387
+ if (present.has(key)) continue;
388
+ node.children.delete(key);
389
+ collectRetiredSignalRetryOwners(child2, cache, retired);
390
+ }
391
+ for (const owner2 of retired) retireRendererSignalOwner(owner2);
392
+ };
393
+ if (typeof source !== "function") {
394
+ prune(source);
395
+ return;
396
+ }
397
+ if (length === 0) {
398
+ prune([]);
399
+ return;
400
+ }
401
+ const observed = /* @__PURE__ */ new Map();
402
+ let complete = false;
403
+ return (index, key) => {
404
+ if (!complete) {
405
+ observed.set(index, key);
406
+ if (observed.size === length) {
407
+ complete = true;
408
+ prune(observed.values());
409
+ }
410
+ }
411
+ };
412
+ }
413
+ function enableSignalBindings(abi = 1, potentialOnly = false) {
414
+ if (abi !== 1) throw new TypeError(formatClientError(74));
415
+ SIGNAL_BINDINGS_ENABLED = true;
416
+ if (!potentialOnly) enableSignalDocument(abi);
417
+ }
418
+ function signalIdentityKey(value) {
419
+ if (value === null) return "null";
420
+ const kind = typeof value;
421
+ return kind === "string" || kind === "number" || kind === "bigint" || kind === "boolean" ? kind.charCodeAt(0).toString(36) + ":" + String(value) : kind === "undefined" ? "u:" : "o:" + String(value);
422
+ }
423
+ function rootSignalInstanceKey(ids) {
424
+ return JSON.stringify([ids.signalState?.prefix ?? ids.prefix, "root"]);
425
+ }
426
+ function resolveSignalInstanceKey(scope) {
427
+ const identity = SCOPE_SIGNAL_INSTANCE_KEYS.get(scope);
428
+ if (identity === void 0 || typeof identity === "string") return identity;
429
+ const key = structuralSignalInstanceKey(
430
+ identity.parentScope,
431
+ identity.invocationSite,
432
+ identity.key,
433
+ identity.hasKey
434
+ );
435
+ SCOPE_SIGNAL_INSTANCE_KEYS.set(scope, key);
436
+ return key;
437
+ }
438
+ function structuralSignalInstanceKey(parentScope, invocationSite, key, hasKey) {
439
+ let base = resolveSignalInstanceKey(parentScope);
440
+ const itemKeys = [];
441
+ const visited = /* @__PURE__ */ new Set();
442
+ let scope = parentScope;
443
+ while (base === void 0 && scope !== null) {
444
+ const block2 = scope.block;
445
+ if (!visited.has(block2)) {
446
+ visited.add(block2);
447
+ if (block2.forSlot !== null) itemKeys.push(signalIdentityKey(block2.key));
448
+ base = resolveSignalInstanceKey(block2);
449
+ }
450
+ scope = scope.parent;
451
+ if (base === void 0 && scope !== null) base = resolveSignalInstanceKey(scope);
452
+ }
453
+ let block = parentScope.block;
454
+ while (base === void 0 && block !== null) {
455
+ if (!visited.has(block)) {
456
+ visited.add(block);
457
+ if (block.forSlot !== null) itemKeys.push(signalIdentityKey(block.key));
458
+ }
459
+ base = resolveSignalInstanceKey(block);
460
+ block = block.parentBlock;
461
+ }
462
+ base ??= rootSignalInstanceKey(parentScope.block.idState);
463
+ itemKeys.reverse();
464
+ return base + JSON.stringify([invocationSite ?? "legacy", itemKeys, hasKey ? signalIdentityKey(key) : ""]);
465
+ }
466
+ function stampSignalInstance(scope, parentScope, invocationSite, key, hasKey) {
467
+ if (SIGNAL_BINDINGS_ENABLED || signalDocumentEnabled) {
468
+ SCOPE_SIGNAL_INSTANCE_KEYS.set(scope, { parentScope, invocationSite, key, hasKey });
469
+ }
470
+ }
471
+ function scopeSignalOwner(scope) {
472
+ if (scope === null) return;
473
+ const root = scope.block.idState.renderOwner;
474
+ let documentOwner = root?.signalOwner;
475
+ if (documentOwner === void 0 && signalDocumentEnabled) {
476
+ documentOwner = documentSignalOwner(scope.block.parentNode);
477
+ if (root !== void 0) root.signalOwner = documentOwner;
478
+ }
479
+ if (documentOwner === void 0) return;
480
+ let owner = SCOPE_SIGNAL_OWNERS.get(scope);
481
+ const retired = owner === null;
482
+ if (!owner || owner.documentOwner !== documentOwner) {
483
+ const ids = scope.block.idState;
484
+ owner = void 0;
485
+ const boundary = signalRetryBoundary(scope.block);
486
+ const cache = boundary?.retrySignalOwners ?? root?.retrySignalOwners;
487
+ const retryRoot = boundary?.retrySignalOwners !== void 0 ? boundary.tryBlock : root?.current;
488
+ if (cache !== void 0 && !retired && !scope.block.disposed && retryRoot != null) {
489
+ const path = signalRetryPath(scope, retryRoot);
490
+ const node = path === null ? void 0 : signalRetryNode(cache, path, false);
491
+ if (node?.owner !== void 0) {
492
+ owner = node.owner;
493
+ node.owner = void 0;
494
+ cache.owners.delete(owner);
495
+ }
496
+ }
497
+ if (owner === void 0 || owner.documentOwner !== documentOwner) {
498
+ const identity = {
499
+ scopeKey: documentOwner.scopeKey,
500
+ documentOwner,
501
+ instanceOwner: scope,
502
+ instanceKey: resolveSignalInstanceKey(scope) ?? rootSignalInstanceKey(ids)
503
+ };
504
+ identity.instanceOwner = identity;
505
+ owner = Object.freeze(identity);
506
+ }
507
+ SCOPE_SIGNAL_OWNERS.set(scope, owner);
508
+ if (retired) retireRendererSignalOwner(owner);
509
+ }
510
+ registerSignalOwnerDocument(owner, scope.block.parentNode.ownerDocument);
511
+ return owner;
512
+ }
513
+ function runWithBlockSignalOwner(scope, callback) {
514
+ const owner = scopeSignalOwner(scope);
515
+ if (owner !== void 0) STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
516
+ return owner === void 0 || currentSignalOwner() === owner ? callback() : runWithSignalOwner(owner, callback);
517
+ }
172
518
  import { readNativeDomStyle as readNativeDomStyle2, readNativeDomProps } from "./signals/read-protocol.js";
173
519
  function disposeNativeStyleBinding(binding) {
174
520
  if (binding.block !== null) unmountBlock(binding.block, false);
175
521
  binding.block = null;
176
522
  }
177
523
  function nativeStyleBody(props, scope) {
178
- const value = readNativeDomStyle(props.value);
524
+ const value = SIGNAL_BINDINGS_ENABLED ? runWithBlockSignalOwner(scope.parent, () => readNativeDomStyle(props.value)) : readNativeDomStyle(props.value);
179
525
  setStyle(props.el, value, scope.slots[0]);
180
526
  journalRootProperty(scope.slots, 0, scope.slots[0]);
181
527
  scope.slots[0] = value;
182
528
  }
183
529
  function nativeStyleBinding(owner, slotIndex, el, value) {
530
+ nativePresentationBinding(owner, slotIndex, el, nativeStyleBody, { el, value });
531
+ }
532
+ function prepareNativeProjection(props, scope) {
533
+ const prepare = () => {
534
+ const projected = props.compute();
535
+ return props.fields.map((field) => {
536
+ const value = projected?.[field];
537
+ if (field === "style") return __normalizeBindingStyle(readNativeDomStyle(value));
538
+ if (field === "class" || field === "className")
539
+ return value == null || value === false ? null : normalizeClass(value);
540
+ return coerceAttrValue(props.el, field, value);
541
+ });
542
+ };
543
+ return SIGNAL_BINDINGS_ENABLED ? runWithBlockSignalOwner(scope.parent, prepare) : prepare();
544
+ }
545
+ function publishNativeProjection(props, values, previous) {
546
+ for (let i = 0; i < props.fields.length; i++) {
547
+ const field = props.fields[i];
548
+ const value = values[i];
549
+ if (previous !== void 0 && Object.is(previous[i], value)) continue;
550
+ if (field === "style") setStyle(props.el, value, previous?.[i]);
551
+ else if (field === "class" || field === "className") setClassAttr(props.el, value);
552
+ else setAttribute(props.el, field, value);
553
+ }
554
+ }
555
+ function nativeProjectionBody(props, scope) {
556
+ const values = prepareNativeProjection(props, scope);
557
+ publishNativeProjection(props, values, scope.slots[0]);
558
+ journalRootProperty(scope.slots, 0, scope.slots[0]);
559
+ scope.slots[0] = values;
560
+ }
561
+ function preparedNativeStyleBody(props, scope) {
562
+ const native = setNativeAdoptionResolver(null);
563
+ const witness = beginNativeReadWitness();
564
+ let value;
565
+ let completed = false;
566
+ try {
567
+ value = runWithBlockSignalOwner(
568
+ scope.parent,
569
+ () => __normalizeBindingStyle(readNativeDomStyle(props.value))
570
+ );
571
+ completed = true;
572
+ } finally {
573
+ props.frame.witnesses.set(scope, finishNativeReadWitness(witness, completed));
574
+ setNativeAdoptionResolver(native);
575
+ }
576
+ preparePresentationOperation(props.frame, scope, "native", () => {
577
+ setStyle(props.el, value, "");
578
+ scope.block.body = nativeStyleBody;
579
+ });
580
+ journalRootProperty(scope.slots, 0, scope.slots[0]);
581
+ scope.slots[0] = value;
582
+ }
583
+ function preparedNativeProjectionBody(props, scope) {
584
+ const native = setNativeAdoptionResolver(null);
585
+ const witness = beginNativeReadWitness();
586
+ let values;
587
+ let completed = false;
588
+ try {
589
+ values = prepareNativeProjection(props, scope);
590
+ completed = true;
591
+ } finally {
592
+ props.frame.witnesses.set(scope, finishNativeReadWitness(witness, completed));
593
+ setNativeAdoptionResolver(native);
594
+ }
595
+ preparePresentationOperation(props.frame, scope, "native", () => {
596
+ publishNativeProjection(
597
+ props,
598
+ values,
599
+ props.fields.map((field) => field === "style" ? "" : void 0)
600
+ );
601
+ scope.block.body = nativeProjectionBody;
602
+ });
603
+ journalRootProperty(scope.slots, 0, scope.slots[0]);
604
+ scope.slots[0] = values;
605
+ }
606
+ function nativeProjectionBinding(owner, slotIndex, el, compute, fields) {
607
+ nativePresentationBinding(owner, slotIndex, el, nativeProjectionBody, { el, compute, fields });
608
+ }
609
+ function nativePresentationBinding(owner, slotIndex, el, body, props) {
184
610
  let binding = owner.slots[slotIndex];
185
611
  if (binding === void 0) {
186
- const block = createBlock("control-flow", owner.block, el, null, null, nativeStyleBody, {
187
- el,
188
- value
189
- });
612
+ const block = createBlock("control-flow", owner.block, el, null, null, body, props);
190
613
  block.parent = owner;
191
614
  binding = {
192
615
  __kind: "nativeStyleBinding",
@@ -206,7 +629,7 @@ function nativeStyleBinding(owner, slotIndex, el, value) {
206
629
  block.slots[0] = void 0;
207
630
  }
208
631
  journalRootProperty(block, "props", block.props);
209
- block.props = { el, value };
632
+ block.props = props;
210
633
  }
211
634
  renderBlock(binding.block);
212
635
  }
@@ -226,6 +649,15 @@ function beginActiveNativeReadScope(scope) {
226
649
  return block === null ? -1 : NATIVE_READ_DRIVER.beginScope(scope, block);
227
650
  }
228
651
  function scheduleNativeRead(target) {
652
+ const activation = preservedHydrateActivationCount === 0 ? null : pendingHydrateOwner(target);
653
+ if (activation !== null) {
654
+ invalidateRender(target, activation.block);
655
+ if (activation.activationRequested) {
656
+ activation.serverActivationStarted = false;
657
+ scheduleRender(activation.parentBlock);
658
+ }
659
+ return;
660
+ }
229
661
  invalidateRender(target, target);
230
662
  const retainPriority = SCHEDULED_VISIBILITY_DRIVER?.holdsNativeRead(target) === true;
231
663
  if (retainPriority) TRANSITION_DEPTH++;
@@ -241,6 +673,8 @@ function ensureNativeReadDriver() {
241
673
  capture: () => WIP_CAPTURE,
242
674
  cleanup: registerHookCleanup,
243
675
  schedule: scheduleNativeRead,
676
+ prepare: prepareNativeTransitionBlock,
677
+ retire: retireNativeTransitionBlock,
244
678
  suspended: retainNativeRetryReads,
245
679
  replayRefs: (capture, owner) => replayNativeUnpublishedRefs(capture, owner),
246
680
  refDisposed: (entry) => blockSubtreeDisposed(entry.block)
@@ -272,13 +706,13 @@ function inspectDevtoolsName(scope) {
272
706
  }
273
707
  function acceptNativeCapture(capture, owner, replayRootRefs = false) {
274
708
  const driver = NATIVE_READ_DRIVER;
275
- if (driver === null) return;
709
+ if (driver === null) return false;
276
710
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(
277
711
  () => acceptNativeCapture(capture, owner, replayRootRefs)
278
712
  ) === true)
279
- return;
713
+ return true;
280
714
  const native = driver.acceptCapture(capture);
281
- if (owner === void 0) return;
715
+ if (owner === void 0) return false;
282
716
  const replays = replayRootRefs && driver.replayDeferredRefs(capture, owner);
283
717
  if (native || replays || driver.hasPublication(owner)) {
284
718
  driver.stampPublication(owner, [
@@ -289,6 +723,7 @@ function acceptNativeCapture(capture, owner, replayRootRefs = false) {
289
723
  capture.refs
290
724
  ]);
291
725
  }
726
+ return false;
292
727
  }
293
728
  function replayNativeUnpublishedRefs(capture, owner) {
294
729
  const driver = NATIVE_READ_DRIVER;
@@ -326,6 +761,7 @@ function replayNativeReadWitness(witness) {
326
761
  NATIVE_READ_DRIVER?.replay(witness);
327
762
  }
328
763
  function retainNativeRetryReads(block, reads) {
764
+ if (NATIVE_TRANSITION_ATTEMPT !== null) return;
329
765
  for (let current = block; current !== null; current = current.parentBlock) {
330
766
  if (current.__suspenseHandler) {
331
767
  const retries = NATIVE_BLOCK_RETRIES ??= /* @__PURE__ */ new WeakMap();
@@ -482,6 +918,7 @@ function hydrationNodeMatches(server, template2, partialStyles, path = "") {
482
918
  const tAttrs = (STAGED_DOM?.view(t) ?? t).attributes;
483
919
  for (let i = 0; i < tAttrs.length; i++) {
484
920
  const a = tAttrs[i];
921
+ if ((STAGED_DOM?.view(a) ?? a).name === HYDRATE_INPUT_ATTR) continue;
485
922
  if ((STAGED_DOM?.view(s) ?? s).getAttribute((STAGED_DOM?.view(a) ?? a).name) !== (STAGED_DOM?.view(a) ?? a).value && !((STAGED_DOM?.view(a) ?? a).name === "style" && partialStyles !== void 0 && partialStyles.includes("|" + path + "|"))) {
486
923
  return false;
487
924
  }
@@ -538,22 +975,24 @@ let COMMIT_PHASE_ERRORS = null;
538
975
  let REF_CALLBACK_DEPTH = 0;
539
976
  let STORE_SYNC_DEPTH = 0;
540
977
  let EFFECT_EVENT_LIFECYCLE_DEPTH = 0;
541
- function runEffectLifecycleCallback(callback) {
978
+ function runEffectLifecycleCallback(callback, scope = null) {
542
979
  EFFECT_EVENT_LIFECYCLE_DEPTH++;
543
980
  const nativeFrame = NATIVE_READ_DRIVER?.pauseLifecycle() ?? -1;
544
981
  try {
545
- callback();
982
+ if (signalDocumentEnabled || scope?.block.idState.renderOwner?.signalOwner !== void 0)
983
+ runWithBlockSignalOwner(scope, callback);
984
+ else callback();
546
985
  } finally {
547
986
  if (nativeFrame >= 0) NATIVE_READ_DRIVER.resumeLifecycle(nativeFrame);
548
987
  EFFECT_EVENT_LIFECYCLE_DEPTH--;
549
988
  }
550
989
  }
551
- function runEffectCleanupCallback(callback, phase = -1) {
990
+ function runEffectCleanupCallback(callback, phase = -1, scope = null) {
552
991
  const previousPhase = CURRENT_EFFECT_PHASE;
553
992
  CURRENT_EFFECT_PHASE = phase;
554
993
  EFFECT_BODY_DEPTH++;
555
994
  try {
556
- runEffectLifecycleCallback(callback);
995
+ runEffectLifecycleCallback(callback, scope);
557
996
  } finally {
558
997
  EFFECT_BODY_DEPTH--;
559
998
  CURRENT_EFFECT_PHASE = previousPhase;
@@ -588,8 +1027,275 @@ function ensureTransitionSwapDriver() {
588
1027
  rebaseHeld: rebaseHeldTransitionUpdate
589
1028
  };
590
1029
  }
1030
+ let NATIVE_TRANSITION_QUEUE = null;
1031
+ let NATIVE_TRANSITION_ATTEMPT = null;
1032
+ function queueNativeTransition(batch) {
1033
+ (NATIVE_TRANSITION_QUEUE ??= /* @__PURE__ */ new Set()).add(batch);
1034
+ if (!scheduled && !syncFlush) {
1035
+ scheduled = true;
1036
+ queueMicrotask(flush);
1037
+ }
1038
+ }
1039
+ function prepareNativeTransitionBlock(block) {
1040
+ const admission = NATIVE_TRANSITION_ATTEMPT;
1041
+ if (block.disposed || admission.blocks.has(block)) return;
1042
+ const hidden = SCHEDULED_VISIBILITY_DRIVER?.find(block, false);
1043
+ if (hidden?.nativeTransition !== void 0 && hidden.tryBlock !== null) block = hidden.tryBlock;
1044
+ if (admission.blocks.has(block)) return;
1045
+ const owner = block.idState.renderOwner;
1046
+ if (owner === void 0 || owner.disposed) return;
1047
+ const retired = owner.transaction?.retired;
1048
+ if (retired !== void 0 && retired !== null) {
1049
+ for (let current = block; current !== null; current = current.parentBlock)
1050
+ if (retired.has(current)) return;
1051
+ }
1052
+ admission.blocks.add(block);
1053
+ const root = beginRootRender(owner);
1054
+ admission.transactions.add(owner.transaction);
1055
+ const mode = block.pendingMode;
1056
+ block.pendingMode = "transition";
1057
+ const attempt = beginTransitionAttempt(block);
1058
+ if (attempt !== null) admission.attempts.push(attempt);
1059
+ try {
1060
+ invalidateRender(block, block);
1061
+ if (hidden?.nativeTransition !== void 0) {
1062
+ journalObjectOnce(hidden);
1063
+ journalRootProperty(block, "inactive", block.inactive);
1064
+ SCHEDULED_VISIBILITY_DRIVER.reveal(hidden, "transition");
1065
+ } else renderBlock(block);
1066
+ } catch (error) {
1067
+ if (isSuspenseException(error)) {
1068
+ for (let owner2 = block; owner2 !== null; owner2 = owner2.parentBlock) {
1069
+ const handler = owner2.__suspenseHandler;
1070
+ if (handler) {
1071
+ try {
1072
+ handler(error.thenable, block);
1073
+ } catch (suspension) {
1074
+ if (!isSuspenseException(suspension)) throw suspension;
1075
+ }
1076
+ break;
1077
+ }
1078
+ }
1079
+ throw error.thenable;
1080
+ }
1081
+ admission.errorBlock ??= block;
1082
+ throw error;
1083
+ } finally {
1084
+ endTransitionAttempt(attempt);
1085
+ block.pendingMode = mode;
1086
+ endRootRender(root);
1087
+ }
1088
+ }
1089
+ function finishNativeTransition(batch) {
1090
+ batch.nativeWake?.();
1091
+ batch.nativeWake = void 0;
1092
+ batch.native = void 0;
1093
+ for (const block of batch.nativeBlocks ?? [])
1094
+ block.idState.renderOwner?.nativeTransitions?.delete(batch);
1095
+ batch.nativeBlocks = void 0;
1096
+ for (const state of batch.nativeBoundaries?.keys() ?? []) {
1097
+ if (state.nativeTransition !== batch) continue;
1098
+ state.nativeTransition = void 0;
1099
+ if (state.transitionTimeoutId !== null) {
1100
+ clearTimeout(state.transitionTimeoutId);
1101
+ state.transitionTimeoutId = null;
1102
+ }
1103
+ }
1104
+ batch.nativeBoundaries = void 0;
1105
+ NATIVE_TRANSITION_QUEUE?.delete(batch);
1106
+ if (NATIVE_TRANSITION_QUEUE?.size === 0) NATIVE_TRANSITION_QUEUE = null;
1107
+ releaseTransitionHookHolder(batch);
1108
+ }
1109
+ function retireNativeTransitionBlock(block) {
1110
+ if (ROOT_RENDER_ROLLBACK) return;
1111
+ for (const batch of block.idState.renderOwner?.nativeTransitions ?? []) {
1112
+ if (!batch.nativeBlocks?.has(block)) continue;
1113
+ queueNativeTransition(batch);
1114
+ }
1115
+ }
1116
+ function prepareNativeTransitionUpdates(batch) {
1117
+ for (const update of batch.updates.values()) {
1118
+ const { block, slot, state, reducer } = update;
1119
+ const owner = block.idState.renderOwner;
1120
+ if (block.disposed || owner === void 0 || owner.disposed) continue;
1121
+ const frame = beginRootRender(owner);
1122
+ NATIVE_TRANSITION_ATTEMPT.transactions.add(owner.transaction);
1123
+ try {
1124
+ journalObjectOnce(slot);
1125
+ if (state !== void 0) {
1126
+ state.renderTransition = update;
1127
+ state.updates = void 0;
1128
+ } else if (reducer !== void 0) {
1129
+ reducer.renderTransition = update;
1130
+ reducer.renderPhaseActions = void 0;
1131
+ } else slot.value = rebaseTransitionActionUpdate(update);
1132
+ if (slot.pendingActionBatch === batch) {
1133
+ slot.pendingActionBatch = void 0;
1134
+ slot.pendingActionValue = void 0;
1135
+ }
1136
+ } finally {
1137
+ endRootRender(frame);
1138
+ }
1139
+ }
1140
+ }
1141
+ function prepareNativeTransitionHook(batch, hook) {
1142
+ const owner = hook.block.idState.renderOwner;
1143
+ if (hook.block.disposed || owner === void 0 || owner.disposed) return;
1144
+ const frame = beginRootRender(owner);
1145
+ NATIVE_TRANSITION_ATTEMPT.transactions.add(owner.transaction);
1146
+ try {
1147
+ if (batch.hooksPending && hook.pendingBatches === 1) {
1148
+ journalObjectOnce(hook);
1149
+ hook.isPending = false;
1150
+ }
1151
+ } finally {
1152
+ endRootRender(frame);
1153
+ }
1154
+ prepareNativeTransitionBlock(hook.block);
1155
+ }
1156
+ function flushNativeTransitions() {
1157
+ const queue = NATIVE_TRANSITION_QUEUE;
1158
+ if (queue === null) return;
1159
+ NATIVE_TRANSITION_QUEUE = null;
1160
+ for (const batch of queue) {
1161
+ const candidate = batch.native;
1162
+ if (candidate === void 0) continue;
1163
+ batch.nativeWake?.();
1164
+ batch.nativeWake = void 0;
1165
+ try {
1166
+ if (!candidate.validate()) candidate.rebase();
1167
+ } catch {
1168
+ candidate.discard();
1169
+ finishNativeTransition(batch);
1170
+ flushTransitionActionBatch(batch);
1171
+ continue;
1172
+ }
1173
+ if (!candidate.hasWrites()) {
1174
+ candidate.discard();
1175
+ finishNativeTransition(batch);
1176
+ flushTransitionActionBatch(batch);
1177
+ continue;
1178
+ }
1179
+ const admission = {
1180
+ blocks: /* @__PURE__ */ new Set(),
1181
+ transactions: /* @__PURE__ */ new Set(),
1182
+ attempts: [],
1183
+ presentations: [],
1184
+ suspensions: /* @__PURE__ */ new Map()
1185
+ };
1186
+ NATIVE_TRANSITION_ATTEMPT = admission;
1187
+ let outcome;
1188
+ try {
1189
+ outcome = candidate.prepare([
1190
+ () => prepareNativeTransitionUpdates(batch),
1191
+ ...batch.hook === null ? [] : [() => prepareNativeTransitionHook(batch, batch.hook)],
1192
+ ...(batch.hooks ?? []).map((hook) => () => prepareNativeTransitionHook(batch, hook)),
1193
+ ...[...batch.updates.values()].map(
1194
+ (update) => () => prepareNativeTransitionBlock(update.block)
1195
+ ),
1196
+ ...candidate.consumers().filter((consumer) => consumer.active()).map((consumer) => () => {
1197
+ const presentation = consumer.prepare();
1198
+ if (presentation !== void 0) admission.presentations.push(presentation);
1199
+ })
1200
+ ]);
1201
+ } finally {
1202
+ NATIVE_TRANSITION_ATTEMPT = null;
1203
+ }
1204
+ for (const block of batch.nativeBlocks ?? [])
1205
+ block.idState.renderOwner?.nativeTransitions?.delete(batch);
1206
+ batch.nativeBlocks = admission.blocks;
1207
+ for (const transaction of admission.transactions)
1208
+ (transaction.owner.nativeTransitions ??= /* @__PURE__ */ new Set()).add(batch);
1209
+ const valid = outcome.status === "ready" && admission.presentations.every((presentation) => presentation.validate()) && [...admission.transactions].every(
1210
+ (transaction) => !transaction.aborted && !transaction.owner.disposed && currentPresentations(transaction.capture) && (NATIVE_READ_DRIVER === null || NATIVE_READ_DRIVER.validateCapture(transaction.capture))
1211
+ );
1212
+ if (valid && outcome.status === "ready" && outcome.receipt.publish(() => {
1213
+ for (const transaction of admission.transactions) {
1214
+ transaction.nativeAdmitted = true;
1215
+ acceptNativeCapture(transaction.capture, transaction.owner, true);
1216
+ }
1217
+ batch.flushed = true;
1218
+ batch.updates.clear();
1219
+ finishNativeTransition(batch);
1220
+ for (const presentation of admission.presentations) presentation.commit();
1221
+ commitRootRenders();
1222
+ })) {
1223
+ continue;
1224
+ }
1225
+ for (const transaction of admission.transactions) rollbackRootRender(transaction);
1226
+ for (const presentation of admission.presentations) presentation.discard();
1227
+ for (let i = admission.attempts.length - 1; i >= 0; i--) {
1228
+ const swaps = admission.attempts[i].memoSwaps;
1229
+ if (swaps !== null)
1230
+ for (let j = swaps.length - 1; j >= 0; j--) applyTransitionMemoSwap(swaps[j], false);
1231
+ }
1232
+ commitRootRenders();
1233
+ if (outcome.status === "pending") {
1234
+ for (const state of batch.nativeBoundaries?.keys() ?? []) {
1235
+ if (admission.suspensions.has(state)) continue;
1236
+ if (state.nativeTransition === batch) state.nativeTransition = void 0;
1237
+ if (state.transitionTimeoutId !== null) {
1238
+ clearTimeout(state.transitionTimeoutId);
1239
+ state.transitionTimeoutId = null;
1240
+ }
1241
+ }
1242
+ for (const [state, thenable] of admission.suspensions) {
1243
+ state.nativeTransition = batch;
1244
+ if (state.hasResolved && state.branch === 1 && state.pendingBody !== null && TRANSITION_FALLBACK_TIMEOUT_MS !== Infinity && TRANSITION_FALLBACK_TIMEOUT_MS >= 0 && (state.transitionTimeoutId === null || batch.nativeBoundaries?.get(state) !== thenable)) {
1245
+ if (state.transitionTimeoutId !== null) clearTimeout(state.transitionTimeoutId);
1246
+ state.transitionTimeoutId = setTimeout(() => {
1247
+ state.transitionTimeoutId = null;
1248
+ if (state.nativeTransition === batch && !state.parentBlock.disposed && state.branch === 1)
1249
+ SCHEDULED_VISIBILITY_DRIVER.hidePending(state);
1250
+ }, TRANSITION_FALLBACK_TIMEOUT_MS);
1251
+ }
1252
+ }
1253
+ batch.nativeBoundaries = admission.suspensions;
1254
+ batch.nativeWake = candidate.watchPreparation(outcome, () => queueNativeTransition(batch));
1255
+ } else if (outcome.status === "ready" || outcome.status === "invalid" && outcome.reason === "stale") {
1256
+ queueNativeTransition(batch);
1257
+ } else {
1258
+ candidate.discard();
1259
+ finishNativeTransition(batch);
1260
+ for (const update of batch.updates.values()) {
1261
+ if (update.slot.pendingActionBatch === batch) {
1262
+ update.slot.pendingActionBatch = void 0;
1263
+ update.slot.pendingActionValue = void 0;
1264
+ }
1265
+ }
1266
+ batch.updates.clear();
1267
+ batch.flushed = true;
1268
+ if (outcome.status === "error") {
1269
+ if (admission.errorBlock !== void 0 && !admission.errorBlock.disposed)
1270
+ handleResumeError(admission.errorBlock, outcome.error);
1271
+ else reportTransitionError(outcome.error, batch.hook ?? void 0);
1272
+ } else if (outcome.status === "invalid")
1273
+ reportTransitionError(new TypeError(formatClientError(79)), batch.hook ?? void 0);
1274
+ }
1275
+ }
1276
+ }
591
1277
  let ACTIVE_TRANSITION_ACTION_BATCH = null;
592
1278
  let IN_FLIGHT_TRANSITION_ACTION_BATCH = null;
1279
+ let nativeActionResolverInstalled = false;
1280
+ function nativeCandidateForAction(batch) {
1281
+ let candidate = batch.native;
1282
+ if (candidate !== void 0 && !candidate.validate()) {
1283
+ if (candidate.hasWrites()) candidate.rebase();
1284
+ else {
1285
+ candidate.discard();
1286
+ candidate = void 0;
1287
+ }
1288
+ }
1289
+ return candidate ?? (batch.native = new SignalCandidateFrame());
1290
+ }
1291
+ function ensureNativeActionResolver() {
1292
+ if (nativeActionResolverInstalled) return;
1293
+ nativeActionResolverInstalled = true;
1294
+ registerNativeActionResolver(() => {
1295
+ const batch = transitionActionBatchForUpdate();
1296
+ return batch === null ? void 0 : nativeCandidateForAction(batch);
1297
+ });
1298
+ }
593
1299
  function createTransitionActionBatch() {
594
1300
  return {
595
1301
  updates: /* @__PURE__ */ new Map(),
@@ -652,6 +1358,16 @@ function stageTransitionValue(slot, block, operation, value, forceRender = false
652
1358
  }
653
1359
  function flushTransitionActionBatch(batch) {
654
1360
  if (batch.flushed) return;
1361
+ if (batch.native !== void 0) {
1362
+ if (batch.native.hasWrites()) {
1363
+ holdTransitionHookBatch(batch, batch);
1364
+ queueNativeTransition(batch);
1365
+ if (IN_FLIGHT_TRANSITION_ACTION_BATCH === batch) IN_FLIGHT_TRANSITION_ACTION_BATCH = null;
1366
+ return;
1367
+ }
1368
+ batch.native.discard();
1369
+ batch.native = void 0;
1370
+ }
655
1371
  batch.flushed = true;
656
1372
  for (const update of batch.updates.values()) {
657
1373
  const { slot, block, forceRender } = update;
@@ -1317,24 +2033,45 @@ function journalRootSlot(state, parent, before, after) {
1317
2033
  journalUndo(() => {
1318
2034
  structures.delete(state);
1319
2035
  });
1320
- journalRootRange(parent, before, after);
2036
+ if (PRESENTATION_HYDRATION?.revision === void 0) journalRootRange(parent, before, after);
1321
2037
  }
1322
2038
  function journalRootRange(parent, before, after) {
2039
+ const leases = ROOT_RENDER_TRANSACTION?.owner.bindingLeases;
1323
2040
  const nodes = [];
1324
2041
  for (let node = before === null ? getFirstChild(parent) : getNextSibling(before); node !== null && node !== after; node = getNextSibling(node))
1325
2042
  nodes.push(node);
1326
2043
  journalUndo(() => {
2044
+ let restore = nodes;
2045
+ for (const lease of leases ?? []) {
2046
+ if (lease.end === void 0 || !lease.active()) continue;
2047
+ let ancestor = parent;
2048
+ while (ancestor !== null && ancestor.parentNode !== lease.root.parentNode)
2049
+ ancestor = ancestor.parentNode;
2050
+ for (let current2 = lease.root; current2 !== null; current2 = current2.nextSibling) {
2051
+ if (current2 === ancestor) return;
2052
+ if (current2 === lease.end) break;
2053
+ }
2054
+ const start = restore.indexOf(lease.root);
2055
+ const end = restore.indexOf(lease.end);
2056
+ if (start < 0 || end < start || lease.root.parentNode !== parent) continue;
2057
+ const current = [];
2058
+ for (let node2 = lease.root; node2 !== null; node2 = node2.nextSibling) {
2059
+ current.push(node2);
2060
+ if (node2 === lease.end) break;
2061
+ }
2062
+ restore = [...restore.slice(0, start), ...current, ...restore.slice(end + 1)];
2063
+ }
1327
2064
  if (before !== null && (STAGED_DOM?.view(before) ?? before).parentNode !== parent || after !== null && (STAGED_DOM?.view(after) ?? after).parentNode !== parent)
1328
2065
  return;
1329
2066
  let node = before !== null && (STAGED_DOM?.view(before) ?? before).parentNode === parent ? getNextSibling(before) : getFirstChild(parent);
1330
2067
  const anchor = after !== null && (STAGED_DOM?.view(after) ?? after).parentNode === parent ? after : null;
1331
- const retained = new Set(nodes);
2068
+ const retained = new Set(restore);
1332
2069
  while (node !== null && node !== anchor) {
1333
2070
  const next = getNextSibling(node);
1334
2071
  if (!retained.has(node)) (STAGED_DOM?.view(parent) ?? parent).removeChild(node);
1335
2072
  node = next;
1336
2073
  }
1337
- restoreRootNodes(parent, nodes, anchor);
2074
+ restoreRootNodes(parent, restore, anchor);
1338
2075
  });
1339
2076
  }
1340
2077
  function journalRootChildren(parent) {
@@ -1479,6 +2216,7 @@ function createdInRootRender(block) {
1479
2216
  if (transaction === null || ROOT_RENDER_ROLLBACK || isCreatedInRootRender(transaction, block))
1480
2217
  return;
1481
2218
  block.createdStamp = transaction.createdStamp;
2219
+ if (PRESENTATION_HYDRATION?.revision !== void 0) preserveRootCreatedDom(block);
1482
2220
  (transaction.created ??= []).push(block);
1483
2221
  TRANSITION_JOURNAL.push(JOURNAL_CREATED, block, transaction, null);
1484
2222
  }
@@ -1489,6 +2227,8 @@ function preserveRootCreatedDom(block) {
1489
2227
  function rollbackRootRender(transaction) {
1490
2228
  if (transaction.aborted) return;
1491
2229
  transaction.aborted = true;
2230
+ if (transaction.owner.retrySignalOwners !== void 0 && transaction.owner.retrySignalOwners !== RETAINED_SIGNAL_OWNERS)
2231
+ clearSignalRetryOwners(transaction.owner);
1492
2232
  const frame = beginRootRender(transaction.owner);
1493
2233
  const previousRollback = ROOT_RENDER_ROLLBACK;
1494
2234
  ROOT_RENDER_ROLLBACK = true;
@@ -1515,6 +2255,19 @@ function rollbackRootRender(transaction) {
1515
2255
  endRootRender(frame);
1516
2256
  }
1517
2257
  }
2258
+ function retireDetachedBindingLeases(owner) {
2259
+ for (const lease of owner.bindingLeases) {
2260
+ if (owner.bindingContainer.contains(lease.anchor)) continue;
2261
+ owner.bindingLeases.delete(lease);
2262
+ PRESENTATION_PREPARATIONS.delete(lease);
2263
+ releaseBindingHandoff(lease);
2264
+ try {
2265
+ lease.retire();
2266
+ } catch (error) {
2267
+ if (!reportUncaughtError(owner.current, error)) console.error(error);
2268
+ }
2269
+ }
2270
+ }
1518
2271
  function commitRootRenders() {
1519
2272
  const transactions = ROOT_RENDER_TRANSACTIONS;
1520
2273
  if (transactions.length === 0) return;
@@ -1528,17 +2281,23 @@ function commitRootRenders() {
1528
2281
  if (owner.transition !== void 0) TRANSITION_SWAP_DRIVER.commitRoot(owner, transaction);
1529
2282
  continue;
1530
2283
  }
1531
- if (NATIVE_READ_DRIVER !== null && !NATIVE_READ_DRIVER.validateCapture(transaction.capture)) {
2284
+ if (!transaction.nativeAdmitted && (!currentPresentations(transaction.capture) || NATIVE_READ_DRIVER !== null && !NATIVE_READ_DRIVER.validateCapture(transaction.capture))) {
2285
+ const presentationChanged = !currentPresentations(transaction.capture);
1532
2286
  rollbackRootRender(transaction);
1533
2287
  if (owner.transaction === transaction) owner.transaction = null;
1534
2288
  if (!owner.disposed) {
1535
2289
  owner.wakeable = null;
1536
2290
  owner.generation++;
1537
- owner.retry();
2291
+ if (presentationChanged) retryPresentations(transaction.capture);
2292
+ else owner.retry();
1538
2293
  }
1539
2294
  continue;
1540
2295
  }
1541
2296
  if (owner.transaction === transaction) owner.transaction = null;
2297
+ if (transaction.capture.presentations !== void 0 && STAGED_COMMIT_CAPTURE !== null) {
2298
+ stagedOwnerGuard(STAGED_COMMIT_CAPTURE, owner);
2299
+ STAGED_COMMIT_CAPTURE.owners.get(owner).presentation = transaction;
2300
+ }
1542
2301
  if (transaction.rootRequest && (owner.transition === void 0 || !TRANSITION_SWAP_DRIVER.keepsRoot(owner))) {
1543
2302
  owner.wakeable = null;
1544
2303
  owner.generation++;
@@ -1546,8 +2305,9 @@ function commitRootRenders() {
1546
2305
  if (owner.wakeable === null) {
1547
2306
  owner.retryKey = null;
1548
2307
  owner.nativeRetry?.clear();
2308
+ if (owner.retrySignalOwners !== void 0) clearSignalRetryOwners(owner);
1549
2309
  }
1550
- acceptNativeCapture(transaction.capture, owner, true);
2310
+ const deferredNativeAcceptance = acceptNativeCapture(transaction.capture, owner, true);
1551
2311
  const acceptedGeneration = owner.generation;
1552
2312
  const commits = transaction.commit;
1553
2313
  if (commits !== null) {
@@ -1573,7 +2333,11 @@ function commitRootRenders() {
1573
2333
  discardOffscreenCapture(transaction.capture);
1574
2334
  continue;
1575
2335
  }
1576
- spliceOffscreenCapture(transaction.capture);
2336
+ spliceOffscreenCapture(transaction.capture, deferredNativeAcceptance);
2337
+ if (owner.bindingLeases !== void 0 && owner.bindingLeases.size > 0) {
2338
+ if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => retireDetachedBindingLeases(owner)) !== true)
2339
+ retireDetachedBindingLeases(owner);
2340
+ }
1577
2341
  if (owner.transition !== void 0) TRANSITION_SWAP_DRIVER.commitRoot(owner, transaction);
1578
2342
  } finally {
1579
2343
  finishStagedOwner?.();
@@ -1592,7 +2356,19 @@ function suspendRootRender(block, wakeable, attempt) {
1592
2356
  retainDiscardedWarmMemos(created);
1593
2357
  }
1594
2358
  }
1595
- rollbackRootRender(transaction);
2359
+ const previousRetainedOwners = RETAINED_SIGNAL_OWNERS;
2360
+ const rootBlock = owner.current;
2361
+ if (rootBlock !== null && transaction.created !== null && owner.signalOwner !== void 0) {
2362
+ for (const created of transaction.created) {
2363
+ if (!created.disposed) retainSignalRetryScope(created, rootBlock, owner);
2364
+ }
2365
+ RETAINED_SIGNAL_OWNERS = owner.retrySignalOwners;
2366
+ }
2367
+ try {
2368
+ rollbackRootRender(transaction);
2369
+ } finally {
2370
+ RETAINED_SIGNAL_OWNERS = previousRetainedOwners;
2371
+ }
1596
2372
  }
1597
2373
  owner.wakeable = wakeable;
1598
2374
  const generation = ++owner.generation;
@@ -3274,6 +4050,7 @@ function ensureScheduledVisibilityDriver() {
3274
4050
  find: findScheduledVisibilityOwner,
3275
4051
  holdsNativeRead,
3276
4052
  reveal: attemptHiddenReveal,
4053
+ hidePending: hideTryContentAndMountPending,
3277
4054
  visible: renderVisibleTry,
3278
4055
  rehide: rehideActivityAfterDescendantRender,
3279
4056
  retryActivity: renderHiddenActivity
@@ -3369,16 +4146,22 @@ function drainQueue() {
3369
4146
  } catch (unhandled) {
3370
4147
  const transaction = block.idState.renderOwner?.transaction;
3371
4148
  if (transaction != null) rollbackRootRender(transaction);
3372
- if (!reportUncaughtError(block, unhandled)) {
3373
- if (pendingError === null) pendingError = { err: unhandled, all: [unhandled] };
4149
+ const reported = unhandled instanceof PresentationAdoptionMiss && Object.prototype.hasOwnProperty.call(unhandled, "failure") ? unhandled.failure : unhandled;
4150
+ if (!reportUncaughtError(block, reported)) {
4151
+ if (pendingError === null) pendingError = { err: reported, all: [reported] };
3374
4152
  else {
3375
- pendingError.all.push(unhandled);
4153
+ pendingError.all.push(reported);
3376
4154
  pendingError.err = typeof AggregateError === "function" ? new AggregateError(pendingError.all, formatClientError(13)) : pendingError.all[0];
3377
4155
  }
3378
4156
  }
3379
4157
  let root = block;
3380
4158
  while (root.parentBlock !== null) root = root.parentBlock;
3381
- if (root.kind === "root" && !root.disposed) unmountBlock(root);
4159
+ if (root.kind === "root" && !root.disposed) {
4160
+ if (unhandled instanceof PresentationAdoptionMiss && root.idState.renderOwner !== void 0) {
4161
+ root.idState.renderOwner.preservePresentation = true;
4162
+ DOM_ROOT_DISPOSERS.get(root)?.();
4163
+ } else unmountBlock(root);
4164
+ }
3382
4165
  }
3383
4166
  } finally {
3384
4167
  endRootRender(rootFrame);
@@ -3391,6 +4174,7 @@ function drainQueue() {
3391
4174
  for (const activity of activitiesToRehide) SCHEDULED_VISIBILITY_DRIVER.rehide(activity);
3392
4175
  }
3393
4176
  commitRootRenders();
4177
+ flushNativeTransitions();
3394
4178
  return pendingError;
3395
4179
  }
3396
4180
  function flush() {
@@ -4146,6 +4930,7 @@ function vtFlush(work = flushWork, queuedOwners, queuedBlocks) {
4146
4930
  beginStagedCommitPublication(stagedCommit);
4147
4931
  try {
4148
4932
  try {
4933
+ rejectStagedPresentations(stagedCommit);
4149
4934
  stage.commit();
4150
4935
  } finally {
4151
4936
  publishStagedCommit(stagedCommit);
@@ -4647,6 +5432,23 @@ function beginStagedCommitPublication(capture) {
4647
5432
  function endStagedCommitPublication(capture) {
4648
5433
  if (PUBLISHING_STAGED_COMMIT === capture) PUBLISHING_STAGED_COMMIT = null;
4649
5434
  }
5435
+ function rejectStagedPresentations(capture) {
5436
+ for (const [owner, receipt] of capture.owners) {
5437
+ const transaction = receipt.presentation;
5438
+ if (transaction === void 0 || owner.disposed || owner.generation !== receipt.generation || currentPresentations(transaction.capture) && (NATIVE_READ_DRIVER === null || NATIVE_READ_DRIVER.validateCapture(transaction.capture)))
5439
+ continue;
5440
+ const pending = owner.transaction;
5441
+ owner.transaction = transaction;
5442
+ try {
5443
+ rollbackRootRender(transaction);
5444
+ } finally {
5445
+ owner.transaction = pending;
5446
+ }
5447
+ owner.generation++;
5448
+ retryPresentations(transaction.capture);
5449
+ if (transaction.rootRequest) owner.retry();
5450
+ }
5451
+ }
4650
5452
  function stagedOwnerGuard(capture, owner) {
4651
5453
  if (owner === void 0) return void 0;
4652
5454
  let receipt = capture.owners.get(owner);
@@ -4808,9 +5610,10 @@ function publishStagedCommit(capture) {
4808
5610
  capture.selects.length = capture.defaults.length = capture.checks.length = capture.autofocus.length = 0;
4809
5611
  capture.bundles.clear();
4810
5612
  capture.controls.clear();
5613
+ capture.signalHosts?.clear();
4811
5614
  commitEffects();
4812
5615
  }
4813
- function runStagedTeardown(cleanup, phase, handler, owner, suppressed) {
5616
+ function runStagedTeardown(cleanup, phase, handler, owner, suppressed, scope) {
4814
5617
  const previousHandler = TEARDOWN_HANDLER;
4815
5618
  const previousOwner = TEARDOWN_BLOCK;
4816
5619
  const previousErrors = TEARDOWN_ERRORS;
@@ -4822,8 +5625,8 @@ function runStagedTeardown(cleanup, phase, handler, owner, suppressed) {
4822
5625
  TEARDOWN_DEPTH++;
4823
5626
  try {
4824
5627
  try {
4825
- if (phase < 0) runEffectLifecycleCallback(cleanup);
4826
- else runEffectCleanupCallback(cleanup, phase);
5628
+ if (phase < 0) runEffectLifecycleCallback(cleanup, scope);
5629
+ else runEffectCleanupCallback(cleanup, phase, scope);
4827
5630
  } catch (error) {
4828
5631
  reportTeardownError(error);
4829
5632
  }
@@ -4898,7 +5701,7 @@ function ensureDeferredLayoutDriver() {
4898
5701
  enqueueStagedAction(capture, action, durable);
4899
5702
  return true;
4900
5703
  },
4901
- stageTeardown(cleanup, phase) {
5704
+ stageTeardown(cleanup, phase, scope) {
4902
5705
  const capture = STAGED_COMMIT_CAPTURE;
4903
5706
  if (capture === null) return false;
4904
5707
  const handler = TEARDOWN_HANDLER;
@@ -4906,7 +5709,7 @@ function ensureDeferredLayoutDriver() {
4906
5709
  const suppressed = REF_DETACH_SUPPRESSION;
4907
5710
  enqueueStagedAction(
4908
5711
  capture,
4909
- () => runStagedTeardown(cleanup, phase, handler, owner, suppressed),
5712
+ () => runStagedTeardown(cleanup, phase, handler, owner, suppressed, scope),
4910
5713
  true
4911
5714
  );
4912
5715
  return true;
@@ -4920,7 +5723,7 @@ function ensureDeferredLayoutDriver() {
4920
5723
  const handler = findTryHandler(scope.block);
4921
5724
  enqueueStagedAction(
4922
5725
  capture,
4923
- () => runStagedTeardown(cleanup, slot.phase, handler, scope.block, null),
5726
+ () => runStagedTeardown(cleanup, slot.phase, handler, scope.block, null, scope),
4924
5727
  true
4925
5728
  );
4926
5729
  }
@@ -5258,7 +6061,7 @@ function drainPassiveEffects() {
5258
6061
  drainPassivePhase();
5259
6062
  }
5260
6063
  function hasPendingWork() {
5261
- return QUEUE.length > 0 || ROOT_RENDER_TRANSACTIONS.length > 0 || effectEventQueue.length > 0 || effectEventCommitActions.length > 0 || effectQueues[INSERTION].length > 0 || effectQueues[LAYOUT].length > 0 || effectQueues[PASSIVE].length > 0 || pendingPassiveUnmounts.length > 0 || storeSyncQueue.length > 0 || NATIVE_ADOPTION_RELEASES !== null || hasControlledSyncs();
6064
+ return QUEUE.length > 0 || ROOT_RENDER_TRANSACTIONS.length > 0 || NATIVE_TRANSITION_QUEUE !== null || effectEventQueue.length > 0 || effectEventCommitActions.length > 0 || effectQueues[INSERTION].length > 0 || effectQueues[LAYOUT].length > 0 || effectQueues[PASSIVE].length > 0 || pendingPassiveUnmounts.length > 0 || storeSyncQueue.length > 0 || NATIVE_ADOPTION_RELEASES !== null || hasControlledSyncs();
5262
6065
  }
5263
6066
  function drainEffectEventUpdates() {
5264
6067
  if (effectEventQueue.length === 0) return;
@@ -5442,7 +6245,7 @@ function fireEffectCleanup(e) {
5442
6245
  if (cleanup) {
5443
6246
  slot.cleanup = void 0;
5444
6247
  try {
5445
- runEffectCleanupCallback(cleanup, e.phase);
6248
+ runEffectCleanupCallback(cleanup, e.phase, e.scope);
5446
6249
  } catch (err) {
5447
6250
  if (err instanceof MaximumUpdateDepthError) throw err;
5448
6251
  reportEffectError(e.scope.block, err);
@@ -5463,7 +6266,7 @@ function runEffectBody(e) {
5463
6266
  CURRENT_EFFECT_PHASE = e.phase;
5464
6267
  EFFECT_BODY_DEPTH++;
5465
6268
  try {
5466
- cleanup = e.fn.apply(null, e.args);
6269
+ cleanup = signalDocumentEnabled || e.scope.block.idState.renderOwner?.signalOwner !== void 0 ? runWithBlockSignalOwner(e.scope, () => e.fn.apply(null, e.args)) : e.fn.apply(null, e.args);
5467
6270
  } finally {
5468
6271
  EFFECT_BODY_DEPTH--;
5469
6272
  CURRENT_EFFECT_PHASE = previousPhase;
@@ -5571,7 +6374,7 @@ function drainDeferredPassiveUnmounts() {
5571
6374
  const q = pendingPassiveUnmounts.splice(0);
5572
6375
  for (let i = 0; i < q.length; i += 3) {
5573
6376
  try {
5574
- runEffectCleanupCallback(q[i], PASSIVE);
6377
+ runEffectCleanupCallback(q[i], PASSIVE, q[i + 2]);
5575
6378
  } catch (err) {
5576
6379
  if (err instanceof MaximumUpdateDepthError) throw err;
5577
6380
  const handler = q[i + 1];
@@ -5764,6 +6567,14 @@ function captureRenderPhaseUpdate(cell, key) {
5764
6567
  if (!updates.has(cell)) updates.set(cell, { value: cell.value, queue: cell[key]?.slice(), key });
5765
6568
  }
5766
6569
  function renderBlock(block) {
6570
+ if (signalDocumentEnabled || block.idState.renderOwner?.signalOwner !== void 0) {
6571
+ const owner = scopeSignalOwner(block);
6572
+ if (owner !== void 0) STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
6573
+ if (owner !== void 0 && currentSignalOwner() !== owner) {
6574
+ runWithSignalOwner(owner, () => renderBlock(block));
6575
+ return;
6576
+ }
6577
+ }
5767
6578
  const hydration = activeHydration();
5768
6579
  if (hydration !== null && !hydration.owns(block)) {
5769
6580
  hydration.suspend(() => renderBlock(block));
@@ -5782,6 +6593,8 @@ function renderBlock(block) {
5782
6593
  }
5783
6594
  if (++retries > RENDER_PHASE_UPDATE_LIMIT) throw new Error(formatClientError(9));
5784
6595
  }
6596
+ if (signalDocumentEnabled && block.__trySlot?.tryBlock === block && block.__trySlot.retrySignalOwners !== void 0)
6597
+ clearSignalRetryOwners(block.__trySlot);
5785
6598
  const updates = renderPhaseUpdates;
5786
6599
  if (updates !== null && previousOwner !== null && blockIsAncestorOf(previousOwner, block)) {
5787
6600
  previousUpdates ??= /* @__PURE__ */ new Map();
@@ -5798,6 +6611,8 @@ function renderBlock(block) {
5798
6611
  }
5799
6612
  if (!block.crossRenderUpdate) block.pending = false;
5800
6613
  }
6614
+ if (block.idState.renderOwner?.signalOwner !== void 0 && !block.mounted && block.forSlot !== null && block.forSlot.items.get(block.key) !== block)
6615
+ discardSignalRetryItem(block, error);
5801
6616
  throw error;
5802
6617
  } finally {
5803
6618
  renderPhaseOwner = previousOwner;
@@ -6075,7 +6890,8 @@ function renderReturnedValue(block, out) {
6075
6890
  d.key ?? void 0,
6076
6891
  true,
6077
6892
  void 0,
6078
- activeHydration() !== null && elementKeyWasProvided(d)
6893
+ activeHydration() !== null && elementKeyWasProvided(d),
6894
+ d.__octaneInvocationSite
6079
6895
  )
6080
6896
  );
6081
6897
  } else {
@@ -6089,7 +6905,8 @@ function renderReturnedValue(block, out) {
6089
6905
  d.key ?? void 0,
6090
6906
  true,
6091
6907
  void 0,
6092
- activeHydration() !== null && elementKeyWasProvided(d)
6908
+ activeHydration() !== null && elementKeyWasProvided(d),
6909
+ d.__octaneInvocationSite
6093
6910
  );
6094
6911
  }
6095
6912
  } else {
@@ -6196,7 +7013,7 @@ class LiteBlockImpl {
6196
7013
  this.idState = parentBlock.idState;
6197
7014
  }
6198
7015
  }
6199
- function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
7016
+ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite) {
6200
7017
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
6201
7018
  if (parentScope === SHARED_BODY_SCOPE) {
6202
7019
  componentSlotImpl(
@@ -6210,7 +7027,10 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
6210
7027
  props,
6211
7028
  anchor,
6212
7029
  void 0,
6213
- 2
7030
+ 2,
7031
+ void 0,
7032
+ void 0,
7033
+ invocationSite
6214
7034
  );
6215
7035
  return;
6216
7036
  }
@@ -6238,6 +7058,7 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
6238
7058
  }
6239
7059
  }
6240
7060
  scope.block = new LiteBlockImpl(host, endMarker, parentScope.block);
7061
+ stampSignalInstance(scope, parentScope, invocationSite, void 0, false);
6241
7062
  if (adoptedOpen !== null && adoptedClose !== null) {
6242
7063
  hydration.liteRanges.set(scope, {
6243
7064
  start: adoptedOpen,
@@ -6258,7 +7079,9 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor) {
6258
7079
  let profileThrown;
6259
7080
  const nativeToken = NATIVE_READ_DRIVER === null ? -1 : beginActiveNativeReadScope(scope);
6260
7081
  try {
6261
- comp(props, scope, void 0);
7082
+ if (signalDocumentEnabled || scope.block.idState.renderOwner?.signalOwner !== void 0)
7083
+ runWithBlockSignalOwner(scope, () => comp(props, scope, void 0));
7084
+ else comp(props, scope, void 0);
6262
7085
  if (!scope.mounted) scope.mounted = true;
6263
7086
  } catch (error) {
6264
7087
  profileDidThrow = true;
@@ -6377,10 +7200,10 @@ function unmountScope(scope, detachDom = true) {
6377
7200
  pendingPassiveUnmounts.push(cleanup, TEARDOWN_HANDLER, TEARDOWN_BLOCK);
6378
7201
  if (!passiveScheduled) schedulePassiveFlush();
6379
7202
  } else {
6380
- if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(cleanup, slot.phase) === true)
7203
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(cleanup, slot.phase, scope) === true)
6381
7204
  continue;
6382
7205
  try {
6383
- runEffectCleanupCallback(cleanup, slot.phase);
7206
+ runEffectCleanupCallback(cleanup, slot.phase, scope);
6384
7207
  } catch (err) {
6385
7208
  reportTeardownError(err);
6386
7209
  }
@@ -6396,21 +7219,46 @@ function unmountScope(scope, detachDom = true) {
6396
7219
  unmountScopeChildrenAndSlots(scope, detachDom);
6397
7220
  });
6398
7221
  }
6399
- function runScopeCleanups(scope) {
7222
+ function runScopeCleanups(scope, retireUnowned) {
6400
7223
  const c = scope.cleanups;
6401
7224
  if (c !== null)
6402
7225
  for (let i = c.length - 1; i >= 0; i--) {
6403
- if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(c[i], -1) === true)
7226
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageTeardown(c[i], -1, scope) === true)
6404
7227
  continue;
6405
7228
  try {
6406
- runEffectLifecycleCallback(c[i]);
7229
+ runEffectLifecycleCallback(c[i], scope);
6407
7230
  } catch (err) {
6408
7231
  reportTeardownError(err);
6409
7232
  }
6410
7233
  }
7234
+ const signalOwner = SCOPE_SIGNAL_OWNERS.get(scope);
7235
+ if (signalOwner) {
7236
+ if (RETAINED_SIGNAL_OWNERS?.owners.has(signalOwner)) return;
7237
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageAction(() => {
7238
+ if (retireUnowned) SCOPE_SIGNAL_OWNERS.set(scope, null);
7239
+ else SCOPE_SIGNAL_OWNERS.delete(scope);
7240
+ retireRendererSignalOwner(signalOwner);
7241
+ }, true))
7242
+ return;
7243
+ if (retireUnowned) SCOPE_SIGNAL_OWNERS.set(scope, null);
7244
+ else SCOPE_SIGNAL_OWNERS.delete(scope);
7245
+ retireRendererSignalOwner(signalOwner);
7246
+ } else if (retireUnowned && signalOwner === false) {
7247
+ if (STAGED_COMMIT_CAPTURE !== null && DEFERRED_LAYOUT_DRIVER.stageAction(() => retireUnownedSignalScope(scope), true))
7248
+ return;
7249
+ retireUnownedSignalScope(scope);
7250
+ }
7251
+ }
7252
+ function retireUnownedSignalScope(scope) {
7253
+ const owner = SCOPE_SIGNAL_OWNERS.get(scope);
7254
+ if (owner === false) SCOPE_SIGNAL_OWNERS.set(scope, null);
7255
+ else if (owner) {
7256
+ SCOPE_SIGNAL_OWNERS.set(scope, null);
7257
+ retireRendererSignalOwner(owner);
7258
+ }
6411
7259
  }
6412
- function unmountScopeChildrenAndSlots(scope, detachDom) {
6413
- runScopeCleanups(scope);
7260
+ function unmountScopeChildrenAndSlots(scope, detachDom, retireUnowned = true) {
7261
+ runScopeCleanups(scope, retireUnowned);
6414
7262
  unmountScopeChildrenAndSlotsOnly(scope, detachDom);
6415
7263
  }
6416
7264
  function unmountScopeChildrenAndSlotsOnly(scope, detachDom) {
@@ -7726,7 +8574,7 @@ function resetHmrBlock(block) {
7726
8574
  const cleanup = cleanups[i];
7727
8575
  if (cleanup[HMR] === true) continue;
7728
8576
  try {
7729
- runEffectLifecycleCallback(cleanup);
8577
+ runEffectLifecycleCallback(cleanup, block);
7730
8578
  } catch (err) {
7731
8579
  reportTeardownError(err);
7732
8580
  }
@@ -7761,7 +8609,7 @@ function resetHmrBlock(block) {
7761
8609
  if (--TEARDOWN_DEPTH === 0) dispatchTeardownErrors();
7762
8610
  }
7763
8611
  }
7764
- function resetScopeChildren(scope) {
8612
+ function resetScopeChildren(scope, detachDom = true) {
7765
8613
  const block = scope.block;
7766
8614
  if (TEARDOWN_DEPTH === 0) {
7767
8615
  TEARDOWN_HANDLER = findTryHandler(block.parentBlock) ?? rendererRegionTryHandler(block);
@@ -7769,12 +8617,13 @@ function resetScopeChildren(scope) {
7769
8617
  }
7770
8618
  TEARDOWN_DEPTH++;
7771
8619
  try {
7772
- unmountScopeChildrenAndSlots(scope, true);
8620
+ unmountScopeChildrenAndSlots(scope, detachDom, false);
7773
8621
  const start = block.startMarker;
7774
- removeRange(
7775
- start !== null ? getNextSibling(start) : getFirstChild(block.parentNode),
7776
- block.endMarker
7777
- );
8622
+ if (detachDom)
8623
+ removeRange(
8624
+ start !== null ? getNextSibling(start) : getFirstChild(block.parentNode),
8625
+ block.endMarker
8626
+ );
7778
8627
  scope.children = null;
7779
8628
  scope.cleanups = null;
7780
8629
  scope._slots = null;
@@ -7806,6 +8655,19 @@ const HYDRATE_STREAM_BOUNDARY_SELECTOR = `template[${STREAM_BOUNDARY_ATTR}]`;
7806
8655
  const HYDRATE_STREAM_SCAN_MASK = 1 | 128;
7807
8656
  let hydrateStreamWaitCleanups = null;
7808
8657
  let preservedHydrateActivations = null;
8658
+ let preservedHydrateActivationCount = 0;
8659
+ function releasePreservedHydrateActivation(state) {
8660
+ if (preservedHydrateActivations?.delete(state)) preservedHydrateActivationCount--;
8661
+ }
8662
+ function pendingHydrateOwner(target) {
8663
+ let owner = null;
8664
+ for (let block = target; block !== null; block = block.parentBlock) {
8665
+ const state = block.slots[0];
8666
+ if (state?.__kind === "hydrateBlockSlot" && !state.hydrated && preservedHydrateActivations?.has(state))
8667
+ owner = state;
8668
+ }
8669
+ return owner;
8670
+ }
7809
8671
  function findSuspendedHydrateBlock(scope, thenable) {
7810
8672
  const own = scope.block.__thenables;
7811
8673
  if (own !== void 0 && own.includes(thenable)) return scope.block;
@@ -7826,7 +8688,9 @@ function preserveSuspendedHydrateActivation(state, hydration, thenable) {
7826
8688
  source: suspendedBlock === state.block ? null : suspendedBlock,
7827
8689
  cursor: hydration.node
7828
8690
  };
7829
- (preservedHydrateActivations ??= /* @__PURE__ */ new WeakMap()).set(state, activation);
8691
+ const activations = preservedHydrateActivations ??= /* @__PURE__ */ new WeakMap();
8692
+ if (!activations.has(state)) preservedHydrateActivationCount++;
8693
+ activations.set(state, activation);
7830
8694
  const resume = () => {
7831
8695
  if (state.block.disposed || !state.activationRequested || state.activationGeneration !== activation.generation || preservedHydrateActivations?.get(state) !== activation)
7832
8696
  return;
@@ -8070,15 +8934,18 @@ function invalidateHydrateActivation(state) {
8070
8934
  state.replays = [];
8071
8935
  }
8072
8936
  function teardownHydrateBoundary(state) {
8937
+ const preserved = preservedHydrateActivations?.get(state);
8938
+ if (preserved !== void 0) {
8939
+ if (isRecordingTransitionJournal()) journalObjectOnce(state.block);
8940
+ state.block.mounted = false;
8941
+ }
8073
8942
  if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => teardownHydrateBoundary(state), true) === true)
8074
8943
  return;
8075
8944
  cleanupHydrateInstallers(state);
8076
8945
  cleanupHydrateStreamWait(state);
8077
- const preserved = preservedHydrateActivations?.get(state);
8078
8946
  if (preserved !== void 0) {
8079
- preservedHydrateActivations.delete(state);
8947
+ releasePreservedHydrateActivation(state);
8080
8948
  discardOffscreenCapture(preserved.capture);
8081
- state.block.mounted = false;
8082
8949
  }
8083
8950
  state.prefetchAbort?.abort();
8084
8951
  resolveHydrateWaiters(state, "abort");
@@ -8116,7 +8983,7 @@ function hydrateStrategyInteractionEvents(strategy) {
8116
8983
  }
8117
8984
  function queueHydrateIntent(state, intent) {
8118
8985
  if (state.hydrated || resolveHydrateStrategy(state)._t === "never") return;
8119
- state.replays.push(intent);
8986
+ if (!intent.earlyBinding) state.replays.push(intent);
8120
8987
  requestHydrateBoundary(state);
8121
8988
  }
8122
8989
  function handleRegisteredHydrationIntent(state, eventType, intent) {
@@ -8297,6 +9164,7 @@ function requestHydrateBoundary(state) {
8297
9164
  }
8298
9165
  function installHydrateBoundary(state) {
8299
9166
  if (!state.serverPreserved || state.hydrated) return () => void 0;
9167
+ if (state.independent) return () => teardownHydrateBoundary(state);
8300
9168
  const strategy = resolveHydrateStrategy(state);
8301
9169
  if (strategy._t === "never") {
8302
9170
  state.strategyCleanup = null;
@@ -8354,14 +9222,14 @@ function createHydrateSlot(props, scope, boundaryId) {
8354
9222
  HYDRATE_WHEN_ATTR,
8355
9223
  hydrateStrategyType(props.when)
8356
9224
  );
8357
- let start;
8358
- let end;
9225
+ if (props.__independent !== void 0)
9226
+ (STAGED_DOM?.view(wrapper) ?? wrapper).setAttribute(HYDRATE_INDEPENDENT_ATTR, "");
9227
+ let start = null;
9228
+ let end = null;
8359
9229
  let seedRaw = null;
8360
9230
  let nativeSeedRaw = null;
8361
9231
  let idState = parentBlock.idState;
8362
- if (serverPreserved && hydration.isOpen(getFirstChild(wrapper))) {
8363
- start = getFirstChild(wrapper);
8364
- end = hydration.close(start);
9232
+ if (serverPreserved) {
8365
9233
  const rawCount = (STAGED_DOM?.view(wrapper) ?? wrapper).getAttribute(HYDRATE_ID_COUNT_ATTR);
8366
9234
  const parsedCount = rawCount === null ? 0 : Number(rawCount);
8367
9235
  const idCount = Number.isSafeInteger(parsedCount) && parsedCount >= 0 ? parsedCount : 0;
@@ -8371,11 +9239,17 @@ function createHydrateSlot(props, scope, boundaryId) {
8371
9239
  idState = {
8372
9240
  prefix: rootIds.prefix,
8373
9241
  next: childStart,
9242
+ signalState: rootIds.signalState,
8374
9243
  limit: childStart + idCount,
8375
9244
  overflow: rootIds,
8376
9245
  renderOwner: rootIds.renderOwner
8377
9246
  };
8378
9247
  (STAGED_DOM?.view(wrapper) ?? wrapper).removeAttribute(HYDRATE_ID_COUNT_ATTR);
9248
+ }
9249
+ if (props.__independent !== void 0) {
9250
+ } else if (serverPreserved && hydration.isOpen(getFirstChild(wrapper))) {
9251
+ start = getFirstChild(wrapper);
9252
+ end = hydration.close(start);
8379
9253
  const seed = findHydrateSeedSidecar(wrapper);
8380
9254
  if (seed !== null) {
8381
9255
  seedRaw = (STAGED_DOM?.view(seed) ?? seed).textContent || "[]";
@@ -8442,17 +9316,19 @@ function createHydrateSlot(props, scope, boundaryId) {
8442
9316
  didNotify: false,
8443
9317
  hasError: false,
8444
9318
  error: void 0,
8445
- replays: []
9319
+ replays: [],
9320
+ independent: props.__independent !== void 0
8446
9321
  };
8447
9322
  if (nativeSeedRaw !== null) state.nativeSeedRaw = nativeSeedRaw;
8448
9323
  scope.slots[0] = state;
8449
9324
  registerSlot(scope, state);
8450
- registerHydrationIntentBoundary(wrapper, intentBoundary);
9325
+ if (!state.independent) registerHydrationIntentBoundary(wrapper, intentBoundary);
8451
9326
  block.body = hydrateBoundaryBody(state);
8452
9327
  const initialStrategy = resolveHydrateStrategy(state);
8453
- const pendingIntents = takePendingHydrationIntents(wrapper);
8454
- if (serverPreserved && pendingIntents !== void 0 && initialStrategy._t !== "never") {
8455
- state.replays.push(...pendingIntents);
9328
+ const pendingIntents = state.independent ? void 0 : takePendingHydrationIntents(wrapper);
9329
+ if (state.independent) {
9330
+ } else if (serverPreserved && pendingIntents !== void 0 && initialStrategy._t !== "never") {
9331
+ state.replays.push(...pendingIntents.filter((intent) => !intent.earlyBinding));
8456
9332
  requestHydrateBoundary(state);
8457
9333
  } else if (serverPreserved) {
8458
9334
  const shouldDefer = initialStrategy._d ? initialStrategy._d() : initialStrategy._t !== "load";
@@ -8461,9 +9337,14 @@ function createHydrateSlot(props, scope, boundaryId) {
8461
9337
  return state;
8462
9338
  }
8463
9339
  function activateHydrateBoundary(state) {
9340
+ if (state.start === null || state.end === null) return;
8464
9341
  const block = state.block;
9342
+ let preserved = preservedHydrateActivations?.get(state);
9343
+ if (preserved !== void 0 && !currentPresentations(preserved.capture)) {
9344
+ discardHydratePresentation(state, preserved.capture);
9345
+ preserved = void 0;
9346
+ }
8465
9347
  const activationSlot = block.slots[0];
8466
- const preserved = preservedHydrateActivations?.get(state);
8467
9348
  if (!state.serverPreserved || activationSlot?.__kind === "trySlotSlot" && preserved === void 0) {
8468
9349
  renderBlock(block);
8469
9350
  return;
@@ -8476,6 +9357,13 @@ function activateHydrateBoundary(state) {
8476
9357
  const previousHydration = currentHydration;
8477
9358
  const previousCapture = WIP_CAPTURE;
8478
9359
  const capture = preserved?.capture ?? createOffscreenCapture();
9360
+ if (block.idState.renderOwner?.bindingLeases?.size) {
9361
+ hydration.retryPresentation = () => {
9362
+ if (block.disposed) return;
9363
+ discardHydratePresentation(state, capture);
9364
+ scheduleRender(state.parentBlock);
9365
+ };
9366
+ }
8479
9367
  currentHydration = hydration;
8480
9368
  WIP_CAPTURE = capture;
8481
9369
  const previousNative = setNativeAdoptionResolver(hydration.nativeAdoption?.resolve ?? null);
@@ -8515,10 +9403,19 @@ function activateHydrateBoundary(state) {
8515
9403
  completed = true;
8516
9404
  }
8517
9405
  } catch (error) {
8518
- preservedHydrateActivations?.delete(state);
9406
+ releasePreservedHydrateActivation(state);
8519
9407
  discardOffscreenCapture(capture);
8520
9408
  state.block.mounted = false;
8521
- if (error instanceof NativeAdoptionMiss) nativeRecovery = error;
9409
+ if (error instanceof PresentationAdoptionMiss) {
9410
+ discardHydratePresentation(state, capture);
9411
+ if (error.retry && error.lease?.active()) {
9412
+ retryPresentationMiss(error, () => {
9413
+ if (!block.disposed) scheduleRender(state.parentBlock);
9414
+ });
9415
+ return;
9416
+ }
9417
+ throw error;
9418
+ } else if (error instanceof NativeAdoptionMiss) nativeRecovery = error;
8522
9419
  else throw error;
8523
9420
  } finally {
8524
9421
  setNativeAdoptionResolver(previousNative);
@@ -8558,16 +9455,36 @@ function activateHydrateBoundary(state) {
8558
9455
  return;
8559
9456
  }
8560
9457
  if (completed) {
8561
- preservedHydrateActivations?.delete(state);
9458
+ releasePreservedHydrateActivation(state);
8562
9459
  spliceOffscreenCapture(capture);
8563
9460
  }
8564
- if (completed && hydration.hasAdjacentRangePair) hydration.coalesce();
9461
+ if (completed && hydration.hasAdjacentRangePair && !hydration.presentation) hydration.coalesce();
8565
9462
  }
8566
- function cloneHydrationReplayEvent(event, target) {
8567
- const realm = target.ownerDocument.defaultView ?? globalThis;
8568
- if (realm.PointerEvent !== void 0 && event instanceof realm.PointerEvent) {
8569
- return new realm.PointerEvent(event.type, event);
8570
- }
9463
+ function discardHydratePresentation(state, capture) {
9464
+ const refs = [];
9465
+ collectVisibleSubtreeRefs(state.block, refs);
9466
+ discardOffscreenCapture(capture);
9467
+ releasePreservedHydrateActivation(state);
9468
+ for (const frame of capture.presentations ?? [])
9469
+ if (PRESENTATION_PREPARATIONS.get(frame.lease) === frame)
9470
+ PRESENTATION_PREPARATIONS.delete(frame.lease);
9471
+ const previousRollback = ROOT_RENDER_ROLLBACK;
9472
+ ROOT_RENDER_ROLLBACK = true;
9473
+ try {
9474
+ withRefDetachSuppression(refs, () => resetScopeChildren(state.block, false));
9475
+ } finally {
9476
+ ROOT_RENDER_ROLLBACK = previousRollback;
9477
+ }
9478
+ state.block.mounted = false;
9479
+ state.block.deoptNode = null;
9480
+ state.hydrated = false;
9481
+ state.serverActivationStarted = false;
9482
+ }
9483
+ function cloneHydrationReplayEvent(event, target) {
9484
+ const realm = target.ownerDocument.defaultView ?? globalThis;
9485
+ if (realm.PointerEvent !== void 0 && event instanceof realm.PointerEvent) {
9486
+ return new realm.PointerEvent(event.type, event);
9487
+ }
8571
9488
  if (realm.KeyboardEvent !== void 0 && event instanceof realm.KeyboardEvent) {
8572
9489
  return new realm.KeyboardEvent(event.type, event);
8573
9490
  }
@@ -8673,8 +9590,11 @@ function initializeHydrateComponent() {
8673
9590
  if (state === void 0) {
8674
9591
  state = createHydrateSlot(props, scope, boundaryId);
8675
9592
  } else {
9593
+ if (state.independent !== (props.__independent !== void 0)) {
9594
+ throw new Error(formatClientError(66));
9595
+ }
8676
9596
  state.props = props;
8677
- if (!state.hydrated) {
9597
+ if (!state.independent && !state.hydrated) {
8678
9598
  const strategy = resolveHydrateStrategy(state);
8679
9599
  if (strategy._t === "never") {
8680
9600
  cleanupHydrateStrategy(state);
@@ -8684,6 +9604,10 @@ function initializeHydrateComponent() {
8684
9604
  }
8685
9605
  }
8686
9606
  }
9607
+ if (state.independent) {
9608
+ useEffect(() => installHydrateBoundary(state), [state], HYDRATE_SETUP_SLOT);
9609
+ return;
9610
+ }
8687
9611
  if (state.hasError) throw state.error;
8688
9612
  if (!state.hydrated && state.activationReady && (!state.serverPreserved || !state.serverActivationStarted)) {
8689
9613
  if (state.serverPreserved) state.serverActivationStarted = true;
@@ -10161,6 +11085,8 @@ class HydrationCapability {
10161
11085
  /** Skip component-frame adoption until the declared container owner. */
10162
11086
  passthroughRanges = false;
10163
11087
  nativeAdoption;
11088
+ retryPresentation;
11089
+ presentation;
10164
11090
  isActive() {
10165
11091
  return this.depth === 0 && !this.abandoned;
10166
11092
  }
@@ -10371,6 +11297,7 @@ class HydrationCapability {
10371
11297
  }
10372
11298
  /** Give up root adoption after an unframed return/fragment mismatch. */
10373
11299
  abandonRoot(expected, actual, loc) {
11300
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
10374
11301
  noteRecoverableHydrationError(() => new Error(formatClientError(52)));
10375
11302
  if (loc) warnHydrationStructuralMismatch(loc, expected, actual);
10376
11303
  let node = this.node;
@@ -10417,11 +11344,13 @@ class HydrationCapability {
10417
11344
  this.claimRootRemainder(framedRemainder === void 0 ? remainder : framedRemainder);
10418
11345
  }
10419
11346
  if (cursor === null) {
11347
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
10420
11348
  if (claimsRoot) this.claimRootRemainder(null);
10421
11349
  if (template2 === null) template2 = resolveLazyTemplate(lazy2);
10422
11350
  return this.freshClone(template2);
10423
11351
  }
10424
11352
  if (!isFragment && (template2 !== null ? !hydrationNodeMatches(cursor, template2, partialStyles) : !lazyRootMatches(cursor, lazy2))) {
11353
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss();
10425
11354
  noteRecoverableHydrationError(() => new Error(formatClientError(51)));
10426
11355
  if (template2 === null) template2 = resolveLazyTemplate(lazy2);
10427
11356
  if (process.env.NODE_ENV !== "production" && loc)
@@ -10631,6 +11560,10 @@ class HydrationCapability {
10631
11560
  return true;
10632
11561
  }
10633
11562
  coalesce() {
11563
+ const leases = this.rootBlock.idState.renderOwner?.bindingLeases;
11564
+ if (leases !== void 0) {
11565
+ for (const lease of leases) if (lease.revision !== void 0 && lease.active()) return;
11566
+ }
10634
11567
  coalesceHydratedRanges(this.rootBlock, this.liteRanges);
10635
11568
  }
10636
11569
  }
@@ -10744,6 +11677,7 @@ function clone(node, loc, partialStyles) {
10744
11677
  }
10745
11678
  function drainFrag(root, parent, anchor) {
10746
11679
  if (activeHydration() !== null && root.__oct_vfrag === true) return;
11680
+ if (PRESENTATION_HYDRATION?.revision !== void 0) presentationMiss(false);
10747
11681
  if (root.nodeType === 11) {
10748
11682
  (STAGED_DOM?.view(parent) ?? parent).insertBefore(root, anchor);
10749
11683
  return;
@@ -10854,10 +11788,423 @@ function htextSwap(posNode, value) {
10854
11788
  (STAGED_DOM?.view(parent) ?? parent).replaceChild(t, posNode);
10855
11789
  return t;
10856
11790
  }
11791
+ function bindingText(posNode, value, marker) {
11792
+ const text = coerceText(value);
11793
+ const hydration = activeHydration();
11794
+ const frame = PRESENTATION_HYDRATION;
11795
+ if (frame?.revision !== void 0) {
11796
+ const range = presentationRange(frame, posNode, marker, "text");
11797
+ const existing = getNextSibling(posNode);
11798
+ if (existing === range.end) {
11799
+ const node2 = document.createTextNode(text);
11800
+ preparePresentationOperation(
11801
+ frame,
11802
+ posNode,
11803
+ "text",
11804
+ () => range.end.parentNode.insertBefore(node2, range.end)
11805
+ );
11806
+ return node2;
11807
+ }
11808
+ if (existing?.nodeType !== 3 || getNextSibling(existing) !== range.end) presentationMiss();
11809
+ preparePresentationOperation(frame, existing, "text", () => {
11810
+ if (existing.nodeValue !== text) existing.nodeValue = text;
11811
+ });
11812
+ return existing;
11813
+ }
11814
+ if (hydration !== null && isBlockOpen(posNode)) {
11815
+ const close2 = hydration.close(posNode);
11816
+ const existing = getNextSibling(posNode);
11817
+ if (existing !== close2 && existing?.nodeType === 3 && getNextSibling(existing) === close2) {
11818
+ if ((STAGED_DOM?.view(existing) ?? existing).nodeValue !== text)
11819
+ (STAGED_DOM?.view(existing) ?? existing).nodeValue = text;
11820
+ return existing;
11821
+ }
11822
+ if (existing !== close2) throw new TypeError(formatClientError(72));
11823
+ const node2 = (STAGED_DOM?.view(document) ?? document).createTextNode(text);
11824
+ domNode((STAGED_DOM?.view(close2) ?? close2).parentNode).insertBefore(node2, close2);
11825
+ return node2;
11826
+ }
11827
+ const parent = domNode(posNode).parentNode;
11828
+ const close = (STAGED_DOM?.view(document) ?? document).createComment(HYDRATION_END);
11829
+ (STAGED_DOM?.view(posNode) ?? posNode).data = marker;
11830
+ (STAGED_DOM?.view(parent) ?? parent).insertBefore(close, getNextSibling(posNode));
11831
+ const node = (STAGED_DOM?.view(document) ?? document).createTextNode(text);
11832
+ (STAGED_DOM?.view(parent) ?? parent).insertBefore(node, close);
11833
+ return node;
11834
+ }
11835
+ const BINDING_VIEW_ROOT = /* @__PURE__ */ Symbol.for("octane.binding.view-root");
11836
+ let PRESENTATION_HYDRATION = null;
11837
+ const PRESENTATION_PREPARATIONS = /* @__PURE__ */ new WeakMap();
11838
+ class PresentationAdoptionMiss extends Error {
11839
+ constructor(lease, retry, revision = PRESENTATION_HYDRATION?.revision) {
11840
+ super(formatClientError(75));
11841
+ this.lease = lease;
11842
+ this.retry = retry;
11843
+ this.revision = revision;
11844
+ }
11845
+ lease;
11846
+ retry;
11847
+ revision;
11848
+ }
11849
+ function retryPresentationMiss(error, retry) {
11850
+ const revision = error.lease?.revision?.();
11851
+ if (revision !== void 0 && revision >= 0 && revision !== error.revision) queueMicrotask(retry);
11852
+ else error.lease?.afterPublication?.(retry);
11853
+ }
11854
+ function isAdoptionControl(error) {
11855
+ return error instanceof NativeAdoptionMiss || error instanceof PresentationAdoptionMiss;
11856
+ }
11857
+ function presentationFailure(error) {
11858
+ const frame = PRESENTATION_HYDRATION;
11859
+ if (frame?.revision !== void 0 && !isSuspenseException(error) && !isAdoptionControl(error)) {
11860
+ const failure = new PresentationAdoptionMiss(frame.lease, false);
11861
+ failure.failure = error;
11862
+ throw failure;
11863
+ }
11864
+ throw error;
11865
+ }
11866
+ function presentationMiss(retry = true) {
11867
+ throw new PresentationAdoptionMiss(PRESENTATION_HYDRATION?.lease, retry);
11868
+ }
11869
+ function currentPresentation(frame) {
11870
+ if (frame.revision === void 0) return true;
11871
+ const lease = frame.lease;
11872
+ return lease.active() && lease.valid?.() !== false && lease.revision?.() === frame.revision && lease.root.parentNode !== null && lease.end?.parentNode === lease.root.parentNode && [...frame.witnesses.values()].every(
11873
+ (witness) => witness === null || validateNativeReadWitness(witness)
11874
+ );
11875
+ }
11876
+ function currentPresentations(capture) {
11877
+ return capture.presentations?.every((frame) => frame.current(frame)) !== false;
11878
+ }
11879
+ function retryPresentations(capture) {
11880
+ const retries = /* @__PURE__ */ new Set();
11881
+ for (const frame of capture.presentations ?? []) {
11882
+ PRESENTATION_PREPARATIONS.delete(frame.lease);
11883
+ if (frame.hydration?.retryPresentation) retries.add(frame.hydration.retryPresentation);
11884
+ }
11885
+ for (const retry of retries) retry();
11886
+ }
11887
+ function preparePresentationOperation(frame, target, key, write) {
11888
+ let operations = frame.writes.get(target);
11889
+ if (operations === void 0) frame.writes.set(target, operations = /* @__PURE__ */ new Map());
11890
+ operations.set(key, write);
11891
+ }
11892
+ function matchesClosedPresentationKeys(value, keys) {
11893
+ if (value === null || typeof value !== "object" && typeof value !== "function") return false;
11894
+ let index = 0;
11895
+ for (const key of Reflect.ownKeys(value)) {
11896
+ if (typeof key !== "string") return false;
11897
+ if (!Object.prototype.propertyIsEnumerable.call(value, key)) continue;
11898
+ if (keys[index++] !== key) return false;
11899
+ }
11900
+ return index === keys.length;
11901
+ }
11902
+ function hasClosedPresentationView(lease, scope, id) {
11903
+ try {
11904
+ const root = scope.block.startMarker ?? activeHydration()?.node;
11905
+ const proof = root == null ? void 0 : lease.view?.(root);
11906
+ return proof?.id === id && matchesClosedPresentationKeys(scope.block.props, proof.closedProps);
11907
+ } catch {
11908
+ return false;
11909
+ }
11910
+ }
11911
+ function beginPresentationHydration(scope, id, supported = false, structural = false, conditionalRest = false) {
11912
+ const owner = scope.block.idState.renderOwner;
11913
+ if (PRESENTATION_HYDRATION !== null && PRESENTATION_HYDRATION.scope.block.idState.renderOwner === owner) {
11914
+ if (conditionalRest) {
11915
+ if (!supported || !structural || !hasClosedPresentationView(PRESENTATION_HYDRATION.lease, scope, id))
11916
+ presentationMiss(false);
11917
+ } else if (!supported) presentationMiss(false);
11918
+ return null;
11919
+ }
11920
+ if (owner?.bindingLeases === void 0 || WIP_CAPTURE === null) return null;
11921
+ const hydration = activeHydration();
11922
+ const lease = [...owner.bindingLeases].find(
11923
+ (candidate) => candidate.id === id && (candidate.root === scope.block.startMarker || candidate.root === hydration?.node || candidate.root.nodeType === 8 && candidate.root.nextSibling === hydration?.node)
11924
+ );
11925
+ if (lease === void 0) return null;
11926
+ if (conditionalRest ? !supported || !structural || !hasClosedPresentationView(lease, scope, id) : !supported)
11927
+ throw new PresentationAdoptionMiss(lease, false);
11928
+ const revision = lease.revision?.();
11929
+ if (revision !== void 0 && revision >= 0 && lease.valid?.() === false)
11930
+ throw new PresentationAdoptionMiss(lease, false);
11931
+ if (revision !== void 0 && (!structural || revision < 0))
11932
+ throw new PresentationAdoptionMiss(lease, revision < 0, revision);
11933
+ const pending = PRESENTATION_PREPARATIONS.get(lease);
11934
+ const frame = {
11935
+ previous: PRESENTATION_HYDRATION,
11936
+ scope,
11937
+ // A suspended component's cache can skip an unchanged writer on retry.
11938
+ // Carry that same scope's prepared operations, replacing by native channel.
11939
+ writes: pending?.scope === scope ? new Map([...pending.writes].map(([node, writes]) => [node, new Map(writes)])) : /* @__PURE__ */ new Map(),
11940
+ native: setNativeAdoptionResolver(null),
11941
+ readToken: beginNativeReadScope(scope),
11942
+ witnessToken: beginNativeReadWitness(),
11943
+ witnesses: pending?.scope === scope ? new Map(pending.witnesses) : /* @__PURE__ */ new Map(),
11944
+ completed: false,
11945
+ lease,
11946
+ ...revision === void 0 ? {} : { revision, current: currentPresentation },
11947
+ hydration
11948
+ };
11949
+ PRESENTATION_HYDRATION = frame;
11950
+ if (revision !== void 0 && hydration !== null) {
11951
+ hydration.presentation = true;
11952
+ for (let block = scope.block; block !== null; block = block.parentBlock) {
11953
+ preserveRootCreatedDom(block);
11954
+ if (block === hydration.rootBlock) break;
11955
+ }
11956
+ }
11957
+ PRESENTATION_PREPARATIONS.set(lease, frame);
11958
+ if (revision !== void 0) (WIP_CAPTURE.presentations ??= []).push(frame);
11959
+ (WIP_CAPTURE.renderCleanups ??= []).push((discarded) => {
11960
+ if (discarded || !frame.completed || owner.disposed || scope.block.disposed || PRESENTATION_PREPARATIONS.get(lease) !== frame)
11961
+ return;
11962
+ if (!currentPresentation(frame)) {
11963
+ frame.hydration?.retryPresentation?.();
11964
+ return;
11965
+ }
11966
+ PRESENTATION_PREPARATIONS.delete(lease);
11967
+ owner.bindingLeases.delete(lease);
11968
+ releaseBindingHandoff(lease);
11969
+ let published = false;
11970
+ try {
11971
+ lease.retire(() => {
11972
+ for (const writes of frame.writes.values()) for (const write of writes.values()) write();
11973
+ published = true;
11974
+ });
11975
+ } catch (error) {
11976
+ if (!published) throw error;
11977
+ reportRendererOwnerError(scope, error);
11978
+ } finally {
11979
+ frame.writes.clear();
11980
+ if (published && !owner.disposed && owner.current !== null && [...frame.witnesses.values()].some(
11981
+ (witness) => witness !== null && !validateNativeReadWitness(witness)
11982
+ )) {
11983
+ owner.generation++;
11984
+ invalidateRender(scope.block);
11985
+ scheduleRender(owner.current);
11986
+ }
11987
+ frame.witnesses.clear();
11988
+ }
11989
+ });
11990
+ return frame;
11991
+ }
11992
+ function endPresentationHydration(frame, completed = true) {
11993
+ if (frame === null) return;
11994
+ frame.completed = completed;
11995
+ frame.witnesses.set(frame.scope, finishNativeReadWitness(frame.witnessToken, completed));
11996
+ endNativeReadScope(frame.readToken, completed);
11997
+ setNativeAdoptionResolver(frame.native);
11998
+ PRESENTATION_HYDRATION = frame.previous;
11999
+ }
12000
+ function preparedPresentationAttribute(el, name, value, kind) {
12001
+ if (kind === "class") return value == null || value === false ? null : normalizeClass(value);
12002
+ if (kind === "booleanAttr")
12003
+ return !!value && typeof value !== "function" && typeof value !== "symbol";
12004
+ const result = coerceAttrValue(el, name, value);
12005
+ return result === "" && BOOLEAN_ATTR_PROPS.has(name.toLowerCase()) ? true : result;
12006
+ }
12007
+ function preparePresentationSignalAttribute(args, frame) {
12008
+ const [scope, previous, element, name, value, site, attributeKind = "attr"] = args;
12009
+ return runWithBlockSignalOwner(scope, () => {
12010
+ const handle = isSignalHandle(value) ? value : null;
12011
+ const current = handle === null ? value : handle.get();
12012
+ const prepared = preparedPresentationAttribute(element, name, current, attributeKind);
12013
+ if (handle === null) {
12014
+ preparePresentationOperation(
12015
+ frame,
12016
+ element,
12017
+ name,
12018
+ () => writeDirectSignalScalar(element, prepared, "attribute", previous, name, attributeKind)
12019
+ );
12020
+ return value;
12021
+ }
12022
+ const prior = previous;
12023
+ const reusable = prior?.[DIRECT_SIGNAL_BINDING] === true && !prior.disposed && prior.unsubscribe === void 0 && prior.handle === handle && prior.target === element && prior.site === site && prior.name === name && prior.attributeKind === attributeKind;
12024
+ const binding = reusable ? prior : {
12025
+ [DIRECT_SIGNAL_BINDING]: true,
12026
+ scope,
12027
+ target: element,
12028
+ kind: "attribute",
12029
+ site,
12030
+ name,
12031
+ attributeKind,
12032
+ handle,
12033
+ value: current,
12034
+ disposed: false
12035
+ };
12036
+ if (!reusable) registerHookCleanup(scope, () => disposeDirectSignalBinding(binding));
12037
+ preparePresentationOperation(frame, element, name, () => {
12038
+ if (binding.disposed) return;
12039
+ writeDirectSignalScalar(element, prepared, "attribute", previous, name, attributeKind);
12040
+ binding.value = current;
12041
+ runWithBlockSignalOwner(scope, () => activateDirectSignalBinding(binding, void 0));
12042
+ });
12043
+ return binding;
12044
+ });
12045
+ }
12046
+ function presentationHostWrite(writer, ...args) {
12047
+ const frame = PRESENTATION_HYDRATION;
12048
+ if (frame === null) return writer(...args);
12049
+ const [scope, previous, element, sources, site, hasNestedChildren, readStyle, proofs] = args;
12050
+ if (frame.revision === void 0 || !Array.isArray(proofs) || proofs.length === 0)
12051
+ presentationMiss(false);
12052
+ const proven = /* @__PURE__ */ new Set();
12053
+ for (const proof of proofs) {
12054
+ const receipt = frame.lease.rest?.(element, proof.site);
12055
+ const row = sources[proof.source];
12056
+ if (receipt === void 0 || receipt.id !== proof.id || receipt.node !== proof.node || receipt.spread !== proof.spread || row?.[0] !== true || proven.has(proof.source) || !matchesClosedPresentationKeys(row[1], receipt.keys))
12057
+ presentationMiss(false);
12058
+ proven.add(proof.source);
12059
+ }
12060
+ for (let index = 0; index < sources.length; index++)
12061
+ if (sources[index][0] && !proven.has(index)) presentationMiss(false);
12062
+ const prepared = prepareSignalHostPropSources(
12063
+ scope,
12064
+ previous,
12065
+ element,
12066
+ sources,
12067
+ site,
12068
+ hasNestedChildren,
12069
+ readStyle
12070
+ );
12071
+ preparePresentationOperation(frame, element, "hostProps", prepared.publish);
12072
+ return prepared.binding;
12073
+ }
12074
+ function presentationWrite(writer, kind, ...args) {
12075
+ const frame = PRESENTATION_HYDRATION;
12076
+ if (frame === null) return writer(...args);
12077
+ if (kind === "markDangerouslySetInnerHTMLChildren") {
12078
+ const element2 = args[0];
12079
+ if (!frame.writes.get(element2)?.has("hostProps") || element2[DANGER_HTML_ACTIVE] === true)
12080
+ presentationMiss(false);
12081
+ preparePresentationOperation(frame, element2, "hostChildren", () => writer(element2));
12082
+ return void 0;
12083
+ }
12084
+ if (kind === "bindSignalText") {
12085
+ const value = args[3];
12086
+ if (value !== null && (typeof value === "object" || typeof value === "function") || typeof args[7] !== "string")
12087
+ presentationMiss(false);
12088
+ return bindingText(args[2], value, args[7]);
12089
+ }
12090
+ if (kind === "setText") {
12091
+ const text = coerceText(args[1]);
12092
+ preparePresentationOperation(frame, args[0], "text", () => writer(args[0], text));
12093
+ return void 0;
12094
+ }
12095
+ if (kind === "bindSignalAttribute") return preparePresentationSignalAttribute(args, frame);
12096
+ if (kind === "nativeStyleBinding" || kind === "nativeProjectionBinding") {
12097
+ const [owner, slot, el] = args;
12098
+ const style = kind === "nativeStyleBinding";
12099
+ nativePresentationBinding(
12100
+ owner,
12101
+ slot,
12102
+ el,
12103
+ style ? preparedNativeStyleBody : preparedNativeProjectionBody,
12104
+ style ? { el, value: args[3], frame } : { el, compute: args[3], fields: args[4], frame }
12105
+ );
12106
+ return void 0;
12107
+ }
12108
+ const prepared = args.slice();
12109
+ let result;
12110
+ if (kind === "setEventHandler") {
12111
+ preparePresentationOperation(frame, prepared[0], "event:" + prepared[1], () => {
12112
+ writer(...prepared);
12113
+ if (SIGNAL_BINDINGS_ENABLED || signalDocumentEnabled)
12114
+ (SIGNAL_EVENT_OWNERS ??= /* @__PURE__ */ new WeakMap()).set(prepared[0], frame.scope);
12115
+ });
12116
+ return void 0;
12117
+ }
12118
+ if (kind === "setStyle") {
12119
+ prepared[1] = __normalizeBindingStyle(args[1]);
12120
+ prepared[2] = "";
12121
+ } else if (kind === "setStyleProperty") {
12122
+ prepared[2] = args[2] == null || typeof args[2] === "boolean" ? null : cssStyleValue(args[1], args[2]);
12123
+ } else if (kind === "setStyleProperties") {
12124
+ prepared[1] = args[1].map(
12125
+ (value, i) => i % 2 === 0 || value == null || typeof value === "boolean" ? value : cssStyleValue(args[1][i - 1], value)
12126
+ );
12127
+ } else if (kind === "setBindingClass" || kind === "setBindingClassIfChanged") {
12128
+ const index = kind.endsWith("IfChanged") ? 0 : 2;
12129
+ const value = args[index];
12130
+ prepared[index] = [normalizeClass(value[0]), value[1].map(normalizeClass)];
12131
+ result = value;
12132
+ } else {
12133
+ const changed2 = kind.endsWith("IfChanged") || kind.startsWith("updateFresh");
12134
+ const valueIndex = changed2 ? 0 : kind === "setClassName" || kind === "setClassAttr" ? 1 : 2;
12135
+ const element2 = args[changed2 ? 2 : 0];
12136
+ const className = kind.includes("Class");
12137
+ const name = className ? "class" : args[changed2 ? 3 : 1];
12138
+ const attributeKind = className ? "class" : kind.includes("Boolean") ? "booleanAttr" : "attr";
12139
+ prepared[valueIndex] = preparedPresentationAttribute(
12140
+ element2,
12141
+ name,
12142
+ args[valueIndex],
12143
+ attributeKind
12144
+ );
12145
+ result = kind.startsWith("updateFresh") ? prepared[valueIndex] : args[valueIndex];
12146
+ }
12147
+ const changed = kind.endsWith("IfChanged") || kind.startsWith("updateFresh");
12148
+ const element = args[changed ? 2 : 0];
12149
+ const key = kind.includes("Class") ? "class" : kind.startsWith("setStyle") ? kind === "setStyleProperty" ? "style:" + args[1] : "style" : args[changed ? 3 : 1];
12150
+ preparePresentationOperation(frame, element, key, () => {
12151
+ writer(...prepared);
12152
+ });
12153
+ return result;
12154
+ }
12155
+ function bindPresentationView(view, id) {
12156
+ view[BINDING_VIEW_ROOT] = "[b;" + id + ";root";
12157
+ return markComponentFlags(view, COMPONENT_FLAG_BOUNDARY, view.name);
12158
+ }
12159
+ const BINDING_CHILDREN_SITE = /* @__PURE__ */ Symbol.for("octane.binding.children-site");
12160
+ function markBindingChildren(body, site) {
12161
+ body[BINDING_CHILDREN_SITE] = site;
12162
+ return body;
12163
+ }
12164
+ function presentationRange(frame, start, marker, kind) {
12165
+ const range = start === null ? void 0 : frame.lease.ranges?.().get(start);
12166
+ if (frame.lease.revision?.() !== frame.revision || start?.nodeType !== 8 || start.data !== marker || range?.kind !== kind || range.end.parentNode !== start.parentNode || activeHydration()?.close(start) !== range.end)
12167
+ presentationMiss();
12168
+ return range;
12169
+ }
12170
+ function presentationStructure(writer, kind, marker, ...args) {
12171
+ const frame = PRESENTATION_HYDRATION;
12172
+ if (frame?.revision === void 0) return writer(...args);
12173
+ const hydration = activeHydration();
12174
+ if (hydration === null) presentationMiss(false);
12175
+ const anchorIndex = kind === "if" ? 6 : 5;
12176
+ const start = hydration.resolveOpen(args[anchorIndex] ?? null, args[2]);
12177
+ if (kind === "if") {
12178
+ const arm = args[3] ? args[4] === null ? -1 : 0 : args[5] === null ? -1 : 1;
12179
+ const range2 = presentationRange(frame, start, marker + arm, kind);
12180
+ if (range2.arm !== arm) presentationMiss();
12181
+ writer(...args);
12182
+ return;
12183
+ }
12184
+ const range = presentationRange(frame, start, marker, kind);
12185
+ const expected = args[3][BINDING_VIEW_ROOT];
12186
+ if (expected !== "[b;" + range.view + ";root") presentationMiss(false);
12187
+ writer(...args);
12188
+ }
12189
+ function setBindingClass(element, receipt, values) {
12190
+ const snapshot = [normalizeClass(values[0]), values[1].map(normalizeClass)];
12191
+ const classes = [snapshot[0], ...snapshot[1]].filter(Boolean).join(" ");
12192
+ if ((STAGED_DOM?.view(element) ?? element).getAttribute("class") !== classes)
12193
+ setClassAttr(element, classes);
12194
+ const serialized = JSON.stringify(snapshot);
12195
+ if ((STAGED_DOM?.view(element) ?? element).getAttribute(receipt) !== serialized)
12196
+ setStringData(element, receipt, serialized);
12197
+ }
12198
+ function setBindingClassIfChanged(value, previous, element, receipt) {
12199
+ if (value !== previous) setBindingClass(element, receipt, value);
12200
+ return value;
12201
+ }
10857
12202
  function hydrationMarkerMultiplicity(data, open) {
10858
12203
  const marker = open ? HYDRATION_START : HYDRATION_END;
10859
12204
  if (data === marker) return 1;
10860
12205
  if (open && (data === HYDRATION_FOR_EMPTY || data === HYDRATION_FOR_ITEMS)) return 1;
12206
+ if (open && (data.startsWith("[b;") || data.startsWith("[f")) && isBindingOpenComment(data))
12207
+ return 1;
10861
12208
  if (data.length < 2 || data.charCodeAt(0) !== marker.charCodeAt(0)) return 0;
10862
12209
  const first = data.charCodeAt(1);
10863
12210
  if (first < 49 || first > 57) return 0;
@@ -10916,7 +12263,9 @@ function findMatchingClose(open, matches) {
10916
12263
  function ssrForMarkerState(node) {
10917
12264
  if (node.nodeType !== 8) return -1;
10918
12265
  const data = (STAGED_DOM?.view(node) ?? node).data;
10919
- return data === HYDRATION_FOR_EMPTY ? 0 : data === HYDRATION_FOR_ITEMS ? 1 : -1;
12266
+ if (data === HYDRATION_FOR_EMPTY) return 0;
12267
+ if (data === HYDRATION_FOR_ITEMS) return 1;
12268
+ return isBindingOpenComment(data) && data.startsWith("[f") ? data.charCodeAt(2) === 48 ? 0 : 1 : -1;
10920
12269
  }
10921
12270
  function child(node) {
10922
12271
  if (currentHydration !== null) return (STAGED_DOM?.view(node) ?? node).firstChild;
@@ -10949,6 +12298,330 @@ function setText(node, value) {
10949
12298
  if (hiddenTextWriter !== null && hiddenTextWriter(node, text)) return;
10950
12299
  (STAGED_DOM?.view(node) ?? node).nodeValue = text;
10951
12300
  }
12301
+ const DIRECT_SIGNAL_BINDING = /* @__PURE__ */ Symbol("octane.direct-signal-binding");
12302
+ function isSignalHandle(value) {
12303
+ return (typeof value === "object" || typeof value === "function") && value !== null && value[SIGNAL_HANDLE] === true;
12304
+ }
12305
+ function readSignalBinding(handle) {
12306
+ return handle[SIGNAL_BINDING_READ]();
12307
+ }
12308
+ function nativeTransitionBindingNotify(binding, notify) {
12309
+ return Object.assign(notify, {
12310
+ [NATIVE_TRANSITION_CONSUMER]: {
12311
+ active: () => !binding.disposed && !binding.scope.block.disposed,
12312
+ prepare: () => prepareNativeTransitionBlock(binding.scope.block)
12313
+ }
12314
+ });
12315
+ }
12316
+ function isWritableSignal(value) {
12317
+ return isSignalHandle(value) && value.kind === "signal" && typeof value.set === "function";
12318
+ }
12319
+ function disposeDirectSignalBinding(binding) {
12320
+ if (binding.disposed) return;
12321
+ if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => disposeDirectSignalBinding(binding)) === true)
12322
+ return;
12323
+ binding.disposed = true;
12324
+ binding.unsubscribe?.();
12325
+ retireNativeTransitionBlock(binding.scope.block);
12326
+ binding.controlWriterCleanup?.();
12327
+ if (binding.input !== void 0) {
12328
+ domNode(binding.target).removeEventListener("input", binding.input);
12329
+ }
12330
+ }
12331
+ function directSignalControlValue(binding, snapshot) {
12332
+ if (binding.kind === "checked") return snapshot.checked ?? false;
12333
+ return snapshot.selectedValues ?? snapshot.value;
12334
+ }
12335
+ function validateDirectSignalControl(element, site) {
12336
+ const actual = (STAGED_DOM?.view(element) ?? element).getAttribute(HYDRATE_INPUT_ATTR);
12337
+ if (actual === null && activeHydration() === null) {
12338
+ (STAGED_DOM?.view(element) ?? element).setAttribute(HYDRATE_INPUT_ATTR, site);
12339
+ return;
12340
+ }
12341
+ if (actual !== site) {
12342
+ throw new Error(formatClientError(67, site));
12343
+ }
12344
+ }
12345
+ function writeDirectSignalBinding(binding, value) {
12346
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(binding);
12347
+ if (binding.kind === "text" || binding.kind === "textOnlyChild") {
12348
+ if (binding.text === void 0) {
12349
+ binding.text = binding.kind === "textOnlyChild" ? htext(binding.target, value) : htextSwap(binding.target, value);
12350
+ } else {
12351
+ setText(binding.text, value);
12352
+ }
12353
+ } else if (binding.kind === "attribute") {
12354
+ const element = binding.target;
12355
+ switch (binding.attributeKind) {
12356
+ case "class":
12357
+ if (element.namespaceURI === HTML_NS) setClassName(element, value);
12358
+ else setClassAttr(element, value);
12359
+ break;
12360
+ case "booleanAttr":
12361
+ setBooleanAttribute(element, binding.name, value);
12362
+ break;
12363
+ case "ariaAttr":
12364
+ setAriaAttribute(element, binding.name, value);
12365
+ break;
12366
+ case "stringData":
12367
+ setStringData(element, binding.name, value);
12368
+ break;
12369
+ default:
12370
+ setAttribute(element, binding.name, value);
12371
+ }
12372
+ } else if (binding.kind === "value") {
12373
+ const element = binding.target;
12374
+ if (element.localName === "select") setSelectValue(element, value);
12375
+ else setValue(element, value);
12376
+ } else {
12377
+ setChecked(binding.target, value);
12378
+ }
12379
+ binding.value = value;
12380
+ }
12381
+ function writeDirectSignalScalar(target, value, kind, previous, name, attributeKind) {
12382
+ if (kind === "text" || kind === "textOnlyChild") {
12383
+ if (previous instanceof Text) {
12384
+ setText(previous, value);
12385
+ return previous;
12386
+ }
12387
+ return kind === "textOnlyChild" ? htext(target, value) : htextSwap(target, value);
12388
+ }
12389
+ if (kind === "attribute") {
12390
+ const element = target;
12391
+ switch (attributeKind) {
12392
+ case "class":
12393
+ if (element.namespaceURI === HTML_NS) setClassName(element, value);
12394
+ else setClassAttr(element, value);
12395
+ break;
12396
+ case "booleanAttr":
12397
+ setBooleanAttribute(element, name, value);
12398
+ break;
12399
+ case "ariaAttr":
12400
+ setAriaAttribute(element, name, value);
12401
+ break;
12402
+ case "stringData":
12403
+ setStringData(element, name, value);
12404
+ break;
12405
+ default:
12406
+ setAttribute(element, name, value);
12407
+ }
12408
+ } else if (kind === "value") {
12409
+ const element = target;
12410
+ if (element.localName === "select") setSelectValue(element, value);
12411
+ else setValue(element, value);
12412
+ } else {
12413
+ setChecked(target, value);
12414
+ }
12415
+ return value;
12416
+ }
12417
+ function updateDirectSignalBinding(binding) {
12418
+ if (binding.disposed || binding.pendingControl || binding.handle === null || binding.scope.block.disposed)
12419
+ return;
12420
+ try {
12421
+ runWithBlockSignalOwner(binding.scope, () => {
12422
+ const value = readSignalBinding(binding.handle);
12423
+ if (!Object.is(binding.value, value)) writeDirectSignalBinding(binding, value);
12424
+ if (process.env.NODE_ENV !== "production" && STAGED_DOM === null && binding.target.nodeType === 1)
12425
+ drainDevFormDiagnostics(binding.target);
12426
+ });
12427
+ } catch {
12428
+ scheduleRender(binding.scope.block);
12429
+ }
12430
+ }
12431
+ function installDirectSignalControl(binding) {
12432
+ if (!isWritableSignal(binding.handle)) return;
12433
+ const element = binding.target;
12434
+ validateDirectSignalControl(element, binding.site);
12435
+ const handle = binding.handle;
12436
+ const input = () => {
12437
+ if (binding.disposed || binding.pendingControl) return;
12438
+ const snapshot = snapshotHydrationControl(element);
12439
+ if (snapshot === null) return;
12440
+ withoutSignalCandidate(
12441
+ () => runWithBlockSignalOwner(
12442
+ binding.scope,
12443
+ () => handle.set(directSignalControlValue(binding, snapshot))
12444
+ )
12445
+ );
12446
+ };
12447
+ binding.input = input;
12448
+ (STAGED_DOM?.view(element) ?? element).addEventListener("input", input);
12449
+ binding.controlWriterCleanup = registerHydrationControlSignalWriter(
12450
+ element,
12451
+ binding.kind === "checked" ? "checked" : "value",
12452
+ (value) => withoutSignalCandidate(
12453
+ () => runWithBlockSignalOwner(binding.scope, () => {
12454
+ if (!binding.disposed && !binding.pendingControl && isWritableSignal(binding.handle))
12455
+ binding.handle.set(value);
12456
+ })
12457
+ )
12458
+ );
12459
+ }
12460
+ function queueDirectSignalControlAdoption(binding) {
12461
+ enqueueEffectEventCommitAction(() => {
12462
+ if (binding.disposed || binding.scope.block.disposed || !binding.pendingControl) return;
12463
+ withoutSignalCandidate(
12464
+ () => runWithBlockSignalOwner(binding.scope, () => {
12465
+ const element = binding.target;
12466
+ const snapshot = snapshotHydrationControl(element);
12467
+ if (snapshot.editRevision > 0 && isWritableSignal(binding.handle)) {
12468
+ binding.handle.set(directSignalControlValue(binding, snapshot));
12469
+ }
12470
+ if (binding.disposed || binding.scope.block.disposed) return;
12471
+ if (!consumeHydrationControl(element, snapshot.revision)) {
12472
+ queueDirectSignalControlAdoption(binding);
12473
+ return;
12474
+ }
12475
+ binding.pendingControl = false;
12476
+ writeDirectSignalBinding(binding, readSignalBinding(binding.handle));
12477
+ })
12478
+ );
12479
+ });
12480
+ }
12481
+ function activateDirectSignalBinding(binding, revision) {
12482
+ if (binding.disposed) return;
12483
+ if (binding.handle !== null)
12484
+ binding.unsubscribe = binding.handle[SIGNAL_BINDING_SUBSCRIBE](
12485
+ nativeTransitionBindingNotify(binding, () => updateDirectSignalBinding(binding))
12486
+ );
12487
+ if (revision !== void 0) {
12488
+ installDirectSignalControl(binding);
12489
+ if (!binding.pendingControl) consumeHydrationControl(binding.target, revision);
12490
+ }
12491
+ }
12492
+ function createDirectSignalBinding(scope, target, value, site, kind, name, attributeKind, text) {
12493
+ const handle = isSignalHandle(value) ? value : null;
12494
+ const binding = {
12495
+ [DIRECT_SIGNAL_BINDING]: true,
12496
+ scope,
12497
+ kind,
12498
+ target,
12499
+ site,
12500
+ name,
12501
+ attributeKind,
12502
+ handle,
12503
+ value: scope,
12504
+ disposed: false
12505
+ };
12506
+ if (text !== void 0) binding.text = text;
12507
+ const controlSnapshot = kind === "value" || kind === "checked" ? snapshotHydrationControl(target) : null;
12508
+ if (controlSnapshot !== null) validateDirectSignalControl(target, site);
12509
+ binding.pendingControl = activeHydration() !== null && isWritableSignal(handle) && controlSnapshot !== null && controlSnapshot.editRevision > 0;
12510
+ const initial = handle === null ? value : readSignalBinding(handle);
12511
+ if (!binding.pendingControl) writeDirectSignalBinding(binding, initial);
12512
+ if (STAGED_COMMIT_CAPTURE !== null) {
12513
+ DEFERRED_LAYOUT_DRIVER.stageAction(() => {
12514
+ runWithBlockSignalOwner(
12515
+ scope,
12516
+ () => activateDirectSignalBinding(binding, controlSnapshot?.revision)
12517
+ );
12518
+ updateDirectSignalBinding(binding);
12519
+ });
12520
+ } else activateDirectSignalBinding(binding, controlSnapshot?.revision);
12521
+ if (binding.pendingControl) queueDirectSignalControlAdoption(binding);
12522
+ registerHookCleanup(scope, () => disposeDirectSignalBinding(binding));
12523
+ return binding;
12524
+ }
12525
+ function bindDirectSignal(scope, previous, target, value, site, kind, name, attributeKind) {
12526
+ const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_BINDING] === true ? previous : null;
12527
+ const handle = isSignalHandle(value) ? value : null;
12528
+ if (handle !== null && (!signalDocumentEnabled || currentSignalOwner() !== SCOPE_SIGNAL_OWNERS.get(scope))) {
12529
+ if (!signalDocumentEnabled) enableSignalBindings();
12530
+ return runWithBlockSignalOwner(
12531
+ scope,
12532
+ () => bindDirectSignal(scope, previous, target, value, site, kind, name, attributeKind)
12533
+ );
12534
+ }
12535
+ if (handle === null && prior === null) {
12536
+ if (kind === "attribute" && previous === value) {
12537
+ const hydration = value === void 0 ? activeHydration() : null;
12538
+ if (hydration === null || hydration.isFresh(target)) return previous;
12539
+ }
12540
+ if (TRANSITION_JOURNAL !== null) journalBag();
12541
+ const scalarTarget = (kind === "text" || kind === "textOnlyChild") && previous instanceof Text ? previous : target;
12542
+ return writeDirectSignalScalar(scalarTarget, value, kind, previous, name, attributeKind);
12543
+ }
12544
+ if (prior !== null && !prior.disposed && prior.target === target && prior.kind === kind && prior.site === site && prior.name === name && prior.attributeKind === attributeKind && prior.handle === handle) {
12545
+ if (prior.pendingControl) {
12546
+ queueDirectSignalControlAdoption(prior);
12547
+ return prior;
12548
+ }
12549
+ const next = readSignalBinding(handle);
12550
+ if (!Object.is(prior.value, next)) writeDirectSignalBinding(prior, next);
12551
+ return prior;
12552
+ }
12553
+ if (TRANSITION_JOURNAL !== null) journalBag();
12554
+ if (handle === null) {
12555
+ const scalarTarget = kind === "text" || kind === "textOnlyChild" ? prior?.text ?? prior?.target ?? target : target;
12556
+ const token = writeDirectSignalScalar(
12557
+ scalarTarget,
12558
+ value,
12559
+ kind,
12560
+ kind === "text" || kind === "textOnlyChild" ? prior?.text : prior?.value ?? previous,
12561
+ name,
12562
+ attributeKind
12563
+ );
12564
+ if (prior !== null) {
12565
+ const finish = (discarded) => {
12566
+ if (!discarded) disposeDirectSignalBinding(prior);
12567
+ };
12568
+ if (WIP_CAPTURE === null) finish(false);
12569
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
12570
+ }
12571
+ return token;
12572
+ }
12573
+ const signalTarget = (kind === "text" || kind === "textOnlyChild") && previous instanceof Text ? previous : target;
12574
+ const binding = createDirectSignalBinding(
12575
+ scope,
12576
+ signalTarget,
12577
+ value,
12578
+ site,
12579
+ kind,
12580
+ name,
12581
+ attributeKind,
12582
+ kind === "text" || kind === "textOnlyChild" ? prior?.text ?? (previous instanceof Text ? previous : void 0) : void 0
12583
+ );
12584
+ if (prior !== null) {
12585
+ const finish = (discarded) => disposeDirectSignalBinding(discarded ? binding : prior);
12586
+ if (WIP_CAPTURE === null) finish(false);
12587
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
12588
+ }
12589
+ return binding;
12590
+ }
12591
+ function bindSignalText(scope, previous, position, value, site, onlyChild = false, seededText = void 0, bindingMarker, previousValue) {
12592
+ if (previous instanceof Text && arguments.length > 8 && previousValue === value && !isSignalHandle(value))
12593
+ return previous;
12594
+ if (previous === void 0 && bindingMarker !== void 0) {
12595
+ const existing = activeHydration() !== null ? getNextSibling(position) : null;
12596
+ previous = bindingText(
12597
+ position,
12598
+ existing?.nodeType === 3 ? (STAGED_DOM?.view(existing) ?? existing).nodeValue : "",
12599
+ bindingMarker
12600
+ );
12601
+ }
12602
+ if (previous === void 0 && onlyChild && seededText === 1 && activeHydration() === null) {
12603
+ const text = getFirstChild(position);
12604
+ if (text instanceof Text) previous = text;
12605
+ }
12606
+ const prior = previous;
12607
+ return bindDirectSignal(
12608
+ scope,
12609
+ previous,
12610
+ prior?.target ?? (previous instanceof Text ? previous : position),
12611
+ value,
12612
+ site,
12613
+ onlyChild ? "textOnlyChild" : "text"
12614
+ );
12615
+ }
12616
+ function bindSignalAttribute(scope, previous, element, name, value, site, attributeKind = "attr") {
12617
+ return bindDirectSignal(scope, previous, element, value, site, "attribute", name, attributeKind);
12618
+ }
12619
+ function bindSignalValue(scope, previous, element, value, site) {
12620
+ return bindDirectSignal(scope, previous, element, value, site, "value");
12621
+ }
12622
+ function bindSignalChecked(scope, previous, element, value, site) {
12623
+ return bindDirectSignal(scope, previous, element, value, site, "checked");
12624
+ }
10952
12625
  function setAttributeIfChanged(value, previous, el, name) {
10953
12626
  if (previous === value) return previous;
10954
12627
  setAttribute(el, name, value);
@@ -12380,8 +14053,7 @@ function normalizedHostProp(el, rawName) {
12380
14053
  if (actionName !== null) return actionName;
12381
14054
  return isHtmlCustomElement(el) ? rawName : ATTRIBUTE_ALIASES.get(rawName) ?? rawName;
12382
14055
  }
12383
- function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false, readStyle) {
12384
- const props = /* @__PURE__ */ new Map();
14056
+ function resolveHostPropSources(el, sources, props, readStyle) {
12385
14057
  let classMerges = null;
12386
14058
  let sourceOrder = 0;
12387
14059
  function record(rawName, value) {
@@ -12405,64 +14077,440 @@ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false,
12405
14077
  record(rawName, source[2]);
12406
14078
  continue;
12407
14079
  }
12408
- const spread = source[1];
12409
- if (spread == null || typeof spread !== "object" && typeof spread !== "function") continue;
12410
- for (const name of Object.keys(Object(spread))) {
12411
- record(name, spread[name]);
14080
+ const spread = source[1];
14081
+ if (spread == null || typeof spread !== "object" && typeof spread !== "function") continue;
14082
+ for (const name of Object.keys(Object(spread))) {
14083
+ record(name, spread[name]);
14084
+ }
14085
+ }
14086
+ const values = /* @__PURE__ */ new Map();
14087
+ const html = el.namespaceURI === "http://www.w3.org/1999/xhtml";
14088
+ let needsWinningOrderSort = false;
14089
+ for (const writer of props.values()) {
14090
+ const rawName = writer.name;
14091
+ if (rawName === "key") continue;
14092
+ const identityKey = isHostPropIdentityKey(rawName);
14093
+ const name = identityKey ? rawName : normalizedHostProp(el, rawName);
14094
+ const identity = html && !identityKey ? name.toLowerCase() : name;
14095
+ const previous = values.get(identity);
14096
+ if (previous !== void 0) {
14097
+ if (previous.lastOrder >= writer.lastOrder) continue;
14098
+ needsWinningOrderSort = true;
14099
+ }
14100
+ writer.name = process.env.NODE_ENV !== "production" && (rawName === "tabIndex" || rawName === "htmlFor") ? rawName : name;
14101
+ values.set(identity, writer);
14102
+ }
14103
+ if (classMerges !== null) {
14104
+ for (const extra of classMerges) {
14105
+ const previous = values.get("class");
14106
+ if (previous !== void 0) {
14107
+ previous.value = mergeClass(previous.value, extra.value);
14108
+ previous.lastOrder = extra.order;
14109
+ } else {
14110
+ values.set("class", {
14111
+ name: "class",
14112
+ value: extra.value,
14113
+ firstOrder: extra.order,
14114
+ lastOrder: extra.order
14115
+ });
14116
+ }
14117
+ }
14118
+ }
14119
+ const resolved = /* @__PURE__ */ Object.create(null);
14120
+ const ordered = needsWinningOrderSort ? [...values.values()].sort((a, b) => a.firstOrder - b.firstOrder) : values.values();
14121
+ for (const { name, value } of ordered) resolved[name] = value;
14122
+ if (readStyle !== void 0 && "style" in resolved) resolved.style = readStyle(resolved.style);
14123
+ return resolved;
14124
+ }
14125
+ function setHostPropSources(el, sources, prev, scope, hasNestedChildren = false, readStyle, deferControl = false) {
14126
+ const props = /* @__PURE__ */ new Map();
14127
+ const resolved = resolveHostPropSources(el, sources, props, readStyle);
14128
+ const tag = el.localName;
14129
+ const formHost = tag === "input" || tag === "textarea" || tag === "select";
14130
+ setSpread(el, resolved, prev, scope, true, formHost);
14131
+ setDangerouslySetInnerHTMLSources(el, sources, hasNestedChildren);
14132
+ if (formHost && !deferControl)
14133
+ applyFormControlValues(
14134
+ el,
14135
+ tag,
14136
+ props.get("value")?.value,
14137
+ props.get("defaultValue")?.value,
14138
+ props.get("checked")?.value,
14139
+ props.get("defaultChecked")?.value,
14140
+ props.get("multiple")?.value
14141
+ );
14142
+ return resolved;
14143
+ }
14144
+ const SIGNAL_HOST_PROP_SOURCES = /* @__PURE__ */ Symbol("octane.signal-host-prop-sources");
14145
+ function resolveSignalStyle(value, handles, read) {
14146
+ if (isSignalHandle(value)) {
14147
+ handles.add(value);
14148
+ return read(value);
14149
+ }
14150
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
14151
+ let copy;
14152
+ for (const name of Object.keys(value)) {
14153
+ const current = value[name];
14154
+ if (!isSignalHandle(current)) continue;
14155
+ handles.add(current);
14156
+ copy ??= { ...value };
14157
+ copy[name] = read(current);
14158
+ }
14159
+ return copy ?? value;
14160
+ }
14161
+ function resolveSignalHostPropSources(sources, readStyle, read = readSignalBinding) {
14162
+ const handles = /* @__PURE__ */ new Set();
14163
+ let rows;
14164
+ for (let i = 0; i < sources.length; i++) {
14165
+ const source = sources[i];
14166
+ if (!source[0]) {
14167
+ const value = source[1] === "children" || source[1] === "style" && readStyle !== void 0 ? source[2] : source[1] === "style" ? resolveSignalStyle(source[2], handles, read) : isSignalHandle(source[2]) ? (handles.add(source[2]), read(source[2])) : source[2];
14168
+ if (value !== source[2]) {
14169
+ rows ??= sources.slice();
14170
+ rows[i] = [false, source[1], value, source[3]];
14171
+ }
14172
+ continue;
14173
+ }
14174
+ const spread = source[1];
14175
+ if (spread === null || typeof spread !== "object") continue;
14176
+ let copy;
14177
+ for (const name of Object.keys(spread)) {
14178
+ const current = spread[name];
14179
+ const value = name === "children" || name === "style" && readStyle !== void 0 ? current : name === "style" ? resolveSignalStyle(current, handles, read) : isSignalHandle(current) ? (handles.add(current), read(current)) : current;
14180
+ if (value !== current) {
14181
+ copy ??= { ...spread };
14182
+ copy[name] = value;
14183
+ }
14184
+ }
14185
+ if (copy !== void 0) {
14186
+ rows ??= sources.slice();
14187
+ rows[i] = [true, copy];
14188
+ }
14189
+ }
14190
+ return { sources: rows ?? sources, handles };
14191
+ }
14192
+ function winningSignalHostControl(sources, name) {
14193
+ let winner;
14194
+ for (const source of sources) {
14195
+ if (!source[0]) {
14196
+ if (source[1] === name) winner = source[2];
14197
+ continue;
14198
+ }
14199
+ const spread = source[1];
14200
+ if (spread !== null && typeof spread === "object" && Object.prototype.propertyIsEnumerable.call(spread, name)) {
14201
+ winner = spread[name];
14202
+ }
14203
+ }
14204
+ return isSignalHandle(winner) ? winner : null;
14205
+ }
14206
+ function updateSignalHostPropSources(binding) {
14207
+ if (binding.disposed || binding.pendingControl || binding.scope.block.disposed) return;
14208
+ try {
14209
+ runWithBlockSignalOwner(binding.scope, () => {
14210
+ const next = resolveSignalHostPropSources(binding.sources, binding.readStyle);
14211
+ binding.resolved = setHostPropSources(
14212
+ binding.element,
14213
+ next.sources,
14214
+ binding.resolved,
14215
+ binding.scope,
14216
+ binding.hasNestedChildren,
14217
+ binding.readStyle
14218
+ );
14219
+ if (process.env.NODE_ENV !== "production" && STAGED_DOM === null)
14220
+ drainDevFormDiagnostics(binding.element);
14221
+ });
14222
+ } catch {
14223
+ scheduleRender(binding.scope.block);
14224
+ }
14225
+ }
14226
+ function addSignalHostSubscription(binding, handle) {
14227
+ const unsubscribe = handle[SIGNAL_BINDING_SUBSCRIBE](
14228
+ nativeTransitionBindingNotify(binding, () => updateSignalHostPropSources(binding))
14229
+ );
14230
+ binding.subscriptions.set(handle, unsubscribe);
14231
+ return unsubscribe;
14232
+ }
14233
+ function rebindSignalHostSubscriptions(binding, handles) {
14234
+ for (const [handle, unsubscribe] of binding.subscriptions) {
14235
+ if (handles.has(handle)) continue;
14236
+ unsubscribe();
14237
+ binding.subscriptions.delete(handle);
14238
+ if (TRANSITION_JOURNAL !== null) {
14239
+ journalUndo(() => {
14240
+ if (binding.disposed || binding.scope.block.disposed) return;
14241
+ runWithBlockSignalOwner(binding.scope, () => addSignalHostSubscription(binding, handle));
14242
+ });
14243
+ }
14244
+ }
14245
+ for (const handle of handles) {
14246
+ if (binding.subscriptions.has(handle)) continue;
14247
+ const unsubscribe = addSignalHostSubscription(binding, handle);
14248
+ if (TRANSITION_JOURNAL !== null) {
14249
+ journalUndo(() => {
14250
+ unsubscribe();
14251
+ binding.subscriptions.delete(handle);
14252
+ });
14253
+ }
14254
+ }
14255
+ }
14256
+ function addSignalHostControlWriter(binding, channel) {
14257
+ const cleanup = registerHydrationControlSignalWriter(binding.element, channel, (next) => {
14258
+ withoutSignalCandidate(
14259
+ () => runWithBlockSignalOwner(binding.scope, () => {
14260
+ const handle = winningSignalHostControl(binding.sources, channel);
14261
+ if (!binding.disposed && !binding.pendingControl && isWritableSignal(handle))
14262
+ handle.set(next);
14263
+ })
14264
+ );
14265
+ });
14266
+ binding.controlWriters.set(channel, cleanup);
14267
+ return cleanup;
14268
+ }
14269
+ function syncSignalHostControl(binding) {
14270
+ const element = binding.element;
14271
+ const value = winningSignalHostControl(binding.sources, "value");
14272
+ const checked = winningSignalHostControl(binding.sources, "checked");
14273
+ const writable = isWritableSignal(value) || isWritableSignal(checked);
14274
+ for (const [channel, cleanup] of binding.controlWriters) {
14275
+ if (channel === "value" && isWritableSignal(value) || channel === "checked" && isWritableSignal(checked)) {
14276
+ continue;
14277
+ }
14278
+ cleanup();
14279
+ binding.controlWriters.delete(channel);
14280
+ if (TRANSITION_JOURNAL !== null) {
14281
+ journalUndo(() => {
14282
+ if (!binding.disposed && !binding.scope.block.disposed)
14283
+ addSignalHostControlWriter(binding, channel);
14284
+ });
12412
14285
  }
12413
14286
  }
12414
- const values = /* @__PURE__ */ new Map();
12415
- const html = el.namespaceURI === "http://www.w3.org/1999/xhtml";
12416
- let needsWinningOrderSort = false;
12417
- for (const writer of props.values()) {
12418
- const rawName = writer.name;
12419
- if (rawName === "key") continue;
12420
- const identityKey = isHostPropIdentityKey(rawName);
12421
- const name = identityKey ? rawName : normalizedHostProp(el, rawName);
12422
- const identity = html && !identityKey ? name.toLowerCase() : name;
12423
- const previous = values.get(identity);
12424
- if (previous !== void 0) {
12425
- if (previous.lastOrder >= writer.lastOrder) continue;
12426
- needsWinningOrderSort = true;
14287
+ if (isWritableSignal(value) && !binding.controlWriters.has("value")) {
14288
+ const cleanup = addSignalHostControlWriter(binding, "value");
14289
+ if (TRANSITION_JOURNAL !== null) {
14290
+ journalUndo(() => {
14291
+ cleanup();
14292
+ binding.controlWriters.delete("value");
14293
+ });
12427
14294
  }
12428
- writer.name = process.env.NODE_ENV !== "production" && (rawName === "tabIndex" || rawName === "htmlFor") ? rawName : name;
12429
- values.set(identity, writer);
12430
14295
  }
12431
- if (classMerges !== null) {
12432
- for (const extra of classMerges) {
12433
- const previous = values.get("class");
12434
- if (previous !== void 0) {
12435
- previous.value = mergeClass(previous.value, extra.value);
12436
- previous.lastOrder = extra.order;
12437
- } else {
12438
- values.set("class", {
12439
- name: "class",
12440
- value: extra.value,
12441
- firstOrder: extra.order,
12442
- lastOrder: extra.order
14296
+ if (isWritableSignal(checked) && !binding.controlWriters.has("checked")) {
14297
+ const cleanup = addSignalHostControlWriter(binding, "checked");
14298
+ if (TRANSITION_JOURNAL !== null) {
14299
+ journalUndo(() => {
14300
+ cleanup();
14301
+ binding.controlWriters.delete("checked");
14302
+ });
14303
+ }
14304
+ }
14305
+ if (!writable) {
14306
+ if (binding.input !== void 0) {
14307
+ const input2 = binding.input;
14308
+ (STAGED_DOM?.view(element) ?? element).removeEventListener("input", input2);
14309
+ if (TRANSITION_JOURNAL !== null) {
14310
+ journalUndo(() => {
14311
+ if (!binding.disposed && !binding.scope.block.disposed)
14312
+ (STAGED_DOM?.view(element) ?? element).addEventListener("input", input2);
12443
14313
  });
12444
14314
  }
14315
+ binding.input = void 0;
12445
14316
  }
14317
+ return;
12446
14318
  }
12447
- const resolved = /* @__PURE__ */ Object.create(null);
12448
- const ordered = needsWinningOrderSort ? [...values.values()].sort((a, b) => a.firstOrder - b.firstOrder) : values.values();
12449
- for (const { name, value } of ordered) resolved[name] = value;
12450
- if (readStyle !== void 0 && "style" in resolved) resolved.style = readStyle(resolved.style);
12451
- const tag = el.localName;
12452
- const formHost = tag === "input" || tag === "textarea" || tag === "select";
12453
- setSpread(el, resolved, prev, scope, true, formHost);
12454
- setDangerouslySetInnerHTMLSources(el, sources, hasNestedChildren);
12455
- if (formHost)
12456
- applyFormControlValues(
12457
- el,
12458
- tag,
12459
- props.get("value")?.value,
12460
- props.get("defaultValue")?.value,
12461
- props.get("checked")?.value,
12462
- props.get("defaultChecked")?.value,
12463
- props.get("multiple")?.value
14319
+ validateDirectSignalControl(element, binding.site);
14320
+ if (binding.input !== void 0) return;
14321
+ const input = () => {
14322
+ if (binding.disposed || binding.pendingControl) return;
14323
+ const live = snapshotHydrationControl(element);
14324
+ if (live === null) return;
14325
+ withoutSignalCandidate(
14326
+ () => runWithBlockSignalOwner(binding.scope, () => {
14327
+ const nextValue = winningSignalHostControl(binding.sources, "value");
14328
+ const nextChecked = winningSignalHostControl(binding.sources, "checked");
14329
+ if (isWritableSignal(nextChecked) && live.checked !== void 0)
14330
+ nextChecked.set(live.checked);
14331
+ if (isWritableSignal(nextValue)) nextValue.set(live.selectedValues ?? live.value);
14332
+ })
12464
14333
  );
12465
- return resolved;
14334
+ };
14335
+ binding.input = input;
14336
+ (STAGED_DOM?.view(element) ?? element).addEventListener("input", input);
14337
+ if (TRANSITION_JOURNAL !== null)
14338
+ journalUndo(() => (STAGED_DOM?.view(element) ?? element).removeEventListener("input", input));
14339
+ }
14340
+ function disposeSignalHostPropSources(binding) {
14341
+ if (binding.disposed) return;
14342
+ if (DEFERRED_LAYOUT_DRIVER?.stageAction(() => disposeSignalHostPropSources(binding)) === true)
14343
+ return;
14344
+ binding.disposed = true;
14345
+ for (const unsubscribe of binding.subscriptions.values()) unsubscribe();
14346
+ retireNativeTransitionBlock(binding.scope.block);
14347
+ binding.subscriptions.clear();
14348
+ for (const cleanup of binding.controlWriters.values()) cleanup();
14349
+ binding.controlWriters.clear();
14350
+ if (binding.input !== void 0)
14351
+ domNode(binding.element).removeEventListener("input", binding.input);
14352
+ queueOwnRefDetach(binding.resolved, binding.element);
14353
+ }
14354
+ function queueSignalHostControlAdoption(binding) {
14355
+ enqueueEffectEventCommitAction(() => {
14356
+ if (binding.disposed || binding.scope.block.disposed || !binding.pendingControl) return;
14357
+ withoutSignalCandidate(
14358
+ () => runWithBlockSignalOwner(binding.scope, () => {
14359
+ const snapshot = snapshotHydrationControl(binding.element);
14360
+ if (snapshot.editRevision > 0) {
14361
+ const checked = winningSignalHostControl(binding.sources, "checked");
14362
+ const value = winningSignalHostControl(binding.sources, "value");
14363
+ if (isWritableSignal(checked) && snapshot.checked !== void 0)
14364
+ checked.set(snapshot.checked);
14365
+ if (isWritableSignal(value)) value.set(snapshot.selectedValues ?? snapshot.value);
14366
+ }
14367
+ if (binding.disposed || binding.scope.block.disposed) return;
14368
+ if (!consumeHydrationControl(binding.element, snapshot.revision)) {
14369
+ queueSignalHostControlAdoption(binding);
14370
+ return;
14371
+ }
14372
+ binding.pendingControl = false;
14373
+ updateSignalHostPropSources(binding);
14374
+ })
14375
+ );
14376
+ });
14377
+ }
14378
+ function createSignalHostPropSourcesBinding(scope, element, sources, site, hasNestedChildren, readStyle) {
14379
+ const binding = {
14380
+ [SIGNAL_HOST_PROP_SOURCES]: true,
14381
+ scope,
14382
+ element,
14383
+ site,
14384
+ hasNestedChildren,
14385
+ readStyle,
14386
+ sources,
14387
+ resolved: void 0,
14388
+ subscriptions: /* @__PURE__ */ new Map(),
14389
+ controlWriters: /* @__PURE__ */ new Map(),
14390
+ disposed: false
14391
+ };
14392
+ registerHookCleanup(scope, () => disposeSignalHostPropSources(binding));
14393
+ return binding;
14394
+ }
14395
+ function prepareSignalHostPropSources(scope, previous, element, sources, site, hasNestedChildren = false, readStyle) {
14396
+ if (isHtmlCustomElement(element) || element.hasAttribute("is") || element.localName === "input" || element.localName === "textarea" || element.localName === "select")
14397
+ presentationMiss(false);
14398
+ return runWithBlockSignalOwner(scope, () => {
14399
+ const next = resolveSignalHostPropSources(sources, readStyle, (handle) => handle.get());
14400
+ const writers = /* @__PURE__ */ new Map();
14401
+ const resolved = resolveHostPropSources(element, next.sources, writers, readStyle);
14402
+ for (const name of writers.keys()) {
14403
+ if (name === "ref" || isEventKey(name)) continue;
14404
+ if (isHostPropIdentityKey(name) || name === "is" || name === "muted" || name === "selected" || formActionAttributeName(element, name) !== null)
14405
+ presentationMiss(false);
14406
+ }
14407
+ const prepared = /* @__PURE__ */ Object.create(null);
14408
+ for (const name of Object.keys(resolved)) {
14409
+ const value = resolved[name];
14410
+ prepared[name] = name === "ref" || isEventKey(name) ? value : name === "style" ? __normalizeBindingStyle(value) : preparedPresentationAttribute(
14411
+ element,
14412
+ name,
14413
+ value,
14414
+ name === "class" ? "class" : "attr"
14415
+ );
14416
+ }
14417
+ const prior = previous;
14418
+ const reusable = prior?.[SIGNAL_HOST_PROP_SOURCES] === true && !prior.disposed && prior.resolved === void 0 && prior.scope === scope && prior.element === element && prior.site === site && prior.hasNestedChildren === hasNestedChildren && prior.readStyle === readStyle;
14419
+ const binding = reusable ? prior : createSignalHostPropSourcesBinding(
14420
+ scope,
14421
+ element,
14422
+ sources,
14423
+ site,
14424
+ hasNestedChildren,
14425
+ readStyle
14426
+ );
14427
+ let published = false;
14428
+ return {
14429
+ binding,
14430
+ publish() {
14431
+ if (published || binding.disposed || scope.block.disposed) return;
14432
+ published = true;
14433
+ runWithBlockSignalOwner(scope, () => {
14434
+ setSpread(
14435
+ element,
14436
+ prepared,
14437
+ "style" in prepared ? { style: "" } : void 0,
14438
+ scope,
14439
+ true
14440
+ );
14441
+ binding.sources = sources;
14442
+ binding.resolved = resolved;
14443
+ rebindSignalHostSubscriptions(binding, next.handles);
14444
+ });
14445
+ }
14446
+ };
14447
+ });
14448
+ }
14449
+ function bindSignalHostPropSources(scope, previous, element, sources, site, hasNestedChildren = false, readStyle) {
14450
+ let binding = typeof previous === "object" && previous !== null && previous[SIGNAL_HOST_PROP_SOURCES] === true ? previous : void 0;
14451
+ if (binding === void 0) {
14452
+ binding = createSignalHostPropSourcesBinding(
14453
+ scope,
14454
+ element,
14455
+ sources,
14456
+ site,
14457
+ hasNestedChildren,
14458
+ readStyle
14459
+ );
14460
+ } else if (STAGED_COMMIT_CAPTURE === null) {
14461
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(binding);
14462
+ binding.sources = sources;
14463
+ }
14464
+ const committed = binding;
14465
+ if (STAGED_COMMIT_CAPTURE !== null) {
14466
+ const projections = STAGED_COMMIT_CAPTURE.signalHosts ??= /* @__PURE__ */ new Map();
14467
+ binding = projections.get(committed);
14468
+ if (binding === void 0) {
14469
+ binding = { ...committed };
14470
+ projections.set(committed, binding);
14471
+ if (isRecordingTransitionJournal()) journalUndo(() => projections.delete(committed));
14472
+ } else if (TRANSITION_JOURNAL !== null) journalObjectOnce(binding);
14473
+ binding.sources = sources;
14474
+ }
14475
+ const valueControl = winningSignalHostControl(sources, "value");
14476
+ const checkedControl = winningSignalHostControl(sources, "checked");
14477
+ const controlSnapshot = isWritableSignal(valueControl) || isWritableSignal(checkedControl) ? snapshotHydrationControl(element) : null;
14478
+ if (controlSnapshot !== null) {
14479
+ validateDirectSignalControl(element, site);
14480
+ binding.pendingControl ||= activeHydration() !== null && controlSnapshot.editRevision > 0;
14481
+ }
14482
+ const next = resolveSignalHostPropSources(sources, readStyle);
14483
+ binding.resolved = setHostPropSources(
14484
+ element,
14485
+ next.sources,
14486
+ binding.resolved,
14487
+ scope,
14488
+ hasNestedChildren,
14489
+ readStyle,
14490
+ binding.pendingControl
14491
+ );
14492
+ if (STAGED_COMMIT_CAPTURE !== null) {
14493
+ DEFERRED_LAYOUT_DRIVER.stageAction(() => {
14494
+ if (committed.disposed) return;
14495
+ committed.sources = binding.sources;
14496
+ committed.resolved = binding.resolved;
14497
+ committed.pendingControl = binding.pendingControl;
14498
+ runWithBlockSignalOwner(scope, () => {
14499
+ rebindSignalHostSubscriptions(committed, next.handles);
14500
+ syncSignalHostControl(committed);
14501
+ });
14502
+ if (!committed.pendingControl && controlSnapshot !== null)
14503
+ consumeHydrationControl(element, controlSnapshot.revision);
14504
+ updateSignalHostPropSources(committed);
14505
+ });
14506
+ } else {
14507
+ rebindSignalHostSubscriptions(binding, next.handles);
14508
+ syncSignalHostControl(binding);
14509
+ if (!binding.pendingControl && controlSnapshot !== null)
14510
+ consumeHydrationControl(element, controlSnapshot.revision);
14511
+ }
14512
+ if (binding.pendingControl) queueSignalHostControlAdoption(committed);
14513
+ return committed;
12466
14514
  }
12467
14515
  function isAggregatedFormControlProp(el, name) {
12468
14516
  switch (el.localName) {
@@ -12517,6 +14565,8 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12517
14565
  if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, mountScope);
12518
14566
  return;
12519
14567
  }
14568
+ const hydration = prev === void 0 ? activeHydration() : null;
14569
+ const initialHydration = hydration !== null && !hydration.isFresh(el);
12520
14570
  for (const k of Object.keys(Object(value))) {
12521
14571
  if (k === "key" || k === "children") continue;
12522
14572
  if (skipDangerouslySetInnerHTML && k === "dangerouslySetInnerHTML") continue;
@@ -12532,7 +14582,7 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12532
14582
  if (k === "suppressHydrationWarning" || k === "suppressNativeChangeWarning" || k === "__octaneNativeChangeDiagnostic")
12533
14583
  continue;
12534
14584
  if (k === "class" || k === "className") {
12535
- if (v === pv) continue;
14585
+ if (v === pv && !initialHydration) continue;
12536
14586
  setClassAttr(el, v);
12537
14587
  continue;
12538
14588
  }
@@ -12546,7 +14596,7 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12546
14596
  }
12547
14597
  const actionName = formActionAttributeName(el, k);
12548
14598
  if (actionName !== null) {
12549
- if (v === pv) continue;
14599
+ if (v === pv && !initialHydration) continue;
12550
14600
  setFormAction(
12551
14601
  el,
12552
14602
  actionName,
@@ -12555,9 +14605,10 @@ function setSpread(el, value, prev, mountScope, skipDangerouslySetInnerHTML = fa
12555
14605
  );
12556
14606
  continue;
12557
14607
  }
12558
- if (v === pv && !isControlledHostProp(el, k)) continue;
14608
+ if (v === pv && !isControlledHostProp(el, k) && !initialHydration) continue;
12559
14609
  const ev = eventSlot(k, el);
12560
14610
  if (ev) {
14611
+ if (v === pv) continue;
12561
14612
  if (ev.capture) {
12562
14613
  if (!_delegatedCapture.has(ev.type)) delegateCaptureEvents([ev.type]);
12563
14614
  } else if (!_delegated.has(ev.type)) {
@@ -12832,6 +14883,7 @@ function isUsableEventSlot(slot) {
12832
14883
  return typeof slot === "function" || isHandlerBundle(slot);
12833
14884
  }
12834
14885
  const EMPTY_ARGS = [];
14886
+ let SIGNAL_EVENT_OWNERS = null;
12835
14887
  function setEventHandler(el, key, handler) {
12836
14888
  if (TRANSITION_JOURNAL !== null) {
12837
14889
  TRANSITION_JOURNAL.push(
@@ -12843,6 +14895,18 @@ function setEventHandler(el, key, handler) {
12843
14895
  journalBag();
12844
14896
  }
12845
14897
  (STAGED_DOM?.view(el) ?? el)[key] = handler;
14898
+ if (SIGNAL_BINDINGS_ENABLED || signalDocumentEnabled) {
14899
+ const owner = (activeSynchronousSignalOwner !== null || activeSignalOwnerEnvironment !== void 0 ? currentExplicitSignalOwner() : null) ?? (signalDocumentEnabled || CURRENT_SCOPE?.block.idState.renderOwner?.signalOwner !== void 0 ? CURRENT_SCOPE === null ? currentSignalOwner() : SCOPE_SIGNAL_OWNERS.get(CURRENT_SCOPE) || CURRENT_SCOPE : CURRENT_SCOPE);
14900
+ if (owner !== null) {
14901
+ if ((owner instanceof ScopeImpl || owner instanceof BlockImpl) && SCOPE_SIGNAL_OWNERS.get(owner) === void 0)
14902
+ SCOPE_SIGNAL_OWNERS.set(owner, false);
14903
+ if (STAGED_COMMIT_CAPTURE !== null)
14904
+ DEFERRED_LAYOUT_DRIVER.stageAction(
14905
+ () => (SIGNAL_EVENT_OWNERS ??= /* @__PURE__ */ new WeakMap()).set(el, owner)
14906
+ );
14907
+ else (SIGNAL_EVENT_OWNERS ??= /* @__PURE__ */ new WeakMap()).set(el, owner);
14908
+ }
14909
+ }
12846
14910
  }
12847
14911
  function evt0(el, key, fn) {
12848
14912
  const d = { fn, args: EMPTY_ARGS, [EVENT_SLOT_KIND]: HANDLER_BUNDLE_KIND };
@@ -12940,11 +15004,13 @@ function isEventRoot(node, epoch) {
12940
15004
  }
12941
15005
  function prepareDelegatedEvent(event, listener) {
12942
15006
  if (_delegationTargets.size === 1 && portalEventTargetCount === 0) {
15007
+ beginBindingEvent(event);
12943
15008
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
12944
15009
  return;
12945
15010
  }
12946
15011
  const path = event.composedPath();
12947
15012
  if (_delegationTargets.size === 1) {
15013
+ beginBindingEvent(event);
12948
15014
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
12949
15015
  if (portalEventTargetCount !== 0) {
12950
15016
  preparePortalEventOwners(path, eventRootEpoch);
@@ -12955,6 +15021,7 @@ function prepareDelegatedEvent(event, listener) {
12955
15021
  for (let i = path.length - 1; i >= 0; i--) {
12956
15022
  if (_delegationTargets.has(path[i])) {
12957
15023
  if (path[i] === listener) {
15024
+ beginBindingEvent(event);
12958
15025
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
12959
15026
  if (portalEventTargetCount !== 0) {
12960
15027
  preparePortalEventOwners(path, eventRootEpoch);
@@ -13433,12 +15500,12 @@ function buildDelegatedPath(event, listener, path = event.composedPath()) {
13433
15500
  rebaseRootAtStart = true;
13434
15501
  }
13435
15502
  }
13436
- function fireEventSlot(slot, event) {
15503
+ function fireEventSlot(slot, event, currentTarget) {
13437
15504
  const previousScope = CURRENT_SCOPE;
13438
15505
  const previousBlock = CURRENT_BLOCK;
13439
15506
  CURRENT_SCOPE = null;
13440
15507
  CURRENT_BLOCK = null;
13441
- try {
15508
+ const invoke = () => {
13442
15509
  if (typeof slot === "function") {
13443
15510
  slot(event);
13444
15511
  return;
@@ -13476,6 +15543,12 @@ function fireEventSlot(slot, event) {
13476
15543
  return;
13477
15544
  }
13478
15545
  invokeInvalidEventListener(`${event.type} event`, slot, event);
15546
+ };
15547
+ try {
15548
+ const recorded = SIGNAL_EVENT_OWNERS?.get(currentTarget);
15549
+ const owner = recorded instanceof ScopeImpl || recorded instanceof BlockImpl ? scopeSignalOwner(recorded) : recorded;
15550
+ if (owner === void 0 || currentSignalOwner() === owner) invoke();
15551
+ else runWithSignalOwner(owner, invoke);
13479
15552
  } catch (err) {
13480
15553
  reportListenerError(err);
13481
15554
  } finally {
@@ -13574,9 +15647,9 @@ function dispatchDelegated(event) {
13574
15647
  const current = CAPTURE_PATH[i];
13575
15648
  if (targetOnly && current !== event.target) break;
13576
15649
  const slot = CAPTURE_SLOTS[i];
13577
- if (slot != null) {
15650
+ if (slot != null && !consumeBindingEvent(event, current, false)) {
13578
15651
  setCurrentTarget(event, current, frame);
13579
- fireEventSlot(slot, event);
15652
+ fireEventSlot(slot, event, current);
13580
15653
  if ((frame.flags & 1) !== 0) break;
13581
15654
  }
13582
15655
  if (targetOnly) break;
@@ -13621,9 +15694,9 @@ function dispatchDelegatedCapture(event, path, type = _delegated.get(event.type)
13621
15694
  frame = beginDelegatedPropagation(event, stop, immediate);
13622
15695
  for (let i = CAPTURE_PATH.length - 1; i >= pathBase; i--) {
13623
15696
  const slot = CAPTURE_SLOTS[i];
13624
- if (slot != null) {
15697
+ if (slot != null && !consumeBindingEvent(event, CAPTURE_PATH[i], true)) {
13625
15698
  setCurrentTarget(event, CAPTURE_PATH[i], frame);
13626
- fireEventSlot(slot, event);
15699
+ fireEventSlot(slot, event, CAPTURE_PATH[i]);
13627
15700
  if ((frame.flags & 1) !== 0) break;
13628
15701
  }
13629
15702
  }
@@ -14471,7 +16544,7 @@ function formDiagnosticOutcome(el) {
14471
16544
  const ctrl = host.$$ctrl;
14472
16545
  if (isTextEntry(el)) {
14473
16546
  const controlled = ctrl !== void 0 && ctrl.v !== UNCONTROLLED;
14474
- if (hasInput) return null;
16547
+ if (hasInput || hasHydrationControlSignalWriter(el, "value")) return null;
14475
16548
  if (hasChange) {
14476
16549
  const dev = getDevFormDiagnosticState(el);
14477
16550
  if (host.__oct_native_change_suppressed === true || dev?.staticNativeChange === true)
@@ -14489,7 +16562,8 @@ function formDiagnosticOutcome(el) {
14489
16562
  };
14490
16563
  }
14491
16564
  if (el.localName === "select") {
14492
- if (ctrl === void 0 || ctrl.sv === null || hasInput || hasChange) return null;
16565
+ if (ctrl === void 0 || ctrl.sv === null || hasInput || hasChange || hasHydrationControlSignalWriter(el, "value"))
16566
+ return null;
14493
16567
  return {
14494
16568
  signature: "controlled-select-missing",
14495
16569
  message: "You provided a `value` prop to a select without an `onInput` or `onChange` handler. This will render a read-only field. Set a usable native handler, `readOnly`, or use `defaultValue` for an uncontrolled field."
@@ -14499,25 +16573,33 @@ function formDiagnosticOutcome(el) {
14499
16573
  const checkable = input.localName === "input" && ((STAGED_DOM?.view(input) ?? input).type === "checkbox" || (STAGED_DOM?.view(input) ?? input).type === "radio");
14500
16574
  if (!checkable || ctrl === void 0 || ctrl.c === -1) return null;
14501
16575
  const hasClick = isUsableEventSlot(host.$$click) || isUsableEventSlot(host["$$capture:click"]);
14502
- if (hasClick || hasInput || hasChange) return null;
16576
+ if (hasClick || hasInput || hasChange || hasHydrationControlSignalWriter(el, "checked"))
16577
+ return null;
14503
16578
  return {
14504
16579
  signature: `controlled-checkable-missing:${(STAGED_DOM?.view(input) ?? input).type}`,
14505
16580
  message: "You provided a `checked` prop to a checkbox or radio without an `onClick`, `onInput`, or `onChange` handler. This will render a read-only field. Set a usable native handler, `readOnly`, or use `defaultChecked` for an uncontrolled field."
14506
16581
  };
14507
16582
  }
14508
- function drainDevFormDiagnostics() {
16583
+ function drainDevFormDiagnostics(target) {
14509
16584
  if (process.env.NODE_ENV === "production") return;
14510
- const q = DEV_FORM_CHECKS;
16585
+ let q = DEV_FORM_CHECKS;
14511
16586
  if (q === null || q.length === 0) return;
14512
- DEV_FORM_CHECKS = [];
14513
- DEV_FORM_CHECK_GENERATION++;
16587
+ if (target !== void 0) {
16588
+ const index = q.indexOf(target);
16589
+ if (index < 0) return;
16590
+ q.splice(index, 1);
16591
+ delete target[DEV_FORM_CHECK_MARK];
16592
+ q = [target];
16593
+ } else DEV_FORM_CHECKS = [];
16594
+ if (target === void 0) DEV_FORM_CHECK_GENERATION++;
14514
16595
  for (let i = 0; i < q.length; i++) {
14515
16596
  const el = q[i];
14516
16597
  const authoring = getDevFormDiagnosticState(el);
14517
16598
  if (authoring !== void 0) {
14518
16599
  let props = authoring.authoringProps;
14519
16600
  if (authoring.authoringSelected !== void 0) {
14520
- (props ??= /* @__PURE__ */ Object.create(null)).selected = authoring.authoringSelected();
16601
+ const selected = authoring.authoringSelected();
16602
+ (props ??= /* @__PURE__ */ Object.create(null)).selected = typeof selected === "object" && selected !== null && selected[DIRECT_SIGNAL_BINDING] === true ? selected.value : selected;
14521
16603
  }
14522
16604
  const action = el.$$formAction;
14523
16605
  if (typeof action === "function") {
@@ -15144,8 +17226,9 @@ function copyScopedElementConfig(type, config, resolve) {
15144
17226
  SCOPED_ELEMENT_PROPS.add(props);
15145
17227
  return props;
15146
17228
  }
15147
- function scopedElementRecord(type, props, key, ref, resolve) {
17229
+ function scopedElementRecord(type, props, key, ref, resolve, invocationSite) {
15148
17230
  const descriptor = { $$kind: ELEMENT_TAG, type, props, key, ref };
17231
+ if (invocationSite !== void 0) descriptor.__octaneInvocationSite = invocationSite;
15149
17232
  Object.defineProperty(descriptor, SCOPED_CHILDREN_RESOLVER, { value: resolve });
15150
17233
  Object.defineProperty(descriptor, "children", SCOPED_CHILDREN_PROPERTY);
15151
17234
  return descriptor;
@@ -15178,12 +17261,20 @@ function scopedValueRef() {
15178
17261
  function scopedValueChildren() {
15179
17262
  return this[SCOPED_VALUE_RECORD]().children;
15180
17263
  }
17264
+ function scopedValueInvocationSite() {
17265
+ return this[SCOPED_VALUE_RECORD]().__octaneInvocationSite;
17266
+ }
15181
17267
  const SCOPED_VALUE_PROPERTIES = {
15182
17268
  type: { configurable: true, enumerable: true, get: scopedValueType },
15183
17269
  props: { configurable: true, enumerable: true, get: scopedValueProps },
15184
17270
  key: { configurable: true, enumerable: true, get: scopedValueKey },
15185
17271
  ref: { configurable: true, enumerable: true, get: scopedValueRef },
15186
- children: { configurable: true, enumerable: true, get: scopedValueChildren }
17272
+ children: { configurable: true, enumerable: true, get: scopedValueChildren },
17273
+ __octaneInvocationSite: {
17274
+ configurable: true,
17275
+ enumerable: true,
17276
+ get: scopedValueInvocationSite
17277
+ }
15187
17278
  };
15188
17279
  function createScopedValue(readElement) {
15189
17280
  return scopedValueDescriptor(createScopedResolver(readElement));
@@ -15199,16 +17290,26 @@ function scopedValueDescriptor(resolve) {
15199
17290
  Object.defineProperty(descriptor, "key", SCOPED_VALUE_PROPERTIES.key);
15200
17291
  Object.defineProperty(descriptor, "ref", SCOPED_VALUE_PROPERTIES.ref);
15201
17292
  Object.defineProperty(descriptor, "children", SCOPED_VALUE_PROPERTIES.children);
17293
+ Object.defineProperty(
17294
+ descriptor,
17295
+ "__octaneInvocationSite",
17296
+ SCOPED_VALUE_PROPERTIES.__octaneInvocationSite
17297
+ );
15202
17298
  if (process.env.NODE_ENV !== "production") Object.freeze(descriptor);
15203
17299
  return descriptor;
15204
17300
  }
15205
- function createScopedElement(type, props, readChildren) {
15206
- return scopedElementDescriptor(type, props, createScopedResolver(readChildren));
17301
+ function createScopedElement(type, props, readChildren, invocationSite) {
17302
+ return scopedElementDescriptor(type, props, createScopedResolver(readChildren), invocationSite);
15207
17303
  }
15208
- function nativeCreateScopedElement(type, props, readChildren) {
15209
- return scopedElementDescriptor(type, props, createNativeScopedResolver(readChildren));
17304
+ function nativeCreateScopedElement(type, props, readChildren, invocationSite) {
17305
+ return scopedElementDescriptor(
17306
+ type,
17307
+ props,
17308
+ createNativeScopedResolver(readChildren),
17309
+ invocationSite
17310
+ );
15210
17311
  }
15211
- function scopedElementDescriptor(type, props, children) {
17312
+ function scopedElementDescriptor(type, props, children, invocationSite) {
15212
17313
  const src = props ?? null;
15213
17314
  const hasKey = hasElementConfigKey(src);
15214
17315
  const key = hasKey ? "" + src.key : null;
@@ -15218,7 +17319,8 @@ function scopedElementDescriptor(type, props, children) {
15218
17319
  copiedProps,
15219
17320
  key,
15220
17321
  copiedProps.ref !== void 0 ? copiedProps.ref : null,
15221
- children
17322
+ children,
17323
+ invocationSite
15222
17324
  );
15223
17325
  if (key === null && src != null && (typeof src === "object" || typeof src === "function") && "key" in src) {
15224
17326
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
@@ -15226,6 +17328,12 @@ function scopedElementDescriptor(type, props, children) {
15226
17328
  return finalizeElementDescriptor(descriptor);
15227
17329
  }
15228
17330
  function createElement(type, props, ...children) {
17331
+ return createElementFromConfig(void 0, type, props, children);
17332
+ }
17333
+ function createElementAt(invocationSite, type, props, ...children) {
17334
+ return createElementFromConfig(invocationSite, type, props, children);
17335
+ }
17336
+ function createElementFromConfig(invocationSite, type, props, children = EMPTY_ARGS) {
15229
17337
  if (typeof type === "function" && isRendererContext(type)) {
15230
17338
  registerClientRendererBridge(renderClientContextProvider, flushSync);
15231
17339
  }
@@ -15250,6 +17358,7 @@ function createElement(type, props, ...children) {
15250
17358
  ref: p.ref !== void 0 ? p.ref : null,
15251
17359
  children: kids ?? null
15252
17360
  };
17361
+ if (invocationSite !== void 0) descriptor.__octaneInvocationSite = invocationSite;
15253
17362
  if (key === null && src != null && (typeof src === "object" || typeof src === "function") && "key" in src) {
15254
17363
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
15255
17364
  }
@@ -15329,7 +17438,14 @@ function cloneElement(element, config, ...children) {
15329
17438
  const ref = props.ref !== void 0 ? props.ref : null;
15330
17439
  let descriptor;
15331
17440
  if (keepsScopedChildren && copiedGetter === void 0) {
15332
- descriptor = scopedElementRecord(element.type, props, key, ref, scopedChildren);
17441
+ descriptor = scopedElementRecord(
17442
+ element.type,
17443
+ props,
17444
+ key,
17445
+ ref,
17446
+ scopedChildren,
17447
+ element.__octaneInvocationSite
17448
+ );
15333
17449
  } else {
15334
17450
  descriptor = {
15335
17451
  $$kind: ELEMENT_TAG,
@@ -15339,6 +17455,8 @@ function cloneElement(element, config, ...children) {
15339
17455
  ref,
15340
17456
  children: kids ?? null
15341
17457
  };
17458
+ if (element.__octaneInvocationSite !== void 0)
17459
+ descriptor.__octaneInvocationSite = element.__octaneInvocationSite;
15342
17460
  if (keepsScopedChildren) {
15343
17461
  Object.defineProperty(descriptor, "children", {
15344
17462
  configurable: true,
@@ -15366,7 +17484,8 @@ function cloneAndReplaceElementKey(element, key) {
15366
17484
  element.props,
15367
17485
  key,
15368
17486
  element.ref,
15369
- element[SCOPED_CHILDREN_RESOLVER]
17487
+ element[SCOPED_CHILDREN_RESOLVER],
17488
+ element.__octaneInvocationSite
15370
17489
  );
15371
17490
  } else {
15372
17491
  const copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
@@ -15378,6 +17497,8 @@ function cloneAndReplaceElementKey(element, key) {
15378
17497
  ref: element.ref,
15379
17498
  children: null
15380
17499
  };
17500
+ if (element.__octaneInvocationSite !== void 0)
17501
+ descriptor.__octaneInvocationSite = element.__octaneInvocationSite;
15381
17502
  Object.defineProperty(descriptor, "children", {
15382
17503
  configurable: true,
15383
17504
  enumerable: true,
@@ -15393,6 +17514,8 @@ function cloneAndReplaceElementKey(element, key) {
15393
17514
  ref: element.ref,
15394
17515
  children: element.children
15395
17516
  };
17517
+ if (element.__octaneInvocationSite !== void 0)
17518
+ descriptor.__octaneInvocationSite = element.__octaneInvocationSite;
15396
17519
  }
15397
17520
  if (ELEMENTS_MISSING_LIST_KEY.has(element)) ELEMENTS_MISSING_LIST_KEY.add(descriptor);
15398
17521
  return finalizeElementDescriptor(descriptor);
@@ -15537,7 +17660,7 @@ const Children = {
15537
17660
  }
15538
17661
  };
15539
17662
  const NO_KEY = /* @__PURE__ */ Symbol("NO_KEY");
15540
- function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey) {
17663
+ function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
15541
17664
  const dispatch = activityDescriptorDispatch;
15542
17665
  const activity = dispatch !== null && comp === dispatch.type;
15543
17666
  if (!activity && typeof comp !== "function" && typeof comp !== "string") {
@@ -15573,10 +17696,11 @@ function componentSlot(parentScope, slotKey, domParent, comp, props, anchor, key
15573
17696
  key,
15574
17697
  singleRoot,
15575
17698
  inherit,
15576
- hasKey
17699
+ hasKey,
17700
+ invocationSite
15577
17701
  );
15578
17702
  }
15579
- function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey) {
17703
+ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
15580
17704
  if (typeof comp !== "function") throw invalidElementTypeError(comp);
15581
17705
  componentSlotImpl(
15582
17706
  null,
@@ -15591,10 +17715,11 @@ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, anchor,
15591
17715
  key,
15592
17716
  singleRoot,
15593
17717
  inherit,
15594
- hasKey
17718
+ hasKey,
17719
+ invocationSite
15595
17720
  );
15596
17721
  }
15597
- function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body, identity, props, renderProps, anchor, key, singleRoot, inherit, hasKey) {
17722
+ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body, identity, props, renderProps, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
15598
17723
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
15599
17724
  const parentBlock = parentScope.block;
15600
17725
  const hydration = activeHydration();
@@ -15613,7 +17738,8 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15613
17738
  key,
15614
17739
  singleRoot,
15615
17740
  inherit,
15616
- hasKey
17741
+ hasKey,
17742
+ invocationSite
15617
17743
  )
15618
17744
  );
15619
17745
  return;
@@ -15745,6 +17871,15 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15745
17871
  journalRootProperty(state, "prevKey", state.prevKey);
15746
17872
  state.prevKey = nextKey;
15747
17873
  if (replacing) {
17874
+ const signalInstanceKey = SIGNAL_BINDINGS_ENABLED || signalDocumentEnabled ? { parentScope, invocationSite, key, hasKey: key != null } : void 0;
17875
+ const retryLocation = state.block === null || !state.block.mounted || parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
17876
+ parent: parentScope,
17877
+ slot: slotKey,
17878
+ kind: state.__kind,
17879
+ branch: void 0,
17880
+ component: identity,
17881
+ key: nextKey
17882
+ };
15748
17883
  const swapDriver = TRANSITION_SWAP_DRIVER;
15749
17884
  const transitionMode = parentBlock.currentRenderMode === "transition";
15750
17885
  const canSwapOffscreen = swapDriver !== null && state.block !== null && state.block.mounted && hydration === null;
@@ -15769,7 +17904,12 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15769
17904
  stageAfter,
15770
17905
  body,
15771
17906
  renderProps,
15772
- outputHandler
17907
+ outputHandler,
17908
+ "dynamic",
17909
+ void 0,
17910
+ false,
17911
+ signalInstanceKey,
17912
+ retryLocation
15773
17913
  );
15774
17914
  if (r.suspended || r.failed) {
15775
17915
  disposeWip(r.wip);
@@ -15800,7 +17940,12 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15800
17940
  state.end,
15801
17941
  body,
15802
17942
  renderProps,
15803
- outputHandler
17943
+ outputHandler,
17944
+ "dynamic",
17945
+ void 0,
17946
+ false,
17947
+ signalInstanceKey,
17948
+ retryLocation
15804
17949
  );
15805
17950
  if (r.suspended || r.failed) {
15806
17951
  transitionSwap.dispose(r.wip);
@@ -15827,7 +17972,12 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15827
17972
  probeAfter,
15828
17973
  body,
15829
17974
  renderProps,
15830
- outputHandler
17975
+ outputHandler,
17976
+ "dynamic",
17977
+ void 0,
17978
+ false,
17979
+ signalInstanceKey,
17980
+ retryLocation
15831
17981
  );
15832
17982
  transitionSwap.dispose(r.wip);
15833
17983
  if (r.failed) throw r.error;
@@ -15871,6 +18021,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15871
18021
  void 0,
15872
18022
  outputHandler
15873
18023
  );
18024
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
15874
18025
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
15875
18026
  profileTrackComponent(b, identity);
15876
18027
  state.block = b;
@@ -15900,6 +18051,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15900
18051
  void 0,
15901
18052
  outputHandler
15902
18053
  );
18054
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
15903
18055
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
15904
18056
  profileTrackComponent(b, identity);
15905
18057
  if (state.inherited) b.exclusiveMarkers = true;
@@ -15919,7 +18071,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
15919
18071
  function coerceChildText(v) {
15920
18072
  return v == null || v === false || v === true ? "" : String(v);
15921
18073
  }
15922
- function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputHandler, kind = "dynamic", env, implicitBail = false) {
18074
+ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputHandler, kind = "dynamic", env, implicitBail = false, signalInstanceKey, retryLocation) {
15923
18075
  const start = (STAGED_DOM?.view(document) ?? document).createComment("wip");
15924
18076
  const end = (STAGED_DOM?.view(document) ?? document).createComment("/wip");
15925
18077
  const ref = getNextSibling(afterNode);
@@ -15940,6 +18092,8 @@ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputH
15940
18092
  env,
15941
18093
  outputHandler
15942
18094
  );
18095
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(block, signalInstanceKey);
18096
+ if (retryLocation !== void 0) SIGNAL_RETRY_LOCATIONS.set(block, retryLocation);
15943
18097
  if (implicitBail) {
15944
18098
  block.$$implicitBail = true;
15945
18099
  block.memoInChain = true;
@@ -15960,15 +18114,32 @@ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputH
15960
18114
  } finally {
15961
18115
  WIP_CAPTURE = prev;
15962
18116
  }
18117
+ const wip = { block, start, end, capture, domParent, refDetachCheckpoint };
18118
+ if (suspended !== null && retryLocation !== void 0) {
18119
+ const owner = parentBlock.idState.renderOwner;
18120
+ const boundary = signalRetryBoundary(parentBlock);
18121
+ const retryRoot = boundary?.tryBlock ?? owner?.current;
18122
+ const holder = boundary ?? owner;
18123
+ if (holder !== void 0 && retryRoot != null) {
18124
+ retainSignalRetryScope(block, retryRoot, holder, true);
18125
+ for (const created of ROOT_RENDER_TRANSACTION?.created ?? [])
18126
+ if (!created.disposed && blockIsAncestorOf(block, created))
18127
+ retainSignalRetryScope(created, retryRoot, holder);
18128
+ wip.retrySignalOwners = holder.retrySignalOwners;
18129
+ }
18130
+ }
15963
18131
  return {
15964
- wip: { block, start, end, capture, domParent, refDetachCheckpoint },
18132
+ wip,
15965
18133
  suspended,
15966
18134
  error,
15967
18135
  failed
15968
18136
  };
15969
18137
  }
15970
- function spliceOffscreenCapture(capture) {
15971
- NATIVE_READ_DRIVER?.spliceCapture(capture, WIP_CAPTURE);
18138
+ function spliceOffscreenCapture(capture, deferredNativeAcceptance = false) {
18139
+ if (capture.presentations !== void 0 && WIP_CAPTURE !== null)
18140
+ (WIP_CAPTURE.presentations ??= []).push(...capture.presentations);
18141
+ if (WIP_CAPTURE !== null || !deferredNativeAcceptance)
18142
+ NATIVE_READ_DRIVER?.spliceCapture(capture, WIP_CAPTURE);
15972
18143
  const rendered = capture.renderedBlocks;
15973
18144
  capture.renderedBlocks = null;
15974
18145
  capture.renderRoot = null;
@@ -16048,10 +18219,13 @@ function commitOffscreen(wip, beforeNode) {
16048
18219
  }
16049
18220
  function disposeWip(wip) {
16050
18221
  const previousCapture = WIP_CAPTURE;
18222
+ const previousRetained = RETAINED_SIGNAL_OWNERS;
18223
+ if (wip.retrySignalOwners !== void 0) RETAINED_SIGNAL_OWNERS = wip.retrySignalOwners;
16051
18224
  WIP_CAPTURE = wip.capture;
16052
18225
  try {
16053
18226
  unmountBlock(wip.block, true);
16054
18227
  } finally {
18228
+ RETAINED_SIGNAL_OWNERS = previousRetained;
16055
18229
  WIP_CAPTURE = previousCapture;
16056
18230
  refDetachQueue.splice(wip.refDetachCheckpoint);
16057
18231
  discardOffscreenCapture(wip.capture);
@@ -17011,7 +19185,9 @@ function mappedDeoptItemBody(item, scope) {
17011
19185
  block.endMarker,
17012
19186
  void 0,
17013
19187
  true,
17014
- true
19188
+ true,
19189
+ void 0,
19190
+ item.__octaneInvocationSite
17015
19191
  );
17016
19192
  return;
17017
19193
  }
@@ -17668,8 +19844,151 @@ function renderPreparedChildList(state, parentBlock, domParent, preparedList, hy
17668
19844
  }
17669
19845
  return;
17670
19846
  }
17671
- function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable, includeKeyedSingle = true, compiledMapBody, compiledMapKey, compiledMapFlags, compiledMapDeps, mappedFallback) {
19847
+ const DIRECT_SIGNAL_CHILD = /* @__PURE__ */ Symbol("octane.direct-signal-child");
19848
+ let IMPLICIT_SIGNAL_CHILD_DEPTH = 0;
19849
+ function disposeDirectSignalChild(binding) {
19850
+ if (binding.disposed) return;
19851
+ binding.disposed = true;
19852
+ binding.unsubscribe?.();
19853
+ retireNativeTransitionBlock(binding.scope.block);
19854
+ }
19855
+ function updateDirectSignalChild(binding) {
19856
+ if (binding.disposed || binding.scope.block.disposed) return;
19857
+ try {
19858
+ runWithBlockSignalOwner(binding.scope, () => {
19859
+ const value = readSignalBinding(binding.handle);
19860
+ if (Object.is(binding.value, value)) return;
19861
+ const state = binding.scope.slots[binding.slotKey];
19862
+ const type = typeof value;
19863
+ const primitive = value == null || type !== "object" && type !== "function";
19864
+ const text = primitive ? coerceChildText(value) : null;
19865
+ if (state === void 0 && binding.text != null && text !== null && text !== "") {
19866
+ setText(binding.text, text);
19867
+ binding.value = value;
19868
+ return;
19869
+ }
19870
+ if (state === binding.state && state?.block === null && state.forSlot === null && state.hostNode === null && state.portal === null && text !== null && text !== "" && state.text !== null) {
19871
+ setText(state.text, text);
19872
+ binding.value = value;
19873
+ return;
19874
+ }
19875
+ scheduleRender(binding.scope.block);
19876
+ });
19877
+ } catch {
19878
+ scheduleRender(binding.scope.block);
19879
+ }
19880
+ }
19881
+ function bindSignalChild(parentScope, previous, slotKey, domParent, value, _site, anchor, ownEnd, ownsHost, compactable, onlyChild, bindingMarker) {
19882
+ const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_CHILD] === true ? previous : null;
19883
+ const cachedText = prior?.text ?? (previous instanceof Text ? previous : null);
19884
+ if (!isSignalHandle(value)) {
19885
+ const text2 = onlyChild ? childTextHole(parentScope, slotKey, domParent, value, cachedText) : (bindingMarker === void 0 ? childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable) : bindingChildSlot(parentScope, slotKey, domParent, value, bindingMarker, anchor, ownEnd), null);
19886
+ if (prior !== null) {
19887
+ if (TRANSITION_JOURNAL !== null) journalBag();
19888
+ const finish = (discarded) => {
19889
+ if (!discarded) disposeDirectSignalChild(prior);
19890
+ };
19891
+ if (WIP_CAPTURE === null) finish(false);
19892
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
19893
+ }
19894
+ return text2;
19895
+ }
19896
+ if (prior !== null && !prior.disposed && prior.handle === value) {
19897
+ const next = readSignalBinding(value);
19898
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(prior);
19899
+ if (onlyChild) prior.text = childTextHole(parentScope, slotKey, domParent, next, cachedText);
19900
+ else if (bindingMarker !== void 0)
19901
+ bindingChildSlot(parentScope, slotKey, domParent, next, bindingMarker, anchor, ownEnd);
19902
+ else childSlot(parentScope, slotKey, domParent, next, anchor, ownEnd, ownsHost, compactable);
19903
+ prior.value = next;
19904
+ prior.state = parentScope.slots[slotKey];
19905
+ return prior;
19906
+ }
19907
+ const initial = readSignalBinding(value);
19908
+ const text = onlyChild ? childTextHole(parentScope, slotKey, domParent, initial, cachedText) : (bindingMarker === void 0 ? childSlot(parentScope, slotKey, domParent, initial, anchor, ownEnd, ownsHost, compactable) : bindingChildSlot(parentScope, slotKey, domParent, initial, bindingMarker, anchor, ownEnd), null);
19909
+ if (TRANSITION_JOURNAL !== null) journalBag();
19910
+ const binding = {
19911
+ [DIRECT_SIGNAL_CHILD]: true,
19912
+ scope: parentScope,
19913
+ slotKey,
19914
+ handle: value,
19915
+ text,
19916
+ state: parentScope.slots[slotKey],
19917
+ value: initial,
19918
+ disposed: false
19919
+ };
19920
+ binding.unsubscribe = value[SIGNAL_BINDING_SUBSCRIBE](
19921
+ nativeTransitionBindingNotify(binding, () => updateDirectSignalChild(binding))
19922
+ );
19923
+ registerHookCleanup(parentScope, () => disposeDirectSignalChild(binding));
19924
+ if (prior !== null) {
19925
+ const finish = (discarded) => disposeDirectSignalChild(discarded ? binding : prior);
19926
+ if (WIP_CAPTURE === null) finish(false);
19927
+ else (WIP_CAPTURE.renderCleanups ??= []).push(finish);
19928
+ }
19929
+ return binding;
19930
+ }
19931
+ function bindingChildSlot(parentScope, slotKey, domParent, value, marker, anchor, ownEnd) {
19932
+ const frame = PRESENTATION_HYDRATION;
19933
+ if (frame?.revision !== void 0) {
19934
+ const start = activeHydration()?.resolveOpen(anchor ?? null, domParent) ?? null;
19935
+ const range = presentationRange(frame, start, marker, "slot");
19936
+ if (value == null ? range.slot !== void 0 || getNextSibling(start) !== range.end : range.slot === void 0 || typeof value !== "function" || value[BINDING_CHILDREN_SITE] !== range.slot)
19937
+ presentationMiss(false);
19938
+ }
19939
+ childSlot(
19940
+ parentScope,
19941
+ slotKey,
19942
+ domParent,
19943
+ value,
19944
+ anchor,
19945
+ ownEnd,
19946
+ void 0,
19947
+ false,
19948
+ true,
19949
+ void 0,
19950
+ void 0,
19951
+ void 0,
19952
+ void 0,
19953
+ void 0,
19954
+ marker
19955
+ );
19956
+ }
19957
+ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable, includeKeyedSingle = true, compiledMapBody, compiledMapKey, compiledMapFlags, compiledMapDeps, mappedFallback, bindingMarker) {
17672
19958
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
19959
+ if (IMPLICIT_SIGNAL_CHILD_DEPTH === 0) {
19960
+ const existing = parentScope.slots[slotKey];
19961
+ const previous = existing?.implicitSignal;
19962
+ if (isSignalHandle(value) || previous !== void 0) {
19963
+ if (isSignalHandle(value)) enableSignalBindings();
19964
+ IMPLICIT_SIGNAL_CHILD_DEPTH++;
19965
+ let token;
19966
+ try {
19967
+ token = runWithBlockSignalOwner(
19968
+ parentScope,
19969
+ () => bindSignalChild(
19970
+ parentScope,
19971
+ previous,
19972
+ slotKey,
19973
+ domParent,
19974
+ value,
19975
+ `runtime:${slotKey}`,
19976
+ anchor,
19977
+ ownEnd,
19978
+ ownsHost,
19979
+ compactable,
19980
+ void 0,
19981
+ bindingMarker
19982
+ )
19983
+ );
19984
+ } finally {
19985
+ IMPLICIT_SIGNAL_CHILD_DEPTH--;
19986
+ }
19987
+ const state2 = parentScope.slots[slotKey];
19988
+ if (state2 !== void 0) state2.implicitSignal = token;
19989
+ return;
19990
+ }
19991
+ }
17673
19992
  if (value != null && includeKeyedSingle && domParent.nodeType === 1 && VOID_ELEMENTS.has(domParent.localName) && !isPortalTarget(parentScope.block, domParent)) {
17674
19993
  throw new Error(formatClientError(26, domParent.localName));
17675
19994
  }
@@ -17692,7 +20011,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17692
20011
  compiledMapKey,
17693
20012
  compiledMapFlags,
17694
20013
  compiledMapDeps,
17695
- mappedFallback
20014
+ mappedFallback,
20015
+ bindingMarker
17696
20016
  )
17697
20017
  );
17698
20018
  return;
@@ -17753,7 +20073,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17753
20073
  compiledMapKey,
17754
20074
  compiledMapFlags,
17755
20075
  compiledMapDeps,
17756
- mappedFallback
20076
+ mappedFallback,
20077
+ bindingMarker
17757
20078
  );
17758
20079
  return;
17759
20080
  }
@@ -17786,6 +20107,13 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17786
20107
  hydration.claimRootRemainder(getNextSibling(end));
17787
20108
  }
17788
20109
  hydration.node = getNextSibling(start);
20110
+ } else if (bindingMarker !== void 0) {
20111
+ start = (STAGED_DOM?.view(document) ?? document).createComment(bindingMarker);
20112
+ end = ownEnd && anchor != null ? anchor : (STAGED_DOM?.view(document) ?? document).createComment(HYDRATION_END);
20113
+ (STAGED_DOM?.view(end) ?? end).data = HYDRATION_END;
20114
+ (STAGED_DOM?.view(domParent) ?? domParent).insertBefore(start, anchor ?? null);
20115
+ if (end !== anchor)
20116
+ (STAGED_DOM?.view(domParent) ?? domParent).insertBefore(end, anchor ?? null);
17789
20117
  } else if (ownEnd && anchor != null) {
17790
20118
  start = null;
17791
20119
  end = anchor;
@@ -17815,7 +20143,8 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17815
20143
  currentIsBodyFn: false,
17816
20144
  forSlot: null,
17817
20145
  hostNode: null,
17818
- portal: null
20146
+ portal: null,
20147
+ implicitSignal: void 0
17819
20148
  };
17820
20149
  parentScope.slots[slotKey] = state;
17821
20150
  registerSlot(parentScope, state);
@@ -17917,6 +20246,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17917
20246
  let comp = null;
17918
20247
  let props = {};
17919
20248
  let isBodyFn = false;
20249
+ let invocationSite;
20250
+ let componentKey;
20251
+ let componentHasKey = false;
17920
20252
  if (isHostDescriptor(value)) {
17921
20253
  if (pureHost) {
17922
20254
  if (state.block !== null || state.text !== null) clearChildContent(state);
@@ -17986,6 +20318,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
17986
20318
  }
17987
20319
  comp = activity ? dispatch.body : value.type;
17988
20320
  props = value.props;
20321
+ invocationSite = value.__octaneInvocationSite;
20322
+ componentKey = value.key;
20323
+ componentHasKey = value.key != null;
17989
20324
  }
17990
20325
  if (comp !== null) {
17991
20326
  if (isBodyFn && state.block !== null && state.currentIsBodyFn) {
@@ -18015,6 +20350,15 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18015
20350
  renderBlock(state.block);
18016
20351
  return;
18017
20352
  }
20353
+ const signalInstanceKey = SIGNAL_BINDINGS_ENABLED || signalDocumentEnabled ? { parentScope, invocationSite, key: componentKey, hasKey: componentHasKey } : void 0;
20354
+ const retryLocation = state.block === null && state.hostNode === null && state.text === null || parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
20355
+ parent: parentScope,
20356
+ slot: slotKey,
20357
+ kind: state.__kind,
20358
+ branch: void 0,
20359
+ component: isBodyFn ? void 0 : comp,
20360
+ key: void 0
20361
+ };
18018
20362
  const swapDriver = TRANSITION_SWAP_DRIVER;
18019
20363
  const transitionMode = parentBlock.currentRenderMode === "transition";
18020
20364
  const committedSuspense = swapDriver !== null && state.block !== null && state.block.mounted && hydration === null && preservesCommittedSuspense(parentBlock);
@@ -18032,7 +20376,12 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18032
20376
  state.end,
18033
20377
  comp,
18034
20378
  props,
18035
- renderReturnedValue
20379
+ renderReturnedValue,
20380
+ "dynamic",
20381
+ void 0,
20382
+ false,
20383
+ signalInstanceKey,
20384
+ retryLocation
18036
20385
  )
18037
20386
  ) : transitionSwap.render(
18038
20387
  parentBlock,
@@ -18040,7 +20389,12 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18040
20389
  state.end,
18041
20390
  comp,
18042
20391
  props,
18043
- renderReturnedValue
20392
+ renderReturnedValue,
20393
+ "dynamic",
20394
+ void 0,
20395
+ false,
20396
+ signalInstanceKey,
20397
+ retryLocation
18044
20398
  );
18045
20399
  if (r.suspended || r.failed) {
18046
20400
  transitionSwap.dispose(r.wip);
@@ -18077,6 +20431,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18077
20431
  void 0,
18078
20432
  renderReturnedValue
18079
20433
  );
20434
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b2, signalInstanceKey);
18080
20435
  preserveRootCreatedDom(b2);
18081
20436
  if (state.borrowed) b2.exclusiveMarkers = true;
18082
20437
  b2.$$implicitBail = true;
@@ -18108,7 +20463,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18108
20463
  renderReturnedValue,
18109
20464
  "dynamic",
18110
20465
  void 0,
18111
- implicitBail
20466
+ implicitBail,
20467
+ signalInstanceKey,
20468
+ retryLocation
18112
20469
  )
18113
20470
  ) : renderOffscreen(
18114
20471
  parentBlock,
@@ -18119,7 +20476,9 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18119
20476
  renderReturnedValue,
18120
20477
  "dynamic",
18121
20478
  void 0,
18122
- implicitBail
20479
+ implicitBail,
20480
+ signalInstanceKey,
20481
+ retryLocation
18123
20482
  );
18124
20483
  if (r.suspended || r.failed) {
18125
20484
  disposeWip(r.wip);
@@ -18168,6 +20527,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
18168
20527
  void 0,
18169
20528
  renderReturnedValue
18170
20529
  );
20530
+ if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
18171
20531
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && comp !== hostElementBody)
18172
20532
  __profileTrackComponent(b, !isBodyFn || __profileHasComponentMetadata(comp) ? comp : null);
18173
20533
  if (state.borrowed) b.exclusiveMarkers = true;
@@ -18896,6 +21256,7 @@ function releaseHiddenText(text, restore = true) {
18896
21256
  }
18897
21257
  }
18898
21258
  function teardownTrySlot(state, detachDom) {
21259
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
18899
21260
  initialSuspenseHydrations?.delete(state);
18900
21261
  cancelSuspenseRetry(state);
18901
21262
  HIDDEN_REVEAL_ACTIONS?.delete(state);
@@ -18966,7 +21327,7 @@ function clearPassthroughTry(state) {
18966
21327
  state.tryBlock = null;
18967
21328
  }
18968
21329
  function mountPassthroughCatch(state, error, reportInline = false) {
18969
- if (error instanceof NativeAdoptionMiss) throw error;
21330
+ if (isAdoptionControl(error)) throw error;
18970
21331
  clearPassthroughTry(state);
18971
21332
  state.pendingThenable = null;
18972
21333
  setTryBranch(state, 0);
@@ -19142,7 +21503,7 @@ function errorBlock(parentScope, slotKey, domParent, tryBody, catchBody, anchor,
19142
21503
  try {
19143
21504
  renderBlock(current);
19144
21505
  } catch (error) {
19145
- if (isHostContextRequest(error) || isSuspenseException(error) || error instanceof NativeAdoptionMiss)
21506
+ if (isHostContextRequest(error) || isSuspenseException(error) || isAdoptionControl(error))
19146
21507
  throw error;
19147
21508
  switchErrorToCatch(state, error, true);
19148
21509
  }
@@ -19203,7 +21564,7 @@ function errorBlock(parentScope, slotKey, domParent, tryBody, catchBody, anchor,
19203
21564
  renderBlock(body);
19204
21565
  state.hasResolved = true;
19205
21566
  } catch (error) {
19206
- if (isHostContextRequest(error) || isSuspenseException(error) || error instanceof NativeAdoptionMiss)
21567
+ if (isHostContextRequest(error) || isSuspenseException(error) || isAdoptionControl(error))
19207
21568
  throw error;
19208
21569
  const adoptServerCatch = hydration?.isRejection(error) === true;
19209
21570
  switchErrorToCatch(
@@ -19220,7 +21581,7 @@ function errorBlock(parentScope, slotKey, domParent, tryBody, catchBody, anchor,
19220
21581
  return state.reset;
19221
21582
  }
19222
21583
  function switchErrorToCatch(state, error, reportInline = false, adoptedStart, adoptedEnd) {
19223
- if (error instanceof NativeAdoptionMiss) throw error;
21584
+ if (isAdoptionControl(error)) throw error;
19224
21585
  const frame = beginDetachedBoundaryRender(state);
19225
21586
  try {
19226
21587
  switchErrorToCatchInner(state, error, reportInline, adoptedStart, adoptedEnd);
@@ -19361,6 +21722,8 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
19361
21722
  registerSlot(parentScope, newState);
19362
21723
  state = newState;
19363
21724
  } else {
21725
+ if (state.retrySignalOwners !== void 0 && (state.tryBody !== tryBody || state.env !== env && depsChanged(state.env, env)))
21726
+ clearSignalRetryOwners(state);
19364
21727
  state.tryBody = tryBody;
19365
21728
  state.catchBody = catchBody;
19366
21729
  state.pendingBody = pendingBody;
@@ -19432,8 +21795,7 @@ function renderVisibleTry(state, source) {
19432
21795
  if (effectDeps !== null) restoreSubtreeEffectDeps(block, effectDeps);
19433
21796
  discardOffscreenCapture(capture);
19434
21797
  }
19435
- if (isHostContextRequest(renderError) || renderError instanceof NativeAdoptionMiss)
19436
- throw renderError;
21798
+ if (isHostContextRequest(renderError) || isAdoptionControl(renderError)) throw renderError;
19437
21799
  if (isSuspenseException(renderError)) {
19438
21800
  if (state.propagateSuspense) throw renderError;
19439
21801
  handleSuspense(state, renderError.thenable, block, journalCheckpoint, source ?? block);
@@ -19475,6 +21837,7 @@ function createTryBody(state, start, end) {
19475
21837
  return block;
19476
21838
  }
19477
21839
  function restartUncommittedTry(state) {
21840
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
19478
21841
  HIDDEN_REVEAL_ACTIONS?.delete(state);
19479
21842
  const old = state.tryBlock;
19480
21843
  const refs = [];
@@ -19595,6 +21958,8 @@ function renderInitialSuspenseHydration(state, initial) {
19595
21958
  hydration.claimRootRemainder(initial.end);
19596
21959
  hydration.protectRootAnchor(initial.end);
19597
21960
  const previousHydration = currentHydration;
21961
+ if (previousHydration?.retryPresentation !== void 0)
21962
+ hydration.retryPresentation = previousHydration.retryPresentation;
19598
21963
  const previousCapture = WIP_CAPTURE;
19599
21964
  const capture = createOffscreenCapture();
19600
21965
  currentHydration = hydration;
@@ -19622,7 +21987,19 @@ function renderInitialSuspenseHydration(state, initial) {
19622
21987
  if (isSuspenseException(error)) suspended = error.thenable;
19623
21988
  const refs = [];
19624
21989
  collectVisibleSubtreeRefs(block, refs);
19625
- withRefDetachSuppression(refs, () => unmountBlock(block, false));
21990
+ const previousRetained = RETAINED_SIGNAL_OWNERS;
21991
+ if (suspended !== null && state.parentBlock.idState.renderOwner?.signalOwner !== void 0) {
21992
+ retainSignalRetryScope(block, block, state, true);
21993
+ for (const created of ROOT_RENDER_TRANSACTION?.created ?? [])
21994
+ if (!created.disposed && blockIsAncestorOf(block, created))
21995
+ retainSignalRetryScope(created, block, state);
21996
+ RETAINED_SIGNAL_OWNERS = state.retrySignalOwners;
21997
+ } else if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
21998
+ try {
21999
+ withRefDetachSuppression(refs, () => unmountBlock(block, false));
22000
+ } finally {
22001
+ RETAINED_SIGNAL_OWNERS = previousRetained;
22002
+ }
19626
22003
  state.block = null;
19627
22004
  state.tryBlock = null;
19628
22005
  discardOffscreenCapture(capture);
@@ -19633,6 +22010,7 @@ function renderInitialSuspenseHydration(state, initial) {
19633
22010
  if (previousHydration !== null) previousHydration.node = state.end;
19634
22011
  }
19635
22012
  if (!failed) {
22013
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
19636
22014
  initialSuspenseHydrations?.delete(state);
19637
22015
  (capture.renderCleanups ??= []).push((discarded) => {
19638
22016
  if (discarded) return;
@@ -19652,7 +22030,7 @@ function renderInitialSuspenseHydration(state, initial) {
19652
22030
  return;
19653
22031
  }
19654
22032
  initialSuspenseHydrations?.delete(state);
19655
- if (failure instanceof NativeAdoptionMiss || isHostContextRequest(failure)) throw failure;
22033
+ if (isAdoptionControl(failure) || isHostContextRequest(failure)) throw failure;
19656
22034
  const adoptServerCatch = hydration.isRejection(failure);
19657
22035
  if (!adoptServerCatch) removeRange(getNextSibling(initial.start), initial.end);
19658
22036
  const outerHydration = currentHydration;
@@ -19676,6 +22054,7 @@ function renderInitialSuspenseHydration(state, initial) {
19676
22054
  }
19677
22055
  }
19678
22056
  function mountTry(state) {
22057
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
19679
22058
  cancelSuspenseRetry(state);
19680
22059
  HIDDEN_REVEAL_ACTIONS?.delete(state);
19681
22060
  const wasPending = state.branch === 2;
@@ -19794,7 +22173,7 @@ function mountTry(state) {
19794
22173
  state.hasResolved = true;
19795
22174
  if (wasPending) recordSuspenseCommit(state);
19796
22175
  } catch (err) {
19797
- if (isHostContextRequest(err) || err instanceof NativeAdoptionMiss) throw err;
22176
+ if (isHostContextRequest(err) || isAdoptionControl(err)) throw err;
19798
22177
  if (isSuspenseException(err)) {
19799
22178
  if (state.propagateSuspense) throw err;
19800
22179
  handleSuspense(state, err.thenable, b);
@@ -19911,6 +22290,10 @@ function releaseHeldTransition(state) {
19911
22290
  }
19912
22291
  }
19913
22292
  function handleSuspense(state, thenable, sourceBlock, journalCheckpoint = -1, transitionOrigin = sourceBlock) {
22293
+ if (NATIVE_TRANSITION_ATTEMPT !== null) {
22294
+ NATIVE_TRANSITION_ATTEMPT.suspensions.set(state, thenable);
22295
+ throw new SuspenseException(thenable);
22296
+ }
19914
22297
  ensureScheduledVisibilityDriver();
19915
22298
  const isTransition = sourceBlock.currentRenderMode === "transition";
19916
22299
  if (isTransition && state.hasResolved && state.branch === 1 && state.hiddenDom === null) {
@@ -20432,6 +22815,10 @@ function attemptHiddenReveal(state, scheduledMode, reason = "update") {
20432
22815
  }
20433
22816
  }
20434
22817
  function attemptHiddenRevealInner(state, scheduledMode, reason = "update") {
22818
+ if (state.nativeTransition !== void 0 && NATIVE_TRANSITION_ATTEMPT === null) {
22819
+ queueNativeTransition(state.nativeTransition);
22820
+ return;
22821
+ }
20435
22822
  const retryOnly = reason === "retry";
20436
22823
  let tryBlock2 = state.tryBlock;
20437
22824
  if (tryBlock2 === null || tryBlock2.disposed || state.hiddenDom === null) return;
@@ -20493,6 +22880,7 @@ function attemptHiddenRevealInner(state, scheduledMode, reason = "update") {
20493
22880
  if (didThrow) {
20494
22881
  restoreSubtreeEffectDeps(tryBlock2, effectDeps);
20495
22882
  discardOffscreenCapture(hiddenCapture);
22883
+ if (NATIVE_TRANSITION_ATTEMPT !== null) throw thrown;
20496
22884
  if (isSuspenseException(thrown)) {
20497
22885
  deactivateScope(tryBlock2, false);
20498
22886
  hideTryBlock(state);
@@ -20704,6 +23092,7 @@ function startTransition(fn) {
20704
23092
  }
20705
23093
  function runTransition(fn, hook) {
20706
23094
  ensureTransitionSwapDriver();
23095
+ ensureNativeActionResolver();
20707
23096
  TRANSITION_DEPTH++;
20708
23097
  const parentActionBatch = ACTIVE_TRANSITION_ACTION_BATCH;
20709
23098
  const pendingActionBatch = IN_FLIGHT_TRANSITION_ACTION_BATCH;
@@ -20720,7 +23109,18 @@ function runTransition(fn, hook) {
20720
23109
  try {
20721
23110
  tickTransitionCount(1);
20722
23111
  try {
20723
- result = fn();
23112
+ const previousCandidate = activeCandidate;
23113
+ const nativeResolver = setNativeCandidateResolver(() => {
23114
+ const candidate = nativeCandidateForAction(actionBatch);
23115
+ swapActiveSignalCandidate(candidate);
23116
+ return candidate;
23117
+ });
23118
+ try {
23119
+ result = fn();
23120
+ } finally {
23121
+ swapActiveSignalCandidate(previousCandidate);
23122
+ setNativeCandidateResolver(nativeResolver);
23123
+ }
20724
23124
  if (result != null && typeof result.then === "function") {
20725
23125
  actionBatch.pendingActions++;
20726
23126
  IN_FLIGHT_TRANSITION_ACTION_BATCH = actionBatch;
@@ -21114,7 +23514,7 @@ function forwardFallbackSuspension(fallbackBlock, error) {
21114
23514
  return true;
21115
23515
  }
21116
23516
  function switchToCatch(state, err, reportInline = false, adoptedStart, adoptedEnd) {
21117
- if (err instanceof NativeAdoptionMiss) throw err;
23517
+ if (isAdoptionControl(err)) throw err;
21118
23518
  const frame = beginDetachedBoundaryRender(state);
21119
23519
  try {
21120
23520
  switchToCatchInner(state, err, reportInline, adoptedStart, adoptedEnd);
@@ -21126,6 +23526,7 @@ function switchToCatch(state, err, reportInline = false, adoptedStart, adoptedEn
21126
23526
  }
21127
23527
  }
21128
23528
  function switchToCatchInner(state, err, reportInline, adoptedStart, adoptedEnd) {
23529
+ if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
21129
23530
  cancelSuspenseRetry(state);
21130
23531
  HIDDEN_REVEAL_ACTIONS?.delete(state);
21131
23532
  const hydration = activeHydration();
@@ -21250,7 +23651,7 @@ function findTryHandler(block) {
21250
23651
  return rendererRegionTryHandler(origin);
21251
23652
  }
21252
23653
  function handleRenderError(block, err, attempt = null) {
21253
- if (err instanceof NativeAdoptionMiss) throw err;
23654
+ if (isAdoptionControl(err)) throw err;
21254
23655
  if (isHostContextRequest(err)) {
21255
23656
  const bridge = rendererRegionOwnerForBlock(block);
21256
23657
  if (bridge !== null && bridge.routeSuspense(err.thenable)) return;
@@ -21440,7 +23841,17 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21440
23841
  void 0,
21441
23842
  null,
21442
23843
  "control-flow",
21443
- env
23844
+ env,
23845
+ false,
23846
+ void 0,
23847
+ parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
23848
+ parent: parentScope,
23849
+ slot: slotKey,
23850
+ kind: state.__kind,
23851
+ branch: next,
23852
+ component: void 0,
23853
+ key: void 0
23854
+ }
21444
23855
  );
21445
23856
  if (r.suspended || r.failed) {
21446
23857
  disposeWip(r.wip);
@@ -21477,7 +23888,17 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21477
23888
  void 0,
21478
23889
  null,
21479
23890
  "control-flow",
21480
- env
23891
+ env,
23892
+ false,
23893
+ void 0,
23894
+ parentBlock.idState.renderOwner?.signalOwner === void 0 ? void 0 : {
23895
+ parent: parentScope,
23896
+ slot: slotKey,
23897
+ kind: state.__kind,
23898
+ branch: next,
23899
+ component: void 0,
23900
+ key: void 0
23901
+ }
21481
23902
  );
21482
23903
  if (r.suspended || r.failed) {
21483
23904
  transitionSwap.dispose(r.wip);
@@ -21547,6 +23968,8 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21547
23968
  inner = getNextSibling(state.start);
21548
23969
  innerEnd = hydration.close(inner);
21549
23970
  if (innerEnd !== state.end && getNextSibling(innerEnd) !== state.end) {
23971
+ if (PRESENTATION_HYDRATION?.revision !== void 0)
23972
+ throw new Error(formatClientError(75));
21550
23973
  if (process.env.NODE_ENV !== "production") {
21551
23974
  const mmLoc = siteLoc(parentScope, slotKey);
21552
23975
  if (mmLoc)
@@ -21590,6 +24013,7 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
21590
24013
  renderBlock(b);
21591
24014
  }
21592
24015
  } else if (hydration !== null && getNextSibling(state.start) !== state.end) {
24016
+ if (PRESENTATION_HYDRATION?.revision !== void 0) throw new Error(formatClientError(75));
21593
24017
  if (process.env.NODE_ENV !== "production") {
21594
24018
  const mmLoc = siteLoc(parentScope, slotKey);
21595
24019
  if (mmLoc)
@@ -22163,7 +24587,8 @@ function detachSubtreeRefs(scope, out, shouldDetach = true, includeHiddenTry = t
22163
24587
  } else if (kind === "s") {
22164
24588
  const el = bag[rm[j + 2]];
22165
24589
  if (el == null) continue;
22166
- const ref = bag[rm[j + 1]]?.ref ?? activityRefs?.get(el)?.connected;
24590
+ const spread = bag[rm[j + 1]];
24591
+ const ref = (spread?.[SIGNAL_HOST_PROP_SOURCES] === true ? spread.resolved : spread)?.ref ?? activityRefs?.get(el)?.connected;
22167
24592
  if (ref == null) continue;
22168
24593
  out.push({ ref, el, scope });
22169
24594
  if (shouldDetach && !refAttachWasDiscarded(uncommitted, el, ref)) {
@@ -22245,7 +24670,7 @@ function deactivateScope(scope, disconnectPassive = true) {
22245
24670
  const cleanup = e.cleanup;
22246
24671
  e.cleanup = void 0;
22247
24672
  try {
22248
- if (!staged) runEffectCleanupCallback(cleanup, e.phase);
24673
+ if (!staged) runEffectCleanupCallback(cleanup, e.phase, scope);
22249
24674
  } catch (err) {
22250
24675
  if (err instanceof MaximumUpdateDepthError) throw err;
22251
24676
  const handler = findTryHandler(scope.block);
@@ -22544,6 +24969,7 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
22544
24969
  );
22545
24970
  current = block;
22546
24971
  block.forSlot = state;
24972
+ block.key = key;
22547
24973
  block.itemIndex = index;
22548
24974
  block.currentRenderMode = renderMode;
22549
24975
  block.currentRenderDeferred = deferred;
@@ -22558,7 +24984,6 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
22558
24984
  block.startMarker = root;
22559
24985
  block.endMarker = root;
22560
24986
  state.items.set(key, block);
22561
- block.key = key;
22562
24987
  block.prevSibling = previous;
22563
24988
  if (previous !== null) previous.nextSibling = block;
22564
24989
  else state.head = block;
@@ -22816,6 +25241,7 @@ function checkedListKey(keySource, normalizeKey) {
22816
25241
  }
22817
25242
  function mountItemsLinear(parentBlock, state, items, keySource, itemBody, singleRoot, ssrMarkerless, normalizeKey = false) {
22818
25243
  const newLen = items.length;
25244
+ const observeKey = parentBlock.idState.renderOwner?.signalOwner !== void 0 ? trackSignalRetryListKeys(parentBlock, state, newLen, keySource) : void 0;
22819
25245
  if (newLen === 0) return;
22820
25246
  if (process.env.NODE_ENV !== "production") {
22821
25247
  keySource = checkedListKey(keySource, normalizeKey);
@@ -22839,6 +25265,7 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
22839
25265
  for (let i = 0; i < newLen; i++) {
22840
25266
  const item = items[i];
22841
25267
  const key = readListKey(keySource, item, i, normalizeKey);
25268
+ if (observeKey !== void 0) observeKey(i, key);
22842
25269
  let adoptNode = null;
22843
25270
  let anchor = state.end;
22844
25271
  if (adoptByKey !== null) {
@@ -22862,6 +25289,7 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
22862
25289
  anchor,
22863
25290
  item,
22864
25291
  i,
25292
+ key,
22865
25293
  itemBody,
22866
25294
  state,
22867
25295
  singleRoot,
@@ -22869,7 +25297,6 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
22869
25297
  adoptNode
22870
25298
  );
22871
25299
  oldItems.set(key, block);
22872
- block.key = key;
22873
25300
  block.prevSibling = prev;
22874
25301
  block.nextSibling = null;
22875
25302
  if (prev) prev.nextSibling = block;
@@ -22884,7 +25311,9 @@ function mountItemsLinear(parentBlock, state, items, keySource, itemBody, single
22884
25311
  prev = block.prevSibling;
22885
25312
  oldItems.delete(block.key);
22886
25313
  if (isSuspenseException(error)) retainDiscardedWarmMemos(block);
22887
- unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
25314
+ if (block.idState.renderOwner?.signalOwner !== void 0)
25315
+ discardSignalRetryItem(block, error);
25316
+ else unmountBlock(block, !ROOT_RENDER_TRANSACTION?.retainedCreated?.has(block));
22888
25317
  }
22889
25318
  state.head = null;
22890
25319
  state.tail = null;
@@ -22919,6 +25348,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
22919
25348
  );
22920
25349
  return;
22921
25350
  }
25351
+ const observeKey = parentBlock.idState.renderOwner?.signalOwner !== void 0 ? trackSignalRetryListKeys(parentBlock, state, newLen, keySource) : void 0;
22922
25352
  if (process.env.NODE_ENV !== "production") {
22923
25353
  keySource = checkedListKey(keySource, normalizeKey);
22924
25354
  normalizeKey = false;
@@ -22940,6 +25370,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
22940
25370
  const newItem = items[prefixLen];
22941
25371
  const newKey = readListKey(keySource, newItem, prefixLen, normalizeKey);
22942
25372
  if (oldFirst.key !== newKey) break;
25373
+ if (observeKey !== void 0) observeKey(prefixLen, newKey);
22943
25374
  const block = oldFirst;
22944
25375
  if (!pure || block.props !== newItem || block.body !== itemBody || block.itemIndex !== prefixLen)
22945
25376
  updateSurvivor(block, newItem, prefixLen, itemBody, pure, lite, indexIndependent, state.env);
@@ -22954,6 +25385,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
22954
25385
  const newItem = items[newEnd];
22955
25386
  const newKey = readListKey(keySource, newItem, newEnd, normalizeKey);
22956
25387
  if (oldLast.key !== newKey) break;
25388
+ if (observeKey !== void 0) observeKey(newEnd, newKey);
22957
25389
  const block = oldLast;
22958
25390
  if (!pure || block.props !== newItem || block.body !== itemBody || block.itemIndex !== newEnd)
22959
25391
  updateSurvivor(block, newItem, newEnd, itemBody, pure, lite, indexIndependent, state.env);
@@ -22977,19 +25409,20 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
22977
25409
  for (let i = prefixLen; i <= newEnd; i++) {
22978
25410
  const item = items[i];
22979
25411
  const key = readListKey(keySource, item, i, normalizeKey);
25412
+ if (observeKey !== void 0) observeKey(i, key);
22980
25413
  const block = mountItem(
22981
25414
  parentBlock,
22982
25415
  parentNode,
22983
25416
  anchor,
22984
25417
  item,
22985
25418
  i,
25419
+ key,
22986
25420
  itemBody,
22987
25421
  state,
22988
25422
  singleRoot,
22989
25423
  ssrMarkerless
22990
25424
  );
22991
25425
  oldItems.set(key, block);
22992
- block.key = key;
22993
25426
  block.prevSibling = prev;
22994
25427
  block.nextSibling = afterMiddle;
22995
25428
  if (prev) prev.nextSibling = block;
@@ -23027,6 +25460,7 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23027
25460
  const key = readListKey(keySource, items[prefixLen + i], prefixLen + i, normalizeKey);
23028
25461
  newKeys[i] = key;
23029
25462
  newKeysToIdx.set(key, i);
25463
+ if (observeKey !== void 0) observeKey(prefixLen + i, key);
23030
25464
  }
23031
25465
  if (beforeMiddle === null && afterMiddle === null && !newKeysToIdx.has(oldFirst.key)) {
23032
25466
  let anySurvivors = false;
@@ -23054,13 +25488,13 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23054
25488
  state.end,
23055
25489
  item,
23056
25490
  i,
25491
+ key,
23057
25492
  itemBody,
23058
25493
  state,
23059
25494
  singleRoot,
23060
25495
  ssrMarkerless
23061
25496
  );
23062
25497
  oldItems.set(key, block);
23063
- block.key = key;
23064
25498
  block.prevSibling = prev;
23065
25499
  block.nextSibling = null;
23066
25500
  if (prev) prev.nextSibling = block;
@@ -23221,13 +25655,13 @@ function reconcileKeyed(parentBlock, state, items, keySource, itemBody, pure, si
23221
25655
  anchor,
23222
25656
  items[targetIdx],
23223
25657
  targetIdx,
25658
+ key,
23224
25659
  itemBody,
23225
25660
  state,
23226
25661
  singleRoot,
23227
25662
  ssrMarkerless
23228
25663
  );
23229
25664
  oldItems.set(key, block);
23230
- block.key = key;
23231
25665
  state.size++;
23232
25666
  } else block = oldItems.get(key);
23233
25667
  block.prevSibling = previous;
@@ -23349,7 +25783,7 @@ function batchClearItems(state, oldItems, ownedRootClear = false) {
23349
25783
  }
23350
25784
  oldItems.clear();
23351
25785
  }
23352
- function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot, singleRoot, ssrMarkerless, adoptNode = null) {
25786
+ function mountItem(parentBlock, parentNode, anchor, item, index, key, body, forSlot, singleRoot, ssrMarkerless, adoptNode = null) {
23353
25787
  const hydration = activeHydration();
23354
25788
  if (hydration !== null) {
23355
25789
  if (ssrMarkerless && !hydration.isOpen(hydration.node) && (singleRoot !== 2 || forSlot.plainDeopt !== true || isHostDescriptor(item) && !descNeedsBlocks(item))) {
@@ -23366,6 +25800,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23366
25800
  forSlot.env
23367
25801
  );
23368
25802
  block3.forSlot = forSlot;
25803
+ block3.key = key;
23369
25804
  block3.itemIndex = index;
23370
25805
  if (singleRoot === 2 && forSlot.plainDeopt === true) block3.deoptNode = root;
23371
25806
  renderBlock(block3);
@@ -23384,6 +25819,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23384
25819
  anchor,
23385
25820
  item,
23386
25821
  index,
25822
+ key,
23387
25823
  body,
23388
25824
  forSlot,
23389
25825
  singleRoot,
@@ -23404,6 +25840,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23404
25840
  anchor,
23405
25841
  item,
23406
25842
  index,
25843
+ key,
23407
25844
  body,
23408
25845
  forSlot,
23409
25846
  singleRoot,
@@ -23425,6 +25862,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23425
25862
  forSlot.env
23426
25863
  );
23427
25864
  block2.forSlot = forSlot;
25865
+ block2.key = key;
23428
25866
  block2.itemIndex = index;
23429
25867
  renderBlock(block2);
23430
25868
  hydration.node = getNextSibling(itemEnd);
@@ -23443,6 +25881,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23443
25881
  forSlot.env
23444
25882
  );
23445
25883
  block3.forSlot = forSlot;
25884
+ block3.key = key;
23446
25885
  block3.itemIndex = index;
23447
25886
  block3.deoptNode = adoptNode;
23448
25887
  preserveRootCreatedDom(block3);
@@ -23460,6 +25899,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23460
25899
  forSlot.env
23461
25900
  );
23462
25901
  block2.forSlot = forSlot;
25902
+ block2.key = key;
23463
25903
  block2.itemIndex = index;
23464
25904
  renderBlock(block2);
23465
25905
  const root = (STAGED_DOM?.view(anchor) ?? anchor).previousSibling;
@@ -23487,6 +25927,7 @@ function mountItem(parentBlock, parentNode, anchor, item, index, body, forSlot,
23487
25927
  forSlot.env
23488
25928
  );
23489
25929
  block.forSlot = forSlot;
25930
+ block.key = key;
23490
25931
  block.itemIndex = index;
23491
25932
  if (adoptNode !== null) {
23492
25933
  block.deoptNode = adoptNode;
@@ -23540,8 +25981,29 @@ function moveFocusedNodeBefore(parent, node, anchor, snapshots) {
23540
25981
  } else if (snapshots.focused.ownerDocument === node.ownerDocument) {
23541
25982
  snapshot = snapshots;
23542
25983
  }
25984
+ if (STAGED_DOM === null) {
25985
+ moveNativeNodeBefore(
25986
+ parent,
25987
+ node,
25988
+ anchor,
25989
+ snapshot?.focused ?? null,
25990
+ snapshot?.contentEditable ?? false
25991
+ );
25992
+ return;
25993
+ }
23543
25994
  const focused = snapshot?.focused ?? null;
23544
- if (focused === null || node !== focused && (node.nodeType !== 1 || !(STAGED_DOM?.view(node) ?? node).contains(focused))) {
25995
+ let containsFocused = node === focused;
25996
+ if (!containsFocused && focused !== null && node.nodeType === 1) {
25997
+ let candidate = focused;
25998
+ do {
25999
+ if (STAGED_DOM.view(node).contains(candidate)) {
26000
+ containsFocused = true;
26001
+ break;
26002
+ }
26003
+ candidate = STAGED_DOM.view(candidate).getRootNode().host;
26004
+ } while (candidate !== void 0);
26005
+ }
26006
+ if (!containsFocused) {
23545
26007
  (STAGED_DOM?.view(parent) ?? parent).insertBefore(node, anchor);
23546
26008
  return;
23547
26009
  }
@@ -23631,6 +26093,7 @@ function coalesceHydratedRanges(rootBlock, liteRanges) {
23631
26093
  }
23632
26094
  function makeGroup(startNode, endNode, block, liteScope, owner) {
23633
26095
  if (!isBlockOpen(startNode) || !isBlockClose(endNode) || startNode === endNode) return null;
26096
+ if (isBindingOpenComment((STAGED_DOM?.view(startNode) ?? startNode).data)) return null;
23634
26097
  if ((STAGED_DOM?.view(startNode) ?? startNode).parentNode === null || (STAGED_DOM?.view(startNode) ?? startNode).parentNode !== (STAGED_DOM?.view(endNode) ?? endNode).parentNode)
23635
26098
  return null;
23636
26099
  const openDepth = hydrationMarkerMultiplicity(
@@ -24171,7 +26634,7 @@ function validateRootHtmlNesting(container, body) {
24171
26634
  }
24172
26635
  }
24173
26636
  }
24174
- function makeRoot(container, rootBlock, currentBody, currentKey, idState, outputHandler, ownerToken, errorOptions) {
26637
+ function makeRoot(container, rootBlock, currentBody, currentKey, idState, outputHandler, ownerToken, signalOwner, errorOptions) {
24175
26638
  let root;
24176
26639
  let unmounted = false;
24177
26640
  let nestedRootRenderChain = -1;
@@ -24190,6 +26653,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24190
26653
  };
24191
26654
  const renderOwner = {
24192
26655
  current: rootBlock,
26656
+ signalOwner,
24193
26657
  retry: noop,
24194
26658
  request: null,
24195
26659
  generation: 0,
@@ -24389,6 +26853,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24389
26853
  else VIEW_TRANSITION_DRIVER?.refreshPendingOwner(renderOwner);
24390
26854
  }
24391
26855
  renderOwner.nativeRetry?.clear();
26856
+ if (renderOwner.retrySignalOwners !== void 0) clearSignalRetryOwners(renderOwner);
24392
26857
  renderOwner.retryKey = null;
24393
26858
  renderOwner.request = null;
24394
26859
  if (renderOwner.transaction?.aborted === true) renderOwner.transaction = null;
@@ -24398,6 +26863,15 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24398
26863
  unmount() {
24399
26864
  if (arguments.length > 0) warnRootUnmountArgument();
24400
26865
  if (unmounted) return;
26866
+ let presentationRefs = null;
26867
+ if (renderOwner.bindingLeases !== void 0)
26868
+ for (const lease of renderOwner.bindingLeases) {
26869
+ const frame = PRESENTATION_PREPARATIONS.get(lease);
26870
+ if (frame?.revision !== void 0) {
26871
+ collectVisibleSubtreeRefs(frame.scope, presentationRefs ??= []);
26872
+ }
26873
+ }
26874
+ if (presentationRefs !== null) renderOwner.generation++;
24401
26875
  if (!inFlush && CURRENT_BLOCK === null && !inNestedUpdateCallback() && EFFECT_EVENT_LIFECYCLE_DEPTH === 0) {
24402
26876
  VIEW_TRANSITION_DRIVER?.interrupt();
24403
26877
  if (unmounted) return;
@@ -24405,12 +26879,25 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24405
26879
  if (!inFlush && CURRENT_BLOCK === null && !inNestedUpdateCallback() && EFFECT_EVENT_LIFECYCLE_DEPTH === 0) {
24406
26880
  UPDATE_CHAIN_ID++;
24407
26881
  }
24408
- if (process.env.NODE_ENV !== "production" && (inFlush || CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || EFFECT_EVENT_LIFECYCLE_DEPTH > 0)) {
26882
+ if (process.env.NODE_ENV !== "production" && !renderOwner.preservePresentation && (inFlush || CURRENT_BLOCK !== null || EFFECT_BODY_DEPTH > 0 || EFFECT_EVENT_LIFECYCLE_DEPTH > 0)) {
24409
26883
  warnRootLifecycleUnmount();
24410
26884
  }
24411
26885
  unmounted = true;
24412
26886
  renderOwner.disposed = true;
26887
+ if (renderOwner.bindingLeases !== void 0) {
26888
+ for (const lease of renderOwner.bindingLeases) {
26889
+ releaseBindingHandoff(lease);
26890
+ PRESENTATION_PREPARATIONS.delete(lease);
26891
+ try {
26892
+ if (!renderOwner.preservePresentation) lease.retire();
26893
+ } catch (error) {
26894
+ if (!reportUncaughtError(rootBlock, error)) console.error(error);
26895
+ }
26896
+ }
26897
+ renderOwner.bindingLeases.clear();
26898
+ }
24413
26899
  renderOwner.nativeRetry?.clear();
26900
+ if (renderOwner.retrySignalOwners !== void 0) clearSignalRetryOwners(renderOwner);
24414
26901
  renderOwner.retry = noop;
24415
26902
  if (renderOwner.transition !== void 0) TRANSITION_SWAP_DRIVER.discardRoot(renderOwner);
24416
26903
  renderOwner.generation++;
@@ -24424,13 +26911,9 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24424
26911
  __devtoolsUnregisterRoot(
24425
26912
  rootBlock
24426
26913
  );
24427
- unmountBlock(
24428
- rootBlock,
24429
- /*detachDom*/
24430
- false
24431
- );
26914
+ withRefDetachSuppression(presentationRefs, () => unmountBlock(rootBlock, false));
24432
26915
  drainRefDetaches();
24433
- clearRootContainer(container);
26916
+ if (!renderOwner.preservePresentation) clearRootContainer(container);
24434
26917
  drainDeferredPassiveUnmounts();
24435
26918
  rootBlock = null;
24436
26919
  currentBody = null;
@@ -24461,20 +26944,24 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
24461
26944
  }
24462
26945
  function createRootWithOutputHandler(container, options, outputHandler) {
24463
26946
  assertValidRootContainer(container);
26947
+ if (options?.bindingLeases !== void 0) throw new Error(formatClientError(76));
24464
26948
  options = warnCreateRootElementOption(options);
24465
26949
  const ownerToken = claimRootContainer(container);
24466
26950
  registerDelegationTarget(container, true);
26951
+ const rootPrefix = (options?.identifierPrefix ?? "") + "r" + (nextClientRootId++).toString(36) + "-";
24467
26952
  return makeRoot(
24468
26953
  container,
24469
26954
  null,
24470
26955
  null,
24471
26956
  null,
24472
26957
  {
24473
- prefix: (options?.identifierPrefix ?? "") + "r" + (nextClientRootId++).toString(36) + "-",
24474
- next: 0
26958
+ prefix: rootPrefix,
26959
+ next: 0,
26960
+ signalState: { prefix: options?.signalInstancePrefix ?? rootPrefix, next: 0 }
24475
26961
  },
24476
26962
  outputHandler,
24477
26963
  ownerToken,
26964
+ options?.signalOwner ?? (signalDocumentEnabled ? documentSignalOwner(container) : void 0),
24478
26965
  options
24479
26966
  );
24480
26967
  }
@@ -24514,6 +27001,15 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24514
27001
  body = ROOT_RENDERABLE_BODY;
24515
27002
  props = bodyOrElement;
24516
27003
  }
27004
+ const bindingLeases = rootOptions?.bindingLeases?.map((handle) => {
27005
+ const capability = handle;
27006
+ const lease = capability[BINDING_HANDOFF]?.();
27007
+ if (lease === void 0 || !lease.active() || lease.owner !== void 0 || !container.contains(lease.root))
27008
+ throw new Error(formatClientError(77));
27009
+ return lease;
27010
+ });
27011
+ if (bindingLeases !== void 0 && new Set(bindingLeases).size !== bindingLeases.length)
27012
+ throw new Error(formatClientError(78));
24517
27013
  const nativeSidecar = findHydrateSeedSidecar(container, NATIVE_SIGNAL_SEED_ATTR);
24518
27014
  const nativeManifest = nativeSidecar === null ? void 0 : parseNativeSignalManifest(
24519
27015
  (STAGED_DOM?.view(nativeSidecar) ?? nativeSidecar).textContent || ""
@@ -24541,7 +27037,11 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24541
27037
  }
24542
27038
  const idState = {
24543
27039
  prefix: rootOptions?.identifierPrefix ?? "",
24544
- next: 0
27040
+ next: rootOptions?.identifierSeed ?? 0,
27041
+ signalState: {
27042
+ prefix: rootOptions?.signalInstancePrefix ?? rootOptions?.identifierPrefix ?? "",
27043
+ next: 0
27044
+ }
24545
27045
  };
24546
27046
  rootBlock.idState = idState;
24547
27047
  registerRootErrorHandlers(rootBlock, rootOptions);
@@ -24567,9 +27067,15 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24567
27067
  idState,
24568
27068
  renderReturnedValue,
24569
27069
  ownerToken,
27070
+ rootOptions?.signalOwner ?? (signalDocumentEnabled ? documentSignalOwner(container) : void 0),
24570
27071
  rootOptions
24571
27072
  );
24572
27073
  const owner = idState.renderOwner;
27074
+ if (bindingLeases !== void 0) {
27075
+ owner.bindingLeases = new Set(bindingLeases);
27076
+ owner.bindingContainer = container;
27077
+ for (const lease of bindingLeases) claimBindingHandoff(lease, owner);
27078
+ }
24573
27079
  const adopt = () => {
24574
27080
  if (owner.disposed) return;
24575
27081
  if (rootBlock.disposed) {
@@ -24593,11 +27099,29 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24593
27099
  owner.transaction.hydrating = true;
24594
27100
  createdInRootRender(rootBlock);
24595
27101
  journalRootProperty(idState, "next", idState.next);
24596
- idState.next = 0;
27102
+ idState.next = rootOptions?.identifierSeed ?? 0;
24597
27103
  let firstNode = getFirstChild(container);
24598
27104
  while (firstNode !== null && (firstNode.nodeType === 10 || isRendererHydrationStyle(firstNode)))
24599
27105
  firstNode = getNextSibling(firstNode);
24600
27106
  const hydration = new HydrationCapability(rootBlock, firstNode, seeds);
27107
+ if (bindingLeases?.some((lease) => lease.revision !== void 0)) {
27108
+ const attempted = rootBlock;
27109
+ hydration.retryPresentation = () => {
27110
+ if (owner.disposed || owner.current !== attempted) return;
27111
+ const refs = [];
27112
+ collectVisibleSubtreeRefs(attempted, refs);
27113
+ withRefDetachSuppression(refs, () => unmountBlock(attempted, false));
27114
+ queueMicrotask(() => {
27115
+ if (!owner.disposed && owner.current === attempted) adopt();
27116
+ });
27117
+ };
27118
+ }
27119
+ if (firstNode?.nodeType === 8 && (STAGED_DOM?.view(firstNode) ?? firstNode).data === body[BINDING_VIEW_ROOT]) {
27120
+ rootBlock.startMarker = firstNode;
27121
+ rootBlock.endMarker = hydration.close(firstNode);
27122
+ hydration.claimRootRemainder(getNextSibling(rootBlock.endMarker));
27123
+ hydration.node = getNextSibling(firstNode);
27124
+ }
24601
27125
  if (nativeManifest !== void 0)
24602
27126
  hydration.nativeAdoption = ownNativeAdoption(rootBlock, nativeManifest);
24603
27127
  hydration.passthroughRanges = body[HYDRATION_RANGE_BOUNDARY] === "passthrough";
@@ -24618,7 +27142,22 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24618
27142
  hydration.finishRoot();
24619
27143
  completed = true;
24620
27144
  } catch (error) {
24621
- if (error instanceof NativeAdoptionMiss) {
27145
+ if (error instanceof PresentationAdoptionMiss) {
27146
+ rollbackRootRender(owner.transaction);
27147
+ const refs = [];
27148
+ collectVisibleSubtreeRefs(rootBlock, refs);
27149
+ withRefDetachSuppression(refs, () => unmountBlock(rootBlock, false));
27150
+ if (error.retry && error.lease?.active()) {
27151
+ retryPresentationMiss(error, () => {
27152
+ if (!owner.disposed) adopt();
27153
+ });
27154
+ } else {
27155
+ owner.preservePresentation = true;
27156
+ root.unmount();
27157
+ if (!Object.prototype.hasOwnProperty.call(error, "failure")) throw error;
27158
+ if (!reportUncaughtError(rootBlock, error.failure)) throw error.failure;
27159
+ }
27160
+ } else if (error instanceof NativeAdoptionMiss) {
24622
27161
  nativeRecovery = error;
24623
27162
  rollbackRootRender(owner.transaction);
24624
27163
  unmountBlock(rootBlock, false);
@@ -24642,13 +27181,13 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24642
27181
  }
24643
27182
  if (nativeRecovery !== void 0 && !owner.disposed) {
24644
27183
  noteRecoverableHydrationError(() => nativeRecovery, rootBlock);
24645
- idState.next = 0;
27184
+ idState.next = rootOptions?.identifierSeed ?? 0;
24646
27185
  if (isElementDescriptor(bodyOrElement)) root.render(bodyOrElement);
24647
27186
  else root.render(body, props);
24648
27187
  return;
24649
27188
  }
24650
27189
  if (!completed) return;
24651
- if (hydration.hasAdjacentRangePair) hydration.coalesce();
27190
+ if (hydration.hasAdjacentRangePair && !hydration.presentation) hydration.coalesce();
24652
27191
  owner.retry = () => {
24653
27192
  if (!rootBlock.disposed) scheduleRender(rootBlock);
24654
27193
  };
@@ -24661,6 +27200,34 @@ function hydrateRoot(container, bodyOrElement, propsOrOptions, rootOptions) {
24661
27200
  adopt();
24662
27201
  return root;
24663
27202
  }
27203
+ function createIndependentHydrateActivator(body) {
27204
+ return (context) => {
27205
+ const content = (_props, scope, extra) => {
27206
+ body(context.captures, scope, extra);
27207
+ };
27208
+ const framed = (_props, scope) => {
27209
+ tryBlock(scope, 0, scope.block.parentNode, content, null, null, scope.block.endMarker);
27210
+ };
27211
+ const adapter = (_props, scope) => {
27212
+ componentSlotVoid(scope, 0, scope.block.parentNode, framed, void 0, scope.block.endMarker);
27213
+ };
27214
+ const root = hydrateRoot(context.element, adapter, context.captures, {
27215
+ identifierPrefix: context.manifest.boundaryId + "-",
27216
+ identifierSeed: context.manifest.idSeed,
27217
+ signalInstancePrefix: context.manifest.boundaryId,
27218
+ ...context.signalOwner === void 0 ? {} : { signalOwner: context.signalOwner }
27219
+ });
27220
+ for (const replay of context.intents) {
27221
+ if (!isHydrationSelectionIntentCurrent(replay)) continue;
27222
+ const originalTarget = replay.event.target;
27223
+ if (originalTarget === null || originalTarget.nodeType !== 1 || !context.element.contains(originalTarget))
27224
+ continue;
27225
+ const target = originalTarget;
27226
+ target.dispatchEvent(cloneHydrationReplayEvent(replay.event, target));
27227
+ }
27228
+ return root;
27229
+ };
27230
+ }
24664
27231
  const _resourceHints = /* @__PURE__ */ new Set();
24665
27232
  function hasHeadHint(key) {
24666
27233
  if (_resourceHints.has(key)) return true;
@@ -25066,7 +27633,17 @@ export {
25066
27633
  bagOf,
25067
27634
  beginNativeReadScope,
25068
27635
  beginNativeReadWitness,
27636
+ beginPresentationHydration,
27637
+ bindPresentationView,
25069
27638
  bindRendererRegionOwner,
27639
+ bindSignalAttribute,
27640
+ bindSignalChecked,
27641
+ bindSignalChild,
27642
+ bindSignalHostPropSources,
27643
+ bindSignalText,
27644
+ bindSignalValue,
27645
+ bindingChildSlot,
27646
+ bindingText,
25070
27647
  callWithReceiver,
25071
27648
  canSplitStyleProperties,
25072
27649
  child,
@@ -25086,7 +27663,10 @@ export {
25086
27663
  componentSlotVoid,
25087
27664
  createContext,
25088
27665
  createElement,
27666
+ createElementAt,
27667
+ createElementFromConfig,
25089
27668
  createHostContextRequest,
27669
+ createIndependentHydrateActivator,
25090
27670
  createPortal,
25091
27671
  createRoot,
25092
27672
  createScopedElement,
@@ -25096,10 +27676,13 @@ export {
25096
27676
  descriptorChildren,
25097
27677
  devEventListener,
25098
27678
  devHtmlNesting,
27679
+ documentSignalOwner2 as documentSignalOwner,
25099
27680
  drainFrag,
25100
27681
  drainPassiveEffects,
25101
27682
  enableNativeReadCollection,
27683
+ enableSignalBindings,
25102
27684
  endNativeReadScope,
27685
+ endPresentationHydration,
25103
27686
  errorBlock,
25104
27687
  evt0,
25105
27688
  evt0u,
@@ -25139,6 +27722,7 @@ export {
25139
27722
  hydrateRoot,
25140
27723
  ifBlock,
25141
27724
  injectStyle,
27725
+ installStreamedSignalOwnerActivator,
25142
27726
  invokeManualHook,
25143
27727
  isChildrenBlock,
25144
27728
  isHydratingStyle,
@@ -25148,6 +27732,7 @@ export {
25148
27732
  lazy,
25149
27733
  manualHook,
25150
27734
  mapSlot,
27735
+ markBindingChildren,
25151
27736
  markChildrenBlock,
25152
27737
  markDangerouslySetInnerHTMLChildren,
25153
27738
  markNativeChangeDiagnosticStatic,
@@ -25168,6 +27753,7 @@ export {
25168
27753
  nativeCreateScopedElement,
25169
27754
  nativeCreateScopedValue,
25170
27755
  nativeLocalHook,
27756
+ nativeProjectionBinding,
25171
27757
  nativePuMemo,
25172
27758
  nativePuPub,
25173
27759
  nativePuTake0,
@@ -25186,6 +27772,10 @@ export {
25186
27772
  preinitModule,
25187
27773
  preload,
25188
27774
  preloadModule,
27775
+ presentationFailure,
27776
+ presentationHostWrite,
27777
+ presentationStructure,
27778
+ presentationWrite,
25189
27779
  provideContext,
25190
27780
  puMiss,
25191
27781
  puPub,
@@ -25218,6 +27808,8 @@ export {
25218
27808
  setAttribute,
25219
27809
  setAttributeIfChanged,
25220
27810
  setAutoFocus,
27811
+ setBindingClass,
27812
+ setBindingClassIfChanged,
25221
27813
  setBooleanAttribute,
25222
27814
  setBooleanAttributeIfChanged,
25223
27815
  setChecked,