reactive-md 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG-ch.md +34 -0
  2. package/CHANGELOG.md +34 -0
  3. package/README-ch.md +7 -7
  4. package/README-en.md +7 -7
  5. package/README.md +7 -7
  6. package/THIRD_PARTY_NOTICES.md +0 -57
  7. package/cli/help.mjs +6 -4
  8. package/cli/init.mjs +1 -1
  9. package/cli/migrate.mjs +1 -1
  10. package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
  11. package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
  12. package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
  13. package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
  14. package/dist-library/authoring-Bwu_zCWs.js +768 -0
  15. package/dist-library/choice-values-BItGjPD2.js +58 -0
  16. package/dist-library/compile-B35rfzKr.js +1742 -0
  17. package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
  18. package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
  19. package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
  20. package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
  21. package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
  22. package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
  23. package/dist-library/conditional-branches-CIhJXasR.js +17 -0
  24. package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
  25. package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
  26. package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
  27. package/dist-library/data-table-CSAkm1eU.js +290 -0
  28. package/dist-library/data-table-model-DruztQFt.js +391 -0
  29. package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
  30. package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
  31. package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
  32. package/dist-library/default-options-By16CVw1.js +131 -0
  33. package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
  34. package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
  35. package/dist-library/display-Bb6hAG5T.js +2065 -0
  36. package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
  37. package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
  38. package/dist-library/font-aliases-CKYjwn4o.js +4 -0
  39. package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
  40. package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
  41. package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
  42. package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
  43. package/dist-library/layout-CPQggKxk.js +592 -0
  44. package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
  45. package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
  46. package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
  47. package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
  48. package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
  49. package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
  50. package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
  51. package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
  52. package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
  53. package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
  54. package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
  55. package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
  56. package/dist-library/reactive-md-authoring.js +277 -269
  57. package/dist-library/reactive-md-build.js +327 -33
  58. package/dist-library/reactive-md-compiler-session.js +3 -3
  59. package/dist-library/reactive-md-compiler-standard.js +10 -10
  60. package/dist-library/reactive-md-compiler.js +3 -3
  61. package/dist-library/reactive-md-contracts.js +4 -4
  62. package/dist-library/reactive-md-default-packs.js +4 -3
  63. package/dist-library/reactive-md-default-preset.js +3 -3
  64. package/dist-library/reactive-md-export.js +6 -6
  65. package/dist-library/reactive-md-minimal-preset.js +3 -2
  66. package/dist-library/reactive-md-minimal-react-preset.js +18 -17
  67. package/dist-library/reactive-md-minimal.css +1 -1
  68. package/dist-library/reactive-md-observability.js +2 -2
  69. package/dist-library/reactive-md-pack-style-manifest.js +8 -0
  70. package/dist-library/reactive-md-plugin-chart.js +13 -9
  71. package/dist-library/reactive-md-plugin-data.js +4 -4
  72. package/dist-library/reactive-md-plugin-diagram.js +3 -3
  73. package/dist-library/reactive-md-plugin-forms.js +5 -5
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +10 -10
  76. package/dist-library/reactive-md-plugin-network.js +5 -5
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-react-component-accordion.js +3 -3
  79. package/dist-library/reactive-md-react-component-alert.js +3 -3
  80. package/dist-library/reactive-md-react-component-anchor.js +3 -3
  81. package/dist-library/reactive-md-react-component-badge.js +3 -3
  82. package/dist-library/reactive-md-react-component-card.js +3 -3
  83. package/dist-library/reactive-md-react-component-chart.js +2 -2
  84. package/dist-library/reactive-md-react-component-checkbox.js +2 -2
  85. package/dist-library/reactive-md-react-component-checklist.js +2 -2
  86. package/dist-library/reactive-md-react-component-choices.js +2 -2
  87. package/dist-library/reactive-md-react-component-column.js +1 -1
  88. package/dist-library/reactive-md-react-component-coordinate.js +2 -2
  89. package/dist-library/reactive-md-react-component-counter.js +2 -2
  90. package/dist-library/reactive-md-react-component-data-table.js +2 -2
  91. package/dist-library/reactive-md-react-component-date.js +2 -2
  92. package/dist-library/reactive-md-react-component-diagram.js +2 -2
  93. package/dist-library/reactive-md-react-component-disclosure.js +3 -3
  94. package/dist-library/reactive-md-react-component-edge.js +1 -1
  95. package/dist-library/reactive-md-react-component-else.js +10 -0
  96. package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
  97. package/dist-library/reactive-md-react-component-gallery.js +2 -2
  98. package/dist-library/reactive-md-react-component-grid.js +3 -3
  99. package/dist-library/reactive-md-react-component-if.js +3 -3
  100. package/dist-library/reactive-md-react-component-input.js +2 -2
  101. package/dist-library/reactive-md-react-component-jump.js +3 -3
  102. package/dist-library/reactive-md-react-component-multi-select.js +2 -2
  103. package/dist-library/reactive-md-react-component-node.js +2 -2
  104. package/dist-library/reactive-md-react-component-number.js +2 -2
  105. package/dist-library/reactive-md-react-component-option.js +1 -1
  106. package/dist-library/reactive-md-react-component-panel.js +3 -3
  107. package/dist-library/reactive-md-react-component-plot.js +2 -2
  108. package/dist-library/reactive-md-react-component-progress.js +2 -2
  109. package/dist-library/reactive-md-react-component-quiz.js +2 -2
  110. package/dist-library/reactive-md-react-component-radio-group.js +2 -2
  111. package/dist-library/reactive-md-react-component-range-slider.js +2 -2
  112. package/dist-library/reactive-md-react-component-section.js +3 -3
  113. package/dist-library/reactive-md-react-component-select.js +2 -2
  114. package/dist-library/reactive-md-react-component-slider.js +2 -2
  115. package/dist-library/reactive-md-react-component-step.js +3 -3
  116. package/dist-library/reactive-md-react-component-steps.js +3 -3
  117. package/dist-library/reactive-md-react-component-tab.js +3 -3
  118. package/dist-library/reactive-md-react-component-table.js +2 -2
  119. package/dist-library/reactive-md-react-component-tabs.js +3 -3
  120. package/dist-library/reactive-md-react-component-text.js +3 -3
  121. package/dist-library/reactive-md-react-component-textarea.js +2 -2
  122. package/dist-library/reactive-md-react-component-timeline.js +2 -2
  123. package/dist-library/reactive-md-react-component-timer.js +2 -2
  124. package/dist-library/reactive-md-react-component-toggle.js +2 -2
  125. package/dist-library/reactive-md-react-component-tooltip.js +3 -3
  126. package/dist-library/reactive-md-react-component-validation.js +3 -3
  127. package/dist-library/reactive-md-react-minimal.js +4 -4
  128. package/dist-library/reactive-md-react-pack-controls.js +4 -4
  129. package/dist-library/reactive-md-react-pack-data.js +3 -3
  130. package/dist-library/reactive-md-react-pack-layout.js +25 -24
  131. package/dist-library/reactive-md-react-pack-visuals.js +2 -2
  132. package/dist-library/reactive-md-react-packed.js +6 -6
  133. package/dist-library/reactive-md-react-server.js +37 -36
  134. package/dist-library/reactive-md-react-static-server.js +2 -2
  135. package/dist-library/reactive-md-react-static.js +1 -1
  136. package/dist-library/reactive-md-react-unstyled.js +12 -12
  137. package/dist-library/reactive-md-react.js +12 -12
  138. package/dist-library/reactive-md-scan.js +1 -1
  139. package/dist-library/reactive-md-sdk.js +23 -9
  140. package/dist-library/reactive-md-standalone-configured.js +2 -2
  141. package/dist-library/reactive-md-standalone-host.js +2 -2
  142. package/dist-library/reactive-md-testing-browser.js +2 -2
  143. package/dist-library/reactive-md-testing-react.js +6 -6
  144. package/dist-library/reactive-md-testing.js +6 -6
  145. package/dist-library/reactive-md-vite.js +25 -9
  146. package/dist-library/reactive-md-worker-pool.js +3 -3
  147. package/dist-library/reactive-md.css +1 -1
  148. package/dist-library/reactive-md.js +52 -43
  149. package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
  150. package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
  151. package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
  152. package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
  153. package/dist-library/rmd-pack-layout.css +9 -0
  154. package/dist-library/rmd-pack-resource-layout.css +9 -0
  155. package/dist-library/runtime-BHeuLOv_.js +1369 -0
  156. package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
  157. package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
  158. package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
  159. package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
  160. package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
  161. package/dist-library/shareable-CHCDnl6j.js +844 -0
  162. package/dist-library/types/authoring/catalog.d.ts +3 -1
  163. package/dist-library/types/authoring/index.d.ts +1 -1
  164. package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
  165. package/dist-library/types/components/chart/default-chart.d.ts +7 -0
  166. package/dist-library/types/components/entries/else.d.ts +3 -0
  167. package/dist-library/types/components/layout/layout.d.ts +5 -0
  168. package/dist-library/types/components/shared/visuals.d.ts +1 -1
  169. package/dist-library/types/components/table/data-table-model.d.ts +95 -2
  170. package/dist-library/types/components/table/data-table.d.ts +2 -2
  171. package/dist-library/types/contracts/component-kernel.d.ts +5 -0
  172. package/dist-library/types/contracts/font-aliases.d.ts +18 -0
  173. package/dist-library/types/contracts/number-literal.d.ts +2 -0
  174. package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
  175. package/dist-library/types/export/index.d.ts +4 -1
  176. package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
  177. package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
  178. package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
  179. package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
  180. package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
  181. package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
  182. package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
  183. package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
  184. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
  185. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
  186. package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
  187. package/dist-library/types/local/evaluation/computations.d.ts +13 -5
  188. package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
  189. package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
  190. package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
  191. package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
  192. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
  193. package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
  194. package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
  195. package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
  196. package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
  197. package/dist-library/types/local/evaluation/validation.d.ts +8 -6
  198. package/dist-library/types/local/index.d.ts +4 -3
  199. package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
  200. package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
  201. package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
  202. package/dist-library/types/local/runtime/runtime.d.ts +3 -1
  203. package/dist-library/types/local/runtime/state.d.ts +30 -15
  204. package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
  205. package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
  206. package/dist-library/types/local/source/authoring.d.ts +10 -0
  207. package/dist-library/types/local/source/source-migration.d.ts +1 -0
  208. package/dist-library/types/local/types.d.ts +33 -2
  209. package/dist-library/types/react/component-api.d.ts +21 -2
  210. package/dist-library/types/react/component-utils.d.ts +11 -0
  211. package/dist-library/types/react/font-aliases.d.ts +2 -0
  212. package/dist-library/types/react/package-core.d.ts +3 -0
  213. package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
  214. package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
  215. package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
  216. package/dist-library/types/react/sdk-core.d.ts +3 -1
  217. package/dist-library/types/sdk/assembly.d.ts +3 -0
  218. package/dist-library/types/sdk/font.d.ts +13 -0
  219. package/dist-library/types/sdk/index.d.ts +1 -0
  220. package/dist-library/types/sdk/theme.d.ts +5 -0
  221. package/dist-library/types/sdk/types.d.ts +6 -0
  222. package/dist-library/types/sdk/version.d.ts +1 -1
  223. package/dist-library/types/shareable.d.ts +15 -3
  224. package/dist-library/types/standalone/prepare.d.ts +4 -2
  225. package/dist-library/types/standalone/session-core.d.ts +4 -1
  226. package/dist-library/types/vite/index.d.ts +3 -0
  227. package/dist-library/types/vite/registration.d.ts +1 -0
  228. package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
  229. package/dist-library/types-FYhRWRn9.js +3 -0
  230. package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
  231. package/dist-library/validation-DRuW0Wl9.js +433 -0
  232. package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
  233. package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
  234. package/dist-library/visuals-7xzoL9ql.js +49340 -0
  235. package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
  236. package/dist-standalone/reactive-md-standalone.css +1 -1
  237. package/dist-standalone/reactive-md-standalone.js +128 -368
  238. package/docs/README-ch.md +3 -1
  239. package/docs/README.md +3 -1
  240. package/docs/compatibility/api-stability-ch.md +1 -1
  241. package/docs/compatibility/api-stability-en.md +1 -1
  242. package/docs/compatibility/compatibility-ch.md +15 -15
  243. package/docs/compatibility/compatibility-en.md +15 -15
  244. package/docs/compatibility/compatibility-manifest.schema.json +3 -2
  245. package/docs/compatibility/deprecation-ch.md +2 -2
  246. package/docs/compatibility/deprecation-en.md +2 -2
  247. package/docs/compatibility/source-versioning-ch.md +22 -14
  248. package/docs/compatibility/source-versioning-en.md +22 -13
  249. package/docs/compatibility/support-matrix-ch.md +4 -3
  250. package/docs/compatibility/support-matrix-en.md +4 -3
  251. package/docs/development/component-development-ch.md +2 -2
  252. package/docs/development/component-development-en.md +2 -2
  253. package/docs/development/component-protocol-ch.md +18 -18
  254. package/docs/development/component-protocol-en.md +14 -14
  255. package/docs/guides/local-guide-ch.md +109 -20
  256. package/docs/guides/local-guide-en.md +109 -20
  257. package/docs/integration/author-tools-ch.md +1 -1
  258. package/docs/integration/author-tools-en.md +1 -1
  259. package/docs/integration/editor-ch.md +3 -3
  260. package/docs/integration/editor-en.md +3 -3
  261. package/docs/integration/extension-sdk-ch.md +29 -3
  262. package/docs/integration/extension-sdk-en.md +29 -3
  263. package/docs/integration/local-integration-ch.md +3 -3
  264. package/docs/integration/local-integration-en.md +3 -3
  265. package/docs/integration/pdf-export-ch.md +42 -0
  266. package/docs/integration/pdf-export-en.md +42 -0
  267. package/docs/integration/shareable-export-ch.md +11 -19
  268. package/docs/integration/shareable-export-en.md +11 -19
  269. package/docs/reference/diagnostics-counting-ch.md +24 -1
  270. package/docs/reference/diagnostics-counting-en.md +24 -1
  271. package/docs/reference/local-interaction-syntax-ch.md +222 -33
  272. package/docs/reference/local-interaction-syntax-en.md +220 -31
  273. package/docs/reference/public-api-ch.md +24 -18
  274. package/docs/reference/public-api-en.md +24 -18
  275. package/docs/reference/theme-protocol-ch.md +1 -1
  276. package/docs/reference/theme-protocol-en.md +1 -1
  277. package/docs/releases/release-0.10.0-ch.md +45 -0
  278. package/docs/releases/release-0.10.0-en.md +45 -0
  279. package/examples/conformance/README-ch.md +3 -3
  280. package/examples/conformance/README.md +3 -3
  281. package/examples/conformance/local-draft-4.json +441 -0
  282. package/examples/integration/README-ch.md +3 -3
  283. package/examples/integration/README.md +3 -3
  284. package/examples/integration/chat-session/package.json +1 -1
  285. package/examples/local/README-ch.md +1 -1
  286. package/examples/local/README.md +1 -1
  287. package/package.json +6 -1
  288. package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
  289. package/dist-library/authoring-B14SsOXZ.js +0 -893
  290. package/dist-library/compile-D50B5_Ww.js +0 -1249
  291. package/dist-library/computations-CffoW7Ff.js +0 -340
  292. package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
  293. package/dist-library/default-options-DU5dxuU6.js +0 -125
  294. package/dist-library/layout-BfUzzO2b.js +0 -553
  295. package/dist-library/runtime-CuJndKqK.js +0 -1289
  296. package/dist-library/shareable-C6mUerpQ.js +0 -817
  297. package/dist-library/types-daDo2c_w.js +0 -3
  298. package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
  299. package/dist-library/visuals-CoVSjVD8.js +0 -49159
