reactive-md 0.8.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 (441) hide show
  1. package/CHANGELOG-ch.md +54 -4
  2. package/CHANGELOG.md +55 -4
  3. package/CONTRIBUTING-ch.md +13 -2
  4. package/CONTRIBUTING.md +13 -2
  5. package/README-ch.md +132 -23
  6. package/README-en.md +130 -21
  7. package/README.md +128 -21
  8. package/SECURITY-ch.md +3 -3
  9. package/SECURITY.md +3 -3
  10. package/THIRD_PARTY_NOTICES.md +111 -1
  11. package/cli/args.mjs +51 -1
  12. package/cli/assets.mjs +6 -1
  13. package/cli/build.mjs +125 -9
  14. package/cli/fs-utils.mjs +3 -3
  15. package/cli/help.mjs +12 -5
  16. package/cli/init.mjs +1 -1
  17. package/cli/package.mjs +1 -0
  18. package/dist-library/LocalDocumentView-sthUP0ct.js +109 -0
  19. package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
  20. package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
  21. package/dist-library/{authoring-BsfSwQRm.js → authoring-Dsune4Hy.js} +240 -218
  22. package/dist-library/compile-wUv8KEge.js +1249 -0
  23. package/dist-library/{compiler-core-kPiH-gOV.js → compiler-core-As_m-MNm.js} +5372 -5559
  24. package/dist-library/compiler-eOfcinZs.js +62 -0
  25. package/dist-library/component-state-BoLCGee4.js +801 -0
  26. package/dist-library/{component-state-D_cw_EHe.js → component-state-C52ZFJGl.js} +2 -2
  27. package/dist-library/{registry-B9Jc3FVe.js → config-BadfhjdP.js} +374 -457
  28. package/dist-library/{config-validation-DXTynAw7.js → config-validation-F47AcE6o.js} +549 -751
  29. package/dist-library/controls-CcT6n7k_.js +6740 -0
  30. package/dist-library/coordinate-CWS9p5q_.js +293 -0
  31. package/dist-library/data-table-Bgccxd7h.js +296 -0
  32. package/dist-library/{default-components-Z_YMio5P.js → default-components-BwQf0oP-.js} +344 -334
  33. package/dist-library/{math-display-BJz4gbFc.js → display-B-VhqVND.js} +1299 -1299
  34. package/dist-library/export-BqVmTXm8.js +369 -0
  35. package/dist-library/gallery-CY6mTx8i.js +360 -0
  36. package/dist-library/html-CNT4KD-2.js +757 -0
  37. package/dist-library/{math-sample-BGEW49zY.js → incremental-Dv0FSp_U.js} +476 -394
  38. package/dist-library/latex-1w7aQgD5.js +928 -0
  39. package/dist-library/layout-C0YlEPGr.js +562 -0
  40. package/dist-library/mount-preset-KxvtKgJb.js +13 -0
  41. package/dist-library/options-1aDLK7JY.js +121 -0
  42. package/dist-library/{react-ByOHunUW.js → package-core-WFK1RhAZ.js} +49 -55
  43. package/dist-library/{parser-standard-DlCk7sLo.js → parser-standard-Yuf3A_VI.js} +6605 -7097
  44. package/dist-library/plugin-packs-B1XPWcFs.js +18 -0
  45. package/dist-library/{identity-MYJXKSkB.js → preset-core-CKc5YXSM.js} +31 -31
  46. package/dist-library/{props-DGlBk0e5.js → props-sJ8vk0cr.js} +1 -1
  47. package/dist-library/react-BbyAgeXc.js +6070 -0
  48. package/dist-library/react-D5iGiUdL.js +7 -0
  49. package/dist-library/reactive-md-authoring.js +222 -223
  50. package/dist-library/reactive-md-build.js +126 -72
  51. package/dist-library/reactive-md-compiler-standard.js +12 -10
  52. package/dist-library/reactive-md-compiler.js +3 -3
  53. package/dist-library/reactive-md-default-packs.js +2 -2
  54. package/dist-library/reactive-md-default-preset.js +4 -4
  55. package/dist-library/reactive-md-export-assets.js +57 -0
  56. package/dist-library/reactive-md-export.js +5 -111
  57. package/dist-library/reactive-md-minimal-preset.js +24 -0
  58. package/dist-library/reactive-md-minimal-react-preset.js +26 -0
  59. package/dist-library/reactive-md-minimal-styles.js +80 -0
  60. package/dist-library/reactive-md-minimal.css +2 -0
  61. package/dist-library/reactive-md-pdf.js +7582 -0
  62. package/dist-library/reactive-md-plugin-chart.js +13 -0
  63. package/dist-library/reactive-md-plugin-data.js +17 -0
  64. package/dist-library/reactive-md-plugin-diagram.js +18 -0
  65. package/dist-library/reactive-md-plugin-forms.js +18 -0
  66. package/dist-library/reactive-md-plugin-gallery.js +12 -0
  67. package/dist-library/reactive-md-plugin-navigation.js +15 -0
  68. package/dist-library/reactive-md-plugin-network.js +222 -0
  69. package/dist-library/reactive-md-plugin-plot.js +24 -0
  70. package/dist-library/reactive-md-print.css +5 -0
  71. package/dist-library/reactive-md-react-minimal.js +28 -0
  72. package/dist-library/reactive-md-react-server.js +34 -32
  73. package/dist-library/reactive-md-react-unstyled.js +14 -9
  74. package/dist-library/reactive-md-react.js +14 -9
  75. package/dist-library/reactive-md-runtime-browser.js +847 -15
  76. package/dist-library/reactive-md-runtime.js +3 -3
  77. package/dist-library/reactive-md-sdk.js +8 -6
  78. package/dist-library/reactive-md-standalone-configured.js +16 -0
  79. package/dist-library/reactive-md-standalone-host.js +9 -438
  80. package/dist-library/reactive-md-testing-browser.js +5 -4
  81. package/dist-library/reactive-md-testing-react.js +46 -44
  82. package/dist-library/reactive-md-testing.js +45 -44
  83. package/dist-library/reactive-md-vite.js +135 -37
  84. package/dist-library/reactive-md.css +1 -1
  85. package/dist-library/reactive-md.js +590 -498
  86. package/dist-library/registry-B9NGct4d.js +20 -0
  87. package/dist-library/registry-core-Bbad9Bm2.js +479 -0
  88. package/dist-library/{resources-BGt8mpDA.js → resources-D2GDQS0p.js} +45 -45
  89. package/dist-library/{runtime-Dkq7ldyg.js → runtime-B2fxeveq.js} +1 -1
  90. package/dist-library/runtime-kcA7bG7G.js +1282 -0
  91. package/dist-library/sample-bP4zHB3L.js +289 -0
  92. package/dist-library/{schema-ZFufO8V0.js → schema-BufhKUSM.js} +12 -11
  93. package/dist-library/sdk-core-BoJT1SIt.js +1166 -0
  94. package/dist-library/session-core-nmJHuR9c.js +452 -0
  95. package/dist-library/{shareable-DDVL4Fi9.js → shareable-DpbE-59H.js} +250 -283
  96. package/dist-library/tooltip-layer-HDLrSWs0.js +28 -0
  97. package/dist-library/types/authoring/catalog.d.ts +2 -3
  98. package/dist-library/types/authoring/editor-i18n.d.ts +1 -1
  99. package/dist-library/types/authoring/index.d.ts +1 -1
  100. package/dist-library/types/authoring/insert.d.ts +1 -1
  101. package/dist-library/types/authoring/templates.d.ts +2 -2
  102. package/dist-library/types/build/diagnostics.d.ts +1 -1
  103. package/dist-library/types/build/host.d.ts +1 -1
  104. package/dist-library/types/build/index.d.ts +1 -1
  105. package/dist-library/types/build/notices.d.ts +1 -1
  106. package/dist-library/types/build/resources.d.ts +1 -1
  107. package/dist-library/types/build/vite.d.ts +1 -1
  108. package/dist-library/types/compiler/index.d.ts +2 -2
  109. package/dist-library/types/compiler/result.d.ts +1 -1
  110. package/dist-library/types/compiler/standard.d.ts +2 -2
  111. package/dist-library/types/compiler/types.d.ts +1 -1
  112. package/dist-library/types/components/{controls.d.ts → controls/controls.d.ts} +2 -3
  113. package/dist-library/types/components/{numeric-sliders.d.ts → controls/numeric-sliders.d.ts} +1 -1
  114. package/dist-library/types/components/{gallery.d.ts → gallery/gallery.d.ts} +1 -1
  115. package/dist-library/types/components/{layout.d.ts → layout/layout.d.ts} +1 -1
  116. package/dist-library/types/components/minimal-preset.d.ts +2 -0
  117. package/dist-library/types/components/mount-preset.d.ts +4 -0
  118. package/dist-library/types/components/network/submit-button.d.ts +10 -0
  119. package/dist-library/types/components/plot/coordinate.d.ts +2 -0
  120. package/dist-library/types/components/plugins/chart.d.ts +2 -0
  121. package/dist-library/types/components/plugins/data.d.ts +2 -0
  122. package/dist-library/types/components/plugins/diagram.d.ts +2 -0
  123. package/dist-library/types/components/plugins/forms.d.ts +2 -0
  124. package/dist-library/types/components/plugins/gallery.d.ts +2 -0
  125. package/dist-library/types/components/plugins/navigation.d.ts +2 -0
  126. package/dist-library/types/components/plugins/network.d.ts +2 -0
  127. package/dist-library/types/components/plugins/plot.d.ts +2 -0
  128. package/dist-library/types/components/shared/visual-frame.d.ts +12 -0
  129. package/dist-library/types/components/{visuals.d.ts → shared/visuals.d.ts} +1 -7
  130. package/dist-library/types/components/{data-table.d.ts → table/data-table.d.ts} +2 -2
  131. package/dist-library/types/export/component-state.d.ts +1 -1
  132. package/dist-library/types/export/index.d.ts +2 -1
  133. package/dist-library/types/export/print-document.d.ts +18 -0
  134. package/dist-library/types/export/render-markup.d.ts +23 -0
  135. package/dist-library/types/export/requirements.d.ts +1 -1
  136. package/dist-library/types/export/resources.d.ts +1 -1
  137. package/dist-library/types/export/restoration.d.ts +1 -1
  138. package/dist-library/types/export-assets/index.d.ts +25 -0
  139. package/dist-library/types/local/compilation/compiler-attributes.d.ts +8 -0
  140. package/dist-library/types/local/compilation/compiler-bindings.d.ts +19 -0
  141. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
  142. package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
  143. package/dist-library/types/local/compilation/compiler-declarations.d.ts +32 -0
  144. package/dist-library/types/local/compilation/compiler-expressions.d.ts +32 -0
  145. package/dist-library/types/local/compilation/compiler-services.d.ts +62 -16
  146. package/dist-library/types/local/compilation/compiler-structure.d.ts +38 -3
  147. package/dist-library/types/local/compilation/compiler-tables.d.ts +30 -0
  148. package/dist-library/types/local/compilation/compiler-validation.d.ts +15 -0
  149. package/dist-library/types/local/compilation/compiler-values.d.ts +39 -1
  150. package/dist-library/types/local/compilation/compiler.d.ts +7 -14
  151. package/dist-library/types/local/compilation/dependencies.d.ts +1 -1
  152. package/dist-library/types/local/compilation/session/incremental.d.ts +75 -0
  153. package/dist-library/types/local/{session → compilation/session}/row-reuse.d.ts +1 -1
  154. package/dist-library/types/local/{session/compiler-cache.d.ts → compilation/session/semantic-cache.d.ts} +5 -19
  155. package/dist-library/types/local/compilation/streaming.d.ts +27 -0
  156. package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
  157. package/dist-library/types/local/{compilation → configuration}/component-kernel.d.ts +3 -79
  158. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +1104 -1056
  159. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +731 -0
  160. package/dist-library/types/local/configuration/diagnostics.d.ts +1 -1
  161. package/dist-library/types/local/configuration/kernel-value-rules.d.ts +66 -0
  162. package/dist-library/types/local/configuration/official-leaf-syntax.d.ts +24 -0
  163. package/dist-library/types/local/configuration/options-core.d.ts +5 -4
  164. package/dist-library/types/local/configuration/options.d.ts +2 -1
  165. package/dist-library/types/local/configuration/portable-options.d.ts +1 -1
  166. package/dist-library/types/local/configuration/schema-core.d.ts +1 -1
  167. package/dist-library/types/local/configuration/schema.d.ts +1 -1
  168. package/dist-library/types/local/css/author-css.d.ts +66 -0
  169. package/dist-library/types/local/evaluation/computations.d.ts +2 -2
  170. package/dist-library/types/local/evaluation/expression/compile.d.ts +30 -0
  171. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -0
  172. package/dist-library/types/local/evaluation/expression/inference.d.ts +4 -0
  173. package/dist-library/types/local/evaluation/expression/syntax.d.ts +72 -0
  174. package/dist-library/types/local/evaluation/expression/values.d.ts +56 -0
  175. package/dist-library/types/local/evaluation/{math-display.d.ts → math/display.d.ts} +2 -2
  176. package/dist-library/types/local/evaluation/math/evaluation.d.ts +10 -0
  177. package/dist-library/types/local/evaluation/{math.d.ts → math/latex.d.ts} +58 -17
  178. package/dist-library/types/local/evaluation/{math-sample.d.ts → math/sample.d.ts} +4 -2
  179. package/dist-library/types/local/evaluation/math/syntax.d.ts +72 -0
  180. package/dist-library/types/local/evaluation/validation.d.ts +1 -1
  181. package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
  182. package/dist-library/types/local/html/html-details.d.ts +1 -1
  183. package/dist-library/types/local/html/html-entities.d.ts +11 -2
  184. package/dist-library/types/local/html/html-recovery.d.ts +1 -1
  185. package/dist-library/types/local/html/html-table.d.ts +1 -1
  186. package/dist-library/types/local/html/html.d.ts +40 -4
  187. package/dist-library/types/local/index.d.ts +14 -13
  188. package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
  189. package/dist-library/types/local/{markdown → parsing}/fast-markdown.d.ts +1 -1
  190. package/dist-library/types/local/{markdown → parsing}/footnotes.d.ts +1 -1
  191. package/dist-library/types/local/{markdown → parsing}/heading-anchors.d.ts +1 -1
  192. package/dist-library/types/local/parsing/html-attributes.d.ts +14 -0
  193. package/dist-library/types/local/parsing/parse-budget.d.ts +1 -1
  194. package/dist-library/types/local/{session → parsing}/parse-session.d.ts +5 -5
  195. package/dist-library/types/local/parsing/parser-capabilities.d.ts +7 -2
  196. package/dist-library/types/local/parsing/parser-convert.d.ts +26 -0
  197. package/dist-library/types/local/parsing/parser-core.d.ts +10 -4
  198. package/dist-library/types/local/parsing/parser-internals.d.ts +54 -0
  199. package/dist-library/types/local/parsing/parser-region.d.ts +46 -0
  200. package/dist-library/types/local/parsing/parser-standard.d.ts +3 -0
  201. package/dist-library/types/local/parsing/parser-tags.d.ts +108 -0
  202. package/dist-library/types/local/parsing/parser.d.ts +3 -3
  203. package/dist-library/types/local/{markdown → parsing}/plain-paragraphs.d.ts +1 -1
  204. package/dist-library/types/local/parsing/rmd-recovery.d.ts +1 -1
  205. package/dist-library/types/local/parsing/theme-declaration.d.ts +22 -0
  206. package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
  207. package/dist-library/types/local/rendering/document/LocalDocumentView.d.ts +5 -0
  208. package/dist-library/types/local/rendering/{LocalDocumentView.d.ts → document/LocalDocumentViewCore.d.ts} +48 -9
  209. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
  210. package/dist-library/types/local/rendering/document/render-nodes.d.ts +24 -0
  211. package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
  212. package/dist-library/types/local/rendering/document/use-color-scheme.d.ts +10 -0
  213. package/dist-library/types/local/rendering/document/validation-state.d.ts +31 -0
  214. package/dist-library/types/local/rendering/document/view-render-context.d.ts +146 -0
  215. package/dist-library/types/local/rendering/{view-revision.d.ts → document/view-revision.d.ts} +31 -4
  216. package/dist-library/types/local/rendering/render-types.d.ts +1 -1
  217. package/dist-library/types/local/{widgets/table-surface.d.ts → rendering/table/data-table.d.ts} +3 -0
  218. package/dist-library/types/local/rendering/table/table-numeric-columns.d.ts +7 -0
  219. package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
  220. package/dist-library/types/local/runtime/retention.d.ts +1 -1
  221. package/dist-library/types/local/runtime/runtime-document.d.ts +71 -0
  222. package/dist-library/types/local/runtime/runtime-migration.d.ts +19 -0
  223. package/dist-library/types/local/runtime/runtime-values.d.ts +39 -0
  224. package/dist-library/types/local/runtime/runtime.d.ts +4 -2
  225. package/dist-library/types/local/runtime/state.d.ts +1 -1
  226. package/dist-library/types/local/source/authoring-syntax.d.ts +48 -0
  227. package/dist-library/types/local/source/authoring.d.ts +1 -1
  228. package/dist-library/types/local/source/source-context.d.ts +23 -0
  229. package/dist-library/types/local/source/source-migration.d.ts +2 -2
  230. package/dist-library/types/local/transport/compile-patch.d.ts +1 -1
  231. package/dist-library/types/local/transport/flat-compiled-data.d.ts +1 -1
  232. package/dist-library/types/local/transport/shared-data.d.ts +1 -1
  233. package/dist-library/types/local/transport/worker-handler.d.ts +30 -0
  234. package/dist-library/types/local/transport/worker-job.d.ts +28 -0
  235. package/dist-library/types/local/transport/worker.d.ts +32 -46
  236. package/dist-library/types/local/{contracts/types.d.ts → types.d.ts} +78 -21
  237. package/dist-library/types/pdf.d.ts +22 -0
  238. package/dist-library/types/presets/identity.d.ts +1 -0
  239. package/dist-library/types/presets/minimal.d.ts +2 -0
  240. package/dist-library/types/presets/plugin-packs.d.ts +1 -0
  241. package/dist-library/types/react/component-api.d.ts +20 -4
  242. package/dist-library/types/react/component-primitives.d.ts +10 -10
  243. package/dist-library/types/react/component-utils.d.ts +9 -1
  244. package/dist-library/types/react/index.d.ts +6 -5
  245. package/dist-library/types/{local/theme/i18n.d.ts → react/localization.d.ts} +2 -2
  246. package/dist-library/types/react/minimal.d.ts +13 -0
  247. package/dist-library/types/react/package-core.d.ts +67 -0
  248. package/dist-library/types/react/package.d.ts +3 -67
  249. package/dist-library/types/react/runtime/common.d.ts +1 -1
  250. package/dist-library/types/react/sdk-core.d.ts +115 -0
  251. package/dist-library/types/react/sdk.d.ts +4 -110
  252. package/dist-library/types/react/server.d.ts +2 -2
  253. package/dist-library/types/react/use-draft-field.d.ts +5 -1
  254. package/dist-library/types/runtime-services/browser/duplex.d.ts +163 -0
  255. package/dist-library/types/runtime-services/browser/http-sse.d.ts +117 -0
  256. package/dist-library/types/runtime-services/browser/index.d.ts +2 -1
  257. package/dist-library/types/runtime-services/component-state.d.ts +1 -1
  258. package/dist-library/types/runtime-services/index.d.ts +2 -0
  259. package/dist-library/types/runtime-services/network.d.ts +86 -0
  260. package/dist-library/types/runtime-services/runtime.d.ts +1 -1
  261. package/dist-library/types/sdk/config.d.ts +1 -1
  262. package/dist-library/types/sdk/index.d.ts +1 -0
  263. package/dist-library/types/sdk/props.d.ts +1 -1
  264. package/dist-library/types/sdk/registry-core.d.ts +1 -1
  265. package/dist-library/types/sdk/theme.d.ts +5 -4
  266. package/dist-library/types/sdk/types.d.ts +2 -2
  267. package/dist-library/types/shareable.d.ts +6 -5
  268. package/dist-library/types/standalone/diagnostics.d.ts +1 -1
  269. package/dist-library/types/standalone/host.d.ts +5 -0
  270. package/dist-library/types/standalone/payload.d.ts +1 -1
  271. package/dist-library/types/standalone/prepare.d.ts +2 -2
  272. package/dist-library/types/standalone/session-core.d.ts +68 -0
  273. package/dist-library/types/standalone/session.d.ts +6 -68
  274. package/dist-library/types/themes/contract.d.ts +7 -0
  275. package/dist-library/types/{local/theme/theme.d.ts → themes/document-theme.d.ts} +4 -3
  276. package/dist-library/types/vite/client.d.ts +19 -0
  277. package/dist-library/types/vite/index.d.ts +18 -3
  278. package/dist-library/types/vite/registration.d.ts +2 -2
  279. package/dist-library/{types-BFCrMrg0.js → types-BeNtPqdY.js} +1 -1
  280. package/dist-library/validation-BEBA_HvS.js +1121 -0
  281. package/dist-library/visual-frame-CyV1FXzs.js +48 -0
  282. package/dist-library/visuals-B5KSafVk.js +3 -0
  283. package/dist-library/visuals-BZbZYA7w.js +72572 -0
  284. package/dist-standalone/reactive-md-standalone.css +1 -1
  285. package/dist-standalone/reactive-md-standalone.js +146 -137
  286. package/docs/README-ch.md +16 -11
  287. package/docs/README.md +16 -11
  288. package/docs/compatibility/compatibility-ch.md +8 -8
  289. package/docs/compatibility/compatibility-en.md +8 -8
  290. package/docs/compatibility/source-versioning-ch.md +1 -1
  291. package/docs/compatibility/source-versioning-en.md +1 -1
  292. package/docs/development/component-development-ch.md +2 -2
  293. package/docs/development/component-development-en.md +2 -2
  294. package/docs/development/component-development-reference-ch.md +4 -4
  295. package/docs/development/component-development-reference-en.md +4 -4
  296. package/docs/development/component-protocol-ch.md +14 -14
  297. package/docs/development/component-protocol-en.md +14 -14
  298. package/docs/development/extension-tutorial-ch.md +308 -0
  299. package/docs/development/extension-tutorial-en.md +308 -0
  300. package/docs/development/local-module-layout-ch.md +10 -50
  301. package/docs/development/local-module-layout-en.md +9 -49
  302. package/docs/development/performance-overview-ch.md +174 -154
  303. package/docs/development/performance-overview-en.md +174 -154
  304. package/docs/guides/local-guide-ch.md +2 -2
  305. package/docs/guides/local-guide-en.md +2 -2
  306. package/docs/integration/author-tools-ch.md +2 -2
  307. package/docs/integration/author-tools-en.md +2 -2
  308. package/docs/integration/compiler-ch.md +4 -2
  309. package/docs/integration/compiler-en.md +4 -2
  310. package/docs/integration/directory-discovery-ch.md +5 -1
  311. package/docs/integration/directory-discovery-en.md +5 -1
  312. package/docs/integration/editor-ch.md +35 -5
  313. package/docs/integration/editor-en.md +42 -4
  314. package/docs/integration/extension-sdk-ch.md +6 -4
  315. package/docs/integration/extension-sdk-en.md +6 -4
  316. package/docs/integration/local-integration-ch.md +201 -19
  317. package/docs/integration/local-integration-en.md +194 -18
  318. package/docs/integration/network-host-ch.md +75 -0
  319. package/docs/integration/network-host-en.md +75 -0
  320. package/docs/integration/shareable-export-ch.md +58 -16
  321. package/docs/integration/shareable-export-en.md +57 -15
  322. package/docs/reference/html-compatibility-ch.md +20 -67
  323. package/docs/reference/html-compatibility-en.md +19 -64
  324. package/docs/reference/local-interaction-syntax-ch.md +199 -26
  325. package/docs/reference/local-interaction-syntax-en.md +194 -27
  326. package/docs/reference/public-api-ch.md +416 -0
  327. package/docs/reference/public-api-en.md +416 -0
  328. package/docs/reference/theme-protocol-ch.md +27 -8
  329. package/docs/reference/theme-protocol-en.md +46 -8
  330. package/docs/releases/release-0.4.0-ch.md +2 -2
  331. package/docs/releases/release-0.4.0-en.md +2 -2
  332. package/docs/releases/release-0.8.0-ch.md +19 -3
  333. package/docs/releases/release-0.8.0-en.md +19 -3
  334. package/docs/releases/release-0.9.0-ch.md +44 -0
  335. package/docs/releases/release-0.9.0-en.md +44 -0
  336. package/docs/releases/release-0.9.1-ch.md +29 -0
  337. package/docs/releases/release-0.9.1-en.md +29 -0
  338. package/examples/component-package/README-ch.md +1 -1
  339. package/examples/component-package/README.md +1 -1
  340. package/examples/conformance/README-ch.md +3 -3
  341. package/examples/conformance/README.md +3 -3
  342. package/examples/game-2048-package/README-ch.md +3 -9
  343. package/examples/game-2048-package/README.md +8 -12
  344. package/examples/integration/README-ch.md +21 -2
  345. package/examples/integration/README.md +21 -2
  346. package/examples/integration/extension-sdk/README-ch.md +1 -1
  347. package/examples/integration/extension-sdk/README.md +1 -1
  348. package/examples/integration/streaming/index.html +48 -0
  349. package/examples/integration/streaming/main.js +175 -0
  350. package/examples/integration/streaming/package.json +13 -0
  351. package/examples/integration/streaming/worker.js +3 -0
  352. package/examples/local/README-ch.md +3 -3
  353. package/examples/local/README.md +2 -2
  354. package/examples/local/minimal-budget.reactive.md +48 -0
  355. package/examples/minimal-extension/README-ch.md +78 -0
  356. package/examples/minimal-extension/README.md +78 -0
  357. package/examples/minimal-extension/index.html +15 -0
  358. package/examples/minimal-extension/package.json +26 -0
  359. package/examples/minimal-extension/sample/document.reactive.md +10 -0
  360. package/examples/minimal-extension/scripts/build.mjs +32 -0
  361. package/examples/minimal-extension/scripts/export.mjs +72 -0
  362. package/examples/minimal-extension/scripts/test-node.mjs +75 -0
  363. package/examples/minimal-extension/src/extension.tsx +90 -0
  364. package/examples/minimal-extension/src/preview.tsx +12 -0
  365. package/examples/minimal-extension/src/source.ts +4 -0
  366. package/examples/minimal-extension/tsconfig.json +14 -0
  367. package/examples/network-survey/README.md +200 -0
  368. package/examples/network-survey/index.html +49 -0
  369. package/examples/network-survey/package.json +26 -0
  370. package/examples/network-survey/sample/document.reactive.md +51 -0
  371. package/examples/network-survey/src/components.tsx +325 -0
  372. package/examples/network-survey/src/host.ts +316 -0
  373. package/examples/network-survey/src/main.tsx +91 -0
  374. package/examples/network-survey/src/source.ts +1 -0
  375. package/examples/network-survey/tsconfig.json +26 -0
  376. package/examples/network-survey/vite.config.ts +227 -0
  377. package/examples/sci-fi-theme/README-ch.md +4 -2
  378. package/examples/sci-fi-theme/README.md +4 -2
  379. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -0
  380. package/examples/sci-fi-theme/demo/demo.css +129 -23
  381. package/examples/sci-fi-theme/demo/document.reactive.md +27 -6
  382. package/examples/sci-fi-theme/demo/main.tsx +45 -10
  383. package/examples/sci-fi-theme/docs/design-system-ch.md +6 -6
  384. package/examples/sci-fi-theme/package.json +2 -1
  385. package/examples/sci-fi-theme/src/components.css +1064 -154
  386. package/examples/sci-fi-theme/src/notch.css +142 -0
  387. package/examples/sci-fi-theme/src/sci-fi.css +3 -1
  388. package/examples/sci-fi-theme/src/theme.ts +2 -0
  389. package/examples/sci-fi-theme/src/tokens.css +512 -408
  390. package/examples/tetris-package/README-ch.md +4 -4
  391. package/examples/tetris-package/README.md +4 -4
  392. package/package.json +70 -3
  393. package/dist-library/LocalDocumentView-6trX7xJc.js +0 -97920
  394. package/dist-library/compiler--ea2CKQF.js +0 -61
  395. package/dist-library/component-state-Cq2K5gkS.js +0 -490
  396. package/dist-library/options-CX5m5n-J.js +0 -115
  397. package/dist-library/runtime-C-sbfpOX.js +0 -1157
  398. package/dist-library/types/local/contracts/locale.d.ts +0 -1
  399. package/dist-library/types/local/contracts/version.d.ts +0 -2
  400. package/dist-library/types/local/evaluation/dates.d.ts +0 -2
  401. package/dist-library/types/local/evaluation/expression.d.ts +0 -47
  402. package/dist-library/types/local/markdown/markdown-structure.d.ts +0 -3
  403. package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +0 -36
  404. package/dist-library/types/local/session/incremental.d.ts +0 -48
  405. package/dist-library/types/local/source/node-walk.d.ts +0 -3
  406. package/dist-library/types/local/source/text-length.d.ts +0 -13
  407. package/dist-library/types/local/theme/theme-name.d.ts +0 -3
  408. package/dist-library/types/local/widgets/visuals.d.ts +0 -25
  409. package/dist-library/types/react/default-theme.d.ts +0 -6
  410. package/dist-library/validation-W-bmny-x.js +0 -2253
  411. package/docs/development/releasing-ch.md +0 -12
  412. package/docs/development/releasing-en.md +0 -12
  413. package/docs/integration/codemirror-ch.md +0 -52
  414. package/docs/integration/codemirror-en.md +0 -29
  415. package/docs/integration/repository-split-ch.md +0 -40
  416. package/docs/integration/repository-split-en.md +0 -23
  417. package/docs/reference/computations-formatting-ch.md +0 -89
  418. package/docs/reference/computations-formatting-en.md +0 -89
  419. package/docs/reference/constraints-collections-ch.md +0 -104
  420. package/docs/reference/constraints-collections-en.md +0 -104
  421. package/docs/reference/local-components-v2-ch.md +0 -140
  422. package/docs/reference/local-components-v2-en.md +0 -106
  423. package/docs/reference/tolerance-ch.md +0 -64
  424. package/docs/reference/tolerance-en.md +0 -57
  425. /package/dist-library/types/components/{chart-motion.d.ts → chart/chart-motion.d.ts} +0 -0
  426. /package/dist-library/types/components/{default-chart-types.d.ts → chart/default-chart-types.d.ts} +0 -0
  427. /package/dist-library/types/components/{default-chart.d.ts → chart/default-chart.d.ts} +0 -0
  428. /package/dist-library/types/components/{diagram-inspector.d.ts → diagram/diagram-inspector.d.ts} +0 -0
  429. /package/dist-library/types/{local/widgets/diagram-layout.d.ts → components/diagram/layout.d.ts} +0 -0
  430. /package/dist-library/types/components/{mafs-plot-grid.d.ts → plot/mafs-plot-grid.d.ts} +0 -0
  431. /package/dist-library/types/components/{mafs-visuals.d.ts → plot/mafs-visuals.d.ts} +0 -0
  432. /package/dist-library/types/components/{use-hydrated.d.ts → shared/use-hydrated.d.ts} +0 -0
  433. /package/dist-library/types/local/{theme/colors.d.ts → configuration/color-values.d.ts} +0 -0
  434. /package/dist-library/types/local/evaluation/{collection-functions.d.ts → expression/collection-functions.d.ts} +0 -0
  435. /package/dist-library/types/local/evaluation/{data-functions.d.ts → expression/data-functions.d.ts} +0 -0
  436. /package/dist-library/types/local/evaluation/{formatting.d.ts → expression/formatting.d.ts} +0 -0
  437. /package/dist-library/types/local/{markdown → parsing}/markdown-blocks.d.ts +0 -0
  438. /package/dist-library/types/local/{widgets → rendering/code}/code-block.d.ts +0 -0
  439. /package/dist-library/types/local/{widgets → rendering/code}/code-languages.d.ts +0 -0
  440. /package/dist-library/types/local/{widgets → rendering/image}/image-view.d.ts +0 -0
  441. /package/dist-library/types/local/{widgets → rendering}/math-view.d.ts +0 -0
