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
@@ -0,0 +1,1121 @@
1
+ import { $ as e, A as t, F as n, I as r, N as i, Q as a, R as o, X as s, Z as c, a as l, i as u, it as d, q as f, st as p, t as m } from "./preset-core-CKc5YXSM.js";
2
+ import { D as h, E as g, O as _, T as v, V as y, _ as b, a as x, c as S, d as C, h as w, i as T, m as ee, n as E, o as te, p as ne, r as D, s as re, t as ie, v as ae, y as O } from "./config-validation-F47AcE6o.js";
3
+ import { a as k, n as oe, s as se, t as ce } from "./compile-wUv8KEge.js";
4
+ import { n as le } from "./props-sJ8vk0cr.js";
5
+ import { p as ue, r as de, x as fe } from "./registry-core-Bbad9Bm2.js";
6
+ // node_modules/devlop/lib/default.js
7
+ function pe() {}
8
+ // node_modules/mdast-util-to-string/lib/index.js
9
+ var me = {};
10
+ function he(e, t) {
11
+ let n = t || me;
12
+ return ge(e, typeof n.includeImageAlt != "boolean" || n.includeImageAlt, typeof n.includeHtml != "boolean" || n.includeHtml);
13
+ }
14
+ function ge(e, t, n) {
15
+ if (ve(e)) {
16
+ if ("value" in e) return e.type === "html" && !n ? "" : e.value;
17
+ if (t && "alt" in e && e.alt) return e.alt;
18
+ if ("children" in e) return _e(e.children, t, n);
19
+ }
20
+ return Array.isArray(e) ? _e(e, t, n) : "";
21
+ }
22
+ function _e(e, t, n) {
23
+ let r = [], i = -1;
24
+ for (; ++i < e.length;) r[i] = ge(e[i], t, n);
25
+ return r.join("");
26
+ }
27
+ function ve(e) {
28
+ return !!(e && typeof e == "object");
29
+ }
30
+ // node_modules/micromark-util-chunked/index.js
31
+ function A(e, t, n, r) {
32
+ let i = e.length, a = 0, o;
33
+ if (t = t < 0 ? -t > i ? 0 : i + t : t > i ? i : t, n = n > 0 ? n : 0, r.length < 1e4) o = Array.from(r), o.unshift(t, n), e.splice(...o);
34
+ else for (n && e.splice(t, n); a < r.length;) o = r.slice(a, a + 1e4), o.unshift(t, 0), e.splice(...o), a += 1e4, t += 1e4;
35
+ }
36
+ function ye(e, t) {
37
+ return e.length > 0 ? (A(e, e.length, 0, t), e) : t;
38
+ }
39
+ // node_modules/micromark-util-combine-extensions/index.js
40
+ var j = {}.hasOwnProperty;
41
+ function be(e) {
42
+ let t = {}, n = -1;
43
+ for (; ++n < e.length;) xe(t, e[n]);
44
+ return t;
45
+ }
46
+ function xe(e, t) {
47
+ let n;
48
+ for (n in t) {
49
+ let r = (j.call(e, n) ? e[n] : void 0) || (e[n] = {}), i = t[n], a;
50
+ if (i) for (a in i) {
51
+ j.call(r, a) || (r[a] = []);
52
+ let e = i[a];
53
+ Se(r[a], Array.isArray(e) ? e : e ? [e] : []);
54
+ }
55
+ }
56
+ }
57
+ function Se(e, t) {
58
+ let n = -1, r = [];
59
+ for (; ++n < t.length;) (t[n].add === "after" ? e : r).push(t[n]);
60
+ A(e, 0, 0, r);
61
+ }
62
+ // node_modules/micromark-util-normalize-identifier/index.js
63
+ function Ce(e) {
64
+ return e.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
65
+ }
66
+ // node_modules/micromark-util-character/index.js
67
+ var we = L(/[A-Za-z]/), Te = L(/[\dA-Za-z]/), Ee = L(/[#-'*+\--9=?A-Z^-~]/);
68
+ function De(e) {
69
+ return e !== null && (e < 32 || e === 127);
70
+ }
71
+ var Oe = L(/\d/), ke = L(/[\dA-Fa-f]/), Ae = L(/[!-/:-@[-`{-~]/);
72
+ function M(e) {
73
+ return e !== null && e < -2;
74
+ }
75
+ function N(e) {
76
+ return e !== null && (e < 0 || e === 32);
77
+ }
78
+ function P(e) {
79
+ return e === -2 || e === -1 || e === 32;
80
+ }
81
+ var F = L(/\p{P}|\p{S}/u), I = L(/\s/);
82
+ function L(e) {
83
+ return t;
84
+ function t(t) {
85
+ return t !== null && t > -1 && e.test(String.fromCharCode(t));
86
+ }
87
+ }
88
+ // node_modules/micromark-factory-space/index.js
89
+ function R(e, t, n, r) {
90
+ let i = r ? r - 1 : Infinity, a = 0;
91
+ return o;
92
+ function o(r) {
93
+ return P(r) ? (e.enter(n), s(r)) : t(r);
94
+ }
95
+ function s(r) {
96
+ return P(r) && a++ < i ? (e.consume(r), s) : (e.exit(n), t(r));
97
+ }
98
+ }
99
+ function je(e, t, n, r, i, a) {
100
+ let o = 0;
101
+ return s;
102
+ function s(t) {
103
+ return a > 0 && P(t) ? (e.enter(r), c(t)) : l(t);
104
+ }
105
+ function c(t) {
106
+ return P(t) && o < a ? (e.consume(t), o++, c) : (e.exit(r), l(t));
107
+ }
108
+ function l(e) {
109
+ return o >= i ? t(e) : n(e);
110
+ }
111
+ }
112
+ // node_modules/micromark-util-classify-character/index.js
113
+ function Me(e) {
114
+ if (e === null || N(e) || I(e)) return 1;
115
+ if (F(e)) return 2;
116
+ }
117
+ // node_modules/micromark-util-resolve-all/index.js
118
+ function Ne(e, t, n) {
119
+ let r = [], i = -1;
120
+ for (; ++i < e.length;) {
121
+ let a = e[i].resolveAll;
122
+ a && !r.includes(a) && (t = a(t, n), r.push(a));
123
+ }
124
+ return t;
125
+ }
126
+ // node_modules/micromark-core-commonmark/lib/blank-line.js
127
+ var Pe = {
128
+ partial: !0,
129
+ tokenize: Fe
130
+ };
131
+ function Fe(e, t, n) {
132
+ return r;
133
+ function r(t) {
134
+ return P(t) ? R(e, i, "linePrefix")(t) : i(t);
135
+ }
136
+ function i(e) {
137
+ return e === null || M(e) ? t(e) : n(e);
138
+ }
139
+ }
140
+ // src/local/html/html-table-names.ts
141
+ var Ie = /* @__PURE__ */ new Set([
142
+ "table",
143
+ "caption",
144
+ "colgroup",
145
+ "col",
146
+ "thead",
147
+ "tbody",
148
+ "tfoot",
149
+ "tr",
150
+ "th",
151
+ "td"
152
+ ]), z = {
153
+ colgroup: /* @__PURE__ */ new Set(["span"]),
154
+ col: /* @__PURE__ */ new Set(["span"]),
155
+ td: /* @__PURE__ */ new Set([
156
+ "colspan",
157
+ "rowspan",
158
+ "headers",
159
+ "align"
160
+ ]),
161
+ th: /* @__PURE__ */ new Set([
162
+ "colspan",
163
+ "rowspan",
164
+ "headers",
165
+ "scope",
166
+ "abbr",
167
+ "align"
168
+ ])
169
+ };
170
+ function B(e, t) {
171
+ let n = t.trim();
172
+ return [
173
+ "colspan",
174
+ "rowspan",
175
+ "span"
176
+ ].includes(e) ? /^\d{1,5}$/.test(n) && Number(n) <= (e === "rowspan" ? 65534 : 1e3) && Number(n) >= (e === "rowspan" ? 0 : 1) : e === "align" ? _(t) !== null : e !== "scope" || [
177
+ "row",
178
+ "col",
179
+ "rowgroup",
180
+ "colgroup"
181
+ ].includes(n.toLowerCase());
182
+ }
183
+ // src/local/html/html-policy.ts
184
+ var Le = {
185
+ b: "strong",
186
+ strong: "strong",
187
+ i: "emphasis",
188
+ em: "emphasis",
189
+ s: "delete",
190
+ del: "delete",
191
+ u: "underline",
192
+ mark: "mark",
193
+ sup: "sup",
194
+ sub: "sub"
195
+ }, Re = /* @__PURE__ */ new Set([
196
+ "br",
197
+ "hr",
198
+ "img",
199
+ "col"
200
+ ]), ze = /* @__PURE__ */ new Set([
201
+ "pre",
202
+ "code",
203
+ "script",
204
+ "style",
205
+ "textarea",
206
+ "title",
207
+ "xmp",
208
+ "iframe",
209
+ "noembed",
210
+ "noframes",
211
+ "plaintext"
212
+ ]), Be = /* @__PURE__ */ new Set([
213
+ "id",
214
+ "title",
215
+ "lang",
216
+ "dir"
217
+ ]), Ve = {
218
+ a: g,
219
+ img: /* @__PURE__ */ new Set([
220
+ "src",
221
+ "alt",
222
+ "width",
223
+ "height"
224
+ ]),
225
+ ol: /* @__PURE__ */ new Set(["start"]),
226
+ details: /* @__PURE__ */ new Set(["open"]),
227
+ ...z
228
+ };
229
+ function He(e, t, n) {
230
+ let r = "";
231
+ for (let i = t; i < n; i += 1) {
232
+ let t = e[i];
233
+ if (r) t === r && (r = "");
234
+ else if (t === "\"" || t === "'") r = t;
235
+ else if (t === ">") return i + 1;
236
+ }
237
+ return -1;
238
+ }
239
+ function Ue(e, t, n) {
240
+ if (e.startsWith("<!-->", t)) return Math.min(n, t + 5);
241
+ if (e.startsWith("<!--->", t)) return Math.min(n, t + 6);
242
+ let r = e.indexOf("-->", t + 4);
243
+ return r < 0 || r + 3 > n ? n : r + 3;
244
+ }
245
+ function We(e) {
246
+ return e.trim().replace(/[\u0000- ]+/g, "");
247
+ }
248
+ function V(e, t) {
249
+ let n = /^([a-z][a-z0-9+.-]*):/i.exec(We(e));
250
+ if (!n) return !1;
251
+ let r = n[1].toLowerCase();
252
+ return t === "image" ? r !== "http" && r !== "https" : r !== "http" && r !== "https" && r !== "mailto" && r !== "tel";
253
+ }
254
+ function Ge(e, t) {
255
+ return t === "class" || t === "style" || /^on[a-z]/i.test(t) ? !1 : t === "align" && v.has(e) || Be.has(t) || /^aria-[a-z0-9_.-]+$/.test(t) || /^data-[a-z0-9_.-]+$/.test(t) ? !0 : Ve[e]?.has(t) ?? !1;
256
+ }
257
+ function Ke(e, t) {
258
+ return !(e === "dir" && ![
259
+ "ltr",
260
+ "rtl",
261
+ "auto"
262
+ ].includes(t.trim().toLowerCase()) || e === "id" && t.trim() === "" || (e === "width" || e === "height") && !/^\d{1,6}$/.test(t.trim()) || e === "start" && !/^-?\d{1,9}$/.test(t.trim()) || !B(e, t) || e === "href" && V(t, "link") || e === "src" && V(t, "image"));
263
+ }
264
+ function qe(e, t) {
265
+ return v.has(e) ? _(t) : null;
266
+ }
267
+ // src/local/types.ts
268
+ var Je = (e) => e.attrs?.bind ?? `@${e.id}`, Ye = "local-draft-3", Xe = Object.freeze({}), Ze = Object.freeze([
269
+ "anchor",
270
+ "checkbox",
271
+ "column",
272
+ "coordinate",
273
+ "counter",
274
+ "date",
275
+ "edge",
276
+ "input",
277
+ "number",
278
+ "progress",
279
+ "range-slider",
280
+ "slider",
281
+ "textarea",
282
+ "timer",
283
+ "toggle",
284
+ "validation"
285
+ ]);
286
+ function Qe(e) {
287
+ let t = /* @__PURE__ */ new Set();
288
+ for (let n of Ze) e(n) || t.add(n);
289
+ return t;
290
+ }
291
+ // src/sdk/compiler-config.ts
292
+ var H = Object.freeze({
293
+ id: u,
294
+ version: l
295
+ }), U = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap();
296
+ function G(e, t = H) {
297
+ if (e.length === 0) return;
298
+ let n = t.id === H.id && t.version === H.version;
299
+ if (n) {
300
+ let t = U.get(e);
301
+ if (t) return t;
302
+ }
303
+ let r = m({
304
+ protocol: o,
305
+ id: t.id,
306
+ version: t.version,
307
+ components: e
308
+ });
309
+ return n && U.set(e, r), r;
310
+ }
311
+ function $e(e, t, n, r, i = "reactive-md-config/v1") {
312
+ let a = w(e, { legacyProfiles: t.length > 0 ? n : [] }), o = [...a.legacyKeys, ...r !== void 0 && !a.legacyKeys.some((e) => e.key === r) ? [Object.freeze({
313
+ profile: i,
314
+ key: r
315
+ })] : []];
316
+ return C(e, a, o);
317
+ }
318
+ function et(e) {
319
+ return x(e) || T("assembly", "must be an object."), D(e, /* @__PURE__ */ new Set([
320
+ "protocol",
321
+ "presets",
322
+ "components",
323
+ "replacementPolicy",
324
+ "themes"
325
+ ]), "assembly"), e.protocol !== "reactive-md-assembly/v1" && T("assembly.protocol", `must be "${i}".`), ee(e);
326
+ }
327
+ function tt(e, a = [], o = []) {
328
+ let s = ae(o);
329
+ if (x(e) || T("config", "must be an object."), D(e, ie, "config"), e.protocol === "reactive-md-config/v2") {
330
+ let n = et(e.assembly), r = $e(n, a, s);
331
+ return t(n) > 16777216 && T("config", `serialized size exceeds the ${E}-byte budget.`), r;
332
+ }
333
+ e.protocol !== "reactive-md-config/v1" && T("config.protocol", `must be "${r}" (or legacy "${n}").`);
334
+ let c = re(e.presets, H, s)[0] ?? H, l = b(c, s);
335
+ l === void 0 && T("presets", `local.config.migration-unsupported: no compatibility profile matches preset "${c.id}" ${c.version}.`);
336
+ let u = l.legacyKeys[0];
337
+ u === void 0 && T("presets", `local.config.migration-unsupported: profile "${l.name}" has no legacy key mapping.`), S(l, a);
338
+ let d = te(e.components, a);
339
+ d.some((e) => e.replaces !== void 0) && T("config", "replaces is not supported by reactive-md-config/v1.");
340
+ let f = G(a, l.preset), p = Object.freeze({
341
+ protocol: i,
342
+ presets: Object.freeze(f ? [f] : []),
343
+ components: d,
344
+ replacementPolicy: "forbid",
345
+ themes: Object.freeze([])
346
+ }), m = $e(p, a, s, a.length > 0 ? ne(l.preset, d) : void 0, u.profile);
347
+ return t(p) > 16777216 && T("config", `serialized size exceeds the ${E}-byte budget.`), m;
348
+ }
349
+ function nt(e) {
350
+ let t = W.get(e);
351
+ if (t !== void 0) return t;
352
+ let n = G(e), r = Object.freeze({
353
+ protocol: i,
354
+ presets: Object.freeze(n ? [n] : []),
355
+ components: Object.freeze([]),
356
+ replacementPolicy: "forbid",
357
+ themes: Object.freeze([])
358
+ }), a = w(r).key;
359
+ return W.set(e, a), a;
360
+ }
361
+ // src/local/configuration/capability-policy.ts
362
+ var K = Object.freeze({
363
+ enableCss: !0,
364
+ enableJavaScript: !1,
365
+ enableExtendedHtml: !1
366
+ });
367
+ function rt(e, t) {
368
+ return {
369
+ enableCss: e?.enableCss === !0 && (t?.enableCss ?? K.enableCss) === !0,
370
+ enableJavaScript: e?.enableJavaScript === !0 && t?.enableJavaScript === !0,
371
+ enableExtendedHtml: e?.enableExtendedHtml === !0 && t?.enableExtendedHtml === !0
372
+ };
373
+ }
374
+ // src/local/configuration/options-core.ts
375
+ var it = [
376
+ "enableCss",
377
+ "enableJavaScript",
378
+ "enableExtendedHtml"
379
+ ], at = H;
380
+ function q(e) {
381
+ return typeof e == "object" && !!e && !Array.isArray(e);
382
+ }
383
+ var ot = "local.options.invalid.host-components", st = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, ct = /* @__PURE__ */ new Set([
384
+ "string",
385
+ "number",
386
+ "boolean",
387
+ "enum"
388
+ ]), lt = /* @__PURE__ */ new Set([
389
+ "leaf",
390
+ "inline",
391
+ "container"
392
+ ]), ut = /* @__PURE__ */ new Set([
393
+ "string",
394
+ "number",
395
+ "boolean"
396
+ ]), dt = /* @__PURE__ */ new Set([
397
+ "bind",
398
+ "initial",
399
+ "disabled"
400
+ ]), ft = /* @__PURE__ */ new Set([
401
+ "maxSyntaxNodes",
402
+ "maxParseWork",
403
+ "maxMarkdownDepth"
404
+ ]);
405
+ function J(e, t, n) {
406
+ if (!Object.hasOwn(e, t)) return {
407
+ ok: !0,
408
+ value: n
409
+ };
410
+ let r = e[t];
411
+ if (r === void 0) return {
412
+ ok: !0,
413
+ value: n
414
+ };
415
+ if (typeof r != "number" || !Number.isSafeInteger(r) || r < 1) {
416
+ let e = t === "maxSyntaxNodes" ? "max-syntax-nodes" : t === "maxParseWork" ? "max-parse-work" : "max-markdown-depth";
417
+ return {
418
+ ok: !1,
419
+ message: `Compile option limits.${t} must be a positive safe integer.`,
420
+ key: `local.options.invalid.${e}`
421
+ };
422
+ }
423
+ return {
424
+ ok: !0,
425
+ value: r
426
+ };
427
+ }
428
+ function Y(e) {
429
+ return {
430
+ ok: !1,
431
+ message: `Compile option hostComponents is invalid: ${e}`,
432
+ key: ot,
433
+ detail: e
434
+ };
435
+ }
436
+ function pt(e, t) {
437
+ if (e === void 0) return {
438
+ ok: !0,
439
+ binding: void 0
440
+ };
441
+ if (!q(e)) return Y(`${t} "binding" must be an object.`);
442
+ for (let n of Object.keys(e)) if (![
443
+ "kind",
444
+ "initialRule",
445
+ "min",
446
+ "max",
447
+ "step",
448
+ "options",
449
+ "exclusive"
450
+ ].includes(n)) return Y(`${t} "binding" has unknown field "${n}".`);
451
+ let n = e.kind;
452
+ if (typeof n != "string" || !ut.has(n)) return Y(`${t} "binding.kind" has unsupported kind ${typeof n == "string" ? `"${n}"` : String(n)}.`);
453
+ let r = { kind: n };
454
+ if (Object.hasOwn(e, "exclusive") && e.exclusive !== void 0) {
455
+ if (typeof e.exclusive != "boolean") return Y(`${t} "binding.exclusive" must be a boolean.`);
456
+ r.exclusive = e.exclusive;
457
+ }
458
+ if (Object.hasOwn(e, "initialRule") && e.initialRule !== void 0) {
459
+ let n = e.initialRule;
460
+ if (typeof n != "string" || ![
461
+ "empty",
462
+ "false",
463
+ "nearest-zero",
464
+ "min",
465
+ "first-option"
466
+ ].includes(n)) return Y(`${t} "binding.initialRule" is not supported.`);
467
+ r.initialRule = n;
468
+ }
469
+ for (let n of [
470
+ "min",
471
+ "max",
472
+ "step"
473
+ ]) {
474
+ if (!Object.hasOwn(e, n) || e[n] === void 0) continue;
475
+ if (r.kind !== "number") return Y(`${t} "binding.${n}" is only valid for number bindings.`);
476
+ let i = e[n];
477
+ if (typeof i != "number" || !Number.isFinite(i)) return Y(`${t} "binding.${n}" must be a finite number.`);
478
+ r[n] = i;
479
+ }
480
+ if (r.kind === "number") {
481
+ if (r.step !== void 0 && !(r.step > 0)) return Y(`${t} "binding.step" must be greater than 0.`);
482
+ if (r.min !== void 0 && r.max !== void 0 && r.min > r.max) return Y(`${t} "binding.min" cannot exceed "binding.max".`);
483
+ if (r.initialRule !== void 0 && !["min", "nearest-zero"].includes(r.initialRule)) return Y(`${t} "binding.initialRule" must be "min" or "nearest-zero" for number bindings.`);
484
+ r.initialRule ??= "nearest-zero";
485
+ }
486
+ let i = Object.hasOwn(e, "options") && e.options !== void 0;
487
+ if (i) {
488
+ if (r.kind !== "string") return Y(`${t} "binding.options" is only valid for string bindings.`);
489
+ let n = e.options;
490
+ if (!Array.isArray(n) || n.length === 0) return Y(`${t} "binding.options" must be a non-empty string array.`);
491
+ if (n.length > 64) return Y(`${t} "binding.options" accepts at most 64 values.`);
492
+ let i = /* @__PURE__ */ new Set(), a = [];
493
+ for (let e of n) {
494
+ if (typeof e != "string" || e === "") return Y(`${t} "binding.options" must be a non-empty string array.`);
495
+ if (e.length > 128) return Y(`${t} "binding.options" value exceeds the 128-character limit.`);
496
+ if (i.has(e)) return Y(`${t} "binding.options" value "${e}" is declared more than once.`);
497
+ i.add(e), a.push(e);
498
+ }
499
+ r.options = a, r.initialRule ??= "first-option";
500
+ }
501
+ if (r.kind === "string") {
502
+ let e = i ? "first-option" : "empty";
503
+ if (r.initialRule !== void 0 && r.initialRule !== e) return Y(`${t} "binding.initialRule" must be "${e}" for ${i ? "choice" : "string"} bindings.`);
504
+ r.initialRule ??= e;
505
+ }
506
+ if (r.kind === "boolean") {
507
+ if (r.initialRule !== void 0 && r.initialRule !== "false") return Y(`${t} "binding.initialRule" must be "false" for boolean bindings.`);
508
+ r.initialRule ??= "false";
509
+ }
510
+ return {
511
+ ok: !0,
512
+ binding: r
513
+ };
514
+ }
515
+ function mt(e, t) {
516
+ let n = [], r = /* @__PURE__ */ new Map();
517
+ if (e === void 0) return {
518
+ ok: !0,
519
+ hostComponents: n,
520
+ hostByName: r
521
+ };
522
+ if (!Array.isArray(e)) return Y("must be an array.");
523
+ if (e.length > 32) return Y("accepts at most 32 components.");
524
+ let i = /* @__PURE__ */ new Set();
525
+ for (let e of t) i.add(e.name.toLowerCase());
526
+ for (let e of O) i.add(e.name.toLowerCase());
527
+ for (let e of h) i.add(e.toLowerCase());
528
+ i.add("theme");
529
+ for (let t = 0; t < e.length; t += 1) {
530
+ let a = e[t], o = `hostComponents[${t}]`;
531
+ if (!q(a)) return Y(`${o} must be an object.`);
532
+ let s = a.name;
533
+ if (typeof s != "string") return Y(`${o} "name" must be a string.`);
534
+ if (s.length > 128) return Y(`${o} "name" exceeds the 128-character limit.`);
535
+ if (!st.test(s)) return Y(`${o} "name" ${s} must use lowercase kebab-case.`);
536
+ if (i.has(s.toLowerCase())) return Y(`${o} "name" ${s} conflicts with a built-in component, HTML tag or theme.`);
537
+ if (r.has(s.toLowerCase())) return Y(`${o} "name" ${s} is declared more than once.`);
538
+ if (typeof a.form != "string" || !lt.has(a.form)) return Y(`${o} "form" must be "leaf", "inline" or "container".`);
539
+ let c = a.form, l = pt(a.binding, o);
540
+ if (!l.ok) return l;
541
+ let u = l.binding, d = a.props;
542
+ if (!q(d)) return Y(`${o} "props" must be an object.`);
543
+ let p = {};
544
+ for (let e of Object.keys(d)) {
545
+ if (!st.test(e)) return Y(`${o} property "${e}" must use lowercase kebab-case.`);
546
+ if (u && dt.has(e)) return Y(`${o} property "${e}" is reserved by the host binding.`);
547
+ let t = d[e];
548
+ if (!q(t)) return Y(`${o} property "${e}" must be an object.`);
549
+ let n = t.kind;
550
+ if (typeof n != "string" || !ct.has(n)) return Y(`property "${e}" has unsupported kind ${typeof n == "string" ? `"${n}"` : String(n)}.`);
551
+ let r = { kind: n };
552
+ for (let n of ["required", "static"]) if (Object.hasOwn(t, n) && t[n] !== void 0) {
553
+ if (typeof t[n] != "boolean") return Y(`${o} property "${e}" "${n}" must be a boolean.`);
554
+ r[n] = t[n];
555
+ }
556
+ let i = Object.hasOwn(t, "enum") && t.enum !== void 0;
557
+ if (n !== "enum") {
558
+ if (i) return Y(`${o} property "${e}" has "enum" but kind is "${n}".`);
559
+ } else {
560
+ let n = t.enum;
561
+ if (!Array.isArray(n) || n.length === 0) return Y(`${o} property "${e}" "enum" must be a non-empty string array.`);
562
+ if (n.length > 64) return Y(`${o} property "${e}" "enum" accepts at most 64 values.`);
563
+ let i = /* @__PURE__ */ new Set();
564
+ for (let t of n) {
565
+ if (typeof t != "string") return Y(`${o} property "${e}" "enum" must be a non-empty string array.`);
566
+ if (t.length > 128) return Y(`${o} property "${e}" enum value exceeds the 128-character limit.`);
567
+ if (i.has(t)) return Y(`${o} property "${e}" enum value "${t}" is declared more than once.`);
568
+ i.add(t);
569
+ }
570
+ r.enum = [...n];
571
+ }
572
+ let a = Object.hasOwn(t, "pattern") && t.pattern !== void 0;
573
+ if (n !== "string") {
574
+ if (a) return Y(`${o} property "${e}" has "pattern" but kind is "${n}".`);
575
+ } else if (a) {
576
+ let n = t.pattern;
577
+ if (typeof n != "string") return Y(`${o} property "${e}" "pattern" must be a string.`);
578
+ if (n.length > 512) return Y(`${o} property "${e}" "pattern" exceeds the 512-character limit.`);
579
+ try {
580
+ new RegExp(n);
581
+ } catch {
582
+ return Y(`${o} property "${e}" "pattern" is not a valid regular expression.`);
583
+ }
584
+ if (!f(n)) return Y(`${o} property "${e}" "pattern" uses unsupported regex syntax; nested quantifiers, quantified alternation, backreferences and lookarounds are rejected.`);
585
+ r.pattern = n;
586
+ }
587
+ p[e] = r;
588
+ }
589
+ let m = {
590
+ name: s,
591
+ form: c,
592
+ props: p,
593
+ ...u ? { binding: u } : {}
594
+ };
595
+ n.push(m), r.set(s, m);
596
+ }
597
+ return {
598
+ ok: !0,
599
+ hostComponents: n,
600
+ hostByName: r
601
+ };
602
+ }
603
+ function ht(e) {
604
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
605
+ }
606
+ function gt(e) {
607
+ let t = e.static === !0 || e.dynamic === !1;
608
+ if (e.kind === "enum") {
609
+ let n = `^(?:${(e.enum ?? []).map(ht).join("|")})$`;
610
+ if (n.length <= 512) return {
611
+ kind: "string",
612
+ ...e.required === !0 ? { required: !0 } : {},
613
+ ...t ? { static: !0 } : {},
614
+ pattern: n
615
+ };
616
+ }
617
+ let n = { kind: e.kind };
618
+ return e.required === !0 && e.default === void 0 && (n.required = !0), t && (n.static = !0), e.enum && (n.enum = [...e.enum]), e.pattern !== void 0 && (n.pattern = e.pattern), n;
619
+ }
620
+ function _t(e) {
621
+ let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
622
+ for (let i of e.components) {
623
+ let e = {};
624
+ for (let t of Object.keys(i.props)) e[t] = gt(i.props[t]);
625
+ let a = le(i), o = {
626
+ name: i.name,
627
+ form: i.form,
628
+ props: e,
629
+ ...a ? { binding: a } : {}
630
+ };
631
+ t.push(o), n.set(i.name, o), r.set(i.name, i);
632
+ }
633
+ return {
634
+ hostComponents: t,
635
+ hostByName: n,
636
+ sdkByName: r
637
+ };
638
+ }
639
+ function X(e, t) {
640
+ let n = /* @__PURE__ */ new Map();
641
+ for (let t of e) n.set(t.name, t);
642
+ let r = /* @__PURE__ */ new Map();
643
+ for (let e of t.values()) r.set(e.name, e);
644
+ for (let e of O) r.has(e.name) || r.set(e.name, fe(e));
645
+ return {
646
+ componentByName: n,
647
+ schemaByName: r
648
+ };
649
+ }
650
+ function Z(e) {
651
+ let t = /* @__PURE__ */ new Map();
652
+ for (let n of e) t.set(n.name, de(n));
653
+ return t;
654
+ }
655
+ function vt(e, t) {
656
+ let n = t.defaults, r = new Set(n.map((e) => e.name));
657
+ if (e !== void 0 && !q(e)) return {
658
+ ok: !1,
659
+ message: "Compile options must be an object.",
660
+ key: "local.options.invalid.object"
661
+ };
662
+ let i = e ?? {}, o = { ...K };
663
+ for (let e of it) {
664
+ if (!Object.hasOwn(i, e)) continue;
665
+ let t = i[e];
666
+ if (t !== void 0) {
667
+ if (typeof t != "boolean") return {
668
+ ok: !1,
669
+ message: `Compile option ${e} must be a boolean.`,
670
+ key: "local.options.invalid.html-flag"
671
+ };
672
+ o[e] = t;
673
+ }
674
+ }
675
+ let l = !1;
676
+ if (Object.hasOwn(i, "markdownBreaks")) {
677
+ let e = i.markdownBreaks;
678
+ if (e !== void 0) {
679
+ if (typeof e != "boolean") return {
680
+ ok: !1,
681
+ message: "Compile option markdownBreaks must be a boolean.",
682
+ key: "local.options.invalid.markdown-breaks"
683
+ };
684
+ l = e;
685
+ }
686
+ }
687
+ let u = !0;
688
+ if (Object.hasOwn(i, "strict")) {
689
+ let e = i.strict;
690
+ if (e !== void 0) {
691
+ if (typeof e != "boolean") return {
692
+ ok: !1,
693
+ message: "Compile option strict must be a boolean.",
694
+ key: "local.options.invalid.strict"
695
+ };
696
+ u = e;
697
+ }
698
+ }
699
+ if (Object.hasOwn(i, "sourcePhase")) {
700
+ let e = i.sourcePhase;
701
+ if (e !== void 0 && e !== "streaming" && e !== "final") return {
702
+ ok: !1,
703
+ message: "Compile option sourcePhase must be \"streaming\" or \"final\".",
704
+ key: "local.options.invalid.source-phase"
705
+ };
706
+ }
707
+ let d = i.limits, f = a, p = c, m = s;
708
+ if (d !== void 0) {
709
+ if (!q(d)) return {
710
+ ok: !1,
711
+ message: "Compile option limits must be an object.",
712
+ key: "local.options.invalid.limits"
713
+ };
714
+ for (let e of Object.keys(d)) if (!ft.has(e) && d[e] !== void 0) return {
715
+ ok: !1,
716
+ message: `Compile option limits.${e} is not supported.`,
717
+ key: "local.options.invalid.limits-unknown",
718
+ detail: e
719
+ };
720
+ let e = J(d, "maxSyntaxNodes", f);
721
+ if (!e.ok) return e;
722
+ f = e.value;
723
+ let t = J(d, "maxParseWork", p);
724
+ if (!t.ok) return t;
725
+ p = t.value;
726
+ let n = J(d, "maxMarkdownDepth", m);
727
+ if (!n.ok) return n;
728
+ m = n.value;
729
+ }
730
+ let h = Object.hasOwn(i, "config") && i.config !== void 0, g = Object.hasOwn(i, "hostComponents") && i.hostComponents !== void 0;
731
+ if (h && g) return {
732
+ ok: !1,
733
+ message: "Compile option config cannot be combined with hostComponents.",
734
+ key: "local.options.invalid.config-conflict"
735
+ };
736
+ let _, v, y, b, x, S, C, w, T;
737
+ if (h) {
738
+ try {
739
+ _ = t.readConfig(i.config, n);
740
+ } catch (e) {
741
+ let t = e instanceof Error ? e.message : String(e);
742
+ return {
743
+ ok: !1,
744
+ message: `Compile option config is invalid: ${t}`,
745
+ key: "local.options.invalid.config",
746
+ detail: t
747
+ };
748
+ }
749
+ let e = _t(_);
750
+ v = e.hostComponents, y = e.hostByName, b = e.sdkByName, x = _.registry;
751
+ let r = X(x, Z(x));
752
+ S = r.schemaByName, C = r.componentByName, w = new Set(_.components.map((e) => e.name)), T = /* @__PURE__ */ new Set();
753
+ } else if (g) {
754
+ let e = mt(i.hostComponents, n);
755
+ if (!e.ok) return e;
756
+ v = e.hostComponents, y = e.hostByName, b = /* @__PURE__ */ new Map(), x = n;
757
+ let t = Z(n);
758
+ for (let [n, r] of e.hostByName) t.set(n, fe({
759
+ ...r,
760
+ legacyHost: !0
761
+ }));
762
+ let r = X(n, t);
763
+ S = r.schemaByName, C = r.componentByName, w = new Set(e.hostByName.keys()), T = new Set(e.hostByName.keys());
764
+ } else {
765
+ v = [], y = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), x = n;
766
+ let e = X(n, Z(n));
767
+ S = e.schemaByName, C = e.componentByName, w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set();
768
+ }
769
+ return {
770
+ ok: !0,
771
+ maxSyntaxNodes: f,
772
+ maxParseWork: p,
773
+ maxMarkdownDepth: m,
774
+ html: o,
775
+ markdownBreaks: l,
776
+ strict: u,
777
+ hostComponents: v,
778
+ hostByName: y,
779
+ ..._ ? { config: _ } : {},
780
+ sdkByName: b,
781
+ registry: x,
782
+ componentByName: C,
783
+ schemaByName: S,
784
+ defaultComponentNames: r,
785
+ unmountedLeafNames: _?.presets.some((e) => e.id === "reactive-md/minimal") ? Qe((e) => S.has(e)) : /* @__PURE__ */ new Set(),
786
+ externalComponentNames: w,
787
+ legacyHostNames: T,
788
+ componentConfigKey: _ ? t.configKey(_) : t.defaultConfigKey,
789
+ capabilities: t.capabilities ?? Xe,
790
+ ...t.preset ? { preset: t.preset } : {}
791
+ };
792
+ }
793
+ function yt(e, t = [], n) {
794
+ let r = t.length > 0 ? at : void 0;
795
+ return vt(e, {
796
+ defaults: t,
797
+ ...r ? { preset: r } : {},
798
+ defaultConfigKey: nt(t),
799
+ readConfig: tt,
800
+ configKey: (e) => e.key,
801
+ ...n ? { capabilities: n } : {}
802
+ });
803
+ }
804
+ function bt(e) {
805
+ return e.componentConfigKey;
806
+ }
807
+ // src/local/configuration/kernel-value-rules.ts
808
+ function Q(e) {
809
+ let t = {};
810
+ for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
811
+ return t;
812
+ }
813
+ function xt(e) {
814
+ let t = [];
815
+ for (let n of ue(e)) switch (n.kind) {
816
+ case "value-date":
817
+ t.push(Q({
818
+ kind: "date",
819
+ min: n.min,
820
+ max: n.max,
821
+ required: n.required
822
+ }));
823
+ break;
824
+ case "value-length":
825
+ t.push(Q({
826
+ kind: "length",
827
+ min: n.min,
828
+ max: n.max
829
+ })), (n.email !== void 0 || n.emailType !== void 0) && t.push(Q({
830
+ kind: "email",
831
+ type: n.email ?? "type",
832
+ value: n.emailType ?? "email"
833
+ }));
834
+ break;
835
+ case "value-email":
836
+ t.push(Q({
837
+ kind: "email",
838
+ type: n.type ?? "type",
839
+ value: n.value ?? "email"
840
+ }));
841
+ break;
842
+ case "value-required": t.push({
843
+ kind: "required",
844
+ required: n.required
845
+ });
846
+ }
847
+ return t;
848
+ }
849
+ function St(e) {
850
+ if (!e || typeof e != "object") return;
851
+ let t = e.kernel;
852
+ if (t && typeof t == "object") return t;
853
+ }
854
+ var Ct = /^[A-Za-z_][A-Za-z0-9_-]*$/;
855
+ function wt(e) {
856
+ return Ct.test(e);
857
+ }
858
+ function Tt(e, t, n) {
859
+ let r = [];
860
+ for (let i of e) {
861
+ let e = i.target;
862
+ e ? e.startsWith("#") || /\s/.test(e) ? r.push({
863
+ code: "local.jump.target",
864
+ message: `<${i.name}> target "${e}" must be a bare heading slug or anchor id without "#" or whitespace.`,
865
+ start: i.offset,
866
+ key: "local.jump.bad-target",
867
+ params: { target: e }
868
+ }) : !t.has(e) && !n.has(e) && r.push({
869
+ code: "local.jump.target",
870
+ message: `<${i.name}> target "${e}" does not resolve to a heading or explicit anchor in this document.`,
871
+ start: i.offset,
872
+ key: "local.jump.unresolved",
873
+ params: { target: e }
874
+ }) : r.push({
875
+ code: "local.jump.target",
876
+ message: "<jump> target cannot be empty.",
877
+ start: i.offset,
878
+ key: "local.jump.empty"
879
+ });
880
+ }
881
+ return r;
882
+ }
883
+ Object.freeze({
884
+ arrayLength: e,
885
+ dataTableColumns: 20,
886
+ plotCurves: 16,
887
+ plotPoints: p
888
+ });
889
+ // src/local/evaluation/computations.ts
890
+ function $(e, t, n) {
891
+ let r = t ? oe(t, n) : void 0;
892
+ return e.expressionOffset + (r ?? Math.max(0, e.source.indexOf(n)));
893
+ }
894
+ function Et(e, t, n, r = "local.expression") {
895
+ t instanceof k ? e(`${r}.${t.code || "invalid"}`, `Expression error: ${t.message}`, n + (Number.isFinite(t.offset) ? t.offset : 0)) : e(`${r}.invalid`, `Expression error: ${t instanceof Error ? t.message : String(t)}`, n);
896
+ }
897
+ function Dt(e) {
898
+ return e instanceof k ? e : new k("expression-eval", e instanceof Error ? e.message : String(e), 0);
899
+ }
900
+ function Ot(e, t) {
901
+ let n = new Set(e), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
902
+ for (let t of e) r.set(t, 0);
903
+ for (let a of e) for (let e of t(a)) {
904
+ if (!n.has(e)) continue;
905
+ r.set(a, (r.get(a) ?? 0) + 1);
906
+ let t = i.get(e);
907
+ t ? t.push(a) : i.set(e, [a]);
908
+ }
909
+ let a = [];
910
+ for (let t of e) (r.get(t) ?? 0) === 0 && a.push(t);
911
+ let o = [];
912
+ for (let e = 0; e < a.length; e += 1) {
913
+ let t = a[e];
914
+ o.push(t);
915
+ for (let e of i.get(t) ?? []) {
916
+ let t = (r.get(e) ?? 0) - 1;
917
+ r.set(e, t), t === 0 && a.push(e);
918
+ }
919
+ }
920
+ let s = new Set(o);
921
+ return {
922
+ order: o,
923
+ cyclic: e.filter((e) => !s.has(e))
924
+ };
925
+ }
926
+ function kt(e) {
927
+ let t = Object.keys(e), n = new Set(t);
928
+ return Ot(t, (t) => {
929
+ let r = e[t];
930
+ return r ? r.dependencies.filter((e) => n.has(e)) : [];
931
+ });
932
+ }
933
+ function At(e, t, n, r = /* @__PURE__ */ new Set(), i) {
934
+ let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = [], l = /* @__PURE__ */ new Set();
935
+ for (let t of e) s.has(t.name) || (s.set(t.name, t), c.push(t.name));
936
+ let u = new Set(c);
937
+ for (let e of c) {
938
+ let t = s.get(e), r;
939
+ try {
940
+ r = i?.expression(t.source) ?? ce(t.source);
941
+ } catch (r) {
942
+ Et(n, r, t.expressionOffset), l.add(e);
943
+ continue;
944
+ }
945
+ a.set(e, r), o.set(e, [...r.dependencies]);
946
+ }
947
+ for (let e of c) if (!l.has(e)) {
948
+ for (let r of o.get(e) ?? []) if (!(u.has(r) || Object.hasOwn(t, r))) {
949
+ n("local.computation.unknown", `Reference to undeclared parameter ${r} in computation "${e}".`, $(s.get(e), a.get(e), r)), l.add(e);
950
+ break;
951
+ }
952
+ }
953
+ let d = /* @__PURE__ */ new Set();
954
+ for (let e of c) {
955
+ if (l.has(e)) continue;
956
+ let i = s.get(e);
957
+ if (i.kind === "const") for (let c of o.get(e) ?? []) {
958
+ let o = u.has(c) ? s.get(c).kind : null;
959
+ Object.hasOwn(t, c) ? (n("local.computation.const", `Constant "${e}" cannot depend on ${r.has(c) ? "external data" : "control parameter"} "${c}".`, $(i, a.get(e), c)), d.add(e)) : o === "computed" && (n("local.computation.const", `Constant "${e}" cannot depend on computed value "${c}".`, $(i, a.get(e), c)), d.add(e));
960
+ }
961
+ }
962
+ let { order: f, cyclic: p } = Ot(c, (e) => o.get(e) ?? []);
963
+ if (p.length > 0) {
964
+ let e = new Set(p), t = [], r = /* @__PURE__ */ new Map(), i = p[0];
965
+ for (; !r.has(i);) {
966
+ r.set(i, t.length), t.push(i);
967
+ let n = (o.get(i) ?? []).find((t) => e.has(t));
968
+ if (n === void 0) break;
969
+ i = n;
970
+ }
971
+ let a = r.has(i) ? t.slice(r.get(i)) : [p[0]], c = a.slice(0, 12).join(" → ") + (a.length > 12 ? " → …" : ` → ${a[0]}`);
972
+ for (let e of a.slice(0, 100)) {
973
+ let t = s.get(e);
974
+ n("local.computation.cycle", `Computation "${e}" is part of a dependency cycle: ${c}.`, t.range.start, t.range.end);
975
+ }
976
+ for (let e of p) l.add(e);
977
+ }
978
+ for (let e of f) if (!l.has(e) && !(s.get(e).kind !== "const" || d.has(e)) && (o.get(e) ?? []).some((e) => u.has(e) ? s.get(e).kind === "const" && d.has(e) : !1)) {
979
+ let t = s.get(e);
980
+ n("local.computation.const", `Constant "${e}" indirectly depends on a value that is not a constant.`, t.expressionOffset), d.add(e);
981
+ }
982
+ let m = {}, h = { ...t };
983
+ for (let e of f) {
984
+ if (l.has(e)) continue;
985
+ let t = s.get(e);
986
+ if ((o.get(e) ?? []).some((e) => l.has(e))) {
987
+ l.add(e);
988
+ continue;
989
+ }
990
+ let r = a.get(e);
991
+ try {
992
+ let t = i ? i.infer(r, h) : r.inferType(h);
993
+ m[e] = t, h[e] = t;
994
+ } catch (r) {
995
+ Et(n, r, t.expressionOffset), l.add(e);
996
+ }
997
+ }
998
+ let g = {}, _ = {}, v = /* @__PURE__ */ Error("failed constant read"), y = (e) => {
999
+ l.add(e), Object.defineProperty(_, e, {
1000
+ enumerable: !0,
1001
+ configurable: !0,
1002
+ get() {
1003
+ throw v;
1004
+ }
1005
+ });
1006
+ };
1007
+ for (let e of f) {
1008
+ if (l.has(e) || s.get(e).kind !== "const" || d.has(e)) continue;
1009
+ let t = s.get(e), r = a.get(e);
1010
+ try {
1011
+ let i = r.evaluate(_), a = se(i);
1012
+ if (a) {
1013
+ n("local.computation.budget", `Constant "${e}": ${a}`, t.expressionOffset), y(e);
1014
+ continue;
1015
+ }
1016
+ g[e] = Array.isArray(i) ? i.slice() : i, _[e] = g[e];
1017
+ } catch (r) {
1018
+ if (r === v) {
1019
+ y(e);
1020
+ continue;
1021
+ }
1022
+ let i = Dt(r);
1023
+ n("local.computation.expression", `Constant "${e}" cannot be evaluated: ${i.message}`, t.expressionOffset + (Number.isFinite(i.offset) ? i.offset : 0)), y(e);
1024
+ }
1025
+ }
1026
+ let b = {};
1027
+ for (let e of c) {
1028
+ let t = s.get(e);
1029
+ if (l.has(e) || m[e] === void 0) continue;
1030
+ let n = {
1031
+ name: e,
1032
+ kind: t.kind,
1033
+ source: t.source,
1034
+ dependencies: [...o.get(e) ?? []],
1035
+ type: m[e],
1036
+ nodeId: t.nodeId,
1037
+ range: { ...t.range }
1038
+ };
1039
+ t.kind === "const" && Object.hasOwn(g, e) && (n.value = g[e]), b[e] = n;
1040
+ }
1041
+ return {
1042
+ computations: b,
1043
+ kinds: m,
1044
+ order: f.filter((e) => !l.has(e)),
1045
+ expressions: a,
1046
+ constValues: g
1047
+ };
1048
+ }
1049
+ function jt(e, t, n, r, i, a = /* @__PURE__ */ new Map()) {
1050
+ let o = {}, s = /* @__PURE__ */ new Map(), c = {};
1051
+ for (let [e, t] of Object.entries(r)) c[e] = t;
1052
+ for (let [e, t] of a) Object.defineProperty(c, e, {
1053
+ enumerable: !0,
1054
+ configurable: !0,
1055
+ get() {
1056
+ throw t;
1057
+ }
1058
+ });
1059
+ for (let [e, t] of Object.entries(i)) o[e] = t, c[e] = t;
1060
+ for (let r of t) {
1061
+ let t = e[r];
1062
+ if (!t || t.kind === "const") continue;
1063
+ let i = n.get(r);
1064
+ if (i) try {
1065
+ let e = i.evaluate(c), t = se(e);
1066
+ if (t) throw new k("expression-budget", t, 0);
1067
+ o[r] = e, c[r] = e;
1068
+ } catch (e) {
1069
+ let t = Dt(e);
1070
+ s.set(r, t), Object.defineProperty(c, r, {
1071
+ enumerable: !0,
1072
+ configurable: !0,
1073
+ get() {
1074
+ throw t;
1075
+ }
1076
+ });
1077
+ }
1078
+ }
1079
+ return {
1080
+ values: o,
1081
+ errors: s
1082
+ };
1083
+ }
1084
+ // src/local/evaluation/validation.ts
1085
+ var Mt = "local.validation.failed", Nt = "local.validation.expression", Pt = "Validation failed.";
1086
+ function Ft(e) {
1087
+ return e.length > 2e3 ? `${y(e, d - 1)}…` : e;
1088
+ }
1089
+ function It(e) {
1090
+ let t = e.trim();
1091
+ return t ? t.split(/\s+/) : [];
1092
+ }
1093
+ function Lt(e) {
1094
+ let t = [0];
1095
+ for (let n = 0; n < e.length; n += 1) e[n] === "\n" && t.push(n + 1);
1096
+ return t;
1097
+ }
1098
+ function Rt(e) {
1099
+ if (!e || typeof e != "object") return !1;
1100
+ let t = e, n = t.range;
1101
+ return typeof t.expression == "string" && typeof t.message == "string" && Array.isArray(t.fields) && !!n && Number.isFinite(n.start) && Number.isFinite(n.end);
1102
+ }
1103
+ function zt(e, t, n, r, i) {
1104
+ let a = e.length, o = Math.max(0, Math.min(a, Math.trunc(n.start))), s = Math.max(o + 1, Math.min(a, Math.trunc(n.end))), c = 0, l = Math.max(0, t.length - 1);
1105
+ for (; c < l;) {
1106
+ let e = Math.ceil((c + l) / 2);
1107
+ t[e] <= o ? c = e : l = e - 1;
1108
+ }
1109
+ return {
1110
+ code: r,
1111
+ message: i,
1112
+ severity: "error",
1113
+ range: {
1114
+ start: o,
1115
+ end: s
1116
+ },
1117
+ line: c + 1,
1118
+ column: o - t[c] + 1
1119
+ };
1120
+ }
1121
+ export { be as $, Ge as A, we as B, Je as C, qe as D, Re as E, Pe as F, ke as G, Ee as H, Ne as I, N as J, Ae as K, Me as L, z as M, Ie as N, Ue as O, B as P, Ce as Q, R, Ye as S, ze as T, De as U, Te as V, Oe as W, F as X, P as Y, I as Z, bt as _, Rt as a, K as b, zt as c, At as d, ye as et, wt as f, it as g, xt as h, Ft as i, Ke as j, He as k, jt as l, Tt as m, Mt as n, he as nt, Lt as o, St as p, M as q, Pt as r, pe as rt, It as s, Nt as t, A as tt, kt as u, yt as v, Le as w, rt as x, vt as y, je as z };