reactive-md 0.9.0 → 0.9.1

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 (162) hide show
  1. package/CHANGELOG-ch.md +13 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README-ch.md +6 -6
  4. package/README-en.md +6 -6
  5. package/README.md +6 -6
  6. package/SECURITY-ch.md +3 -3
  7. package/SECURITY.md +3 -3
  8. package/THIRD_PARTY_NOTICES.md +111 -1
  9. package/cli/build.mjs +1 -0
  10. package/cli/init.mjs +1 -1
  11. package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
  12. package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
  13. package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
  14. package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
  15. package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
  16. package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
  17. package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
  18. package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
  19. package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
  20. package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
  21. package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
  22. package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
  23. package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
  24. package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
  25. package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
  26. package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
  27. package/dist-library/html-CNT4KD-2.js +757 -0
  28. package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
  29. package/dist-library/layout-C0YlEPGr.js +562 -0
  30. package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
  31. package/dist-library/options-1aDLK7JY.js +121 -0
  32. package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
  33. package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
  34. package/dist-library/react-D5iGiUdL.js +7 -0
  35. package/dist-library/reactive-md-authoring.js +16 -18
  36. package/dist-library/reactive-md-build.js +51 -51
  37. package/dist-library/reactive-md-compiler-standard.js +10 -9
  38. package/dist-library/reactive-md-compiler.js +3 -3
  39. package/dist-library/reactive-md-export.js +4 -4
  40. package/dist-library/reactive-md-minimal-react-preset.js +3 -3
  41. package/dist-library/reactive-md-pdf.js +127 -3
  42. package/dist-library/reactive-md-plugin-chart.js +2 -2
  43. package/dist-library/reactive-md-plugin-data.js +4 -4
  44. package/dist-library/reactive-md-plugin-diagram.js +3 -3
  45. package/dist-library/reactive-md-plugin-forms.js +2 -2
  46. package/dist-library/reactive-md-plugin-gallery.js +2 -2
  47. package/dist-library/reactive-md-plugin-navigation.js +2 -2
  48. package/dist-library/reactive-md-plugin-network.js +117 -115
  49. package/dist-library/reactive-md-plugin-plot.js +3 -3
  50. package/dist-library/reactive-md-react-minimal.js +4 -4
  51. package/dist-library/reactive-md-react-server.js +6 -6
  52. package/dist-library/reactive-md-react-unstyled.js +10 -11
  53. package/dist-library/reactive-md-react.js +10 -11
  54. package/dist-library/reactive-md-sdk.js +3 -3
  55. package/dist-library/reactive-md-standalone-configured.js +2 -2
  56. package/dist-library/reactive-md-standalone-host.js +2 -2
  57. package/dist-library/reactive-md-testing-browser.js +2 -2
  58. package/dist-library/reactive-md-testing-react.js +6 -6
  59. package/dist-library/reactive-md-testing.js +4 -4
  60. package/dist-library/reactive-md.js +280 -193
  61. package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
  62. package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
  63. package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
  64. package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
  65. package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
  66. package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
  67. package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
  68. package/dist-library/types/authoring/catalog.d.ts +1 -2
  69. package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
  70. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
  71. package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
  72. package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
  73. package/dist-library/types/local/compilation/compiler.d.ts +3 -3
  74. package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
  75. package/dist-library/types/local/compilation/streaming.d.ts +27 -0
  76. package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
  77. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
  78. package/dist-library/types/local/configuration/options-core.d.ts +1 -2
  79. package/dist-library/types/local/configuration/options.d.ts +1 -0
  80. package/dist-library/types/local/css/author-css.d.ts +66 -0
  81. package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
  82. package/dist-library/types/local/html/html.d.ts +39 -3
  83. package/dist-library/types/local/index.d.ts +1 -1
  84. package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
  85. package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
  86. package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
  87. package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
  88. package/dist-library/types/local/parsing/parser.d.ts +2 -2
  89. package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
  90. package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
  91. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
  92. package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
  93. package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
  94. package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
  95. package/dist-library/types/local/transport/worker.d.ts +27 -4
  96. package/dist-library/types/local/types.d.ts +52 -16
  97. package/dist-library/types/react/component-api.d.ts +10 -1
  98. package/dist-library/types/react/component-utils.d.ts +9 -1
  99. package/dist-library/types/react/sdk-core.d.ts +4 -1
  100. package/dist-library/types/shareable.d.ts +5 -4
  101. package/dist-library/types/standalone/prepare.d.ts +1 -1
  102. package/dist-library/types/standalone/session-core.d.ts +3 -2
  103. package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
  104. package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
  105. package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
  106. package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
  107. package/dist-standalone/reactive-md-standalone.js +124 -117
  108. package/docs/README-ch.md +2 -1
  109. package/docs/README.md +2 -1
  110. package/docs/compatibility/compatibility-ch.md +6 -6
  111. package/docs/compatibility/compatibility-en.md +6 -6
  112. package/docs/compatibility/source-versioning-ch.md +1 -1
  113. package/docs/compatibility/source-versioning-en.md +1 -1
  114. package/docs/development/component-development-ch.md +2 -2
  115. package/docs/development/component-development-en.md +2 -2
  116. package/docs/development/component-development-reference-ch.md +2 -2
  117. package/docs/development/component-development-reference-en.md +2 -2
  118. package/docs/development/component-protocol-ch.md +2 -2
  119. package/docs/development/component-protocol-en.md +2 -2
  120. package/docs/development/extension-tutorial-ch.md +3 -3
  121. package/docs/development/extension-tutorial-en.md +3 -3
  122. package/docs/integration/author-tools-ch.md +1 -1
  123. package/docs/integration/author-tools-en.md +1 -1
  124. package/docs/integration/compiler-ch.md +3 -1
  125. package/docs/integration/compiler-en.md +3 -1
  126. package/docs/integration/editor-ch.md +3 -3
  127. package/docs/integration/editor-en.md +3 -3
  128. package/docs/integration/extension-sdk-ch.md +2 -2
  129. package/docs/integration/extension-sdk-en.md +2 -2
  130. package/docs/integration/local-integration-ch.md +130 -8
  131. package/docs/integration/local-integration-en.md +130 -8
  132. package/docs/integration/shareable-export-ch.md +4 -2
  133. package/docs/integration/shareable-export-en.md +4 -2
  134. package/docs/reference/html-compatibility-ch.md +20 -67
  135. package/docs/reference/html-compatibility-en.md +19 -64
  136. package/docs/reference/public-api-ch.md +10 -7
  137. package/docs/reference/public-api-en.md +10 -7
  138. package/docs/releases/release-0.9.1-ch.md +29 -0
  139. package/docs/releases/release-0.9.1-en.md +29 -0
  140. package/examples/component-package/README-ch.md +1 -1
  141. package/examples/component-package/README.md +1 -1
  142. package/examples/game-2048-package/README-ch.md +1 -1
  143. package/examples/game-2048-package/README.md +1 -1
  144. package/examples/integration/README-ch.md +21 -2
  145. package/examples/integration/README.md +21 -2
  146. package/examples/integration/extension-sdk/README-ch.md +1 -1
  147. package/examples/integration/extension-sdk/README.md +1 -1
  148. package/examples/integration/streaming/index.html +48 -0
  149. package/examples/integration/streaming/main.js +175 -0
  150. package/examples/integration/streaming/package.json +13 -0
  151. package/examples/integration/streaming/worker.js +3 -0
  152. package/examples/minimal-extension/README-ch.md +3 -3
  153. package/examples/minimal-extension/README.md +3 -3
  154. package/examples/tetris-package/README-ch.md +1 -1
  155. package/examples/tetris-package/README.md +1 -1
  156. package/package.json +6 -1
  157. package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
  158. package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
  159. package/dist-library/component-utils-BvHL8VGt.js +0 -298
  160. package/dist-library/layout-C22VjZh0.js +0 -542
  161. package/dist-library/options-CdSKOi7p.js +0 -116
  162. package/dist-library/react-LY5qsVeP.js +0 -7
@@ -1,119 +1,119 @@
1
1
  import { dt as e } from "./preset-core-CKc5YXSM.js";
2
- import { B as t, H as n, P as r, j as i } from "./config-validation-C5kJYk-J.js";
3
- import { a, c as o, r as s, s as c, t as l } from "./compile-LhpTKqCR.js";
4
- import { a as u, b as d, c as f, h as p, i as m, l as h, n as g, o as _, p as v, r as ee, t as y, u as b, x } from "./validation-BlDL2uD9.js";
5
- import { i as S } from "./registry-core-Bbad9Bm2.js";
6
- import { t as C } from "./registry-05JiqmEp.js";
7
- import { A as te, C as ne, b as w } from "./component-state-BoLCGee4.js";
8
- import { n as T } from "./runtime-B2fxeveq.js";
2
+ import { B as t, H as n, P as r, j as i } from "./config-validation-F47AcE6o.js";
3
+ import { a, c as o, r as s, s as c, t as l } from "./compile-wUv8KEge.js";
4
+ import { C as u, S as d, a as f, c as p, h as m, i as h, l as g, n as _, o as v, p as y, r as b, t as x, u as S } from "./validation-BEBA_HvS.js";
5
+ import { i as C } from "./registry-core-Bbad9Bm2.js";
6
+ import { t as w } from "./registry-B9NGct4d.js";
7
+ import { A as ee, C as te, b as T } from "./component-state-BoLCGee4.js";
8
+ import { n as E } from "./runtime-B2fxeveq.js";
9
9
  // src/local/runtime/runtime-values.ts
