reactive-md 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG-ch.md +34 -0
  2. package/CHANGELOG.md +34 -0
  3. package/README-ch.md +7 -7
  4. package/README-en.md +7 -7
  5. package/README.md +7 -7
  6. package/THIRD_PARTY_NOTICES.md +0 -57
  7. package/cli/help.mjs +6 -4
  8. package/cli/init.mjs +1 -1
  9. package/cli/migrate.mjs +1 -1
  10. package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
  11. package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
  12. package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
  13. package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
  14. package/dist-library/authoring-Bwu_zCWs.js +768 -0
  15. package/dist-library/choice-values-BItGjPD2.js +58 -0
  16. package/dist-library/compile-B35rfzKr.js +1742 -0
  17. package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
  18. package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
  19. package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
  20. package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
  21. package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
  22. package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
  23. package/dist-library/conditional-branches-CIhJXasR.js +17 -0
  24. package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
  25. package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
  26. package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
  27. package/dist-library/data-table-CSAkm1eU.js +290 -0
  28. package/dist-library/data-table-model-DruztQFt.js +391 -0
  29. package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
  30. package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
  31. package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
  32. package/dist-library/default-options-By16CVw1.js +131 -0
  33. package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
  34. package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
  35. package/dist-library/display-Bb6hAG5T.js +2065 -0
  36. package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
  37. package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
  38. package/dist-library/font-aliases-CKYjwn4o.js +4 -0
  39. package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
  40. package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
  41. package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
  42. package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
  43. package/dist-library/layout-CPQggKxk.js +592 -0
  44. package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
  45. package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
  46. package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
  47. package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
  48. package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
  49. package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
  50. package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
  51. package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
  52. package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
  53. package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
  54. package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
  55. package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
  56. package/dist-library/reactive-md-authoring.js +277 -269
  57. package/dist-library/reactive-md-build.js +327 -33
  58. package/dist-library/reactive-md-compiler-session.js +3 -3
  59. package/dist-library/reactive-md-compiler-standard.js +10 -10
  60. package/dist-library/reactive-md-compiler.js +3 -3
  61. package/dist-library/reactive-md-contracts.js +4 -4
  62. package/dist-library/reactive-md-default-packs.js +4 -3
  63. package/dist-library/reactive-md-default-preset.js +3 -3
  64. package/dist-library/reactive-md-export.js +6 -6
  65. package/dist-library/reactive-md-minimal-preset.js +3 -2
  66. package/dist-library/reactive-md-minimal-react-preset.js +18 -17
  67. package/dist-library/reactive-md-minimal.css +1 -1
  68. package/dist-library/reactive-md-observability.js +2 -2
  69. package/dist-library/reactive-md-pack-style-manifest.js +8 -0
  70. package/dist-library/reactive-md-plugin-chart.js +13 -9
  71. package/dist-library/reactive-md-plugin-data.js +4 -4
  72. package/dist-library/reactive-md-plugin-diagram.js +3 -3
  73. package/dist-library/reactive-md-plugin-forms.js +5 -5
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +10 -10
  76. package/dist-library/reactive-md-plugin-network.js +5 -5
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-react-component-accordion.js +3 -3
  79. package/dist-library/reactive-md-react-component-alert.js +3 -3
  80. package/dist-library/reactive-md-react-component-anchor.js +3 -3
  81. package/dist-library/reactive-md-react-component-badge.js +3 -3
  82. package/dist-library/reactive-md-react-component-card.js +3 -3
  83. package/dist-library/reactive-md-react-component-chart.js +2 -2
  84. package/dist-library/reactive-md-react-component-checkbox.js +2 -2
  85. package/dist-library/reactive-md-react-component-checklist.js +2 -2
  86. package/dist-library/reactive-md-react-component-choices.js +2 -2
  87. package/dist-library/reactive-md-react-component-column.js +1 -1
  88. package/dist-library/reactive-md-react-component-coordinate.js +2 -2
  89. package/dist-library/reactive-md-react-component-counter.js +2 -2
  90. package/dist-library/reactive-md-react-component-data-table.js +2 -2
  91. package/dist-library/reactive-md-react-component-date.js +2 -2
  92. package/dist-library/reactive-md-react-component-diagram.js +2 -2
  93. package/dist-library/reactive-md-react-component-disclosure.js +3 -3
  94. package/dist-library/reactive-md-react-component-edge.js +1 -1
  95. package/dist-library/reactive-md-react-component-else.js +10 -0
  96. package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
  97. package/dist-library/reactive-md-react-component-gallery.js +2 -2
  98. package/dist-library/reactive-md-react-component-grid.js +3 -3
  99. package/dist-library/reactive-md-react-component-if.js +3 -3
  100. package/dist-library/reactive-md-react-component-input.js +2 -2
  101. package/dist-library/reactive-md-react-component-jump.js +3 -3
  102. package/dist-library/reactive-md-react-component-multi-select.js +2 -2
  103. package/dist-library/reactive-md-react-component-node.js +2 -2
  104. package/dist-library/reactive-md-react-component-number.js +2 -2
  105. package/dist-library/reactive-md-react-component-option.js +1 -1
  106. package/dist-library/reactive-md-react-component-panel.js +3 -3
  107. package/dist-library/reactive-md-react-component-plot.js +2 -2
  108. package/dist-library/reactive-md-react-component-progress.js +2 -2
  109. package/dist-library/reactive-md-react-component-quiz.js +2 -2
  110. package/dist-library/reactive-md-react-component-radio-group.js +2 -2
  111. package/dist-library/reactive-md-react-component-range-slider.js +2 -2
  112. package/dist-library/reactive-md-react-component-section.js +3 -3
  113. package/dist-library/reactive-md-react-component-select.js +2 -2
  114. package/dist-library/reactive-md-react-component-slider.js +2 -2
  115. package/dist-library/reactive-md-react-component-step.js +3 -3
  116. package/dist-library/reactive-md-react-component-steps.js +3 -3
  117. package/dist-library/reactive-md-react-component-tab.js +3 -3
  118. package/dist-library/reactive-md-react-component-table.js +2 -2
  119. package/dist-library/reactive-md-react-component-tabs.js +3 -3
  120. package/dist-library/reactive-md-react-component-text.js +3 -3
  121. package/dist-library/reactive-md-react-component-textarea.js +2 -2
  122. package/dist-library/reactive-md-react-component-timeline.js +2 -2
  123. package/dist-library/reactive-md-react-component-timer.js +2 -2
  124. package/dist-library/reactive-md-react-component-toggle.js +2 -2
  125. package/dist-library/reactive-md-react-component-tooltip.js +3 -3
  126. package/dist-library/reactive-md-react-component-validation.js +3 -3
  127. package/dist-library/reactive-md-react-minimal.js +4 -4
  128. package/dist-library/reactive-md-react-pack-controls.js +4 -4
  129. package/dist-library/reactive-md-react-pack-data.js +3 -3
  130. package/dist-library/reactive-md-react-pack-layout.js +25 -24
  131. package/dist-library/reactive-md-react-pack-visuals.js +2 -2
  132. package/dist-library/reactive-md-react-packed.js +6 -6
  133. package/dist-library/reactive-md-react-server.js +37 -36
  134. package/dist-library/reactive-md-react-static-server.js +2 -2
  135. package/dist-library/reactive-md-react-static.js +1 -1
  136. package/dist-library/reactive-md-react-unstyled.js +12 -12
  137. package/dist-library/reactive-md-react.js +12 -12
  138. package/dist-library/reactive-md-scan.js +1 -1
  139. package/dist-library/reactive-md-sdk.js +23 -9
  140. package/dist-library/reactive-md-standalone-configured.js +2 -2
  141. package/dist-library/reactive-md-standalone-host.js +2 -2
  142. package/dist-library/reactive-md-testing-browser.js +2 -2
  143. package/dist-library/reactive-md-testing-react.js +6 -6
  144. package/dist-library/reactive-md-testing.js +6 -6
  145. package/dist-library/reactive-md-vite.js +25 -9
  146. package/dist-library/reactive-md-worker-pool.js +3 -3
  147. package/dist-library/reactive-md.css +1 -1
  148. package/dist-library/reactive-md.js +52 -43
  149. package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
  150. package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
  151. package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
  152. package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
  153. package/dist-library/rmd-pack-layout.css +9 -0
  154. package/dist-library/rmd-pack-resource-layout.css +9 -0
  155. package/dist-library/runtime-BHeuLOv_.js +1369 -0
  156. package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
  157. package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
  158. package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
  159. package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
  160. package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
  161. package/dist-library/shareable-CHCDnl6j.js +844 -0
  162. package/dist-library/types/authoring/catalog.d.ts +3 -1
  163. package/dist-library/types/authoring/index.d.ts +1 -1
  164. package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
  165. package/dist-library/types/components/chart/default-chart.d.ts +7 -0
  166. package/dist-library/types/components/entries/else.d.ts +3 -0
  167. package/dist-library/types/components/layout/layout.d.ts +5 -0
  168. package/dist-library/types/components/shared/visuals.d.ts +1 -1
  169. package/dist-library/types/components/table/data-table-model.d.ts +95 -2
  170. package/dist-library/types/components/table/data-table.d.ts +2 -2
  171. package/dist-library/types/contracts/component-kernel.d.ts +5 -0
  172. package/dist-library/types/contracts/font-aliases.d.ts +18 -0
  173. package/dist-library/types/contracts/number-literal.d.ts +2 -0
  174. package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
  175. package/dist-library/types/export/index.d.ts +4 -1
  176. package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
  177. package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
  178. package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
  179. package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
  180. package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
  181. package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
  182. package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
  183. package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
  184. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
  185. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
  186. package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
  187. package/dist-library/types/local/evaluation/computations.d.ts +13 -5
  188. package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
  189. package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
  190. package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
  191. package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
  192. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
  193. package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
  194. package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
  195. package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
  196. package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
  197. package/dist-library/types/local/evaluation/validation.d.ts +8 -6
  198. package/dist-library/types/local/index.d.ts +4 -3
  199. package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
  200. package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
  201. package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
  202. package/dist-library/types/local/runtime/runtime.d.ts +3 -1
  203. package/dist-library/types/local/runtime/state.d.ts +30 -15
  204. package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
  205. package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
  206. package/dist-library/types/local/source/authoring.d.ts +10 -0
  207. package/dist-library/types/local/source/source-migration.d.ts +1 -0
  208. package/dist-library/types/local/types.d.ts +33 -2
  209. package/dist-library/types/react/component-api.d.ts +21 -2
  210. package/dist-library/types/react/component-utils.d.ts +11 -0
  211. package/dist-library/types/react/font-aliases.d.ts +2 -0
  212. package/dist-library/types/react/package-core.d.ts +3 -0
  213. package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
  214. package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
  215. package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
  216. package/dist-library/types/react/sdk-core.d.ts +3 -1
  217. package/dist-library/types/sdk/assembly.d.ts +3 -0
  218. package/dist-library/types/sdk/font.d.ts +13 -0
  219. package/dist-library/types/sdk/index.d.ts +1 -0
  220. package/dist-library/types/sdk/theme.d.ts +5 -0
  221. package/dist-library/types/sdk/types.d.ts +6 -0
  222. package/dist-library/types/sdk/version.d.ts +1 -1
  223. package/dist-library/types/shareable.d.ts +15 -3
  224. package/dist-library/types/standalone/prepare.d.ts +4 -2
  225. package/dist-library/types/standalone/session-core.d.ts +4 -1
  226. package/dist-library/types/vite/index.d.ts +3 -0
  227. package/dist-library/types/vite/registration.d.ts +1 -0
  228. package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
  229. package/dist-library/types-FYhRWRn9.js +3 -0
  230. package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
  231. package/dist-library/validation-DRuW0Wl9.js +433 -0
  232. package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
  233. package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
  234. package/dist-library/visuals-7xzoL9ql.js +49340 -0
  235. package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
  236. package/dist-standalone/reactive-md-standalone.css +1 -1
  237. package/dist-standalone/reactive-md-standalone.js +128 -368
  238. package/docs/README-ch.md +3 -1
  239. package/docs/README.md +3 -1
  240. package/docs/compatibility/api-stability-ch.md +1 -1
  241. package/docs/compatibility/api-stability-en.md +1 -1
  242. package/docs/compatibility/compatibility-ch.md +15 -15
  243. package/docs/compatibility/compatibility-en.md +15 -15
  244. package/docs/compatibility/compatibility-manifest.schema.json +3 -2
  245. package/docs/compatibility/deprecation-ch.md +2 -2
  246. package/docs/compatibility/deprecation-en.md +2 -2
  247. package/docs/compatibility/source-versioning-ch.md +22 -14
  248. package/docs/compatibility/source-versioning-en.md +22 -13
  249. package/docs/compatibility/support-matrix-ch.md +4 -3
  250. package/docs/compatibility/support-matrix-en.md +4 -3
  251. package/docs/development/component-development-ch.md +2 -2
  252. package/docs/development/component-development-en.md +2 -2
  253. package/docs/development/component-protocol-ch.md +18 -18
  254. package/docs/development/component-protocol-en.md +14 -14
  255. package/docs/guides/local-guide-ch.md +109 -20
  256. package/docs/guides/local-guide-en.md +109 -20
  257. package/docs/integration/author-tools-ch.md +1 -1
  258. package/docs/integration/author-tools-en.md +1 -1
  259. package/docs/integration/editor-ch.md +3 -3
  260. package/docs/integration/editor-en.md +3 -3
  261. package/docs/integration/extension-sdk-ch.md +29 -3
  262. package/docs/integration/extension-sdk-en.md +29 -3
  263. package/docs/integration/local-integration-ch.md +3 -3
  264. package/docs/integration/local-integration-en.md +3 -3
  265. package/docs/integration/pdf-export-ch.md +42 -0
  266. package/docs/integration/pdf-export-en.md +42 -0
  267. package/docs/integration/shareable-export-ch.md +11 -19
  268. package/docs/integration/shareable-export-en.md +11 -19
  269. package/docs/reference/diagnostics-counting-ch.md +24 -1
  270. package/docs/reference/diagnostics-counting-en.md +24 -1
  271. package/docs/reference/local-interaction-syntax-ch.md +222 -33
  272. package/docs/reference/local-interaction-syntax-en.md +220 -31
  273. package/docs/reference/public-api-ch.md +24 -18
  274. package/docs/reference/public-api-en.md +24 -18
  275. package/docs/reference/theme-protocol-ch.md +1 -1
  276. package/docs/reference/theme-protocol-en.md +1 -1
  277. package/docs/releases/release-0.10.0-ch.md +45 -0
  278. package/docs/releases/release-0.10.0-en.md +45 -0
  279. package/examples/conformance/README-ch.md +3 -3
  280. package/examples/conformance/README.md +3 -3
  281. package/examples/conformance/local-draft-4.json +441 -0
  282. package/examples/integration/README-ch.md +3 -3
  283. package/examples/integration/README.md +3 -3
  284. package/examples/integration/chat-session/package.json +1 -1
  285. package/examples/local/README-ch.md +1 -1
  286. package/examples/local/README.md +1 -1
  287. package/package.json +6 -1
  288. package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
  289. package/dist-library/authoring-B14SsOXZ.js +0 -893
  290. package/dist-library/compile-D50B5_Ww.js +0 -1249
  291. package/dist-library/computations-CffoW7Ff.js +0 -340
  292. package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
  293. package/dist-library/default-options-DU5dxuU6.js +0 -125
  294. package/dist-library/layout-BfUzzO2b.js +0 -553
  295. package/dist-library/runtime-CuJndKqK.js +0 -1289
  296. package/dist-library/shareable-C6mUerpQ.js +0 -817
  297. package/dist-library/types-daDo2c_w.js +0 -3
  298. package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
  299. package/dist-library/visuals-CoVSjVD8.js +0 -49159
