reactive-md 0.9.0 → 0.9.2

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 (338) hide show
  1. package/CHANGELOG-ch.md +333 -306
  2. package/CHANGELOG.md +334 -307
  3. package/CONTRIBUTING-ch.md +22 -22
  4. package/CONTRIBUTING.md +22 -22
  5. package/README-ch.md +431 -431
  6. package/README-en.md +431 -431
  7. package/README.md +429 -429
  8. package/SECURITY-ch.md +83 -83
  9. package/SECURITY.md +83 -83
  10. package/THIRD_PARTY_NOTICES.md +111 -1
  11. package/bin/reactive-md.mjs +39 -39
  12. package/cli/args.mjs +263 -263
  13. package/cli/assets.mjs +395 -395
  14. package/cli/build.mjs +445 -444
  15. package/cli/check.mjs +444 -444
  16. package/cli/document.mjs +130 -130
  17. package/cli/errors.mjs +61 -61
  18. package/cli/fs-utils.mjs +133 -133
  19. package/cli/glob.mjs +203 -203
  20. package/cli/help.mjs +323 -323
  21. package/cli/init.mjs +1577 -1577
  22. package/cli/lint.mjs +177 -177
  23. package/cli/main.mjs +65 -65
  24. package/cli/migrate.mjs +368 -368
  25. package/cli/package-loader.mjs +41 -41
  26. package/cli/package.mjs +211 -211
  27. package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-BuqgJZEY.js} +11 -11
  28. package/dist-library/LocalDocumentViewCore-DXE0I0Qc.js +9830 -0
  29. package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +275 -0
  30. package/dist-library/{authoring-Co_TiE-P.js → authoring-Ci_KzJ0q.js} +87 -67
  31. package/dist-library/{compile-LhpTKqCR.js → compile-Dx6Uw3D9.js} +11 -11
  32. package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-DDDdvuLy.js} +2618 -1846
  33. package/dist-library/compiler-dxLPB9Ym.js +86 -0
  34. package/dist-library/{component-state-BBJ08vML.js → component-state-BRwvTV0d.js} +15 -14
  35. package/dist-library/component-state-CwKX_SN5.js +763 -0
  36. package/dist-library/{config-BUo-8O5C.js → config-DXLvctiZ.js} +68 -66
  37. package/dist-library/config-validation-D3D7Dy2J.js +586 -0
  38. package/dist-library/{controls-BWiLLtBO.js → controls-DoZyLCrV.js} +2434 -2410
  39. package/dist-library/{coordinate-BSl6enWV.js → coordinate-B1VFK9fd.js} +108 -107
  40. package/dist-library/{data-table-DfvytZKQ.js → data-table-8-3F15Jf.js} +69 -66
  41. package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
  42. package/dist-library/{display-lw3BT1TA.js → display-B_uutKkN.js} +1 -1
  43. package/dist-library/{config-validation-C5kJYk-J.js → document-theme-C8J6UyNO.js} +241 -731
  44. package/dist-library/export-CIAIPBov.js +370 -0
  45. package/dist-library/{gallery-B8kSt1oI.js → gallery-Dv1rOvL0.js} +151 -147
  46. package/dist-library/html-Cr4CBwAH.js +758 -0
  47. package/dist-library/identity-BUx0Q_-d.js +40 -0
  48. package/dist-library/{incremental-D_6vwAAE.js → incremental-9nx92u9c.js} +407 -143
  49. package/dist-library/layout-BBB2VF0S.js +562 -0
  50. package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-DMZ5wd3t.js} +3 -3
  51. package/dist-library/observability-4KqXhIEU.js +421 -0
  52. package/dist-library/observability-core-Bcu7vpnl.js +24 -0
  53. package/dist-library/options-BBp9IcHm.js +121 -0
  54. package/dist-library/{package-core-D0POW4Gd.js → package-core-K5xesGqy.js} +30 -29
  55. package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-CBA1-hdG.js} +3332 -3840
  56. package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
  57. package/dist-library/preset-core-DeZPA8IE.js +1298 -0
  58. package/dist-library/react-0DCh-Mar.js +7 -0
  59. package/dist-library/reactive-md-authoring.js +28 -30
  60. package/dist-library/reactive-md-build.js +99 -61
  61. package/dist-library/reactive-md-compiler-standard.js +10 -9
  62. package/dist-library/reactive-md-compiler.js +3 -3
  63. package/dist-library/reactive-md-default-packs.js +3 -2
  64. package/dist-library/reactive-md-default-preset.js +3 -2
  65. package/dist-library/reactive-md-export.js +4 -4
  66. package/dist-library/reactive-md-minimal-preset.js +2 -2
  67. package/dist-library/reactive-md-minimal-react-preset.js +3 -3
  68. package/dist-library/reactive-md-observability.js +4 -0
  69. package/dist-library/reactive-md-pdf.js +127 -3
  70. package/dist-library/reactive-md-plugin-chart.js +3 -3
  71. package/dist-library/reactive-md-plugin-data.js +5 -5
  72. package/dist-library/reactive-md-plugin-diagram.js +4 -4
  73. package/dist-library/reactive-md-plugin-forms.js +4 -4
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +3 -3
  76. package/dist-library/reactive-md-plugin-network.js +119 -116
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-print.css +304 -304
  79. package/dist-library/reactive-md-react-minimal.js +4 -4
  80. package/dist-library/reactive-md-react-server.js +6 -6
  81. package/dist-library/reactive-md-react-unstyled.js +11 -12
  82. package/dist-library/reactive-md-react.js +11 -12
  83. package/dist-library/reactive-md-runtime-browser.js +2 -1
  84. package/dist-library/reactive-md-runtime.js +4 -3
  85. package/dist-library/reactive-md-sdk.js +8 -7
  86. package/dist-library/reactive-md-standalone-configured.js +2 -2
  87. package/dist-library/reactive-md-standalone-host.js +2 -2
  88. package/dist-library/reactive-md-testing-browser.js +2 -2
  89. package/dist-library/reactive-md-testing-react.js +6 -6
  90. package/dist-library/reactive-md-testing.js +5 -5
  91. package/dist-library/reactive-md.js +649 -373
  92. package/dist-library/{registry-05JiqmEp.js → registry-D6OGkOcX.js} +3 -3
  93. package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
  94. package/dist-library/{resources-IeJomeUT.js → resources-B0x_w3s9.js} +71 -46
  95. package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
  96. package/dist-library/{runtime-CuOyRe9f.js → runtime-BpQdZmFI.js} +269 -263
  97. package/dist-library/{schema-C-AeByPp.js → schema-BryM_VRW.js} +14 -14
  98. package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-ChslheKs.js} +499 -158
  99. package/dist-library/{session-core-BGka5D1J.js → session-core-dxQCJBNa.js} +171 -156
  100. package/dist-library/{shareable-jkGi2g6y.js → shareable-B8xMoGEa.js} +265 -297
  101. package/dist-library/types/authoring/catalog.d.ts +1 -2
  102. package/dist-library/types/build/diagnostics.d.ts +1 -1
  103. package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
  104. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
  105. package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
  106. package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
  107. package/dist-library/types/local/compilation/compiler.d.ts +3 -3
  108. package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
  109. package/dist-library/types/local/compilation/streaming.d.ts +27 -0
  110. package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
  111. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
  112. package/dist-library/types/local/configuration/options-core.d.ts +1 -2
  113. package/dist-library/types/local/configuration/options.d.ts +1 -0
  114. package/dist-library/types/local/css/author-css.d.ts +66 -0
  115. package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
  116. package/dist-library/types/local/html/html.d.ts +39 -3
  117. package/dist-library/types/local/index.d.ts +7 -1
  118. package/dist-library/types/local/observability-codes.d.ts +2 -0
  119. package/dist-library/types/local/observability-core.d.ts +25 -0
  120. package/dist-library/types/local/observability-messages.d.ts +6 -0
  121. package/dist-library/types/local/observability.d.ts +43 -0
  122. package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
  123. package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
  124. package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
  125. package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
  126. package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
  127. package/dist-library/types/local/parsing/parser.d.ts +2 -2
  128. package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
  129. package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
  130. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
  131. package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
  132. package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
  133. package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
  134. package/dist-library/types/local/transport/worker.d.ts +79 -5
  135. package/dist-library/types/local/types.d.ts +60 -16
  136. package/dist-library/types/observability.d.ts +7 -0
  137. package/dist-library/types/react/component-api.d.ts +10 -1
  138. package/dist-library/types/react/component-utils.d.ts +9 -1
  139. package/dist-library/types/react/sdk-core.d.ts +4 -1
  140. package/dist-library/types/shareable.d.ts +5 -4
  141. package/dist-library/types/standalone/prepare.d.ts +1 -1
  142. package/dist-library/types/standalone/session-core.d.ts +3 -2
  143. package/dist-library/{types-BFC5rzC4.js → types-Ib5kSScP.js} +1 -1
  144. package/dist-library/types-daDo2c_w.js +3 -0
  145. package/dist-library/{validation-BlDL2uD9.js → validation-B3RI0xOk.js} +218 -200
  146. package/dist-library/version-DAxuGOG2.js +147 -0
  147. package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-_rcd5HUv.js} +6 -5
  148. package/dist-library/{visuals-BkYRmYGO.js → visuals-DkDhNdEZ.js} +24191 -24190
  149. package/dist-standalone/reactive-md-standalone.js +124 -117
  150. package/docs/README-ch.md +101 -94
  151. package/docs/README.md +101 -94
  152. package/docs/compatibility/api-stability-ch.md +25 -0
  153. package/docs/compatibility/api-stability-en.md +25 -0
  154. package/docs/compatibility/compatibility-ch.md +146 -129
  155. package/docs/compatibility/compatibility-en.md +146 -129
  156. package/docs/compatibility/compatibility-manifest.schema.json +161 -0
  157. package/docs/compatibility/deprecation-ch.md +21 -0
  158. package/docs/compatibility/deprecation-en.md +21 -0
  159. package/docs/compatibility/source-versioning-ch.md +162 -162
  160. package/docs/compatibility/source-versioning-en.md +162 -162
  161. package/docs/compatibility/support-matrix-ch.md +108 -0
  162. package/docs/compatibility/support-matrix-en.md +108 -0
  163. package/docs/development/component-development-ch.md +66 -66
  164. package/docs/development/component-development-en.md +66 -66
  165. package/docs/development/component-development-reference-ch.md +253 -253
  166. package/docs/development/component-development-reference-en.md +238 -238
  167. package/docs/development/component-protocol-ch.md +748 -748
  168. package/docs/development/component-protocol-en.md +750 -750
  169. package/docs/development/extension-tutorial-ch.md +308 -308
  170. package/docs/development/extension-tutorial-en.md +308 -308
  171. package/docs/development/performance-overview-ch.md +422 -422
  172. package/docs/development/performance-overview-en.md +422 -422
  173. package/docs/guides/local-guide-ch.md +532 -532
  174. package/docs/guides/local-guide-en.md +532 -532
  175. package/docs/integration/author-tools-ch.md +64 -64
  176. package/docs/integration/author-tools-en.md +64 -64
  177. package/docs/integration/compiler-ch.md +49 -47
  178. package/docs/integration/compiler-en.md +36 -34
  179. package/docs/integration/directory-discovery-en.md +1 -1
  180. package/docs/integration/editor-ch.md +295 -295
  181. package/docs/integration/editor-en.md +303 -303
  182. package/docs/integration/extension-sdk-ch.md +394 -394
  183. package/docs/integration/extension-sdk-en.md +379 -379
  184. package/docs/integration/local-integration-ch.md +646 -524
  185. package/docs/integration/local-integration-en.md +662 -540
  186. package/docs/integration/shareable-export-ch.md +307 -305
  187. package/docs/integration/shareable-export-en.md +309 -307
  188. package/docs/reference/diagnostics-counting-ch.md +104 -104
  189. package/docs/reference/diagnostics-counting-en.md +104 -104
  190. package/docs/reference/html-compatibility-ch.md +93 -140
  191. package/docs/reference/html-compatibility-en.md +95 -140
  192. package/docs/reference/local-interaction-syntax-ch.md +724 -724
  193. package/docs/reference/local-interaction-syntax-en.md +722 -722
  194. package/docs/reference/public-api-ch.md +39 -7
  195. package/docs/reference/public-api-en.md +39 -7
  196. package/docs/reference/theme-protocol-ch.md +198 -198
  197. package/docs/reference/theme-protocol-en.md +217 -217
  198. package/docs/releases/release-0.4.0-ch.md +91 -91
  199. package/docs/releases/release-0.4.0-en.md +91 -91
  200. package/docs/releases/release-0.4.1-ch.md +25 -25
  201. package/docs/releases/release-0.4.1-en.md +25 -25
  202. package/docs/releases/release-0.5.0-ch.md +43 -43
  203. package/docs/releases/release-0.5.0-en.md +43 -43
  204. package/docs/releases/release-0.5.1-ch.md +41 -41
  205. package/docs/releases/release-0.5.1-en.md +41 -41
  206. package/docs/releases/release-0.5.2-ch.md +37 -37
  207. package/docs/releases/release-0.5.2-en.md +37 -37
  208. package/docs/releases/release-0.5.3-ch.md +26 -26
  209. package/docs/releases/release-0.5.3-en.md +26 -26
  210. package/docs/releases/release-0.6.0-ch.md +59 -59
  211. package/docs/releases/release-0.6.0-en.md +59 -59
  212. package/docs/releases/release-0.6.1-ch.md +29 -29
  213. package/docs/releases/release-0.6.1-en.md +29 -29
  214. package/docs/releases/release-0.7.0-ch.md +86 -86
  215. package/docs/releases/release-0.7.0-en.md +86 -86
  216. package/docs/releases/release-0.9.1-ch.md +29 -0
  217. package/docs/releases/release-0.9.1-en.md +29 -0
  218. package/docs/releases/release-0.9.2-ch.md +33 -0
  219. package/docs/releases/release-0.9.2-en.md +33 -0
  220. package/examples/component-package/README-ch.md +101 -101
  221. package/examples/component-package/README.md +133 -133
  222. package/examples/conformance/README-ch.md +55 -55
  223. package/examples/conformance/README.md +55 -55
  224. package/examples/conformance/component-protocol-1.json +482 -482
  225. package/examples/conformance/component-protocol-1.schema.json +76 -76
  226. package/examples/conformance/local-draft-1.json +50 -50
  227. package/examples/conformance/local-draft-2.json +212 -212
  228. package/examples/game-2048-package/LICENSE +21 -21
  229. package/examples/game-2048-package/NOTICES.md +11 -11
  230. package/examples/game-2048-package/README-ch.md +91 -91
  231. package/examples/game-2048-package/README.md +98 -98
  232. package/examples/game-2048-package/package.json +35 -35
  233. package/examples/game-2048-package/sample/document.reactive.md +17 -17
  234. package/examples/game-2048-package/scripts/build-export.mjs +44 -44
  235. package/examples/game-2048-package/scripts/build.mjs +130 -130
  236. package/examples/game-2048-package/scripts/verify.mjs +180 -180
  237. package/examples/game-2048-package/src/component.css +161 -161
  238. package/examples/game-2048-package/src/components.tsx +326 -326
  239. package/examples/game-2048-package/src/game-engine.ts +228 -228
  240. package/examples/game-2048-package/src/harness.tsx +34 -34
  241. package/examples/game-2048-package/src/manifest.ts +85 -85
  242. package/examples/game-2048-package/src/node-entry.ts +30 -30
  243. package/examples/game-2048-package/src/sample.ts +4 -4
  244. package/examples/game-2048-package/tsconfig.json +15 -15
  245. package/examples/integration/README-ch.md +82 -63
  246. package/examples/integration/README.md +82 -63
  247. package/examples/integration/core/index.mjs +32 -32
  248. package/examples/integration/extension-sdk/README-ch.md +24 -24
  249. package/examples/integration/extension-sdk/README.md +24 -24
  250. package/examples/integration/streaming/index.html +48 -0
  251. package/examples/integration/streaming/main.js +175 -0
  252. package/examples/integration/streaming/package.json +13 -0
  253. package/examples/integration/streaming/worker.js +3 -0
  254. package/examples/integration/worker/index.html +19 -19
  255. package/examples/integration/worker/main.js +61 -61
  256. package/examples/integration/worker/package.json +13 -13
  257. package/examples/integration/worker/worker.js +3 -3
  258. package/examples/local/README-ch.md +76 -76
  259. package/examples/local/README.md +76 -76
  260. package/examples/local/charts.reactive.md +73 -73
  261. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  262. package/examples/local/recipes/invoice.reactive.md +36 -36
  263. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  264. package/examples/local/recipes/workshop.reactive.md +33 -33
  265. package/examples/local/showcase/README-ch.md +22 -22
  266. package/examples/local/showcase/README.md +31 -31
  267. package/examples/local/showcase/explore.reactive.md +102 -102
  268. package/examples/local/showcase/flow.reactive.md +86 -86
  269. package/examples/local/showcase/forms.reactive.md +126 -126
  270. package/examples/local/showcase/functions.reactive.md +119 -119
  271. package/examples/local/showcase/layout.reactive.md +100 -100
  272. package/examples/local/showcase/statistics.reactive.md +108 -108
  273. package/examples/local/showcase/tasks.reactive.md +89 -89
  274. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  275. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  276. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  277. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  278. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  279. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  280. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  281. package/examples/minimal-extension/README-ch.md +78 -78
  282. package/examples/minimal-extension/README.md +78 -78
  283. package/examples/minimal-extension/index.html +15 -15
  284. package/examples/minimal-extension/package.json +26 -26
  285. package/examples/minimal-extension/sample/document.reactive.md +10 -10
  286. package/examples/minimal-extension/scripts/build.mjs +32 -32
  287. package/examples/minimal-extension/scripts/export.mjs +72 -72
  288. package/examples/minimal-extension/scripts/test-node.mjs +75 -75
  289. package/examples/minimal-extension/src/extension.tsx +90 -90
  290. package/examples/minimal-extension/src/preview.tsx +12 -12
  291. package/examples/minimal-extension/src/source.ts +4 -4
  292. package/examples/minimal-extension/tsconfig.json +14 -14
  293. package/examples/sci-fi-theme/README-ch.md +133 -133
  294. package/examples/sci-fi-theme/README.md +148 -148
  295. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
  296. package/examples/sci-fi-theme/demo/demo.css +638 -638
  297. package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
  298. package/examples/sci-fi-theme/demo/index.html +13 -13
  299. package/examples/sci-fi-theme/demo/main.tsx +215 -215
  300. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
  301. package/examples/sci-fi-theme/docs/design-system.md +474 -474
  302. package/examples/sci-fi-theme/package.json +28 -28
  303. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
  304. package/examples/sci-fi-theme/src/components.css +2370 -2370
  305. package/examples/sci-fi-theme/src/index.ts +6 -6
  306. package/examples/sci-fi-theme/src/notch.css +142 -142
  307. package/examples/sci-fi-theme/src/sci-fi.css +7 -7
  308. package/examples/sci-fi-theme/src/theme.ts +39 -39
  309. package/examples/sci-fi-theme/tsconfig.json +20 -20
  310. package/examples/sci-fi-theme/vite.config.ts +24 -24
  311. package/examples/tetris-package/LICENSE +21 -21
  312. package/examples/tetris-package/NOTICES.md +11 -11
  313. package/examples/tetris-package/README-ch.md +91 -91
  314. package/examples/tetris-package/README.md +95 -95
  315. package/examples/tetris-package/package.json +35 -35
  316. package/examples/tetris-package/sample/document.reactive.md +16 -16
  317. package/examples/tetris-package/scripts/build-export.mjs +44 -44
  318. package/examples/tetris-package/scripts/build.mjs +130 -130
  319. package/examples/tetris-package/scripts/verify.mjs +173 -173
  320. package/examples/tetris-package/src/component.css +145 -145
  321. package/examples/tetris-package/src/components.tsx +334 -334
  322. package/examples/tetris-package/src/harness.tsx +34 -34
  323. package/examples/tetris-package/src/manifests.ts +93 -93
  324. package/examples/tetris-package/src/node-entry.ts +16 -16
  325. package/examples/tetris-package/src/sample.ts +4 -4
  326. package/examples/tetris-package/src/tetris-engine.ts +325 -325
  327. package/examples/tetris-package/tsconfig.json +15 -15
  328. package/package.json +12 -1
  329. package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
  330. package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
  331. package/dist-library/compiler-DfGbQhyD.js +0 -62
  332. package/dist-library/component-state-BoLCGee4.js +0 -801
  333. package/dist-library/component-utils-BvHL8VGt.js +0 -298
  334. package/dist-library/export-C7IDW9ul.js +0 -311
  335. package/dist-library/layout-C22VjZh0.js +0 -542
  336. package/dist-library/options-CdSKOi7p.js +0 -116
  337. package/dist-library/preset-core-CKc5YXSM.js +0 -1443
  338. package/dist-library/react-LY5qsVeP.js +0 -7