10
- function E(e, t) {
10
+ function D(e, t) {
11
11
  return e.attrs?.[t];
12
12
  }
13
- function D(e, t) {
14
- let n = E(e, t);
13
+ function O(e, t) {
14
+ let n = D(e, t);
15
15
  if (n === "true") return !0;
16
16
  if (n === "false") return !1;
17
17
  }
18
- function O(e, t) {
19
- let n = E(e, t);
18
+ function k(e, t) {
19
+ let n = D(e, t);
20
20
  if (n === void 0) return;
21
21
  let r = Number(n);
22
22
  return Number.isFinite(r) ? r : void 0;
23
23
  }
24
- function k(e) {
24
+ function A(e) {
25
25
  return t(e);
26
26
  }
27
- function A(e, t) {
27
+ function j(e, t) {
28
28
  return {
29
29
  ok: !1,
30
30
  detail: r(e, t)
31
31
  };
32
32
  }
33
- function j(e, t) {
34
- if (t !== void 0) return E(e, t);
35
- }
36
33
  function M(e, t) {
37
- if (t !== void 0) return O(e, t);
34
+ if (t !== void 0) return D(e, t);
38
35
  }
39
- function N(t, n, r, i = {}) {
36
+ function N(e, t) {
37
+ if (t !== void 0) return k(e, t);
38
+ }
39
+ function P(t, n, r, i = {}) {
40
40
  for (let a of r) if (a.kind === "date") {
41
- if (!S(n)) return A("local.runtime.value.date-invalid");
42
- let e = i.required ?? (a.required !== void 0 && D(t, a.required) === !0);
43
- if (n === "" && e) return A("local.runtime.value.date-required");
44
- let r = i.min ?? j(t, a.min), o = i.max ?? j(t, a.max);
45
- if (n !== "" && r && n < r) return A("local.runtime.value.date-earlier", { min: r });
46
- if (n !== "" && o && n > o) return A("local.runtime.value.date-later", { max: o });
41
+ if (!C(n)) return j("local.runtime.value.date-invalid");
42
+ let e = i.required ?? (a.required !== void 0 && O(t, a.required) === !0);
43
+ if (n === "" && e) return j("local.runtime.value.date-required");
44
+ let r = i.min ?? M(t, a.min), o = i.max ?? M(t, a.max);
45
+ if (n !== "" && r && n < r) return j("local.runtime.value.date-earlier", { min: r });
46
+ if (n !== "" && o && n > o) return j("local.runtime.value.date-later", { max: o });
47
47
  } else if (a.kind === "required") {
48
- let e = i.required ?? D(t, a.required) === !0;
49
- if (n === "" && e) return A("local.runtime.value.field-required");
48
+ let e = i.required ?? O(t, a.required) === !0;
49
+ if (n === "" && e) return j("local.runtime.value.field-required");
50
50
  } else if (a.kind === "length") {
51
- let e = k(n), r = M(t, a.min), i = M(t, a.max);
52
- if (r !== void 0 && r > 0 && n !== "" && e < r) return A("local.runtime.value.min-length", { min: r });
53
- if (i !== void 0 && e > i) return A("local.runtime.value.max-length", { max: i });
54
- } else if (a.kind === "email" && (j(t, a.type) ?? "text") === a.value && n !== "") {
55
- if (n.length > 254) return A("local.runtime.value.email-length", { limit: 254 });
56
- if (!e(n)) return A("local.runtime.value.email-invalid");
51
+ let e = A(n), r = N(t, a.min), i = N(t, a.max);
52
+ if (r !== void 0 && r > 0 && n !== "" && e < r) return j("local.runtime.value.min-length", { min: r });
53
+ if (i !== void 0 && e > i) return j("local.runtime.value.max-length", { max: i });
54
+ } else if (a.kind === "email" && (M(t, a.type) ?? "text") === a.value && n !== "") {
55
+ if (n.length > 254) return j("local.runtime.value.email-length", { limit: 254 });
56
+ if (!e(n)) return j("local.runtime.value.email-invalid");
57
57
  }
58
58
  return {
59
59
  ok: !0,
60
60
  value: n
61
61
  };
62
62
  }
63
- var P = /* @__PURE__ */ new Map();
64
- function F(e) {
65
- if (!e.name) return I;
66
- let t = P.get(e.name);
67
- if (t !== void 0) return t ?? I;
68
- let n = C(e.name), r = n ? p(n) : I;
69
- return P.set(e.name, n ? r : null), r;
63
+ var F = /* @__PURE__ */ new Map();
64
+ function I(e) {
65
+ if (!e.name) return L;
66
+ let t = F.get(e.name);
67
+ if (t !== void 0) return t ?? L;
68
+ let n = w(e.name), r = n ? m(n) : L;
69
+ return F.set(e.name, n ? r : null), r;
70
70
  }
71
- var I = Object.freeze([]);
72
- function L(e, t, n, r, a, s = !1) {
71
+ var L = Object.freeze([]);
72
+ function R(e, t, n, r, a, s = !1) {
73
73
  switch (e.type) {
74
74
  case "number": {
75
- if (typeof n != "number" || !Number.isFinite(n)) return A("local.runtime.value.finite-number", { name: e.name });
75
+ if (typeof n != "number" || !Number.isFinite(n)) return j("local.runtime.value.finite-number", { name: e.name });
76
76
  let i = e.step ?? 1, a = e.min ?? 0;
77
77
  for (let i of t) {
78
78
  let t = r(i, "min");
79
- if (t.present && !t.ok) return A("local.runtime.value.constraint", {
79
+ if (t.present && !t.ok) return j("local.runtime.value.constraint", {
80
80
  name: e.name,
81
81
  attribute: "min"
82
82
  });
83
83
  if (t.present && t.ok) {
84
- if (typeof t.value != "number" || !Number.isFinite(t.value)) return A("local.runtime.value.constraint", {
84
+ if (typeof t.value != "number" || !Number.isFinite(t.value)) return j("local.runtime.value.constraint", {
85
85
  name: e.name,
86
86
  attribute: "min"
87
87
  });
88
- if (a = t.value, n < t.value) return A("local.runtime.value.min", {
88
+ if (a = t.value, n < t.value) return j("local.runtime.value.min", {
89
89
  name: e.name,
90
90
  min: t.value
91
91
  });
92
92
  }
93
93
  let o = r(i, "max");
94
- if (o.present && !o.ok) return A("local.runtime.value.constraint", {
94
+ if (o.present && !o.ok) return j("local.runtime.value.constraint", {
95
95
  name: e.name,
96
96
  attribute: "max"
97
97
  });
98
98
  if (o.present && o.ok) {
99
- if (typeof o.value != "number" || !Number.isFinite(o.value)) return A("local.runtime.value.constraint", {
99
+ if (typeof o.value != "number" || !Number.isFinite(o.value)) return j("local.runtime.value.constraint", {
100
100
  name: e.name,
101
101
  attribute: "max"
102
102
  });
103
- if (n > o.value) return A("local.runtime.value.max", {
103
+ if (n > o.value) return j("local.runtime.value.max", {
104
104
  name: e.name,
105
105
  max: o.value
106
106
  });
107
107
  }
108
- if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return A("local.runtime.value.constraint-range", { name: e.name });
108
+ if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return j("local.runtime.value.constraint-range", { name: e.name });
109
109
  }
110
- return e.min !== void 0 && n < e.min ? A("local.runtime.value.min", {
110
+ return e.min !== void 0 && n < e.min ? j("local.runtime.value.min", {
111
111
  name: e.name,
112
112
  min: e.min
113
- }) : e.max !== void 0 && n > e.max ? A("local.runtime.value.max", {
113
+ }) : e.max !== void 0 && n > e.max ? j("local.runtime.value.max", {
114
114
  name: e.name,
115
115
  max: e.max
116
- }) : i > 0 && !B(n, a, i) ? A("local.runtime.value.step", {
116
+ }) : i > 0 && !V(n, a, i) ? j("local.runtime.value.step", {
117
117
  name: e.name,
118
118
  step: i,
119
119
  base: a
@@ -125,18 +125,18 @@ function L(e, t, n, r, a, s = !1) {
125
125
  case "boolean": return typeof n == "boolean" ? {
126
126
  ok: !0,
127
127
  value: n
128
- } : A("local.runtime.value.boolean", { name: e.name });
128
+ } : j("local.runtime.value.boolean", { name: e.name });
129
129
  case "string": {
130
- if (typeof n != "string") return A("local.runtime.value.string", { name: e.name });
130
+ if (typeof n != "string") return j("local.runtime.value.string", { name: e.name });
131
131
  let c = o(n);
132
- if (c) return A("local.runtime.value.budget", {
132
+ if (c) return j("local.runtime.value.budget", {
133
133
  name: e.name,
134
134
  detail: i(c),
135
135
  detailKey: c.key,
136
136
  ...c.params
137
137
  });
138
138
  for (let i of t) {
139
- let t = a?.get(i.id) ?? (s ? F(i) : I);
139
+ let t = a?.get(i.id) ?? (s ? I(i) : L);
140
140
  if (!t.length) continue;
141
141
  let o = {};
142
142
  for (let n of t) {
@@ -145,20 +145,20 @@ function L(e, t, n, r, a, s = !1) {
145
145
  if (n[t] === void 0) continue;
146
146
  let a = r(i, t);
147
147
  if (a.present) {
148
- if (!a.ok || typeof a.value != "string" || !S(a.value)) return A("local.runtime.value.constraint-date", {
148
+ if (!a.ok || typeof a.value != "string" || !C(a.value)) return j("local.runtime.value.constraint-date", {
149
149
  name: e.name,
150
150
  attribute: t
151
151
  });
152
152
  o[t] = a.value;
153
153
  }
154
154
  }
155
- let t = o.min ?? j(i, n.min), a = o.max ?? j(i, n.max);
156
- if (t && a && S(t) && S(a) && t > a) return A("local.runtime.value.constraint-range", { name: e.name });
155
+ let t = o.min ?? M(i, n.min), a = o.max ?? M(i, n.max);
156
+ if (t && a && C(t) && C(a) && t > a) return j("local.runtime.value.constraint-range", { name: e.name });
157
157
  }
158
158
  if ((n.kind === "date" || n.kind === "required" ? n.required : void 0) !== void 0) {
159
159
  let t = r(i, "required");
160
160
  if (t.present) {
161
- if (!t.ok || typeof t.value != "boolean") return A("local.runtime.value.constraint", {
161
+ if (!t.ok || typeof t.value != "boolean") return j("local.runtime.value.constraint", {
162
162
  name: e.name,
163
163
  attribute: "required"
164
164
  });
@@ -166,10 +166,10 @@ function L(e, t, n, r, a, s = !1) {
166
166
  }
167
167
  }
168
168
  }
169
- let c = N(i, n, t, o);
169
+ let c = P(i, n, t, o);
170
170
  if (!c.ok) return c;
171
171
  }
172
- return e.options?.length && !e.options.includes(n) ? A("local.runtime.value.option", {
172
+ return e.options?.length && !e.options.includes(n) ? j("local.runtime.value.option", {
173
173
  value: n,
174
174
  options: e.options.join(", ")
175
175
  }) : {
@@ -178,16 +178,16 @@ function L(e, t, n, r, a, s = !1) {
178
178
  };
179
179
  }
180
180
  case "array": {
181
- if (!Array.isArray(n)) return A("local.runtime.value.array", { name: e.name });
181
+ if (!Array.isArray(n)) return j("local.runtime.value.array", { name: e.name });
182
182
  let t = o(n);
183
- if (t) return A("local.runtime.value.budget", {
183
+ if (t) return j("local.runtime.value.budget", {
184
184
  name: e.name,
185
185
  detail: i(t),
186
186
  detailKey: t.key,
187
187
  ...t.params
188
188
  });
189
- for (let t of n) if (typeof t != "string") return A("local.runtime.value.array-members", { name: e.name });
190
- if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
189
+ for (let t of n) if (typeof t != "string") return j("local.runtime.value.array-members", { name: e.name });
190
+ if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
191
191
  name: e.name,
192
192
  max: e.maxItems
193
193
  }) : {
@@ -196,11 +196,11 @@ function L(e, t, n, r, a, s = !1) {
196
196
  };
197
197
  let r = /* @__PURE__ */ new Set();
198
198
  for (let t of n) {
199
- if (e.options && !e.options.includes(t)) return A("local.runtime.value.checklist-option", { value: t });
199
+ if (e.options && !e.options.includes(t)) return j("local.runtime.value.checklist-option", { value: t });
200
200
  r.add(t);
201
201
  }
202
202
  let a = e.options ? e.options.filter((e) => r.has(e)) : [...r];
203
- return e.maxItems !== void 0 && a.length > e.maxItems ? A("local.runtime.value.max-items", {
203
+ return e.maxItems !== void 0 && a.length > e.maxItems ? j("local.runtime.value.max-items", {
204
204
  name: e.name,
205
205
  max: e.maxItems
206
206
  }) : {
@@ -209,16 +209,16 @@ function L(e, t, n, r, a, s = !1) {
209
209
  };
210
210
  }
211
211
  case "number-array": {
212
- if (!Array.isArray(n)) return A("local.runtime.value.number-array", { name: e.name });
212
+ if (!Array.isArray(n)) return j("local.runtime.value.number-array", { name: e.name });
213
213
  let t = o(n);
214
- if (t) return A("local.runtime.value.budget", {
214
+ if (t) return j("local.runtime.value.budget", {
215
215
  name: e.name,
216
216
  detail: i(t),
217
217
  detailKey: t.key,
218
218
  ...t.params
219
219
  });
220
- for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return A("local.runtime.value.number-array-members", { name: e.name });
221
- return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
220
+ for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return j("local.runtime.value.number-array-members", { name: e.name });
221
+ return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
222
222
  name: e.name,
223
223
  max: e.maxItems
224
224
  }) : {
@@ -229,14 +229,14 @@ function L(e, t, n, r, a, s = !1) {
229
229
  case "null": return n === null ? {
230
230
  ok: !0,
231
231
  value: n
232
- } : A("local.runtime.value.null", { name: e.name });
232
+ } : j("local.runtime.value.null", { name: e.name });
233
233
  }
234
- return A("local.runtime.value.unsupported-type", { name: e.name });
234
+ return j("local.runtime.value.unsupported-type", { name: e.name });
235
235
  }
236
- function re(e) {
236
+ function ne(e) {
237
237
  return e instanceof a ? e : new a("expression-eval", e instanceof Error ? e.message : String(e), 0);
238
238
  }
239
- function ie(e, t) {
239
+ function re(e, t) {
240
240
  switch (e) {
241
241
  case "string": {
242
242
  if (typeof t != "string") return {
@@ -328,15 +328,15 @@ function ie(e, t) {
328
328
  };
329
329
  }
330
330
  }
331
- var R = 1e-9;
332
- function z(e) {
331
+ var z = 1e-9;
332
+ function B(e) {
333
333
  return Array.isArray(e) ? e.slice() : e;
334
334
  }
335
- function B(e, t, n) {
335
+ function V(e, t, n) {
336
336
  let r = (e - t) / n;
337
- return Math.abs(r - Math.round(r)) <= R * Math.max(1, Math.abs(r));
337
+ return Math.abs(r - Math.round(r)) <= z * Math.max(1, Math.abs(r));
338
338
  }
339
- function V(e, t, n, r) {
339
+ function H(e, t, n, r) {
340
340
  let a = Math.max(0, Math.min(e.source.length, t.range.start)), o = e.source.slice(0, a).split("\n");
341
341
  return {
342
342
  code: n,
@@ -352,7 +352,7 @@ function V(e, t, n, r) {
352
352
  ...r.params ? { params: r.params } : {}
353
353
  };
354
354
  }
355
- function H(e, t, n) {
355
+ function U(e, t, n) {
356
356
  return {
357
357
  code: e,
358
358
  message: t,
@@ -370,7 +370,7 @@ function H(e, t, n) {
370
370
  };
371
371
  }
372
372
  // src/local/runtime/runtime-document.ts
373
- function U(e, t) {
373
+ function W(e, t) {
374
374
  let n = e.document.bindings[t];
375
375
  if (!n) return;
376
376
  let { nodeIds: r, owner: i, ...a } = n, o = (e.controls.get(t) ?? []).map((t) => {
@@ -391,7 +391,7 @@ function U(e, t) {
391
391
  controls: o
392
392
  });
393
393
  }
394
- function ae(e, t) {
394
+ function ie(e, t) {
395
395
  let n = t.get(e);
396
396
  if (n) return {
397
397
  expression: n,
@@ -410,18 +410,18 @@ function ae(e, t) {
410
410
  } catch (e) {
411
411
  return {
412
412
  expression: null,
413
- error: re(e)
413
+ error: ne(e)
414
414
  };
415
415
  }
416
416
  }
417
- function oe(e, t) {
417
+ function ae(e, t) {
418
418
  let r = /* @__PURE__ */ new Map();
419
419
  for (let t of n(e.nodes)) r.set(t.id, t);
420
420
  let s = {}, l = /* @__PURE__ */ new Map();
421
421
  for (let [t, n] of Object.entries(e.bindings)) {
422
422
  let e = o(n.initial);
423
423
  if (e) throw new a("expression-budget", `Parameter "${t}": ${i(e)}`, 0);
424
- s[t] = z(n.initial);
424
+ s[t] = B(n.initial);
425
425
  let c = [];
426
426
  for (let e of n.nodeIds) {
427
427
  let t = r.get(e);
@@ -429,11 +429,11 @@ function oe(e, t) {
429
429
  }
430
430
  l.set(t, c);
431
431
  }
432
- let d = /* @__PURE__ */ new Map();
433
- for (let [t, n] of Object.entries(e.bindingSlots ?? {})) d.set(t, { ...n });
434
- let f = v(e), p = new Map(Object.entries(f?.valueRules ?? {})), m = f === void 0, h = /* @__PURE__ */ new Map();
435
- if (f) for (let e of f.slotRelations) {
436
- let t = d.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
432
+ let u = /* @__PURE__ */ new Map();
433
+ for (let [t, n] of Object.entries(e.bindingSlots ?? {})) u.set(t, { ...n });
434
+ let d = y(e), p = new Map(Object.entries(d?.valueRules ?? {})), m = d === void 0, h = /* @__PURE__ */ new Map();
435
+ if (d) for (let e of d.slotRelations) {
436
+ let t = u.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
437
437
  if (!n || !r) continue;
438
438
  let i = h.get(e.nodeId) ?? [];
439
439
  i.push({
@@ -441,60 +441,60 @@ function oe(e, t) {
441
441
  upper: r
442
442
  }), h.set(e.nodeId, i);
443
443
  }
444
- else for (let [e, t] of d) t.start && t.end && h.set(e, [{
444
+ else for (let [e, t] of u) t.start && t.end && h.set(e, [{
445
445
  lower: t.start,
446
446
  upper: t.end
447
447
  }]);
448
448
  let g = /* @__PURE__ */ new Map();
449
449
  for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
450
- if (d.has(e)) continue;
450
+ if (u.has(e)) continue;
451
451
  let n = g.get(e);
452
452
  (n === void 0 || n.startsWith("@") && !t.startsWith("@")) && g.set(e, t);
453
453
  }
454
- let ee = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), y = /* @__PURE__ */ new Map();
455
- for (let [e, t] of d) for (let n of Object.values(t)) {
454
+ let _ = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
455
+ for (let [e, t] of u) for (let n of Object.values(t)) {
456
456
  if (n.startsWith("@")) continue;
457
- let t = y.get(n) ?? /* @__PURE__ */ new Set();
458
- t.add(e), y.set(n, t);
457
+ let t = b.get(n) ?? /* @__PURE__ */ new Set();
458
+ t.add(e), b.set(n, t);
459
459
  }
460
- let x = e.computations ?? {}, S = Object.keys(x), C = /* @__PURE__ */ new Map();
460
+ let x = e.computations ?? {}, C = Object.keys(x), w = /* @__PURE__ */ new Map();
461
461
  for (let [e, n] of Object.entries(x)) {
462
- let r = ae(n.source, t);
463
- r.expression && C.set(e, r.expression);
462
+ let r = ie(n.source, t);
463
+ r.expression && w.set(e, r.expression);
464
464
  }
465
- let { order: te, cyclic: ne } = b(x), w = {}, T = /* @__PURE__ */ new Map();
466
- for (let e of te) {
465
+ let { order: ee, cyclic: te } = S(x), T = {}, E = /* @__PURE__ */ new Map();
466
+ for (let e of ee) {
467
467
  let t = x[e];
468
468
  if (!t || t.kind !== "const") continue;
469
469
  if (Object.hasOwn(t, "value")) {
470
470
  let n = t.value, r = c(n);
471
471
  if (r) {
472
- T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
472
+ E.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
473
473
  continue;
474
474
  }
475
- w[e] = z(n);
475
+ T[e] = B(n);
476
476
  continue;
477
477
  }
478
- let n = C.get(e);
479
- if (!n) T.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
478
+ let n = w.get(e);
479
+ if (!n) E.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
480
480
  else try {
481
- let t = n.evaluate({ ...w }), r = c(t);
481
+ let t = n.evaluate({ ...T }), r = c(t);
482
482
  if (r) {
483
- T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
483
+ E.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
484
484
  continue;
485
485
  }
486
- w[e] = z(t);
486
+ T[e] = B(t);
487
487
  } catch (t) {
488
- T.set(e, re(t));
488
+ E.set(e, ne(t));
489
489
  }
490
490
  }
491
- let E = /* @__PURE__ */ new Map();
492
- for (let e of ne) E.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
493
- let D = [];
491
+ let D = /* @__PURE__ */ new Map();
492
+ for (let e of te) D.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
493
+ let O = [];
494
494
  if (Array.isArray(e.validations)) for (let n of e.validations) {
495
- if (!u(n)) continue;
496
- let e = ae(n.expression, t);
497
- D.push({
495
+ if (!f(n)) continue;
496
+ let e = ie(n.expression, t);
497
+ O.push({
498
498
  rule: n,
499
499
  expression: e.expression,
500
500
  error: e.error
@@ -504,66 +504,66 @@ function oe(e, t) {
504
504
  document: e,
505
505
  nodeIndex: r,
506
506
  controls: l,
507
- slotKeys: d,
508
- publicNames: ee,
509
- publicSlotOwners: y,
507
+ slotKeys: u,
508
+ publicNames: _,
509
+ publicSlotOwners: b,
510
510
  initial: s,
511
511
  valueRules: p,
512
512
  legacyValueRules: m,
513
513
  slotRelations: h,
514
514
  bindingByNode: g,
515
515
  computationMetadata: x,
516
- computationNames: S,
517
- computationOrder: te,
518
- cyclicComputations: ne,
519
- computationExpressions: C,
520
- constValues: w,
521
- constErrors: T,
522
- cycleErrors: E,
523
- validationRules: D,
524
- validationLineStarts: _(typeof e.source == "string" ? e.source : "")
516
+ computationNames: C,
517
+ computationOrder: ee,
518
+ cyclicComputations: te,
519
+ computationExpressions: w,
520
+ constValues: T,
521
+ constErrors: E,
522
+ cycleErrors: D,
523
+ validationRules: O,
524
+ validationLineStarts: v(typeof e.source == "string" ? e.source : "")
525
525
  };
526
526
  }
527
- function se(e) {
527
+ function oe(e) {
528
528
  return !e || e.syntax !== "local" ? "createLocalRuntime requires a local interaction document." : e.syntaxVersion !== void 0 && e.syntaxVersion !== "local-draft-3" || e.versionDeclaration && e.versionDeclaration.version !== "local-draft-3" ? `createLocalRuntime requires ${d}; migrate the source before constructing a runtime.` : null;
529
529
  }
530
- function W(e, t) {
530
+ function G(e, t) {
531
531
  return (e.controls.get(t.name) ?? [])[0] ?? (t.owner ? e.nodeIndex.get(t.owner) : void 0) ?? (t.nodeIds[0] ? e.nodeIndex.get(t.nodeIds[0]) : void 0);
532
532
  }
533
- function ce(e, t, n) {
534
- let r = W(e, t);
535
- return r ? V(e.document, r, "local.runtime.value", n) : H("local.runtime.value", i(n));
533
+ function se(e, t, n) {
534
+ let r = G(e, t);
535
+ return r ? H(e.document, r, "local.runtime.value", n) : U("local.runtime.value", i(n));
536
536
  }
537
- function G(e, t, n) {
537
+ function K(e, t, n) {
538
538
  let r = e.slotRelations.get(t);
539
539
  return r?.length ? r.some(({ lower: e, upper: t }) => {
540
540
  let r = n[e], i = n[t];
541
541
  return typeof r == "number" && typeof i == "number" && r > i;
542
542
  }) : !1;
543
543
  }
544
- function le(e, t) {
544
+ function ce(e, t) {
545
545
  let n = e.nodeIndex.get(t);
546
- return n ? V(e.document, n, "local.runtime.value", r("local.runtime.value.range-order")) : H("local.runtime.value", i(r("local.runtime.value.range-order")));
546
+ return n ? H(e.document, n, "local.runtime.value", r("local.runtime.value.range-order")) : U("local.runtime.value", i(r("local.runtime.value.range-order")));
547
547
  }
548
548
  // src/local/runtime/retention.ts
549
- function K(e) {
549
+ function q(e) {
550
550
  let t = /* @__PURE__ */ new Map();
551
551
  for (let r of n(e.nodes)) t.set(r.id, r);
552
552
  return t;
553
553
  }
554
- function ue(e, t, n) {
554
+ function le(e, t, n) {
555
555
  let r = e.bindingSlots?.[t.id];
556
556
  return r !== void 0 && Object.values(r).includes(n);
557
557
  }
558
- function q(e, t, n) {
559
- let r = t.name ? C(t.name) : void 0;
558
+ function J(e, t, n) {
559
+ let r = t.name ? w(t.name) : void 0;
560
560
  if (r?.bindings) {
561
561
  let i = e.bindingSlots?.[t.id];
562
562
  for (let [e, a] of Object.entries(r.bindings)) if (t.attrs?.[a.bind] === n || e !== "value" && i?.[e] === n) return a.retain === !1 ? void 0 : a.initial;
563
- } else if (t.attrs?.bind === n || ue(e, t, n)) return "initial";
563
+ } else if (t.attrs?.bind === n || le(e, t, n)) return "initial";
564
564
  }
565
- function J(e) {
566
- let t = K(e), n = v(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
565
+ function Y(e) {
566
+ let t = q(e), n = y(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
567
567
  for (let [a, o] of Object.entries(e.bindings)) {
568
568
  let s = o.nodeIds.flatMap((e) => {
569
569
  let n = t.get(e);
@@ -572,7 +572,7 @@ function J(e) {
572
572
  if (!s.length || a.startsWith("@") || r.has(a)) continue;
573
573
  let c;
574
574
  if (n === void 0) {
575
- let t = s.map((t) => q(e, t, a));
575
+ let t = s.map((t) => J(e, t, a));
576
576
  if (t.some((e) => e === void 0)) continue;
577
577
  c = t;
578
578
  } else {
@@ -587,34 +587,34 @@ function J(e) {
587
587
  }
588
588
  return i;
589
589
  }
590
- function Y(e, t) {
590
+ function X(e, t) {
591
591
  return Object.freeze({
592
592
  name: e,
593
593
  reason: t
594
594
  });
595
595
  }
596
- function X(e) {
597
- let t = J(e.previous), n = J(e.next), r = {}, i = [], a = [];
596
+ function Z(e) {
597
+ let t = Y(e.previous), n = Y(e.next), r = {}, i = [], a = [];
598
598
  for (let o of Object.keys(e.state).sort()) {
599
599
  if (o.startsWith("@")) {
600
- a.push(Y(o, "internal"));
600
+ a.push(X(o, "internal"));
601
601
  continue;
602
602
  }
603
603
  if (!Object.hasOwn(e.previous.bindings, o) || !Object.hasOwn(e.next.bindings, o)) {
604
- a.push(Y(o, "unknown"));
604
+ a.push(X(o, "unknown"));
605
605
  continue;
606
606
  }
607
607
  let s = t.get(o), c = n.get(o);
608
608
  if (!s || !c) {
609
- a.push(Y(o, "unretainable"));
609
+ a.push(X(o, "unretainable"));
610
610
  continue;
611
611
  }
612
612
  if (s.type !== c.type) {
613
- a.push(Y(o, "type"));
613
+ a.push(X(o, "type"));
614
614
  continue;
615
615
  }
616
616
  if (s.initialDefinition !== c.initialDefinition) {
617
- a.push(Y(o, "initial"));
617
+ a.push(X(o, "initial"));
618
618
  continue;
619
619
  }
620
620
  let l = e.state[o];
@@ -626,7 +626,7 @@ function X(e) {
626
626
  dropped: Object.freeze(a)
627
627
  });
628
628
  }
629
- function Z(e, t, n) {
629
+ function ue(e, t, n) {
630
630
  return Object.freeze({
631
631
  retained: Object.freeze([...e]),
632
632
  dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
@@ -635,7 +635,7 @@ function Z(e, t, n) {
635
635
  }
636
636
  function Q(e, t) {
637
637
  let n = Object.keys(t.values).sort();
638
- if (!e.setParameters(t.values).length) return Z(n, t.dropped, []);
638
+ if (!e.setParameters(t.values).length) return ue(n, t.dropped, []);
639
639
  let r = [], i = n, a = [];
640
640
  for (; i.length;) {
641
641
  let n = [];
@@ -648,32 +648,32 @@ function Q(e, t) {
648
648
  i = n;
649
649
  }
650
650
  r.sort();
651
- let o = [...t.dropped, ...i.map((e) => Y(e, "invalid"))];
652
- return o.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), Z(r, o, a);
651
+ let o = [...t.dropped, ...i.map((e) => X(e, "invalid"))];
652
+ return o.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), ue(r, o, a);
653
653
  }
654
654
  // src/local/runtime/runtime-migration.ts
655
655
  function de(e, t, n, r, i) {
656
- let a = X({
656
+ let a = Z({
657
657
  previous: e.document,
658
658
  state: t,
659
659
  next: n
660
660
  }), o = {};
661
- for (let [e, t] of Object.entries(n.bindings)) o[e] = z(t.initial);
661
+ for (let [e, t] of Object.entries(n.bindings)) o[e] = B(t.initial);
662
662
  let s = /* @__PURE__ */ new Map();
663
663
  for (let e of a.dropped) s.set(e.name, Object.freeze({ ...e }));
664
664
  let c = [], l = {}, u = [], d = /* @__PURE__ */ new Set(), f, p = (n) => {
665
665
  let o = e.document.bindings[n], s = e.controls.get(n) ?? [];
666
- return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t), L(o, s, a.values[n], f, e.valueRules, e.legacyValueRules).ok) ? !1 : U(e, n) === U(r, n);
666
+ return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t), R(o, s, a.values[n], f, e.valueRules, e.legacyValueRules).ok) ? !1 : W(e, n) === W(r, n);
667
667
  };
668
668
  for (let e of a.retained) {
669
669
  let t = n.bindings[e];
670
670
  if (!t) continue;
671
671
  if (p(e)) {
672
- d.add(e), l[e] = z(a.values[e]), u.push(e);
672
+ d.add(e), l[e] = B(a.values[e]), u.push(e);
673
673
  continue;
674
674
  }
675
- let f = L(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
676
- f.ok ? (l[e] = z(f.value), u.push(e)) : (c.push(ce(r, t, f.detail)), s.set(e, Object.freeze({
675
+ let f = R(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
676
+ f.ok ? (l[e] = B(f.value), u.push(e)) : (c.push(se(r, t, f.detail)), s.set(e, Object.freeze({
677
677
  name: e,
678
678
  reason: "invalid"
679
679
  })));
@@ -684,7 +684,7 @@ function de(e, t, n, r, i) {
684
684
  }, h = /* @__PURE__ */ new Set();
685
685
  for (let e of u) for (let t of r.publicSlotOwners.get(e) ?? []) h.add(t);
686
686
  let g = !1;
687
- for (let e of [...h].sort()) if (G(r, e, m)) {
687
+ for (let e of [...h].sort()) if (K(r, e, m)) {
688
688
  g = !0;
689
689
  break;
690
690
  }
@@ -696,25 +696,25 @@ function de(e, t, n, r, i) {
696
696
  let t = o[e];
697
697
  o[e] = l[e];
698
698
  let n = !1;
699
- for (let t of [...r.publicSlotOwners.get(e) ?? []].sort()) G(r, t, o) && (c.push(le(r, t)), n = !0);
699
+ for (let t of [...r.publicSlotOwners.get(e) ?? []].sort()) K(r, t, o) && (c.push(ce(r, t)), n = !0);
700
700
  n ? (o[e] = t, s.set(e, Object.freeze({
701
701
  name: e,
702
702
  reason: "invalid"
703
703
  }))) : _.push(e);
704
704
  }
705
705
  }
706
- for (let [e, t] of r.slotRelations) if (G(r, e, o)) {
706
+ for (let [e, t] of r.slotRelations) if (K(r, e, o)) {
707
707
  for (let e of t) for (let t of [e.lower, e.upper]) {
708
708
  let e = n.bindings[t];
709
709
  if (!e) continue;
710
- o[t] = z(e.initial);
710
+ o[t] = B(e.initial);
711
711
  let r = _.indexOf(t);
712
712
  r >= 0 && _.splice(r, 1), s.set(t, Object.freeze({
713
713
  name: t,
714
714
  reason: "invalid"
715
715
  }));
716
716
  }
717
- if (c.push(le(r, e)), G(r, e, o)) return {
717
+ if (c.push(ce(r, e)), K(r, e, o)) return {
718
718
  values: {},
719
719
  retained: [],
720
720
  dropped: [],
@@ -726,20 +726,20 @@ function de(e, t, n, r, i) {
726
726
  let e = i({}, r, o), t = [];
727
727
  for (let i of _) {
728
728
  if (d.has(i)) continue;
729
- let a = n.bindings[i], s = L(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
730
- s.ok || (c.push(ce(r, a, s.detail)), t.push(i));
729
+ let a = n.bindings[i], s = R(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
730
+ s.ok || (c.push(se(r, a, s.detail)), t.push(i));
731
731
  }
732
- for (let e of t) o[e] = z(n.bindings[e].initial), _.splice(_.indexOf(e), 1), s.set(e, Object.freeze({
732
+ for (let e of t) o[e] = B(n.bindings[e].initial), _.splice(_.indexOf(e), 1), s.set(e, Object.freeze({
733
733
  name: e,
734
734
  reason: "invalid"
735
735
  }));
736
736
  v = t.length > 0;
737
737
  }
738
- let ee = [...s.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
738
+ let y = [...s.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
739
739
  return _.sort(), {
740
740
  values: o,
741
741
  retained: _,
742
- dropped: ee,
742
+ dropped: y,
743
743
  diagnostics: c
744
744
  };
745
745
  }
@@ -780,50 +780,50 @@ function ve(e, t, n) {
780
780
  return he.get(e)?.bindNetworkExternals(t, n) ?? (() => {});
781
781
  }
782
782
  function ye(e, t) {
783
- let c = se(e);
783
+ let c = oe(e);
784
784
  if (c) throw Error(c);
785
- let u = t?.services === void 0, d = te(t?.network), p = /* @__PURE__ */ new Map(), _ = ne(e.source), v = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), S = oe(e, b), C = () => S, E = () => {
785
+ let d = t?.services === void 0, f = ee(t?.network), m = /* @__PURE__ */ new Map(), v = te(e.source), y = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), C = ae(e, S), w = () => C, D = () => {
786
786
  let e = /* @__PURE__ */ new Set();
787
- for (let r of n(S.document.nodes)) r.name !== void 0 && e.add(w({
787
+ for (let r of n(C.document.nodes)) r.name !== void 0 && e.add(T({
788
788
  documentId: t?.documentId,
789
- sourceDigest: _,
789
+ sourceDigest: v,
790
790
  nodeId: r.id,
791
791
  stateKey: r.attrs?.["state-key"]
792
792
  }));
793
793
  return e;
794
- }, D = t?.services ?? T({
794
+ }, O = t?.services ?? E({
795
795
  documentId: t?.documentId,
796
- sourceDigest: _,
796
+ sourceDigest: v,
797
797
  randomSeed: t?.randomSeed,
798
798
  componentState: t?.componentState,
799
799
  ...t?.componentStateStorage === void 0 ? {} : { componentStateStorage: t.componentStateStorage },
800
800
  ...t?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: t.componentStateWriteDelayMs },
801
801
  ...t?.configKey === void 0 ? {} : { configKey: t.configKey },
802
802
  ...t?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: t.legacyConfigKeys },
803
- ...u ? { knownStateKeys: E } : {}
804
- }), O = {}, k = /* @__PURE__ */ new Map();
803
+ ...d ? { knownStateKeys: D } : {}
804
+ }), k = {}, A = /* @__PURE__ */ new Map();
805
805
  for (let [n, r] of Object.entries(e.externals ?? {})) {
806
806
  let e = t?.externalValues?.[n];
807
807
  if (e === void 0) continue;
808
- let i = ie(r.type, e);
809
- i.ok && (O[n] = i.value);
808
+ let i = re(r.type, e);
809
+ i.ok && (k[n] = i.value);
810
810
  }
811
- let A = (e, t) => {
811
+ let j = (e, t) => {
812
812
  let n = {};
813
813
  for (let [r, i] of Object.entries(e.document.externals ?? {})) {
814
814
  if (!Object.hasOwn(t, r)) continue;
815
- let e = ie(i.type, t[r]);
815
+ let e = re(i.type, t[r]);
816
816
  e.ok && (n[r] = e.value);
817
817
  }
818
818
  return n;
819
- }, j = (e) => {
820
- let t = A(e, O);
821
- for (let n of k.keys()) Object.assign(t, A(e, n));
819
+ }, M = (e) => {
820
+ let t = j(e, k);
821
+ for (let n of A.keys()) Object.assign(t, j(e, n));
822
822
  return t;
823
- }, M = (e, t, n, r = C()) => {
823
+ }, N = (e, t, n, r = w()) => {
824
824
  let i = r.document.dynamicConstraints?.[e.id]?.[t];
825
825
  if (!i) return { present: !1 };
826
- let a = ae(i.source, b);
826
+ let a = ie(i.source, S);
827
827
  if (!a.expression) return {
828
828
  present: !0,
829
829
  ok: !1
@@ -844,21 +844,21 @@ function ye(e, t) {
844
844
  ok: !1
845
845
  };
846
846
  }
847
- }, N = S.initial, P = 0, F = {}, I = {}, re = {
847
+ }, P = C.initial, F = 0, I = {}, L = {}, ne = {
848
848
  revision: 0,
849
849
  state: me({})
850
- }, R = !1, B = null, U = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Map(), K = () => {
851
- if (R) throw Error("The local interaction runtime has been disposed.");
850
+ }, z = !1, V = null, W = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), q = () => {
851
+ if (z) throw Error("The local interaction runtime has been disposed.");
852
852
  };
853
- function ue(e, t) {
854
- if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(N, t) ? N[t] : void 0;
853
+ function le(e, t) {
854
+ if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(P, t) ? P[t] : void 0;
855
855
  }
856
- let q = (e, t) => {
857
- let n = j(e), r = /* @__PURE__ */ new Map();
856
+ let J = (e, t) => {
857
+ let n = M(e), r = /* @__PURE__ */ new Map();
858
858
  for (let t of Object.keys(e.document.externals ?? {})) Object.hasOwn(n, t) || r.set(t, new a("external-missing", "External data \"" + t + "\" is not available.", 0));
859
859
  let i = {}, o = /* @__PURE__ */ new Map();
860
860
  if (e.computationNames.length > 0) {
861
- let a = h(e.computationMetadata, e.computationOrder, e.computationExpressions, {
861
+ let a = g(e.computationMetadata, e.computationOrder, e.computationExpressions, {
862
862
  ...t,
863
863
  ...n
864
864
  }, e.constValues, r);
@@ -885,187 +885,187 @@ function ye(e, t) {
885
885
  environment: s,
886
886
  snapshotState: c
887
887
  };
888
- }, J = () => {
889
- let e = q(C(), N);
890
- F = e.environment, I = e.snapshotState;
891
- }, Y = (e, t = C(), n = N) => {
888
+ }, Y = () => {
889
+ let e = J(w(), P);
890
+ I = e.environment, L = e.snapshotState;
891
+ }, X = (e, t = w(), n = P) => {
892
892
  let r;
893
- return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= q(t, {
893
+ return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= J(t, {
894
894
  ...n,
895
895
  ...e
896
- }).environment, M(i, a, r, t)) : { present: !1 };
897
- }, X = () => {
898
- re = {
899
- revision: P,
900
- state: me(I)
901
- };
896
+ }).environment, N(i, a, r, t)) : { present: !1 };
902
897
  }, Z = () => {
903
- for (let e of U) e();
898
+ ne = {
899
+ revision: F,
900
+ state: me(L)
901
+ };
902
+ }, ue = () => {
903
+ for (let e of W) e();
904
904
  }, Q = (e) => {
905
- N = e, P += 1, J(), X(), Z();
905
+ P = e, F += 1, Y(), Z(), ue();
906
906
  }, ge = () => {
907
- P += 1, J(), X(), Z();
908
- }, _e = (e, t = O) => {
909
- if (K(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
907
+ F += 1, Y(), Z(), ue();
908
+ }, _e = (e, t = k) => {
909
+ if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
910
910
  let n = [], a = {}, o = Object.keys(e).sort();
911
911
  for (let t of o) {
912
912
  if (t === "__proto__") {
913
- n.push(H("local.runtime.external", "External names cannot be \"__proto__\"."));
913
+ n.push(U("local.runtime.external", "External names cannot be \"__proto__\"."));
914
914
  continue;
915
915
  }
916
- let o = C().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
916
+ let o = w().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
917
917
  if (!s) {
918
918
  let e = r("local.runtime.external", { name: t });
919
- n.push(H("local.runtime.external", i(e), e));
919
+ n.push(U("local.runtime.external", i(e), e));
920
920
  continue;
921
921
  }
922
- let c = ie(s.type, e[t]);
922
+ let c = re(s.type, e[t]);
923
923
  if (c.ok) a[t] = c.value;
924
924
  else {
925
925
  let e = r(c.key, {
926
926
  name: t,
927
927
  ...c.params ?? {}
928
928
  });
929
- n.push(H("local.runtime.external", i(e), e));
929
+ n.push(U("local.runtime.external", i(e), e));
930
930
  }
931
931
  }
932
932
  return n.length ? n : (o.some((e) => !pe(t[e], a[e])) && (Object.assign(t, a), ge()), []);
933
933
  }, ve = (e, t) => {
934
- if (R) return () => {};
934
+ if (z) return () => {};
935
935
  let n = {}, r = e.bindExternalValues((e) => {
936
- if (R || !k.has(n)) return;
936
+ if (z || !A.has(n)) return;
937
937
  let r = _e(e, n);
938
938
  r.length && t?.(r);
939
939
  });
940
- return r ? (k.set(n, r), () => {
941
- k.delete(n) && (r(), !R && Object.keys(n).length && ge());
940
+ return r ? (A.set(n, r), () => {
941
+ A.delete(n) && (r(), !z && Object.keys(n).length && ge());
942
942
  }) : () => {};
943
943
  }, ye = (e) => {
944
- K();
945
- let t = C(), n = [], r = {}, i = Object.keys(e).sort(), a = Y(e);
944
+ q();
945
+ let t = w(), n = [], r = {}, i = Object.keys(e).sort(), a = X(e);
946
946
  for (let o of i) {
947
947
  if (o === "__proto__") {
948
- n.push(H("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
948
+ n.push(U("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
949
949
  continue;
950
950
  }
951
951
  if (o.startsWith("@")) {
952
- n.push(H("local.runtime.parameter", `Internal parameter "${o}" cannot be written by name.`));
952
+ n.push(U("local.runtime.parameter", `Internal parameter "${o}" cannot be written by name.`));
953
953
  continue;
954
954
  }
955
955
  if (!Object.hasOwn(t.document.bindings, o)) {
956
- n.push(H("local.runtime.parameter", `Unknown parameter "${o}".`));
956
+ n.push(U("local.runtime.parameter", `Unknown parameter "${o}".`));
957
957
  continue;
958
958
  }
959
- let i = t.document.bindings[o], s = L(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
960
- s.ok ? r[o] = z(s.value) : n.push(ce(t, i, s.detail));
959
+ let i = t.document.bindings[o], s = R(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
960
+ s.ok ? r[o] = B(s.value) : n.push(se(t, i, s.detail));
961
961
  }
962
962
  if (n.length) return n;
963
- if (!i.some((e) => !pe(N[e], r[e]))) return [];
963
+ if (!i.some((e) => !pe(P[e], r[e]))) return [];
964
964
  let o = {
965
- ...N,
965
+ ...P,
966
966
  ...r
967
967
  }, s = /* @__PURE__ */ new Set();
968
968
  for (let e of i) for (let n of t.publicSlotOwners.get(e) ?? []) s.add(n);
969
- for (let e of [...s].sort()) G(t, e, o) && n.push(le(t, e));
969
+ for (let e of [...s].sort()) K(t, e, o) && n.push(ce(t, e));
970
970
  return n.length ? n : (Q(o), []);
971
971
  }, be = (e) => {
972
- let t = v.get(e);
972
+ let t = y.get(e);
973
973
  if (!t) {
974
- if (t = l(e), v.size >= 200) {
975
- let e = v.keys().next().value;
976
- e !== void 0 && v.delete(e);
974
+ if (t = l(e), y.size >= 200) {
975
+ let e = y.keys().next().value;
976
+ e !== void 0 && y.delete(e);
977
977
  }
978
- v.set(e, t);
978
+ y.set(e, t);
979
979
  }
980
980
  return t;
981
981
  }, xe = () => {
982
- let e = C(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
982
+ let e = w(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
983
983
  for (let r of e.validationRules) {
984
984
  if (r.error) {
985
- t.push(f(n, e.validationLineStarts, r.rule.range, y, m(`Validation expression is invalid: ${r.error.message}`)));
985
+ t.push(p(n, e.validationLineStarts, r.rule.range, x, h(`Validation expression is invalid: ${r.error.message}`)));
986
986
  continue;
987
987
  }
988
988
  if (!r.expression) continue;
989
989
  let i;
990
990
  try {
991
- i = r.expression.evaluate(F);
991
+ i = r.expression.evaluate(I);
992
992
  } catch (i) {
993
- t.push(f(n, e.validationLineStarts, r.rule.range, y, m(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
993
+ t.push(p(n, e.validationLineStarts, r.rule.range, x, h(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
994
994
  continue;
995
995
  }
996
- typeof i == "boolean" ? i || t.push(f(n, e.validationLineStarts, r.rule.range, g, Se(r.rule.message))) : t.push(f(n, e.validationLineStarts, r.rule.range, y, "Validation expression must evaluate to a boolean."));
996
+ typeof i == "boolean" ? i || t.push(p(n, e.validationLineStarts, r.rule.range, _, Se(r.rule.message))) : t.push(p(n, e.validationLineStarts, r.rule.range, x, "Validation expression must evaluate to a boolean."));
997
997
  }
998
998
  return t;
999
999
  }, Se = (e) => {
1000
1000
  let t;
1001
1001
  try {
1002
- t = s(e, F);
1002
+ t = s(e, I);
1003
1003
  } catch {
1004
- t = ee;
1004
+ t = b;
1005
1005
  }
1006
- return m(t);
1006
+ return h(t);
1007
1007
  }, Ce = (e, t) => {
1008
- if (K(), e === S.document) return $({
1008
+ if (q(), e === C.document) return $({
1009
1009
  ok: !0,
1010
1010
  changed: !1,
1011
- revision: P,
1011
+ revision: F,
1012
1012
  retained: [],
1013
1013
  dropped: [],
1014
1014
  diagnostics: []
1015
1015
  });
1016
- if (se(e)) return $({
1016
+ if (oe(e)) return $({
1017
1017
  ok: !1,
1018
1018
  changed: !1,
1019
- revision: P,
1019
+ revision: F,
1020
1020
  retained: [],
1021
1021
  dropped: [],
1022
1022
  diagnostics: []
1023
1023
  });
1024
1024
  let n;
1025
1025
  try {
1026
- n = oe(e, b);
1026
+ n = ae(e, S);
1027
1027
  } catch {
1028
1028
  return $({
1029
1029
  ok: !1,
1030
1030
  changed: !1,
1031
- revision: P,
1031
+ revision: F,
1032
1032
  retained: [],
1033
1033
  dropped: [],
1034
1034
  diagnostics: []
1035
1035
  });
1036
1036
  }
1037
- let r = de(S, N, e, n, Y);
1037
+ let r = de(C, P, e, n, X);
1038
1038
  if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
1039
1039
  ok: !1,
1040
1040
  changed: !1,
1041
- revision: P,
1041
+ revision: F,
1042
1042
  retained: [],
1043
1043
  dropped: [],
1044
1044
  diagnostics: []
1045
1045
  });
1046
1046
  let i;
1047
1047
  try {
1048
- i = q(n, r.values);
1048
+ i = J(n, r.values);
1049
1049
  } catch {
1050
1050
  return $({
1051
1051
  ok: !1,
1052
1052
  changed: !1,
1053
- revision: P,
1053
+ revision: F,
1054
1054
  retained: [],
1055
1055
  dropped: [],
1056
1056
  diagnostics: []
1057
1057
  });
1058
1058
  }
1059
- for (let e of [O, ...k.keys()]) {
1060
- let t = A(n, e);
1059
+ for (let e of [k, ...A.keys()]) {
1060
+ let t = j(n, e);
1061
1061
  for (let t of Object.keys(e)) delete e[t];
1062
1062
  Object.assign(e, t);
1063
1063
  }
1064
- if (S = n, N = r.values, F = i.environment, I = i.snapshotState, B = null, P += 1, X(), t) for (let e of U) e();
1064
+ if (C = n, P = r.values, I = i.environment, L = i.snapshotState, V = null, F += 1, Z(), t) for (let e of W) e();
1065
1065
  return $({
1066
1066
  ok: !0,
1067
1067
  changed: !0,
1068
- revision: P,
1068
+ revision: F,
1069
1069
  retained: r.retained,
1070
1070
  dropped: r.dropped,
1071
1071
  diagnostics: r.diagnostics
@@ -1075,96 +1075,96 @@ function ye(e, t) {
1075
1075
  for (let r of n([e])) t.add(r.id);
1076
1076
  return t;
1077
1077
  }, Te = {
1078
- network: d.network,
1078
+ network: f.network,
1079
1079
  get document() {
1080
- return S.document;
1080
+ return C.document;
1081
1081
  },
1082
- services: D,
1082
+ services: O,
1083
1083
  snapshot() {
1084
- return K(), re;
1084
+ return q(), ne;
1085
1085
  },
1086
1086
  get(e, t) {
1087
- K();
1088
- let n = C(), r = n.nodeIndex.get(e.id);
1087
+ q();
1088
+ let n = w(), r = n.nodeIndex.get(e.id);
1089
1089
  if (!r) return null;
1090
- let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? x(r) : n.slotKeys.get(r.id)?.[t];
1091
- return i && Object.hasOwn(N, i) ? z(N[i]) : null;
1090
+ let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? u(r) : n.slotKeys.get(r.id)?.[t];
1091
+ return i && Object.hasOwn(P, i) ? B(P[i]) : null;
1092
1092
  },
1093
1093
  set(e, t, n) {
1094
- K();
1095
- let i = C(), a = i.nodeIndex.get(e.id);
1096
- if (!a) return [V(i.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1094
+ q();
1095
+ let i = w(), a = i.nodeIndex.get(e.id);
1096
+ if (!a) return [H(i.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1097
1097
  let o = i.slotKeys.get(a.id), s;
1098
1098
  if (n === void 0) {
1099
- if (o && !o.value) return [V(i.document, a, "local.runtime.binding", r("local.runtime.binding.needs-slot"))];
1100
- s = o?.value ?? i.bindingByNode.get(a.id) ?? x(a);
1101
- } else if (s = o?.[n], !s) return [V(i.document, a, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: n }))];
1099
+ if (o && !o.value) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.needs-slot"))];
1100
+ s = o?.value ?? i.bindingByNode.get(a.id) ?? u(a);
1101
+ } else if (s = o?.[n], !s) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: n }))];
1102
1102
  let c = Object.hasOwn(i.document.bindings, s) ? i.document.bindings[s] : void 0;
1103
- if (!c) return [V(i.document, a, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1104
- let l = L(c, i.controls.get(s) ?? [], t, Y({ [s]: t }), i.valueRules, i.legacyValueRules);
1105
- if (!l.ok) return [V(i.document, a, "local.runtime.value", l.detail)];
1106
- let u = z(l.value);
1107
- if (pe(N[s], u)) return [];
1108
- let d = {
1109
- ...N,
1110
- [s]: u
1103
+ if (!c) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1104
+ let l = R(c, i.controls.get(s) ?? [], t, X({ [s]: t }), i.valueRules, i.legacyValueRules);
1105
+ if (!l.ok) return [H(i.document, a, "local.runtime.value", l.detail)];
1106
+ let d = B(l.value);
1107
+ if (pe(P[s], d)) return [];
1108
+ let f = {
1109
+ ...P,
1110
+ [s]: d
1111
1111
  };
1112
- return G(i, a.id, d) ? [V(i.document, a, "local.runtime.value", r("local.runtime.value.range-order"))] : (Q(d), []);
1112
+ return K(i, a.id, f) ? [H(i.document, a, "local.runtime.value", r("local.runtime.value.range-order"))] : (Q(f), []);
1113
1113
  },
1114
1114
  setMany(e, t) {
1115
- K();
1116
- let n = C(), i = n.nodeIndex.get(e.id);
1117
- if (!i) return [V(n.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1115
+ q();
1116
+ let n = w(), i = n.nodeIndex.get(e.id);
1117
+ if (!i) return [H(n.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1118
1118
  let a = n.slotKeys.get(i.id);
1119
- if (!a) return [V(n.document, i, "local.runtime.binding", r("local.runtime.binding.no-multi-slot"))];
1119
+ if (!a) return [H(n.document, i, "local.runtime.binding", r("local.runtime.binding.no-multi-slot"))];
1120
1120
  let o = Object.entries(t);
1121
1121
  if (!o.length) return [];
1122
- let s = { ...N }, c = q(n, {
1123
- ...N,
1122
+ let s = { ...P }, c = J(n, {
1123
+ ...P,
1124
1124
  ...Object.fromEntries(o.map(([e, t]) => [a[e], t]))
1125
1125
  }).environment;
1126
1126
  for (let [e, t] of o) {
1127
1127
  let o = a[e];
1128
- if (!o || !Object.hasOwn(n.document.bindings, o)) return [V(n.document, i, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: e }))];
1129
- let l = L(n.document.bindings[o], n.controls.get(o) ?? [], t, (e, t) => M(e, t, c), n.valueRules, n.legacyValueRules);
1130
- if (!l.ok) return [V(n.document, i, "local.runtime.value", l.detail)];
1131
- s[o] = z(l.value);
1128
+ if (!o || !Object.hasOwn(n.document.bindings, o)) return [H(n.document, i, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: e }))];
1129
+ let l = R(n.document.bindings[o], n.controls.get(o) ?? [], t, (e, t) => N(e, t, c), n.valueRules, n.legacyValueRules);
1130
+ if (!l.ok) return [H(n.document, i, "local.runtime.value", l.detail)];
1131
+ s[o] = B(l.value);
1132
1132
  }
1133
- return G(n, i.id, s) ? [V(n.document, i, "local.runtime.value", r("local.runtime.value.range-order"))] : (o.every(([e, t]) => pe(N[a[e]], t)) || Q(s), []);
1133
+ return K(n, i.id, s) ? [H(n.document, i, "local.runtime.value", r("local.runtime.value.range-order"))] : (o.every(([e, t]) => pe(P[a[e]], t)) || Q(s), []);
1134
1134
  },
1135
1135
  parameterNames() {
1136
- return K(), C().publicNames;
1136
+ return q(), w().publicNames;
1137
1137
  },
1138
1138
  getParameter(e) {
1139
- K();
1140
- let t = ue(C(), e);
1141
- return t === void 0 ? void 0 : z(t);
1139
+ q();
1140
+ let t = le(w(), e);
1141
+ return t === void 0 ? void 0 : B(t);
1142
1142
  },
1143
1143
  getParameters() {
1144
- K();
1145
- let e = C(), t = {};
1144
+ q();
1145
+ let e = w(), t = {};
1146
1146
  for (let n of e.publicNames) {
1147
- let e = N[n];
1147
+ let e = P[n];
1148
1148
  t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
1149
1149
  }
1150
1150
  return Object.freeze(t);
1151
1151
  },
1152
1152
  readSubmissionFields(e) {
1153
- K();
1154
- let t = C(), n = /* @__PURE__ */ new Map(), r = (e, n) => M(e, n, F, t);
1153
+ q();
1154
+ let t = w(), n = /* @__PURE__ */ new Map(), r = (e, n) => N(e, n, I, t);
1155
1155
  if (e.length === 0) return {
1156
1156
  ok: !1,
1157
1157
  field: "",
1158
1158
  reason: "unavailable"
1159
1159
  };
1160
1160
  for (let i of e) {
1161
- let e = ue(t, i);
1161
+ let e = le(t, i);
1162
1162
  if (e === void 0 || n.has(i)) return {
1163
1163
  ok: !1,
1164
1164
  field: i,
1165
1165
  reason: "unavailable"
1166
1166
  };
1167
- let a = L(t.document.bindings[i], t.controls.get(i) ?? [], e, r, t.valueRules, t.legacyValueRules);
1167
+ let a = R(t.document.bindings[i], t.controls.get(i) ?? [], e, r, t.valueRules, t.legacyValueRules);
1168
1168
  if (!a.ok) {
1169
1169
  let e = a.detail.key;
1170
1170
  return {
@@ -1177,9 +1177,9 @@ function ye(e, t) {
1177
1177
  }
1178
1178
  let i = Object.create(null);
1179
1179
  for (let [e, r] of n) {
1180
- for (let [n, i] of p.get(e) ?? []) {
1180
+ for (let [n, i] of m.get(e) ?? []) {
1181
1181
  if (!t.controls.get(e)?.some((e) => e.id === i)) continue;
1182
- let a = n(z(r));
1182
+ let a = n(B(r));
1183
1183
  if (a) return {
1184
1184
  ok: !1,
1185
1185
  field: e,
@@ -1194,80 +1194,80 @@ function ye(e, t) {
1194
1194
  };
1195
1195
  },
1196
1196
  registerSubmissionField(e, t) {
1197
- if (R) return () => {};
1198
- let n = C(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
1197
+ if (z) return () => {};
1198
+ let n = w(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
1199
1199
  if (!r || r.startsWith("@")) return () => {};
1200
- let i = p.get(r);
1201
- return i || p.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
1202
- i.delete(t), i.size === 0 && p.get(r) === i && p.delete(r);
1200
+ let i = m.get(r);
1201
+ return i || m.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
1202
+ i.delete(t), i.size === 0 && m.get(r) === i && m.delete(r);
1203
1203
  };
1204
1204
  },
1205
1205
  setParameter(e, t) {
1206
- K();
1206
+ q();
1207
1207
  let n = Object.create(null);
1208
1208
  return n[e] = t, ye(n);
1209
1209
  },
1210
1210
  setParameters(e) {
1211
- if (K(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setParameters requires an object of parameter values.");
1211
+ if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setParameters requires an object of parameter values.");
1212
1212
  return ye(e);
1213
1213
  },
1214
1214
  getExternal(e) {
1215
- if (K(), Object.hasOwn(C().document.externals ?? {}, e) && Object.hasOwn(I, e)) return z(I[e]);
1215
+ if (q(), Object.hasOwn(w().document.externals ?? {}, e) && Object.hasOwn(L, e)) return B(L[e]);
1216
1216
  },
1217
1217
  getExternalValues() {
1218
- K();
1218
+ q();
1219
1219
  let e = {};
1220
- for (let [t, n] of Object.entries(j(C()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
1220
+ for (let [t, n] of Object.entries(M(w()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
1221
1221
  return Object.freeze(e);
1222
1222
  },
1223
1223
  setExternalValues(e) {
1224
1224
  return _e(e);
1225
1225
  },
1226
1226
  evaluate(e) {
1227
- K();
1228
- let t = be(e).evaluate(F);
1227
+ q();
1228
+ let t = be(e).evaluate(I);
1229
1229
  return Array.isArray(t) ? t.slice() : t;
1230
1230
  },
1231
1231
  validate() {
1232
- if (K(), B && B.revision === P) return B.diagnostics.map(fe);
1232
+ if (q(), V && V.revision === F) return V.diagnostics.map(fe);
1233
1233
  let e = xe();
1234
- return B = {
1235
- revision: P,
1234
+ return V = {
1235
+ revision: F,
1236
1236
  diagnostics: e
1237
1237
  }, e.map(fe);
1238
1238
  },
1239
1239
  text(e) {
1240
- return K(), s(e, F);
1240
+ return q(), s(e, I);
1241
1241
  },
1242
1242
  reset(e) {
1243
- K();
1244
- let t = C(), n = t.nodeIndex.get(e.id);
1243
+ q();
1244
+ let t = w(), n = t.nodeIndex.get(e.id);
1245
1245
  if (!n) return;
1246
- let r = we(n), s = { ...N };
1246
+ let r = we(n), s = { ...P };
1247
1247
  for (let [e, n] of Object.entries(t.document.bindings)) {
1248
1248
  if (!(t.controls.get(e) ?? []).some((e) => r.has(e.id))) continue;
1249
1249
  let c = o(n.initial);
1250
1250
  if (c) throw new a("expression-budget", `Parameter "${e}": ${i(c)}`, 0);
1251
- s[e] = z(n.initial);
1251
+ s[e] = B(n.initial);
1252
1252
  }
1253
- for (let e of r) W.set(e, (W.get(e) ?? 0) + 1);
1253
+ for (let e of r) G.set(e, (G.get(e) ?? 0) + 1);
1254
1254
  Q(s);
1255
1255
  },
1256
1256
  resetToken(e) {
1257
- K();
1258
- let t = C().nodeIndex.get(e.id);
1259
- return t ? W.get(t.id) ?? 0 : 0;
1257
+ q();
1258
+ let t = w().nodeIndex.get(e.id);
1259
+ return t ? G.get(t.id) ?? 0 : 0;
1260
1260
  },
1261
1261
  subscribe(e) {
1262
- return K(), U.add(e), () => {
1263
- U.delete(e);
1262
+ return q(), W.add(e), () => {
1263
+ W.delete(e);
1264
1264
  };
1265
1265
  },
1266
1266
  dispose() {
1267
- if (!R) {
1268
- R = !0, d.dispose();
1269
- for (let e of k.values()) e();
1270
- k.clear(), p.clear(), D.state.flush(), u && D.scheduler.dispose(), U.clear(), v.clear(), b.clear(), S.computationExpressions.clear(), S.constErrors.clear(), S.cycleErrors.clear(), S.validationRules.length = 0, W.clear();
1267
+ if (!z) {
1268
+ z = !0, f.dispose();
1269
+ for (let e of A.values()) e();
1270
+ A.clear(), m.clear(), O.state.flush(), d && O.scheduler.dispose(), W.clear(), y.clear(), S.clear(), C.computationExpressions.clear(), C.constErrors.clear(), C.cycleErrors.clear(), C.validationRules.length = 0, G.clear();
1271
1271
  }
1272
1272
  }
1273
1273
  };
@@ -1275,8 +1275,8 @@ function ye(e, t) {
1275
1275
  update: Ce,
1276
1276
  bindNetworkExternals: ve,
1277
1277
  notify() {
1278
- if (!R) for (let e of U) e();
1278
+ if (!z) for (let e of W) e();
1279
1279
  }
1280
- }), J(), X(), ve(d), Te;
1280
+ }), Y(), Z(), ve(f), Te;
1281
1281
  }
1282
- export { Q as a, ge as i, ye as n, X as o, _e as r, ve as t };
1282
+ export { Q as a, ge as i, ye as n, Z as o, _e as r, ve as t };