octane 0.16.0 → 0.16.2

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 (160) hide show
  1. package/dist/behavior-root.js +12 -13
  2. package/dist/cjs/behavior-root.cjs +12 -13
  3. package/dist/cjs/data-encoding.cjs +18 -0
  4. package/dist/cjs/dom-tables.cjs +14 -0
  5. package/dist/cjs/error-codes.client.generated.cjs +43 -0
  6. package/dist/cjs/error-codes.server.generated.cjs +43 -0
  7. package/dist/cjs/independent-hydration-protocol.cjs +7 -20
  8. package/dist/cjs/radio-group.cjs +7 -2
  9. package/dist/cjs/runtime/block.cjs +5 -5
  10. package/dist/cjs/runtime/branches.cjs +2 -21
  11. package/dist/cjs/runtime/child-slots.cjs +29 -16
  12. package/dist/cjs/runtime/commit.cjs +3 -1
  13. package/dist/cjs/runtime/component-slots.cjs +26 -15
  14. package/dist/cjs/runtime/context.cjs +14 -9
  15. package/dist/cjs/runtime/deopt.cjs +78 -82
  16. package/dist/cjs/runtime/drivers.cjs +25 -0
  17. package/dist/cjs/runtime/elements.cjs +5 -5
  18. package/dist/cjs/runtime/forms.cjs +12 -13
  19. package/dist/cjs/runtime/hydrate-boundary.cjs +1 -1
  20. package/dist/cjs/runtime/hydration-presentation.cjs +3 -2
  21. package/dist/cjs/runtime/hydration.cjs +24 -21
  22. package/dist/cjs/runtime/lists.cjs +5 -4
  23. package/dist/cjs/runtime/portals.cjs +2 -2
  24. package/dist/cjs/runtime/refs.cjs +4 -0
  25. package/dist/cjs/runtime/render.cjs +3 -3
  26. package/dist/cjs/runtime/roots.cjs +1 -1
  27. package/dist/cjs/runtime/signal-bindings.cjs +29 -38
  28. package/dist/cjs/runtime/signal-owners.cjs +3 -3
  29. package/dist/cjs/runtime/suspense.cjs +36 -97
  30. package/dist/cjs/runtime/templates.cjs +4 -3
  31. package/dist/cjs/runtime.cjs +2 -0
  32. package/dist/cjs/runtime.server.cjs +1 -13
  33. package/dist/cjs/signals/actions.cjs +3 -2
  34. package/dist/cjs/signals/computations.cjs +4 -3
  35. package/dist/cjs/signals/control-binding.cjs +2 -5
  36. package/dist/cjs/signals/engine.cjs +2 -1
  37. package/dist/cjs/signals/facade.cjs +1 -1
  38. package/dist/cjs/signals/graph.cjs +3 -7
  39. package/dist/cjs/signals/handle-protocol.cjs +5 -0
  40. package/dist/cjs/signals/requests.cjs +2 -1
  41. package/dist/cjs/signals/scalar-computations.cjs +2 -1
  42. package/dist/cjs/stream-protocol.cjs +5 -3
  43. package/dist/cjs/streamed-signals-protocol.cjs +7 -20
  44. package/dist/cjs/version.cjs +1 -1
  45. package/dist/compiler/compile.js +62 -58
  46. package/dist/compiler/template-ir.js +102 -0
  47. package/dist/data-encoding.d.ts +4 -0
  48. package/dist/data-encoding.js +16 -0
  49. package/dist/dom-binding-program.js +1 -3
  50. package/dist/dom-binding-signals.d.ts +2 -2
  51. package/dist/dom-binding-signals.js +3 -4
  52. package/dist/dom-tables.d.ts +1 -0
  53. package/dist/dom-tables.js +13 -0
  54. package/dist/error-codes.client.generated.d.ts +11 -0
  55. package/dist/error-codes.client.generated.js +43 -0
  56. package/dist/error-codes.server.generated.d.ts +11 -0
  57. package/dist/error-codes.server.generated.js +43 -0
  58. package/dist/independent-hydration-protocol.js +5 -18
  59. package/dist/node/behavior-root.js +12 -13
  60. package/dist/node/data-encoding.js +16 -0
  61. package/dist/node/dom-binding-program.js +1 -3
  62. package/dist/node/dom-binding-signals.js +3 -4
  63. package/dist/node/dom-tables.js +13 -0
  64. package/dist/node/error-codes.client.generated.js +43 -0
  65. package/dist/node/error-codes.server.generated.js +43 -0
  66. package/dist/node/independent-hydration-protocol.js +5 -18
  67. package/dist/node/owner-kernel/hooks.js +0 -4
  68. package/dist/node/radio-group.js +5 -1
  69. package/dist/node/runtime/block.js +5 -5
  70. package/dist/node/runtime/branches.js +2 -21
  71. package/dist/node/runtime/child-slots.js +31 -22
  72. package/dist/node/runtime/commit.js +3 -1
  73. package/dist/node/runtime/component-slots.js +32 -24
  74. package/dist/node/runtime/context.js +19 -9
  75. package/dist/node/runtime/deopt.js +77 -82
  76. package/dist/node/runtime/drivers.js +29 -0
  77. package/dist/node/runtime/elements.js +4 -6
  78. package/dist/node/runtime/forms.js +4 -5
  79. package/dist/node/runtime/hydrate-boundary.js +2 -5
  80. package/dist/node/runtime/hydration-presentation.js +1 -2
  81. package/dist/node/runtime/hydration.js +14 -10
  82. package/dist/node/runtime/lists.js +5 -4
  83. package/dist/node/runtime/portals.js +3 -3
  84. package/dist/node/runtime/refs.js +3 -0
  85. package/dist/node/runtime/render.js +11 -7
  86. package/dist/node/runtime/roots.js +1 -1
  87. package/dist/node/runtime/signal-bindings.js +3 -11
  88. package/dist/node/runtime/signal-owners.js +3 -3
  89. package/dist/node/runtime/suspense.js +36 -97
  90. package/dist/node/runtime/templates.js +2 -1
  91. package/dist/node/runtime.js +2 -0
  92. package/dist/node/runtime.server.js +1 -13
  93. package/dist/node/signals/actions.js +2 -9
  94. package/dist/node/signals/computations.js +1 -1
  95. package/dist/node/signals/control-binding.js +3 -6
  96. package/dist/node/signals/engine.js +1 -1
  97. package/dist/node/signals/facade.js +1 -2
  98. package/dist/node/signals/graph.js +1 -4
  99. package/dist/node/signals/handle-protocol.js +4 -0
  100. package/dist/node/signals/requests.js +1 -1
  101. package/dist/node/signals/scalar-computations.js +1 -1
  102. package/dist/node/stream-protocol.js +4 -3
  103. package/dist/node/streamed-signals-protocol.js +1 -14
  104. package/dist/node/universal-core.js +1 -1
  105. package/dist/node/version.js +1 -1
  106. package/dist/owner-kernel/hooks.d.ts +0 -1
  107. package/dist/owner-kernel/hooks.js +0 -4
  108. package/dist/radio-group.d.ts +2 -0
  109. package/dist/radio-group.js +5 -1
  110. package/dist/runtime/block.js +5 -5
  111. package/dist/runtime/branches.js +2 -21
  112. package/dist/runtime/child-slots.js +31 -22
  113. package/dist/runtime/commit.d.ts +5 -4
  114. package/dist/runtime/commit.js +3 -1
  115. package/dist/runtime/component-slots.d.ts +3 -0
  116. package/dist/runtime/component-slots.js +32 -24
  117. package/dist/runtime/context.d.ts +9 -1
  118. package/dist/runtime/context.js +19 -9
  119. package/dist/runtime/deopt.d.ts +16 -5
  120. package/dist/runtime/deopt.js +77 -82
  121. package/dist/runtime/drivers.d.ts +32 -0
  122. package/dist/runtime/drivers.js +29 -0
  123. package/dist/runtime/elements.d.ts +4 -0
  124. package/dist/runtime/elements.js +4 -6
  125. package/dist/runtime/forms.js +4 -5
  126. package/dist/runtime/hydrate-boundary.js +2 -5
  127. package/dist/runtime/hydration-presentation.js +1 -2
  128. package/dist/runtime/hydration.d.ts +1 -3
  129. package/dist/runtime/hydration.js +14 -10
  130. package/dist/runtime/lists.js +5 -4
  131. package/dist/runtime/portals.js +3 -3
  132. package/dist/runtime/refs.d.ts +1 -0
  133. package/dist/runtime/refs.js +3 -0
  134. package/dist/runtime/render.js +11 -7
  135. package/dist/runtime/roots.js +1 -1
  136. package/dist/runtime/signal-bindings.d.ts +1 -3
  137. package/dist/runtime/signal-bindings.js +3 -11
  138. package/dist/runtime/signal-owners.js +3 -3
  139. package/dist/runtime/suspense.js +36 -97
  140. package/dist/runtime/templates.js +2 -1
  141. package/dist/runtime.d.ts +1 -1
  142. package/dist/runtime.js +2 -0
  143. package/dist/runtime.server.js +1 -13
  144. package/dist/signals/actions.js +2 -9
  145. package/dist/signals/computations.js +1 -1
  146. package/dist/signals/control-binding.js +3 -6
  147. package/dist/signals/engine.js +1 -1
  148. package/dist/signals/facade.js +1 -2
  149. package/dist/signals/graph.d.ts +0 -1
  150. package/dist/signals/graph.js +1 -4
  151. package/dist/signals/handle-protocol.d.ts +1 -1
  152. package/dist/signals/handle-protocol.js +4 -0
  153. package/dist/signals/requests.js +1 -1
  154. package/dist/signals/scalar-computations.js +1 -1
  155. package/dist/stream-protocol.d.ts +2 -0
  156. package/dist/stream-protocol.js +4 -3
  157. package/dist/streamed-signals-protocol.js +1 -14
  158. package/dist/universal-core.js +1 -1
  159. package/dist/version.js +1 -1
  160. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { adoptBindings, mountBindings, unbound } from "./dom-bindings.js";