@@ -1,6 +1,6 @@
1
- import { B as e, F as t, G as n, I as r, J as i, K as a, M as o, N as s, O as c, U as l, it as u, j as d, k as f, n as p, r as m } from "./preset-core-CKc5YXSM.js";
1
+ import { w as e } from "./version-DAxuGOG2.js";
2
2
  // src/local/source/source-context.ts
3
- function ee(e, t) {
3
+ function t(e, t) {
4
4
  let n = e[t];
5
5
  if (n !== "`" && n !== "~") return;
6
6
  let r = 0;
@@ -10,98 +10,98 @@ function ee(e, t) {
10
10
  length: r
11
11
  } : void 0;
12
12
  }
13
- function h(e) {
13
+ function n(e) {
14
14
  if (!e.length) return {
15
15
  lines: [],
16
16
  maxMarkdownDepth: 0,
17
17
  potentialDepth: 0,
18
18
  fenceSpans: []
19
19
  };
20
- let t = [0];
21
- for (let n = 0; n < e.length; n++) {
22
- let r = e[n];
23
- r === "\r" ? (e[n + 1] === "\n" && n++, t.push(n + 1)) : r === "\n" && t.push(n + 1);
20
+ let n = [0];
21
+ for (let t = 0; t < e.length; t++) {
22
+ let r = e[t];
23
+ r === "\r" ? (e[t + 1] === "\n" && t++, n.push(t + 1)) : r === "\n" && n.push(t + 1);
24
24
  }
25
- let n = [], r = [], i = [], a = null, o = !1, s = 0, c = 0;
26
- for (let l = 0; l < t.length; l++) {
27
- let u = t[l], d = l + 1 < t.length ? t[l + 1] : e.length;
28
- for (; d > u && (e[d - 1] === "\r" || e[d - 1] === "\n");) d--;
29
- let f = e.slice(u, d), p = u, m = 0;
30
- for (; p < d;) {
31
- for (; e[p] === " " || e[p] === " ";) m += e[p] === " " ? 4 : 1, p++;
32
- if (e[p] === ">") {
33
- m++, p++;
25
+ let r = [], i = [], a = [], o = null, s = !1, c = 0, l = 0;
26
+ for (let u = 0; u < n.length; u++) {
27
+ let d = n[u], f = u + 1 < n.length ? n[u + 1] : e.length;
28
+ for (; f > d && (e[f - 1] === "\r" || e[f - 1] === "\n");) f--;
29
+ let p = e.slice(d, f), m = d, h = 0;
30
+ for (; m < f;) {
31
+ for (; e[m] === " " || e[m] === " ";) h += e[m] === " " ? 4 : 1, m++;
32
+ if (e[m] === ">") {
33
+ h++, m++;
34
34
  continue;
35
35
  }
36
- let t = /^(?:[-+*]|\d{1,9}[.)])(?=[ \t])/.exec(e.slice(p, d));
37
- if (t) m++, p += t[0].length;
36
+ let t = /^(?:[-+*]|\d{1,9}[.)])(?=[ \t])/.exec(e.slice(m, f));
37
+ if (t) h++, m += t[0].length;
38
38
  else break;
39
39
  }
40
- c = Math.max(c, m);
41
- let h = l === 0 && e.charCodeAt(0) === 65279 ? u + 1 : u, g = 0;
42
- for (; e[h + g] === " " || e[h + g] === " ";) g++;
43
- let _ = /^[ \t]*$/.test(e.slice(h, d)), v = h;
44
- for (let t = 0; t < 3 && e[v] === " "; t++) v++;
45
- let y = !1;
46
- if (a) {
47
- let t = e.slice(v, d), n = ee(t, 0);
48
- if (n && n.char === a.char && n.length >= a.length && /^[ \t]*$/.test(t.slice(n.length))) {
49
- a = null;
50
- let e = r[r.length - 1];
51
- e && (e.to = d);
40
+ l = Math.max(l, h);
41
+ let g = u === 0 && e.charCodeAt(0) === 65279 ? d + 1 : d, _ = 0;
42
+ for (; e[g + _] === " " || e[g + _] === " ";) _++;
43
+ let v = /^[ \t]*$/.test(e.slice(g, f)), y = g;
44
+ for (let t = 0; t < 3 && e[y] === " "; t++) y++;
45
+ let b = !1;
46
+ if (o) {
47
+ let n = e.slice(y, f), r = t(n, 0);
48
+ if (r && r.char === o.char && r.length >= o.length && /^[ \t]*$/.test(n.slice(r.length))) {
49
+ o = null;
50
+ let e = i[i.length - 1];
51
+ e && (e.to = f);
52
52
  }
53
- y = !0;
53
+ b = !0;
54
54
  } else {
55
- let t = e.slice(v, d), n = ee(t, 0);
56
- n && (n.char !== "`" || t.indexOf("`", n.length) < 0) && (a = {
57
- char: n.char,
58
- length: n.length
59
- }, y = !0, r.push({
60
- from: u,
55
+ let n = e.slice(y, f), r = t(n, 0);
56
+ r && (r.char !== "`" || n.indexOf("`", r.length) < 0) && (o = {
57
+ char: r.char,
58
+ length: r.length
59
+ }, b = !0, i.push({
60
+ from: d,
61
61
  to: e.length
62
62
  }));
63
63
  }
64
- let b = 0, x = 0;
65
- if (!y && !_) {
66
- let t = h;
64
+ let x = 0, S = 0;
65
+ if (!b && !v) {
66
+ let t = g;
67
67
  for (;;) {
68
68
  let n = t;
69
69
  for (let t = 0; t < 3 && e[n] === " "; t++) n++;
70
70
  if (e[n] !== ">") break;
71
- t = n + 1, e[t] === " " && t++, b++;
71
+ t = n + 1, e[t] === " " && t++, x++;
72
72
  }
73
73
  let n = t;
74
- for (; n < d && (e[n] === " " || e[n] === " ");) n++;
75
- let r = /^([-+*]|\d{1,9}[.)])(?=[ \t]|$)/.exec(e.slice(n, d)), a = n - t >= 4 && i.length === 0;
76
- if (r && !a) {
77
- let e = n - h;
78
- for (; i.length && i[i.length - 1] >= e;) i.pop();
79
- i.push(e);
74
+ for (; n < f && (e[n] === " " || e[n] === " ");) n++;
75
+ let r = /^([-+*]|\d{1,9}[.)])(?=[ \t]|$)/.exec(e.slice(n, f)), i = n - t >= 4 && a.length === 0;
76
+ if (r && !i) {
77
+ let e = n - g;
78
+ for (; a.length && a[a.length - 1] >= e;) a.pop();
79
+ a.push(e);
80
80
  } else {
81
81
  let e = n - t;
82
- for (; i.length && (e < i[i.length - 1] || o && e <= i[i.length - 1]);) i.pop();
82
+ for (; a.length && (e < a[a.length - 1] || s && e <= a[a.length - 1]);) a.pop();
83
83
  }
84
- x = b + i.length, x > s && (s = x);
84
+ S = x + a.length, S > c && (c = S);
85
85
  }
86
- o = !y && (_ || /^[ \t]*(?:>[ \t]*)*$/.test(f)), n.push({
87
- from: u,
88
- to: d,
89
- text: f,
90
- blank: _,
91
- indent: g,
92
- quoteDepth: b,
93
- fenced: y,
94
- depth: x
86
+ s = !b && (v || /^[ \t]*(?:>[ \t]*)*$/.test(p)), r.push({
87
+ from: d,
88
+ to: f,
89
+ text: p,
90
+ blank: v,
91
+ indent: _,
92
+ quoteDepth: x,
93
+ fenced: b,
94
+ depth: S
95
95
  });
96
96
  }
97
97
  return {
98
- lines: n,
99
- maxMarkdownDepth: s,
100
- potentialDepth: c,
101
- fenceSpans: r
98
+ lines: r,
99
+ maxMarkdownDepth: c,
100
+ potentialDepth: l,
101
+ fenceSpans: i
102
102
  };
103
103
  }
104
- var g = class {
104
+ var r = class {
105
105
  source;
106
106
  lineStarts = [0];
107
107
  logicalLines;
@@ -117,7 +117,7 @@ var g = class {
117
117
  return this.logicalLines = e;
118
118
  }
119
119
  get facts() {
120
- return this.factsValue ??= h(this.source);
120
+ return this.factsValue ??= n(this.source);
121
121
  }
122
122
  lineIndexAt(e) {
123
123
  let t = 0, n = this.lineStarts.length - 1;
@@ -130,7 +130,7 @@ var g = class {
130
130
  lineStartAt(e) {
131
131
  return this.lineStarts[this.lineIndexAt(e)];
132
132
  }
133
- }, _ = class {
133
+ }, i = class {
134
134
  context;
135
135
  chunks = [];
136
136
  segments = [];
@@ -192,17 +192,17 @@ var g = class {
192
192
  return n ? n.source + (e - n.from) * n.step : t;
193
193
  }
194
194
  };
195
- function v(e) {
195
+ function a(e) {
196
196
  if (typeof e != "string") return 0;
197
197
  let t = 0;
198
198
  for (let n of e) t += 1;
199
199
  return t;
200
200
  }
201
- function y(e, t) {
201
+ function o(e, t) {
202
202
  let n = e.slice(0, Math.max(0, t)), r = n.charCodeAt(n.length - 1);
203
203
  return r >= 55296 && r <= 56319 ? n.slice(0, -1) : n;
204
204
  }
205
- function* b(e, t = !1) {
205
+ function* s(e, t = !1) {
206
206
  let n = [{
207
207
  nodes: e,
208
208
  index: 0
@@ -221,8 +221,42 @@ function* b(e, t = !1) {
221
221
  }) : t && (yield r);
222
222
  }
223
223
  }
224
+ // src/local/observability-messages.ts
225
+ var c = Object.freeze({
226
+ "local.worker.timeout": {
227
+ en: "The background compilation request timed out after {timeoutMs} ms.",
228
+ zh: "编译 Worker 请求在 {timeoutMs} 毫秒后超时。"
229
+ },
230
+ "local.worker.error": {
231
+ en: "The background compiler failed while processing the request.",
232
+ zh: "编译 Worker 处理请求时失败。"
233
+ },
234
+ "local.worker.compile": {
235
+ en: "The background compiler could not complete this request.",
236
+ zh: "编译 Worker 无法完成此请求。"
237
+ },
238
+ "local.worker.compile.detail": {
239
+ en: "The background compiler could not complete this request: {detail}",
240
+ zh: "编译 Worker 无法完成此请求:{detail}"
241
+ },
242
+ "local.worker.stale-response": {
243
+ en: "The background compiler returned a response for an older source revision.",
244
+ zh: "编译 Worker 返回了较旧源码版本的响应。"
245
+ },
246
+ "local.export.failure": {
247
+ en: "The {stage} stage of export failed.",
248
+ zh: "导出流程的 {stage} 阶段失败。"
249
+ },
250
+ "local.resource.budget": {
251
+ en: "Resource {budget} used {actual} {unit}, exceeding the limit of {limit}.",
252
+ zh: "资源 {budget} 已使用 {actual} {unit},超过上限 {limit}。"
253
+ }
254
+ });
255
+ function l(e, t, n = {}) {
256
+ return c[e][t].replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g, (e, t) => String(n[t] ?? ""));
257
+ }
224
258
  // src/local/configuration/diagnostic-messages.ts
225
- var x = {
259
+ var u = {
226
260
  "local.version.unsupported": {
227
261
  en: "This reader accepts {supported}; migrate {declared} or use a compatible reader.",
228
262
  zh: "此阅读器支持 {supported};请迁移 {declared} 或使用兼容的阅读器。"
@@ -499,6 +533,54 @@ var x = {
499
533
  en: "Unsafe URL in attribute {name} was removed.",
500
534
  zh: "属性 {name} 中的不安全 URL 已移除。"
501
535
  },
536
+ "local.author.disabled": {
537
+ en: "Author {feature} is disabled by the compile options.",
538
+ zh: "编译选项已关闭作者 {feature}。"
539
+ },
540
+ "local.author.placement": {
541
+ en: "Use paired tags for this declaration.",
542
+ zh: "请使用成对标签声明此能力。"
543
+ },
544
+ "local.author.unclosed": {
545
+ en: "Close the <{name}> declaration.",
546
+ zh: "请补全 <{name}> 声明的结束标签。"
547
+ },
548
+ "local.author.css-placement": {
549
+ en: "Move document CSS before the body.",
550
+ zh: "请将文档 CSS 移到正文之前。"
551
+ },
552
+ "local.author.script-placement": {
553
+ en: "Place author JavaScript at the document’s top level.",
554
+ zh: "请将 JavaScript 声明放在文档顶层。"
555
+ },
556
+ "local.author.component-conflict": {
557
+ en: "The registered <{name}> component owns this tag.",
558
+ zh: "此标签归已注册的 <{name}> 组件。"
559
+ },
560
+ "local.author.css-owned": {
561
+ en: "<{name}> defines its own css attribute.",
562
+ zh: "<{name}> 自行定义了 css 属性。"
563
+ },
564
+ "local.author.css-hidden": {
565
+ en: "<{name}> has no visible root for a css declaration.",
566
+ zh: "<{name}> 没有可应用 css 声明的可见根元素。"
567
+ },
568
+ "local.author.css-global-rule": {
569
+ en: "Author CSS does not support the global rule @{name}.",
570
+ zh: "作者 CSS 暂不支持全局规则 @{name}。"
571
+ },
572
+ "local.author.action-invalid": {
573
+ en: "Invalid or unsupported action target \"{id}\".",
574
+ zh: "动作目标 \"{id}\" 无效或不受支持。"
575
+ },
576
+ "local.author.action-duplicate": {
577
+ en: "Duplicate action target \"{id}\".",
578
+ zh: "动作目标 \"{id}\" 重复。"
579
+ },
580
+ "local.author.fragment-tag": {
581
+ en: "Use a document declaration or an extended element instead of <{name}>.",
582
+ zh: "<{name}> 已按原文显示。请使用文档声明或扩展元素。"
583
+ },
502
584
  "html.capability": {
503
585
  en: "Author {feature} was disabled by the compile options.",
504
586
  zh: "编译选项已禁用作者提供的{feature}。"
@@ -1631,7 +1713,7 @@ var x = {
1631
1713
  en: "Dynamic {attribute} date bound for parameter {name} is not a valid YYYY-MM-DD value.",
1632
1714
  zh: "参数 {name} 的动态 {attribute} 日期边界不是合法的 YYYY-MM-DD。"
1633
1715
  }
1634
- }, S = {
1716
+ }, d = {
1635
1717
  "local.options.invalid.object": "options.notObject",
1636
1718
  "local.options.invalid.limits": "options.limitsNotObject",
1637
1719
  "local.options.invalid.max-syntax-nodes": "options.maxSyntaxNodes",
@@ -1924,57 +2006,57 @@ var x = {
1924
2006
  "local.runtime.value.option": "runtime.option",
1925
2007
  "local.runtime.value.budget": "runtime.budget",
1926
2008
  "local.runtime.value.range-order": "runtime.rangeOrder"
1927
- }, te = 16, C = 256, ne = 2e3;
1928
- function re(e) {
1929
- if (typeof e == "string") return e.length > C ? `${y(e, 255)}…` : e;
2009
+ }, f = 16, p = 256, m = 2e3;
2010
+ function h(e) {
2011
+ if (typeof e == "string") return e.length > p ? `${o(e, 255)}…` : e;
1930
2012
  if (typeof e == "number") return Number.isFinite(e) ? e : String(e);
1931
2013
  if (typeof e == "boolean" || e === null) return e;
1932
2014
  if (e === void 0) return "";
1933
2015
  try {
1934
2016
  let t = JSON.stringify(e) ?? String(e);
1935
- return t.length > C ? `${y(t, 255)}…` : t;
2017
+ return t.length > p ? `${o(t, 255)}…` : t;
1936
2018
  } catch {
1937
- return y(String(e), C);
2019
+ return o(String(e), p);
1938
2020
  }
1939
2021
  }
1940
- function ie(e) {
2022
+ function g(e) {
1941
2023
  let t = Object.entries(e);
1942
2024
  if (t.length === 0) return;
1943
2025
  let n = {}, r = 0, i = 0;
1944
2026
  for (let [e, a] of t) {
1945
- if (i >= te) break;
2027
+ if (i >= f) break;
1946
2028
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)) continue;
1947
2029
  let t;
1948
2030
  try {
1949
- t = re(a);
2031
+ t = h(a);
1950
2032
  } catch {
1951
2033
  t = "";
1952
2034
  }
1953
2035
  let o = typeof t == "string" ? t.length : String(t).length;
1954
- if (r + o > ne) break;
2036
+ if (r + o > m) break;
1955
2037
  n[e] = t, r += o, i += 1;
1956
2038
  }
1957
2039
  return i > 0 ? n : void 0;
1958
2040
  }
1959
- function w(e, t) {
1960
- let n = t ? ie(t) : void 0;
2041
+ function _(e, t) {
2042
+ let n = t ? g(t) : void 0;
1961
2043
  return n ? {
1962
2044
  key: e,
1963
2045
  params: n
1964
2046
  } : { key: e };
1965
2047
  }
1966
- var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.theme.expression,local.theme.name,local.theme.attribute,local.theme.malformed,local.theme.duplicate,local.theme.late,local.theme.nested,local.attribute,local.attribute.name,local.attribute.duplicate,local.budget.name,local.budget.math,local.tag.unclosed,local.tag.closing,local.tag.name,local.tag.mismatch,local.tag.shape,local.footnote.unsupported,local.interpolation,local.math.unclosed,local.math.whitespace,local.component.unknown,local.html,local.html.fallback,local.html.table,local.html.repair,local.html.literal,local.recovery.unclosed,local.recovery.mismatch,local.recovery.stray-close".split(","), oe = /* @__PURE__ */ "local.budget.data-table.cells,local.budget.data-table.columns,local.budget.data-table.rows,local.computation.budget,local.computation.const,local.computation.cycle,local.computation.duplicate,local.computation.expression,local.computation.name,local.computation.placement,local.computation.reserved,local.computation.unknown,local.external.placement,local.external.name,local.external.reserved,local.external.duplicate,local.external.conflict,local.external.type,local.host.structure,local.computation.value,local.data-table.column,local.data-table.key,local.data-table.rows,local.data-table.value,local.validation.budget,local.validation.expression,local.validation.failed,local.validation.fields,local.validation.placement,local.validation.when,local.parse,local.legacy,local.component.unknown,local.host.attribute,local.attribute.unknown,local.budget.attribute,local.attribute.color,local.attribute.required,local.label.required,local.attribute.static,local.expression.empty,local.expression.invalid,local.attribute.type,local.attribute.range,local.constraint,local.selection.key,local.structure.parent,local.structure.children,local.budget.array,local.option.value,local.tab.value,local.step.value,local.quiz.answer,local.diagram.node,local.diagram.edge,local.checklist.body,local.budget.identifier,local.binding.name,local.binding.reserved,local.binding.type,local.binding.exclusive,local.binding.constraint,local.binding.option,local.initial.duplicate,local.initial.length,local.initial.email,local.initial.range,local.initial.option,local.initial.type,local.initial.date,local.initial,local.initial.step,local.binding.unknown,local.type,local.interpolation,local.attribute.interpolation,local.anchor.id,local.anchor.duplicate,local.jump.target,local.budget.plot.curves,local.budget.plot.points,local.math.formula,local.math,local.math.display,local.math.binding,local.table.header,local.table.row,local.chart.numeric,local.chart.column,local.chart.negative,local.timeline.header,local.timeline.value,local.html.extended,local.html.attribute,local.html.unsafe-url,local.html.capability,local.capability.html,local.capability.plot".split(","), se = [
2048
+ var v = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.theme.expression,local.theme.name,local.theme.attribute,local.theme.malformed,local.theme.duplicate,local.theme.late,local.theme.nested,local.attribute,local.attribute.name,local.attribute.duplicate,local.budget.name,local.budget.math,local.tag.unclosed,local.tag.closing,local.tag.name,local.tag.mismatch,local.tag.shape,local.footnote.unsupported,local.interpolation,local.math.unclosed,local.math.whitespace,local.component.unknown,local.html,local.html.fallback,local.html.table,local.html.repair,local.html.literal,local.author.placement,local.author.unclosed,local.author.css-placement,local.author.script-placement,local.author.component-conflict,local.recovery.unclosed,local.recovery.mismatch,local.recovery.stray-close".split(","), y = /* @__PURE__ */ "local.budget.data-table.cells,local.budget.data-table.columns,local.budget.data-table.rows,local.computation.budget,local.computation.const,local.computation.cycle,local.computation.duplicate,local.computation.expression,local.computation.name,local.computation.placement,local.computation.reserved,local.computation.unknown,local.external.placement,local.external.name,local.external.reserved,local.external.duplicate,local.external.conflict,local.external.type,local.host.structure,local.computation.value,local.data-table.column,local.data-table.key,local.data-table.rows,local.data-table.value,local.validation.budget,local.validation.expression,local.validation.failed,local.validation.fields,local.validation.placement,local.validation.when,local.parse,local.legacy,local.component.unknown,local.host.attribute,local.attribute.unknown,local.budget.attribute,local.attribute.color,local.attribute.required,local.label.required,local.attribute.static,local.expression.empty,local.expression.invalid,local.attribute.type,local.attribute.range,local.constraint,local.selection.key,local.structure.parent,local.structure.children,local.budget.array,local.option.value,local.tab.value,local.step.value,local.quiz.answer,local.diagram.node,local.diagram.edge,local.checklist.body,local.budget.identifier,local.binding.name,local.binding.reserved,local.binding.type,local.binding.exclusive,local.binding.constraint,local.binding.option,local.initial.duplicate,local.initial.length,local.initial.email,local.initial.range,local.initial.option,local.initial.type,local.initial.date,local.initial,local.initial.step,local.binding.unknown,local.type,local.interpolation,local.attribute.interpolation,local.anchor.id,local.anchor.duplicate,local.jump.target,local.budget.plot.curves,local.budget.plot.points,local.math.formula,local.math,local.math.display,local.math.binding,local.table.header,local.table.row,local.chart.numeric,local.chart.column,local.chart.negative,local.timeline.header,local.timeline.value,local.html.extended,local.html.attribute,local.html.unsafe-url,local.html.capability,local.capability.html,local.capability.plot".split(","), b = [
1967
2049
  "local.runtime.binding",
1968
2050
  "local.runtime.value",
1969
2051
  "local.runtime.external"
1970
- ], ce = [
2052
+ ], x = [
1971
2053
  "local.theme.name",
1972
2054
  "local.theme.missing",
1973
2055
  "local.theme.manifest",
1974
2056
  "local.theme.duplicate",
1975
2057
  "local.theme.protocol",
1976
2058
  "local.theme.modes"
1977
- ], T = [
2059
+ ], S = [
1978
2060
  "expression-index",
1979
2061
  "expression-cycle",
1980
2062
  "expression-syntax",
@@ -1994,7 +2076,7 @@ var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.t
1994
2076
  "expression-domain",
1995
2077
  "expression-divide-by-zero",
1996
2078
  "expression-interpolation"
1997
- ], le = [
2079
+ ], C = [
1998
2080
  "latex-budget",
1999
2081
  "latex-syntax",
2000
2082
  "latex-empty",
@@ -2009,7 +2091,13 @@ var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.t
2009
2091
  "latex-undefined",
2010
2092
  "latex-plot-range",
2011
2093
  "latex-plot-samples"
2012
- ], ue = [
2094
+ ], w = [
2095
+ ...Object.keys(c),
2096
+ "local.worker.compile",
2097
+ "local.build.resource-budget",
2098
+ "local.extension.resource-budget",
2099
+ "local.extension.resource-conflict",
2100
+ "local.extension.resource-invalid",
2013
2101
  "local.version.unsupported",
2014
2102
  "local.version.malformed",
2015
2103
  "local.version.duplicate",
@@ -2020,101 +2108,76 @@ var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.t
2020
2108
  "local.upgrade.text-length",
2021
2109
  "local.upgrade.expression",
2022
2110
  "local.upgrade.version-missing",
2023
- ...ae,
2024
- ...oe,
2025
- ...se,
2026
- ...ce
2027
- ], E = Object.freeze(Array.from(/* @__PURE__ */ new Set([
2028
- ...ue,
2029
- ...T,
2030
- ...T.map((e) => `local.expression.${e}`),
2031
- ...le
2032
- ]))), de = Object.freeze([...Object.keys(S), ...Object.keys(x).filter((e) => e.startsWith("error."))].sort());
2111
+ ...v,
2112
+ ...y,
2113
+ ...b,
2114
+ ...x
2115
+ ], T = Object.freeze(Array.from(/* @__PURE__ */ new Set([
2116
+ ...w,
2117
+ ...S,
2118
+ ...S.map((e) => `local.expression.${e}`),
2119
+ ...C
2120
+ ]))), E = Object.freeze([
2121
+ ...Object.keys(d),
2122
+ ...Object.keys(u).filter((e) => e.startsWith("error.")),
2123
+ ...Object.keys(c)
2124
+ ].sort());
2033
2125
  function D(e) {
2034
- if (Object.hasOwn(S, e)) return S[e];
2035
- if (Object.hasOwn(x, e)) return e;
2126
+ if (Object.hasOwn(d, e)) return d[e];
2127
+ if (Object.hasOwn(u, e)) return e;
2036
2128
  }
2037
2129
  function O(e, t = "en") {
2130
+ if (Object.hasOwn(c, e)) return c[e][t === "zh" ? "zh" : "en"];
2038
2131
  let n = D(e);
2039
- if (n) return x[n][t === "zh" ? "zh" : "en"];
2132
+ if (n) return u[n][t === "zh" ? "zh" : "en"];
2040
2133
  }
2041
- function fe(e) {
2042
- return typeof e == "string" && E.includes(e);
2134
+ function k(e) {
2135
+ return typeof e == "string" && T.includes(e);
2043
2136
  }
2044
- function k(e, t) {
2137
+ function A(e, t) {
2045
2138
  return t ? e.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => {
2046
2139
  let r = t[n];
2047
2140
  return r === void 0 ? "" : String(r);
2048
2141
  }) : e;
2049
2142
  }
2050
- function A(e, t = "en", n) {
2143
+ function j(e, t = "en", n) {
2051
2144
  let r = O(e, t);
2052
- return r === void 0 ? "" : k(r, n);
2145
+ return r === void 0 ? "" : A(r, n);
2053
2146
  }
2054
- function j(e) {
2055
- return A(e.key, "en", e.params);
2147
+ function M(e) {
2148
+ return j(e.key, "en", e.params);
2056
2149
  }
2057
- function pe(e, t = "en") {
2058
- let n = typeof e.messageKey == "string" ? e.messageKey : void 0, r = n === void 0 ? void 0 : O(n, t), i = e.params;
2059
- if (t === "zh" && i) {
2060
- let e = n === void 0 ? void 0 : D(n);
2150
+ function N(t, n = "en") {
2151
+ let r = typeof t.messageKey == "string" ? t.messageKey : void 0, i = r === void 0 ? void 0 : O(r, n), a = t.params ?? t.details;
2152
+ if (n === "zh" && a) {
2153
+ let e = r === void 0 ? void 0 : D(r);
2061
2154
  if (e === "expression.error" || e === "math.computeFailed") {
2062
- let e = typeof i.code == "string" ? O(`error.${i.code}`, "zh") : void 0;
2155
+ let e = typeof a.code == "string" ? O(`error.${a.code}`, "zh") : void 0;
2063
2156
  if (e) {
2064
- let t = typeof i.near == "string" && i.near ? ` 相关源码:${i.near}` : "";
2065
- i = {
2066
- ...i,
2157
+ let t = typeof a.near == "string" && a.near ? ` 相关源码:${a.near}` : "";
2158
+ a = {
2159
+ ...a,
2067
2160
  detail: e + t
2068
2161
  };
2069
2162
  }
2070
- } else if (e === "runtime.budget" && typeof i.detailKey == "string") {
2071
- let e = O(i.detailKey, "zh");
2072
- e && (i = {
2073
- ...i,
2074
- detail: k(e, i)
2163
+ } else if (e === "runtime.budget" && typeof a.detailKey == "string") {
2164
+ let e = O(a.detailKey, "zh");
2165
+ e && (a = {
2166
+ ...a,
2167
+ detail: A(e, a)
2075
2168
  });
2076
2169
  }
2077
2170
  }
2078
- let a = r === void 0 ? typeof e.message == "string" ? e.message : String(e.message ?? "") : k(r, i), o = typeof a == "string" ? a : String(a ?? "");
2079
- return o.length > 2e3 ? `${y(o, u - 1)}…` : o;
2080
- }
2081
- // src/local/html/html-names.ts
2082
- var M = /* @__PURE__ */ new Set(/* @__PURE__ */ "b.strong.i.em.s.del.u.mark.sup.sub.br.hr.img.p.h1.h2.h3.h4.h5.h6.div.span.details.summary.blockquote.code.pre.ul.ol.li.a".split(".")), me = /* @__PURE__ */ new Set([
2083
- "div",
2084
- "p",
2085
- "h1",
2086
- "h2",
2087
- "h3",
2088
- "h4",
2089
- "h5",
2090
- "h6"
2091
- ]);
2092
- function he(e) {
2093
- let t = e.trim().toLowerCase();
2094
- return t === "left" || t === "center" || t === "right" || t === "justify" ? t : null;
2095
- }
2096
- var ge = /* @__PURE__ */ new Set([
2097
- "href",
2098
- "target",
2099
- "rel"
2100
- ]);
2101
- function _e(e, t) {
2102
- if (t?.toLowerCase() !== "_blank") return e;
2103
- let n = [], r = /* @__PURE__ */ new Set();
2104
- for (let t of (e ?? "").split(/[\t\n\f\r ]+/)) {
2105
- let e = t.toLowerCase();
2106
- t && e !== "opener" && !r.has(e) && (r.add(e), n.push(t));
2107
- }
2108
- for (let e of ["noopener", "noreferrer"]) r.has(e) || n.push(e);
2109
- return n.join(" ");
2171
+ let s = i === void 0 ? typeof t.message == "string" ? t.message : String(t.message ?? "") : A(i, a), c = typeof s == "string" ? s : String(s ?? "");
2172
+ return c.length > 2e3 ? `${o(c, e - 1)}…` : c;
2110
2173
  }
2111
2174
  // src/themes/document-theme.ts
2112
- var N = "reactive-md-theme-1", P = Object.freeze({
2175
+ var P = "reactive-md-theme-1", F = Object.freeze({
2113
2176
  name: "default",
2114
- protocol: N,
2177
+ protocol: P,
2115
2178
  colorSchemes: Object.freeze(["light", "dark"])
2116
2179
  });
2117
- function ve(e, t) {
2180
+ function I(e, t) {
2118
2181
  let n = typeof t == "string" ? t.length : Infinity;
2119
2182
  if (!e || typeof e.start != "number" || typeof e.end != "number" || !Number.isFinite(e.start) || !Number.isFinite(e.end)) return {
2120
2183
  start: 0,
@@ -2126,7 +2189,7 @@ function ve(e, t) {
2126
2189
  end: Math.max(r, Math.min(n, Math.floor(e.end)))
2127
2190
  };
2128
2191
  }
2129
- function ye(e, t) {
2192
+ function L(e, t) {
2130
2193
  if (typeof e != "string" || e.length === 0) return {
2131
2194
  line: 1,
2132
2195
  column: 1
@@ -2138,11 +2201,11 @@ function ye(e, t) {
2138
2201
  column: t - i + 1
2139
2202
  };
2140
2203
  }
2141
- function be(e, t, n, r) {
2142
- let i = ve(n, r), { line: a, column: o } = ye(r, i.start);
2204
+ function R(e, t, n, r) {
2205
+ let i = I(n, r), { line: a, column: o } = L(r, i.start);
2143
2206
  return {
2144
2207
  code: e,
2145
- message: j(t),
2208
+ message: M(t),
2146
2209
  severity: "warning",
2147
2210
  range: i,
2148
2211
  line: a,
@@ -2151,605 +2214,52 @@ function be(e, t, n, r) {
2151
2214
  ...t.params ? { params: t.params } : {}
2152
2215
  };
2153
2216
  }
2154
- function xe(e, t, n, r) {
2217
+ function z(e, t, n, r) {
2155
2218
  let i = (e, t) => ({
2156
- name: P.name,
2157
- diagnostics: [be(e, t, n, r)]
2219
+ name: F.name,
2220
+ diagnostics: [R(e, t, n, r)]
2158
2221
  }), a = e;
2159
2222
  if (a == null || a === "") return {
2160
- name: P.name,
2223
+ name: F.name,
2161
2224
  diagnostics: []
2162
2225
  };
2163
- if (!F(a)) return i("local.theme.name", w("local.theme.name", {
2226
+ if (!V(a)) return i("local.theme.name", _("local.theme.name", {
2164
2227
  name: String(a),
2165
2228
  limit: 64
2166
2229
  }));
2167
2230
  let o = a;
2168
- if (o === P.name) return {
2169
- name: P.name,
2231
+ if (o === F.name) return {
2232
+ name: F.name,
2170
2233
  diagnostics: []
2171
2234
  };
2172
- if (!Array.isArray(t)) return i("local.theme.missing", w("local.theme.missing", { name: o }));
2235
+ if (!Array.isArray(t)) return i("local.theme.missing", _("local.theme.missing", { name: o }));
2173
2236
  let s = 0, c = null;
2174
2237
  try {
2175
2238
  for (let e of t) typeof e == "object" && e && !Array.isArray(e) && e.name === o && (s += 1, c = e);
2176
2239
  } catch {
2177
- return i("local.theme.manifest", w("local.theme.manifest.unreadable"));
2240
+ return i("local.theme.manifest", _("local.theme.manifest.unreadable"));
2178
2241
  }
2179
- if (s === 0) return i("local.theme.missing", w("local.theme.missing", { name: o }));
2180
- if (s > 1) return i("local.theme.duplicate", w("local.theme.duplicate", { name: o }));
2242
+ if (s === 0) return i("local.theme.missing", _("local.theme.missing", { name: o }));
2243
+ if (s > 1) return i("local.theme.duplicate", _("local.theme.duplicate", { name: o }));
2181
2244
  try {
2182
2245
  let e = c;
2183
- if (!e || typeof e != "object") return i("local.theme.manifest", w("local.theme.manifest.definition", { name: o }));
2184
- if (e.protocol !== "reactive-md-theme-1") return i("local.theme.protocol", w("local.theme.protocol", {
2246
+ if (!e || typeof e != "object") return i("local.theme.manifest", _("local.theme.manifest.definition", { name: o }));
2247
+ if (e.protocol !== "reactive-md-theme-1") return i("local.theme.protocol", _("local.theme.protocol", {
2185
2248
  name: o,
2186
- protocol: N
2249
+ protocol: P
2187
2250
  }));
2188
2251
  let t = e.colorSchemes;
2189
- if (!Array.isArray(t) || !t.includes("light") || !t.includes("dark")) return i("local.theme.modes", w("local.theme.modes", { name: o }));
2252
+ if (!Array.isArray(t) || !t.includes("light") || !t.includes("dark")) return i("local.theme.modes", _("local.theme.modes", { name: o }));
2190
2253
  } catch {
2191
- return i("local.theme.manifest", w("local.theme.manifest.selected", { name: o }));
2254
+ return i("local.theme.manifest", _("local.theme.manifest.selected", { name: o }));
2192
2255
  }
2193
2256
  return {
2194
2257
  name: o,
2195
2258
  diagnostics: []
2196
2259
  };
2197
2260
  }
2198
- var Se = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
2199
- function F(e) {
2200
- return typeof e == "string" && e.length > 0 && e.length <= 64 && Se.test(e);
2201
- }
2202
- var I = Object.freeze([
2203
- Object.freeze({
2204
- name: "computed",
2205
- form: "leaf",
2206
- childRule: "none",
2207
- label: "none",
2208
- props: {
2209
- name: {
2210
- kind: "string",
2211
- static: !0,
2212
- required: !0
2213
- },
2214
- value: {
2215
- kind: "string",
2216
- required: !0
2217
- }
2218
- },
2219
- structure: {
2220
- rule: "none",
2221
- label: "none"
2222
- },
2223
- rules: [{
2224
- kind: "require-full-interpolation",
2225
- attributes: ["value"]
2226
- }]
2227
- }),
2228
- Object.freeze({
2229
- name: "const",
2230
- form: "leaf",
2231
- childRule: "none",
2232
- label: "none",
2233
- props: {
2234
- name: {
2235
- kind: "string",
2236
- static: !0,
2237
- required: !0
2238
- },
2239
- value: {
2240
- kind: "string",
2241
- required: !0
2242
- }
2243
- },
2244
- structure: {
2245
- rule: "none",
2246
- label: "none"
2247
- },
2248
- rules: [{
2249
- kind: "require-full-interpolation",
2250
- attributes: ["value"]
2251
- }]
2252
- }),
2253
- Object.freeze({
2254
- name: "external",
2255
- form: "leaf",
2256
- childRule: "none",
2257
- label: "none",
2258
- props: {
2259
- name: {
2260
- kind: "string",
2261
- static: !0,
2262
- required: !0
2263
- },
2264
- type: {
2265
- kind: "enum",
2266
- static: !0,
2267
- required: !0,
2268
- values: [
2269
- "string",
2270
- "number",
2271
- "boolean",
2272
- "string-array",
2273
- "number-array"
2274
- ]
2275
- }
2276
- },
2277
- structure: {
2278
- rule: "none",
2279
- label: "none"
2280
- }
2281
- })
2282
- ]);
2283
- function Ce(e, t) {
2284
- let n = Array.from({ length: t.length + 1 }, (e, t) => t);
2285
- for (let r = 1; r <= e.length; r++) {
2286
- let i = n[0];
2287
- n[0] = r;
2288
- for (let a = 1; a <= t.length; a++) {
2289
- let o = n[a];
2290
- n[a] = Math.min(n[a] + 1, n[a - 1] + 1, i + (e[r - 1] === t[a - 1] ? 0 : 1)), i = o;
2291
- }
2292
- }
2293
- return n[t.length];
2294
- }
2295
- function we(e, t) {
2296
- let n, r = Infinity;
2297
- for (let i of t) {
2298
- let t = Ce(e, i);
2299
- t < r && (n = i, r = t);
2300
- }
2301
- return r <= 2 ? n : void 0;
2302
- }
2303
- // src/sdk/compat-profile.ts
2304
- var L = Object.freeze([Object.freeze({
2305
- name: "reactive-md-config/v1@0.7.0",
2306
- protocol: t,
2307
- sdkRange: "0.7.0",
2308
- targetProtocol: r,
2309
- targetSdkRange: "0.7.0",
2310
- preset: Object.freeze({
2311
- id: "reactive-md/default",
2312
- version: "0.7.0"
2313
- }),
2314
- legacyKeys: Object.freeze([Object.freeze({
2315
- profile: t,
2316
- algorithm: "external-components/v1"
2317
- })]),
2318
- source: "git tag v0.7.0:src/presets/default.ts and src/sdk/config.ts; docs/compatibility/compatibility-ch.md"
2319
- })]);
2320
- function R(e, t = L) {
2321
- for (let n of t) if (n.preset.id === e.id && n.preset.version === e.version) return n;
2322
- }
2323
- function Te(e = []) {
2324
- return e.length === 0 ? L : Object.freeze([...L, ...e]);
2325
- }
2326
- // src/sdk/assembly.ts
2327
- var Ee = /* @__PURE__ */ new Set([
2328
- "protocol",
2329
- "presets",
2330
- "components",
2331
- "replacementPolicy",
2332
- "themes"
2333
- ]), z = 32, B = 256, V = 32;
2334
- function H(e, t) {
2335
- throw Error(`Invalid local SDK config (${e}): ${t}`);
2336
- }
2337
- function U(e, t) {
2338
- return e < t ? -1 : +(e > t);
2339
- }
2340
- function W(e, t) {
2341
- return [...e].sort((e, n) => U(t(e), t(n)));
2342
- }
2343
- function G(e) {
2344
- if (typeof e != "object" || !e || Array.isArray(e)) return !1;
2345
- let t = Object.getPrototypeOf(e);
2346
- return t === Object.prototype || t === null;
2347
- }
2348
- function K(e) {
2349
- if (Array.isArray(e)) return e.map(K);
2350
- if (G(e)) {
2351
- let t = {};
2352
- for (let n of Object.keys(e).sort(U)) t[n] = K(e[n]);
2353
- return t;
2354
- }
2355
- return e;
2356
- }
2357
- function q(e, t) {
2358
- return JSON.stringify(K(e)) === JSON.stringify(K(t));
2359
- }
2360
- function De(e) {
2361
- Array.isArray(e) || H("assembly.presets", "must be an array."), e.length > z && H("assembly.presets", `accepts at most ${z} packages.`);
2362
- let t = W(e.map((e, t) => {
2363
- try {
2364
- return m(e);
2365
- } catch (e) {
2366
- H(`assembly.presets[${t}]`, e instanceof Error ? e.message : String(e));
2367
- }
2368
- }), (e) => e.id), n = /* @__PURE__ */ new Set();
2369
- for (let e of t) n.has(e.id) && H("assembly.presets", `preset "${e.id}" is selected more than once.`), n.add(e.id);
2370
- return Object.freeze(t);
2371
- }
2372
- function Oe(e) {
2373
- Array.isArray(e) || H("assembly.components", "must be an array."), e.length > B && H("assembly.components", `accepts at most ${B} components.`);
2374
- let t = W(e.map((e, t) => {
2375
- try {
2376
- return o(e);
2377
- } catch (e) {
2378
- H(`assembly.components[${t}]`, e instanceof Error ? e.message : String(e));
2379
- }
2380
- }), (e) => e.id);
2381
- return Object.freeze(t);
2382
- }
2383
- function ke(e) {
2384
- Array.isArray(e) || H("assembly.themes", "must be an array."), e.length > V && H("assembly.themes", `accepts at most ${V} themes.`);
2385
- let t = /* @__PURE__ */ new Set();
2386
- return Object.freeze(W(e.map((e, n) => {
2387
- G(e) || H(`assembly.themes[${n}]`, "must be an object.");
2388
- let r = e.id, i = e.name, a = e.version;
2389
- return (typeof r != "string" || r.length === 0) && H(`assembly.themes[${n}].id`, "must be a non-empty string."), (typeof i != "string" || i.length === 0) && H(`assembly.themes[${n}].name`, "must be a non-empty string."), typeof a == "string" && l(a) || H(`assembly.themes[${n}].version`, "must be a semantic version."), t.has(r) && H("assembly.themes", `theme id "${r}" is declared more than once.`), t.add(r), Object.freeze({ ...e });
2390
- }), (e) => e.id));
2391
- }
2392
- function Ae(e) {
2393
- G(e) || H("assembly", "must be an object.");
2394
- for (let t of Object.keys(e)) Ee.has(t) || H("assembly", `unknown field "${t}".`);
2395
- e.protocol !== "reactive-md-assembly/v1" && H("assembly.protocol", `must be "${s}".`);
2396
- let t = e.replacementPolicy;
2397
- return t !== "allow" && t !== "forbid" && H("assembly.replacementPolicy", "must be \"allow\" or \"forbid\"."), Object.freeze({
2398
- protocol: s,
2399
- presets: De(e.presets),
2400
- components: Oe(e.components),
2401
- replacementPolicy: t,
2402
- themes: ke(e.themes)
2403
- });
2404
- }
2405
- function je(e) {
2406
- let t = new Map(e.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map(), r = [], i = (e) => {
2407
- let a = n.get(e);
2408
- if (a === "done") return;
2409
- a === "visiting" && H("assembly.presets", `preset dependency cycle at "${e}".`);
2410
- let o = t.get(e);
2411
- o || H("assembly.presets", `missing preset dependency "${e}".`), n.set(e, "visiting");
2412
- for (let e of W(o.dependencies ?? [], (e) => e.id)) {
2413
- let n = t.get(e.id);
2414
- n || H("assembly.presets", `preset "${o.id}" requires missing preset "${e.id}".`), l(e.version) || H("assembly.presets", `preset dependency "${e.id}" must use an exact version.`), n.version !== e.version && H("assembly.presets", `preset "${o.id}" requires "${e.id}" ${e.version}, but ${n.version} is installed.`), i(e.id);
2415
- }
2416
- n.set(e, "done"), r.push(o);
2417
- };
2418
- for (let e of [...t.keys()].sort(U)) i(e);
2419
- return Object.freeze(r);
2420
- }
2421
- function J(e) {
2422
- let { description: t, ...n } = e;
2423
- return n;
2424
- }
2425
- function Y(e) {
2426
- return e.structure ?? d(e.children) ?? null;
2427
- }
2428
- function Me(e, t) {
2429
- for (let n of [
2430
- "interactive",
2431
- "static",
2432
- "ssr",
2433
- "offline"
2434
- ]) if (t.capabilities[n] && !e.capabilities[n]) return !1;
2435
- return !0;
2436
- }
2437
- function Ne(e, t) {
2438
- let n = e.definition, r = t.definition, i = `assembly.replacements["${n.id}"]`;
2439
- (n.id !== r.id || n.name !== r.name) && H(i, "the replacement must keep the target id and tag name."), n.form !== r.form && H(i, "the replacement must keep the target form.");
2440
- for (let e of Object.keys(n.props)) {
2441
- let t = n.props[e], a = r.props[e];
2442
- a || H(i, `the replacement removed prop "${e}".`), q(J(t), J(a)) || H(i, `the replacement changed the semantics of prop "${e}".`);
2443
- }
2444
- for (let e of Object.keys(r.props)) Object.hasOwn(n.props, e) || r.props[e].required === !0 && H(i, `the replacement added required prop "${e}".`);
2445
- let a = n.bindings ?? {}, o = r.bindings ?? {}, s = Object.keys(a).sort(U);
2446
- q(s, Object.keys(o).sort(U)) || H(i, "the replacement must keep the target binding slots unchanged.");
2447
- for (let e of s) q(a[e], o[e]) || H(i, `the replacement changed binding slot "${e}".`);
2448
- q(Y(n), Y(r)) || H(i, "the replacement changed the target child structure."), q(n.rules ?? [], r.rules ?? []) || H(i, "the replacement changed semantic rules."), q(n.slotRelations ?? [], r.slotRelations ?? []) || H(i, "the replacement changed slot relations."), n.legacyHost === !0 != (r.legacyHost === !0) && H(i, "the replacement changed legacyHost."), Me(r, n) || H(i, "the replacement downgraded a declared capability.");
2449
- }
2450
- function Pe(e, t) {
2451
- return e.id === t.id ? t.version === void 0 || a(t.version) !== null && n(e.version, t.version) : !1;
2452
- }
2453
- function Fe(e, t) {
2454
- return Object.freeze({
2455
- id: e.definition.id,
2456
- name: e.definition.name,
2457
- fromVersion: e.definition.version,
2458
- toVersion: t.definition.version,
2459
- fromDigest: c(e.definition),
2460
- toDigest: c(t.definition),
2461
- ...e.origin.kind === "preset" ? { fromPreset: e.origin.id } : {},
2462
- ...t.origin.kind === "preset" ? { toPreset: t.origin.id } : {}
2463
- });
2464
- }
2465
- function Ie(e, t) {
2466
- let n = [], r = 0;
2467
- for (let t of e) for (let e of t.components) n.push({
2468
- definition: e,
2469
- origin: {
2470
- kind: "preset",
2471
- id: t.id
2472
- },
2473
- index: r
2474
- }), r += 1;
2475
- for (let e of W(t, (e) => e.id)) n.push({
2476
- definition: e,
2477
- origin: { kind: "external" },
2478
- index: r
2479
- }), r += 1;
2480
- return n;
2481
- }
2482
- function Le(e) {
2483
- let t = /* @__PURE__ */ new Map();
2484
- for (let n of e) n.authoring !== void 0 && n.authoring.length !== 0 && t.set(n.id, new Map(n.authoring.map((e) => [e.componentId, e.authoring])));
2485
- return t;
2486
- }
2487
- function X(e, t) {
2488
- return t === void 0 ? e : e === void 0 ? t : Object.freeze({
2489
- ...e.title === void 0 ? {} : { title: e.title },
2490
- ...e.description === void 0 ? {} : { description: e.description },
2491
- ...e.category === void 0 ? {} : { category: e.category },
2492
- ...e.insertText === void 0 ? {} : { insertText: e.insertText },
2493
- ...t.title === void 0 ? {} : { title: t.title },
2494
- ...t.description === void 0 ? {} : { description: t.description },
2495
- ...t.category === void 0 ? {} : { category: t.category },
2496
- ...t.insertText === void 0 ? {} : { insertText: t.insertText }
2497
- });
2498
- }
2499
- function Z(e, t) {
2500
- let n = e.origin.kind === "preset" ? t.get(e.origin.id)?.get(e.definition.id) : void 0;
2501
- return X(e.definition.authoring, n);
2502
- }
2503
- function Re(e, t) {
2504
- return t === void 0 || t === e.authoring ? e : o({
2505
- ...e,
2506
- authoring: t
2507
- });
2508
- }
2509
- function ze(e, t, n) {
2510
- let r = /* @__PURE__ */ new Map();
2511
- for (let t of e) {
2512
- let e = r.get(t.definition.id);
2513
- e ? e.push(t) : r.set(t.definition.id, [t]);
2514
- }
2515
- let i = [], a = [];
2516
- for (let e of r.values()) {
2517
- if (e.length === 1) {
2518
- let r = e[0];
2519
- r.definition.replaces !== void 0 && (t === "forbid" && H("assembly.replacements", `replacement for "${r.definition.id}" is forbidden.`), H("assembly.replacements", `replacement for "${r.definition.id}" has no base contribution.`));
2520
- let a = Z(r, n);
2521
- i.push({
2522
- ...r,
2523
- position: r.index,
2524
- ...a === void 0 ? {} : { authoring: a }
2525
- });
2526
- continue;
2527
- }
2528
- let r = e.filter((e) => e.definition.replaces !== void 0);
2529
- t === "forbid" && r.length > 0 && H("assembly.replacements", `replacement for "${e[0].definition.id}" is forbidden.`), r.length === 0 && H("assembly.components", `component id "${e[0].definition.id}" is declared more than once.`), r.length > 1 && H("assembly.replacements", `component id "${e[0].definition.id}" has more than one replacement.`), e.length > 2 && H("assembly.replacements", `component id "${e[0].definition.id}" has ambiguous base contributions.`);
2530
- let o = r[0], s = e.filter((e) => e !== o);
2531
- s.length !== 1 && H("assembly.replacements", `component id "${e[0].definition.id}" must have exactly one base.`);
2532
- let c = s[0];
2533
- c.definition.replaces !== void 0 && H("assembly.replacements", `component id "${e[0].definition.id}" uses a replacement chain.`);
2534
- let l = o.definition.replaces;
2535
- Pe(c.definition, l) || H("assembly.replacements", `replacement for "${c.definition.id}" does not match base version ${c.definition.version}.`), Ne(c, o);
2536
- let u = X(Z(c, n), Z(o, n));
2537
- i.push({
2538
- ...o,
2539
- position: c.index,
2540
- ...u === void 0 ? {} : { authoring: u }
2541
- }), a.push(Fe(c, o));
2542
- }
2543
- return i.sort((e, t) => e.position - t.position), {
2544
- active: Object.freeze(i),
2545
- replacements: Object.freeze(W(a, (e) => e.id))
2546
- };
2547
- }
2548
- function Be(t) {
2549
- let r = /* @__PURE__ */ new Map(), i = new Map(t.map((e) => [e.definition.id, e.definition]));
2550
- for (let a of t) {
2551
- let t = a.definition, o = r.get(t.name);
2552
- o !== void 0 && ((o.origin.kind === "preset" || a.origin.kind === "preset") && H("assembly.components", `name "${t.name}" conflicts with a built-in component "${o.definition.id}".`), H("assembly.components", `component name "${t.name}" is declared more than once by "${o.definition.id}" and "${t.id}".`)), r.set(t.name, a);
2553
- let s = t.requires?.kernel;
2554
- s !== void 0 && !n("0.7.0", s) && H("assembly.components", `component "${t.id}" requires kernel ${s}, but ${e} is installed.`);
2555
- for (let e of t.dependencies ?? []) {
2556
- let r = i.get(e.id);
2557
- r || H("assembly.dependencies", `component "${t.id}" requires missing component "${e.id}".`), e.version !== void 0 && !n(r.version, e.version) && H("assembly.dependencies", `component "${t.id}" requires "${e.id}" ${e.version}, but version ${r.version} is installed.`);
2558
- }
2559
- }
2560
- let a = /* @__PURE__ */ new Map(), o = (e, t) => {
2561
- let n = a.get(e);
2562
- if (n !== "done") {
2563
- n === "visiting" && H("assembly.dependencies", `dependency cycle: ${[...t, e].join(" -> ")}.`), a.set(e, "visiting");
2564
- for (let n of i.get(e)?.dependencies ?? []) i.has(n.id) && o(n.id, [...t, e]);
2565
- a.set(e, "done");
2566
- }
2567
- };
2568
- for (let e of [...i.keys()].sort(U)) o(e, []);
2569
- }
2570
- function Ve(e, t) {
2571
- let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = (e, t) => {
2572
- n.get(e.id) && H("assembly.themes", `theme id "${e.id}" is declared by both ${t} and another source.`), r.get(e.name) && H("assembly.themes", `theme name "${e.name}" is declared by both ${t} and another source.`), n.set(e.id, e), r.set(e.name, e);
2573
- };
2574
- for (let t of e) for (let e of t.themes ?? []) i(e, `preset:${t.id}`);
2575
- for (let e of t) i(e, "external");
2576
- return Object.freeze(W([...n.values()], (e) => e.id));
2577
- }
2578
- function He(e) {
2579
- return Object.freeze(W(e.map((e) => ({
2580
- id: e.id,
2581
- version: e.version,
2582
- digest: p(e)
2583
- })), (e) => e.id));
2584
- }
2585
- function Ue(e, t, n) {
2586
- let a = JSON.stringify({
2587
- protocol: r,
2588
- presets: W(e, (e) => e.id),
2589
- registry: [...t].map((e) => ({
2590
- id: e.id,
2591
- name: e.name,
2592
- version: e.version,
2593
- digest: c(e)
2594
- })).sort((e, t) => U(e.id, t.id)),
2595
- replacements: W(n, (e) => e.id)
2596
- });
2597
- return i(a);
2598
- }
2599
- function Q(e, n) {
2600
- let r = JSON.stringify({
2601
- protocol: t,
2602
- presets: [{
2603
- id: e.id,
2604
- version: e.version
2605
- }],
2606
- components: [...n].map((e) => ({
2607
- id: e.id,
2608
- version: e.version,
2609
- digest: c(e)
2610
- })).sort((e, t) => U(e.id, t.id))
2611
- });
2612
- return i(r);
2613
- }
2614
- function We(e, t = {}) {
2615
- let n = je(e.presets), r = ze(Ie(n, e.components), e.replacementPolicy, Le(n));
2616
- Be(r.active);
2617
- let i = Object.freeze(r.active.map((e) => Re(e.definition, e.authoring))), a = Object.freeze(W(r.active.filter((e) => e.origin.kind === "external").map((e) => e.definition), (e) => e.id)), o = He(n), s = Ve(n, e.themes), c = Ue(o, i, r.replacements), l = [], u = t.legacyProfiles === void 0 || n.length !== 1 || r.replacements.length !== 0 ? void 0 : R({
2618
- id: n[0].id,
2619
- version: n[0].version
2620
- }, t.legacyProfiles), d = u?.legacyKeys[0];
2621
- return u !== void 0 && d !== void 0 && l.push(Object.freeze({
2622
- profile: d.profile,
2623
- key: Q(u.preset, a)
2624
- })), Object.freeze({
2625
- presets: o,
2626
- components: a,
2627
- replacements: r.replacements,
2628
- registry: i,
2629
- themes: s,
2630
- key: c,
2631
- legacyKeys: Object.freeze(l)
2632
- });
2633
- }
2634
- function Ge(e, t, n = t.legacyKeys) {
2635
- return Object.freeze({
2636
- protocol: r,
2637
- assembly: e,
2638
- key: t.key,
2639
- presets: t.presets,
2640
- components: t.components,
2641
- replacements: t.replacements,
2642
- registry: t.registry,
2643
- themes: t.themes,
2644
- legacyKeys: Object.freeze(n)
2645
- });
2646
- }
2647
- function Ke(e) {
2648
- return Object.freeze({
2649
- protocol: "reactive-md-assembly-seal/v1",
2650
- configKey: e.key,
2651
- presets: Object.freeze(W(e.presets, (e) => e.id)),
2652
- components: Object.freeze(W(e.registry.map(f), (e) => e.id)),
2653
- replacements: Object.freeze(W(e.replacements, (e) => e.id)),
2654
- legacyKeys: Object.freeze(W(e.legacyKeys, (e) => e.key))
2655
- });
2656
- }
2657
- function qe(e) {
2658
- return i(JSON.stringify(Ke(e)));
2659
- }
2660
- function Je(e, t) {
2661
- return e.key === t || e.legacyKeys.some((e) => e.key === t);
2662
- }
2663
- // src/sdk/config-validation.ts
2664
- var Ye = 16777216, Xe = /* @__PURE__ */ new Set([
2665
- "__proto__",
2666
- "constructor",
2667
- "prototype"
2668
- ]), Ze = /* @__PURE__ */ new Set([
2669
- "protocol",
2670
- "key",
2671
- "assembly",
2672
- "presets",
2673
- "components",
2674
- "replacements",
2675
- "registry",
2676
- "themes",
2677
- "legacyKeys"
2678
- ]);
2679
- function $(e, t) {
2680
- throw Error(`Invalid local SDK config (${e}): ${t}`);
2681
- }
2682
- function Qe(e) {
2683
- if (typeof e != "object" || !e || Array.isArray(e)) return !1;
2684
- let t = Object.getPrototypeOf(e);
2685
- return t === Object.prototype || t === null;
2686
- }
2687
- function $e(e, t, n) {
2688
- for (let r of Object.keys(e)) Xe.has(r) && $(n, `field "${r}" is not allowed.`), t.has(r) || $(n, `unknown field "${r}".`);
2689
- }
2690
- function et(e, t, n = []) {
2691
- if (e === void 0) return Object.freeze([t]);
2692
- Array.isArray(e) || $("presets", "must be an array."), e.length === 0 && $("presets", "must select at least the default preset.");
2693
- let r = [];
2694
- for (let e of [t, ...n.map((e) => e.preset)]) r.some((t) => t.id === e.id && t.version === e.version) || r.push(e);
2695
- let i = /* @__PURE__ */ new Set(), a = [];
2696
- for (let n = 0; n < e.length; n += 1) {
2697
- let o = e[n], s, c;
2698
- typeof o == "string" ? s = o : Qe(o) ? ((o.id === void 0 || typeof o.id != "string") && $(`presets[${n}].id`, "must be a string."), s = o.id, o.version !== void 0 && (typeof o.version != "string" && $(`presets[${n}].version`, "must be a string."), c = o.version)) : $(`presets[${n}]`, "must be a preset id or preset reference.");
2699
- let l = s === "default" ? t.id : s, u = r.filter((e) => e.id === l);
2700
- u.length === 0 && $(`presets[${n}]`, `unsupported preset "${s}"; local.config.migration-unsupported: no compatibility profile matches this identity.`);
2701
- let d = c === void 0 ? u.length === 1 ? u[0] : void 0 : u.find((e) => e.version === c);
2702
- d === void 0 && $(`presets[${n}]`, `unsupported preset "${s}"${c === void 0 ? "" : ` version "${c}"`}; local.config.migration-unsupported: no compatibility profile matches this identity.`), i.has(d.id) && $("presets", `"${d.id}" is selected more than once.`), a.length > 0 && a[0].id !== d.id && $("presets", "reactive-md-config/v1 selects exactly one default preset identity."), i.add(d.id), a.push(d);
2703
- }
2704
- return Object.freeze(a);
2705
- }
2706
- function tt(e, t) {
2707
- if (e.components === void 0) return;
2708
- let n = new Map(t.map((e) => [e.id, e]));
2709
- for (let t of e.components) {
2710
- let r = n.get(t.id);
2711
- r && r.name === t.name && r.version === t.version && c(r) === t.digest || $("presets", `local.config.migration-unsupported: profile "${e.name}" cannot map legacy component "${t.id}".`);
2712
- }
2713
- }
2714
- function nt(e) {
2715
- let t = /* @__PURE__ */ new Set();
2716
- for (let n of e) t.add(n.name), t.add(n.id);
2717
- return t;
2718
- }
2719
- function rt(t, r) {
2720
- let i = new Map(t.map((e) => [e.id, e])), a = nt(r);
2721
- for (let r of t) {
2722
- let t = r.requires?.kernel;
2723
- t !== void 0 && !n("0.7.0", t) && $("requires", `component "${r.id}" requires kernel ${t}, but ${e} is installed.`);
2724
- for (let e of r.dependencies ?? []) {
2725
- let t = i.get(e.id)?.version ?? (a.has(e.id) ? "0.7.0" : null);
2726
- t === null && $("dependencies", `component "${r.id}" requires missing component "${e.id}".`), e.version !== void 0 && !n(t, e.version) && $("dependencies", `component "${r.id}" requires "${e.id}" ${e.version}, but version ${t} is installed.`);
2727
- }
2728
- }
2729
- let o = /* @__PURE__ */ new Map(), s = (e, t) => {
2730
- let n = o.get(e);
2731
- if (n === "done") return;
2732
- n === "visiting" && $("dependencies", `dependency cycle: ${[...t, e].join(" -> ")}.`), o.set(e, "visiting");
2733
- let r = i.get(e);
2734
- for (let n of r?.dependencies ?? []) i.has(n.id) && s(n.id, [...t, e]);
2735
- o.set(e, "done");
2736
- };
2737
- for (let e of i.keys()) s(e, []);
2738
- }
2739
- function it(e, t) {
2740
- if (e === void 0) return Object.freeze([]);
2741
- Array.isArray(e) || $("components", "must be an array."), e.length > 64 && $("components", "accepts at most 64 external components.");
2742
- let n = new Set([
2743
- ...t.map((e) => e.name),
2744
- ...I.map((e) => e.name),
2745
- ...M
2746
- ].map((e) => e.toLowerCase()));
2747
- n.add("theme");
2748
- let r = new Set(t.map((e) => e.id)), i = /* @__PURE__ */ new Set(), a = [];
2749
- for (let t = 0; t < e.length; t += 1) {
2750
- let s = o(e[t]);
2751
- n.has(s.name.toLowerCase()) && $(`components[${t}]`, `name "${s.name}" conflicts with a built-in component, HTML tag or theme declaration.`), r.has(s.id) && $("components", `component id "${s.id}" is declared more than once.`), i.has(s.name) && $("components", `component name "${s.name}" is declared more than once.`), r.add(s.id), i.add(s.name), a.push(s);
2752
- }
2753
- return rt(a, t), Object.freeze(a);
2261
+ var B = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
2262
+ function V(e) {
2263
+ return typeof e == "string" && e.length > 0 && e.length <= 64 && B.test(e);
2754
2264
  }
2755
- export { E as A, v as B, F as C, M as D, ge as E, O as F, b as H, de as I, A as L, pe as M, fe as N, he as O, w as P, _ as R, N as S, me as T, y as V, R as _, Qe as a, we as b, tt as c, Ge as d, Je as f, L as g, We as h, $ as i, j, _e as k, Ke as l, Ae as m, Ye as n, it as o, Q as p, $e as r, et as s, Ze as t, qe as u, Te as v, xe as w, P as x, I as y, g as z };
2265
+ export { a as _, T as a, k as c, E as d, j as f, r as g, i as h, z as i, _ as l, l as m, P as n, M as o, c as p, V as r, N as s, F as t, O as u, o as v, s as y };