@@ -0,0 +1,768 @@
1
+ import { o as e } from "./latex-1w7aQgD5.js";
2
+ import { m as t, y as n } from "./compile-B35rfzKr.js";
3
+ import { V as r, z as i } from "./preset-core-BKPbH_Nv.js";
4
+ import { a, c as o, d as s, i as c, l, o as u, s as d, u as f } from "./compiler-core-kkDiQ1RK.js";
5
+ import { S as p } from "./validation-DRuW0Wl9.js";
6
+ import { a as m } from "./schema-core-CDXfxdID.js";
7
+ import { t as h } from "./compiler-DBwLawMZ.js";
8
+ import { r as g } from "./default-options-By16CVw1.js";
9
+ import { t as _ } from "./parser-BHl9Lxbw.js";
10
+ // src/local/source/authoring-requirements.ts
11
+ function v(e, t, n, r) {
12
+ return t === "label" && (e.structure?.label ?? e.label) === "required" || n.required === !0 && n.default === void 0 || (e.bindings ? Object.values(e.bindings) : [e.binding]).some((e) => e?.required === !0 && e.bind === t && !e.requiresAttributes?.some((e) => !r?.has(e)));
13
+ }
14
+ // src/local/source/authoring.ts
15
+ var y = /^[A-Za-z_][A-Za-z0-9_]*$/, b = 128, x = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, S = /^[a-z][a-z0-9]*$/;
16
+ function C(e, t) {
17
+ let r = /* @__PURE__ */ new Map(), i = (e = "") => [...new Set(e.split(",").map((e) => e.trim()).filter((e) => S.test(e) && e.length <= b && !n.has(e)))].slice(0, 20);
18
+ for (let n of t) {
19
+ if (n.type !== "component" || n.name !== "macro") continue;
20
+ let t = n.attrs?.name ?? "";
21
+ if (t.length > b || !x.test(t) || r.has(t)) continue;
22
+ let a = s(e, n.range.start), o = a && c(e, n, a.end);
23
+ if (a && o && (r.set(t, {
24
+ name: t,
25
+ params: i(n.attrs?.params).filter((e) => e !== "macro"),
26
+ outputs: i(n.attrs?.outputs),
27
+ range: n.range,
28
+ bodyRange: {
29
+ start: a.end,
30
+ end: o.start
31
+ }
32
+ }), r.size === 50)) break;
33
+ }
34
+ return [...r.values()];
35
+ }
36
+ var w = /* @__PURE__ */ new Set([
37
+ "code",
38
+ "inlineCode",
39
+ "math",
40
+ "inlineMath",
41
+ "fallback",
42
+ "comment",
43
+ "footnoteDefinition",
44
+ "authorCss",
45
+ "authorJavaScript",
46
+ "extendedHtmlRaw",
47
+ "rawBody"
48
+ ]), T = /* @__PURE__ */ new Set([
49
+ "local.version.unsupported",
50
+ "local.version.malformed",
51
+ "local.version.duplicate",
52
+ "local.version.placement",
53
+ "local.parse",
54
+ "local.interpolation",
55
+ "local.tag.unclosed",
56
+ "local.tag.mismatch",
57
+ "local.tag.closing",
58
+ "local.tag.shape",
59
+ "local.attribute",
60
+ "local.budget"
61
+ ]);
62
+ function E(e) {
63
+ return e.length > 0 && e.length <= b && y.test(e) && !n.has(e);
64
+ }
65
+ function D(e) {
66
+ return {
67
+ start: e.start,
68
+ end: e.end
69
+ };
70
+ }
71
+ function O(e, t) {
72
+ try {
73
+ return h(e, t).diagnostics;
74
+ } catch {
75
+ return [];
76
+ }
77
+ }
78
+ function k(e) {
79
+ return g(e).ok;
80
+ }
81
+ function A(e) {
82
+ let t = g(e);
83
+ return t.ok ? [...t.schemaByName.values()] : [];
84
+ }
85
+ function j(e, t) {
86
+ return Object.values(e.bindings ?? {}).some((e) => e.bind === t);
87
+ }
88
+ function M(e, t = []) {
89
+ for (let n of e) w.has(n.type) && t.push(D(n.range)), n.type !== "fallback" && n.children && M(n.children, t);
90
+ return t;
91
+ }
92
+ function N(e, t) {
93
+ let n = M(t), r = (t) => {
94
+ for (let i of t) {
95
+ if (i.type === "component" || i.type === "hostComponent") {
96
+ let t = s(e, i.range.start);
97
+ t && n.push({
98
+ start: t.start,
99
+ end: t.end
100
+ });
101
+ }
102
+ i.type !== "fallback" && i.children && r(i.children);
103
+ }
104
+ };
105
+ r(t), n.sort((e, t) => e.start - t.start || t.end - e.end);
106
+ let i = [], a = 0, o = 0;
107
+ for (; a < e.length;) {
108
+ let t = e.indexOf("<!--", a);
109
+ if (t < 0) break;
110
+ for (; o < n.length && n[o].end <= t;) o++;
111
+ let r = n[o];
112
+ if (r && r.start <= t) {
113
+ a = r.end;
114
+ continue;
115
+ }
116
+ let s = e.indexOf("-->", t + 4), c = s < 0 ? e.length : s + 3;
117
+ i.push({
118
+ start: t,
119
+ end: c
120
+ }), a = c;
121
+ }
122
+ return i;
123
+ }
124
+ function P(e, t) {
125
+ return t.find((t) => t.name === e)?.props;
126
+ }
127
+ function F(n, r, i, o) {
128
+ let l = [];
129
+ o?.themeRange && l.push({
130
+ type: "component",
131
+ name: "theme",
132
+ id: "author-theme",
133
+ range: o.themeRange
134
+ });
135
+ for (let e of Object.values(o?.computations ?? {})) l.push({
136
+ type: "component",
137
+ name: e.kind,
138
+ id: e.nodeId,
139
+ range: e.range
140
+ });
141
+ let d = l.length ? r.concat(l) : r, h = /* @__PURE__ */ new Set(), g = [], _ = /* @__PURE__ */ new Map(), v = [], y = [], b = !1, x = (e) => {
142
+ b || v.push(e);
143
+ }, S = (e, t) => {
144
+ if (b) return;
145
+ let n = _.get(e);
146
+ n ? n.push(D(t)) : _.set(e, [D(t)]);
147
+ }, C = (e, r) => {
148
+ if (h.has(e.range.start)) return;
149
+ let o = s(n, e.range.start);
150
+ if (!o || o.closing) return;
151
+ h.add(e.range.start), g.push({
152
+ kind: "tag",
153
+ range: D(o.nameRange)
154
+ });
155
+ let l = i.find((t) => t.name === e.name);
156
+ for (let r of o.attrs) {
157
+ if (g.push({
158
+ kind: "attribute",
159
+ range: D(r.nameRange)
160
+ }), !r.valueRange) continue;
161
+ let s = P(e.name ?? "", i)?.[r.name], c = e.type === "component" && e.name === "use", d = l !== void 0 && j(l, r.name) && Object.values(l.bindings ?? {}).some((e) => e.bind === r.name && (e.requiresAttributes ?? []).every((e) => o.attrs.some((t) => t.name === e))), p = (e.name === "computed" || e.name === "const" || e.name === "external") && r.name === "name", m = n.slice(r.valueRange.start, r.valueRange.end), h = a(n, r.valueRange);
162
+ if (l?.rules?.some((e) => e.kind === "validation-rule" && e.fields === r.name)) {
163
+ for (let e of h.text.matchAll(/\S+/g)) {
164
+ if (!E(e[0])) continue;
165
+ let t = {
166
+ start: h.offsets[e.index],
167
+ end: h.offsets[e.index + e[0].length]
168
+ };
169
+ x({
170
+ name: e[0],
171
+ range: t
172
+ }), g.push({
173
+ kind: "binding",
174
+ range: t
175
+ });
176
+ }
177
+ continue;
178
+ }
179
+ let _ = c && r.name.startsWith("bind-"), v = s && !s.static || c && !_ && r.name !== "macro" ? f(h.text, 0, h.text.length) : [];
180
+ if (v.length > 0) {
181
+ let e = l?.rules?.some((e) => e.kind === "scoped-expressions" && e.scope === "row" && e.attributes.includes(r.name) || e.kind === "row-values" && e.key === r.name) && !l.rules.some((e) => e.kind === "options-body" && r.name === "options" || e.kind === "chart-table" && r.name === "rows"), n = 0;
182
+ for (let r of v) {
183
+ r.start > n && g.push({
184
+ kind: "string",
185
+ range: {
186
+ start: h.offsets[n],
187
+ end: h.offsets[r.start]
188
+ }
189
+ }), g.push({
190
+ kind: "expression",
191
+ range: {
192
+ start: h.offsets[r.start],
193
+ end: h.offsets[r.end]
194
+ }
195
+ });
196
+ for (let n of u(h.text, r.innerStart, r.innerEnd)) e && t.has(n.name) || x({
197
+ ...n,
198
+ range: {
199
+ start: h.offsets[n.range.start],
200
+ end: h.offsets[n.range.end]
201
+ },
202
+ ...e && !n.scope ? { scope: "iteration" } : {}
203
+ });
204
+ n = r.end;
205
+ }
206
+ n < h.text.length && g.push({
207
+ kind: "string",
208
+ range: {
209
+ start: h.offsets[n],
210
+ end: r.valueRange.end
211
+ }
212
+ });
213
+ } else (d || p || _) && E(m) ? (g.push({
214
+ kind: "binding",
215
+ range: D(r.valueRange)
216
+ }), S(m, r.valueRange)) : r.valueRange.end > r.valueRange.start && g.push({
217
+ kind: "string",
218
+ range: D(r.valueRange)
219
+ });
220
+ }
221
+ let d = c(n, e, o.end);
222
+ d && g.push({
223
+ kind: "tag",
224
+ range: D(d.nameRange)
225
+ });
226
+ }, T = (t, r) => {
227
+ for (let a of t) {
228
+ if ((a.type === "component" || a.type === "hostComponent") && a.name) C(a, r);
229
+ else if (a.type === "interpolation") {
230
+ g.push({
231
+ kind: "expression",
232
+ range: D(a.range)
233
+ });
234
+ let e = a.range.start + 2, t = Math.max(e, a.range.end - 2), r = n.slice(e, t), i = r.includes("\\|") && r.trim().replace(/\\\|/g, "|") === a.value;
235
+ for (let r of u(n, e, t, i)) x(r);
236
+ } else if (a.type === "math" || a.type === "inlineMath") {
237
+ if (g.push({
238
+ kind: "math",
239
+ range: D(a.range)
240
+ }), i.find((e) => e.name === r)?.rules?.some((e) => e.kind === "inline-math-reads") && a.type === "math") {
241
+ let t = a.range.start + 2;
242
+ try {
243
+ for (let r of e(n.slice(t, a.range.end - 2))) {
244
+ let e = {
245
+ name: r.name,
246
+ range: {
247
+ start: t + r.range.start,
248
+ end: t + r.range.end
249
+ }
250
+ };
251
+ x(e), b || y.push(e);
252
+ }
253
+ } catch {}
254
+ }
255
+ } else a.type === "code" || a.type === "inlineCode" ? g.push({
256
+ kind: "code",
257
+ range: D(a.range)
258
+ }) : a.type === "comment" && g.push({
259
+ kind: "comment",
260
+ range: D(a.range)
261
+ });
262
+ if (!w.has(a.type) && n[a.range.start] === "<" && !h.has(a.range.start)) {
263
+ let e = s(n, a.range.start);
264
+ e && !e.closing && (m.has(e.name.toLowerCase()) || p.has(e.name.toLowerCase())) && C({
265
+ ...a,
266
+ name: e.name
267
+ }, r);
268
+ }
269
+ if (a.type !== "fallback" && a.children) {
270
+ let e = b;
271
+ b ||= a.type === "component" && a.name === "macro", T(a.children, a.name), b = e;
272
+ }
273
+ }
274
+ };
275
+ T(d);
276
+ for (let e of N(n, d)) g.push({
277
+ kind: "comment",
278
+ range: e
279
+ });
280
+ g.sort((e, t) => e.range.start - t.range.start || e.range.end - t.range.end);
281
+ let O = [];
282
+ for (let e of g) {
283
+ if (e.range.end <= e.range.start) continue;
284
+ let t = O[O.length - 1];
285
+ t && e.range.start < t.range.end || O.push(e);
286
+ }
287
+ let k = [];
288
+ for (let [e, t] of _) {
289
+ let n = [], r = /* @__PURE__ */ new Set();
290
+ for (let t of v) {
291
+ if (t.name !== e) continue;
292
+ let i = `${t.range.start}:${t.range.end}`;
293
+ r.has(i) || (r.add(i), n.push(D(t.range)));
294
+ }
295
+ n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end), k.push({
296
+ name: e,
297
+ declarations: t,
298
+ references: n
299
+ });
300
+ }
301
+ return k.sort((e, t) => e.declarations[0].start - t.declarations[0].start || e.name.localeCompare(t.name)), {
302
+ tokens: O,
303
+ bindings: k,
304
+ references: v,
305
+ mathReferences: y
306
+ };
307
+ }
308
+ function I(e, t, n = {}) {
309
+ if (typeof e != "string") return {
310
+ tokens: [],
311
+ bindings: [],
312
+ diagnostics: []
313
+ };
314
+ if (!k(t)) return {
315
+ tokens: [],
316
+ bindings: [],
317
+ diagnostics: n.diagnostics === !1 ? [] : O(e, t)
318
+ };
319
+ let r = n.document?.source === e ? n.document : void 0, i = r && !r.versionDeclaration?.features?.includes("macros") ? r : _(e, t), a = F(e, i.nodes, A(t), i), o = C(e, i.nodes);
320
+ return {
321
+ tokens: a.tokens,
322
+ bindings: a.bindings,
323
+ diagnostics: n.diagnostics === !1 ? [] : O(e, t),
324
+ ...o.length ? { macros: o } : {},
325
+ ...i.themeRange && i.theme ? { theme: i.theme } : {}
326
+ };
327
+ }
328
+ function L(e, t, n) {
329
+ let r = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)/.exec(e.slice(t, Math.min(e.length, n + 1)));
330
+ if (!r) return null;
331
+ let i = !!r[1], a = r[2], o = t + r[0].length, s = [], c = !1, u, d = !1;
332
+ if (!i) {
333
+ let t = o;
334
+ for (; t < n;) {
335
+ for (; t < n && l(e[t]);) t += 1;
336
+ if (t >= n) break;
337
+ if (e[t] === "/") {
338
+ d = !0, t += 1;
339
+ continue;
340
+ }
341
+ let r = /^[A-Za-z][A-Za-z0-9_-]*/.exec(e.slice(t, n));
342
+ if (!r) {
343
+ t += 1;
344
+ continue;
345
+ }
346
+ let i = r[0], a = t;
347
+ t += i.length;
348
+ let o = t, f = t;
349
+ for (; f < n && l(e[f]);) f += 1;
350
+ if (e[f] !== "=") {
351
+ s.push({
352
+ name: i,
353
+ nameStart: a,
354
+ nameEnd: o,
355
+ nameRange: {
356
+ start: a,
357
+ end: o
358
+ }
359
+ }), t = o;
360
+ continue;
361
+ }
362
+ for (t = f + 1; t < n && l(e[t]);) t += 1;
363
+ let p = e[t];
364
+ if (p === "\"" || p === "'") {
365
+ let r = t, l = t + 1, d = e.indexOf(p, l);
366
+ if (d < 0 || d >= n) {
367
+ let e = {
368
+ name: i,
369
+ nameStart: a,
370
+ nameEnd: o,
371
+ nameRange: {
372
+ start: a,
373
+ end: o
374
+ },
375
+ valueRange: {
376
+ start: l,
377
+ end: n
378
+ },
379
+ quoteStart: r,
380
+ quoteEnd: d < 0 ? n : d
381
+ };
382
+ s.push(e), u = e, c = !0, t = n;
383
+ break;
384
+ }
385
+ s.push({
386
+ name: i,
387
+ nameStart: a,
388
+ nameEnd: o,
389
+ nameRange: {
390
+ start: a,
391
+ end: o
392
+ },
393
+ valueRange: {
394
+ start: l,
395
+ end: d
396
+ },
397
+ quoteStart: r,
398
+ quoteEnd: d
399
+ }), t = d + 1;
400
+ continue;
401
+ }
402
+ let m = t;
403
+ for (; t < n && !l(e[t]);) t += 1;
404
+ s.push({
405
+ name: i,
406
+ nameStart: a,
407
+ nameEnd: o,
408
+ nameRange: {
409
+ start: a,
410
+ end: o
411
+ },
412
+ valueRange: {
413
+ start: m,
414
+ end: t
415
+ },
416
+ unquoted: !0
417
+ });
418
+ }
419
+ }
420
+ let f = -1;
421
+ if (!c) {
422
+ let t = n;
423
+ for (; t > o && /[A-Za-z0-9_-]/.test(e[t - 1]);) --t;
424
+ t > o && l(e[t - 1]) && (f = t);
425
+ }
426
+ return {
427
+ name: a,
428
+ closing: i,
429
+ selfClosing: d,
430
+ inValue: c,
431
+ currentAttribute: u,
432
+ attrs: s,
433
+ partialStart: f
434
+ };
435
+ }
436
+ function R(e, t, n) {
437
+ let r = [], i = (e) => {
438
+ for (let t of e) t.type === "component" && r.push(t.range.start), t.type !== "fallback" && t.children && i(t.children);
439
+ };
440
+ i(n), r.sort((e, t) => e - t);
441
+ for (let n = r.length - 1; n >= 0; --n) {
442
+ let i = r[n];
443
+ if (i >= t) continue;
444
+ let a = s(e, i);
445
+ if (a && t <= a.end) return i;
446
+ if (a && a.end < t) break;
447
+ }
448
+ let a = t;
449
+ for (; a > 0;) {
450
+ let n = e.lastIndexOf("<", a - 1);
451
+ if (n < 0) return -1;
452
+ if (e[n - 1] === "\\") {
453
+ a = n;
454
+ continue;
455
+ }
456
+ let r = e[n + 1];
457
+ if (r !== "/" && !o(r)) a = n;
458
+ else if (z(e, n, t)) a = n;
459
+ else return n;
460
+ }
461
+ return -1;
462
+ }
463
+ function z(e, t, n) {
464
+ let r = "";
465
+ for (let i = t; i < n; i += 1) {
466
+ let t = e[i];
467
+ if (r) t === r && (r = "");
468
+ else if (t === "\"" || t === "'") r = t;
469
+ else if (t === ">") return !0;
470
+ }
471
+ return !1;
472
+ }
473
+ function B(e, t) {
474
+ let n = t;
475
+ for (; n > 0;) {
476
+ let r = e.lastIndexOf("{{", n - 1);
477
+ if (r < 0) return null;
478
+ if (e[r - 1] === "\\") {
479
+ n = r;
480
+ continue;
481
+ }
482
+ let i = "", a = r + 2, o = -1;
483
+ for (; a < e.length - 1; a += 1) {
484
+ let t = e[a];
485
+ if (i) t === "\\" ? a += 1 : t === i && (i = "");
486
+ else if (t === "\"" || t === "'") i = t;
487
+ else if (t === "}" && e[a + 1] === "}") {
488
+ o = a;
489
+ break;
490
+ }
491
+ }
492
+ if (o >= 0 && o + 2 <= t) n = r;
493
+ else return {
494
+ start: r,
495
+ end: o < 0 ? e.length : o + 2,
496
+ innerStart: r + 2,
497
+ innerEnd: o < 0 ? e.length : o
498
+ };
499
+ }
500
+ return null;
501
+ }
502
+ function V(e, t, n) {
503
+ let r = "";
504
+ for (let i = t; i < n; i += 1) {
505
+ let t = e[i];
506
+ r ? t === "\\" ? i += 1 : t === r && (r = "") : (t === "\"" || t === "'") && (r = t);
507
+ }
508
+ return r !== "";
509
+ }
510
+ function H(e, t) {
511
+ let n = 0, r = e.length - 1;
512
+ for (; n <= r;) {
513
+ let i = n + r >> 1, a = e[i];
514
+ if (t < a.start) r = i - 1;
515
+ else if (t >= a.end) n = i + 1;
516
+ else return !0;
517
+ }
518
+ return !1;
519
+ }
520
+ function U(e, t, n, r) {
521
+ let i = e.slice(t, n), a = i && r.startsWith(i) ? r.slice(i.length) : "";
522
+ return {
523
+ start: t,
524
+ end: a && e.startsWith(a, n) ? n + a.length : n
525
+ };
526
+ }
527
+ function W(e, t, n, r) {
528
+ if (V(e, n.innerStart, t)) return [];
529
+ let i = t;
530
+ for (; i > n.innerStart && d(e[i - 1]);) --i;
531
+ if (e[i - 1] === ".") return [];
532
+ let a = e.slice(i, t);
533
+ return a && !o(a[0]) ? [] : r.filter((e) => e.name.startsWith(a)).map((n) => ({
534
+ label: n.name,
535
+ insertText: n.name,
536
+ range: U(e, i, t, n.name),
537
+ kind: "binding",
538
+ detail: `${n.declarations.length} declaration${n.declarations.length === 1 ? "" : "s"}, ${n.references.length} reference${n.references.length === 1 ? "" : "s"}`
539
+ }));
540
+ }
541
+ function G(e, t, n, r, i) {
542
+ let a = n.currentAttribute;
543
+ if (!a) return [];
544
+ let o = P(n.name, r)?.[a.name];
545
+ if (!o || o.kind !== "enum" || !o.values) return [];
546
+ let s = a.valueRange?.start ?? t, c = e.slice(s, t);
547
+ return (n.name === "text" && a.name === "font" && i ? i : o.values).filter((e) => e.startsWith(c)).map((n) => ({
548
+ label: n,
549
+ insertText: n,
550
+ range: U(e, s, t, n),
551
+ kind: "value",
552
+ detail: `${a.name} value`
553
+ }));
554
+ }
555
+ function K(e, t, n, r) {
556
+ if (n.closing || n.inValue || n.partialStart < 0) return [];
557
+ let i = r.find((e) => e.name === n.name);
558
+ if (!i) return [];
559
+ let { props: a } = i, o = e.slice(n.partialStart, t);
560
+ if (o && !/^[A-Za-z0-9_-]*$/.test(o)) return [];
561
+ let s = new Set(n.attrs.filter((e) => e.nameEnd < n.partialStart).map((e) => e.name)), c = { ...a };
562
+ return ![
563
+ "computed",
564
+ "const",
565
+ "external",
566
+ "dataset",
567
+ "validation",
568
+ "option",
569
+ "column",
570
+ "edge",
571
+ "step"
572
+ ].includes(n.name) && !Object.hasOwn(a, "css") && (c.css = {
573
+ kind: "string",
574
+ static: !0
575
+ }), n.name === "counter" && !Object.hasOwn(a, "action-id") && (c["action-id"] = {
576
+ kind: "string",
577
+ static: !0
578
+ }), Object.entries(c).filter(([e]) => !s.has(e) && e.startsWith(o)).map(([r, a]) => ({
579
+ label: r,
580
+ insertText: r,
581
+ range: U(e, n.partialStart, t, r),
582
+ kind: "attribute",
583
+ detail: v(i, r, a, s) ? `${a.kind}, required` : a.kind
584
+ }));
585
+ }
586
+ function q(e, t, n) {
587
+ let r = Math.max(0, t - 256), i = e.slice(r, t), a = /<\/?([A-Za-z][A-Za-z0-9-]*)?$/.exec(i);
588
+ if (!a) return [];
589
+ let o = r + a.index;
590
+ if (e[o] !== "<" || e[o - 1] === "\\") return [];
591
+ let s = e[o + 1] === "/", c = o + (s ? 2 : 1);
592
+ if (c > t) return [];
593
+ let l = a[1] ?? "", u = s ? n.filter((e) => e.form !== "leaf").map((e) => e.name) : n.map((e) => e.name), d = ["css", "javascript"].filter((e) => !n.some((t) => t.name === e));
594
+ return [...u, ...d].filter((e) => e.startsWith(l)).map((n) => ({
595
+ label: n,
596
+ insertText: !s && d.includes(n) && e[U(e, c, t, n).end] !== ">" ? `${n}>\n\n</${n}>` : n,
597
+ range: U(e, c, t, n),
598
+ kind: "tag",
599
+ detail: s ? "closing tag" : d.includes(n) ? "document declaration" : "component"
600
+ }));
601
+ }
602
+ function J(e, t, n, r) {
603
+ if (n.inValue) {
604
+ if (n.currentAttribute?.name !== "macro") return [];
605
+ let i = n.currentAttribute.valueRange?.start ?? t;
606
+ return r.filter((n) => n.name.startsWith(e.slice(i, t))).map((n) => ({
607
+ label: n.name,
608
+ insertText: n.name,
609
+ range: U(e, i, t, n.name),
610
+ kind: "value",
611
+ detail: [...n.params, ...n.outputs.map((e) => "bind-" + e)].join(", ")
612
+ }));
613
+ }
614
+ if (n.closing || n.partialStart < 0) return [];
615
+ let i = n.attrs.find((e) => e.name === "macro" && e.valueRange)?.valueRange, o = i ? r.find((t) => t.name === a(e, i).text) : void 0, s = new Set(n.attrs.filter((e) => e.nameEnd < n.partialStart).map((e) => e.name));
616
+ return (o ? [...o.params, ...o.outputs.map((e) => "bind-" + e)] : ["macro"]).filter((r) => !s.has(r) && r.startsWith(e.slice(n.partialStart, t))).map((r) => ({
617
+ label: r,
618
+ insertText: r,
619
+ range: U(e, n.partialStart, t, r),
620
+ kind: "attribute",
621
+ detail: r.startsWith("bind-") ? "optional output" : "required"
622
+ }));
623
+ }
624
+ function Y(e, t, n) {
625
+ if (typeof e != "string" || !Number.isFinite(t)) return [];
626
+ let a = g(n);
627
+ if (!a.ok) return [];
628
+ let o = Math.max(0, Math.min(e.length, Math.floor(t))), s = [...a.schemaByName.values()], c = _(e, n), l = c.versionDeclaration?.features?.includes("macros") && !["macro", "use"].some((e) => a.schemaByName.has(e)), u = l ? C(e, c.nodes) : [], d = [...M(c.nodes), ...N(e, c.nodes)].sort((e, t) => e.start - t.start);
629
+ if (H(d, o) || o === e.length && d.some((e) => e.end === o && e.start < o)) return [];
630
+ let f = u.find((e) => e.bodyRange.start <= o && o < e.bodyRange.end), p = F(e, f ? c.nodes.find((e) => e.range.start === f.range.start)?.children ?? [] : c.nodes, s), m = f ? [...p.bindings, ...f.params.map((e) => ({
631
+ name: e,
632
+ declarations: [],
633
+ references: []
634
+ }))] : p.bindings, h = B(e, o);
635
+ if (h) {
636
+ let t = R(e, o, c.nodes);
637
+ if (t >= 0) {
638
+ let n = L(e, t, o);
639
+ if (n?.inValue && n.currentAttribute) {
640
+ let e = P(n.name, s)?.[n.currentAttribute.name];
641
+ if (e?.static || !e && ["css", "action-id"].includes(n.currentAttribute.name)) return [];
642
+ }
643
+ }
644
+ return W(e, o, h, m);
645
+ }
646
+ let v = R(e, o, c.nodes);
647
+ if (v >= 0) {
648
+ let t = L(e, v, o);
649
+ if (t?.inValue) {
650
+ if (l && t.name === "use") return J(e, o, t, u);
651
+ let n = a.schemaByName.get("text")?.props.font;
652
+ return G(e, o, t, s, t.name === "text" && n?.kind === "enum" && a.componentByName.get("text")?.id === "reactive-md/text" ? r(i(a.config, c.theme), n.values) : void 0);
653
+ }
654
+ }
655
+ let y = q(e, o, s);
656
+ if (l) {
657
+ let t = /<(\/?)([a-z-]*)$/.exec(e.slice(Math.max(0, o - 256), o));
658
+ if (t && e[o - t[0].length - 1] !== "\\") {
659
+ let n = t[1] === "/", r = t[2], i = o - r.length;
660
+ if ("macro".startsWith(r) && y.push({
661
+ label: "macro",
662
+ kind: "tag",
663
+ insertText: "macro",
664
+ range: U(e, i, o, "macro")
665
+ }), !n && "use".startsWith(r)) for (let t of u) {
666
+ let n = U(e, i, o, "use");
667
+ if (e[n.end] === ">") continue;
668
+ let r = t.params.map((e) => " " + e + "=\"\"").join("");
669
+ y.push({
670
+ label: "use " + t.name,
671
+ kind: "tag",
672
+ range: n,
673
+ insertText: "use macro=\"" + t.name + "\"" + r + ">"
674
+ });
675
+ }
676
+ }
677
+ }
678
+ if (y.length > 0) return y;
679
+ if (v >= 0) {
680
+ let t = L(e, v, o);
681
+ if (t) return l && t.name === "use" ? J(e, o, t, u) : K(e, o, t, s);
682
+ }
683
+ return [];
684
+ }
685
+ function X(e, t) {
686
+ let n = "", r = 0;
687
+ for (let i of t) n += e.slice(r, i.range.start) + i.text, r = i.range.end;
688
+ return n + e.slice(r);
689
+ }
690
+ function Z(e, n, r, i) {
691
+ if (typeof e != "string" || typeof n != "string" || typeof r != "string") throw Error("Rename requires string arguments.");
692
+ if (!k(i)) throw Error("Bindings cannot be renamed with invalid compile options.");
693
+ if (!E(r)) throw Error(`"${r}" is not a valid binding name. Use [A-Za-z_][A-Za-z0-9_]* and avoid reserved names.`);
694
+ let a = F(e, _(e, i).nodes, A(i)), o = a.bindings.find((e) => e.name === n);
695
+ if (!o || o.declarations.length === 0) throw Error(`Binding "${n}" is not declared in this document.`);
696
+ if (n === r) return {
697
+ source: e,
698
+ edits: []
699
+ };
700
+ if (a.bindings.some((e) => e.name === r)) throw Error(`Binding "${r}" already exists.`);
701
+ if (O(e, i).some((e) => e.severity === "error" && T.has(e.code))) throw Error("The document cannot be renamed safely while parse errors remain.");
702
+ if (a.references.some((e) => e.name === n && e.scope === "unknown")) throw Error("The binding cannot be renamed safely while an expression has unresolved references.");
703
+ if (t.has(r) && a.references.some((e) => e.name === n && e.scope === "iteration")) throw Error(`Binding "${r}" would be shadowed by an iteration scope.`);
704
+ let s = /* @__PURE__ */ new Set(), c = [];
705
+ for (let e of [...o.declarations, ...o.references]) {
706
+ let t = `${e.start}:${e.end}`;
707
+ s.has(t) || (s.add(t), c.push(D(e)));
708
+ }
709
+ c.sort((e, t) => e.start - t.start || e.end - t.end);
710
+ let l = new Set(a.mathReferences.filter((e) => e.name === n).map((e) => `${e.range.start}:${e.range.end}`)), u = c.map((e) => ({
711
+ range: D(e),
712
+ text: l.has(`${e.start}:${e.end}`) ? `\\mathrm{${r}}` : r
713
+ })), d = X(e, u);
714
+ if (h(e, i).ok && !h(d, i).ok) throw Error("Rename could not preserve all binding references; the source was left unchanged.");
715
+ return {
716
+ source: d,
717
+ edits: u
718
+ };
719
+ }
720
+ function Q(e, t) {
721
+ let n = e.slice(t.nameRange.start, t.nameRange.end), r = t.attrs.map((t) => {
722
+ let n = e.slice(t.nameRange.start, t.nameRange.end);
723
+ return t.valueRange === void 0 ? n : t.quoteStart !== void 0 && t.quoteEnd !== void 0 ? `${n}=${e.slice(t.quoteStart, t.quoteEnd + 1)}` : n;
724
+ }), i = r.length > 0 ? `<${n} ${r.join(" ")}` : `<${n}`;
725
+ return t.selfClosing ? `${i} />` : `${i}>`;
726
+ }
727
+ function $(e, t) {
728
+ if (typeof e != "string" || !k(t)) return e;
729
+ let n;
730
+ try {
731
+ n = h(e, t);
732
+ } catch {
733
+ return e;
734
+ }
735
+ if (n.diagnostics.some((e) => e.severity === "error")) return e;
736
+ let r = _(e, t), i = [], a = (t) => {
737
+ for (let n of t) {
738
+ if ((n.type === "component" || n.type === "hostComponent") && n.name) {
739
+ let t = s(e, n.range.start);
740
+ if (t && !t.closing && !/[\r\n]/.test(e.slice(t.start, t.end))) {
741
+ let n = Q(e, t);
742
+ n !== e.slice(t.start, t.end) && i.push({
743
+ start: t.start,
744
+ end: t.end,
745
+ text: n
746
+ });
747
+ }
748
+ if (t) {
749
+ let r = c(e, n, t.end);
750
+ if (r && !/[\r\n]/.test(e.slice(r.start, r.end))) {
751
+ let t = `</${e.slice(r.nameRange.start, r.nameRange.end)}>`;
752
+ t !== e.slice(r.start, r.end) && i.push({
753
+ start: r.start,
754
+ end: r.end,
755
+ text: t
756
+ });
757
+ }
758
+ }
759
+ }
760
+ n.type !== "fallback" && n.children && a(n.children);
761
+ }
762
+ };
763
+ a(r.nodes), i.sort((e, t) => e.start - t.start || e.end - t.end);
764
+ let o = "", l = 0;
765
+ for (let t of i) t.start < l || (o += e.slice(l, t.start) + t.text, l = t.end);
766
+ return o + e.slice(l);
767
+ }
768
+ export { v as a, Z as i, Y as n, $ as r, I as t };