2
+ import { formatClientError } from "./error-codes.client.generated.js";
2
3
  import { captureFormSubmissions } from "./behavior-form-submissions.js";
3
4
  const documentRegistries = /* @__PURE__ */ new WeakMap();
4
5
  const DEFAULT_DOM = {
@@ -85,12 +86,12 @@ function contains(root, element, container = root.container) {
85
86
  }
86
87
  function assertActiveRoot(root) {
87
88
  if (root.disposed || root.controller.signal.aborted) {
88
- throw new Error("Cannot register behavior on a disposed behavior root.");
89
+ throw new Error(formatClientError(351));
89
90
  }
90
91
  }
91
92
  function assertContainedElement(root, element, label) {
92
93
  if (!root.dom.element(element) || !contains(root, element)) {
93
- throw new Error(`${label} must belong to the behavior root container and document.`);
94
+ throw new Error(formatClientError(352, label));
94
95
  }
95
96
  }
96
97
  function nearestRange(root, element) {
@@ -388,7 +389,7 @@ function installListeners(root, events) {
388
389
  if (events === void 0) return;
389
390
  for (const event of new Set(events)) {
390
391
  if (typeof event !== "string" || event.length === 0) {
391
- throw new Error("Behavior event names must be non-empty strings.");
392
+ throw new Error(formatClientError(353));
392
393
  }
393
394
  if (root.listeners.has(event)) continue;
394
395
  const listener = (nativeEvent) => handleDelegatedEvent(root, nativeEvent);
@@ -449,7 +450,7 @@ function activateBehavior(record) {
449
450
  function registerBehavior(root, entry) {
450
451
  assertActiveRoot(root);
451
452
  if (entry === null || typeof entry !== "object" || typeof entry.adopt !== "function") {
452
- throw new Error("A behavior entry requires an adopt(element, context) function.");
453
+ throw new Error(formatClientError(354));
453
454
  }
454
455
  if (typeof entry.target !== "string") {
455
456
  assertContainedElement(root, entry.target, "A behavior target");
@@ -457,19 +458,19 @@ function registerBehavior(root, entry) {
457
458
  root.dom.matches(root.container, entry.target);
458
459
  }
459
460
  if (entry.id !== void 0 && root.byId.has(entry.id)) {
460
- throw new Error(`A behavior with identity ${JSON.stringify(entry.id)} is already registered.`);
461
+ throw new Error(formatClientError(355, JSON.stringify(entry.id)));
461
462
  }
462
463
  const dependencies = [];
463
464
  for (const id of entry.dependencies ?? []) {
464
465
  const dependency = root.byId.get(id);
465
466
  if (dependency === void 0) {
466
- throw new Error(`Behavior dependency ${JSON.stringify(id)} is not registered.`);
467
+ throw new Error(formatClientError(356, JSON.stringify(id)));
467
468
  }
468
469
  dependencies.push(dependency);
469
470
  }
470
471
  for (const existing of root.behaviors) {
471
472
  if (entry.id !== void 0 && existing.entry.conflicts?.includes(entry.id) || existing.entry.id !== void 0 && entry.conflicts?.includes(existing.entry.id)) {
472
- throw new Error("The requested behavior conflicts with an existing behavior registration.");
473
+ throw new Error(formatClientError(357));
473
474
  }
474
475
  }
475
476
  const controller = createController(root.document);
@@ -549,7 +550,7 @@ function registerExternalRange(root, element, options) {
549
550
  assertActiveRoot(root);
550
551
  assertContainedElement(root, element, "An externally owned range");
551
552
  if (options === null || typeof options !== "object" || !("owner" in options)) {
552
- throw new Error("An external range requires an explicit owner identity.");
553
+ throw new Error(formatClientError(358));
553
554
  }
554
555
  const existing = root.registry.ranges.get(element);
555
556
  if (existing !== void 0) {
@@ -557,7 +558,7 @@ function registerExternalRange(root, element, options) {
557
558
  return existing.publicRange;
558
559
  }
559
560
  if (!options.replace) {
560
- throw new Error("External ownership conflict: pass replace: true to hand this range off.");
561
+ throw new Error(formatClientError(359));
561
562
  }
562
563
  if (!options.signal?.aborted) disposeRange(existing);
563
564
  }
@@ -675,15 +676,13 @@ function attachBehaviorRoot(container, options = {}) {
675
676
  const capture = options.formSubmissions;
676
677
  const document = capture === void 0 ? isElement(container) ? container.ownerDocument : null : capture.document(container);
677
678
  if (document === null) {
678
- throw new Error("A behavior root requires an element with an owner document.");
679
+ throw new Error(formatClientError(360));
679
680
  }
680
681
  let registry = registryFor(document);
681
682
  const existing = registry.roots.get(container);
682
683
  if (existing !== void 0) {
683
684
  if (!options.replace) {
684
- throw new Error(
685
- "This container already has a behavior root; pass replace: true to replace it."
686
- );
685
+ throw new Error(formatClientError(361));
687
686
  }
688
687
  if (!options.signal?.aborted) {
689
688
  disposeRoot(existing);
@@ -26,6 +26,7 @@ __export(behavior_root_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(behavior_root_exports);
28
28
  var import_dom_bindings = require("./dom-bindings.cjs");
29
+ var import_error_codes_client_generated = require("./error-codes.client.generated.cjs");
29
30
  var import_behavior_form_submissions = require("./behavior-form-submissions.cjs");
30
31
  const documentRegistries = /* @__PURE__ */ new WeakMap();
31
32
  const DEFAULT_DOM = {
@@ -112,12 +113,12 @@ function contains(root, element, container = root.container) {
112
113
  }
113
114
  function assertActiveRoot(root) {
114
115
  if (root.disposed || root.controller.signal.aborted) {
115
- throw new Error("Cannot register behavior on a disposed behavior root.");
116
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(351));
116
117
  }
117
118
  }
118
119
  function assertContainedElement(root, element, label) {
119
120
  if (!root.dom.element(element) || !contains(root, element)) {
120
- throw new Error(`${label} must belong to the behavior root container and document.`);
121
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(352, label));
121
122
  }
122
123
  }
123
124
  function nearestRange(root, element) {
@@ -415,7 +416,7 @@ function installListeners(root, events) {
415
416
  if (events === void 0) return;
416
417
  for (const event of new Set(events)) {
417
418
  if (typeof event !== "string" || event.length === 0) {
418
- throw new Error("Behavior event names must be non-empty strings.");
419
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(353));
419
420
  }
420
421
  if (root.listeners.has(event)) continue;
421
422
  const listener = (nativeEvent) => handleDelegatedEvent(root, nativeEvent);
@@ -476,7 +477,7 @@ function activateBehavior(record) {
476
477
  function registerBehavior(root, entry) {
477
478
  assertActiveRoot(root);
478
479
  if (entry === null || typeof entry !== "object" || typeof entry.adopt !== "function") {
479
- throw new Error("A behavior entry requires an adopt(element, context) function.");
480
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(354));
480
481
  }
481
482
  if (typeof entry.target !== "string") {
482
483
  assertContainedElement(root, entry.target, "A behavior target");
@@ -484,19 +485,19 @@ function registerBehavior(root, entry) {
484
485
  root.dom.matches(root.container, entry.target);
485
486
  }
486
487
  if (entry.id !== void 0 && root.byId.has(entry.id)) {
487
- throw new Error(`A behavior with identity ${JSON.stringify(entry.id)} is already registered.`);
488
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(355, JSON.stringify(entry.id)));
488
489
  }
489
490
  const dependencies = [];
490
491
  for (const id of entry.dependencies ?? []) {
491
492
  const dependency = root.byId.get(id);
492
493
  if (dependency === void 0) {
493
- throw new Error(`Behavior dependency ${JSON.stringify(id)} is not registered.`);
494
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(356, JSON.stringify(id)));
494
495
  }
495
496
  dependencies.push(dependency);
496
497
  }
497
498
  for (const existing of root.behaviors) {
498
499
  if (entry.id !== void 0 && existing.entry.conflicts?.includes(entry.id) || existing.entry.id !== void 0 && entry.conflicts?.includes(existing.entry.id)) {
499
- throw new Error("The requested behavior conflicts with an existing behavior registration.");
500
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(357));
500
501
  }
501
502
  }
502
503
  const controller = createController(root.document);
@@ -576,7 +577,7 @@ function registerExternalRange(root, element, options) {
576
577
  assertActiveRoot(root);
577
578
  assertContainedElement(root, element, "An externally owned range");
578
579
  if (options === null || typeof options !== "object" || !("owner" in options)) {
579
- throw new Error("An external range requires an explicit owner identity.");
580
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(358));
580
581
  }
581
582
  const existing = root.registry.ranges.get(element);
582
583
  if (existing !== void 0) {
@@ -584,7 +585,7 @@ function registerExternalRange(root, element, options) {
584
585
  return existing.publicRange;
585
586
  }
586
587
  if (!options.replace) {
587
- throw new Error("External ownership conflict: pass replace: true to hand this range off.");
588
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(359));
588
589
  }
589
590
  if (!options.signal?.aborted) disposeRange(existing);
590
591
  }
@@ -702,15 +703,13 @@ function attachBehaviorRoot(container, options = {}) {
702
703
  const capture = options.formSubmissions;
703
704
  const document = capture === void 0 ? isElement(container) ? container.ownerDocument : null : capture.document(container);
704
705
  if (document === null) {
705
- throw new Error("A behavior root requires an element with an owner document.");
706
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(360));
706
707
  }
707
708
  let registry = registryFor(document);
708
709
  const existing = registry.roots.get(container);
709
710
  if (existing !== void 0) {
710
711
  if (!options.replace) {
711
- throw new Error(
712
- "This container already has a behavior root; pass replace: true to replace it."
713
- );
712
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(361));
714
713
  }
715
714
  if (!options.signal?.aborted) {
716
715
  disposeRoot(existing);
@@ -20,6 +20,8 @@ var data_encoding_exports = {};
20
20
  __export(data_encoding_exports, {
21
21
  decodeSignalValue: () => decodeSignalValue,
22
22
  encodeSignalValue: () => encodeSignalValue,
23
+ isKey: () => isKey,
24
+ isRecord: () => isRecord,
23
25
  snapshotSignalValue: () => snapshotSignalValue
24
26
  });
25
27
  module.exports = __toCommonJS(data_encoding_exports);
@@ -29,6 +31,20 @@ function unsupported() {
29
31
  "Signal request arguments and seeds require acyclic plain data: undefined, null, booleans, finite numbers, strings, dense arrays, and plain objects with enumerable string data properties."
30
32
  );
31
33
  }
34
+ function isRecord(value) {
35
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
36
+ const prototype = Object.getPrototypeOf(value);
37
+ if (prototype !== Object.prototype && prototype !== null) return false;
38
+ for (const key of Reflect.ownKeys(value)) {
39
+ if (typeof key !== "string") return false;
40
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
41
+ if (!descriptor.enumerable || !("value" in descriptor)) return false;
42
+ }
43
+ return true;
44
+ }
45
+ function isKey(value) {
46
+ return typeof value === "string" && value.length > 0 && value.length <= 1024;
47
+ }
32
48
  function encodeSignalValue(value, ancestors = /* @__PURE__ */ new Set()) {
33
49
  if (value === void 0) return ["undefined"];
34
50
  if (value === null) return ["null"];
@@ -156,5 +172,7 @@ function decodeSignalValue(encoded) {
156
172
  0 && (module.exports = {
157
173
  decodeSignalValue,
158
174
  encodeSignalValue,
175
+ isKey,
176
+ isRecord,
159
177
  snapshotSignalValue
160
178
  });
@@ -24,6 +24,7 @@ __export(dom_tables_exports, {
24
24
  MATHML_ONLY_TAGS: () => MATHML_ONLY_TAGS,
25
25
  MUST_USE_PROPERTY_PROPS: () => MUST_USE_PROPERTY_PROPS,
26
26
  POSITIVE_NUMERIC_ATTR_PROPS: () => POSITIVE_NUMERIC_ATTR_PROPS,
27
+ RAW_TEXT_CONTENT: () => RAW_TEXT_CONTENT,
27
28
  READ_ONLY_VALUE_INPUT_TYPES: () => READ_ONLY_VALUE_INPUT_TYPES,
28
29
  SVG_ONLY_TAGS: () => SVG_ONLY_TAGS,
29
30
  VOID_ELEMENTS: () => VOID_ELEMENTS,
@@ -50,6 +51,18 @@ const VOID_ELEMENTS = /* @__PURE__ */ new Set([
50
51
  "track",
51
52
  "wbr"
52
53
  ]);
54
+ const RAW_TEXT_CONTENT = /* @__PURE__ */ new Set([
55
+ "textarea",
56
+ "title",
57
+ "script",
58
+ "style",
59
+ "xmp",
60
+ "iframe",
61
+ "noembed",
62
+ "noframes",
63
+ "noscript",
64
+ "plaintext"
65
+ ]);
53
66
  const READ_ONLY_VALUE_INPUT_TYPES = /* @__PURE__ */ new Set([
54
67
  "button",
55
68
  "checkbox",
@@ -418,6 +431,7 @@ function isEnumeratedBooleanAttr(name) {
418
431
  MATHML_ONLY_TAGS,
419
432
  MUST_USE_PROPERTY_PROPS,
420
433
  POSITIVE_NUMERIC_ATTR_PROPS,
434
+ RAW_TEXT_CONTENT,
421
435
  READ_ONLY_VALUE_INPUT_TYPES,
422
436
  SVG_ONLY_TAGS,
423
437
  VOID_ELEMENTS,
@@ -1085,6 +1085,49 @@ function formatClientError(code, ...args) {
1085
1085
  );
1086
1086
  case 350:
1087
1087
  return (0, import_error_message.formatDevErrorMessage)("__runOnCatch must be called from an active catch arm.", args);
1088
+ case 351:
1089
+ return (0, import_error_message.formatDevErrorMessage)("Cannot register behavior on a disposed behavior root.", args);
1090
+ case 352:
1091
+ return (0, import_error_message.formatDevErrorMessage)(
1092
+ "%s must belong to the behavior root container and document.",
1093
+ args
1094
+ );
1095
+ case 353:
1096
+ return (0, import_error_message.formatDevErrorMessage)("Behavior event names must be non-empty strings.", args);
1097
+ case 354:
1098
+ return (0, import_error_message.formatDevErrorMessage)(
1099
+ "A behavior entry requires an adopt(element, context) function.",
1100
+ args
1101
+ );
1102
+ case 355:
1103
+ return (0, import_error_message.formatDevErrorMessage)("A behavior with identity %s is already registered.", args);
1104
+ case 356:
1105
+ return (0, import_error_message.formatDevErrorMessage)("Behavior dependency %s is not registered.", args);
1106
+ case 357:
1107
+ return (0, import_error_message.formatDevErrorMessage)(
1108
+ "The requested behavior conflicts with an existing behavior registration.",
1109
+ args
1110
+ );
1111
+ case 358:
1112
+ return (0, import_error_message.formatDevErrorMessage)(
1113
+ "An external range requires an explicit owner identity.",
1114
+ args
1115
+ );
1116
+ case 359:
1117
+ return (0, import_error_message.formatDevErrorMessage)(
1118
+ "External ownership conflict: pass replace: true to hand this range off.",
1119
+ args
1120
+ );
1121
+ case 360:
1122
+ return (0, import_error_message.formatDevErrorMessage)(
1123
+ "A behavior root requires an element with an owner document.",
1124
+ args
1125
+ );
1126
+ case 361:
1127
+ return (0, import_error_message.formatDevErrorMessage)(
1128
+ "This container already has a behavior root; pass replace: true to replace it.",
1129
+ args
1130
+ );
1088
1131
  default:
1089
1132
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
1090
1133
  }
@@ -767,6 +767,49 @@ function formatServerError(code, ...args) {
767
767
  );
768
768
  case 350:
769
769
  return (0, import_error_message.formatDevErrorMessage)("__runOnCatch must be called from an active catch arm.", args);
770
+ case 351:
771
+ return (0, import_error_message.formatDevErrorMessage)("Cannot register behavior on a disposed behavior root.", args);
772
+ case 352:
773
+ return (0, import_error_message.formatDevErrorMessage)(
774
+ "%s must belong to the behavior root container and document.",
775
+ args
776
+ );
777
+ case 353:
778
+ return (0, import_error_message.formatDevErrorMessage)("Behavior event names must be non-empty strings.", args);
779
+ case 354:
780
+ return (0, import_error_message.formatDevErrorMessage)(
781
+ "A behavior entry requires an adopt(element, context) function.",
782
+ args
783
+ );
784
+ case 355:
785
+ return (0, import_error_message.formatDevErrorMessage)("A behavior with identity %s is already registered.", args);
786
+ case 356:
787
+ return (0, import_error_message.formatDevErrorMessage)("Behavior dependency %s is not registered.", args);
788
+ case 357:
789
+ return (0, import_error_message.formatDevErrorMessage)(
790
+ "The requested behavior conflicts with an existing behavior registration.",
791
+ args
792
+ );
793
+ case 358:
794
+ return (0, import_error_message.formatDevErrorMessage)(
795
+ "An external range requires an explicit owner identity.",
796
+ args
797
+ );
798
+ case 359:
799
+ return (0, import_error_message.formatDevErrorMessage)(
800
+ "External ownership conflict: pass replace: true to hand this range off.",
801
+ args
802
+ );
803
+ case 360:
804
+ return (0, import_error_message.formatDevErrorMessage)(
805
+ "A behavior root requires an element with an owner document.",
806
+ args
807
+ );
808
+ case 361:
809
+ return (0, import_error_message.formatDevErrorMessage)(
810
+ "This container already has a behavior root; pass replace: true to replace it.",
811
+ args
812
+ );
770
813
  default:
771
814
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
772
815
  }
@@ -9,9 +9,9 @@ var __export = (target, all) => {
9
9
  };
10
10
  var __copyProps = (to, from, except, desc) => {
11
11
  if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key2 of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key2) && key2 !== except)
14
- __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
15
  }
16
16
  return to;
17
17
  };
@@ -26,21 +26,8 @@ module.exports = __toCommonJS(independent_hydration_protocol_exports);
26
26
  var import_error_message_no_arguments = require("./error-message-no-arguments.cjs");
27
27
  var import_data_encoding = require("./data-encoding.cjs");
28
28
  const __octaneDev = process.env.NODE_ENV !== "production";
29
- function plainRecord(value) {
30
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
31
- const prototype = Object.getPrototypeOf(value);
32
- if (prototype !== Object.prototype && prototype !== null) return false;
33
- return Reflect.ownKeys(value).every((key2) => {
34
- if (typeof key2 !== "string") return false;
35
- const descriptor = Object.getOwnPropertyDescriptor(value, key2);
36
- return descriptor.enumerable && "value" in descriptor;
37
- });
38
- }
39
- function key(value) {
40
- return typeof value === "string" && value.length > 0 && value.length <= 1024;
41
- }
42
29
  function uniqueKeys(value) {
43
- return Array.isArray(value) && value.every(key) && new Set(value).size === value.length;
30
+ return Array.isArray(value) && value.every(import_data_encoding.isKey) && new Set(value).size === value.length;
44
31
  }
45
32
  function captures(value, count) {
46
33
  if (!Array.isArray(value) || value.length !== count) return false;
@@ -52,7 +39,7 @@ function captures(value, count) {
52
39
  }
53
40
  }
54
41
  function isIndependentHydrateManifest(value) {
55
- if (!plainRecord(value)) return false;
42
+ if (!(0, import_data_encoding.isRecord)(value)) return false;
56
43
  const allowed = /* @__PURE__ */ new Set([
57
44
  "version",
58
45
  "buildId",
@@ -68,12 +55,12 @@ function isIndependentHydrateManifest(value) {
68
55
  "parentDependencies"
69
56
  ]);
70
57
  if (!Object.keys(value).every((name) => allowed.has(name))) return false;
71
- if (value["version"] !== 1 || !key(value["buildId"]) || !key(value["boundaryId"]) || !key(value["moduleId"]) || !key(value["exportName"]) || !Number.isSafeInteger(value["hookSeed"]) || value["hookSeed"] < 0 || !Number.isSafeInteger(value["idSeed"]) || value["idSeed"] < 0 || value["parentDependencies"] !== false || !uniqueKeys(value["signalSites"]) || !uniqueKeys(value["styles"]) || !Array.isArray(value["captureSchema"])) {
58
+ if (value["version"] !== 1 || !(0, import_data_encoding.isKey)(value["buildId"]) || !(0, import_data_encoding.isKey)(value["boundaryId"]) || !(0, import_data_encoding.isKey)(value["moduleId"]) || !(0, import_data_encoding.isKey)(value["exportName"]) || !Number.isSafeInteger(value["hookSeed"]) || value["hookSeed"] < 0 || !Number.isSafeInteger(value["idSeed"]) || value["idSeed"] < 0 || value["parentDependencies"] !== false || !uniqueKeys(value["signalSites"]) || !uniqueKeys(value["styles"]) || !Array.isArray(value["captureSchema"])) {
72
59
  return false;
73
60
  }
74
61
  const names = /* @__PURE__ */ new Set();
75
62
  for (const capture of value["captureSchema"]) {
76
- if (!plainRecord(capture) || Object.keys(capture).length !== 2 || !key(capture["name"]) || capture["type"] !== "json" || names.has(capture["name"])) {
63
+ if (!(0, import_data_encoding.isRecord)(capture) || Object.keys(capture).length !== 2 || !(0, import_data_encoding.isKey)(capture["name"]) || capture["type"] !== "json" || names.has(capture["name"])) {
77
64
  return false;
78
65
  }
79
66
  names.add(capture["name"]);
@@ -18,7 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var radio_group_exports = {};
20
20
  __export(radio_group_exports, {
21
- radioGroupCandidates: () => radioGroupCandidates
21
+ radioGroupCandidates: () => radioGroupCandidates,
22
+ toControlledString: () => toControlledString
22
23
  });
23
24
  module.exports = __toCommonJS(radio_group_exports);
24
25
  function radioGroupCandidates(input) {
@@ -33,7 +34,11 @@ function radioGroupCandidates(input) {
33
34
  if (root === input) return [input];
34
35
  return root.nodeType === 9 ? root.getElementsByName(name) : root.querySelectorAll('input[type="radio"]');
35
36
  }
37
+ function toControlledString(value) {
38
+ return typeof value === "string" ? value : typeof value === "function" || typeof value === "symbol" ? "" : String(value);
39
+ }
36
40
  // Annotate the CommonJS export names for ESM import in node:
37
41
  0 && (module.exports = {
38
- radioGroupCandidates
42
+ radioGroupCandidates,
43
+ toControlledString
39
44
  });
@@ -537,7 +537,7 @@ function unmountBlock(block, detachDom = true) {
537
537
  return;
538
538
  }
539
539
  if (TEARDOWN_DEPTH === 0) {
540
- TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(block.parentBlock) ?? (import_context.RENDERER_REGION_OWNER_COUNT === 0 ? null : (0, import_context.rendererRegionTryHandler)(block));
540
+ TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(block.parentBlock) ?? (import_context.RENDERER_REGION_OWNER_COUNT ? (0, import_context.rendererRegionTryHandler)(block) : null);
541
541
  TEARDOWN_BLOCK = block;
542
542
  }
543
543
  TEARDOWN_DEPTH++;
@@ -711,7 +711,7 @@ function unmountSlot(val, detachDom) {
711
711
  }
712
712
  function resetHmrBlock(block) {
713
713
  if (TEARDOWN_DEPTH === 0) {
714
- TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(block.parentBlock) ?? (0, import_context.rendererRegionTryHandler)(block);
714
+ TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(block.parentBlock) ?? (import_context.RENDERER_REGION_OWNER_COUNT ? (0, import_context.rendererRegionTryHandler)(block) : null);
715
715
  TEARDOWN_BLOCK = block;
716
716
  }
717
717
  TEARDOWN_DEPTH++;
@@ -764,7 +764,7 @@ function resetHmrBlock(block) {
764
764
  function resetScopeChildren(scope, detachDom = true) {
765
765
  const block = scope.block;
766
766
  if (TEARDOWN_DEPTH === 0) {
767
- TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(block.parentBlock) ?? (0, import_context.rendererRegionTryHandler)(block);
767
+ TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(block.parentBlock) ?? (import_context.RENDERER_REGION_OWNER_COUNT ? (0, import_context.rendererRegionTryHandler)(block) : null);
768
768
  TEARDOWN_BLOCK = block;
769
769
  }
770
770
  TEARDOWN_DEPTH++;
@@ -791,7 +791,7 @@ function resetScopeChildren(scope, detachDom = true) {
791
791
  function releaseLiteArm(scope) {
792
792
  const parent = scope.block.parentBlock;
793
793
  if (TEARDOWN_DEPTH === 0) {
794
- TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(parent) ?? (0, import_context.rendererRegionTryHandler)(parent);
794
+ TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(parent) ?? (import_context.RENDERER_REGION_OWNER_COUNT ? (0, import_context.rendererRegionTryHandler)(parent) : null);
795
795
  TEARDOWN_BLOCK = (0, import_branches.owningBlock)(parent);
796
796
  }
797
797
  TEARDOWN_DEPTH++;
@@ -806,7 +806,7 @@ function releaseLiteArm(scope) {
806
806
  }
807
807
  function clearItems(first, start, end, size) {
808
808
  if (first !== null && TEARDOWN_DEPTH === 0) {
809
- TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(first.parentBlock) ?? (import_context.RENDERER_REGION_OWNER_COUNT === 0 ? null : (0, import_context.rendererRegionTryHandler)(first));
809
+ TEARDOWN_HANDLER = (0, import_suspense.findTryHandler)(first.parentBlock) ?? (import_context.RENDERER_REGION_OWNER_COUNT ? (0, import_context.rendererRegionTryHandler)(first) : null);
810
810
  TEARDOWN_BLOCK = first;
811
811
  }
812
812
  TEARDOWN_DEPTH++;
@@ -44,6 +44,7 @@ var import_engine = require("./engine.cjs");
44
44
  var import_use = require("./use.cjs");
45
45
  var import_context = require("./context.cjs");
46
46
  var import_hydration = require("./hydration.cjs");
47
+ var import_stream_protocol = require("../stream-protocol.cjs");
47
48
  var import_block = require("./block.cjs");
48
49
  var import_render = require("./render.cjs");
49
50
  var import_lists = require("./lists.cjs");
@@ -526,7 +527,7 @@ function renderBranchSlot(parentScope, slotKey, state, domParent, next, body, ma
526
527
  bEnd = state.end;
527
528
  borrowed = true;
528
529
  if (hydration !== null) {
529
- if ((0, import_hydration.isBlockOpen)(state.start)) hydration.node = first = (0, import_templates.getNextSibling)(state.start);
530
+ if ((0, import_stream_protocol.isBlockOpen)(state.start)) hydration.node = first = (0, import_templates.getNextSibling)(state.start);
530
531
  else rebuild = true;
531
532
  }
532
533
  }
@@ -638,11 +639,6 @@ function ifBlock(parentScope, slotKey, domParent, cond, thenBody, elseBody, anch
638
639
  if (open !== null) {
639
640
  start = open;
640
641
  end = hydration.close(open);
641
- } else if (hydration !== null && !passthrough) {
642
- hydration.suspend(
643
- () => ifBlock(parentScope, slotKey, domParent, cond, thenBody, elseBody, anchor, env, lite)
644
- );
645
- return;
646
642
  }
647
643
  state = {
648
644
  __kind: "ifBlockSlot",
@@ -695,21 +691,6 @@ function switchBlock(parentScope, slotKey, domParent, discriminant, cases, defau
695
691
  if (open !== null) {
696
692
  start = open;
697
693
  end = hydration.close(open);
698
- } else if (hydration !== null && !passthrough) {
699
- hydration.suspend(
700
- () => switchBlock(
701
- parentScope,
702
- slotKey,
703
- domParent,
704
- discriminant,
705
- cases,
706
- defaultBody,
707
- anchor,
708
- env,
709
- lite
710
- )
711
- );
712
- return;
713
694
  }
714
695
  state = {
715
696
  __kind: "switchBlockSlot",