@@ -1,1289 +0,0 @@
1
- import { E as e } from "./limits-CFERRrlC.js";
2
- import { _ as t, l as n, o as r, y as i } from "./document-theme-DBAfnk7y.js";
3
- import { a, c as o, r as s, s as c, t as l } from "./compile-D50B5_Ww.js";
4
- import { a as u, n as d, s as f, t as p } from "./computations-CffoW7Ff.js";
5
- import { a as ee, c as m, i as h, n as g, o as _, r as v, t as y } from "./validation-XXlb-spV.js";
6
- import { n as b, t as x } from "./types-daDo2c_w.js";
7
- import { t as S } from "./component-kernel-IG4wOO0i.js";
8
- import { t as C } from "./default-registry-BlloaZi7.js";
9
- import { x as te } from "./component-state-CwKX_SN5.js";
10
- import { i as ne, t as w } from "./identity-BUx0Q_-d.js";
11
- import { n as T } from "./runtime-BDnnimPA.js";
12
- // src/local/runtime/runtime-values.ts
13
- function E(e, t) {
14
- return e.attrs?.[t];
15
- }
16
- function D(e, t) {
17
- let n = E(e, t);
18
- if (n === "true") return !0;
19
- if (n === "false") return !1;
20
- }
21
- function O(e, t) {
22
- let n = E(e, t);
23
- if (n === void 0) return;
24
- let r = Number(n);
25
- return Number.isFinite(r) ? r : void 0;
26
- }
27
- function k(e) {
28
- return t(e);
29
- }
30
- function A(e, t) {
31
- return {
32
- ok: !1,
33
- detail: n(e, t)
34
- };
35
- }
36
- function j(e, t) {
37
- if (t !== void 0) return E(e, t);
38
- }
39
- function M(e, t) {
40
- if (t !== void 0) return O(e, t);
41
- }
42
- function N(t, n, r, i = {}) {
43
- for (let a of r) if (a.kind === "date") {
44
- if (!S(n)) return A("local.runtime.value.date-invalid");
45
- let e = i.required ?? (a.required !== void 0 && D(t, a.required) === !0);
46
- if (n === "" && e) return A("local.runtime.value.date-required");
47
- let r = i.min ?? j(t, a.min), o = i.max ?? j(t, a.max);
48
- if (n !== "" && r && n < r) return A("local.runtime.value.date-earlier", { min: r });
49
- if (n !== "" && o && n > o) return A("local.runtime.value.date-later", { max: o });
50
- } else if (a.kind === "required") {
51
- let e = i.required ?? D(t, a.required) === !0;
52
- if (n === "" && e) return A("local.runtime.value.field-required");
53
- } else if (a.kind === "length") {
54
- let e = k(n), r = M(t, a.min), i = M(t, a.max);
55
- if (r !== void 0 && r > 0 && n !== "" && e < r) return A("local.runtime.value.min-length", { min: r });
56
- if (i !== void 0 && e > i) return A("local.runtime.value.max-length", { max: i });
57
- } else if (a.kind === "email" && (j(t, a.type) ?? "text") === a.value && n !== "") {
58
- if (n.length > 254) return A("local.runtime.value.email-length", { limit: 254 });
59
- if (!e(n)) return A("local.runtime.value.email-invalid");
60
- }
61
- return {
62
- ok: !0,
63
- value: n
64
- };
65
- }
66
- var P = /* @__PURE__ */ new Map();
67
- function F(e) {
68
- if (!e.name) return I;
69
- let t = P.get(e.name);
70
- if (t !== void 0) return t ?? I;
71
- let n = C(e.name), r = n ? f(n) : I;
72
- return P.set(e.name, n ? r : null), r;
73
- }
74
- var I = Object.freeze([]);
75
- function L(e, t, n, i, a, s = !1) {
76
- switch (e.type) {
77
- case "number": {
78
- if (typeof n != "number" || !Number.isFinite(n)) return A("local.runtime.value.finite-number", { name: e.name });
79
- let r = e.step ?? 1, a = e.min ?? 0;
80
- for (let r of t) {
81
- let t = i(r, "min");
82
- if (t.present && !t.ok) return A("local.runtime.value.constraint", {
83
- name: e.name,
84
- attribute: "min"
85
- });
86
- if (t.present && t.ok) {
87
- if (typeof t.value != "number" || !Number.isFinite(t.value)) return A("local.runtime.value.constraint", {
88
- name: e.name,
89
- attribute: "min"
90
- });
91
- if (a = t.value, n < t.value) return A("local.runtime.value.min", {
92
- name: e.name,
93
- min: t.value
94
- });
95
- }
96
- let o = i(r, "max");
97
- if (o.present && !o.ok) return A("local.runtime.value.constraint", {
98
- name: e.name,
99
- attribute: "max"
100
- });
101
- if (o.present && o.ok) {
102
- if (typeof o.value != "number" || !Number.isFinite(o.value)) return A("local.runtime.value.constraint", {
103
- name: e.name,
104
- attribute: "max"
105
- });
106
- if (n > o.value) return A("local.runtime.value.max", {
107
- name: e.name,
108
- max: o.value
109
- });
110
- }
111
- 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 });
112
- }
113
- return e.min !== void 0 && n < e.min ? A("local.runtime.value.min", {
114
- name: e.name,
115
- min: e.min
116
- }) : e.max !== void 0 && n > e.max ? A("local.runtime.value.max", {
117
- name: e.name,
118
- max: e.max
119
- }) : r > 0 && !V(n, a, r) ? A("local.runtime.value.step", {
120
- name: e.name,
121
- step: r,
122
- base: a
123
- }) : {
124
- ok: !0,
125
- value: n
126
- };
127
- }
128
- case "boolean": return typeof n == "boolean" ? {
129
- ok: !0,
130
- value: n
131
- } : A("local.runtime.value.boolean", { name: e.name });
132
- case "string": {
133
- if (typeof n != "string") return A("local.runtime.value.string", { name: e.name });
134
- let c = o(n);
135
- if (c) return A("local.runtime.value.budget", {
136
- name: e.name,
137
- detail: r(c),
138
- detailKey: c.key,
139
- ...c.params
140
- });
141
- for (let r of t) {
142
- let t = a?.get(r.id) ?? (s ? F(r) : I);
143
- if (!t.length) continue;
144
- let o = {};
145
- for (let n of t) {
146
- if (n.kind === "date") {
147
- for (let t of ["min", "max"]) {
148
- if (n[t] === void 0) continue;
149
- let a = i(r, t);
150
- if (a.present) {
151
- if (!a.ok || typeof a.value != "string" || !S(a.value)) return A("local.runtime.value.constraint-date", {
152
- name: e.name,
153
- attribute: t
154
- });
155
- o[t] = a.value;
156
- }
157
- }
158
- let t = o.min ?? j(r, n.min), a = o.max ?? j(r, n.max);
159
- if (t && a && S(t) && S(a) && t > a) return A("local.runtime.value.constraint-range", { name: e.name });
160
- }
161
- if ((n.kind === "date" || n.kind === "required" ? n.required : void 0) !== void 0) {
162
- let t = i(r, "required");
163
- if (t.present) {
164
- if (!t.ok || typeof t.value != "boolean") return A("local.runtime.value.constraint", {
165
- name: e.name,
166
- attribute: "required"
167
- });
168
- o.required = t.value;
169
- }
170
- }
171
- }
172
- let c = N(r, n, t, o);
173
- if (!c.ok) return c;
174
- }
175
- return e.options?.length && !e.options.includes(n) ? A("local.runtime.value.option", {
176
- value: n,
177
- options: e.options.join(", ")
178
- }) : {
179
- ok: !0,
180
- value: n
181
- };
182
- }
183
- case "array": {
184
- if (!Array.isArray(n)) return A("local.runtime.value.array", { name: e.name });
185
- let t = o(n);
186
- if (t) return A("local.runtime.value.budget", {
187
- name: e.name,
188
- detail: r(t),
189
- detailKey: t.key,
190
- ...t.params
191
- });
192
- for (let t of n) if (typeof t != "string") return A("local.runtime.value.array-members", { name: e.name });
193
- if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
194
- name: e.name,
195
- max: e.maxItems
196
- }) : {
197
- ok: !0,
198
- value: n.slice()
199
- };
200
- let i = /* @__PURE__ */ new Set();
201
- for (let t of n) {
202
- if (e.options && !e.options.includes(t)) return A("local.runtime.value.checklist-option", { value: t });
203
- i.add(t);
204
- }
205
- let a = e.options ? e.options.filter((e) => i.has(e)) : [...i];
206
- return e.maxItems !== void 0 && a.length > e.maxItems ? A("local.runtime.value.max-items", {
207
- name: e.name,
208
- max: e.maxItems
209
- }) : {
210
- ok: !0,
211
- value: a
212
- };
213
- }
214
- case "number-array": {
215
- if (!Array.isArray(n)) return A("local.runtime.value.number-array", { name: e.name });
216
- let t = o(n);
217
- if (t) return A("local.runtime.value.budget", {
218
- name: e.name,
219
- detail: r(t),
220
- detailKey: t.key,
221
- ...t.params
222
- });
223
- for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return A("local.runtime.value.number-array-members", { name: e.name });
224
- return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
225
- name: e.name,
226
- max: e.maxItems
227
- }) : {
228
- ok: !0,
229
- value: n.slice()
230
- };
231
- }
232
- case "null": return n === null ? {
233
- ok: !0,
234
- value: n
235
- } : A("local.runtime.value.null", { name: e.name });
236
- }
237
- return A("local.runtime.value.unsupported-type", { name: e.name });
238
- }
239
- function R(e) {
240
- return e instanceof a ? e : new a("expression-eval", e instanceof Error ? e.message : String(e), 0);
241
- }
242
- function re(e, t) {
243
- switch (e) {
244
- case "string": {
245
- if (typeof t != "string") return {
246
- ok: !1,
247
- key: "local.runtime.external-value",
248
- params: { kind: "string" }
249
- };
250
- let e = o(t);
251
- return e ? {
252
- ok: !1,
253
- key: "local.runtime.external-budget",
254
- params: {
255
- detailKey: e.key,
256
- ...e.params ?? {}
257
- }
258
- } : {
259
- ok: !0,
260
- value: t
261
- };
262
- }
263
- case "number": return typeof t == "number" && Number.isFinite(t) ? {
264
- ok: !0,
265
- value: t
266
- } : {
267
- ok: !1,
268
- key: "local.runtime.external-value",
269
- params: { kind: "number" }
270
- };
271
- case "boolean": return typeof t == "boolean" ? {
272
- ok: !0,
273
- value: t
274
- } : {
275
- ok: !1,
276
- key: "local.runtime.external-value",
277
- params: { kind: "boolean" }
278
- };
279
- case "array": {
280
- if (!Array.isArray(t)) return {
281
- ok: !1,
282
- key: "local.runtime.external-value",
283
- params: { kind: "string-array" }
284
- };
285
- for (let e of t) if (typeof e != "string") return {
286
- ok: !1,
287
- key: "local.runtime.external-value",
288
- params: { kind: "string-array" }
289
- };
290
- let e = o(t);
291
- return e ? {
292
- ok: !1,
293
- key: "local.runtime.external-budget",
294
- params: {
295
- detailKey: e.key,
296
- ...e.params ?? {}
297
- }
298
- } : {
299
- ok: !0,
300
- value: t.slice()
301
- };
302
- }
303
- case "number-array": {
304
- if (!Array.isArray(t)) return {
305
- ok: !1,
306
- key: "local.runtime.external-value",
307
- params: { kind: "number-array" }
308
- };
309
- for (let e of t) if (typeof e != "number" || !Number.isFinite(e)) return {
310
- ok: !1,
311
- key: "local.runtime.external-value",
312
- params: { kind: "number-array" }
313
- };
314
- let e = o(t);
315
- return e ? {
316
- ok: !1,
317
- key: "local.runtime.external-budget",
318
- params: {
319
- detailKey: e.key,
320
- ...e.params ?? {}
321
- }
322
- } : {
323
- ok: !0,
324
- value: t.slice()
325
- };
326
- }
327
- default: return {
328
- ok: !1,
329
- key: "local.runtime.external-value",
330
- params: { kind: String(e) }
331
- };
332
- }
333
- }
334
- var z = 1e-9;
335
- function B(e) {
336
- return Array.isArray(e) ? e.slice() : e;
337
- }
338
- function V(e, t, n) {
339
- let r = (e - t) / n;
340
- return Math.abs(r - Math.round(r)) <= z * Math.max(1, Math.abs(r));
341
- }
342
- function H(e, t, n, i) {
343
- let a = Math.max(0, Math.min(e.source.length, t.range.start)), o = e.source.slice(0, a).split("\n");
344
- return {
345
- code: n,
346
- message: r(i),
347
- severity: "error",
348
- range: {
349
- start: a,
350
- end: Math.max(a + 1, Math.min(e.source.length, t.range.end))
351
- },
352
- line: o.length,
353
- column: (o.at(-1) ?? "").length + 1,
354
- messageKey: i.key,
355
- phase: "runtime",
356
- recoverable: !0,
357
- ...i.params ? { params: i.params } : {}
358
- };
359
- }
360
- function U(e, t, n) {
361
- return {
362
- code: e,
363
- message: t,
364
- severity: "error",
365
- range: {
366
- start: 0,
367
- end: 0
368
- },
369
- line: 1,
370
- column: 1,
371
- phase: "runtime",
372
- recoverable: !0,
373
- ...n ? {
374
- messageKey: n.key,
375
- ...n.params ? { params: n.params } : {}
376
- } : {}
377
- };
378
- }
379
- // src/local/runtime/runtime-document.ts
380
- function W(e, t) {
381
- let n = e.document.bindings[t];
382
- if (!n) return;
383
- let { nodeIds: r, owner: i, ...a } = n, o = (e.controls.get(t) ?? []).map((t) => {
384
- let n = e.document.dynamicConstraints?.[t.id] ?? {};
385
- return {
386
- name: t.name ?? null,
387
- attrs: t.attrs ?? {},
388
- dynamic: Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t ? {
389
- source: t.source,
390
- numeric: t.numeric ?? null
391
- } : null])),
392
- rules: e.valueRules.get(t.id) ?? null
393
- };
394
- });
395
- return JSON.stringify({
396
- facts: a,
397
- legacy: e.legacyValueRules,
398
- controls: o
399
- });
400
- }
401
- function ie(e, t) {
402
- let n = t.get(e);
403
- if (n) return {
404
- expression: n,
405
- error: null
406
- };
407
- try {
408
- let n = l(e);
409
- if (t.size >= 200) {
410
- let e = t.keys().next().value;
411
- e !== void 0 && t.delete(e);
412
- }
413
- return t.set(e, n), {
414
- expression: n,
415
- error: null
416
- };
417
- } catch (e) {
418
- return {
419
- expression: null,
420
- error: R(e)
421
- };
422
- }
423
- }
424
- function ae(e, t) {
425
- let n = /* @__PURE__ */ new Map();
426
- for (let t of i(e.nodes)) n.set(t.id, t);
427
- let s = {}, l = /* @__PURE__ */ new Map();
428
- for (let [t, i] of Object.entries(e.bindings)) {
429
- let e = o(i.initial);
430
- if (e) throw new a("expression-budget", `Parameter "${t}": ${r(e)}`, 0);
431
- s[t] = B(i.initial);
432
- let c = [];
433
- for (let e of i.nodeIds) {
434
- let t = n.get(e);
435
- t && c.push(t);
436
- }
437
- l.set(t, c);
438
- }
439
- let f = /* @__PURE__ */ new Map();
440
- for (let [t, n] of Object.entries(e.bindingSlots ?? {})) f.set(t, { ...n });
441
- let p = u(e), m = new Map(Object.entries(p?.valueRules ?? {})), h = p === void 0, g = /* @__PURE__ */ new Map();
442
- if (p) for (let e of p.slotRelations) {
443
- let t = f.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
444
- if (!n || !r) continue;
445
- let i = g.get(e.nodeId) ?? [];
446
- i.push({
447
- lower: n,
448
- upper: r
449
- }), g.set(e.nodeId, i);
450
- }
451
- else for (let [e, t] of f) t.start && t.end && g.set(e, [{
452
- lower: t.start,
453
- upper: t.end
454
- }]);
455
- let v = /* @__PURE__ */ new Map();
456
- for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
457
- if (f.has(e)) continue;
458
- let n = v.get(e);
459
- (n === void 0 || n.startsWith("@") && !t.startsWith("@")) && v.set(e, t);
460
- }
461
- let y = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
462
- for (let [e, t] of f) for (let n of Object.values(t)) {
463
- if (n.startsWith("@")) continue;
464
- let t = b.get(n) ?? /* @__PURE__ */ new Set();
465
- t.add(e), b.set(n, t);
466
- }
467
- let x = e.computations ?? {}, S = Object.keys(x), C = /* @__PURE__ */ new Map();
468
- for (let [e, n] of Object.entries(x)) {
469
- let r = ie(n.source, t);
470
- r.expression && C.set(e, r.expression);
471
- }
472
- let { order: te, cyclic: ne } = d(x), w = {}, T = /* @__PURE__ */ new Map();
473
- for (let e of te) {
474
- let t = x[e];
475
- if (!t || t.kind !== "const") continue;
476
- if (Object.hasOwn(t, "value")) {
477
- let n = t.value, r = c(n);
478
- if (r) {
479
- T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
480
- continue;
481
- }
482
- w[e] = B(n);
483
- continue;
484
- }
485
- let n = C.get(e);
486
- if (!n) T.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
487
- else try {
488
- let t = n.evaluate({ ...w }), r = c(t);
489
- if (r) {
490
- T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
491
- continue;
492
- }
493
- w[e] = B(t);
494
- } catch (t) {
495
- T.set(e, R(t));
496
- }
497
- }
498
- let E = /* @__PURE__ */ new Map();
499
- for (let e of ne) E.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
500
- let D = [];
501
- if (Array.isArray(e.validations)) for (let n of e.validations) {
502
- if (!ee(n)) continue;
503
- let e = ie(n.expression, t);
504
- D.push({
505
- rule: n,
506
- expression: e.expression,
507
- error: e.error
508
- });
509
- }
510
- return {
511
- document: e,
512
- nodeIndex: n,
513
- controls: l,
514
- slotKeys: f,
515
- publicNames: y,
516
- publicSlotOwners: b,
517
- initial: s,
518
- valueRules: m,
519
- legacyValueRules: h,
520
- slotRelations: g,
521
- bindingByNode: v,
522
- computationMetadata: x,
523
- computationNames: S,
524
- computationOrder: te,
525
- cyclicComputations: ne,
526
- computationExpressions: C,
527
- constValues: w,
528
- constErrors: T,
529
- cycleErrors: E,
530
- validationRules: D,
531
- validationLineStarts: _(typeof e.source == "string" ? e.source : "")
532
- };
533
- }
534
- function oe(e) {
535
- 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 ${x}; migrate the source before constructing a runtime.` : null;
536
- }
537
- function G(e, t) {
538
- 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);
539
- }
540
- function se(e, t, n) {
541
- let i = G(e, t);
542
- return i ? H(e.document, i, "local.runtime.value", n) : U("local.runtime.value", r(n));
543
- }
544
- function K(e, t, n) {
545
- let r = e.slotRelations.get(t);
546
- return r?.length ? r.some(({ lower: e, upper: t }) => {
547
- let r = n[e], i = n[t];
548
- return typeof r == "number" && typeof i == "number" && r > i;
549
- }) : !1;
550
- }
551
- function ce(e, t) {
552
- let i = e.nodeIndex.get(t);
553
- return i ? H(e.document, i, "local.runtime.value", n("local.runtime.value.range-order")) : U("local.runtime.value", r(n("local.runtime.value.range-order")));
554
- }
555
- // src/local/runtime/retention.ts
556
- function q(e) {
557
- let t = /* @__PURE__ */ new Map();
558
- for (let n of i(e.nodes)) t.set(n.id, n);
559
- return t;
560
- }
561
- function le(e, t, n) {
562
- let r = e.bindingSlots?.[t.id];
563
- return r !== void 0 && Object.values(r).includes(n);
564
- }
565
- function J(e, t, n) {
566
- let r = t.name ? C(t.name) : void 0;
567
- if (r?.bindings) {
568
- let i = e.bindingSlots?.[t.id];
569
- 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;
570
- } else if (t.attrs?.bind === n || le(e, t, n)) return "initial";
571
- }
572
- function Y(e) {
573
- let t = q(e), n = u(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
574
- for (let [a, o] of Object.entries(e.bindings)) {
575
- let s = o.nodeIds.flatMap((e) => {
576
- let n = t.get(e);
577
- return n ? [n] : [];
578
- });
579
- if (!s.length || a.startsWith("@") || r.has(a)) continue;
580
- let c;
581
- if (n === void 0) {
582
- let t = s.map((t) => J(e, t, a));
583
- if (t.some((e) => e === void 0)) continue;
584
- c = t;
585
- } else {
586
- let e = n.bindingAttributes?.[a]?.initial ?? "initial";
587
- c = s.map(() => e);
588
- }
589
- let l = s.flatMap((e, t) => Object.hasOwn(e.attrs ?? {}, c[t]) ? [e.attrs[c[t]]] : []).sort();
590
- i.set(a, {
591
- type: o.type,
592
- initialDefinition: JSON.stringify([o.initial, l])
593
- });
594
- }
595
- return i;
596
- }
597
- function X(e, t) {
598
- return Object.freeze({
599
- name: e,
600
- reason: t
601
- });
602
- }
603
- function Z(e) {
604
- let t = Y(e.previous), n = Y(e.next), r = {}, i = [], a = [];
605
- for (let o of Object.keys(e.state).sort()) {
606
- if (o.startsWith("@")) {
607
- a.push(X(o, "internal"));
608
- continue;
609
- }
610
- if (!Object.hasOwn(e.previous.bindings, o) || !Object.hasOwn(e.next.bindings, o)) {
611
- a.push(X(o, "unknown"));
612
- continue;
613
- }
614
- let s = t.get(o), c = n.get(o);
615
- if (!s || !c) {
616
- a.push(X(o, "unretainable"));
617
- continue;
618
- }
619
- if (s.type !== c.type) {
620
- a.push(X(o, "type"));
621
- continue;
622
- }
623
- if (s.initialDefinition !== c.initialDefinition) {
624
- a.push(X(o, "initial"));
625
- continue;
626
- }
627
- let l = e.state[o];
628
- r[o] = Array.isArray(l) ? Object.freeze([...l]) : l, i.push(o);
629
- }
630
- return Object.freeze({
631
- values: Object.freeze(r),
632
- retained: Object.freeze(i),
633
- dropped: Object.freeze(a)
634
- });
635
- }
636
- function ue(e, t, n) {
637
- return Object.freeze({
638
- retained: Object.freeze([...e]),
639
- dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
640
- diagnostics: Object.freeze([...n])
641
- });
642
- }
643
- function Q(e, t) {
644
- let n = Object.keys(t.values).sort();
645
- if (!e.setParameters(t.values).length) return ue(n, t.dropped, []);
646
- let r = [], i = n, a = [];
647
- for (; i.length;) {
648
- let n = [];
649
- a = [];
650
- for (let o of i) {
651
- let i = e.setParameter(o, t.values[o]);
652
- i.length ? (n.push(o), a.push(...i)) : r.push(o);
653
- }
654
- if (n.length === i.length) break;
655
- i = n;
656
- }
657
- r.sort();
658
- let o = [...t.dropped, ...i.map((e) => X(e, "invalid"))];
659
- return o.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), ue(r, o, a);
660
- }
661
- // src/local/runtime/runtime-migration.ts
662
- function de(e, t, n, r, i) {
663
- let a = Z({
664
- previous: e.document,
665
- state: t,
666
- next: n
667
- }), o = {};
668
- for (let [e, t] of Object.entries(n.bindings)) o[e] = B(t.initial);
669
- let s = /* @__PURE__ */ new Map();
670
- for (let e of a.dropped) s.set(e.name, Object.freeze({ ...e }));
671
- let c = [], l = {}, u = [], d = /* @__PURE__ */ new Set(), f, p = (n) => {
672
- let o = e.document.bindings[n], s = e.controls.get(n) ?? [];
673
- 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 : W(e, n) === W(r, n);
674
- };
675
- for (let e of a.retained) {
676
- let t = n.bindings[e];
677
- if (!t) continue;
678
- if (p(e)) {
679
- d.add(e), l[e] = B(a.values[e]), u.push(e);
680
- continue;
681
- }
682
- let f = L(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
683
- f.ok ? (l[e] = B(f.value), u.push(e)) : (c.push(se(r, t, f.detail)), s.set(e, Object.freeze({
684
- name: e,
685
- reason: "invalid"
686
- })));
687
- }
688
- let ee = {
689
- ...o,
690
- ...l
691
- }, m = /* @__PURE__ */ new Set();
692
- for (let e of u) for (let t of r.publicSlotOwners.get(e) ?? []) m.add(t);
693
- let h = !1;
694
- for (let e of [...m].sort()) if (K(r, e, ee)) {
695
- h = !0;
696
- break;
697
- }
698
- let g;
699
- if (!h) Object.assign(o, l), g = u;
700
- else {
701
- g = [];
702
- for (let e of u) {
703
- let t = o[e];
704
- o[e] = l[e];
705
- let n = !1;
706
- for (let t of [...r.publicSlotOwners.get(e) ?? []].sort()) K(r, t, o) && (c.push(ce(r, t)), n = !0);
707
- n ? (o[e] = t, s.set(e, Object.freeze({
708
- name: e,
709
- reason: "invalid"
710
- }))) : g.push(e);
711
- }
712
- }
713
- for (let [e, t] of r.slotRelations) if (K(r, e, o)) {
714
- for (let e of t) for (let t of [e.lower, e.upper]) {
715
- let e = n.bindings[t];
716
- if (!e) continue;
717
- o[t] = B(e.initial);
718
- let r = g.indexOf(t);
719
- r >= 0 && g.splice(r, 1), s.set(t, Object.freeze({
720
- name: t,
721
- reason: "invalid"
722
- }));
723
- }
724
- if (c.push(ce(r, e)), K(r, e, o)) return {
725
- values: {},
726
- retained: [],
727
- dropped: [],
728
- diagnostics: []
729
- };
730
- }
731
- let _ = !0;
732
- for (; _;) {
733
- let e = i({}, r, o), t = [];
734
- for (let i of g) {
735
- if (d.has(i)) continue;
736
- let a = n.bindings[i], s = L(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
737
- s.ok || (c.push(se(r, a, s.detail)), t.push(i));
738
- }
739
- for (let e of t) o[e] = B(n.bindings[e].initial), g.splice(g.indexOf(e), 1), s.set(e, Object.freeze({
740
- name: e,
741
- reason: "invalid"
742
- }));
743
- _ = t.length > 0;
744
- }
745
- let v = [...s.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
746
- return g.sort(), {
747
- values: o,
748
- retained: g,
749
- dropped: v,
750
- diagnostics: c
751
- };
752
- }
753
- // src/local/runtime/runtime.ts
754
- function fe(e) {
755
- return {
756
- ...e,
757
- range: { ...e.range }
758
- };
759
- }
760
- function pe(e, t) {
761
- return Array.isArray(e) || Array.isArray(t) ? !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => e === t[n]) : e === t;
762
- }
763
- function me(e) {
764
- for (let [t, n] of Object.entries(e)) Array.isArray(n) && !Object.isFrozen(n) && (e[t] = Object.freeze([...n]));
765
- return Object.freeze(e);
766
- }
767
- var he = /* @__PURE__ */ new WeakMap();
768
- function $(e) {
769
- return Object.freeze({
770
- ok: e.ok,
771
- changed: e.changed,
772
- revision: e.revision,
773
- retained: Object.freeze([...e.retained]),
774
- dropped: Object.freeze(e.dropped.map((e) => Object.freeze({ ...e }))),
775
- diagnostics: Object.freeze([...e.diagnostics])
776
- });
777
- }
778
- function ge(e, t, n) {
779
- let r = he.get(e);
780
- if (!r) throw TypeError("updateLocalRuntime requires a runtime created by createLocalRuntime.");
781
- return r.update(t, n?.notify !== !1);
782
- }
783
- function _e(e) {
784
- he.get(e)?.notify();
785
- }
786
- function ve(e, t, n) {
787
- return he.get(e)?.bindNetworkExternals(t, n) ?? (() => {});
788
- }
789
- function ye(e, t) {
790
- let c = oe(e);
791
- if (c) throw Error(c);
792
- let u = t?.services === void 0, d = te(t?.network), f = /* @__PURE__ */ new Map(), ee = ne(e.source), _ = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), S = ae(e, x), C = () => S, E = () => {
793
- let e = /* @__PURE__ */ new Set();
794
- for (let n of i(S.document.nodes)) n.name !== void 0 && e.add(w({
795
- documentId: t?.documentId,
796
- sourceDigest: ee,
797
- nodeId: n.id,
798
- stateKey: n.attrs?.["state-key"]
799
- }));
800
- return e;
801
- }, D = t?.services ?? T({
802
- documentId: t?.documentId,
803
- sourceDigest: ee,
804
- randomSeed: t?.randomSeed,
805
- componentState: t?.componentState,
806
- ...t?.componentStateStorage === void 0 ? {} : { componentStateStorage: t.componentStateStorage },
807
- ...t?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: t.componentStateWriteDelayMs },
808
- ...t?.configKey === void 0 ? {} : { configKey: t.configKey },
809
- ...t?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: t.legacyConfigKeys },
810
- ...u ? { knownStateKeys: E } : {}
811
- }), O = {}, k = /* @__PURE__ */ new Map();
812
- for (let [n, r] of Object.entries(e.externals ?? {})) {
813
- let e = t?.externalValues?.[n];
814
- if (e === void 0) continue;
815
- let i = re(r.type, e);
816
- i.ok && (O[n] = i.value);
817
- }
818
- let A = (e, t) => {
819
- let n = {};
820
- for (let [r, i] of Object.entries(e.document.externals ?? {})) {
821
- if (!Object.hasOwn(t, r)) continue;
822
- let e = re(i.type, t[r]);
823
- e.ok && (n[r] = e.value);
824
- }
825
- return n;
826
- }, j = (e) => {
827
- let t = A(e, O);
828
- for (let n of k.keys()) Object.assign(t, A(e, n));
829
- return t;
830
- }, M = (e, t, n, r = C()) => {
831
- let i = r.document.dynamicConstraints?.[e.id]?.[t];
832
- if (!i) return { present: !1 };
833
- let a = ie(i.source, x);
834
- if (!a.expression) return {
835
- present: !0,
836
- ok: !1
837
- };
838
- try {
839
- let e = a.expression.evaluate(n), t = i.numeric;
840
- return t && (typeof e != "number" || !Number.isFinite(e) || t.integer === !0 && !Number.isInteger(e) || t.min !== void 0 && e < t.min || t.max !== void 0 && e > t.max) ? {
841
- present: !0,
842
- ok: !1
843
- } : {
844
- present: !0,
845
- ok: !0,
846
- value: e
847
- };
848
- } catch {
849
- return {
850
- present: !0,
851
- ok: !1
852
- };
853
- }
854
- }, N = S.initial, P = 0, F = {}, I = {}, R = {
855
- revision: 0,
856
- state: me({})
857
- }, z = !1, V = null, W = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), q = () => {
858
- if (z) throw Error("The local interaction runtime has been disposed.");
859
- };
860
- function le(e, t) {
861
- if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(N, t) ? N[t] : void 0;
862
- }
863
- let J = (e, t) => {
864
- let n = j(e), r = /* @__PURE__ */ new Map();
865
- 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));
866
- let i = {}, o = /* @__PURE__ */ new Map();
867
- if (e.computationNames.length > 0) {
868
- let a = p(e.computationMetadata, e.computationOrder, e.computationExpressions, {
869
- ...t,
870
- ...n
871
- }, e.constValues, r);
872
- i = a.values, o = a.errors;
873
- for (let [t, n] of e.constErrors) Object.hasOwn(i, t) || o.set(t, n);
874
- for (let [t, n] of e.cycleErrors) Object.hasOwn(i, t) || o.set(t, n);
875
- }
876
- let s = {};
877
- for (let [e, n] of Object.entries(t)) s[e] = n;
878
- for (let [e, t] of Object.entries(n)) s[e] = t;
879
- for (let [e, t] of Object.entries(i)) s[e] = t;
880
- for (let [e, t] of [...r, ...o]) Object.hasOwn(i, e) || Object.defineProperty(s, e, {
881
- enumerable: !0,
882
- configurable: !0,
883
- get() {
884
- throw t;
885
- }
886
- });
887
- let c = {};
888
- for (let [e, n] of Object.entries(t)) c[e] = n;
889
- for (let [e, t] of Object.entries(n)) c[e] = t;
890
- for (let [e, t] of Object.entries(i)) c[e] = t;
891
- return {
892
- environment: s,
893
- snapshotState: c
894
- };
895
- }, Y = () => {
896
- let e = J(C(), N);
897
- F = e.environment, I = e.snapshotState;
898
- }, X = (e, t = C(), n = N) => {
899
- let r;
900
- return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= J(t, {
901
- ...n,
902
- ...e
903
- }).environment, M(i, a, r, t)) : { present: !1 };
904
- }, Z = () => {
905
- R = {
906
- revision: P,
907
- state: me(I)
908
- };
909
- }, ue = () => {
910
- for (let e of W) e();
911
- }, Q = (e) => {
912
- N = e, P += 1, Y(), Z(), ue();
913
- }, ge = () => {
914
- P += 1, Y(), Z(), ue();
915
- }, _e = (e, t = O) => {
916
- if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
917
- let i = [], a = {}, o = Object.keys(e).sort();
918
- for (let t of o) {
919
- if (t === "__proto__") {
920
- i.push(U("local.runtime.external", "External names cannot be \"__proto__\"."));
921
- continue;
922
- }
923
- let o = C().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
924
- if (!s) {
925
- let e = n("local.runtime.external", { name: t });
926
- i.push(U("local.runtime.external", r(e), e));
927
- continue;
928
- }
929
- let c = re(s.type, e[t]);
930
- if (c.ok) a[t] = c.value;
931
- else {
932
- let e = n(c.key, {
933
- name: t,
934
- ...c.params ?? {}
935
- });
936
- i.push(U("local.runtime.external", r(e), e));
937
- }
938
- }
939
- return i.length ? i : (o.some((e) => !pe(t[e], a[e])) && (Object.assign(t, a), ge()), []);
940
- }, ve = (e, t) => {
941
- if (z) return () => {};
942
- let n = {}, r = e.bindExternalValues((e) => {
943
- if (z || !k.has(n)) return;
944
- let r = _e(e, n);
945
- r.length && t?.(r);
946
- });
947
- return r ? (k.set(n, r), () => {
948
- k.delete(n) && (r(), !z && Object.keys(n).length && ge());
949
- }) : () => {};
950
- }, ye = (e) => {
951
- q();
952
- let t = C(), n = [], r = {}, i = Object.keys(e).sort(), a = X(e);
953
- for (let o of i) {
954
- if (o === "__proto__") {
955
- n.push(U("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
956
- continue;
957
- }
958
- if (o.startsWith("@")) {
959
- n.push(U("local.runtime.parameter", `Internal parameter "${o}" cannot be written by name.`));
960
- continue;
961
- }
962
- if (!Object.hasOwn(t.document.bindings, o)) {
963
- n.push(U("local.runtime.parameter", `Unknown parameter "${o}".`));
964
- continue;
965
- }
966
- let i = t.document.bindings[o], s = L(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
967
- s.ok ? r[o] = B(s.value) : n.push(se(t, i, s.detail));
968
- }
969
- if (n.length) return n;
970
- if (!i.some((e) => !pe(N[e], r[e]))) return [];
971
- let o = {
972
- ...N,
973
- ...r
974
- }, s = /* @__PURE__ */ new Set();
975
- for (let e of i) for (let n of t.publicSlotOwners.get(e) ?? []) s.add(n);
976
- for (let e of [...s].sort()) K(t, e, o) && n.push(ce(t, e));
977
- return n.length ? n : (Q(o), []);
978
- }, be = (e) => {
979
- let t = _.get(e);
980
- if (!t) {
981
- if (t = l(e), _.size >= 200) {
982
- let e = _.keys().next().value;
983
- e !== void 0 && _.delete(e);
984
- }
985
- _.set(e, t);
986
- }
987
- return t;
988
- }, xe = () => {
989
- let e = C(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
990
- for (let r of e.validationRules) {
991
- if (r.error) {
992
- t.push(m(n, e.validationLineStarts, r.rule.range, y, h(`Validation expression is invalid: ${r.error.message}`)));
993
- continue;
994
- }
995
- if (!r.expression) continue;
996
- let i;
997
- try {
998
- i = r.expression.evaluate(F);
999
- } catch (i) {
1000
- t.push(m(n, e.validationLineStarts, r.rule.range, y, h(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
1001
- continue;
1002
- }
1003
- typeof i == "boolean" ? i || t.push(m(n, e.validationLineStarts, r.rule.range, g, Se(r.rule.message))) : t.push(m(n, e.validationLineStarts, r.rule.range, y, "Validation expression must evaluate to a boolean."));
1004
- }
1005
- return t;
1006
- }, Se = (e) => {
1007
- let t;
1008
- try {
1009
- t = s(e, F);
1010
- } catch {
1011
- t = v;
1012
- }
1013
- return h(t);
1014
- }, Ce = (e, t) => {
1015
- if (q(), e === S.document) return $({
1016
- ok: !0,
1017
- changed: !1,
1018
- revision: P,
1019
- retained: [],
1020
- dropped: [],
1021
- diagnostics: []
1022
- });
1023
- if (oe(e)) return $({
1024
- ok: !1,
1025
- changed: !1,
1026
- revision: P,
1027
- retained: [],
1028
- dropped: [],
1029
- diagnostics: []
1030
- });
1031
- let n;
1032
- try {
1033
- n = ae(e, x);
1034
- } catch {
1035
- return $({
1036
- ok: !1,
1037
- changed: !1,
1038
- revision: P,
1039
- retained: [],
1040
- dropped: [],
1041
- diagnostics: []
1042
- });
1043
- }
1044
- let r = de(S, N, e, n, X);
1045
- if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
1046
- ok: !1,
1047
- changed: !1,
1048
- revision: P,
1049
- retained: [],
1050
- dropped: [],
1051
- diagnostics: []
1052
- });
1053
- let i;
1054
- try {
1055
- i = J(n, r.values);
1056
- } catch {
1057
- return $({
1058
- ok: !1,
1059
- changed: !1,
1060
- revision: P,
1061
- retained: [],
1062
- dropped: [],
1063
- diagnostics: []
1064
- });
1065
- }
1066
- for (let e of [O, ...k.keys()]) {
1067
- let t = A(n, e);
1068
- for (let t of Object.keys(e)) delete e[t];
1069
- Object.assign(e, t);
1070
- }
1071
- if (S = n, N = r.values, F = i.environment, I = i.snapshotState, V = null, P += 1, Z(), t) for (let e of W) e();
1072
- return $({
1073
- ok: !0,
1074
- changed: !0,
1075
- revision: P,
1076
- retained: r.retained,
1077
- dropped: r.dropped,
1078
- diagnostics: r.diagnostics
1079
- });
1080
- }, we = (e) => {
1081
- let t = /* @__PURE__ */ new Set();
1082
- for (let n of i([e])) t.add(n.id);
1083
- return t;
1084
- }, Te = {
1085
- network: d.network,
1086
- get document() {
1087
- return S.document;
1088
- },
1089
- services: D,
1090
- snapshot() {
1091
- return q(), R;
1092
- },
1093
- get(e, t) {
1094
- q();
1095
- let n = C(), r = n.nodeIndex.get(e.id);
1096
- if (!r) return null;
1097
- let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? b(r) : n.slotKeys.get(r.id)?.[t];
1098
- return i && Object.hasOwn(N, i) ? B(N[i]) : null;
1099
- },
1100
- set(e, t, r) {
1101
- q();
1102
- let i = C(), a = i.nodeIndex.get(e.id);
1103
- if (!a) return [H(i.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1104
- let o = i.slotKeys.get(a.id), s;
1105
- if (r === void 0) {
1106
- if (o && !o.value) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.needs-slot"))];
1107
- s = o?.value ?? i.bindingByNode.get(a.id) ?? b(a);
1108
- } else if (s = o?.[r], !s) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: r }))];
1109
- let c = Object.hasOwn(i.document.bindings, s) ? i.document.bindings[s] : void 0;
1110
- if (!c) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1111
- let l = L(c, i.controls.get(s) ?? [], t, X({ [s]: t }), i.valueRules, i.legacyValueRules);
1112
- if (!l.ok) return [H(i.document, a, "local.runtime.value", l.detail)];
1113
- let u = B(l.value);
1114
- if (pe(N[s], u)) return [];
1115
- let d = {
1116
- ...N,
1117
- [s]: u
1118
- };
1119
- return K(i, a.id, d) ? [H(i.document, a, "local.runtime.value", n("local.runtime.value.range-order"))] : (Q(d), []);
1120
- },
1121
- setMany(e, t) {
1122
- q();
1123
- let r = C(), i = r.nodeIndex.get(e.id);
1124
- if (!i) return [H(r.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1125
- let a = r.slotKeys.get(i.id);
1126
- if (!a) return [H(r.document, i, "local.runtime.binding", n("local.runtime.binding.no-multi-slot"))];
1127
- let o = Object.entries(t);
1128
- if (!o.length) return [];
1129
- let s = { ...N }, c = J(r, {
1130
- ...N,
1131
- ...Object.fromEntries(o.map(([e, t]) => [a[e], t]))
1132
- }).environment;
1133
- for (let [e, t] of o) {
1134
- let o = a[e];
1135
- if (!o || !Object.hasOwn(r.document.bindings, o)) return [H(r.document, i, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: e }))];
1136
- let l = L(r.document.bindings[o], r.controls.get(o) ?? [], t, (e, t) => M(e, t, c), r.valueRules, r.legacyValueRules);
1137
- if (!l.ok) return [H(r.document, i, "local.runtime.value", l.detail)];
1138
- s[o] = B(l.value);
1139
- }
1140
- return K(r, i.id, s) ? [H(r.document, i, "local.runtime.value", n("local.runtime.value.range-order"))] : (o.every(([e, t]) => pe(N[a[e]], t)) || Q(s), []);
1141
- },
1142
- parameterNames() {
1143
- return q(), C().publicNames;
1144
- },
1145
- getParameter(e) {
1146
- q();
1147
- let t = le(C(), e);
1148
- return t === void 0 ? void 0 : B(t);
1149
- },
1150
- getParameters() {
1151
- q();
1152
- let e = C(), t = {};
1153
- for (let n of e.publicNames) {
1154
- let e = N[n];
1155
- t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
1156
- }
1157
- return Object.freeze(t);
1158
- },
1159
- readSubmissionFields(e) {
1160
- q();
1161
- let t = C(), n = /* @__PURE__ */ new Map(), r = (e, n) => M(e, n, F, t);
1162
- if (e.length === 0) return {
1163
- ok: !1,
1164
- field: "",
1165
- reason: "unavailable"
1166
- };
1167
- for (let i of e) {
1168
- let e = le(t, i);
1169
- if (e === void 0 || n.has(i)) return {
1170
- ok: !1,
1171
- field: i,
1172
- reason: "unavailable"
1173
- };
1174
- let a = L(t.document.bindings[i], t.controls.get(i) ?? [], e, r, t.valueRules, t.legacyValueRules);
1175
- if (!a.ok) {
1176
- let e = a.detail.key;
1177
- return {
1178
- ok: !1,
1179
- field: i,
1180
- reason: e === "local.runtime.value.field-required" || e === "local.runtime.value.date-required" ? "required" : "invalid"
1181
- };
1182
- }
1183
- n.set(i, e);
1184
- }
1185
- let i = Object.create(null);
1186
- for (let [e, r] of n) {
1187
- for (let [n, i] of f.get(e) ?? []) {
1188
- if (!t.controls.get(e)?.some((e) => e.id === i)) continue;
1189
- let a = n(B(r));
1190
- if (a) return {
1191
- ok: !1,
1192
- field: e,
1193
- reason: a
1194
- };
1195
- }
1196
- i[e] = Array.isArray(r) ? Object.freeze([...r]) : r;
1197
- }
1198
- return {
1199
- ok: !0,
1200
- payload: Object.freeze(i)
1201
- };
1202
- },
1203
- registerSubmissionField(e, t) {
1204
- if (z) return () => {};
1205
- let n = C(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
1206
- if (!r || r.startsWith("@")) return () => {};
1207
- let i = f.get(r);
1208
- return i || f.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
1209
- i.delete(t), i.size === 0 && f.get(r) === i && f.delete(r);
1210
- };
1211
- },
1212
- setParameter(e, t) {
1213
- q();
1214
- let n = Object.create(null);
1215
- return n[e] = t, ye(n);
1216
- },
1217
- setParameters(e) {
1218
- if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setParameters requires an object of parameter values.");
1219
- return ye(e);
1220
- },
1221
- getExternal(e) {
1222
- if (q(), Object.hasOwn(C().document.externals ?? {}, e) && Object.hasOwn(I, e)) return B(I[e]);
1223
- },
1224
- getExternalValues() {
1225
- q();
1226
- let e = {};
1227
- for (let [t, n] of Object.entries(j(C()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
1228
- return Object.freeze(e);
1229
- },
1230
- setExternalValues(e) {
1231
- return _e(e);
1232
- },
1233
- evaluate(e) {
1234
- q();
1235
- let t = be(e).evaluate(F);
1236
- return Array.isArray(t) ? t.slice() : t;
1237
- },
1238
- validate() {
1239
- if (q(), V && V.revision === P) return V.diagnostics.map(fe);
1240
- let e = xe();
1241
- return V = {
1242
- revision: P,
1243
- diagnostics: e
1244
- }, e.map(fe);
1245
- },
1246
- text(e) {
1247
- return q(), s(e, F);
1248
- },
1249
- reset(e) {
1250
- q();
1251
- let t = C(), n = t.nodeIndex.get(e.id);
1252
- if (!n) return;
1253
- let i = we(n), s = { ...N };
1254
- for (let [e, n] of Object.entries(t.document.bindings)) {
1255
- if (!(t.controls.get(e) ?? []).some((e) => i.has(e.id))) continue;
1256
- let c = o(n.initial);
1257
- if (c) throw new a("expression-budget", `Parameter "${e}": ${r(c)}`, 0);
1258
- s[e] = B(n.initial);
1259
- }
1260
- for (let e of i) G.set(e, (G.get(e) ?? 0) + 1);
1261
- Q(s);
1262
- },
1263
- resetToken(e) {
1264
- q();
1265
- let t = C().nodeIndex.get(e.id);
1266
- return t ? G.get(t.id) ?? 0 : 0;
1267
- },
1268
- subscribe(e) {
1269
- return q(), W.add(e), () => {
1270
- W.delete(e);
1271
- };
1272
- },
1273
- dispose() {
1274
- if (!z) {
1275
- z = !0, d.dispose();
1276
- for (let e of k.values()) e();
1277
- k.clear(), f.clear(), D.state.flush(), u && D.scheduler.dispose(), W.clear(), _.clear(), x.clear(), S.computationExpressions.clear(), S.constErrors.clear(), S.cycleErrors.clear(), S.validationRules.length = 0, G.clear();
1278
- }
1279
- }
1280
- };
1281
- return he.set(Te, {
1282
- update: Ce,
1283
- bindNetworkExternals: ve,
1284
- notify() {
1285
- if (!z) for (let e of W) e();
1286
- }
1287
- }), Y(), Z(), ve(d), Te;
1288
- }
1289
- export { Q as a, ge as i, ye as n, Z as o, _e as r, ve as t };