@@ -1,1157 +0,0 @@
1
- import { ut as e } from "./identity-MYJXKSkB.js";
2
- import { $ as t, F as n, X as r, j as i, nt as a } from "./config-validation-DXTynAw7.js";
3
- import { J as o, Q as s, Y as c, Z as l, a as u, at as d, c as f, et as p, i as m, n as h, nt as g, o as _, ot as v, r as ee, rt as y, t as b, tt as x, w as S } from "./validation-W-bmny-x.js";
4
- import { t as C } from "./registry-B9Jc3FVe.js";
5
- import { C as w, b as te } from "./component-state-Cq2K5gkS.js";
6
- import { n as T } from "./runtime-Dkq7ldyg.js";
7
- // src/local/runtime/retention.ts
8
- function E(e) {
9
- let t = /* @__PURE__ */ new Map();
10
- for (let n of l(e.nodes)) t.set(n.id, n);
11
- return t;
12
- }
13
- function D(e, t, n) {
14
- let r = e.bindingSlots?.[t.id];
15
- return r !== void 0 && Object.values(r).includes(n);
16
- }
17
- function O(e, t, n) {
18
- let r = t.name ? C(t.name) : void 0;
19
- if (r?.bindings) {
20
- let i = e.bindingSlots?.[t.id];
21
- 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;
22
- } else if (t.attrs?.bind === n || D(e, t, n)) return "initial";
23
- }
24
- function k(e) {
25
- let t = E(e), r = n(e), i = new Set(r?.retentionExclusions ?? []), a = /* @__PURE__ */ new Map();
26
- for (let [n, o] of Object.entries(e.bindings)) {
27
- let s = o.nodeIds.flatMap((e) => {
28
- let n = t.get(e);
29
- return n ? [n] : [];
30
- });
31
- if (!s.length || n.startsWith("@") || i.has(n)) continue;
32
- let c;
33
- if (r === void 0) {
34
- let t = s.map((t) => O(e, t, n));
35
- if (t.some((e) => e === void 0)) continue;
36
- c = t;
37
- } else {
38
- let e = r.bindingAttributes?.[n]?.initial ?? "initial";
39
- c = s.map(() => e);
40
- }
41
- let l = s.flatMap((e, t) => Object.hasOwn(e.attrs ?? {}, c[t]) ? [e.attrs[c[t]]] : []).sort();
42
- a.set(n, {
43
- type: o.type,
44
- initialDefinition: JSON.stringify([o.initial, l])
45
- });
46
- }
47
- return a;
48
- }
49
- function A(e, t) {
50
- return Object.freeze({
51
- name: e,
52
- reason: t
53
- });
54
- }
55
- function ne(e) {
56
- let t = k(e.previous), n = k(e.next), r = {}, i = [], a = [];
57
- for (let o of Object.keys(e.state).sort()) {
58
- if (o.startsWith("@")) {
59
- a.push(A(o, "internal"));
60
- continue;
61
- }
62
- if (!Object.hasOwn(e.previous.bindings, o) || !Object.hasOwn(e.next.bindings, o)) {
63
- a.push(A(o, "unknown"));
64
- continue;
65
- }
66
- let s = t.get(o), c = n.get(o);
67
- if (!s || !c) {
68
- a.push(A(o, "unretainable"));
69
- continue;
70
- }
71
- if (s.type !== c.type) {
72
- a.push(A(o, "type"));
73
- continue;
74
- }
75
- if (s.initialDefinition !== c.initialDefinition) {
76
- a.push(A(o, "initial"));
77
- continue;
78
- }
79
- let l = e.state[o];
80
- r[o] = Array.isArray(l) ? Object.freeze([...l]) : l, i.push(o);
81
- }
82
- return Object.freeze({
83
- values: Object.freeze(r),
84
- retained: Object.freeze(i),
85
- dropped: Object.freeze(a)
86
- });
87
- }
88
- function j(e, t, n) {
89
- return Object.freeze({
90
- retained: Object.freeze([...e]),
91
- dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
92
- diagnostics: Object.freeze([...n])
93
- });
94
- }
95
- function M(e, t) {
96
- let n = Object.keys(t.values).sort();
97
- if (!e.setParameters(t.values).length) return j(n, t.dropped, []);
98
- let r = [], i = [...t.dropped], a = [];
99
- for (let o of n) {
100
- let n = e.setParameter(o, t.values[o]);
101
- n.length ? (i.push(A(o, "invalid")), a.push(...n)) : r.push(o);
102
- }
103
- return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), j(r, i, a);
104
- }
105
- // src/local/runtime/runtime.ts
106
- var N = 1e-9, re = 200;
107
- function P(e) {
108
- return Array.isArray(e) ? e.slice() : e;
109
- }
110
- function ie(e) {
111
- return {
112
- ...e,
113
- range: { ...e.range }
114
- };
115
- }
116
- function F(e, t) {
117
- 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;
118
- }
119
- function I(e, t, n) {
120
- let r = (e - t) / n;
121
- return Math.abs(r - Math.round(r)) <= N * Math.max(1, Math.abs(r));
122
- }
123
- function ae(e) {
124
- for (let [t, n] of Object.entries(e)) Array.isArray(n) && !Object.isFrozen(n) && (e[t] = Object.freeze([...n]));
125
- return Object.freeze(e);
126
- }
127
- function L(e, n, r, i) {
128
- let a = Math.max(0, Math.min(e.source.length, n.range.start)), o = e.source.slice(0, a).split("\n");
129
- return {
130
- code: r,
131
- message: t(i),
132
- severity: "error",
133
- range: {
134
- start: a,
135
- end: Math.max(a + 1, Math.min(e.source.length, n.range.end))
136
- },
137
- line: o.length,
138
- column: (o.at(-1) ?? "").length + 1,
139
- messageKey: i.key,
140
- ...i.params ? { params: i.params } : {}
141
- };
142
- }
143
- function R(e, t, n) {
144
- return {
145
- code: e,
146
- message: t,
147
- severity: "error",
148
- range: {
149
- start: 0,
150
- end: 0
151
- },
152
- line: 1,
153
- column: 1,
154
- ...n ? {
155
- messageKey: n.key,
156
- ...n.params ? { params: n.params } : {}
157
- } : {}
158
- };
159
- }
160
- function z(e, t) {
161
- return e.attrs?.[t];
162
- }
163
- function B(e, t) {
164
- let n = z(e, t);
165
- if (n === "true") return !0;
166
- if (n === "false") return !1;
167
- }
168
- function V(e, t) {
169
- let n = z(e, t);
170
- if (n === void 0) return;
171
- let r = Number(n);
172
- return Number.isFinite(r) ? r : void 0;
173
- }
174
- function H(e) {
175
- return v(e);
176
- }
177
- function U(e, t) {
178
- return {
179
- ok: !1,
180
- detail: a(e, t)
181
- };
182
- }
183
- function W(e, t) {
184
- if (t !== void 0) return z(e, t);
185
- }
186
- function G(e, t) {
187
- if (t !== void 0) return V(e, t);
188
- }
189
- function K(t, n, r, a = {}) {
190
- for (let o of r) if (o.kind === "date") {
191
- if (!i(n)) return U("local.runtime.value.date-invalid");
192
- let e = a.required ?? (o.required !== void 0 && B(t, o.required) === !0);
193
- if (n === "" && e) return U("local.runtime.value.date-required");
194
- let r = a.min ?? W(t, o.min), s = a.max ?? W(t, o.max);
195
- if (n !== "" && r && n < r) return U("local.runtime.value.date-earlier", { min: r });
196
- if (n !== "" && s && n > s) return U("local.runtime.value.date-later", { max: s });
197
- } else if (o.kind === "required") {
198
- let e = a.required ?? B(t, o.required) === !0;
199
- if (n === "" && e) return U("local.runtime.value.field-required");
200
- } else if (o.kind === "length") {
201
- let e = H(n), r = G(t, o.min), i = G(t, o.max);
202
- if (r !== void 0 && r > 0 && n !== "" && e < r) return U("local.runtime.value.min-length", { min: r });
203
- if (i !== void 0 && e > i) return U("local.runtime.value.max-length", { max: i });
204
- } else if (o.kind === "email" && (W(t, o.type) ?? "text") === o.value && n !== "") {
205
- if (n.length > 254) return U("local.runtime.value.email-length", { limit: 254 });
206
- if (!e(n)) return U("local.runtime.value.email-invalid");
207
- }
208
- return {
209
- ok: !0,
210
- value: n
211
- };
212
- }
213
- var q = /* @__PURE__ */ new Map();
214
- function J(e) {
215
- if (!e.name) return Y;
216
- let t = q.get(e.name);
217
- if (t !== void 0) return t ?? Y;
218
- let n = C(e.name), i = n ? r(n) : Y;
219
- return q.set(e.name, n ? i : null), i;
220
- }
221
- var Y = Object.freeze([]);
222
- function X(e, n, r, a, o, s = !1) {
223
- switch (e.type) {
224
- case "number": {
225
- if (typeof r != "number" || !Number.isFinite(r)) return U("local.runtime.value.finite-number", { name: e.name });
226
- let t = e.step ?? 1, i = e.min ?? 0;
227
- for (let t of n) {
228
- let n = a(t, "min");
229
- if (n.present && !n.ok) return U("local.runtime.value.constraint", {
230
- name: e.name,
231
- attribute: "min"
232
- });
233
- if (n.present && n.ok) {
234
- if (typeof n.value != "number" || !Number.isFinite(n.value)) return U("local.runtime.value.constraint", {
235
- name: e.name,
236
- attribute: "min"
237
- });
238
- if (i = n.value, r < n.value) return U("local.runtime.value.min", {
239
- name: e.name,
240
- min: n.value
241
- });
242
- }
243
- let o = a(t, "max");
244
- if (o.present && !o.ok) return U("local.runtime.value.constraint", {
245
- name: e.name,
246
- attribute: "max"
247
- });
248
- if (o.present && o.ok) {
249
- if (typeof o.value != "number" || !Number.isFinite(o.value)) return U("local.runtime.value.constraint", {
250
- name: e.name,
251
- attribute: "max"
252
- });
253
- if (r > o.value) return U("local.runtime.value.max", {
254
- name: e.name,
255
- max: o.value
256
- });
257
- }
258
- if (n.present && n.ok && o.present && o.ok && typeof n.value == "number" && typeof o.value == "number" && n.value > o.value) return U("local.runtime.value.constraint-range", { name: e.name });
259
- }
260
- return e.min !== void 0 && r < e.min ? U("local.runtime.value.min", {
261
- name: e.name,
262
- min: e.min
263
- }) : e.max !== void 0 && r > e.max ? U("local.runtime.value.max", {
264
- name: e.name,
265
- max: e.max
266
- }) : t > 0 && !I(r, i, t) ? U("local.runtime.value.step", {
267
- name: e.name,
268
- step: t,
269
- base: i
270
- }) : {
271
- ok: !0,
272
- value: r
273
- };
274
- }
275
- case "boolean": return typeof r == "boolean" ? {
276
- ok: !0,
277
- value: r
278
- } : U("local.runtime.value.boolean", { name: e.name });
279
- case "string": {
280
- if (typeof r != "string") return U("local.runtime.value.string", { name: e.name });
281
- let c = y(r);
282
- if (c) return U("local.runtime.value.budget", {
283
- name: e.name,
284
- detail: t(c),
285
- detailKey: c.key,
286
- ...c.params
287
- });
288
- for (let t of n) {
289
- let n = o?.get(t.id) ?? (s ? J(t) : Y);
290
- if (!n.length) continue;
291
- let c = {};
292
- for (let r of n) {
293
- if (r.kind === "date") {
294
- for (let n of ["min", "max"]) {
295
- if (r[n] === void 0) continue;
296
- let o = a(t, n);
297
- if (o.present) {
298
- if (!o.ok || typeof o.value != "string" || !i(o.value)) return U("local.runtime.value.constraint-date", {
299
- name: e.name,
300
- attribute: n
301
- });
302
- c[n] = o.value;
303
- }
304
- }
305
- let n = c.min ?? W(t, r.min), o = c.max ?? W(t, r.max);
306
- if (n && o && i(n) && i(o) && n > o) return U("local.runtime.value.constraint-range", { name: e.name });
307
- }
308
- if ((r.kind === "date" || r.kind === "required" ? r.required : void 0) !== void 0) {
309
- let n = a(t, "required");
310
- if (n.present) {
311
- if (!n.ok || typeof n.value != "boolean") return U("local.runtime.value.constraint", {
312
- name: e.name,
313
- attribute: "required"
314
- });
315
- c.required = n.value;
316
- }
317
- }
318
- }
319
- let l = K(t, r, n, c);
320
- if (!l.ok) return l;
321
- }
322
- return e.options?.length && !e.options.includes(r) ? U("local.runtime.value.option", {
323
- value: r,
324
- options: e.options.join(", ")
325
- }) : {
326
- ok: !0,
327
- value: r
328
- };
329
- }
330
- case "array": {
331
- if (!Array.isArray(r)) return U("local.runtime.value.array", { name: e.name });
332
- let n = y(r);
333
- if (n) return U("local.runtime.value.budget", {
334
- name: e.name,
335
- detail: t(n),
336
- detailKey: n.key,
337
- ...n.params
338
- });
339
- for (let t of r) if (typeof t != "string") return U("local.runtime.value.array-members", { name: e.name });
340
- if (e.family === "collection") return e.maxItems !== void 0 && r.length > e.maxItems ? U("local.runtime.value.max-items", {
341
- name: e.name,
342
- max: e.maxItems
343
- }) : {
344
- ok: !0,
345
- value: r.slice()
346
- };
347
- let i = /* @__PURE__ */ new Set();
348
- for (let t of r) {
349
- if (e.options && !e.options.includes(t)) return U("local.runtime.value.checklist-option", { value: t });
350
- i.add(t);
351
- }
352
- let a = e.options ? e.options.filter((e) => i.has(e)) : [...i];
353
- return e.maxItems !== void 0 && a.length > e.maxItems ? U("local.runtime.value.max-items", {
354
- name: e.name,
355
- max: e.maxItems
356
- }) : {
357
- ok: !0,
358
- value: a
359
- };
360
- }
361
- case "number-array": {
362
- if (!Array.isArray(r)) return U("local.runtime.value.number-array", { name: e.name });
363
- let n = y(r);
364
- if (n) return U("local.runtime.value.budget", {
365
- name: e.name,
366
- detail: t(n),
367
- detailKey: n.key,
368
- ...n.params
369
- });
370
- for (let t of r) if (typeof t != "number" || !Number.isFinite(t)) return U("local.runtime.value.number-array-members", { name: e.name });
371
- return e.maxItems !== void 0 && r.length > e.maxItems ? U("local.runtime.value.max-items", {
372
- name: e.name,
373
- max: e.maxItems
374
- }) : {
375
- ok: !0,
376
- value: r.slice()
377
- };
378
- }
379
- case "null": return r === null ? {
380
- ok: !0,
381
- value: r
382
- } : U("local.runtime.value.null", { name: e.name });
383
- }
384
- return U("local.runtime.value.unsupported-type", { name: e.name });
385
- }
386
- function Z(e) {
387
- return e instanceof s ? e : new s("expression-eval", e instanceof Error ? e.message : String(e), 0);
388
- }
389
- function oe(e, t) {
390
- switch (e) {
391
- case "string": {
392
- if (typeof t != "string") return {
393
- ok: !1,
394
- key: "local.runtime.external-value",
395
- params: { kind: "string" }
396
- };
397
- let e = y(t);
398
- return e ? {
399
- ok: !1,
400
- key: "local.runtime.external-budget",
401
- params: {
402
- detailKey: e.key,
403
- ...e.params ?? {}
404
- }
405
- } : {
406
- ok: !0,
407
- value: t
408
- };
409
- }
410
- case "number": return typeof t == "number" && Number.isFinite(t) ? {
411
- ok: !0,
412
- value: t
413
- } : {
414
- ok: !1,
415
- key: "local.runtime.external-value",
416
- params: { kind: "number" }
417
- };
418
- case "boolean": return typeof t == "boolean" ? {
419
- ok: !0,
420
- value: t
421
- } : {
422
- ok: !1,
423
- key: "local.runtime.external-value",
424
- params: { kind: "boolean" }
425
- };
426
- case "array": {
427
- if (!Array.isArray(t)) return {
428
- ok: !1,
429
- key: "local.runtime.external-value",
430
- params: { kind: "string-array" }
431
- };
432
- for (let e of t) if (typeof e != "string") return {
433
- ok: !1,
434
- key: "local.runtime.external-value",
435
- params: { kind: "string-array" }
436
- };
437
- let e = y(t);
438
- return e ? {
439
- ok: !1,
440
- key: "local.runtime.external-budget",
441
- params: {
442
- detailKey: e.key,
443
- ...e.params ?? {}
444
- }
445
- } : {
446
- ok: !0,
447
- value: t.slice()
448
- };
449
- }
450
- case "number-array": {
451
- if (!Array.isArray(t)) return {
452
- ok: !1,
453
- key: "local.runtime.external-value",
454
- params: { kind: "number-array" }
455
- };
456
- for (let e of t) if (typeof e != "number" || !Number.isFinite(e)) return {
457
- ok: !1,
458
- key: "local.runtime.external-value",
459
- params: { kind: "number-array" }
460
- };
461
- let e = y(t);
462
- return e ? {
463
- ok: !1,
464
- key: "local.runtime.external-budget",
465
- params: {
466
- detailKey: e.key,
467
- ...e.params ?? {}
468
- }
469
- } : {
470
- ok: !0,
471
- value: t.slice()
472
- };
473
- }
474
- default: return {
475
- ok: !1,
476
- key: "local.runtime.external-value",
477
- params: { kind: String(e) }
478
- };
479
- }
480
- }
481
- function se(e, t) {
482
- let n = t.get(e);
483
- if (n) return {
484
- expression: n,
485
- error: null
486
- };
487
- try {
488
- let n = p(e);
489
- if (t.size >= re) {
490
- let e = t.keys().next().value;
491
- e !== void 0 && t.delete(e);
492
- }
493
- return t.set(e, n), {
494
- expression: n,
495
- error: null
496
- };
497
- } catch (e) {
498
- return {
499
- expression: null,
500
- error: Z(e)
501
- };
502
- }
503
- }
504
- function ce(e, r) {
505
- let i = /* @__PURE__ */ new Map();
506
- for (let t of l(e.nodes)) i.set(t.id, t);
507
- let a = {}, o = /* @__PURE__ */ new Map();
508
- for (let [n, r] of Object.entries(e.bindings)) {
509
- let e = y(r.initial);
510
- if (e) throw new s("expression-budget", `Parameter "${n}": ${t(e)}`, 0);
511
- a[n] = P(r.initial);
512
- let c = [];
513
- for (let e of r.nodeIds) {
514
- let t = i.get(e);
515
- t && c.push(t);
516
- }
517
- o.set(n, c);
518
- }
519
- let d = /* @__PURE__ */ new Map();
520
- for (let [t, n] of Object.entries(e.bindingSlots ?? {})) d.set(t, { ...n });
521
- let f = n(e), p = new Map(Object.entries(f?.valueRules ?? {})), m = f === void 0, h = /* @__PURE__ */ new Map();
522
- if (f) for (let e of f.slotRelations) {
523
- let t = d.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
524
- if (!n || !r) continue;
525
- let i = h.get(e.nodeId) ?? [];
526
- i.push({
527
- lower: n,
528
- upper: r
529
- }), h.set(e.nodeId, i);
530
- }
531
- else for (let [e, t] of d) t.start && t.end && h.set(e, [{
532
- lower: t.start,
533
- upper: t.end
534
- }]);
535
- let v = /* @__PURE__ */ new Map();
536
- for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
537
- if (d.has(e)) continue;
538
- let n = v.get(e);
539
- (n === void 0 || n.startsWith("@") && !t.startsWith("@")) && v.set(e, t);
540
- }
541
- let ee = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
542
- for (let [e, t] of d) for (let n of Object.values(t)) {
543
- if (n.startsWith("@")) continue;
544
- let t = b.get(n) ?? /* @__PURE__ */ new Set();
545
- t.add(e), b.set(n, t);
546
- }
547
- let x = e.computations ?? {}, S = Object.keys(x), C = /* @__PURE__ */ new Map();
548
- for (let [e, t] of Object.entries(x)) {
549
- let n = se(t.source, r);
550
- n.expression && C.set(e, n.expression);
551
- }
552
- let { order: w, cyclic: te } = c(x), T = {}, E = /* @__PURE__ */ new Map();
553
- for (let e of w) {
554
- let t = x[e];
555
- if (!t || t.kind !== "const") continue;
556
- if (Object.hasOwn(t, "value")) {
557
- let n = t.value, r = g(n);
558
- if (r) {
559
- E.set(e, new s("expression-budget", `Constant "${e}": ${r}`, 0));
560
- continue;
561
- }
562
- T[e] = P(n);
563
- continue;
564
- }
565
- let n = C.get(e);
566
- if (!n) E.set(e, new s("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
567
- else try {
568
- let t = n.evaluate({ ...T }), r = g(t);
569
- if (r) {
570
- E.set(e, new s("expression-budget", `Constant "${e}": ${r}`, 0));
571
- continue;
572
- }
573
- T[e] = P(t);
574
- } catch (t) {
575
- E.set(e, Z(t));
576
- }
577
- }
578
- let D = /* @__PURE__ */ new Map();
579
- for (let e of te) D.set(e, new s("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
580
- let O = [];
581
- if (Array.isArray(e.validations)) for (let t of e.validations) {
582
- if (!u(t)) continue;
583
- let e = se(t.expression, r);
584
- O.push({
585
- rule: t,
586
- expression: e.expression,
587
- error: e.error
588
- });
589
- }
590
- return {
591
- document: e,
592
- nodeIndex: i,
593
- controls: o,
594
- slotKeys: d,
595
- publicNames: ee,
596
- publicSlotOwners: b,
597
- initial: a,
598
- valueRules: p,
599
- legacyValueRules: m,
600
- slotRelations: h,
601
- bindingByNode: v,
602
- computationMetadata: x,
603
- computationNames: S,
604
- computationOrder: w,
605
- cyclicComputations: te,
606
- computationExpressions: C,
607
- constValues: T,
608
- constErrors: E,
609
- cycleErrors: D,
610
- validationRules: O,
611
- validationLineStarts: _(typeof e.source == "string" ? e.source : "")
612
- };
613
- }
614
- function le(e) {
615
- 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 ${S}; migrate the source before constructing a runtime.` : null;
616
- }
617
- function ue(e, t) {
618
- 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);
619
- }
620
- function de(e, n, r) {
621
- let i = ue(e, n);
622
- return i ? L(e.document, i, "local.runtime.value", r) : R("local.runtime.value", t(r));
623
- }
624
- function Q(e, t, n) {
625
- let r = e.slotRelations.get(t);
626
- return r?.length ? r.some(({ lower: e, upper: t }) => {
627
- let r = n[e], i = n[t];
628
- return typeof r == "number" && typeof i == "number" && r > i;
629
- }) : !1;
630
- }
631
- function fe(e, n) {
632
- let r = e.nodeIndex.get(n);
633
- return r ? L(e.document, r, "local.runtime.value", a("local.runtime.value.range-order")) : R("local.runtime.value", t(a("local.runtime.value.range-order")));
634
- }
635
- var pe = /* @__PURE__ */ new WeakMap();
636
- function $(e) {
637
- return Object.freeze({
638
- ok: e.ok,
639
- changed: e.changed,
640
- revision: e.revision,
641
- retained: Object.freeze([...e.retained]),
642
- dropped: Object.freeze(e.dropped.map((e) => Object.freeze({ ...e }))),
643
- diagnostics: Object.freeze([...e.diagnostics])
644
- });
645
- }
646
- function me(e, t, n) {
647
- let r = pe.get(e);
648
- if (!r) throw TypeError("updateLocalRuntime requires a runtime created by createLocalRuntime.");
649
- return r.update(t, n?.notify !== !1);
650
- }
651
- function he(e) {
652
- pe.get(e)?.notify();
653
- }
654
- function ge(e, n) {
655
- let r = le(e);
656
- if (r) throw Error(r);
657
- let i = n?.services === void 0, c = w(e.source), u = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = ce(e, g), v = () => _, S = () => {
658
- let e = /* @__PURE__ */ new Set();
659
- for (let t of l(_.document.nodes)) t.name !== void 0 && e.add(te({
660
- documentId: n?.documentId,
661
- sourceDigest: c,
662
- nodeId: t.id,
663
- stateKey: t.attrs?.["state-key"]
664
- }));
665
- return e;
666
- }, C = n?.services ?? T({
667
- documentId: n?.documentId,
668
- sourceDigest: c,
669
- randomSeed: n?.randomSeed,
670
- componentState: n?.componentState,
671
- ...n?.componentStateStorage === void 0 ? {} : { componentStateStorage: n.componentStateStorage },
672
- ...n?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: n.componentStateWriteDelayMs },
673
- ...n?.configKey === void 0 ? {} : { configKey: n.configKey },
674
- ...n?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: n.legacyConfigKeys },
675
- ...i ? { knownStateKeys: S } : {}
676
- }), E = {};
677
- for (let [t, r] of Object.entries(e.externals ?? {})) {
678
- let e = n?.externalValues?.[t];
679
- if (e === void 0) continue;
680
- let i = oe(r.type, e);
681
- i.ok && (E[t] = i.value);
682
- }
683
- let D = (e) => {
684
- let t = {};
685
- for (let [n, r] of Object.entries(e.document.externals ?? {})) {
686
- if (!Object.hasOwn(E, n)) continue;
687
- let e = oe(r.type, E[n]);
688
- e.ok && (t[n] = e.value);
689
- }
690
- return t;
691
- }, O = (e, t, n, r = v()) => {
692
- let i = r.document.dynamicConstraints?.[e.id]?.[t];
693
- if (!i) return { present: !1 };
694
- let a = se(i.source, g);
695
- if (!a.expression) return {
696
- present: !0,
697
- ok: !1
698
- };
699
- try {
700
- let e = a.expression.evaluate(n), t = i.numeric;
701
- 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) ? {
702
- present: !0,
703
- ok: !1
704
- } : {
705
- present: !0,
706
- ok: !0,
707
- value: e
708
- };
709
- } catch {
710
- return {
711
- present: !0,
712
- ok: !1
713
- };
714
- }
715
- }, k = _.initial, A = 0, j = {}, M = {}, N = {
716
- revision: 0,
717
- state: ae({})
718
- }, I = !1, z = null, B = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Map(), H = () => {
719
- if (I) throw Error("The local interaction runtime has been disposed.");
720
- }, U = (e, t) => {
721
- let n = D(e), r = /* @__PURE__ */ new Map();
722
- for (let t of Object.keys(e.document.externals ?? {})) Object.hasOwn(n, t) || r.set(t, new s("external-missing", "External data \"" + t + "\" is not available.", 0));
723
- let i = {}, a = /* @__PURE__ */ new Map();
724
- if (e.computationNames.length > 0) {
725
- let s = o(e.computationMetadata, e.computationOrder, e.computationExpressions, {
726
- ...t,
727
- ...n
728
- }, e.constValues, r);
729
- i = s.values, a = s.errors;
730
- for (let [t, n] of e.constErrors) Object.hasOwn(i, t) || a.set(t, n);
731
- for (let [t, n] of e.cycleErrors) Object.hasOwn(i, t) || a.set(t, n);
732
- }
733
- let c = {};
734
- for (let [e, n] of Object.entries(t)) c[e] = n;
735
- for (let [e, t] of Object.entries(n)) c[e] = t;
736
- for (let [e, t] of Object.entries(i)) c[e] = t;
737
- for (let [e, t] of [...r, ...a]) Object.hasOwn(i, e) || Object.defineProperty(c, e, {
738
- enumerable: !0,
739
- configurable: !0,
740
- get() {
741
- throw t;
742
- }
743
- });
744
- let l = {};
745
- for (let [e, n] of Object.entries(t)) l[e] = n;
746
- for (let [e, t] of Object.entries(n)) l[e] = t;
747
- for (let [e, t] of Object.entries(i)) l[e] = t;
748
- return {
749
- environment: c,
750
- snapshotState: l
751
- };
752
- }, W = () => {
753
- let e = U(v(), k);
754
- j = e.environment, M = e.snapshotState;
755
- }, G = (e, t = v(), n = k) => {
756
- let r;
757
- return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= U(t, {
758
- ...n,
759
- ...e
760
- }).environment, O(i, a, r, t)) : { present: !1 };
761
- }, K = () => {
762
- N = {
763
- revision: A,
764
- state: ae(M)
765
- };
766
- }, q = () => {
767
- for (let e of B) e();
768
- }, J = (e) => {
769
- k = e, A += 1, W(), K(), q();
770
- }, Y = (e) => {
771
- if (H(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
772
- let n = [], r = {}, i = Object.keys(e).sort();
773
- for (let o of i) {
774
- if (o === "__proto__") {
775
- n.push(R("local.runtime.external", "External names cannot be \"__proto__\"."));
776
- continue;
777
- }
778
- let i = v().document.externals ?? {}, s = Object.hasOwn(i, o) ? i[o] : void 0;
779
- if (!s) {
780
- let e = a("local.runtime.external", { name: o });
781
- n.push(R("local.runtime.external", t(e), e));
782
- continue;
783
- }
784
- let c = oe(s.type, e[o]);
785
- if (c.ok) r[o] = c.value;
786
- else {
787
- let e = a(c.key, {
788
- name: o,
789
- ...c.params ?? {}
790
- });
791
- n.push(R("local.runtime.external", t(e), e));
792
- }
793
- }
794
- if (n.length) return n;
795
- if (!i.some((e) => !F(E[e], r[e]))) return [];
796
- for (let [e, t] of Object.entries(r)) E[e] = t;
797
- return A += 1, W(), K(), q(), [];
798
- }, Z = (e) => {
799
- H();
800
- let t = v(), n = [], r = {}, i = Object.keys(e).sort(), a = G(e);
801
- for (let o of i) {
802
- if (o === "__proto__") {
803
- n.push(R("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
804
- continue;
805
- }
806
- if (o.startsWith("@")) {
807
- n.push(R("local.runtime.parameter", `Internal parameter "${o}" cannot be written by name.`));
808
- continue;
809
- }
810
- if (!Object.hasOwn(t.document.bindings, o)) {
811
- n.push(R("local.runtime.parameter", `Unknown parameter "${o}".`));
812
- continue;
813
- }
814
- let i = t.document.bindings[o], s = X(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
815
- s.ok ? r[o] = P(s.value) : n.push(de(t, i, s.detail));
816
- }
817
- if (n.length) return n;
818
- if (!i.some((e) => !F(k[e], r[e]))) return [];
819
- let o = {
820
- ...k,
821
- ...r
822
- }, s = /* @__PURE__ */ new Set();
823
- for (let e of i) for (let n of t.publicSlotOwners.get(e) ?? []) s.add(n);
824
- for (let e of [...s].sort()) Q(t, e, o) && n.push(fe(t, e));
825
- return n.length ? n : (J(o), []);
826
- }, ue = (e) => {
827
- let t = u.get(e);
828
- if (!t) {
829
- if (t = p(e), u.size >= re) {
830
- let e = u.keys().next().value;
831
- e !== void 0 && u.delete(e);
832
- }
833
- u.set(e, t);
834
- }
835
- return t;
836
- }, me = () => {
837
- let e = v(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
838
- for (let r of e.validationRules) {
839
- if (r.error) {
840
- t.push(f(n, e.validationLineStarts, r.rule.range, b, m(`Validation expression is invalid: ${r.error.message}`)));
841
- continue;
842
- }
843
- if (!r.expression) continue;
844
- let i;
845
- try {
846
- i = r.expression.evaluate(j);
847
- } catch (i) {
848
- t.push(f(n, e.validationLineStarts, r.rule.range, b, m(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
849
- continue;
850
- }
851
- typeof i == "boolean" ? i || t.push(f(n, e.validationLineStarts, r.rule.range, h, he(r.rule.message))) : t.push(f(n, e.validationLineStarts, r.rule.range, b, "Validation expression must evaluate to a boolean."));
852
- }
853
- return t;
854
- }, he = (e) => {
855
- let t;
856
- try {
857
- t = x(e, j);
858
- } catch {
859
- t = ee;
860
- }
861
- return m(t);
862
- }, ge = (e, t) => {
863
- let n = ne({
864
- previous: _.document,
865
- state: k,
866
- next: e
867
- }), r = {};
868
- for (let [t, n] of Object.entries(e.bindings)) r[t] = P(n.initial);
869
- let i = /* @__PURE__ */ new Map();
870
- for (let e of n.dropped) i.set(e.name, Object.freeze({ ...e }));
871
- let a = [], o = {}, s = [];
872
- for (let c of n.retained) {
873
- let l = e.bindings[c];
874
- if (!l) continue;
875
- let u = X(l, t.controls.get(c) ?? [], n.values[c], G(n.values, t, r), t.valueRules, t.legacyValueRules);
876
- u.ok ? (o[c] = P(u.value), s.push(c)) : (a.push(de(t, l, u.detail)), i.set(c, Object.freeze({
877
- name: c,
878
- reason: "invalid"
879
- })));
880
- }
881
- let c = {
882
- ...r,
883
- ...o
884
- }, l = /* @__PURE__ */ new Set();
885
- for (let e of s) for (let n of t.publicSlotOwners.get(e) ?? []) l.add(n);
886
- let u = !1;
887
- for (let e of [...l].sort()) if (Q(t, e, c)) {
888
- u = !0;
889
- break;
890
- }
891
- let d;
892
- if (!u) Object.assign(r, o), d = s;
893
- else {
894
- d = [];
895
- for (let e of s) {
896
- let n = r[e];
897
- r[e] = o[e];
898
- let s = !1;
899
- for (let n of [...t.publicSlotOwners.get(e) ?? []].sort()) Q(t, n, r) && (a.push(fe(t, n)), s = !0);
900
- s ? (r[e] = n, i.set(e, Object.freeze({
901
- name: e,
902
- reason: "invalid"
903
- }))) : d.push(e);
904
- }
905
- }
906
- for (let [n, o] of t.slotRelations) if (Q(t, n, r)) {
907
- for (let t of o) for (let n of [t.lower, t.upper]) {
908
- let t = e.bindings[n];
909
- if (!t) continue;
910
- r[n] = P(t.initial);
911
- let a = d.indexOf(n);
912
- a >= 0 && d.splice(a, 1), i.set(n, Object.freeze({
913
- name: n,
914
- reason: "invalid"
915
- }));
916
- }
917
- if (a.push(fe(t, n)), Q(t, n, r)) return {
918
- values: {},
919
- retained: [],
920
- dropped: [],
921
- diagnostics: []
922
- };
923
- }
924
- let f = !0;
925
- for (; f;) {
926
- let n = G({}, t, r), o = [];
927
- for (let i of d) {
928
- let s = e.bindings[i], c = X(s, t.controls.get(i) ?? [], r[i], n, t.valueRules, t.legacyValueRules);
929
- c.ok || (a.push(de(t, s, c.detail)), o.push(i));
930
- }
931
- for (let t of o) r[t] = P(e.bindings[t].initial), d.splice(d.indexOf(t), 1), i.set(t, Object.freeze({
932
- name: t,
933
- reason: "invalid"
934
- }));
935
- f = o.length > 0;
936
- }
937
- let p = [...i.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
938
- return d.sort(), {
939
- values: r,
940
- retained: d,
941
- dropped: p,
942
- diagnostics: a
943
- };
944
- }, _e = (e, t) => {
945
- if (H(), e === _.document) return $({
946
- ok: !0,
947
- changed: !1,
948
- revision: A,
949
- retained: [],
950
- dropped: [],
951
- diagnostics: []
952
- });
953
- if (le(e)) return $({
954
- ok: !1,
955
- changed: !1,
956
- revision: A,
957
- retained: [],
958
- dropped: [],
959
- diagnostics: []
960
- });
961
- let n;
962
- try {
963
- n = ce(e, g);
964
- } catch {
965
- return $({
966
- ok: !1,
967
- changed: !1,
968
- revision: A,
969
- retained: [],
970
- dropped: [],
971
- diagnostics: []
972
- });
973
- }
974
- let r = ge(e, n);
975
- if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
976
- ok: !1,
977
- changed: !1,
978
- revision: A,
979
- retained: [],
980
- dropped: [],
981
- diagnostics: []
982
- });
983
- let i;
984
- try {
985
- i = U(n, r.values);
986
- } catch {
987
- return $({
988
- ok: !1,
989
- changed: !1,
990
- revision: A,
991
- retained: [],
992
- dropped: [],
993
- diagnostics: []
994
- });
995
- }
996
- let a = D(n);
997
- for (let e of Object.keys(E)) delete E[e];
998
- if (Object.assign(E, a), _ = n, k = r.values, j = i.environment, M = i.snapshotState, z = null, A += 1, K(), t) for (let e of B) e();
999
- return $({
1000
- ok: !0,
1001
- changed: !0,
1002
- revision: A,
1003
- retained: r.retained,
1004
- dropped: r.dropped,
1005
- diagnostics: r.diagnostics
1006
- });
1007
- }, ve = (e) => {
1008
- let t = /* @__PURE__ */ new Set();
1009
- for (let n of l([e])) t.add(n.id);
1010
- return t;
1011
- }, ye = {
1012
- get document() {
1013
- return _.document;
1014
- },
1015
- services: C,
1016
- snapshot() {
1017
- return H(), N;
1018
- },
1019
- get(e, t) {
1020
- H();
1021
- let n = v(), r = n.nodeIndex.get(e.id);
1022
- if (!r) return null;
1023
- let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? d(r) : n.slotKeys.get(r.id)?.[t];
1024
- return i && Object.hasOwn(k, i) ? P(k[i]) : null;
1025
- },
1026
- set(e, t, n) {
1027
- H();
1028
- let r = v(), i = r.nodeIndex.get(e.id);
1029
- if (!i) return [L(r.document, e, "local.runtime.binding", a("local.runtime.binding.no-writable"))];
1030
- let o = r.slotKeys.get(i.id), s;
1031
- if (n === void 0) {
1032
- if (o && !o.value) return [L(r.document, i, "local.runtime.binding", a("local.runtime.binding.needs-slot"))];
1033
- s = o?.value ?? r.bindingByNode.get(i.id) ?? d(i);
1034
- } else if (s = o?.[n], !s) return [L(r.document, i, "local.runtime.binding", a("local.runtime.binding.unknown-slot", { slot: n }))];
1035
- let c = Object.hasOwn(r.document.bindings, s) ? r.document.bindings[s] : void 0;
1036
- if (!c) return [L(r.document, i, "local.runtime.binding", a("local.runtime.binding.no-writable"))];
1037
- let l = X(c, r.controls.get(s) ?? [], t, G({ [s]: t }), r.valueRules, r.legacyValueRules);
1038
- if (!l.ok) return [L(r.document, i, "local.runtime.value", l.detail)];
1039
- let u = P(l.value);
1040
- if (F(k[s], u)) return [];
1041
- let f = {
1042
- ...k,
1043
- [s]: u
1044
- };
1045
- return Q(r, i.id, f) ? [L(r.document, i, "local.runtime.value", a("local.runtime.value.range-order"))] : (J(f), []);
1046
- },
1047
- setMany(e, t) {
1048
- H();
1049
- let n = v(), r = n.nodeIndex.get(e.id);
1050
- if (!r) return [L(n.document, e, "local.runtime.binding", a("local.runtime.binding.no-writable"))];
1051
- let i = n.slotKeys.get(r.id);
1052
- if (!i) return [L(n.document, r, "local.runtime.binding", a("local.runtime.binding.no-multi-slot"))];
1053
- let o = Object.entries(t);
1054
- if (!o.length) return [];
1055
- let s = { ...k }, c = U(n, {
1056
- ...k,
1057
- ...Object.fromEntries(o.map(([e, t]) => [i[e], t]))
1058
- }).environment;
1059
- for (let [e, t] of o) {
1060
- let o = i[e];
1061
- if (!o || !Object.hasOwn(n.document.bindings, o)) return [L(n.document, r, "local.runtime.binding", a("local.runtime.binding.unknown-slot", { slot: e }))];
1062
- let l = X(n.document.bindings[o], n.controls.get(o) ?? [], t, (e, t) => O(e, t, c), n.valueRules, n.legacyValueRules);
1063
- if (!l.ok) return [L(n.document, r, "local.runtime.value", l.detail)];
1064
- s[o] = P(l.value);
1065
- }
1066
- return Q(n, r.id, s) ? [L(n.document, r, "local.runtime.value", a("local.runtime.value.range-order"))] : (o.every(([e, t]) => F(k[i[e]], t)) || J(s), []);
1067
- },
1068
- parameterNames() {
1069
- return H(), v().publicNames;
1070
- },
1071
- getParameter(e) {
1072
- H();
1073
- let t = v();
1074
- if (!e.startsWith("@") && Object.hasOwn(t.document.bindings, e)) return Object.hasOwn(k, e) ? P(k[e]) : void 0;
1075
- },
1076
- getParameters() {
1077
- H();
1078
- let e = v(), t = {};
1079
- for (let n of e.publicNames) {
1080
- let e = k[n];
1081
- t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
1082
- }
1083
- return Object.freeze(t);
1084
- },
1085
- setParameter(e, t) {
1086
- H();
1087
- let n = Object.create(null);
1088
- return n[e] = t, Z(n);
1089
- },
1090
- setParameters(e) {
1091
- if (H(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setParameters requires an object of parameter values.");
1092
- return Z(e);
1093
- },
1094
- getExternal(e) {
1095
- if (H(), Object.hasOwn(v().document.externals ?? {}, e) && Object.hasOwn(E, e)) return P(E[e]);
1096
- },
1097
- getExternalValues() {
1098
- H();
1099
- let e = {};
1100
- for (let [t, n] of Object.entries(E)) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
1101
- return Object.freeze(e);
1102
- },
1103
- setExternalValues(e) {
1104
- return Y(e);
1105
- },
1106
- evaluate(e) {
1107
- H();
1108
- let t = ue(e).evaluate(j);
1109
- return Array.isArray(t) ? t.slice() : t;
1110
- },
1111
- validate() {
1112
- if (H(), z && z.revision === A) return z.diagnostics.map(ie);
1113
- let e = me();
1114
- return z = {
1115
- revision: A,
1116
- diagnostics: e
1117
- }, e.map(ie);
1118
- },
1119
- text(e) {
1120
- return H(), x(e, j);
1121
- },
1122
- reset(e) {
1123
- H();
1124
- let n = v(), r = n.nodeIndex.get(e.id);
1125
- if (!r) return;
1126
- let i = ve(r), a = { ...k };
1127
- for (let [e, r] of Object.entries(n.document.bindings)) {
1128
- if (!(n.controls.get(e) ?? []).some((e) => i.has(e.id))) continue;
1129
- let o = y(r.initial);
1130
- if (o) throw new s("expression-budget", `Parameter "${e}": ${t(o)}`, 0);
1131
- a[e] = P(r.initial);
1132
- }
1133
- for (let e of i) V.set(e, (V.get(e) ?? 0) + 1);
1134
- J(a);
1135
- },
1136
- resetToken(e) {
1137
- H();
1138
- let t = v().nodeIndex.get(e.id);
1139
- return t ? V.get(t.id) ?? 0 : 0;
1140
- },
1141
- subscribe(e) {
1142
- return H(), B.add(e), () => {
1143
- B.delete(e);
1144
- };
1145
- },
1146
- dispose() {
1147
- I || (I = !0, C.state.flush(), i && C.scheduler.dispose(), B.clear(), u.clear(), g.clear(), _.computationExpressions.clear(), _.constErrors.clear(), _.cycleErrors.clear(), _.validationRules.length = 0, V.clear());
1148
- }
1149
- };
1150
- return pe.set(ye, {
1151
- update: _e,
1152
- notify() {
1153
- if (!I) for (let e of B) e();
1154
- }
1155
- }), W(), K(), ye;
1156
- }
1157
- export { ne as a, M as i, he as n, me as r, ge as t };