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,103 +1,21 @@
1
- import { F as e, M as t, P as n, a as r, i, j as a, k as o, q as s } from "./identity-MYJXKSkB.js";
2
- import { $ as c, S as l, _ as u, a as d, c as f, d as ee, g as p, h as te, i as m, m as ne, n as h, nt as g, o as re, p as ie, r as _, s as ae, t as oe, v as se, y as ce } from "./config-validation-DXTynAw7.js";
3
- import { t as le } from "./default-components-Z_YMio5P.js";
1
+ import { A as e, F as t, I as n, J as r, M as i, N as a, n as o, r as s } from "./preset-core-CKc5YXSM.js";
2
+ import { C as c, S as l, _ as u, a as d, c as f, d as p, g as m, h as ee, i as h, m as te, n as g, o as ne, p as re, r as _, s as ie, t as ae, v as oe } from "./config-validation-F47AcE6o.js";
4
3
  import v from "./reactive-md-default-preset.js";
5
- // src/local/theme/theme.ts
6
- var y = "reactive-md-theme-1", b = Object.freeze({
7
- name: "default",
8
- protocol: y,
9
- colorSchemes: Object.freeze(["light", "dark"])
10
- });
11
- function ue(e, t) {
12
- let n = typeof t == "string" ? t.length : Infinity;
13
- if (!e || typeof e.start != "number" || typeof e.end != "number" || !Number.isFinite(e.start) || !Number.isFinite(e.end)) return {
14
- start: 0,
15
- end: 0
16
- };
17
- let r = Math.max(0, Math.min(n, Math.floor(e.start)));
18
- return {
19
- start: r,
20
- end: Math.max(r, Math.min(n, Math.floor(e.end)))
21
- };
22
- }
23
- function de(e, t) {
24
- if (typeof e != "string" || e.length === 0) return {
25
- line: 1,
26
- column: 1
27
- };
28
- let n = Math.min(t, e.length), r = 1, i = 0;
29
- for (let t = 0; t < n; t += 1) e[t] === "\n" && (r += 1, i = t + 1);
30
- return {
31
- line: r,
32
- column: t - i + 1
33
- };
34
- }
35
- function fe(e, t, n, r) {
36
- let i = ue(n, r), { line: a, column: o } = de(r, i.start);
37
- return {
38
- code: e,
39
- message: c(t),
40
- severity: "warning",
41
- range: i,
42
- line: a,
43
- column: o,
44
- messageKey: t.key,
45
- ...t.params ? { params: t.params } : {}
46
- };
47
- }
48
- function pe(e, t, n, r) {
49
- let i = (e, t) => ({
50
- name: b.name,
51
- diagnostics: [fe(e, t, n, r)]
52
- }), a = e;
53
- if (a == null || a === "") return {
54
- name: b.name,
55
- diagnostics: []
56
- };
57
- if (!l(a)) return i("local.theme.name", g("local.theme.name", {
58
- name: String(a),
59
- limit: 64
60
- }));
61
- let o = a;
62
- if (o === b.name) return {
63
- name: b.name,
64
- diagnostics: []
65
- };
66
- if (!Array.isArray(t)) return i("local.theme.missing", g("local.theme.missing", { name: o }));
67
- let s = 0, c = null;
68
- try {
69
- for (let e of t) typeof e == "object" && e && !Array.isArray(e) && e.name === o && (s += 1, c = e);
70
- } catch {
71
- return i("local.theme.manifest", g("local.theme.manifest.unreadable"));
72
- }
73
- if (s === 0) return i("local.theme.missing", g("local.theme.missing", { name: o }));
74
- if (s > 1) return i("local.theme.duplicate", g("local.theme.duplicate", { name: o }));
75
- try {
76
- let e = c;
77
- if (!e || typeof e != "object") return i("local.theme.manifest", g("local.theme.manifest.definition", { name: o }));
78
- if (e.protocol !== "reactive-md-theme-1") return i("local.theme.protocol", g("local.theme.protocol", {
79
- name: o,
80
- protocol: y
81
- }));
82
- let t = e.colorSchemes;
83
- if (!Array.isArray(t) || !t.includes("light") || !t.includes("dark")) return i("local.theme.modes", g("local.theme.modes", { name: o }));
84
- } catch {
85
- return i("local.theme.manifest", g("local.theme.manifest.selected", { name: o }));
86
- }
87
- return {
88
- name: o,
89
- diagnostics: []
90
- };
91
- }
92
- // src/sdk/theme.ts
93
- var me = 128, he = 32, ge = 128, _e = 262144, x = 524288, ve = /^[a-z][a-z0-9]*(?:[-./][a-z0-9]+)*$/, ye = /^[a-z][a-z0-9._/-]*$/, be = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/, xe = /^\[\s*data-rmd-theme\s*=\s*(?:"[^"]*"|'[^']*'|[^\]]*?)\s*\]/, Se = /^(?::root|html|body)(?![A-Za-z0-9_-])/i, Ce = /* @__PURE__ */ new Set([
4
+ // src/themes/contract.ts
5
+ var se = "reactive-md-styles-1", ce = Object.freeze([
6
+ "rmd.reset",
7
+ "rmd.defaults",
8
+ "rmd.components",
9
+ "rmd.themes",
10
+ "rmd.overrides"
11
+ ]), y = "rmd.themes", b = `@layer ${ce.join(", ")};`, le = 128, ue = 32, de = 128, x = 262144, S = 524288, fe = /^[a-z][a-z0-9]*(?:[-./][a-z0-9]+)*$/, pe = /^[a-z][a-z0-9._/-]*$/, me = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/, he = /^\[\s*data-rmd-theme\s*=\s*(?:"[^"]*"|'[^']*'|[^\]]*?)\s*\]/, ge = /^(?::root|html|body)(?![A-Za-z0-9_-])/i, _e = /* @__PURE__ */ new Set([
94
12
  "media",
95
13
  "supports",
96
14
  "layer",
97
15
  "container",
98
16
  "scope",
99
17
  "starting-style"
100
- ]), we = 256, Te = /* @__PURE__ */ new Set([
18
+ ]), ve = 256, ye = /* @__PURE__ */ new Set([
101
19
  "serif",
102
20
  "sans-serif",
103
21
  "monospace",
@@ -113,20 +31,20 @@ var me = 128, he = 32, ge = 128, _e = 262144, x = 524288, ve = /^[a-z][a-z0-9]*(
113
31
  "fangsong",
114
32
  "-apple-system",
115
33
  "blinkmacsystemfont"
116
- ]), S = /* @__PURE__ */ new Set([
34
+ ]), C = /* @__PURE__ */ new Set([
117
35
  "inherit",
118
36
  "initial",
119
37
  "unset",
120
38
  "revert",
121
39
  "revert-layer"
122
- ]), Ee = /* @__PURE__ */ new Set([
40
+ ]), be = /* @__PURE__ */ new Set([
123
41
  "caption",
124
42
  "icon",
125
43
  "menu",
126
44
  "message-box",
127
45
  "small-caption",
128
46
  "status-bar"
129
- ]), De = /* @__PURE__ */ new Set([
47
+ ]), xe = /* @__PURE__ */ new Set([
130
48
  "xx-small",
131
49
  "x-small",
132
50
  "small",
@@ -137,45 +55,45 @@ var me = 128, he = 32, ge = 128, _e = 262144, x = 524288, ve = /^[a-z][a-z0-9]*(
137
55
  "xxx-large",
138
56
  "smaller",
139
57
  "larger"
140
- ]), Oe = /^rmd-theme-([a-z][a-z0-9-]*)-font-([0-9a-f]+)$/;
141
- function C(e, t) {
58
+ ]), Se = /^rmd-theme-([a-z][a-z0-9-]*)-font-([0-9a-f]+)$/;
59
+ function w(e, t) {
142
60
  return /* @__PURE__ */ Error(`Invalid local theme ${e}: ${t}`);
143
61
  }
144
- function ke(e) {
62
+ function Ce(e) {
145
63
  return typeof e == "object" && !!e && !Array.isArray(e);
146
64
  }
147
- function w(e, t) {
148
- if (!ke(e)) throw C(t, "must be an object.");
149
- return e;
150
- }
151
65
  function T(e, t) {
152
- if (typeof e != "string" || e.length === 0) throw C(t, "must be a non-empty string.");
153
- if (e.length > me) throw C(t, `must not exceed ${me} characters.`);
154
- if (!ve.test(e)) throw C(t, `"${e}" must be lowercase, start with a letter and use "-", "." or "/" only as separators.`);
66
+ if (!Ce(e)) throw w(t, "must be an object.");
155
67
  return e;
156
68
  }
157
69
  function E(e, t) {
158
- if (!l(e)) throw C(t, "must be a lowercase kebab-case name that starts with a letter.");
159
- if (e === "default") throw C(t, "must not replace the reserved built-in \"default\" theme.");
70
+ if (typeof e != "string" || e.length === 0) throw w(t, "must be a non-empty string.");
71
+ if (e.length > le) throw w(t, `must not exceed ${le} characters.`);
72
+ if (!fe.test(e)) throw w(t, `"${e}" must be lowercase, start with a letter and use "-", "." or "/" only as separators.`);
160
73
  return e;
161
74
  }
162
75
  function D(e, t) {
163
- if (typeof e != "string" || !be.test(e)) throw C(t, "must be a semantic version such as \"1.0.0\".");
76
+ if (!c(e)) throw w(t, "must be a lowercase kebab-case name that starts with a letter.");
77
+ if (e === "default") throw w(t, "must not replace the reserved built-in \"default\" theme.");
164
78
  return e;
165
79
  }
166
- function Ae(e, t) {
80
+ function O(e, t) {
81
+ if (typeof e != "string" || !me.test(e)) throw w(t, "must be a semantic version such as \"1.0.0\".");
82
+ return e;
83
+ }
84
+ function we(e, t) {
167
85
  if (e === void 0) return Object.freeze(["light", "dark"]);
168
- if (!Array.isArray(e)) throw C(t, "must be an array of \"light\" and \"dark\".");
86
+ if (!Array.isArray(e)) throw w(t, "must be an array of \"light\" and \"dark\".");
169
87
  let n = [];
170
88
  for (let r of e) {
171
- if (r !== "light" && r !== "dark") throw C(t, "may only contain \"light\" and \"dark\".");
172
- if (n.includes(r)) throw C(t, `must not repeat "${r}".`);
89
+ if (r !== "light" && r !== "dark") throw w(t, "may only contain \"light\" and \"dark\".");
90
+ if (n.includes(r)) throw w(t, `must not repeat "${r}".`);
173
91
  n.push(r);
174
92
  }
175
- if (!n.includes("light") || !n.includes("dark")) throw C(t, "must declare both \"light\" and \"dark\".");
93
+ if (!n.includes("light") || !n.includes("dark")) throw w(t, "must declare both \"light\" and \"dark\".");
176
94
  return Object.freeze(n);
177
95
  }
178
- function O(e, t) {
96
+ function k(e, t) {
179
97
  let n = e[t], r = t + 1;
180
98
  for (; r < e.length;) if (e[r] === "\\") r += 2;
181
99
  else {
@@ -184,11 +102,11 @@ function O(e, t) {
184
102
  }
185
103
  return e.length;
186
104
  }
187
- function k(e, t, n, r) {
105
+ function A(e, t, n, r) {
188
106
  let i = 0;
189
107
  for (let a = t; a < e.length; a += 1) {
190
108
  let t = e[a];
191
- if (t === "\"" || t === "'") a = O(e, a) - 1;
109
+ if (t === "\"" || t === "'") a = k(e, a) - 1;
192
110
  else if (t === "/" && e[a + 1] === "*") {
193
111
  let t = e.indexOf("*/", a + 2);
194
112
  a = (t < 0 ? e.length : t + 2) - 1;
@@ -197,50 +115,50 @@ function k(e, t, n, r) {
197
115
  }
198
116
  return e.length;
199
117
  }
200
- function je(e, t, n) {
118
+ function Te(e, t, n) {
201
119
  let r = t + 3;
202
120
  for (; r < e.length && /\s/.test(e[r]);) r += 1;
203
- if (e[r] !== "(") throw C(n, "has a malformed url() value.");
121
+ if (e[r] !== "(") throw w(n, "has a malformed url() value.");
204
122
  for (r += 1; r < e.length && /\s/.test(e[r]);) r += 1;
205
123
  let i = e[r];
206
124
  if (i === "\"" || i === "'") {
207
125
  let t = e.indexOf(i, r + 1);
208
- if (t < 0) throw C(n, "has an unterminated url() string.");
126
+ if (t < 0) throw w(n, "has an unterminated url() string.");
209
127
  let a = e.slice(r + 1, t);
210
128
  for (r = t + 1; r < e.length && /\s/.test(e[r]);) r += 1;
211
- if (e[r] !== ")") throw C(n, "has a malformed url() value.");
129
+ if (e[r] !== ")") throw w(n, "has a malformed url() value.");
212
130
  return {
213
131
  value: a.trim(),
214
132
  end: r + 1
215
133
  };
216
134
  }
217
135
  let a = e.indexOf(")", r);
218
- if (a < 0) throw C(n, "has an unterminated url() value.");
136
+ if (a < 0) throw w(n, "has an unterminated url() value.");
219
137
  return {
220
138
  value: e.slice(r, a).trim(),
221
139
  end: a + 1
222
140
  };
223
141
  }
224
- function Me(e, t, n, r) {
142
+ function Ee(e, t, n, r) {
225
143
  let i = t;
226
144
  for (; i < e.length && e[i] !== "(";) i += 1;
227
- if (i >= e.length) throw C(r, `has a malformed ${n}() value.`);
228
- let a = k(e, i, "(", ")");
229
- if (a <= i + 1 || e[a - 1] !== ")") throw C(r, `has an unterminated ${n}() value.`);
145
+ if (i >= e.length) throw w(r, `has a malformed ${n}() value.`);
146
+ let a = A(e, i, "(", ")");
147
+ if (a <= i + 1 || e[a - 1] !== ")") throw w(r, `has an unterminated ${n}() value.`);
230
148
  return {
231
149
  body: e.slice(i + 1, a - 1),
232
150
  end: a
233
151
  };
234
152
  }
235
- function Ne(e, t) {
153
+ function De(e, t) {
236
154
  let n = 0;
237
155
  for (; n < e.length;) {
238
156
  let r = e[n];
239
157
  if (r === "\"" || r === "'") {
240
- let i = O(e, n);
241
- if (i > e.length || e[i - 1] !== r) throw C(t, "has an unterminated image-set() string.");
158
+ let i = k(e, n);
159
+ if (i > e.length || e[i - 1] !== r) throw w(t, "has an unterminated image-set() string.");
242
160
  let a = e.slice(n + 1, i - 1).trim();
243
- if (!/^data:/i.test(a)) throw C(t, "image-set() entries must be inline data: URLs; network and file URLs are not allowed.");
161
+ if (!/^data:/i.test(a)) throw w(t, "image-set() entries must be inline data: URLs; network and file URLs are not allowed.");
244
162
  n = i;
245
163
  } else if (r === "/" && e[n + 1] === "*") {
246
164
  let t = e.indexOf("*/", n + 2);
@@ -248,45 +166,45 @@ function Ne(e, t) {
248
166
  } else n += 1;
249
167
  }
250
168
  }
251
- function Pe(e, t, n = !1) {
252
- if (e.toLowerCase().includes("</style")) throw C(t, "must not contain a closing style tag.");
169
+ function Oe(e, t, n = !1) {
170
+ if (e.toLowerCase().includes("</style")) throw w(t, "must not contain a closing style tag.");
253
171
  let r = 0;
254
172
  for (; r < e.length;) {
255
173
  let i = e[r];
256
- if (i === "\"" || i === "'") r = O(e, r);
174
+ if (i === "\"" || i === "'") r = k(e, r);
257
175
  else if (i === "/" && e[r + 1] === "*") {
258
176
  let t = e.indexOf("*/", r + 2);
259
177
  r = t < 0 ? e.length : t + 2;
260
178
  } else {
261
- if (i === "\\") throw C(t, "must not use CSS escapes outside strings; escaped tokens can disguise url() or @import.");
262
- if (i === "@" && /^@import\b/i.test(e.slice(r, r + 8))) throw C(t, "must not use @import; inline every resource.");
179
+ if (i === "\\") throw w(t, "must not use CSS escapes outside strings; escaped tokens can disguise url() or @import.");
180
+ if (i === "@" && /^@import\b/i.test(e.slice(r, r + 8))) throw w(t, "must not use @import; inline every resource.");
263
181
  if ((i === "i" || i === "I" || i === "-") && /^(?:-webkit-)?image-set\s*\(/i.test(e.slice(r, r + 24))) {
264
- let { body: n } = Me(e, r, "image-set", t);
265
- Ne(n, t), r += 1;
182
+ let { body: n } = Ee(e, r, "image-set", t);
183
+ De(n, t), r += 1;
266
184
  } else if ((i === "u" || i === "U") && /^url\s*\(/i.test(e.slice(r, r + 12))) {
267
- let i = je(e, r, t);
268
- if (!/^data:/i.test(i.value) && !(n && i.value.startsWith("#"))) throw C(t, "may only reference data: URLs; network and file URLs are not allowed.");
185
+ let i = Te(e, r, t);
186
+ if (!/^data:/i.test(i.value) && !(n && i.value.startsWith("#"))) throw w(t, "may only reference data: URLs; network and file URLs are not allowed.");
269
187
  r = i.end;
270
188
  } else {
271
- if ((i === "e" || i === "E") && /^expression\s*\(/i.test(e.slice(r, r + 16))) throw C(t, "must not use CSS expression().");
189
+ if ((i === "e" || i === "E") && /^expression\s*\(/i.test(e.slice(r, r + 16))) throw w(t, "must not use CSS expression().");
272
190
  r += 1;
273
191
  }
274
192
  }
275
193
  }
276
194
  }
277
- function Fe(e) {
195
+ function ke(e) {
278
196
  if (typeof e != "string" || e.length > 4194304) return !1;
279
197
  try {
280
- return Pe(e, "css", !0), !0;
198
+ return Oe(e, "css", !0), !0;
281
199
  } catch {
282
200
  return !1;
283
201
  }
284
202
  }
285
- function Ie(e) {
203
+ function Ae(e) {
286
204
  let t = [], n = 0, r = 0, i = 0;
287
205
  for (let a = 0; a < e.length; a += 1) {
288
206
  let o = e[a];
289
- if (o === "\"" || o === "'") a = O(e, a) - 1;
207
+ if (o === "\"" || o === "'") a = k(e, a) - 1;
290
208
  else if (o === "/" && e[a + 1] === "*") {
291
209
  let t = e.indexOf("*/", a + 2);
292
210
  a = (t < 0 ? e.length : t + 2) - 1;
@@ -294,11 +212,11 @@ function Ie(e) {
294
212
  }
295
213
  return t.push(e.slice(n)), t;
296
214
  }
297
- function Le(e, t) {
298
- let n = e.trim(), r = `[data-rmd-theme="${t}"]`, i = xe.exec(n);
215
+ function je(e, t) {
216
+ let n = e.trim(), r = `[data-rmd-theme="${t}"]`, i = he.exec(n);
299
217
  return i ? `${r}${n.slice(i[0].length)}` : `${r} ${n}`;
300
218
  }
301
- function A(e, t) {
219
+ function j(e, t) {
302
220
  let n = t;
303
221
  for (; n < e.length;) if (/\s/.test(e[n])) n += 1;
304
222
  else if (e[n] === "/" && e[n + 1] === "*") {
@@ -307,45 +225,45 @@ function A(e, t) {
307
225
  } else break;
308
226
  return n;
309
227
  }
310
- function Re(e, t) {
228
+ function Me(e, t) {
311
229
  let n = e.toLowerCase(), r = /:has\s*\(/g;
312
230
  for (let i = r.exec(n); i; i = r.exec(n)) {
313
231
  if (r.lastIndex = i.index + 1, i.index >= t) continue;
314
- let n = i.index + i[0].length - 1, a = k(e, n, "(", ")"), o = e.slice(n + 1, Math.max(n + 1, a - 1));
315
- for (let t of Ie(o)) if (/^\s*[+~]/.test(t)) throw C("theme.css", `selector "${e.trim()}" uses :has() with a sibling combinator that can escape the theme root.`);
232
+ let n = i.index + i[0].length - 1, a = A(e, n, "(", ")"), o = e.slice(n + 1, Math.max(n + 1, a - 1));
233
+ for (let t of Ae(o)) if (/^\s*[+~]/.test(t)) throw w("theme.css", `selector "${e.trim()}" uses :has() with a sibling combinator that can escape the theme root.`);
316
234
  }
317
235
  }
318
- function ze(e) {
236
+ function Ne(e) {
319
237
  let t = e.trim();
320
238
  if (t === "") return;
321
- if (t[0] === "+" || t[0] === "~") throw C("theme.css", `selector "${t}" begins with a sibling combinator and cannot be scoped.`);
322
- let n = xe.exec(t);
239
+ if (t[0] === "+" || t[0] === "~") throw w("theme.css", `selector "${t}" begins with a sibling combinator and cannot be scoped.`);
240
+ let n = he.exec(t);
323
241
  if (n) {
324
242
  let e = n[0].length;
325
243
  for (; e < t.length;) {
326
244
  let n = t[e];
327
245
  if (/\s/.test(n) || n === "+" || n === "~" || n === ">" || n === ",") break;
328
- n === "[" ? e = k(t, e, "[", "]") : n === "(" ? e = k(t, e, "(", ")") : e += 1;
246
+ n === "[" ? e = A(t, e, "[", "]") : n === "(" ? e = A(t, e, "(", ")") : e += 1;
329
247
  }
330
- let r = A(t, e);
331
- if (t[r] === "+" || t[r] === "~") throw C("theme.css", `selector "${t}" uses a sibling combinator that can escape the theme root.`);
332
- Re(t, e);
248
+ let r = j(t, e);
249
+ if (t[r] === "+" || t[r] === "~") throw w("theme.css", `selector "${t}" uses a sibling combinator that can escape the theme root.`);
250
+ Me(t, e);
333
251
  }
334
252
  }
335
- function Be(e, t) {
336
- let n = Ie(e).map((e) => e.trim()).filter(Boolean);
253
+ function Pe(e, t) {
254
+ let n = Ae(e).map((e) => e.trim()).filter(Boolean);
337
255
  if (n.length === 0) return e.trim();
338
256
  for (let e of n) {
339
- if (Se.test(e)) throw C("theme.css", `selector "${e}" targets the host document; scope it under the theme root instead.`);
340
- ze(e);
257
+ if (ge.test(e)) throw w("theme.css", `selector "${e}" targets the host document; scope it under the theme root instead.`);
258
+ Ne(e);
341
259
  }
342
- return n.map((e) => Le(e, t)).join(", ");
260
+ return n.map((e) => je(e, t)).join(", ");
343
261
  }
344
- function j(e, t) {
262
+ function M(e, t) {
345
263
  let n = 1;
346
264
  for (let r = t; r < e.length; r += 1) {
347
265
  let t = e[r];
348
- if (t === "\"" || t === "'") r = O(e, r) - 1;
266
+ if (t === "\"" || t === "'") r = k(e, r) - 1;
349
267
  else if (t === "/" && e[r + 1] === "*") {
350
268
  let t = e.indexOf("*/", r + 2);
351
269
  r = (t < 0 ? e.length : t + 2) - 1;
@@ -354,10 +272,10 @@ function j(e, t) {
354
272
  }
355
273
  return e.length;
356
274
  }
357
- function M(e) {
275
+ function N(e) {
358
276
  return e.trim().replace(/\s+/g, " ").toLowerCase();
359
277
  }
360
- function Ve(e) {
278
+ function Fe(e) {
361
279
  let t = [];
362
280
  for (let n of e) {
363
281
  let e = n.codePointAt(0);
@@ -365,7 +283,7 @@ function Ve(e) {
365
283
  }
366
284
  return t;
367
285
  }
368
- function He(e) {
286
+ function Ie(e) {
369
287
  let t = "", n = 0;
370
288
  for (; n < e.length;) {
371
289
  let r = e[n], i, a;
@@ -385,41 +303,41 @@ function He(e) {
385
303
  }
386
304
  return t;
387
305
  }
388
- function Ue(e, t) {
389
- return `rmd-theme-${e}-font-${Ve(t).map((e) => e.toString(16).padStart(2, "0")).join("")}`;
306
+ function Le(e, t) {
307
+ return `rmd-theme-${e}-font-${Fe(t).map((e) => e.toString(16).padStart(2, "0")).join("")}`;
390
308
  }
391
- function We(e) {
392
- let t = Oe.exec(e);
309
+ function P(e) {
310
+ let t = Se.exec(e);
393
311
  if (!t || t[2].length % 2 != 0) return null;
394
312
  let n = [];
395
313
  for (let e = 0; e < t[2].length; e += 2) n.push(Number.parseInt(t[2].slice(e, e + 2), 16));
396
- let r = He(n);
397
- return r === null || r.length === 0 || M(r) !== r ? null : {
314
+ let r = Ie(n);
315
+ return r === null || r.length === 0 || N(r) !== r ? null : {
398
316
  themeName: t[1],
399
317
  original: r
400
318
  };
401
319
  }
402
- function N(e) {
320
+ function F(e) {
403
321
  return e === void 0 ? !1 : /[A-Za-z0-9_-]/.test(e) || e.codePointAt(0) >= 128;
404
322
  }
405
- function Ge(e, t) {
323
+ function Re(e, t) {
406
324
  let n = e[t];
407
325
  if (n === void 0) return !1;
408
326
  if (/[A-Za-z_]/.test(n) || n.codePointAt(0) >= 128) return !0;
409
327
  if (n === "-") {
410
328
  let n = e[t + 1];
411
- return n !== void 0 && (N(n) || n === "-");
329
+ return n !== void 0 && (F(n) || n === "-");
412
330
  }
413
331
  return !1;
414
332
  }
415
- function Ke(e, t) {
333
+ function ze(e, t) {
416
334
  let n = e[t];
417
335
  if (n === void 0) return !1;
418
336
  if (n >= "0" && n <= "9") return !0;
419
337
  let r = e[t + 1];
420
338
  return n === "+" || n === "-" ? r !== void 0 && (r >= "0" && r <= "9" || r === ".") : n === "." && r !== void 0 && r >= "0" && r <= "9";
421
339
  }
422
- function P(e) {
340
+ function I(e) {
423
341
  let t = [], n = 0;
424
342
  for (; n < e.length;) {
425
343
  let r = e[n];
@@ -434,7 +352,7 @@ function P(e) {
434
352
  }
435
353
  let i = n;
436
354
  if (r === "\"" || r === "'") {
437
- let r = O(e, n);
355
+ let r = k(e, n);
438
356
  t.push({
439
357
  type: "string",
440
358
  text: e.slice(i, r),
@@ -451,7 +369,7 @@ function P(e) {
451
369
  name: "",
452
370
  stringValue: ""
453
371
  }), n += 1;
454
- else if (Ke(e, n)) {
372
+ else if (ze(e, n)) {
455
373
  let r = n;
456
374
  for ((e[r] === "+" || e[r] === "-") && (r += 1); e[r] >= "0" && e[r] <= "9";) r += 1;
457
375
  if (e[r] === ".") for (r += 1; e[r] >= "0" && e[r] <= "9";) r += 1;
@@ -464,8 +382,8 @@ function P(e) {
464
382
  }
465
383
  let a = "number";
466
384
  if (e[r] === "%") r += 1, a = "percentage";
467
- else if (Ge(e, r)) {
468
- for (r += 1; N(e[r]);) r += 1;
385
+ else if (Re(e, r)) {
386
+ for (r += 1; F(e[r]);) r += 1;
469
387
  a = "dimension";
470
388
  }
471
389
  t.push({
@@ -476,12 +394,12 @@ function P(e) {
476
394
  name: "",
477
395
  stringValue: ""
478
396
  }), n = r;
479
- } else if (Ge(e, n)) {
397
+ } else if (Re(e, n)) {
480
398
  let r = n + 1;
481
- for (; N(e[r]);) r += 1;
399
+ for (; F(e[r]);) r += 1;
482
400
  let a = e.slice(n, r).toLowerCase();
483
401
  if (e[r] === "(") {
484
- let o = k(e, r, "(", ")"), s = Math.min(o, e.length);
402
+ let o = A(e, r, "(", ")"), s = Math.min(o, e.length);
485
403
  t.push({
486
404
  type: "function",
487
405
  text: e.slice(n, s),
@@ -501,7 +419,7 @@ function P(e) {
501
419
  stringValue: ""
502
420
  }), n = r;
503
421
  } else if (r === "(") {
504
- let r = k(e, n, "(", ")"), a = Math.min(r, e.length);
422
+ let r = A(e, n, "(", ")"), a = Math.min(r, e.length);
505
423
  t.push({
506
424
  type: "function",
507
425
  text: e.slice(n, a),
@@ -521,14 +439,14 @@ function P(e) {
521
439
  }
522
440
  return t;
523
441
  }
524
- function F(e) {
525
- return A(e, 0) === e.length;
442
+ function Be(e) {
443
+ return j(e, 0) === e.length;
526
444
  }
527
- function I(e) {
528
- let t = P(e);
445
+ function L(e) {
446
+ let t = I(e);
529
447
  if (t.length === 0) return null;
530
448
  if (t.length === 1 && t[0].type === "string") {
531
- let e = M(t[0].stringValue);
449
+ let e = N(t[0].stringValue);
532
450
  return e === "" ? null : {
533
451
  key: e,
534
452
  start: t[0].start,
@@ -536,24 +454,24 @@ function I(e) {
536
454
  };
537
455
  }
538
456
  if (t[0].type === "string") return null;
539
- for (let n = 0; n < t.length; n += 1) if (t[n].type !== "ident" || n > 0 && !F(e.slice(t[n - 1].end, t[n].start))) return null;
540
- if (t.length === 1 && (S.has(t[0].name) || Te.has(t[0].name))) return null;
541
- let n = M(t.map((e) => e.text).join(" "));
457
+ for (let n = 0; n < t.length; n += 1) if (t[n].type !== "ident" || n > 0 && !Be(e.slice(t[n - 1].end, t[n].start))) return null;
458
+ if (t.length === 1 && (C.has(t[0].name) || ye.has(t[0].name))) return null;
459
+ let n = N(t.map((e) => e.text).join(" "));
542
460
  return n === "" ? null : {
543
461
  key: n,
544
462
  start: t[0].start,
545
463
  end: t[t.length - 1].end
546
464
  };
547
465
  }
548
- function L(e) {
466
+ function R(e) {
549
467
  let t = [], n = 0, r = 0;
550
468
  for (; r < e.length;) {
551
469
  let i = e[r];
552
- if (i === "\"" || i === "'") r = O(e, r);
470
+ if (i === "\"" || i === "'") r = k(e, r);
553
471
  else if (i === "/" && e[r + 1] === "*") {
554
472
  let t = e.indexOf("*/", r + 2);
555
473
  r = t < 0 ? e.length : t + 2;
556
- } else i === "(" || i === "[" ? r = k(e, r, i, i === "(" ? ")" : "]") : (i === "," && (t.push({
474
+ } else i === "(" || i === "[" ? r = A(e, r, i, i === "(" ? ")" : "]") : (i === "," && (t.push({
557
475
  start: n,
558
476
  end: r
559
477
  }), n = r + 1), r += 1);
@@ -563,14 +481,14 @@ function L(e) {
563
481
  end: e.length
564
482
  }), t;
565
483
  }
566
- function R(e) {
567
- let t = P(e);
484
+ function z(e) {
485
+ let t = I(e);
568
486
  if (t.length < 2) return {
569
487
  body: e,
570
488
  important: ""
571
489
  };
572
490
  let n = t[t.length - 1], r = t[t.length - 2];
573
- return n.type !== "ident" || n.name !== "important" || r.type !== "delimiter" || r.text !== "!" || !F(e.slice(r.end, n.start)) ? {
491
+ return n.type !== "ident" || n.name !== "important" || r.type !== "delimiter" || r.text !== "!" || !Be(e.slice(r.end, n.start)) ? {
574
492
  body: e,
575
493
  important: ""
576
494
  } : {
@@ -578,55 +496,55 @@ function R(e) {
578
496
  important: e.slice(r.start)
579
497
  };
580
498
  }
581
- function z(e, t) {
499
+ function B(e, t) {
582
500
  if (t.length === 0) return e;
583
501
  let n = [...t].sort((e, t) => e.start - t.start), r = "", i = 0;
584
502
  for (let t of n) t.start < i || (r += e.slice(i, t.start) + t.text, i = t.end);
585
503
  return r + e.slice(i);
586
504
  }
587
- function qe(e) {
505
+ function Ve(e) {
588
506
  return `"${e}"`;
589
507
  }
590
- function B(e, t, n = 0) {
508
+ function V(e, t, n = 0) {
591
509
  if (t.size === 0) return e;
592
- if (n > 64) throw C("theme.css", "font-family fallback nesting exceeds 64 levels.");
593
- let { body: r, important: i } = R(e), a = [];
594
- for (let e of L(r)) {
595
- let i = r.slice(e.start, e.end), o = I(i);
510
+ if (n > 64) throw w("theme.css", "font-family fallback nesting exceeds 64 levels.");
511
+ let { body: r, important: i } = z(e), a = [];
512
+ for (let e of R(r)) {
513
+ let i = r.slice(e.start, e.end), o = L(i);
596
514
  if (o) {
597
515
  let n = t.get(o.key);
598
516
  n && a.push({
599
517
  start: e.start + o.start,
600
518
  end: e.start + o.end,
601
- text: qe(n)
519
+ text: Ve(n)
602
520
  });
603
521
  continue;
604
522
  }
605
- let s = P(i);
606
- if (s.length !== 0 && (s.length !== 1 || s[0].type !== "ident" || !Te.has(s[0].name) && !S.has(s[0].name))) {
523
+ let s = I(i);
524
+ if (s.length !== 0 && (s.length !== 1 || s[0].type !== "ident" || !ye.has(s[0].name) && !C.has(s[0].name))) {
607
525
  if (s.length === 1 && s[0].type === "function" && s[0].name === "var") {
608
- let r = s[0], i = r.text.indexOf("("), o = r.text.slice(i + 1, -1), c = L(o), l = P(o.slice(0, c[0].end));
609
- if (!r.text.endsWith(")") || l.length !== 1 || l[0].type !== "ident" || !l[0].text.startsWith("--")) throw C("theme.css", "font-family var() must start with a custom property name.");
526
+ let r = s[0], i = r.text.indexOf("("), o = r.text.slice(i + 1, -1), c = R(o), l = I(o.slice(0, c[0].end));
527
+ if (!r.text.endsWith(")") || l.length !== 1 || l[0].type !== "ident" || !l[0].text.startsWith("--")) throw w("theme.css", "font-family var() must start with a custom property name.");
610
528
  if (c.length > 1) {
611
529
  let s = c[0].end + 1, l = o.slice(s);
612
530
  a.push({
613
531
  start: e.start + r.start + i + 1 + s,
614
532
  end: e.start + r.end - 1,
615
- text: B(l, t, n + 1)
533
+ text: V(l, t, n + 1)
616
534
  });
617
535
  }
618
- } else throw C("theme.css", "unsupported font-family syntax; use literal families or var() with a family-list fallback.");
536
+ } else throw w("theme.css", "unsupported font-family syntax; use literal families or var() with a family-list fallback.");
619
537
  }
620
538
  }
621
- return z(r, a) + i;
539
+ return B(r, a) + i;
622
540
  }
623
- function Je(e) {
624
- let t = P(e);
625
- if (t.length === 0 || t.length === 1 && t[0].type === "ident" && (Ee.has(t[0].name) || S.has(t[0].name))) return null;
541
+ function He(e) {
542
+ let t = I(e);
543
+ if (t.length === 0 || t.length === 1 && t[0].type === "ident" && (be.has(t[0].name) || C.has(t[0].name))) return null;
626
544
  let n = -1;
627
545
  for (let e = 0; e < t.length; e += 1) {
628
546
  let r = t[e];
629
- if (r.type === "dimension" && !/(?:deg|grad|rad|turn)$/i.test(r.text) || r.type === "percentage" || r.type === "ident" && De.has(r.name) || r.type === "number" && Number(r.text) === 0) {
547
+ if (r.type === "dimension" && !/(?:deg|grad|rad|turn)$/i.test(r.text) || r.type === "percentage" || r.type === "ident" && xe.has(r.name) || r.type === "number" && Number(r.text) === 0) {
630
548
  n = e;
631
549
  break;
632
550
  }
@@ -647,29 +565,29 @@ function Je(e) {
647
565
  let r = n + 1, i = t[r];
648
566
  return i?.type === "delimiter" && i.text === "/" && (r += 2), r >= t.length ? null : t[r].start;
649
567
  }
650
- function Ye(e, t) {
568
+ function Ue(e, t) {
651
569
  if (t.size === 0) return e;
652
- let { body: n, important: r } = R(e), i = Je(n);
570
+ let { body: n, important: r } = z(e), i = He(n);
653
571
  if (i === null) {
654
- let t = P(n);
655
- if (t.length === 1 && t[0].type === "ident" && (Ee.has(t[0].name) || S.has(t[0].name)) || t.length === 1 && t[0].type === "function" && t[0].name === "var" && L(t[0].text.slice(t[0].text.indexOf("(") + 1, -1)).length === 1) return e;
656
- throw C("theme.css", "unsupported font shorthand; use an explicit font size (including calc/min/max/clamp) and a family list.");
572
+ let t = I(n);
573
+ if (t.length === 1 && t[0].type === "ident" && (be.has(t[0].name) || C.has(t[0].name)) || t.length === 1 && t[0].type === "function" && t[0].name === "var" && R(t[0].text.slice(t[0].text.indexOf("(") + 1, -1)).length === 1) return e;
574
+ throw w("theme.css", "unsupported font shorthand; use an explicit font size (including calc/min/max/clamp) and a family list.");
657
575
  }
658
- let a = B(n.slice(i), t);
576
+ let a = V(n.slice(i), t);
659
577
  return n.slice(0, i) + a + r;
660
578
  }
661
- function V(e, t = !1, n = 0) {
662
- if (n > 64) throw C("theme.css", "nested font declarations exceed 64 levels.");
579
+ function H(e, t = !1, n = 0) {
580
+ if (n > 64) throw w("theme.css", "nested font declarations exceed 64 levels.");
663
581
  let r = [], i = (i) => {
664
- let a = j(e, i + 1);
665
- if (t) for (let t of V(e.slice(i + 1, a), !0, n + 1)) r.push({
582
+ let a = M(e, i + 1);
583
+ if (t) for (let t of H(e.slice(i + 1, a), !0, n + 1)) r.push({
666
584
  name: t.name,
667
585
  valueStart: i + 1 + t.valueStart,
668
586
  valueEnd: i + 1 + t.valueEnd
669
587
  });
670
588
  return Math.min(a + 1, e.length);
671
589
  }, a = 0;
672
- for (; a < e.length && (a = A(e, a), !(a >= e.length));) {
590
+ for (; a < e.length && (a = j(e, a), !(a >= e.length));) {
673
591
  if (e[a] === ";" || e[a] === "}") {
674
592
  a += 1;
675
593
  continue;
@@ -681,9 +599,9 @@ function V(e, t = !1, n = 0) {
681
599
  let t = a, n = a;
682
600
  for (; n < e.length;) {
683
601
  let t = e[n];
684
- if (t === "\"" || t === "'") n = O(e, n);
685
- else if (t === "/" && e[n + 1] === "*") n = A(e, n);
686
- else if (t === "(" || t === "[") n = k(e, n, t, t === "(" ? ")" : "]");
602
+ if (t === "\"" || t === "'") n = k(e, n);
603
+ else if (t === "/" && e[n + 1] === "*") n = j(e, n);
604
+ else if (t === "(" || t === "[") n = A(e, n, t, t === "(" ? ")" : "]");
687
605
  else {
688
606
  if (t === ":" || t === ";" || t === "{" || t === "}") break;
689
607
  n += 1;
@@ -694,13 +612,13 @@ function V(e, t = !1, n = 0) {
694
612
  a = e[n] === "{" ? i(n) : n + 1;
695
613
  continue;
696
614
  }
697
- let o = P(e.slice(t, n)), s = o.length === 1 && o[0].type === "ident" ? o[0] : void 0, c = s?.text ?? "", l = c.startsWith("--") ? c : c.toLowerCase(), u = n + 1, d = u;
615
+ let o = I(e.slice(t, n)), s = o.length === 1 && o[0].type === "ident" ? o[0] : void 0, c = s?.text ?? "", l = c.startsWith("--") ? c : c.toLowerCase(), u = n + 1, d = u;
698
616
  for (; d < e.length;) {
699
617
  let t = e[d];
700
- if (t === "\"" || t === "'") d = O(e, d);
701
- else if (t === "/" && e[d + 1] === "*") d = A(e, d);
702
- else if (t === "(" || t === "[") d = k(e, d, t, t === "(" ? ")" : "]");
703
- else if (t === "{" && c.startsWith("--")) d = j(e, d + 1) + 1;
618
+ if (t === "\"" || t === "'") d = k(e, d);
619
+ else if (t === "/" && e[d + 1] === "*") d = j(e, d);
620
+ else if (t === "(" || t === "[") d = A(e, d, t, t === "(" ? ")" : "]");
621
+ else if (t === "{" && c.startsWith("--")) d = M(e, d + 1) + 1;
704
622
  else {
705
623
  if (t === ";" || t === "{" || t === "}") break;
706
624
  d += 1;
@@ -714,22 +632,22 @@ function V(e, t = !1, n = 0) {
714
632
  }
715
633
  return r;
716
634
  }
717
- function Xe(e, t) {
635
+ function We(e, t) {
718
636
  if (t.size === 0) return e;
719
637
  let n = [];
720
- for (let r of V(e, !0)) {
638
+ for (let r of H(e, !0)) {
721
639
  let i = r.name === "font-family" || r.name === "--font-sans" || r.name === "--font-mono";
722
640
  if (!i && r.name !== "font") continue;
723
- let a = e.slice(r.valueStart, r.valueEnd), o = i ? B(a, t) : Ye(a, t);
641
+ let a = e.slice(r.valueStart, r.valueEnd), o = i ? V(a, t) : Ue(a, t);
724
642
  o !== a && n.push({
725
643
  start: r.valueStart,
726
644
  end: r.valueEnd,
727
645
  text: o
728
646
  });
729
647
  }
730
- return z(e, n);
648
+ return B(e, n);
731
649
  }
732
- function Ze(e, t, n) {
650
+ function Ge(e, t, n) {
733
651
  let r = 0;
734
652
  for (; r < e.length;) {
735
653
  let i = e[r];
@@ -743,17 +661,17 @@ function Ze(e, t, n) {
743
661
  continue;
744
662
  }
745
663
  if (i === "{") {
746
- r = j(e, r + 1) + 1;
664
+ r = M(e, r + 1) + 1;
747
665
  continue;
748
666
  }
749
667
  let a = r, o = r;
750
668
  for (; o < e.length;) {
751
669
  let t = e[o];
752
- if (t === "\"" || t === "'") o = O(e, o);
670
+ if (t === "\"" || t === "'") o = k(e, o);
753
671
  else if (t === "/" && e[o + 1] === "*") {
754
672
  let t = e.indexOf("*/", o + 2);
755
673
  o = t < 0 ? e.length : t + 2;
756
- } else if (t === "(" || t === "[") o = k(e, o, t, t === "(" ? ")" : "]");
674
+ } else if (t === "(" || t === "[") o = A(e, o, t, t === "(" ? ")" : "]");
757
675
  else {
758
676
  if (t === "{" || t === ";" || t === "}") break;
759
677
  o += 1;
@@ -764,123 +682,132 @@ function Ze(e, t, n) {
764
682
  r = o + 1;
765
683
  continue;
766
684
  }
767
- let s = j(e, o + 1), c = e.slice(a, o).trim();
685
+ let s = M(e, o + 1), c = e.slice(a, o).trim();
768
686
  if (c.startsWith("@")) {
769
687
  let r = (/^@([A-Za-z-]+)/.exec(c)?.[1] ?? "").toLowerCase();
770
- r === "font-face" ? n(e.slice(o + 1, s), t) : Ce.has(r) && Ze(e.slice(o + 1, s), t, n);
688
+ r === "font-face" ? n(e.slice(o + 1, s), t) : _e.has(r) && Ge(e.slice(o + 1, s), t, n);
771
689
  }
772
690
  r = Math.min(s + 1, e.length);
773
691
  }
774
692
  }
775
- function Qe(e, t) {
776
- let n = V(e).filter((e) => e.name === "font-family");
777
- if (n.length === 0) throw C(t, "@font-face must declare a font-family descriptor.");
778
- if (n.length > 1) throw C(t, "@font-face may declare font-family only once.");
779
- let { body: r, important: i } = R(e.slice(n[0].valueStart, n[0].valueEnd));
780
- if (i !== "") throw C(t, "@font-face descriptors must not use !important.");
781
- if (L(r).length !== 1) throw C(t, "@font-face font-family must be a single family name, not a list.");
782
- let a = I(r);
783
- if (!a) throw C(t, "@font-face font-family must be one quoted or unquoted family name; generic families, keywords, var() and other functions are not allowed.");
784
- if (Ve(We(a.key)?.original ?? a.key).length > we) throw C(t, `@font-face font-family must not exceed ${we} UTF-8 bytes.`);
693
+ function Ke(e, t) {
694
+ let n = H(e).filter((e) => e.name === "font-family");
695
+ if (n.length === 0) throw w(t, "@font-face must declare a font-family descriptor.");
696
+ if (n.length > 1) throw w(t, "@font-face may declare font-family only once.");
697
+ let { body: r, important: i } = z(e.slice(n[0].valueStart, n[0].valueEnd));
698
+ if (i !== "") throw w(t, "@font-face descriptors must not use !important.");
699
+ if (R(r).length !== 1) throw w(t, "@font-face font-family must be a single family name, not a list.");
700
+ let a = L(r);
701
+ if (!a) throw w(t, "@font-face font-family must be one quoted or unquoted family name; generic families, keywords, var() and other functions are not allowed.");
702
+ if (Fe(P(a.key)?.original ?? a.key).length > ve) throw w(t, `@font-face font-family must not exceed ${ve} UTF-8 bytes.`);
785
703
  return a.key;
786
704
  }
787
- function $e(e, t, n) {
705
+ function qe(e, t, n) {
788
706
  let r = /* @__PURE__ */ new Map();
789
- for (let i of e) Ze(i.css, n, (e, n) => {
790
- let i = Qe(e, n), a = We(i), o = a ? a.original : i, s = Ue(t, o), c = r.get(i);
791
- if (c !== void 0 && c !== s) throw C(n, `@font-face family "${i}" maps to more than one name.`);
707
+ for (let i of e) Ge(i.css, n, (e, n) => {
708
+ let i = Ke(e, n), a = P(i), o = a ? a.original : i, s = Le(t, o), c = r.get(i);
709
+ if (c !== void 0 && c !== s) throw w(n, `@font-face family "${i}" maps to more than one name.`);
792
710
  r.set(i, s), r.set(o, s);
793
711
  });
794
712
  return r;
795
713
  }
796
- function et(e, t, n) {
797
- let r = V(e).filter((e) => e.name === "font-family");
798
- if (r.length !== 1) throw C(n, "@font-face must declare exactly one font-family descriptor.");
799
- let i = r[0], { body: a } = R(e.slice(i.valueStart, i.valueEnd));
800
- if (L(a).length !== 1) throw C(n, "@font-face font-family must be a single family name, not a list.");
801
- let o = I(a);
802
- if (!o) throw C(n, "@font-face has an unsupported font-family descriptor.");
714
+ function Je(e, t, n) {
715
+ let r = H(e).filter((e) => e.name === "font-family");
716
+ if (r.length !== 1) throw w(n, "@font-face must declare exactly one font-family descriptor.");
717
+ let i = r[0], { body: a } = z(e.slice(i.valueStart, i.valueEnd));
718
+ if (R(a).length !== 1) throw w(n, "@font-face font-family must be a single family name, not a list.");
719
+ let o = L(a);
720
+ if (!o) throw w(n, "@font-face has an unsupported font-family descriptor.");
803
721
  let s = t.get(o.key);
804
- if (s === void 0) throw C(n, `@font-face family "${o.key}" was not registered.`);
805
- return z(e, [{
722
+ if (s === void 0) throw w(n, `@font-face family "${o.key}" was not registered.`);
723
+ return B(e, [{
806
724
  start: i.valueStart + o.start,
807
725
  end: i.valueStart + o.end,
808
- text: qe(s)
726
+ text: Ve(s)
809
727
  }]);
810
728
  }
811
- var tt = /* @__PURE__ */ new Map();
812
- function nt(e, t, n = tt) {
813
- let r = "", i = 0;
814
- for (; i < e.length;) {
815
- let a = e[i];
816
- if (a === "/" && e[i + 1] === "*") {
817
- let t = e.indexOf("*/", i + 2), n = t < 0 ? e.length : t + 2;
818
- r += e.slice(i, n), i = n;
729
+ var Ye = /* @__PURE__ */ new Map();
730
+ function Xe(e) {
731
+ return e.replace(/\/\*[\s\S]*?\*\//g, " ").trim().replace(/^@layer\b/i, "@layer").replace(/\s+/g, " ").replace(/\s*,\s*/g, ", ");
732
+ }
733
+ function U(e, t, n = Ye, r = !1) {
734
+ let i = "", a = 0;
735
+ for (; a < e.length;) {
736
+ let o = e[a];
737
+ if (o === "/" && e[a + 1] === "*") {
738
+ let t = e.indexOf("*/", a + 2), n = t < 0 ? e.length : t + 2;
739
+ i += e.slice(a, n), a = n;
819
740
  continue;
820
741
  }
821
- if (/\s/.test(a) || a === ";" || a === "}") {
822
- r += a, i += 1;
742
+ if (/\s/.test(o) || o === ";" || o === "}") {
743
+ i += o, a += 1;
823
744
  continue;
824
745
  }
825
- let o = i, s = i;
826
- for (; s < e.length;) {
827
- let t = e[s];
828
- if (t === "\"" || t === "'") s = O(e, s);
829
- else if (t === "/" && e[s + 1] === "*") {
830
- let t = e.indexOf("*/", s + 2);
831
- s = t < 0 ? e.length : t + 2;
832
- } else if (t === "(") s = k(e, s, "(", ")");
833
- else if (t === "[") s = k(e, s, "[", "]");
746
+ let s = a, c = a;
747
+ for (; c < e.length;) {
748
+ let t = e[c];
749
+ if (t === "\"" || t === "'") c = k(e, c);
750
+ else if (t === "/" && e[c + 1] === "*") {
751
+ let t = e.indexOf("*/", c + 2);
752
+ c = t < 0 ? e.length : t + 2;
753
+ } else if (t === "(") c = A(e, c, "(", ")");
754
+ else if (t === "[") c = A(e, c, "[", "]");
834
755
  else {
835
756
  if (t === "{" || t === ";" || t === "}") break;
836
- s += 1;
757
+ c += 1;
837
758
  }
838
759
  }
839
- if (s >= e.length) {
840
- r += e.slice(o);
760
+ if (c >= e.length) {
761
+ i += e.slice(s);
841
762
  break;
842
763
  }
843
- let c = e.slice(o, s), l = e[s];
844
- if (l === ";" || l === "}") {
845
- r += c + l, i = s + 1;
764
+ let l = e.slice(s, c), u = e[c];
765
+ if (u === ";" || u === "}") {
766
+ let e = Xe(l);
767
+ if (!r && (e === "@layer rmd.themes" || `${e};` === b)) {
768
+ a = c + 1;
769
+ continue;
770
+ }
771
+ i += l + u, a = c + 1;
846
772
  continue;
847
773
  }
848
- let u = j(e, s + 1), d = e.slice(s + 1, u), f = c.trim();
849
- if (f.startsWith("@")) {
850
- let e = (/^@([A-Za-z-]+)/.exec(f)?.[1] ?? "").toLowerCase();
851
- if (e === "import") throw C("theme.css", "must not use @import.");
852
- if (e === "keyframes" || e.endsWith("-keyframes")) throw C("theme.css", `@${e} declares a global name; phase one only supports document-scoped CSS.`);
853
- if (e === "font-face") r += `${f} {${et(d, n, "theme.css")}}`;
774
+ let d = M(e, c + 1), f = e.slice(c + 1, d), p = l.trim();
775
+ if (p.startsWith("@")) {
776
+ let e = (/^@([A-Za-z-]+)/.exec(p)?.[1] ?? "").toLowerCase();
777
+ if (e === "import") throw w("theme.css", "must not use @import.");
778
+ if (e === "keyframes" || e.endsWith("-keyframes")) throw w("theme.css", `@${e} declares a global name; phase one only supports document-scoped CSS.`);
779
+ if (e === "font-face") i += `${p} {${Je(f, n, "theme.css")}}`;
780
+ else if (e === "layer" && !r && Xe(p) === "@layer rmd.themes") i += U(f, t, n, !0).trim();
854
781
  else {
855
- let i = Ce.has(e) ? nt(d, t, n) : d;
856
- r += `${f} {${i}}`;
782
+ let a = _e.has(e) ? U(f, t, n, r || e === "layer") : f;
783
+ i += `${p} {${a}}`;
857
784
  }
858
- } else r += `${Be(f, t)} {${Xe(d, n)}}`;
859
- i = Math.min(u + 1, e.length);
785
+ } else i += `${Pe(p, t)} {${We(f, n)}}`;
786
+ a = Math.min(d + 1, e.length);
860
787
  }
861
- return r;
788
+ return i;
862
789
  }
863
- function H(e, t, n = tt) {
864
- return nt(e, t, n);
790
+ function W(e, t, n = Ye) {
791
+ return `${b}\n@layer ${y} {\n${U(e, t, n).trim()}\n}`;
865
792
  }
866
- function U(e, t) {
867
- if (!Array.isArray(e)) throw C(t, "must be an array of { id, css } resources.");
868
- if (e.length > he) throw C(t, `may contain at most ${he} resources.`);
793
+ function G(e, t) {
794
+ if (!Array.isArray(e)) throw w(t, "must be an array of { id, css } resources.");
795
+ if (e.length > ue) throw w(t, `may contain at most ${ue} resources.`);
869
796
  let n = /* @__PURE__ */ new Set(), r = [], i = 0;
870
797
  for (let a = 0; a < e.length; a += 1) {
871
798
  let o = e[a], s = `${t}[${a}]`;
872
- if (!ke(o)) throw C(s, "must be an object.");
799
+ if (!Ce(o)) throw w(s, "must be an object.");
873
800
  let c = o.id;
874
- if (typeof c != "string" || c.length === 0) throw C(`${s}.id`, "must be a non-empty string.");
875
- if (c.length > ge) throw C(`${s}.id`, `must not exceed ${ge} characters.`);
876
- if (!ye.test(c)) throw C(`${s}.id`, `"${c}" must start with a letter and use letters, digits, ".", "_", "-" or "/".`);
877
- if (n.has(c)) throw C(`${s}.id`, `"${c}" is declared more than once.`);
801
+ if (typeof c != "string" || c.length === 0) throw w(`${s}.id`, "must be a non-empty string.");
802
+ if (c.length > de) throw w(`${s}.id`, `must not exceed ${de} characters.`);
803
+ if (!pe.test(c)) throw w(`${s}.id`, `"${c}" must start with a letter and use letters, digits, ".", "_", "-" or "/".`);
804
+ if (n.has(c)) throw w(`${s}.id`, `"${c}" is declared more than once.`);
878
805
  n.add(c);
879
806
  let l = o.css;
880
- if (typeof l != "string") throw C(`${s}.css`, "must be a string.");
881
- if (l.length > _e) throw C(`${s}.css`, `must not exceed ${_e} characters.`);
882
- if (i += l.length, i > x) throw C(t, `must not exceed ${x} characters in total.`);
883
- Pe(l, `${s}.css`), r.push(Object.freeze({
807
+ if (typeof l != "string") throw w(`${s}.css`, "must be a string.");
808
+ if (l.length > x) throw w(`${s}.css`, `must not exceed ${x} characters.`);
809
+ if (i += l.length, i > S) throw w(t, `must not exceed ${S} characters in total.`);
810
+ Oe(l, `${s}.css`), r.push(Object.freeze({
884
811
  id: c,
885
812
  css: l
886
813
  }));
@@ -890,7 +817,15 @@ function U(e, t) {
890
817
  totalLength: i
891
818
  };
892
819
  }
893
- function W(e) {
820
+ function Ze(e) {
821
+ let t = 0;
822
+ for (let [n, r] of e.entries()) {
823
+ if (r.css.length > x) throw w(`theme.css[${n}].css`, `scoped CSS must not exceed ${x} characters.`);
824
+ t += r.css.length;
825
+ }
826
+ if (t > S) throw w("theme.css", `scoped CSS must not exceed ${S} characters in total.`);
827
+ }
828
+ function K(e) {
894
829
  return Object.freeze({
895
830
  id: e.id,
896
831
  name: e.name,
@@ -903,50 +838,49 @@ function W(e) {
903
838
  })))
904
839
  });
905
840
  }
906
- function rt(e, t) {
907
- let n = w(e, t), r = T(n.id, `${t}.id`), i = E(n.name, `${t}.name`), a = D(n.version, `${t}.version`);
908
- if (n.protocol !== "reactive-md-theme-1") throw C(`${t}.protocol`, `must be "${y}".`);
909
- let o = Ae(n.colorSchemes, `${t}.colorSchemes`), { resources: s } = U(n.css, `${t}.css`);
910
- return W({
841
+ function Qe(e, t) {
842
+ let n = T(e, t), r = E(n.id, `${t}.id`), i = D(n.name, `${t}.name`), a = O(n.version, `${t}.version`);
843
+ if (n.protocol !== "reactive-md-theme-1") throw w(`${t}.protocol`, `must be "${l}".`);
844
+ let o = we(n.colorSchemes, `${t}.colorSchemes`), { resources: s } = G(n.css, `${t}.css`);
845
+ return K({
911
846
  id: r,
912
847
  name: i,
913
848
  version: a,
914
- protocol: y,
849
+ protocol: l,
915
850
  colorSchemes: o,
916
851
  css: s
917
852
  });
918
853
  }
919
- function G(e) {
920
- let t = w(e, "input"), n = T(t.id, "theme.id"), r = E(t.name, "theme.name"), i = D(t.version, "theme.version");
921
- if ((t.protocol === void 0 ? "reactive-md-theme-1" : t.protocol) !== "reactive-md-theme-1") throw C("theme.protocol", `must be "${y}".`);
922
- let a = Ae(t.colorSchemes, "theme.colorSchemes"), { resources: o } = U(t.css, "theme.css"), s = $e(o, r, "theme.css");
923
- return W({
854
+ function q(e) {
855
+ let t = T(e, "input"), n = E(t.id, "theme.id"), r = D(t.name, "theme.name"), i = O(t.version, "theme.version");
856
+ if ((t.protocol === void 0 ? "reactive-md-theme-1" : t.protocol) !== "reactive-md-theme-1") throw w("theme.protocol", `must be "${l}".`);
857
+ let a = we(t.colorSchemes, "theme.colorSchemes"), { resources: o } = G(t.css, "theme.css"), s = qe(o, r, "theme.css"), c = o.map((e) => Object.freeze({
858
+ id: e.id,
859
+ css: W(e.css, r, s)
860
+ }));
861
+ return Ze(c), K({
924
862
  id: n,
925
863
  name: r,
926
864
  version: i,
927
- protocol: y,
865
+ protocol: l,
928
866
  colorSchemes: a,
929
- css: o.map((e) => Object.freeze({
930
- id: e.id,
931
- css: H(e.css, r, s)
932
- }))
867
+ css: c
933
868
  });
934
869
  }
935
- function it(e) {
936
- let t = w(e, "input"), n = T(t.id, "theme.id"), r = E(t.name, "theme.name"), i = D(t.version, "theme.version"), a = rt(t.base, "theme.base"), o = U(t.overrides, "theme.overrides"), s = $e([...a.css, ...o.resources], r, "theme.css"), c = new Set(a.css.map((e) => e.id));
870
+ function $e(e) {
871
+ let t = T(e, "input"), n = E(t.id, "theme.id"), r = D(t.name, "theme.name"), i = O(t.version, "theme.version"), a = Qe(t.base, "theme.base"), o = G(t.overrides, "theme.overrides"), s = qe([...a.css, ...o.resources], r, "theme.css"), c = new Set(a.css.map((e) => e.id));
937
872
  for (let e of o.resources) {
938
- if (c.has(e.id)) throw C("theme.overrides", `resource "${e.id}" is already declared by the base theme.`);
873
+ if (c.has(e.id)) throw w("theme.overrides", `resource "${e.id}" is already declared by the base theme.`);
939
874
  c.add(e.id);
940
875
  }
941
876
  let l = [...a.css.map((e) => Object.freeze({
942
877
  id: e.id,
943
- css: H(e.css, r, s)
878
+ css: W(e.css, r, s)
944
879
  })), ...o.resources.map((e) => Object.freeze({
945
880
  id: e.id,
946
- css: H(e.css, r, s)
947
- }))], u = 0;
948
- for (let e of l) if (u += e.css.length, u > x) throw C("theme.css", `must not exceed ${x} characters in total.`);
949
- return W({
881
+ css: W(e.css, r, s)
882
+ }))];
883
+ return Ze(l), K({
950
884
  id: n,
951
885
  name: r,
952
886
  version: i,
@@ -955,50 +889,49 @@ function it(e) {
955
889
  css: l
956
890
  });
957
891
  }
958
- function at(e) {
959
- let { resources: t } = U(w(e, "theme").css, "theme.css");
960
- return t.map((e) => e.css).join("\n");
892
+ function et(e) {
893
+ return q(e).css.map((e) => e.css).join("\n");
961
894
  }
962
895
  // src/sdk/preset.ts
963
- var K = /* @__PURE__ */ new WeakSet();
964
- function ot(e, t) {
896
+ var J = /* @__PURE__ */ new WeakSet();
897
+ function tt(e, t) {
965
898
  let n = t instanceof Error ? t.message : String(t);
966
899
  throw Error(`Invalid local preset (themes[${e}]): ${n}`);
967
900
  }
968
- function q(e) {
969
- if (typeof e == "object" && e && K.has(e)) return e;
970
- let t = r(e);
971
- if (t.themes === void 0) return K.add(t), t;
901
+ function Y(e) {
902
+ if (typeof e == "object" && e && J.has(e)) return e;
903
+ let t = s(e);
904
+ if (t.themes === void 0) return J.add(t), t;
972
905
  let n = t.themes.map((e, t) => {
973
906
  try {
974
- return G(e);
907
+ return q(e);
975
908
  } catch (e) {
976
- ot(t, e);
909
+ tt(t, e);
977
910
  }
978
- }), i = Object.freeze({
911
+ }), r = Object.freeze({
979
912
  ...t,
980
913
  themes: Object.freeze(n)
981
914
  });
982
- return K.add(i), i;
915
+ return J.add(r), r;
983
916
  }
984
- function st(e) {
985
- return q(e);
917
+ function nt(e) {
918
+ return Y(e);
986
919
  }
987
- function ct(e) {
988
- return i(e);
920
+ function rt(e) {
921
+ return o(e);
989
922
  }
990
923
  // src/sdk/config.ts
991
- var lt = v.id, ut = v.version, dt = Object.freeze({
992
- id: lt,
993
- version: ut
994
- }), ft = 16, pt = /* @__PURE__ */ new Set([
924
+ var it = v.id, at = v.version, ot = Object.freeze({
925
+ id: it,
926
+ version: at
927
+ }), st = 16, ct = /* @__PURE__ */ new Set([
995
928
  "presets",
996
929
  "components",
997
930
  "replacements",
998
931
  "themes"
999
- ]), J = /* @__PURE__ */ new WeakSet();
1000
- function mt(e) {
1001
- d(e) || m("themes", "each theme must be an object."), _(e, /* @__PURE__ */ new Set([
932
+ ]), X = /* @__PURE__ */ new WeakSet();
933
+ function lt(e) {
934
+ d(e) || h("themes", "each theme must be an object."), _(e, /* @__PURE__ */ new Set([
1002
935
  "id",
1003
936
  "name",
1004
937
  "version",
@@ -1007,49 +940,49 @@ function mt(e) {
1007
940
  "css"
1008
941
  ]), "theme");
1009
942
  try {
1010
- return G(e);
943
+ return q(e);
1011
944
  } catch (e) {
1012
- m("theme", e instanceof Error ? e.message : String(e));
945
+ h("theme", e instanceof Error ? e.message : String(e));
1013
946
  }
1014
947
  }
1015
- function Y(e) {
948
+ function Z(e) {
1016
949
  if (e === void 0) return Object.freeze([]);
1017
- Array.isArray(e) || m("themes", "must be an array."), e.length > 16 && m("themes", "accepts at most 16 themes.");
950
+ Array.isArray(e) || h("themes", "must be an array."), e.length > 16 && h("themes", "accepts at most 16 themes.");
1018
951
  let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = [];
1019
952
  for (let i of e) {
1020
- let e = mt(i);
1021
- t.has(e.id) && m("themes", `theme id "${e.id}" is declared more than once.`), n.has(e.name) && m("themes", `theme name "${e.name}" is declared more than once.`), t.add(e.id), n.add(e.name), r.push(e);
953
+ let e = lt(i);
954
+ t.has(e.id) && h("themes", `theme id "${e.id}" is declared more than once.`), n.has(e.name) && h("themes", `theme name "${e.name}" is declared more than once.`), t.add(e.id), n.add(e.name), r.push(e);
1022
955
  }
1023
956
  return Object.freeze(r.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
1024
957
  }
1025
- function ht(e, t) {
1026
- if (typeof e == "string") return e !== "default" && e !== v.id && m(`presets[${t}]`, `unsupported preset "${e}"; phase one accepts only the built-in default package.`), v;
1027
- if (d(e) || m(`presets[${t}]`, "must be a preset package, \"default\" or a preset reference."), e.protocol !== void 0 || e.components !== void 0) try {
1028
- return q(e);
958
+ function ut(e, t) {
959
+ if (typeof e == "string") return e !== "default" && e !== v.id && h(`presets[${t}]`, `unsupported preset "${e}"; phase one accepts only the built-in default package.`), v;
960
+ if (d(e) || h(`presets[${t}]`, "must be a preset package, \"default\" or a preset reference."), e.protocol !== void 0 || e.components !== void 0) try {
961
+ return Y(e);
1029
962
  } catch (e) {
1030
- m(`presets[${t}]`, e instanceof Error ? e.message : String(e));
963
+ h(`presets[${t}]`, e instanceof Error ? e.message : String(e));
1031
964
  }
1032
965
  let n = e.id, r = e.version;
1033
- return typeof n != "string" && m(`presets[${t}].id`, "must be a string."), typeof r != "string" && m(`presets[${t}].version`, "must be a string."), (n === "default" ? v.id : n) !== v.id && m(`presets[${t}]`, `unsupported preset "${n}"; phase one accepts only "${v.id}".`), r !== v.version && m(`presets[${t}].version`, `must be "${v.version}".`), v;
966
+ return typeof n != "string" && h(`presets[${t}].id`, "must be a string."), typeof r != "string" && h(`presets[${t}].version`, "must be a string."), (n === "default" ? v.id : n) !== v.id && h(`presets[${t}]`, `unsupported preset "${n}"; phase one accepts only "${v.id}".`), r !== v.version && h(`presets[${t}].version`, `must be "${v.version}".`), v;
1034
967
  }
1035
- function gt(e) {
968
+ function dt(e) {
1036
969
  if (e === void 0) return Object.freeze([v]);
1037
- Array.isArray(e) || m("presets", "must be an array.");
970
+ Array.isArray(e) || h("presets", "must be an array.");
1038
971
  let t = [], n = /* @__PURE__ */ new Set();
1039
972
  for (let r = 0; r < e.length; r += 1) {
1040
- let i = ht(e[r], r);
1041
- n.has(i.id) && m("presets", `preset "${i.id}" is selected more than once.`), n.add(i.id), t.push(i);
973
+ let i = ut(e[r], r);
974
+ n.has(i.id) && h("presets", `preset "${i.id}" is selected more than once.`), n.add(i.id), t.push(i);
1042
975
  }
1043
976
  return Object.freeze([...t].sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
1044
977
  }
1045
- function _t(e) {
978
+ function ft(e) {
1046
979
  if (e === void 0) return Object.freeze([]);
1047
- Array.isArray(e) || m("components", "must be an array.");
980
+ Array.isArray(e) || h("components", "must be an array.");
1048
981
  let t = e.map((e, t) => {
1049
982
  try {
1050
- return a(e);
983
+ return i(e);
1051
984
  } catch (e) {
1052
- m(`components[${t}]`, e instanceof Error ? e.message : String(e));
985
+ h(`components[${t}]`, e instanceof Error ? e.message : String(e));
1053
986
  }
1054
987
  });
1055
988
  return Object.freeze(t.sort((e, t) => {
@@ -1058,44 +991,44 @@ function _t(e) {
1058
991
  return n === r ? e.version === t.version ? e.name < t.name ? -1 : +(e.name > t.name) : e.version < t.version ? -1 : 1 : n - r;
1059
992
  }));
1060
993
  }
1061
- function vt(e) {
1062
- return e === void 0 ? "allow" : (e !== "allow" && e !== "forbid" && m("replacements", "must be \"allow\" or \"forbid\"."), e);
994
+ function pt(e) {
995
+ return e === void 0 ? "allow" : (e !== "allow" && e !== "forbid" && h("replacements", "must be \"allow\" or \"forbid\"."), e);
1063
996
  }
1064
- function yt(e, n) {
1065
- d(e) || m(n, "must be an object."), _(e, pt, n);
997
+ function mt(t, n) {
998
+ d(t) || h(n, "must be an object."), _(t, ct, n);
1066
999
  let r = Object.freeze({
1067
- protocol: t,
1068
- presets: gt(e.presets),
1069
- components: _t(e.components),
1070
- replacementPolicy: vt(e.replacements),
1071
- themes: Y(e.themes)
1000
+ protocol: a,
1001
+ presets: dt(t.presets),
1002
+ components: ft(t.components),
1003
+ replacementPolicy: pt(t.replacements),
1004
+ themes: Z(t.themes)
1072
1005
  });
1073
- return o(r) > 16777216 && m(n, `serialized size exceeds the ${h}-byte budget.`), r;
1006
+ return e(r) > 16777216 && h(n, `serialized size exceeds the ${g}-byte budget.`), r;
1074
1007
  }
1075
- function bt(e) {
1008
+ function ht(e) {
1076
1009
  return Object.freeze({
1077
1010
  ...e,
1078
- presets: Object.freeze(e.presets.map((e) => q(e))),
1079
- themes: Y(e.themes)
1011
+ presets: Object.freeze(e.presets.map((e) => Y(e))),
1012
+ themes: Z(e.themes)
1080
1013
  });
1081
1014
  }
1082
- function X(e) {
1083
- let t = bt(e), n = te(t, { legacyProfiles: p }), r = ee(t, n);
1084
- return J.add(r), r;
1015
+ function gt(e) {
1016
+ let t = ht(e), n = ee(t, { legacyProfiles: m }), r = p(t, n);
1017
+ return X.add(r), r;
1085
1018
  }
1086
- function Z(e = {}) {
1087
- return X(yt(e, "config"));
1019
+ function Q(e = {}) {
1020
+ return gt(mt(e, "config"));
1088
1021
  }
1089
- var xt;
1090
- function St(e) {
1091
- return e === void 0 ? xt ??= Z().key : Q(e).key;
1022
+ var _t;
1023
+ function vt(e) {
1024
+ return e === void 0 ? _t ??= Q().key : $(e).key;
1092
1025
  }
1093
- function Ct(e) {
1026
+ function yt(e) {
1094
1027
  return new Set(e.legacyKeys.map((e) => e.key));
1095
1028
  }
1096
- function wt(e, t) {
1097
- let n = Q(t ?? Z()), r = e.componentConfigKey;
1098
- return r === void 0 || r === n.key || Ct(n).has(r) ? [] : [{
1029
+ function bt(e, t) {
1030
+ let n = $(t ?? Q()), r = e.componentConfigKey;
1031
+ return r === void 0 || r === n.key || yt(n).has(r) ? [] : [{
1099
1032
  code: "local.extension.config-mismatch",
1100
1033
  severity: "error",
1101
1034
  message: "The document compiler configuration differs from the installed renderer. Recompile with the same host.config used by host.reactConfig (including Worker requests).",
@@ -1107,68 +1040,52 @@ function wt(e, t) {
1107
1040
  column: 1
1108
1041
  }];
1109
1042
  }
1110
- function Tt(e) {
1111
- return e.preset.id === v.id && e.preset.version === v.version ? v : q({
1043
+ function xt(e) {
1044
+ return e.preset.id === v.id && e.preset.version === v.version ? v : Y({
1112
1045
  ...v,
1113
1046
  id: e.preset.id,
1114
1047
  version: e.preset.version
1115
1048
  });
1116
1049
  }
1117
- function Et(e, n) {
1118
- let r = ae(e.presets, dt, n)[0] ?? dt, i = u(r, n);
1119
- i === void 0 && m("presets", `local.config.migration-unsupported: no compatibility profile matches preset "${r.id}" ${r.version}.`);
1120
- let a = i.legacyKeys[0];
1121
- a === void 0 && m("presets", `local.config.migration-unsupported: profile "${i.name}" has no legacy key mapping.`), f(i, v.components);
1122
- let o = Tt(i), s = re(e.components, v.components);
1123
- s.some((e) => e.replaces !== void 0) && m("config", "replaces is not supported by reactive-md-config/v1.");
1124
- let c = Y(e.themes), l = Object.freeze({
1125
- protocol: t,
1050
+ function St(e, t) {
1051
+ let n = ie(e.presets, ot, t)[0] ?? ot, r = u(n, t);
1052
+ r === void 0 && h("presets", `local.config.migration-unsupported: no compatibility profile matches preset "${n.id}" ${n.version}.`);
1053
+ let i = r.legacyKeys[0];
1054
+ i === void 0 && h("presets", `local.config.migration-unsupported: profile "${r.name}" has no legacy key mapping.`), f(r, v.components);
1055
+ let o = xt(r), s = ne(e.components, v.components);
1056
+ s.some((e) => e.replaces !== void 0) && h("config", "replaces is not supported by reactive-md-config/v1.");
1057
+ let c = Z(e.themes), l = Object.freeze({
1058
+ protocol: a,
1126
1059
  presets: Object.freeze([o]),
1127
1060
  components: s,
1128
1061
  replacementPolicy: "forbid",
1129
1062
  themes: c
1130
- }), d = te(l, { legacyProfiles: n }), p = ie(i.preset, d.components), ne = [...d.legacyKeys, ...d.legacyKeys.some((e) => e.key === p) ? [] : [Object.freeze({
1131
- profile: a.profile,
1132
- key: p
1133
- })]], h = ee(l, d, ne);
1134
- return J.add(h), h;
1063
+ }), d = ee(l, { legacyProfiles: t }), m = re(r.preset, d.components), te = [...d.legacyKeys, ...d.legacyKeys.some((e) => e.key === m) ? [] : [Object.freeze({
1064
+ profile: i.profile,
1065
+ key: m
1066
+ })]], g = p(l, d, te);
1067
+ return X.add(g), g;
1135
1068
  }
1136
- function Q(t, r = []) {
1137
- return typeof t == "object" && t && J.has(t) ? t : (d(t) || m("config", "must be an object."), _(t, oe, "config"), t.protocol === "reactive-md-config/v1" ? Et(t, se(r)) : (t.protocol !== "reactive-md-config/v2" && m("config.protocol", `must be "${e}" (or legacy "${n}").`), X(ne(t.assembly))));
1069
+ function $(e, r = []) {
1070
+ return typeof e == "object" && e && X.has(e) ? e : (d(e) || h("config", "must be an object."), _(e, ae, "config"), e.protocol === "reactive-md-config/v1" ? St(e, oe(r)) : (e.protocol !== "reactive-md-config/v2" && h("config.protocol", `must be "${n}" (or legacy "${t}").`), gt(te(e.assembly))));
1138
1071
  }
1139
- function Dt(e) {
1140
- if (typeof e == "object" && e && J.has(e)) return e.key;
1072
+ function Ct(e) {
1073
+ if (typeof e == "object" && e && X.has(e)) return e.key;
1141
1074
  try {
1142
- return Q(e).key;
1075
+ return $(e).key;
1143
1076
  } catch {
1144
1077
  try {
1145
- return `invalid:${s(JSON.stringify(e))}`;
1078
+ return `invalid:${r(JSON.stringify(e))}`;
1146
1079
  } catch {
1147
1080
  return "invalid";
1148
1081
  }
1149
1082
  }
1150
1083
  }
1151
- function Ot(e) {
1084
+ function wt(e) {
1152
1085
  try {
1153
- return Q(e);
1086
+ return $(e);
1154
1087
  } catch {
1155
1088
  return e;
1156
1089
  }
1157
1090
  }
1158
- // src/sdk/registry.ts
1159
- function kt() {
1160
- return le;
1161
- }
1162
- function $(e) {
1163
- return e ? Q(e).registry : kt();
1164
- }
1165
- function At(e, t) {
1166
- let n = $(t);
1167
- for (let t of n) if (t.name === e) return t;
1168
- }
1169
- function jt(e) {
1170
- let t = /* @__PURE__ */ new Map();
1171
- for (let n of $(e)) t.set(n.name, ce(n));
1172
- return t;
1173
- }
1174
- export { pe as S, it as _, ut as a, b, St as c, Ot as d, wt as f, at as g, q as h, lt as i, Dt as l, ct as m, $ as n, ft as o, st as p, jt as r, Z as s, At as t, Q as u, G as v, y as x, Fe as y };
1091
+ export { se as _, vt as a, y as b, wt as c, rt as d, Y as f, ke as g, q as h, Q as i, bt as l, $e as m, at as n, Ct as o, et as p, st as r, $ as s, it as t, nt as u, ce as v, b as y };