reactive-md 0.9.2 → 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 (638) hide show
  1. package/CHANGELOG-ch.md +397 -333
  2. package/CHANGELOG.md +398 -334
  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 +0 -57
  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 -445
  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 +325 -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-CP2QG86k.js +114 -0
  28. package/dist-library/{LocalDocumentViewCore-DXE0I0Qc.js → LocalDocumentViewCore-Cd6yMEkg.js} +379 -9445
  29. package/dist-library/LocalReactiveDocumentCore-VuYpZqdn.js +283 -0
  30. package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
  31. package/dist-library/authoring-Bwu_zCWs.js +768 -0
  32. package/dist-library/chart-B1TUtzm-.js +3 -0
  33. package/dist-library/choice-values-BItGjPD2.js +58 -0
  34. package/dist-library/color-values-r8Wf7ALn.js +6 -0
  35. package/dist-library/compile-B35rfzKr.js +1742 -0
  36. package/dist-library/compile-cache-key-D21X2Obx.js +28 -0
  37. package/dist-library/compiler-DBwLawMZ.js +98 -0
  38. package/dist-library/{compiler-core-DDDdvuLy.js → compiler-core-kkDiQ1RK.js} +4202 -3496
  39. package/dist-library/component-kernel-CsJSabHX.js +372 -0
  40. package/dist-library/{component-state-BRwvTV0d.js → component-state-Da0G8Ajc.js} +1 -1
  41. package/dist-library/component-utils-ZM3jUJNy.js +339 -0
  42. package/dist-library/conditional-branches-CIhJXasR.js +17 -0
  43. package/dist-library/config-validation-DbmsWAEV.js +469 -0
  44. package/dist-library/controls-DRy5rzzN.js +5970 -0
  45. package/dist-library/controls-DWlx-AQl.js +3 -0
  46. package/dist-library/{coordinate-B1VFK9fd.js → coordinate-c54pHfgf.js} +89 -89
  47. package/dist-library/data-BtFlkJzp.js +3 -0
  48. package/dist-library/data-table-CSAkm1eU.js +290 -0
  49. package/dist-library/data-table-model-DruztQFt.js +391 -0
  50. package/dist-library/data-visuals-rZQUeQM0.js +384 -0
  51. package/dist-library/{default-components-s21NevON.js → default-components-B-39etG9.js} +518 -355
  52. package/dist-library/{config-DXLvctiZ.js → default-config-CCa8rm2k.js} +265 -230
  53. package/dist-library/default-options-By16CVw1.js +131 -0
  54. package/dist-library/{registry-D6OGkOcX.js → default-registry-DXJy66xj.js} +4 -4
  55. package/dist-library/default-schema-CeYiEW1K.js +33 -0
  56. package/dist-library/diagram-BLepzI8l.js +3 -0
  57. package/dist-library/display-Bb6hAG5T.js +2065 -0
  58. package/dist-library/dist-Cueh1Psp.js +4761 -0
  59. package/dist-library/{document-theme-C8J6UyNO.js → document-theme-CJvN-nC1.js} +246 -4
  60. package/dist-library/{export-CIAIPBov.js → export-BSV4E0jv.js} +135 -135
  61. package/dist-library/font-aliases-CKYjwn4o.js +4 -0
  62. package/dist-library/gallery-BC6FYTqw.js +3 -0
  63. package/dist-library/{gallery-Dv1rOvL0.js → gallery-DM2yTVZJ.js} +1 -1
  64. package/dist-library/{html-Cr4CBwAH.js → html-CY9mC3Sr.js} +49 -48
  65. package/dist-library/{incremental-9nx92u9c.js → incremental-B-wW4H3F.js} +537 -384
  66. package/dist-library/{display-B_uutKkN.js → katex-4ukd4ZxT.js} +1555 -3618
  67. package/dist-library/layout-CPQggKxk.js +592 -0
  68. package/dist-library/layout-CaDWsDof.js +3 -0
  69. package/dist-library/limits-CFERRrlC.js +10 -0
  70. package/dist-library/localization-COdJ6lw2.js +6 -0
  71. package/dist-library/mafs-CnzDC5CR.js +3 -0
  72. package/dist-library/math-view-CyGTS6kv.js +20 -0
  73. package/dist-library/motion-tokens-Czk0RDmS.js +283 -0
  74. package/dist-library/mount-preset-DtrCX4G8.js +24 -0
  75. package/dist-library/numeric-sliders-BmJ1LCLx.js +542 -0
  76. package/dist-library/{observability-4KqXhIEU.js → observability-BVQ16ByQ.js} +125 -43
  77. package/dist-library/package-core-Cu_r_qs7.js +128 -0
  78. package/dist-library/parser-BHl9Lxbw.js +8 -0
  79. package/dist-library/parser-standard-DDAKv_DZ.js +4872 -0
  80. package/dist-library/plugin-packs-CkI0floL.js +19 -0
  81. package/dist-library/preset-core-BKPbH_Nv.js +1371 -0
  82. package/dist-library/props-0iDqxlTk.js +174 -0
  83. package/dist-library/react-74jdGBmu.js +32 -0
  84. package/dist-library/reactive-md-authoring.js +315 -296
  85. package/dist-library/reactive-md-build.js +334 -43
  86. package/dist-library/reactive-md-compiler-session.js +4 -0
  87. package/dist-library/reactive-md-compiler-standard.js +10 -10
  88. package/dist-library/reactive-md-compiler.js +3 -3
  89. package/dist-library/reactive-md-contracts.js +6 -0
  90. package/dist-library/reactive-md-default-packs.js +32 -15
  91. package/dist-library/reactive-md-default-preset.js +7 -7
  92. package/dist-library/reactive-md-export.js +6 -5
  93. package/dist-library/reactive-md-minimal-preset.js +3 -2
  94. package/dist-library/reactive-md-minimal-react-preset.js +26 -23
  95. package/dist-library/reactive-md-minimal.css +1 -1
  96. package/dist-library/reactive-md-observability.js +125 -3
  97. package/dist-library/reactive-md-pack-style-manifest.js +805 -0
  98. package/dist-library/reactive-md-plugin-chart.js +14 -9
  99. package/dist-library/reactive-md-plugin-data.js +8 -8
  100. package/dist-library/reactive-md-plugin-diagram.js +7 -6
  101. package/dist-library/reactive-md-plugin-forms.js +14 -13
  102. package/dist-library/reactive-md-plugin-gallery.js +6 -5
  103. package/dist-library/reactive-md-plugin-navigation.js +8 -8
  104. package/dist-library/reactive-md-plugin-network.js +13 -13
  105. package/dist-library/reactive-md-plugin-plot.js +7 -6
  106. package/dist-library/reactive-md-print.css +304 -304
  107. package/dist-library/reactive-md-react-component-accordion.js +10 -0
  108. package/dist-library/reactive-md-react-component-alert.js +10 -0
  109. package/dist-library/reactive-md-react-component-anchor.js +10 -0
  110. package/dist-library/reactive-md-react-component-badge.js +10 -0
  111. package/dist-library/reactive-md-react-component-card.js +10 -0
  112. package/dist-library/reactive-md-react-component-chart.js +22 -0
  113. package/dist-library/reactive-md-react-component-checkbox.js +10 -0
  114. package/dist-library/reactive-md-react-component-checklist.js +10 -0
  115. package/dist-library/reactive-md-react-component-choices.js +10 -0
  116. package/dist-library/reactive-md-react-component-column.js +6 -0
  117. package/dist-library/reactive-md-react-component-coordinate.js +21 -0
  118. package/dist-library/reactive-md-react-component-counter.js +10 -0
  119. package/dist-library/reactive-md-react-component-data-table.js +14 -0
  120. package/dist-library/reactive-md-react-component-date.js +10 -0
  121. package/dist-library/reactive-md-react-component-diagram.js +22 -0
  122. package/dist-library/reactive-md-react-component-disclosure.js +10 -0
  123. package/dist-library/reactive-md-react-component-edge.js +22 -0
  124. package/dist-library/reactive-md-react-component-else.js +10 -0
  125. package/dist-library/reactive-md-react-component-gallery-item.js +10 -0
  126. package/dist-library/reactive-md-react-component-gallery.js +10 -0
  127. package/dist-library/reactive-md-react-component-grid.js +10 -0
  128. package/dist-library/reactive-md-react-component-if.js +10 -0
  129. package/dist-library/reactive-md-react-component-input.js +10 -0
  130. package/dist-library/reactive-md-react-component-jump.js +10 -0
  131. package/dist-library/reactive-md-react-component-multi-select.js +10 -0
  132. package/dist-library/reactive-md-react-component-node.js +22 -0
  133. package/dist-library/reactive-md-react-component-number.js +10 -0
  134. package/dist-library/reactive-md-react-component-option.js +10 -0
  135. package/dist-library/reactive-md-react-component-panel.js +10 -0
  136. package/dist-library/reactive-md-react-component-plot.js +26 -0
  137. package/dist-library/reactive-md-react-component-progress.js +10 -0
  138. package/dist-library/reactive-md-react-component-quiz.js +10 -0
  139. package/dist-library/reactive-md-react-component-radio-group.js +10 -0
  140. package/dist-library/reactive-md-react-component-range-slider.js +10 -0
  141. package/dist-library/reactive-md-react-component-section.js +10 -0
  142. package/dist-library/reactive-md-react-component-select.js +10 -0
  143. package/dist-library/reactive-md-react-component-slider.js +10 -0
  144. package/dist-library/reactive-md-react-component-step.js +10 -0
  145. package/dist-library/reactive-md-react-component-steps.js +10 -0
  146. package/dist-library/reactive-md-react-component-tab.js +10 -0
  147. package/dist-library/reactive-md-react-component-table.js +14 -0
  148. package/dist-library/reactive-md-react-component-tabs.js +10 -0
  149. package/dist-library/reactive-md-react-component-text.js +10 -0
  150. package/dist-library/reactive-md-react-component-textarea.js +10 -0
  151. package/dist-library/reactive-md-react-component-timeline.js +14 -0
  152. package/dist-library/reactive-md-react-component-timer.js +10 -0
  153. package/dist-library/reactive-md-react-component-toggle.js +10 -0
  154. package/dist-library/reactive-md-react-component-tooltip.js +10 -0
  155. package/dist-library/reactive-md-react-component-validation.js +10 -0
  156. package/dist-library/reactive-md-react-minimal.js +4 -4
  157. package/dist-library/reactive-md-react-pack-controls.js +44 -0
  158. package/dist-library/reactive-md-react-pack-data.js +21 -0
  159. package/dist-library/reactive-md-react-pack-layout.js +37 -0
  160. package/dist-library/reactive-md-react-pack-visuals.js +43 -0
  161. package/dist-library/reactive-md-react-packed.js +50 -0
  162. package/dist-library/reactive-md-react-server.js +29 -27
  163. package/dist-library/reactive-md-react-static-server.js +24 -0
  164. package/dist-library/reactive-md-react-static.js +1 -0
  165. package/dist-library/reactive-md-react-unstyled.js +15 -12
  166. package/dist-library/reactive-md-react.js +15 -12
  167. package/dist-library/reactive-md-scan.js +1 -0
  168. package/dist-library/reactive-md-sdk.js +23 -9
  169. package/dist-library/reactive-md-standalone-configured.js +2 -2
  170. package/dist-library/reactive-md-standalone-host.js +2 -2
  171. package/dist-library/reactive-md-testing-browser.js +2 -2
  172. package/dist-library/reactive-md-testing-react.js +32 -32
  173. package/dist-library/reactive-md-testing.js +12 -12
  174. package/dist-library/reactive-md-vite.js +25 -9
  175. package/dist-library/reactive-md-worker-pool.js +401 -0
  176. package/dist-library/reactive-md.css +1 -1
  177. package/dist-library/reactive-md.js +97 -1554
  178. package/dist-library/registry-core-DxEaxhJ6.js +126 -0
  179. package/dist-library/render-nodes-B6j6Ip5I.js +9404 -0
  180. package/dist-library/requirements-C56sFIEs.js +157 -0
  181. package/dist-library/resources-6VaNgk-h.js +74 -0
  182. package/dist-library/rmd-pack-controls.css +1032 -0
  183. package/dist-library/rmd-pack-data.css +724 -0
  184. package/dist-library/rmd-pack-layout.css +1834 -0
  185. package/dist-library/rmd-pack-resource-chart.css +300 -0
  186. package/dist-library/rmd-pack-resource-controls.css +781 -0
  187. package/dist-library/rmd-pack-resource-data-visuals.css +501 -0
  188. package/dist-library/rmd-pack-resource-diagram.css +106 -0
  189. package/dist-library/rmd-pack-resource-gallery.css +346 -0
  190. package/dist-library/rmd-pack-resource-graphics.css +516 -0
  191. package/dist-library/rmd-pack-resource-layout.css +1489 -0
  192. package/dist-library/rmd-pack-resource-mafs-core.css +124 -0
  193. package/dist-library/rmd-pack-resource-mafs.css +129 -0
  194. package/dist-library/rmd-pack-resource-visual-base.css +224 -0
  195. package/dist-library/rmd-pack-visuals.css +1394 -0
  196. package/dist-library/runtime-BHeuLOv_.js +1369 -0
  197. package/dist-library/runtime-requirement-DzPO8raU.js +772 -0
  198. package/dist-library/schema-core-CDXfxdID.js +155 -0
  199. package/dist-library/sdk-core-CnE-n0Z7.js +1295 -0
  200. package/dist-library/{session-core-dxQCJBNa.js → session-core-C071yQwV.js} +147 -133
  201. package/dist-library/sha256-utf16-Bmandi_H.js +937 -0
  202. package/dist-library/shareable-CHCDnl6j.js +844 -0
  203. package/dist-library/shared-bTzN-F4g.js +3 -0
  204. package/dist-library/structural-views-30-YD_TJ.js +11 -0
  205. package/dist-library/table-surface-CfZn_tk-.js +13 -0
  206. package/dist-library/types/assemblies/compile-cache-key.d.ts +11 -0
  207. package/dist-library/types/assemblies/default-config.d.ts +35 -0
  208. package/dist-library/types/{local/configuration/options.d.ts → assemblies/default-options.d.ts} +4 -4
  209. package/dist-library/types/assemblies/default-registry.d.ts +18 -0
  210. package/dist-library/types/{local/configuration/schema.d.ts → assemblies/default-schema.d.ts} +4 -4
  211. package/dist-library/types/authoring/catalog.d.ts +14 -2
  212. package/dist-library/types/authoring/extensions.d.ts +1 -1
  213. package/dist-library/types/authoring/index.d.ts +4 -4
  214. package/dist-library/types/authoring/templates.d.ts +1 -1
  215. package/dist-library/types/compiler/index.d.ts +1 -0
  216. package/dist-library/types/compiler/session.d.ts +19 -0
  217. package/dist-library/types/compiler/standard.d.ts +1 -0
  218. package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
  219. package/dist-library/types/components/chart/default-chart.d.ts +7 -0
  220. package/dist-library/types/components/entries/accordion.d.ts +3 -0
  221. package/dist-library/types/components/entries/alert.d.ts +3 -0
  222. package/dist-library/types/components/entries/anchor.d.ts +3 -0
  223. package/dist-library/types/components/entries/badge.d.ts +3 -0
  224. package/dist-library/types/components/entries/card.d.ts +3 -0
  225. package/dist-library/types/components/entries/chart.d.ts +3 -0
  226. package/dist-library/types/components/entries/checkbox.d.ts +3 -0
  227. package/dist-library/types/components/entries/checklist.d.ts +3 -0
  228. package/dist-library/types/components/entries/choices.d.ts +3 -0
  229. package/dist-library/types/components/entries/column.d.ts +3 -0
  230. package/dist-library/types/components/entries/coordinate.d.ts +3 -0
  231. package/dist-library/types/components/entries/counter.d.ts +3 -0
  232. package/dist-library/types/components/entries/data-table.d.ts +3 -0
  233. package/dist-library/types/components/entries/date.d.ts +3 -0
  234. package/dist-library/types/components/entries/diagram.d.ts +3 -0
  235. package/dist-library/types/components/entries/disclosure.d.ts +3 -0
  236. package/dist-library/types/components/entries/edge.d.ts +3 -0
  237. package/dist-library/types/components/entries/else.d.ts +3 -0
  238. package/dist-library/types/components/entries/gallery-item.d.ts +3 -0
  239. package/dist-library/types/components/entries/gallery.d.ts +3 -0
  240. package/dist-library/types/components/entries/grid.d.ts +3 -0
  241. package/dist-library/types/components/entries/if.d.ts +3 -0
  242. package/dist-library/types/components/entries/input.d.ts +3 -0
  243. package/dist-library/types/components/entries/jump.d.ts +3 -0
  244. package/dist-library/types/components/entries/multi-select.d.ts +3 -0
  245. package/dist-library/types/components/entries/node.d.ts +3 -0
  246. package/dist-library/types/components/entries/number.d.ts +3 -0
  247. package/dist-library/types/components/entries/option.d.ts +3 -0
  248. package/dist-library/types/components/entries/panel.d.ts +3 -0
  249. package/dist-library/types/components/entries/plot.d.ts +3 -0
  250. package/dist-library/types/components/entries/progress.d.ts +3 -0
  251. package/dist-library/types/components/entries/quiz.d.ts +3 -0
  252. package/dist-library/types/components/entries/radio-group.d.ts +3 -0
  253. package/dist-library/types/components/entries/range-slider.d.ts +3 -0
  254. package/dist-library/types/components/entries/section.d.ts +3 -0
  255. package/dist-library/types/components/entries/select.d.ts +3 -0
  256. package/dist-library/types/components/entries/slider.d.ts +3 -0
  257. package/dist-library/types/components/entries/step.d.ts +3 -0
  258. package/dist-library/types/components/entries/steps.d.ts +3 -0
  259. package/dist-library/types/components/entries/tab.d.ts +3 -0
  260. package/dist-library/types/components/entries/table.d.ts +3 -0
  261. package/dist-library/types/components/entries/tabs.d.ts +3 -0
  262. package/dist-library/types/components/entries/text.d.ts +3 -0
  263. package/dist-library/types/components/entries/textarea.d.ts +3 -0
  264. package/dist-library/types/components/entries/timeline.d.ts +3 -0
  265. package/dist-library/types/components/entries/timer.d.ts +3 -0
  266. package/dist-library/types/components/entries/toggle.d.ts +3 -0
  267. package/dist-library/types/components/entries/tooltip.d.ts +3 -0
  268. package/dist-library/types/components/entries/validation.d.ts +3 -0
  269. package/dist-library/types/components/layout/layout.d.ts +6 -3
  270. package/dist-library/types/components/layout/structural-views.d.ts +3 -0
  271. package/dist-library/types/components/mount-preset.d.ts +2 -0
  272. package/dist-library/types/components/packs/controls.d.ts +2 -0
  273. package/dist-library/types/components/packs/data.d.ts +2 -0
  274. package/dist-library/types/components/packs/layout.d.ts +2 -0
  275. package/dist-library/types/components/packs/visuals.d.ts +2 -0
  276. package/dist-library/types/components/shared/data-visuals.d.ts +3 -0
  277. package/dist-library/types/components/shared/table-surface.d.ts +10 -0
  278. package/dist-library/types/components/shared/visual-helpers.d.ts +24 -0
  279. package/dist-library/types/components/shared/visuals.d.ts +1 -3
  280. package/dist-library/types/components/table/data-table-model.d.ts +141 -0
  281. package/dist-library/types/components/table/data-table.d.ts +3 -50
  282. package/dist-library/types/{local/configuration → contracts}/component-kernel.d.ts +9 -2
  283. package/dist-library/types/contracts/font-aliases.d.ts +18 -0
  284. package/dist-library/types/contracts/index.d.ts +8 -0
  285. package/dist-library/types/{local/configuration → contracts}/limits.d.ts +9 -1
  286. package/dist-library/types/contracts/localization.d.ts +6 -0
  287. package/dist-library/types/contracts/number-literal.d.ts +2 -0
  288. package/dist-library/types/contracts/runtime-types.d.ts +19 -0
  289. package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
  290. package/dist-library/types/export/index.d.ts +4 -1
  291. package/dist-library/types/local/compilation/cache-version.d.ts +1 -0
  292. package/dist-library/types/local/compilation/compile-status.d.ts +2 -0
  293. package/dist-library/types/local/compilation/compiler-bindings.d.ts +1 -1
  294. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +4 -1
  295. package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
  296. package/dist-library/types/local/compilation/compiler-core.d.ts +1 -1
  297. package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
  298. package/dist-library/types/local/compilation/compiler-embedding.d.ts +20 -0
  299. package/dist-library/types/local/compilation/compiler-expressions.d.ts +17 -5
  300. package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
  301. package/dist-library/types/local/compilation/compiler-structure.d.ts +9 -3
  302. package/dist-library/types/local/compilation/compiler-tables.d.ts +4 -2
  303. package/dist-library/types/local/compilation/compiler-validation.d.ts +14 -7
  304. package/dist-library/types/local/compilation/compiler-values.d.ts +2 -3
  305. package/dist-library/types/local/compilation/compiler.d.ts +1 -1
  306. package/dist-library/types/local/compilation/component-usage.d.ts +2 -0
  307. package/dist-library/types/local/compilation/runtime-requirement.d.ts +3 -0
  308. package/dist-library/types/local/compilation/session/incremental.d.ts +5 -1
  309. package/dist-library/types/local/compilation/streaming.d.ts +1 -1
  310. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +228 -2
  311. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
  312. package/dist-library/types/local/configuration/embedding.d.ts +4 -0
  313. package/dist-library/types/local/configuration/kernel-value-rules.d.ts +1 -1
  314. package/dist-library/types/local/configuration/options-core.d.ts +8 -2
  315. package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
  316. package/dist-library/types/local/evaluation/computations.d.ts +13 -5
  317. package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
  318. package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
  319. package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
  320. package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
  321. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
  322. package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
  323. package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
  324. package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
  325. package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
  326. package/dist-library/types/local/evaluation/validation.d.ts +8 -6
  327. package/dist-library/types/local/index.d.ts +10 -4
  328. package/dist-library/types/local/observability-core.d.ts +20 -1
  329. package/dist-library/types/local/observability.d.ts +2 -0
  330. package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
  331. package/dist-library/types/local/parsing/parse-budget.d.ts +18 -2
  332. package/dist-library/types/local/parsing/parser-region.d.ts +13 -2
  333. package/dist-library/types/local/parsing/parser-tags.d.ts +6 -1
  334. package/dist-library/types/local/parsing/rmd-recovery.d.ts +8 -0
  335. package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
  336. package/dist-library/types/local/performance-report.d.ts +70 -0
  337. package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
  338. package/dist-library/types/local/runtime/runtime-pool.d.ts +14 -0
  339. package/dist-library/types/local/runtime/runtime.d.ts +3 -1
  340. package/dist-library/types/local/runtime/state.d.ts +30 -15
  341. package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
  342. package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
  343. package/dist-library/types/local/source/authoring.d.ts +10 -0
  344. package/dist-library/types/local/source/source-migration.d.ts +1 -0
  345. package/dist-library/types/local/transport/worker-handler.d.ts +3 -0
  346. package/dist-library/types/local/transport/worker-job.d.ts +12 -2
  347. package/dist-library/types/local/transport/worker-pool.d.ts +68 -0
  348. package/dist-library/types/local/transport/worker.d.ts +14 -0
  349. package/dist-library/types/local/types.d.ts +70 -27
  350. package/dist-library/types/observability.d.ts +1 -0
  351. package/dist-library/types/presets/default-semantics.d.ts +1 -1
  352. package/dist-library/types/presets/identity.d.ts +1 -8
  353. package/dist-library/types/presets/pack-style-entry.d.ts +3 -0
  354. package/dist-library/types/presets/pack-style-manifest.d.ts +11 -0
  355. package/dist-library/types/react/component-api.d.ts +24 -4
  356. package/dist-library/types/react/component-loader.d.ts +61 -0
  357. package/dist-library/types/react/component-primitives.d.ts +5 -5
  358. package/dist-library/types/react/component-utils.d.ts +11 -0
  359. package/dist-library/types/react/font-aliases.d.ts +2 -0
  360. package/dist-library/types/react/index.d.ts +9 -5
  361. package/dist-library/types/react/localization.d.ts +5 -6
  362. package/dist-library/types/react/minimal.d.ts +2 -2
  363. package/dist-library/types/react/package-core.d.ts +6 -0
  364. package/dist-library/types/react/packed.d.ts +17 -0
  365. package/dist-library/types/react/render-lifecycle.d.ts +9 -0
  366. package/dist-library/types/{local → react}/rendering/document/ExtendedHtmlFragment.d.ts +1 -1
  367. package/dist-library/types/{local → react}/rendering/document/LocalDocumentViewCore.d.ts +11 -4
  368. package/dist-library/types/react/rendering/document/LocalPooledDocumentView.d.ts +8 -0
  369. package/dist-library/types/react/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
  370. package/dist-library/types/react/rendering/document/LocalStaticDocumentView.d.ts +18 -0
  371. package/dist-library/types/react/rendering/document/StaticExternalSlot.d.ts +25 -0
  372. package/dist-library/types/react/rendering/document/StaticHostData.d.ts +14 -0
  373. package/dist-library/types/{local → react}/rendering/document/render-nodes.d.ts +8 -8
  374. package/dist-library/types/react/rendering/document/static-runtime.d.ts +11 -0
  375. package/dist-library/types/{local → react}/rendering/document/use-author-script.d.ts +2 -2
  376. package/dist-library/types/{local → react}/rendering/document/validation-state.d.ts +3 -3
  377. package/dist-library/types/{local → react}/rendering/document/view-render-context.d.ts +40 -8
  378. package/dist-library/types/{local → react}/rendering/document/view-revision.d.ts +5 -14
  379. package/dist-library/types/{local → react}/rendering/render-types.d.ts +5 -5
  380. package/dist-library/types/react/rendering/table/data-table.d.ts +5 -0
  381. package/dist-library/types/{local → react}/rendering/table/table-numeric-columns.d.ts +3 -3
  382. package/dist-library/types/react/sdk-core.d.ts +15 -4
  383. package/dist-library/types/react/sdk.d.ts +2 -1
  384. package/dist-library/types/react/server.d.ts +3 -10
  385. package/dist-library/types/react/static-server.d.ts +12 -0
  386. package/dist-library/types/scan/index.d.ts +15 -0
  387. package/dist-library/types/sdk/assembly.d.ts +3 -0
  388. package/dist-library/types/sdk/config.d.ts +2 -35
  389. package/dist-library/types/sdk/default-identity.d.ts +3 -0
  390. package/dist-library/types/sdk/font.d.ts +13 -0
  391. package/dist-library/types/sdk/index.d.ts +2 -1
  392. package/dist-library/types/sdk/preset.d.ts +9 -0
  393. package/dist-library/types/sdk/props.d.ts +8 -3
  394. package/dist-library/types/sdk/registry-core.d.ts +2 -2
  395. package/dist-library/types/sdk/registry.d.ts +2 -18
  396. package/dist-library/types/sdk/theme.d.ts +5 -0
  397. package/dist-library/types/sdk/types.d.ts +8 -2
  398. package/dist-library/types/sdk/version.d.ts +2 -0
  399. package/dist-library/types/shareable.d.ts +15 -3
  400. package/dist-library/types/standalone/prepare.d.ts +4 -2
  401. package/dist-library/types/standalone/session-core.d.ts +5 -2
  402. package/dist-library/types/vite/index.d.ts +3 -0
  403. package/dist-library/types/vite/registration.d.ts +1 -0
  404. package/dist-library/{types-Ib5kSScP.js → types-B4qG8J4S.js} +1 -1
  405. package/dist-library/types-FYhRWRn9.js +3 -0
  406. package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
  407. package/dist-library/validation-DRuW0Wl9.js +433 -0
  408. package/dist-library/{version-DAxuGOG2.js → version-4wzhbvDG.js} +24 -33
  409. package/dist-library/visual-frame-y5RFhJ0_.js +19 -0
  410. package/dist-library/visual-helpers-UU6xiL8g.js +75 -0
  411. package/dist-library/visuals-7xzoL9ql.js +49340 -0
  412. package/dist-library/visuals-CdHezgh5.js +3 -0
  413. package/dist-library/worker-3ldRjOEG.js +1632 -0
  414. package/dist-standalone/reactive-md-standalone.css +1 -1
  415. package/dist-standalone/reactive-md-standalone.js +127 -366
  416. package/docs/README-ch.md +104 -101
  417. package/docs/README.md +104 -101
  418. package/docs/compatibility/api-stability-ch.md +1 -1
  419. package/docs/compatibility/api-stability-en.md +1 -1
  420. package/docs/compatibility/compatibility-ch.md +146 -146
  421. package/docs/compatibility/compatibility-en.md +146 -146
  422. package/docs/compatibility/compatibility-manifest.schema.json +3 -2
  423. package/docs/compatibility/deprecation-ch.md +2 -2
  424. package/docs/compatibility/deprecation-en.md +2 -2
  425. package/docs/compatibility/source-versioning-ch.md +170 -162
  426. package/docs/compatibility/source-versioning-en.md +171 -162
  427. package/docs/compatibility/support-matrix-ch.md +4 -3
  428. package/docs/compatibility/support-matrix-en.md +4 -3
  429. package/docs/development/component-development-ch.md +66 -66
  430. package/docs/development/component-development-en.md +66 -66
  431. package/docs/development/component-development-reference-ch.md +269 -253
  432. package/docs/development/component-development-reference-en.md +254 -238
  433. package/docs/development/component-protocol-ch.md +768 -748
  434. package/docs/development/component-protocol-en.md +770 -750
  435. package/docs/development/extension-tutorial-ch.md +308 -308
  436. package/docs/development/extension-tutorial-en.md +308 -308
  437. package/docs/development/performance-overview-ch.md +422 -422
  438. package/docs/development/performance-overview-en.md +422 -422
  439. package/docs/guides/local-guide-ch.md +621 -532
  440. package/docs/guides/local-guide-en.md +621 -532
  441. package/docs/integration/author-tools-ch.md +66 -64
  442. package/docs/integration/author-tools-en.md +66 -64
  443. package/docs/integration/compiler-ch.md +90 -49
  444. package/docs/integration/compiler-en.md +77 -36
  445. package/docs/integration/directory-discovery-en.md +1 -1
  446. package/docs/integration/editor-ch.md +295 -295
  447. package/docs/integration/editor-en.md +303 -303
  448. package/docs/integration/extension-sdk-ch.md +424 -394
  449. package/docs/integration/extension-sdk-en.md +409 -379
  450. package/docs/integration/local-integration-ch.md +648 -646
  451. package/docs/integration/local-integration-en.md +664 -662
  452. package/docs/integration/pdf-export-ch.md +42 -0
  453. package/docs/integration/pdf-export-en.md +42 -0
  454. package/docs/integration/shareable-export-ch.md +299 -307
  455. package/docs/integration/shareable-export-en.md +301 -309
  456. package/docs/reference/diagnostics-counting-ch.md +127 -104
  457. package/docs/reference/diagnostics-counting-en.md +127 -104
  458. package/docs/reference/html-compatibility-ch.md +93 -93
  459. package/docs/reference/html-compatibility-en.md +95 -95
  460. package/docs/reference/local-interaction-syntax-ch.md +913 -724
  461. package/docs/reference/local-interaction-syntax-en.md +911 -722
  462. package/docs/reference/public-api-ch.md +134 -21
  463. package/docs/reference/public-api-en.md +134 -21
  464. package/docs/reference/theme-protocol-ch.md +198 -198
  465. package/docs/reference/theme-protocol-en.md +217 -217
  466. package/docs/releases/release-0.10.0-ch.md +45 -0
  467. package/docs/releases/release-0.10.0-en.md +45 -0
  468. package/docs/releases/release-0.4.0-ch.md +91 -91
  469. package/docs/releases/release-0.4.0-en.md +91 -91
  470. package/docs/releases/release-0.4.1-ch.md +25 -25
  471. package/docs/releases/release-0.4.1-en.md +25 -25
  472. package/docs/releases/release-0.5.0-ch.md +43 -43
  473. package/docs/releases/release-0.5.0-en.md +43 -43
  474. package/docs/releases/release-0.5.1-ch.md +41 -41
  475. package/docs/releases/release-0.5.1-en.md +41 -41
  476. package/docs/releases/release-0.5.2-ch.md +37 -37
  477. package/docs/releases/release-0.5.2-en.md +37 -37
  478. package/docs/releases/release-0.5.3-ch.md +26 -26
  479. package/docs/releases/release-0.5.3-en.md +26 -26
  480. package/docs/releases/release-0.6.0-ch.md +59 -59
  481. package/docs/releases/release-0.6.0-en.md +59 -59
  482. package/docs/releases/release-0.6.1-ch.md +29 -29
  483. package/docs/releases/release-0.6.1-en.md +29 -29
  484. package/docs/releases/release-0.7.0-ch.md +86 -86
  485. package/docs/releases/release-0.7.0-en.md +86 -86
  486. package/docs/releases/release-0.9.3-ch.md +45 -0
  487. package/docs/releases/release-0.9.3-en.md +45 -0
  488. package/examples/component-package/README-ch.md +101 -101
  489. package/examples/component-package/README.md +133 -133
  490. package/examples/conformance/README-ch.md +55 -55
  491. package/examples/conformance/README.md +55 -55
  492. package/examples/conformance/component-protocol-1.json +482 -482
  493. package/examples/conformance/component-protocol-1.schema.json +76 -76
  494. package/examples/conformance/local-draft-1.json +50 -50
  495. package/examples/conformance/local-draft-2.json +212 -212
  496. package/examples/conformance/local-draft-4.json +441 -0
  497. package/examples/game-2048-package/LICENSE +21 -21
  498. package/examples/game-2048-package/NOTICES.md +11 -11
  499. package/examples/game-2048-package/README-ch.md +91 -91
  500. package/examples/game-2048-package/README.md +98 -98
  501. package/examples/game-2048-package/package.json +35 -35
  502. package/examples/game-2048-package/sample/document.reactive.md +17 -17
  503. package/examples/game-2048-package/scripts/build-export.mjs +44 -44
  504. package/examples/game-2048-package/scripts/build.mjs +130 -130
  505. package/examples/game-2048-package/scripts/verify.mjs +180 -180
  506. package/examples/game-2048-package/src/component.css +161 -161
  507. package/examples/game-2048-package/src/components.tsx +326 -326
  508. package/examples/game-2048-package/src/game-engine.ts +228 -228
  509. package/examples/game-2048-package/src/harness.tsx +34 -34
  510. package/examples/game-2048-package/src/manifest.ts +85 -85
  511. package/examples/game-2048-package/src/node-entry.ts +30 -30
  512. package/examples/game-2048-package/src/sample.ts +4 -4
  513. package/examples/game-2048-package/tsconfig.json +15 -15
  514. package/examples/integration/README-ch.md +114 -82
  515. package/examples/integration/README.md +114 -82
  516. package/examples/integration/chat-session/index.mjs +91 -0
  517. package/examples/integration/chat-session/package.json +10 -0
  518. package/examples/integration/core/index.mjs +32 -32
  519. package/examples/integration/extension-sdk/README-ch.md +24 -24
  520. package/examples/integration/extension-sdk/README.md +24 -24
  521. package/examples/integration/static-embed/embed.mjs +44 -0
  522. package/examples/integration/static-embed/index.html +12 -0
  523. package/examples/integration/static-embed/main.mjs +24 -0
  524. package/examples/integration/static-embed/references.mjs +5 -0
  525. package/examples/integration/static-embed/render.mjs +10 -0
  526. package/examples/integration/worker/index.html +19 -19
  527. package/examples/integration/worker/main.js +61 -61
  528. package/examples/integration/worker/package.json +13 -13
  529. package/examples/integration/worker/worker.js +3 -3
  530. package/examples/local/README-ch.md +76 -76
  531. package/examples/local/README.md +76 -76
  532. package/examples/local/charts.reactive.md +73 -73
  533. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  534. package/examples/local/recipes/invoice.reactive.md +36 -36
  535. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  536. package/examples/local/recipes/workshop.reactive.md +33 -33
  537. package/examples/local/showcase/README-ch.md +22 -22
  538. package/examples/local/showcase/README.md +31 -31
  539. package/examples/local/showcase/explore.reactive.md +102 -102
  540. package/examples/local/showcase/flow.reactive.md +86 -86
  541. package/examples/local/showcase/forms.reactive.md +126 -126
  542. package/examples/local/showcase/functions.reactive.md +119 -119
  543. package/examples/local/showcase/layout.reactive.md +100 -100
  544. package/examples/local/showcase/statistics.reactive.md +108 -108
  545. package/examples/local/showcase/tasks.reactive.md +89 -89
  546. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  547. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  548. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  549. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  550. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  551. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  552. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  553. package/examples/minimal-extension/README-ch.md +78 -78
  554. package/examples/minimal-extension/README.md +78 -78
  555. package/examples/minimal-extension/index.html +15 -15
  556. package/examples/minimal-extension/package.json +26 -26
  557. package/examples/minimal-extension/sample/document.reactive.md +10 -10
  558. package/examples/minimal-extension/scripts/build.mjs +32 -32
  559. package/examples/minimal-extension/scripts/export.mjs +72 -72
  560. package/examples/minimal-extension/scripts/test-node.mjs +75 -75
  561. package/examples/minimal-extension/src/extension.tsx +90 -90
  562. package/examples/minimal-extension/src/preview.tsx +12 -12
  563. package/examples/minimal-extension/src/source.ts +4 -4
  564. package/examples/minimal-extension/tsconfig.json +14 -14
  565. package/examples/sci-fi-theme/README-ch.md +133 -133
  566. package/examples/sci-fi-theme/README.md +148 -148
  567. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
  568. package/examples/sci-fi-theme/demo/demo.css +638 -638
  569. package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
  570. package/examples/sci-fi-theme/demo/index.html +13 -13
  571. package/examples/sci-fi-theme/demo/main.tsx +215 -215
  572. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
  573. package/examples/sci-fi-theme/docs/design-system.md +474 -474
  574. package/examples/sci-fi-theme/package.json +28 -28
  575. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
  576. package/examples/sci-fi-theme/src/components.css +2370 -2370
  577. package/examples/sci-fi-theme/src/index.ts +6 -6
  578. package/examples/sci-fi-theme/src/notch.css +142 -142
  579. package/examples/sci-fi-theme/src/sci-fi.css +7 -7
  580. package/examples/sci-fi-theme/src/theme.ts +39 -39
  581. package/examples/sci-fi-theme/tsconfig.json +20 -20
  582. package/examples/sci-fi-theme/vite.config.ts +24 -24
  583. package/examples/tetris-package/LICENSE +21 -21
  584. package/examples/tetris-package/NOTICES.md +11 -11
  585. package/examples/tetris-package/README-ch.md +91 -91
  586. package/examples/tetris-package/README.md +95 -95
  587. package/examples/tetris-package/package.json +35 -35
  588. package/examples/tetris-package/sample/document.reactive.md +16 -16
  589. package/examples/tetris-package/scripts/build-export.mjs +44 -44
  590. package/examples/tetris-package/scripts/build.mjs +130 -130
  591. package/examples/tetris-package/scripts/verify.mjs +173 -173
  592. package/examples/tetris-package/src/component.css +145 -145
  593. package/examples/tetris-package/src/components.tsx +334 -334
  594. package/examples/tetris-package/src/harness.tsx +34 -34
  595. package/examples/tetris-package/src/manifests.ts +93 -93
  596. package/examples/tetris-package/src/node-entry.ts +16 -16
  597. package/examples/tetris-package/src/sample.ts +4 -4
  598. package/examples/tetris-package/src/tetris-engine.ts +325 -325
  599. package/examples/tetris-package/tsconfig.json +15 -15
  600. package/package.json +66 -2
  601. package/dist-library/LocalDocumentView-BuqgJZEY.js +0 -109
  602. package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +0 -275
  603. package/dist-library/authoring-Ci_KzJ0q.js +0 -892
  604. package/dist-library/compile-Dx6Uw3D9.js +0 -1249
  605. package/dist-library/compiler-dxLPB9Ym.js +0 -86
  606. package/dist-library/config-validation-D3D7Dy2J.js +0 -586
  607. package/dist-library/controls-DoZyLCrV.js +0 -6740
  608. package/dist-library/data-table-8-3F15Jf.js +0 -296
  609. package/dist-library/layout-BBB2VF0S.js +0 -562
  610. package/dist-library/mount-preset-DMZ5wd3t.js +0 -13
  611. package/dist-library/options-BBp9IcHm.js +0 -121
  612. package/dist-library/package-core-K5xesGqy.js +0 -117
  613. package/dist-library/parser-standard-CBA1-hdG.js +0 -9630
  614. package/dist-library/plugin-packs-Bh1HhLym.js +0 -19
  615. package/dist-library/preset-core-DeZPA8IE.js +0 -1298
  616. package/dist-library/props-sJ8vk0cr.js +0 -183
  617. package/dist-library/react-0DCh-Mar.js +0 -7
  618. package/dist-library/registry-core-C9xOunaw.js +0 -479
  619. package/dist-library/resources-B0x_w3s9.js +0 -229
  620. package/dist-library/runtime-BpQdZmFI.js +0 -1288
  621. package/dist-library/schema-BryM_VRW.js +0 -40
  622. package/dist-library/sdk-core-ChslheKs.js +0 -1167
  623. package/dist-library/shareable-B8xMoGEa.js +0 -814
  624. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +0 -6
  625. package/dist-library/types/local/rendering/table/data-table.d.ts +0 -13
  626. package/dist-library/types-daDo2c_w.js +0 -3
  627. package/dist-library/validation-B3RI0xOk.js +0 -1123
  628. package/dist-library/visual-frame-_rcd5HUv.js +0 -48
  629. package/dist-library/visuals-DkDhNdEZ.js +0 -72572
  630. /package/dist-library/types/{local/configuration → contracts}/color-values.d.ts +0 -0
  631. /package/dist-library/types/{local/html → contracts}/html-names.d.ts +0 -0
  632. /package/dist-library/types/{local/configuration → contracts}/schema-core.d.ts +0 -0
  633. /package/dist-library/types/{local → react}/rendering/code/code-block.d.ts +0 -0
  634. /package/dist-library/types/{local → react}/rendering/code/code-languages.d.ts +0 -0
  635. /package/dist-library/types/{local → react}/rendering/document/LocalDocumentView.d.ts +0 -0
  636. /package/dist-library/types/{local → react}/rendering/document/use-color-scheme.d.ts +0 -0
  637. /package/dist-library/types/{local → react}/rendering/image/image-view.d.ts +0 -0
  638. /package/dist-library/types/{local → react}/rendering/math-view.d.ts +0 -0
@@ -0,0 +1,2065 @@
1
+ import { f as e, v as t } from "./document-theme-CJvN-nC1.js";
2
+ import { t as n } from "./katex-4ukd4ZxT.js";
3
+ n.__defineMacro("\\ce", function(e) {
4
+ return r(e.consumeArgs(1)[0], "ce");
5
+ }), n.__defineMacro("\\pu", function(e) {
6
+ return r(e.consumeArgs(1)[0], "pu");
7
+ }), n.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
8
+ var r = function(e, t) {
9
+ for (var n = "", r = e.length && e[e.length - 1].loc.start, o = e.length - 1; o >= 0; o--) e[o].loc.start > r && (n += " ", r = e[o].loc.start), n += e[o].text, r += e[o].text.length;
10
+ return a.go(i.go(n, t));
11
+ }, i = {
12
+ go: function(e, t) {
13
+ if (!e) return [];
14
+ t === void 0 && (t = "ce");
15
+ var n = "0", r = {};
16
+ r.parenthesisLevel = 0, e = e.replace(/\n/g, " "), e = e.replace(/[\u2212\u2013\u2014\u2010]/g, "-"), e = e.replace(/[\u2026]/g, "...");
17
+ for (var a, o = 10, s = [];;) {
18
+ a === e ? o-- : (o = 10, a = e);
19
+ var c = i.stateMachines[t], l = c.transitions[n] || c.transitions["*"];
20
+ iterateTransitions: for (var u = 0; u < l.length; u++) {
21
+ var d = i.patterns.match_(l[u].pattern, e);
22
+ if (d) {
23
+ for (var f = l[u].task, p = 0; p < f.action_.length; p++) {
24
+ var m;
25
+ if (c.actions[f.action_[p].type_]) m = c.actions[f.action_[p].type_](r, d.match_, f.action_[p].option);
26
+ else if (i.actions[f.action_[p].type_]) m = i.actions[f.action_[p].type_](r, d.match_, f.action_[p].option);
27
+ else throw ["MhchemBugA", "mhchem bug A. Please report. (" + f.action_[p].type_ + ")"];
28
+ i.concatArray(s, m);
29
+ }
30
+ if (n = f.nextState || n, e.length > 0) {
31
+ if (f.revisit || (e = d.remainder), !f.toContinue) break iterateTransitions;
32
+ } else return s;
33
+ }
34
+ }
35
+ if (o <= 0) throw ["MhchemBugU", "mhchem bug U. Please report."];
36
+ }
37
+ },
38
+ concatArray: function(e, t) {
39
+ if (t) {
40
+ if (Array.isArray(t)) for (var n = 0; n < t.length; n++) e.push(t[n]);
41
+ else e.push(t);
42
+ }
43
+ },
44
+ patterns: {
45
+ patterns: {
46
+ empty: /^$/,
47
+ else: /^./,
48
+ else2: /^./,
49
+ space: /^\s/,
50
+ "space A": /^\s(?=[A-Z\\$])/,
51
+ space$: /^\s$/,
52
+ "a-z": /^[a-z]/,
53
+ x: /^x/,
54
+ x$: /^x$/,
55
+ i$: /^i$/,
56
+ letters: /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,
57
+ "\\greek": /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,
58
+ "one lowercase latin letter $": /^(?:([a-z])(?:$|[^a-zA-Z]))$/,
59
+ "$one lowercase latin letter$ $": /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,
60
+ "one lowercase greek letter $": /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,
61
+ digits: /^[0-9]+/,
62
+ "-9.,9": /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,
63
+ "-9.,9 no missing 0": /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
64
+ "(-)(9.,9)(e)(99)": function(e) {
65
+ var t = e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);
66
+ return t && t[0] ? {
67
+ match_: t.splice(1),
68
+ remainder: e.substr(t[0].length)
69
+ } : null;
70
+ },
71
+ "(-)(9)^(-9)": function(e) {
72
+ var t = e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
73
+ return t && t[0] ? {
74
+ match_: t.splice(1),
75
+ remainder: e.substr(t[0].length)
76
+ } : null;
77
+ },
78
+ "state of aggregation $": function(e) {
79
+ var t = i.patterns.findObserveGroups(e, "", /^\([a-z]{1,3}(?=[\),])/, ")", "");
80
+ if (t && t.remainder.match(/^($|[\s,;\)\]\}])/)) return t;
81
+ var n = e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);
82
+ return n ? {
83
+ match_: n[0],
84
+ remainder: e.substr(n[0].length)
85
+ } : null;
86
+ },
87
+ "_{(state of aggregation)}$": /^_\{(\([a-z]{1,3}\))\}/,
88
+ "{[(": /^(?:\\\{|\[|\()/,
89
+ ")]}": /^(?:\)|\]|\\\})/,
90
+ ", ": /^[,;]\s*/,
91
+ ",": /^[,;]/,
92
+ ".": /^[.]/,
93
+ ". ": /^([.\u22C5\u00B7\u2022])\s*/,
94
+ "...": /^\.\.\.(?=$|[^.])/,
95
+ "* ": /^([*])\s*/,
96
+ "^{(...)}": function(e) {
97
+ return i.patterns.findObserveGroups(e, "^{", "", "", "}");
98
+ },
99
+ "^($...$)": function(e) {
100
+ return i.patterns.findObserveGroups(e, "^", "$", "$", "");
101
+ },
102
+ "^a": /^\^([0-9]+|[^\\_])/,
103
+ "^\\x{}{}": function(e) {
104
+ return i.patterns.findObserveGroups(e, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
105
+ },
106
+ "^\\x{}": function(e) {
107
+ return i.patterns.findObserveGroups(e, "^", /^\\[a-zA-Z]+\{/, "}", "");
108
+ },
109
+ "^\\x": /^\^(\\[a-zA-Z]+)\s*/,
110
+ "^(-1)": /^\^(-?\d+)/,
111
+ "'": /^'/,
112
+ "_{(...)}": function(e) {
113
+ return i.patterns.findObserveGroups(e, "_{", "", "", "}");
114
+ },
115
+ "_($...$)": function(e) {
116
+ return i.patterns.findObserveGroups(e, "_", "$", "$", "");
117
+ },
118
+ _9: /^_([+\-]?[0-9]+|[^\\])/,
119
+ "_\\x{}{}": function(e) {
120
+ return i.patterns.findObserveGroups(e, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
121
+ },
122
+ "_\\x{}": function(e) {
123
+ return i.patterns.findObserveGroups(e, "_", /^\\[a-zA-Z]+\{/, "}", "");
124
+ },
125
+ "_\\x": /^_(\\[a-zA-Z]+)\s*/,
126
+ "^_": /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,
127
+ "{}": /^\{\}/,
128
+ "{...}": function(e) {
129
+ return i.patterns.findObserveGroups(e, "", "{", "}", "");
130
+ },
131
+ "{(...)}": function(e) {
132
+ return i.patterns.findObserveGroups(e, "{", "", "", "}");
133
+ },
134
+ "$...$": function(e) {
135
+ return i.patterns.findObserveGroups(e, "", "$", "$", "");
136
+ },
137
+ "${(...)}$": function(e) {
138
+ return i.patterns.findObserveGroups(e, "${", "", "", "}$");
139
+ },
140
+ "$(...)$": function(e) {
141
+ return i.patterns.findObserveGroups(e, "$", "", "", "$");
142
+ },
143
+ "=<>": /^[=<>]/,
144
+ "#": /^[#\u2261]/,
145
+ "+": /^\+/,
146
+ "-$": /^-(?=[\s_},;\]/]|$|\([a-z]+\))/,
147
+ "-9": /^-(?=[0-9])/,
148
+ "- orbital overlap": /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,
149
+ "-": /^-/,
150
+ "pm-operator": /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,
151
+ operator: /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,
152
+ arrowUpDown: /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
153
+ "\\bond{(...)}": function(e) {
154
+ return i.patterns.findObserveGroups(e, "\\bond{", "", "", "}");
155
+ },
156
+ "->": /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,
157
+ CMT: /^[CMT](?=\[)/,
158
+ "[(...)]": function(e) {
159
+ return i.patterns.findObserveGroups(e, "[", "", "", "]");
160
+ },
161
+ "1st-level escape": /^(&|\\\\|\\hline)\s*/,
162
+ "\\,": /^(?:\\[,\ ;:])/,
163
+ "\\x{}{}": function(e) {
164
+ return i.patterns.findObserveGroups(e, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
165
+ },
166
+ "\\x{}": function(e) {
167
+ return i.patterns.findObserveGroups(e, "", /^\\[a-zA-Z]+\{/, "}", "");
168
+ },
169
+ "\\ca": /^\\ca(?:\s+|(?![a-zA-Z]))/,
170
+ "\\x": /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,
171
+ orbital: /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,
172
+ others: /^[\/~|]/,
173
+ "\\frac{(...)}": function(e) {
174
+ return i.patterns.findObserveGroups(e, "\\frac{", "", "", "}", "{", "", "", "}");
175
+ },
176
+ "\\overset{(...)}": function(e) {
177
+ return i.patterns.findObserveGroups(e, "\\overset{", "", "", "}", "{", "", "", "}");
178
+ },
179
+ "\\underset{(...)}": function(e) {
180
+ return i.patterns.findObserveGroups(e, "\\underset{", "", "", "}", "{", "", "", "}");
181
+ },
182
+ "\\underbrace{(...)}": function(e) {
183
+ return i.patterns.findObserveGroups(e, "\\underbrace{", "", "", "}_", "{", "", "", "}");
184
+ },
185
+ "\\color{(...)}0": function(e) {
186
+ return i.patterns.findObserveGroups(e, "\\color{", "", "", "}");
187
+ },
188
+ "\\color{(...)}{(...)}1": function(e) {
189
+ return i.patterns.findObserveGroups(e, "\\color{", "", "", "}", "{", "", "", "}");
190
+ },
191
+ "\\color(...){(...)}2": function(e) {
192
+ return i.patterns.findObserveGroups(e, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
193
+ },
194
+ "\\ce{(...)}": function(e) {
195
+ return i.patterns.findObserveGroups(e, "\\ce{", "", "", "}");
196
+ },
197
+ oxidation$: /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
198
+ "d-oxidation$": /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
199
+ "roman numeral": /^[IVX]+/,
200
+ "1/2$": /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
201
+ amount: function(e) {
202
+ var t = e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);
203
+ if (t) return {
204
+ match_: t[0],
205
+ remainder: e.substr(t[0].length)
206
+ };
207
+ var n = i.patterns.findObserveGroups(e, "", "$", "$", "");
208
+ return n && (t = n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/), t) ? {
209
+ match_: t[0],
210
+ remainder: e.substr(t[0].length)
211
+ } : null;
212
+ },
213
+ amount2: function(e) {
214
+ return this.amount(e);
215
+ },
216
+ "(KV letters),": /^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
217
+ formula$: function(e) {
218
+ if (e.match(/^\([a-z]+\)$/)) return null;
219
+ var t = e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
220
+ return t ? {
221
+ match_: t[0],
222
+ remainder: e.substr(t[0].length)
223
+ } : null;
224
+ },
225
+ uprightEntities: /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
226
+ "/": /^\s*(\/)\s*/,
227
+ "//": /^\s*(\/\/)\s*/,
228
+ "*": /^\s*[*.]\s*/
229
+ },
230
+ findObserveGroups: function(e, t, n, r, i, a, o, s, c, l) {
231
+ var u = function(e, t) {
232
+ if (typeof t == "string") return e.indexOf(t) === 0 ? t : null;
233
+ var n = e.match(t);
234
+ return n ? n[0] : null;
235
+ }, d = function(e, t, n) {
236
+ for (var r = 0; t < e.length;) {
237
+ var i = e.charAt(t), a = u(e.substr(t), n);
238
+ if (a !== null && r === 0) return {
239
+ endMatchBegin: t,
240
+ endMatchEnd: t + a.length
241
+ };
242
+ if (i === "{") r++;
243
+ else if (i === "}") {
244
+ if (r === 0) throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"];
245
+ r--;
246
+ }
247
+ t++;
248
+ }
249
+ return null;
250
+ }, f = u(e, t);
251
+ if (f === null || (e = e.substr(f.length), f = u(e, n), f === null)) return null;
252
+ var p = d(e, f.length, r || i);
253
+ if (p === null) return null;
254
+ var m = e.substring(0, r ? p.endMatchEnd : p.endMatchBegin);
255
+ if (a || o) {
256
+ var h = this.findObserveGroups(e.substr(p.endMatchEnd), a, o, s, c);
257
+ if (h === null) return null;
258
+ var g = [m, h.match_];
259
+ return {
260
+ match_: l ? g.join("") : g,
261
+ remainder: h.remainder
262
+ };
263
+ }
264
+ return {
265
+ match_: m,
266
+ remainder: e.substr(p.endMatchEnd)
267
+ };
268
+ },
269
+ match_: function(e, t) {
270
+ var n = i.patterns.patterns[e];
271
+ if (n === void 0) throw ["MhchemBugP", "mhchem bug P. Please report. (" + e + ")"];
272
+ if (typeof n == "function") return i.patterns.patterns[e](t);
273
+ var r = t.match(n);
274
+ return r ? {
275
+ match_: r[2] ? [r[1], r[2]] : r[1] ? r[1] : r[0],
276
+ remainder: t.substr(r[0].length)
277
+ } : null;
278
+ }
279
+ },
280
+ actions: {
281
+ "a=": function(e, t) {
282
+ e.a = (e.a || "") + t;
283
+ },
284
+ "b=": function(e, t) {
285
+ e.b = (e.b || "") + t;
286
+ },
287
+ "p=": function(e, t) {
288
+ e.p = (e.p || "") + t;
289
+ },
290
+ "o=": function(e, t) {
291
+ e.o = (e.o || "") + t;
292
+ },
293
+ "q=": function(e, t) {
294
+ e.q = (e.q || "") + t;
295
+ },
296
+ "d=": function(e, t) {
297
+ e.d = (e.d || "") + t;
298
+ },
299
+ "rm=": function(e, t) {
300
+ e.rm = (e.rm || "") + t;
301
+ },
302
+ "text=": function(e, t) {
303
+ e.text_ = (e.text_ || "") + t;
304
+ },
305
+ insert: function(e, t, n) {
306
+ return { type_: n };
307
+ },
308
+ "insert+p1": function(e, t, n) {
309
+ return {
310
+ type_: n,
311
+ p1: t
312
+ };
313
+ },
314
+ "insert+p1+p2": function(e, t, n) {
315
+ return {
316
+ type_: n,
317
+ p1: t[0],
318
+ p2: t[1]
319
+ };
320
+ },
321
+ copy: function(e, t) {
322
+ return t;
323
+ },
324
+ rm: function(e, t) {
325
+ return {
326
+ type_: "rm",
327
+ p1: t || ""
328
+ };
329
+ },
330
+ text: function(e, t) {
331
+ return i.go(t, "text");
332
+ },
333
+ "{text}": function(e, t) {
334
+ var n = ["{"];
335
+ return i.concatArray(n, i.go(t, "text")), n.push("}"), n;
336
+ },
337
+ "tex-math": function(e, t) {
338
+ return i.go(t, "tex-math");
339
+ },
340
+ "tex-math tight": function(e, t) {
341
+ return i.go(t, "tex-math tight");
342
+ },
343
+ bond: function(e, t, n) {
344
+ return {
345
+ type_: "bond",
346
+ kind_: n || t
347
+ };
348
+ },
349
+ "color0-output": function(e, t) {
350
+ return {
351
+ type_: "color0",
352
+ color: t[0]
353
+ };
354
+ },
355
+ ce: function(e, t) {
356
+ return i.go(t);
357
+ },
358
+ "1/2": function(e, t) {
359
+ var n = [];
360
+ t.match(/^[+\-]/) && (n.push(t.substr(0, 1)), t = t.substr(1));
361
+ var r = t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
362
+ return r[1] = r[1].replace(/\$/g, ""), n.push({
363
+ type_: "frac",
364
+ p1: r[1],
365
+ p2: r[2]
366
+ }), r[3] && (r[3] = r[3].replace(/\$/g, ""), n.push({
367
+ type_: "tex-math",
368
+ p1: r[3]
369
+ })), n;
370
+ },
371
+ "9,9": function(e, t) {
372
+ return i.go(t, "9,9");
373
+ }
374
+ },
375
+ createTransitions: function(e) {
376
+ var t, n, r, i, a = {};
377
+ for (t in e) for (n in e[t]) for (r = n.split("|"), e[t][n].stateArray = r, i = 0; i < r.length; i++) a[r[i]] = [];
378
+ for (t in e) for (n in e[t]) for (r = e[t][n].stateArray || [], i = 0; i < r.length; i++) {
379
+ var o = e[t][n];
380
+ if (o.action_) {
381
+ o.action_ = [].concat(o.action_);
382
+ for (var s = 0; s < o.action_.length; s++) typeof o.action_[s] == "string" && (o.action_[s] = { type_: o.action_[s] });
383
+ } else o.action_ = [];
384
+ for (var c = t.split("|"), l = 0; l < c.length; l++) if (r[i] === "*") for (var u in a) a[u].push({
385
+ pattern: c[l],
386
+ task: o
387
+ });
388
+ else a[r[i]].push({
389
+ pattern: c[l],
390
+ task: o
391
+ });
392
+ }
393
+ return a;
394
+ },
395
+ stateMachines: {}
396
+ };
397
+ i.stateMachines = {
398
+ ce: {
399
+ transitions: i.createTransitions({
400
+ empty: { "*": { action_: "output" } },
401
+ else: { "0|1|2": {
402
+ action_: "beginsWithBond=false",
403
+ revisit: !0,
404
+ toContinue: !0
405
+ } },
406
+ oxidation$: { 0: { action_: "oxidation-output" } },
407
+ CMT: {
408
+ r: {
409
+ action_: "rdt=",
410
+ nextState: "rt"
411
+ },
412
+ rd: {
413
+ action_: "rqt=",
414
+ nextState: "rdt"
415
+ }
416
+ },
417
+ arrowUpDown: { "0|1|2|as": {
418
+ action_: [
419
+ "sb=false",
420
+ "output",
421
+ "operator"
422
+ ],
423
+ nextState: "1"
424
+ } },
425
+ uprightEntities: { "0|1|2": {
426
+ action_: ["o=", "output"],
427
+ nextState: "1"
428
+ } },
429
+ orbital: { "0|1|2|3": {
430
+ action_: "o=",
431
+ nextState: "o"
432
+ } },
433
+ "->": {
434
+ "0|1|2|3": {
435
+ action_: "r=",
436
+ nextState: "r"
437
+ },
438
+ "a|as": {
439
+ action_: ["output", "r="],
440
+ nextState: "r"
441
+ },
442
+ "*": {
443
+ action_: ["output", "r="],
444
+ nextState: "r"
445
+ }
446
+ },
447
+ "+": {
448
+ o: {
449
+ action_: "d= kv",
450
+ nextState: "d"
451
+ },
452
+ "d|D": {
453
+ action_: "d=",
454
+ nextState: "d"
455
+ },
456
+ q: {
457
+ action_: "d=",
458
+ nextState: "qd"
459
+ },
460
+ "qd|qD": {
461
+ action_: "d=",
462
+ nextState: "qd"
463
+ },
464
+ dq: {
465
+ action_: ["output", "d="],
466
+ nextState: "d"
467
+ },
468
+ 3: {
469
+ action_: [
470
+ "sb=false",
471
+ "output",
472
+ "operator"
473
+ ],
474
+ nextState: "0"
475
+ }
476
+ },
477
+ amount: { "0|2": {
478
+ action_: "a=",
479
+ nextState: "a"
480
+ } },
481
+ "pm-operator": { "0|1|2|a|as": {
482
+ action_: [
483
+ "sb=false",
484
+ "output",
485
+ {
486
+ type_: "operator",
487
+ option: "\\pm"
488
+ }
489
+ ],
490
+ nextState: "0"
491
+ } },
492
+ operator: { "0|1|2|a|as": {
493
+ action_: [
494
+ "sb=false",
495
+ "output",
496
+ "operator"
497
+ ],
498
+ nextState: "0"
499
+ } },
500
+ "-$": {
501
+ "o|q": {
502
+ action_: ["charge or bond", "output"],
503
+ nextState: "qd"
504
+ },
505
+ d: {
506
+ action_: "d=",
507
+ nextState: "d"
508
+ },
509
+ D: {
510
+ action_: ["output", {
511
+ type_: "bond",
512
+ option: "-"
513
+ }],
514
+ nextState: "3"
515
+ },
516
+ q: {
517
+ action_: "d=",
518
+ nextState: "qd"
519
+ },
520
+ qd: {
521
+ action_: "d=",
522
+ nextState: "qd"
523
+ },
524
+ "qD|dq": {
525
+ action_: ["output", {
526
+ type_: "bond",
527
+ option: "-"
528
+ }],
529
+ nextState: "3"
530
+ }
531
+ },
532
+ "-9": { "3|o": {
533
+ action_: ["output", {
534
+ type_: "insert",
535
+ option: "hyphen"
536
+ }],
537
+ nextState: "3"
538
+ } },
539
+ "- orbital overlap": {
540
+ o: {
541
+ action_: ["output", {
542
+ type_: "insert",
543
+ option: "hyphen"
544
+ }],
545
+ nextState: "2"
546
+ },
547
+ d: {
548
+ action_: ["output", {
549
+ type_: "insert",
550
+ option: "hyphen"
551
+ }],
552
+ nextState: "2"
553
+ }
554
+ },
555
+ "-": {
556
+ "0|1|2": {
557
+ action_: [
558
+ {
559
+ type_: "output",
560
+ option: 1
561
+ },
562
+ "beginsWithBond=true",
563
+ {
564
+ type_: "bond",
565
+ option: "-"
566
+ }
567
+ ],
568
+ nextState: "3"
569
+ },
570
+ 3: { action_: {
571
+ type_: "bond",
572
+ option: "-"
573
+ } },
574
+ a: {
575
+ action_: ["output", {
576
+ type_: "insert",
577
+ option: "hyphen"
578
+ }],
579
+ nextState: "2"
580
+ },
581
+ as: {
582
+ action_: [{
583
+ type_: "output",
584
+ option: 2
585
+ }, {
586
+ type_: "bond",
587
+ option: "-"
588
+ }],
589
+ nextState: "3"
590
+ },
591
+ b: { action_: "b=" },
592
+ o: {
593
+ action_: {
594
+ type_: "- after o/d",
595
+ option: !1
596
+ },
597
+ nextState: "2"
598
+ },
599
+ q: {
600
+ action_: {
601
+ type_: "- after o/d",
602
+ option: !1
603
+ },
604
+ nextState: "2"
605
+ },
606
+ "d|qd|dq": {
607
+ action_: {
608
+ type_: "- after o/d",
609
+ option: !0
610
+ },
611
+ nextState: "2"
612
+ },
613
+ "D|qD|p": {
614
+ action_: ["output", {
615
+ type_: "bond",
616
+ option: "-"
617
+ }],
618
+ nextState: "3"
619
+ }
620
+ },
621
+ amount2: { "1|3": {
622
+ action_: "a=",
623
+ nextState: "a"
624
+ } },
625
+ letters: {
626
+ "0|1|2|3|a|as|b|p|bp|o": {
627
+ action_: "o=",
628
+ nextState: "o"
629
+ },
630
+ "q|dq": {
631
+ action_: ["output", "o="],
632
+ nextState: "o"
633
+ },
634
+ "d|D|qd|qD": {
635
+ action_: "o after d",
636
+ nextState: "o"
637
+ }
638
+ },
639
+ digits: {
640
+ o: {
641
+ action_: "q=",
642
+ nextState: "q"
643
+ },
644
+ "d|D": {
645
+ action_: "q=",
646
+ nextState: "dq"
647
+ },
648
+ q: {
649
+ action_: ["output", "o="],
650
+ nextState: "o"
651
+ },
652
+ a: {
653
+ action_: "o=",
654
+ nextState: "o"
655
+ }
656
+ },
657
+ "space A": { "b|p|bp": {} },
658
+ space: {
659
+ a: { nextState: "as" },
660
+ 0: { action_: "sb=false" },
661
+ "1|2": { action_: "sb=true" },
662
+ "r|rt|rd|rdt|rdq": {
663
+ action_: "output",
664
+ nextState: "0"
665
+ },
666
+ "*": {
667
+ action_: ["output", "sb=true"],
668
+ nextState: "1"
669
+ }
670
+ },
671
+ "1st-level escape": {
672
+ "1|2": { action_: ["output", {
673
+ type_: "insert+p1",
674
+ option: "1st-level escape"
675
+ }] },
676
+ "*": {
677
+ action_: ["output", {
678
+ type_: "insert+p1",
679
+ option: "1st-level escape"
680
+ }],
681
+ nextState: "0"
682
+ }
683
+ },
684
+ "[(...)]": {
685
+ "r|rt": {
686
+ action_: "rd=",
687
+ nextState: "rd"
688
+ },
689
+ "rd|rdt": {
690
+ action_: "rq=",
691
+ nextState: "rdq"
692
+ }
693
+ },
694
+ "...": {
695
+ "o|d|D|dq|qd|qD": {
696
+ action_: ["output", {
697
+ type_: "bond",
698
+ option: "..."
699
+ }],
700
+ nextState: "3"
701
+ },
702
+ "*": {
703
+ action_: [{
704
+ type_: "output",
705
+ option: 1
706
+ }, {
707
+ type_: "insert",
708
+ option: "ellipsis"
709
+ }],
710
+ nextState: "1"
711
+ }
712
+ },
713
+ ". |* ": { "*": {
714
+ action_: ["output", {
715
+ type_: "insert",
716
+ option: "addition compound"
717
+ }],
718
+ nextState: "1"
719
+ } },
720
+ "state of aggregation $": { "*": {
721
+ action_: ["output", "state of aggregation"],
722
+ nextState: "1"
723
+ } },
724
+ "{[(": {
725
+ "a|as|o": {
726
+ action_: [
727
+ "o=",
728
+ "output",
729
+ "parenthesisLevel++"
730
+ ],
731
+ nextState: "2"
732
+ },
733
+ "0|1|2|3": {
734
+ action_: [
735
+ "o=",
736
+ "output",
737
+ "parenthesisLevel++"
738
+ ],
739
+ nextState: "2"
740
+ },
741
+ "*": {
742
+ action_: [
743
+ "output",
744
+ "o=",
745
+ "output",
746
+ "parenthesisLevel++"
747
+ ],
748
+ nextState: "2"
749
+ }
750
+ },
751
+ ")]}": {
752
+ "0|1|2|3|b|p|bp|o": {
753
+ action_: ["o=", "parenthesisLevel--"],
754
+ nextState: "o"
755
+ },
756
+ "a|as|d|D|q|qd|qD|dq": {
757
+ action_: [
758
+ "output",
759
+ "o=",
760
+ "parenthesisLevel--"
761
+ ],
762
+ nextState: "o"
763
+ }
764
+ },
765
+ ", ": { "*": {
766
+ action_: ["output", "comma"],
767
+ nextState: "0"
768
+ } },
769
+ "^_": { "*": {} },
770
+ "^{(...)}|^($...$)": {
771
+ "0|1|2|as": {
772
+ action_: "b=",
773
+ nextState: "b"
774
+ },
775
+ p: {
776
+ action_: "b=",
777
+ nextState: "bp"
778
+ },
779
+ "3|o": {
780
+ action_: "d= kv",
781
+ nextState: "D"
782
+ },
783
+ q: {
784
+ action_: "d=",
785
+ nextState: "qD"
786
+ },
787
+ "d|D|qd|qD|dq": {
788
+ action_: ["output", "d="],
789
+ nextState: "D"
790
+ }
791
+ },
792
+ "^a|^\\x{}{}|^\\x{}|^\\x|'": {
793
+ "0|1|2|as": {
794
+ action_: "b=",
795
+ nextState: "b"
796
+ },
797
+ p: {
798
+ action_: "b=",
799
+ nextState: "bp"
800
+ },
801
+ "3|o": {
802
+ action_: "d= kv",
803
+ nextState: "d"
804
+ },
805
+ q: {
806
+ action_: "d=",
807
+ nextState: "qd"
808
+ },
809
+ "d|qd|D|qD": { action_: "d=" },
810
+ dq: {
811
+ action_: ["output", "d="],
812
+ nextState: "d"
813
+ }
814
+ },
815
+ "_{(state of aggregation)}$": { "d|D|q|qd|qD|dq": {
816
+ action_: ["output", "q="],
817
+ nextState: "q"
818
+ } },
819
+ "_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x": {
820
+ "0|1|2|as": {
821
+ action_: "p=",
822
+ nextState: "p"
823
+ },
824
+ b: {
825
+ action_: "p=",
826
+ nextState: "bp"
827
+ },
828
+ "3|o": {
829
+ action_: "q=",
830
+ nextState: "q"
831
+ },
832
+ "d|D": {
833
+ action_: "q=",
834
+ nextState: "dq"
835
+ },
836
+ "q|qd|qD|dq": {
837
+ action_: ["output", "q="],
838
+ nextState: "q"
839
+ }
840
+ },
841
+ "=<>": { "0|1|2|3|a|as|o|q|d|D|qd|qD|dq": {
842
+ action_: [{
843
+ type_: "output",
844
+ option: 2
845
+ }, "bond"],
846
+ nextState: "3"
847
+ } },
848
+ "#": { "0|1|2|3|a|as|o": {
849
+ action_: [{
850
+ type_: "output",
851
+ option: 2
852
+ }, {
853
+ type_: "bond",
854
+ option: "#"
855
+ }],
856
+ nextState: "3"
857
+ } },
858
+ "{}": { "*": {
859
+ action_: {
860
+ type_: "output",
861
+ option: 1
862
+ },
863
+ nextState: "1"
864
+ } },
865
+ "{...}": {
866
+ "0|1|2|3|a|as|b|p|bp": {
867
+ action_: "o=",
868
+ nextState: "o"
869
+ },
870
+ "o|d|D|q|qd|qD|dq": {
871
+ action_: ["output", "o="],
872
+ nextState: "o"
873
+ }
874
+ },
875
+ "$...$": {
876
+ a: { action_: "a=" },
877
+ "0|1|2|3|as|b|p|bp|o": {
878
+ action_: "o=",
879
+ nextState: "o"
880
+ },
881
+ "as|o": { action_: "o=" },
882
+ "q|d|D|qd|qD|dq": {
883
+ action_: ["output", "o="],
884
+ nextState: "o"
885
+ }
886
+ },
887
+ "\\bond{(...)}": { "*": {
888
+ action_: [{
889
+ type_: "output",
890
+ option: 2
891
+ }, "bond"],
892
+ nextState: "3"
893
+ } },
894
+ "\\frac{(...)}": { "*": {
895
+ action_: [{
896
+ type_: "output",
897
+ option: 1
898
+ }, "frac-output"],
899
+ nextState: "3"
900
+ } },
901
+ "\\overset{(...)}": { "*": {
902
+ action_: [{
903
+ type_: "output",
904
+ option: 2
905
+ }, "overset-output"],
906
+ nextState: "3"
907
+ } },
908
+ "\\underset{(...)}": { "*": {
909
+ action_: [{
910
+ type_: "output",
911
+ option: 2
912
+ }, "underset-output"],
913
+ nextState: "3"
914
+ } },
915
+ "\\underbrace{(...)}": { "*": {
916
+ action_: [{
917
+ type_: "output",
918
+ option: 2
919
+ }, "underbrace-output"],
920
+ nextState: "3"
921
+ } },
922
+ "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": {
923
+ action_: [{
924
+ type_: "output",
925
+ option: 2
926
+ }, "color-output"],
927
+ nextState: "3"
928
+ } },
929
+ "\\color{(...)}0": { "*": { action_: [{
930
+ type_: "output",
931
+ option: 2
932
+ }, "color0-output"] } },
933
+ "\\ce{(...)}": { "*": {
934
+ action_: [{
935
+ type_: "output",
936
+ option: 2
937
+ }, "ce"],
938
+ nextState: "3"
939
+ } },
940
+ "\\,": { "*": {
941
+ action_: [{
942
+ type_: "output",
943
+ option: 1
944
+ }, "copy"],
945
+ nextState: "1"
946
+ } },
947
+ "\\x{}{}|\\x{}|\\x": {
948
+ "0|1|2|3|a|as|b|p|bp|o|c0": {
949
+ action_: ["o=", "output"],
950
+ nextState: "3"
951
+ },
952
+ "*": {
953
+ action_: [
954
+ "output",
955
+ "o=",
956
+ "output"
957
+ ],
958
+ nextState: "3"
959
+ }
960
+ },
961
+ others: { "*": {
962
+ action_: [{
963
+ type_: "output",
964
+ option: 1
965
+ }, "copy"],
966
+ nextState: "3"
967
+ } },
968
+ else2: {
969
+ a: {
970
+ action_: "a to o",
971
+ nextState: "o",
972
+ revisit: !0
973
+ },
974
+ as: {
975
+ action_: ["output", "sb=true"],
976
+ nextState: "1",
977
+ revisit: !0
978
+ },
979
+ "r|rt|rd|rdt|rdq": {
980
+ action_: ["output"],
981
+ nextState: "0",
982
+ revisit: !0
983
+ },
984
+ "*": {
985
+ action_: ["output", "copy"],
986
+ nextState: "3"
987
+ }
988
+ }
989
+ }),
990
+ actions: {
991
+ "o after d": function(e, t) {
992
+ var n;
993
+ if ((e.d || "").match(/^[0-9]+$/)) {
994
+ var r = e.d;
995
+ e.d = void 0, n = this.output(e), e.b = r;
996
+ } else n = this.output(e);
997
+ return i.actions["o="](e, t), n;
998
+ },
999
+ "d= kv": function(e, t) {
1000
+ e.d = t, e.dType = "kv";
1001
+ },
1002
+ "charge or bond": function(e, t) {
1003
+ if (e.beginsWithBond) {
1004
+ var n = [];
1005
+ return i.concatArray(n, this.output(e)), i.concatArray(n, i.actions.bond(e, t, "-")), n;
1006
+ }
1007
+ e.d = t;
1008
+ },
1009
+ "- after o/d": function(e, t, n) {
1010
+ var r = i.patterns.match_("orbital", e.o || ""), a = i.patterns.match_("one lowercase greek letter $", e.o || ""), o = i.patterns.match_("one lowercase latin letter $", e.o || ""), s = i.patterns.match_("$one lowercase latin letter$ $", e.o || ""), c = t === "-" && (r && r.remainder === "" || a || o || s);
1011
+ !c || e.a || e.b || e.p || e.d || e.q || r || !o || (e.o = "$" + e.o + "$");
1012
+ var l = [];
1013
+ return c ? (i.concatArray(l, this.output(e)), l.push({ type_: "hyphen" })) : (r = i.patterns.match_("digits", e.d || ""), n && r && r.remainder === "" ? (i.concatArray(l, i.actions["d="](e, t)), i.concatArray(l, this.output(e))) : (i.concatArray(l, this.output(e)), i.concatArray(l, i.actions.bond(e, t, "-")))), l;
1014
+ },
1015
+ "a to o": function(e) {
1016
+ e.o = e.a, e.a = void 0;
1017
+ },
1018
+ "sb=true": function(e) {
1019
+ e.sb = !0;
1020
+ },
1021
+ "sb=false": function(e) {
1022
+ e.sb = !1;
1023
+ },
1024
+ "beginsWithBond=true": function(e) {
1025
+ e.beginsWithBond = !0;
1026
+ },
1027
+ "beginsWithBond=false": function(e) {
1028
+ e.beginsWithBond = !1;
1029
+ },
1030
+ "parenthesisLevel++": function(e) {
1031
+ e.parenthesisLevel++;
1032
+ },
1033
+ "parenthesisLevel--": function(e) {
1034
+ e.parenthesisLevel--;
1035
+ },
1036
+ "state of aggregation": function(e, t) {
1037
+ return {
1038
+ type_: "state of aggregation",
1039
+ p1: i.go(t, "o")
1040
+ };
1041
+ },
1042
+ comma: function(e, t) {
1043
+ var n = t.replace(/\s*$/, "");
1044
+ return n !== t && e.parenthesisLevel === 0 ? {
1045
+ type_: "comma enumeration L",
1046
+ p1: n
1047
+ } : {
1048
+ type_: "comma enumeration M",
1049
+ p1: n
1050
+ };
1051
+ },
1052
+ output: function(e, t, n) {
1053
+ var r;
1054
+ if (!e.r) r = [], (e.a || e.b || e.p || e.o || e.q || e.d || n) && (e.sb && r.push({ type_: "entitySkip" }), !e.o && !e.q && !e.d && !e.b && !e.p && n !== 2 ? (e.o = e.a, e.a = void 0) : !e.o && !e.q && !e.d && (e.b || e.p) ? (e.o = e.a, e.d = e.b, e.q = e.p, e.a = e.b = e.p = void 0) : e.o && e.dType === "kv" && i.patterns.match_("d-oxidation$", e.d || "") ? e.dType = "oxidation" : e.o && e.dType === "kv" && !e.q && (e.dType = void 0), r.push({
1055
+ type_: "chemfive",
1056
+ a: i.go(e.a, "a"),
1057
+ b: i.go(e.b, "bd"),
1058
+ p: i.go(e.p, "pq"),
1059
+ o: i.go(e.o, "o"),
1060
+ q: i.go(e.q, "pq"),
1061
+ d: i.go(e.d, e.dType === "oxidation" ? "oxidation" : "bd"),
1062
+ dType: e.dType
1063
+ }));
1064
+ else {
1065
+ var a = e.rdt === "M" ? i.go(e.rd, "tex-math") : e.rdt === "T" ? [{
1066
+ type_: "text",
1067
+ p1: e.rd || ""
1068
+ }] : i.go(e.rd), o = e.rqt === "M" ? i.go(e.rq, "tex-math") : e.rqt === "T" ? [{
1069
+ type_: "text",
1070
+ p1: e.rq || ""
1071
+ }] : i.go(e.rq);
1072
+ r = {
1073
+ type_: "arrow",
1074
+ r: e.r,
1075
+ rd: a,
1076
+ rq: o
1077
+ };
1078
+ }
1079
+ for (var s in e) s !== "parenthesisLevel" && s !== "beginsWithBond" && delete e[s];
1080
+ return r;
1081
+ },
1082
+ "oxidation-output": function(e, t) {
1083
+ var n = ["{"];
1084
+ return i.concatArray(n, i.go(t, "oxidation")), n.push("}"), n;
1085
+ },
1086
+ "frac-output": function(e, t) {
1087
+ return {
1088
+ type_: "frac-ce",
1089
+ p1: i.go(t[0]),
1090
+ p2: i.go(t[1])
1091
+ };
1092
+ },
1093
+ "overset-output": function(e, t) {
1094
+ return {
1095
+ type_: "overset",
1096
+ p1: i.go(t[0]),
1097
+ p2: i.go(t[1])
1098
+ };
1099
+ },
1100
+ "underset-output": function(e, t) {
1101
+ return {
1102
+ type_: "underset",
1103
+ p1: i.go(t[0]),
1104
+ p2: i.go(t[1])
1105
+ };
1106
+ },
1107
+ "underbrace-output": function(e, t) {
1108
+ return {
1109
+ type_: "underbrace",
1110
+ p1: i.go(t[0]),
1111
+ p2: i.go(t[1])
1112
+ };
1113
+ },
1114
+ "color-output": function(e, t) {
1115
+ return {
1116
+ type_: "color",
1117
+ color1: t[0],
1118
+ color2: i.go(t[1])
1119
+ };
1120
+ },
1121
+ "r=": function(e, t) {
1122
+ e.r = t;
1123
+ },
1124
+ "rdt=": function(e, t) {
1125
+ e.rdt = t;
1126
+ },
1127
+ "rd=": function(e, t) {
1128
+ e.rd = t;
1129
+ },
1130
+ "rqt=": function(e, t) {
1131
+ e.rqt = t;
1132
+ },
1133
+ "rq=": function(e, t) {
1134
+ e.rq = t;
1135
+ },
1136
+ operator: function(e, t, n) {
1137
+ return {
1138
+ type_: "operator",
1139
+ kind_: n || t
1140
+ };
1141
+ }
1142
+ }
1143
+ },
1144
+ a: {
1145
+ transitions: i.createTransitions({
1146
+ empty: { "*": {} },
1147
+ "1/2$": { 0: { action_: "1/2" } },
1148
+ else: { 0: {
1149
+ nextState: "1",
1150
+ revisit: !0
1151
+ } },
1152
+ "$(...)$": { "*": {
1153
+ action_: "tex-math tight",
1154
+ nextState: "1"
1155
+ } },
1156
+ ",": { "*": { action_: {
1157
+ type_: "insert",
1158
+ option: "commaDecimal"
1159
+ } } },
1160
+ else2: { "*": { action_: "copy" } }
1161
+ }),
1162
+ actions: {}
1163
+ },
1164
+ o: {
1165
+ transitions: i.createTransitions({
1166
+ empty: { "*": {} },
1167
+ "1/2$": { 0: { action_: "1/2" } },
1168
+ else: { 0: {
1169
+ nextState: "1",
1170
+ revisit: !0
1171
+ } },
1172
+ letters: { "*": { action_: "rm" } },
1173
+ "\\ca": { "*": { action_: {
1174
+ type_: "insert",
1175
+ option: "circa"
1176
+ } } },
1177
+ "\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
1178
+ "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
1179
+ "{(...)}": { "*": { action_: "{text}" } },
1180
+ else2: { "*": { action_: "copy" } }
1181
+ }),
1182
+ actions: {}
1183
+ },
1184
+ text: {
1185
+ transitions: i.createTransitions({
1186
+ empty: { "*": { action_: "output" } },
1187
+ "{...}": { "*": { action_: "text=" } },
1188
+ "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
1189
+ "\\greek": { "*": { action_: ["output", "rm"] } },
1190
+ "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: ["output", "copy"] } },
1191
+ else: { "*": { action_: "text=" } }
1192
+ }),
1193
+ actions: { output: function(e) {
1194
+ if (e.text_) {
1195
+ var t = {
1196
+ type_: "text",
1197
+ p1: e.text_
1198
+ };
1199
+ for (var n in e) delete e[n];
1200
+ return t;
1201
+ }
1202
+ } }
1203
+ },
1204
+ pq: {
1205
+ transitions: i.createTransitions({
1206
+ empty: { "*": {} },
1207
+ "state of aggregation $": { "*": { action_: "state of aggregation" } },
1208
+ i$: { 0: {
1209
+ nextState: "!f",
1210
+ revisit: !0
1211
+ } },
1212
+ "(KV letters),": { 0: {
1213
+ action_: "rm",
1214
+ nextState: "0"
1215
+ } },
1216
+ formula$: { 0: {
1217
+ nextState: "f",
1218
+ revisit: !0
1219
+ } },
1220
+ "1/2$": { 0: { action_: "1/2" } },
1221
+ else: { 0: {
1222
+ nextState: "!f",
1223
+ revisit: !0
1224
+ } },
1225
+ "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
1226
+ "{(...)}": { "*": { action_: "text" } },
1227
+ "a-z": { f: { action_: "tex-math" } },
1228
+ letters: { "*": { action_: "rm" } },
1229
+ "-9.,9": { "*": { action_: "9,9" } },
1230
+ ",": { "*": { action_: {
1231
+ type_: "insert+p1",
1232
+ option: "comma enumeration S"
1233
+ } } },
1234
+ "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } },
1235
+ "\\color{(...)}0": { "*": { action_: "color0-output" } },
1236
+ "\\ce{(...)}": { "*": { action_: "ce" } },
1237
+ "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
1238
+ else2: { "*": { action_: "copy" } }
1239
+ }),
1240
+ actions: {
1241
+ "state of aggregation": function(e, t) {
1242
+ return {
1243
+ type_: "state of aggregation subscript",
1244
+ p1: i.go(t, "o")
1245
+ };
1246
+ },
1247
+ "color-output": function(e, t) {
1248
+ return {
1249
+ type_: "color",
1250
+ color1: t[0],
1251
+ color2: i.go(t[1], "pq")
1252
+ };
1253
+ }
1254
+ }
1255
+ },
1256
+ bd: {
1257
+ transitions: i.createTransitions({
1258
+ empty: { "*": {} },
1259
+ x$: { 0: {
1260
+ nextState: "!f",
1261
+ revisit: !0
1262
+ } },
1263
+ formula$: { 0: {
1264
+ nextState: "f",
1265
+ revisit: !0
1266
+ } },
1267
+ else: { 0: {
1268
+ nextState: "!f",
1269
+ revisit: !0
1270
+ } },
1271
+ "-9.,9 no missing 0": { "*": { action_: "9,9" } },
1272
+ ".": { "*": { action_: {
1273
+ type_: "insert",
1274
+ option: "electron dot"
1275
+ } } },
1276
+ "a-z": { f: { action_: "tex-math" } },
1277
+ x: { "*": { action_: {
1278
+ type_: "insert",
1279
+ option: "KV x"
1280
+ } } },
1281
+ letters: { "*": { action_: "rm" } },
1282
+ "'": { "*": { action_: {
1283
+ type_: "insert",
1284
+ option: "prime"
1285
+ } } },
1286
+ "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
1287
+ "{(...)}": { "*": { action_: "text" } },
1288
+ "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } },
1289
+ "\\color{(...)}0": { "*": { action_: "color0-output" } },
1290
+ "\\ce{(...)}": { "*": { action_: "ce" } },
1291
+ "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
1292
+ else2: { "*": { action_: "copy" } }
1293
+ }),
1294
+ actions: { "color-output": function(e, t) {
1295
+ return {
1296
+ type_: "color",
1297
+ color1: t[0],
1298
+ color2: i.go(t[1], "bd")
1299
+ };
1300
+ } }
1301
+ },
1302
+ oxidation: {
1303
+ transitions: i.createTransitions({
1304
+ empty: { "*": {} },
1305
+ "roman numeral": { "*": { action_: "roman-numeral" } },
1306
+ "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
1307
+ else: { "*": { action_: "copy" } }
1308
+ }),
1309
+ actions: { "roman-numeral": function(e, t) {
1310
+ return {
1311
+ type_: "roman numeral",
1312
+ p1: t || ""
1313
+ };
1314
+ } }
1315
+ },
1316
+ "tex-math": {
1317
+ transitions: i.createTransitions({
1318
+ empty: { "*": { action_: "output" } },
1319
+ "\\ce{(...)}": { "*": { action_: ["output", "ce"] } },
1320
+ "{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } },
1321
+ else: { "*": { action_: "o=" } }
1322
+ }),
1323
+ actions: { output: function(e) {
1324
+ if (e.o) {
1325
+ var t = {
1326
+ type_: "tex-math",
1327
+ p1: e.o
1328
+ };
1329
+ for (var n in e) delete e[n];
1330
+ return t;
1331
+ }
1332
+ } }
1333
+ },
1334
+ "tex-math tight": {
1335
+ transitions: i.createTransitions({
1336
+ empty: { "*": { action_: "output" } },
1337
+ "\\ce{(...)}": { "*": { action_: ["output", "ce"] } },
1338
+ "{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } },
1339
+ "-|+": { "*": { action_: "tight operator" } },
1340
+ else: { "*": { action_: "o=" } }
1341
+ }),
1342
+ actions: {
1343
+ "tight operator": function(e, t) {
1344
+ e.o = (e.o || "") + "{" + t + "}";
1345
+ },
1346
+ output: function(e) {
1347
+ if (e.o) {
1348
+ var t = {
1349
+ type_: "tex-math",
1350
+ p1: e.o
1351
+ };
1352
+ for (var n in e) delete e[n];
1353
+ return t;
1354
+ }
1355
+ }
1356
+ }
1357
+ },
1358
+ "9,9": {
1359
+ transitions: i.createTransitions({
1360
+ empty: { "*": {} },
1361
+ ",": { "*": { action_: "comma" } },
1362
+ else: { "*": { action_: "copy" } }
1363
+ }),
1364
+ actions: { comma: function() {
1365
+ return { type_: "commaDecimal" };
1366
+ } }
1367
+ },
1368
+ pu: {
1369
+ transitions: i.createTransitions({
1370
+ empty: { "*": { action_: "output" } },
1371
+ space$: { "*": { action_: ["output", "space"] } },
1372
+ "{[(|)]}": { "0|a": { action_: "copy" } },
1373
+ "(-)(9)^(-9)": { 0: {
1374
+ action_: "number^",
1375
+ nextState: "a"
1376
+ } },
1377
+ "(-)(9.,9)(e)(99)": { 0: {
1378
+ action_: "enumber",
1379
+ nextState: "a"
1380
+ } },
1381
+ space: { "0|a": {} },
1382
+ "pm-operator": { "0|a": {
1383
+ action_: {
1384
+ type_: "operator",
1385
+ option: "\\pm"
1386
+ },
1387
+ nextState: "0"
1388
+ } },
1389
+ operator: { "0|a": {
1390
+ action_: "copy",
1391
+ nextState: "0"
1392
+ } },
1393
+ "//": { d: {
1394
+ action_: "o=",
1395
+ nextState: "/"
1396
+ } },
1397
+ "/": { d: {
1398
+ action_: "o=",
1399
+ nextState: "/"
1400
+ } },
1401
+ "{...}|else": {
1402
+ "0|d": {
1403
+ action_: "d=",
1404
+ nextState: "d"
1405
+ },
1406
+ a: {
1407
+ action_: ["space", "d="],
1408
+ nextState: "d"
1409
+ },
1410
+ "/|q": {
1411
+ action_: "q=",
1412
+ nextState: "q"
1413
+ }
1414
+ }
1415
+ }),
1416
+ actions: {
1417
+ enumber: function(e, t) {
1418
+ var n = [];
1419
+ return t[0] === "+-" || t[0] === "+/-" ? n.push("\\pm ") : t[0] && n.push(t[0]), t[1] && (i.concatArray(n, i.go(t[1], "pu-9,9")), t[2] && (t[2].match(/[,.]/) ? i.concatArray(n, i.go(t[2], "pu-9,9")) : n.push(t[2])), t[3] = t[4] || t[3], t[3] && (t[3] = t[3].trim(), t[3] === "e" || t[3].substr(0, 1) === "*" ? n.push({ type_: "cdot" }) : n.push({ type_: "times" }))), t[3] && n.push("10^{" + t[5] + "}"), n;
1420
+ },
1421
+ "number^": function(e, t) {
1422
+ var n = [];
1423
+ return t[0] === "+-" || t[0] === "+/-" ? n.push("\\pm ") : t[0] && n.push(t[0]), i.concatArray(n, i.go(t[1], "pu-9,9")), n.push("^{" + t[2] + "}"), n;
1424
+ },
1425
+ operator: function(e, t, n) {
1426
+ return {
1427
+ type_: "operator",
1428
+ kind_: n || t
1429
+ };
1430
+ },
1431
+ space: function() {
1432
+ return { type_: "pu-space-1" };
1433
+ },
1434
+ output: function(e) {
1435
+ var t, n = i.patterns.match_("{(...)}", e.d || "");
1436
+ n && n.remainder === "" && (e.d = n.match_);
1437
+ var r = i.patterns.match_("{(...)}", e.q || "");
1438
+ if (r && r.remainder === "" && (e.q = r.match_), e.d &&= (e.d = e.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), e.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F")), e.q) {
1439
+ e.q = e.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), e.q = e.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
1440
+ var a = {
1441
+ d: i.go(e.d, "pu"),
1442
+ q: i.go(e.q, "pu")
1443
+ };
1444
+ e.o === "//" ? t = {
1445
+ type_: "pu-frac",
1446
+ p1: a.d,
1447
+ p2: a.q
1448
+ } : (t = a.d, a.d.length > 1 || a.q.length > 1 ? t.push({ type_: " / " }) : t.push({ type_: "/" }), i.concatArray(t, a.q));
1449
+ } else t = i.go(e.d, "pu-2");
1450
+ for (var o in e) delete e[o];
1451
+ return t;
1452
+ }
1453
+ }
1454
+ },
1455
+ "pu-2": {
1456
+ transitions: i.createTransitions({
1457
+ empty: { "*": { action_: "output" } },
1458
+ "*": { "*": {
1459
+ action_: ["output", "cdot"],
1460
+ nextState: "0"
1461
+ } },
1462
+ "\\x": { "*": { action_: "rm=" } },
1463
+ space: { "*": {
1464
+ action_: ["output", "space"],
1465
+ nextState: "0"
1466
+ } },
1467
+ "^{(...)}|^(-1)": { 1: { action_: "^(-1)" } },
1468
+ "-9.,9": {
1469
+ 0: {
1470
+ action_: "rm=",
1471
+ nextState: "0"
1472
+ },
1473
+ 1: {
1474
+ action_: "^(-1)",
1475
+ nextState: "0"
1476
+ }
1477
+ },
1478
+ "{...}|else": { "*": {
1479
+ action_: "rm=",
1480
+ nextState: "1"
1481
+ } }
1482
+ }),
1483
+ actions: {
1484
+ cdot: function() {
1485
+ return { type_: "tight cdot" };
1486
+ },
1487
+ "^(-1)": function(e, t) {
1488
+ e.rm += "^{" + t + "}";
1489
+ },
1490
+ space: function() {
1491
+ return { type_: "pu-space-2" };
1492
+ },
1493
+ output: function(e) {
1494
+ var t = [];
1495
+ if (e.rm) {
1496
+ var n = i.patterns.match_("{(...)}", e.rm || "");
1497
+ t = n && n.remainder === "" ? i.go(n.match_, "pu") : {
1498
+ type_: "rm",
1499
+ p1: e.rm
1500
+ };
1501
+ }
1502
+ for (var r in e) delete e[r];
1503
+ return t;
1504
+ }
1505
+ }
1506
+ },
1507
+ "pu-9,9": {
1508
+ transitions: i.createTransitions({
1509
+ empty: {
1510
+ 0: { action_: "output-0" },
1511
+ o: { action_: "output-o" }
1512
+ },
1513
+ ",": { 0: {
1514
+ action_: ["output-0", "comma"],
1515
+ nextState: "o"
1516
+ } },
1517
+ ".": { 0: {
1518
+ action_: ["output-0", "copy"],
1519
+ nextState: "o"
1520
+ } },
1521
+ else: { "*": { action_: "text=" } }
1522
+ }),
1523
+ actions: {
1524
+ comma: function() {
1525
+ return { type_: "commaDecimal" };
1526
+ },
1527
+ "output-0": function(e) {
1528
+ var t = [];
1529
+ if (e.text_ = e.text_ || "", e.text_.length > 4) {
1530
+ var n = e.text_.length % 3;
1531
+ n === 0 && (n = 3);
1532
+ for (var r = e.text_.length - 3; r > 0; r -= 3) t.push(e.text_.substr(r, 3)), t.push({ type_: "1000 separator" });
1533
+ t.push(e.text_.substr(0, n)), t.reverse();
1534
+ } else t.push(e.text_);
1535
+ for (var i in e) delete e[i];
1536
+ return t;
1537
+ },
1538
+ "output-o": function(e) {
1539
+ var t = [];
1540
+ if (e.text_ = e.text_ || "", e.text_.length > 4) {
1541
+ for (var n = e.text_.length - 3, r = 0; r < n; r += 3) t.push(e.text_.substr(r, 3)), t.push({ type_: "1000 separator" });
1542
+ t.push(e.text_.substr(r));
1543
+ } else t.push(e.text_);
1544
+ for (var i in e) delete e[i];
1545
+ return t;
1546
+ }
1547
+ }
1548
+ }
1549
+ };
1550
+ var a = {
1551
+ go: function(e, t) {
1552
+ if (!e) return "";
1553
+ for (var n = "", r = !1, i = 0; i < e.length; i++) {
1554
+ var o = e[i];
1555
+ typeof o == "string" ? n += o : (n += a._go2(o), o.type_ === "1st-level escape" && (r = !0));
1556
+ }
1557
+ return !t && !r && n && (n = "{" + n + "}"), n;
1558
+ },
1559
+ _goInner: function(e) {
1560
+ return e && a.go(e, !0);
1561
+ },
1562
+ _go2: function(e) {
1563
+ var t;
1564
+ switch (e.type_) {
1565
+ case "chemfive":
1566
+ t = "";
1567
+ var n = {
1568
+ a: a._goInner(e.a),
1569
+ b: a._goInner(e.b),
1570
+ p: a._goInner(e.p),
1571
+ o: a._goInner(e.o),
1572
+ q: a._goInner(e.q),
1573
+ d: a._goInner(e.d)
1574
+ };
1575
+ n.a && (n.a.match(/^[+\-]/) && (n.a = "{" + n.a + "}"), t += n.a + "\\,"), (n.b || n.p) && (t += "{\\vphantom{X}}", t += "^{\\hphantom{" + (n.b || "") + "}}_{\\hphantom{" + (n.p || "") + "}}", t += "{\\vphantom{X}}", t += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (n.b || "") + "}}", t += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (n.p || "") + "}}}"), n.o && (n.o.match(/^[+\-]/) && (n.o = "{" + n.o + "}"), t += n.o), e.dType === "kv" ? ((n.d || n.q) && (t += "{\\vphantom{X}}"), n.d && (t += "^{" + n.d + "}"), n.q && (t += "_{\\smash[t]{" + n.q + "}}")) : e.dType === "oxidation" ? (n.d && (t += "{\\vphantom{X}}", t += "^{" + n.d + "}"), n.q && (t += "{\\vphantom{X}}", t += "_{\\smash[t]{" + n.q + "}}")) : (n.q && (t += "{\\vphantom{X}}", t += "_{\\smash[t]{" + n.q + "}}"), n.d && (t += "{\\vphantom{X}}", t += "^{" + n.d + "}"));
1576
+ break;
1577
+ case "rm":
1578
+ t = "\\mathrm{" + e.p1 + "}";
1579
+ break;
1580
+ case "text":
1581
+ e.p1.match(/[\^_]/) ? (e.p1 = e.p1.replace(" ", "~").replace("-", "\\text{-}"), t = "\\mathrm{" + e.p1 + "}") : t = "\\text{" + e.p1 + "}";
1582
+ break;
1583
+ case "roman numeral":
1584
+ t = "\\mathrm{" + e.p1 + "}";
1585
+ break;
1586
+ case "state of aggregation":
1587
+ t = "\\mskip2mu " + a._goInner(e.p1);
1588
+ break;
1589
+ case "state of aggregation subscript":
1590
+ t = "\\mskip1mu " + a._goInner(e.p1);
1591
+ break;
1592
+ case "bond":
1593
+ if (t = a._getBond(e.kind_), !t) throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + e.kind_ + ")"];
1594
+ break;
1595
+ case "frac":
1596
+ var r = "\\frac{" + e.p1 + "}{" + e.p2 + "}";
1597
+ t = "\\mathchoice{\\textstyle" + r + "}{" + r + "}{" + r + "}{" + r + "}";
1598
+ break;
1599
+ case "pu-frac":
1600
+ var i = "\\frac{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
1601
+ t = "\\mathchoice{\\textstyle" + i + "}{" + i + "}{" + i + "}{" + i + "}";
1602
+ break;
1603
+ case "tex-math":
1604
+ t = e.p1 + " ";
1605
+ break;
1606
+ case "frac-ce":
1607
+ t = "\\frac{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
1608
+ break;
1609
+ case "overset":
1610
+ t = "\\overset{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
1611
+ break;
1612
+ case "underset":
1613
+ t = "\\underset{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
1614
+ break;
1615
+ case "underbrace":
1616
+ t = "\\underbrace{" + a._goInner(e.p1) + "}_{" + a._goInner(e.p2) + "}";
1617
+ break;
1618
+ case "color":
1619
+ t = "{\\color{" + e.color1 + "}{" + a._goInner(e.color2) + "}}";
1620
+ break;
1621
+ case "color0":
1622
+ t = "\\color{" + e.color + "}";
1623
+ break;
1624
+ case "arrow":
1625
+ var o = {
1626
+ rd: a._goInner(e.rd),
1627
+ rq: a._goInner(e.rq)
1628
+ }, s = "\\x" + a._getArrow(e.r);
1629
+ o.rq && (s += "[{" + o.rq + "}]"), o.rd ? s += "{" + o.rd + "}" : s += "{}", t = s;
1630
+ break;
1631
+ case "operator":
1632
+ t = a._getOperator(e.kind_);
1633
+ break;
1634
+ case "1st-level escape":
1635
+ t = e.p1 + " ";
1636
+ break;
1637
+ case "space":
1638
+ t = " ";
1639
+ break;
1640
+ case "entitySkip":
1641
+ t = "~";
1642
+ break;
1643
+ case "pu-space-1":
1644
+ t = "~";
1645
+ break;
1646
+ case "pu-space-2":
1647
+ t = "\\mkern3mu ";
1648
+ break;
1649
+ case "1000 separator":
1650
+ t = "\\mkern2mu ";
1651
+ break;
1652
+ case "commaDecimal":
1653
+ t = "{,}";
1654
+ break;
1655
+ case "comma enumeration L":
1656
+ t = "{" + e.p1 + "}\\mkern6mu ";
1657
+ break;
1658
+ case "comma enumeration M":
1659
+ t = "{" + e.p1 + "}\\mkern3mu ";
1660
+ break;
1661
+ case "comma enumeration S":
1662
+ t = "{" + e.p1 + "}\\mkern1mu ";
1663
+ break;
1664
+ case "hyphen":
1665
+ t = "\\text{-}";
1666
+ break;
1667
+ case "addition compound":
1668
+ t = "\\,{\\cdot}\\,";
1669
+ break;
1670
+ case "electron dot":
1671
+ t = "\\mkern1mu \\bullet\\mkern1mu ";
1672
+ break;
1673
+ case "KV x":
1674
+ t = "{\\times}";
1675
+ break;
1676
+ case "prime":
1677
+ t = "\\prime ";
1678
+ break;
1679
+ case "cdot":
1680
+ t = "\\cdot ";
1681
+ break;
1682
+ case "tight cdot":
1683
+ t = "\\mkern1mu{\\cdot}\\mkern1mu ";
1684
+ break;
1685
+ case "times":
1686
+ t = "\\times ";
1687
+ break;
1688
+ case "circa":
1689
+ t = "{\\sim}";
1690
+ break;
1691
+ case "^":
1692
+ t = "uparrow";
1693
+ break;
1694
+ case "v":
1695
+ t = "downarrow";
1696
+ break;
1697
+ case "ellipsis":
1698
+ t = "\\ldots ";
1699
+ break;
1700
+ case "/":
1701
+ t = "/";
1702
+ break;
1703
+ case " / ":
1704
+ t = "\\,/\\,";
1705
+ break;
1706
+ default: throw ["MhchemBugT", "mhchem bug T. Please report."];
1707
+ }
1708
+ return t;
1709
+ },
1710
+ _getArrow: function(e) {
1711
+ switch (e) {
1712
+ case "->": return "rightarrow";
1713
+ case "→": return "rightarrow";
1714
+ case "⟶": return "rightarrow";
1715
+ case "<-": return "leftarrow";
1716
+ case "<->": return "leftrightarrow";
1717
+ case "<-->": return "rightleftarrows";
1718
+ case "<=>": return "rightleftharpoons";
1719
+ case "⇌": return "rightleftharpoons";
1720
+ case "<=>>": return "rightequilibrium";
1721
+ case "<<=>": return "leftequilibrium";
1722
+ default: throw ["MhchemBugT", "mhchem bug T. Please report."];
1723
+ }
1724
+ },
1725
+ _getBond: function(e) {
1726
+ switch (e) {
1727
+ case "-": return "{-}";
1728
+ case "1": return "{-}";
1729
+ case "=": return "{=}";
1730
+ case "2": return "{=}";
1731
+ case "#": return "{\\equiv}";
1732
+ case "3": return "{\\equiv}";
1733
+ case "~": return "{\\tripledash}";
1734
+ case "~-": return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
1735
+ case "~=": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
1736
+ case "~--": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
1737
+ case "-~-": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
1738
+ case "...": return "{{\\cdot}{\\cdot}{\\cdot}}";
1739
+ case "....": return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
1740
+ case "->": return "{\\rightarrow}";
1741
+ case "<-": return "{\\leftarrow}";
1742
+ case "<": return "{<}";
1743
+ case ">": return "{>}";
1744
+ default: throw ["MhchemBugT", "mhchem bug T. Please report."];
1745
+ }
1746
+ },
1747
+ _getOperator: function(e) {
1748
+ switch (e) {
1749
+ case "+": return " {}+{} ";
1750
+ case "-": return " {}-{} ";
1751
+ case "=": return " {}={} ";
1752
+ case "<": return " {}<{} ";
1753
+ case ">": return " {}>{} ";
1754
+ case "<<": return " {}\\ll{} ";
1755
+ case ">>": return " {}\\gg{} ";
1756
+ case "\\pm": return " {}\\pm{} ";
1757
+ case "\\approx": return " {}\\approx{} ";
1758
+ case "$\\approx$": return " {}\\approx{} ";
1759
+ case "v": return " \\downarrow{} ";
1760
+ case "(v)": return " \\downarrow{} ";
1761
+ case "^": return " \\uparrow{} ";
1762
+ case "(^)": return " \\uparrow{} ";
1763
+ default: throw ["MhchemBugT", "mhchem bug T. Please report."];
1764
+ }
1765
+ }
1766
+ }, o = "local.math.display", s = {
1767
+ "unsupported-command": "local.math.display.unsupported-command",
1768
+ "unsupported-environment": "local.math.display.unsupported-environment",
1769
+ budget: "local.math.display.budget",
1770
+ "stray-end": "local.math.display.stray-end",
1771
+ "environment-unclosed": "local.math.display.environment-unclosed",
1772
+ "environment-missing-name": "local.math.display.environment-missing-name",
1773
+ syntax: "local.math.display.syntax"
1774
+ }, c = 5e4, l = 2e4, u = 2e3, d = 50, f = 64, p = 1e3, m = 20, h = /* @__PURE__ */ new Set(/* @__PURE__ */ "def.gdef.edef.xdef.let.futurelet.global.newcommand.renewcommand.providecommand.newenvironment.renewenvironment.csname.endcsname.expandafter.noexpand.long.outer.protected.catcode.makeatletter.makeatother.chardef.mathchardef.countdef.dimendef.skipdef.toksdef.newcount.newdimen.newskip.newtoks.newbox.newif.href.url.includegraphics.htmlClass.htmlId.htmlStyle.htmlData.input.include.includeonly.openin.openout.read.write.immediate.special.shipout".split(".")), g = /* @__PURE__ */ new Set(/* @__PURE__ */ "sqrt.frac.dfrac.tfrac.binom.dbinom.tbinom.overline.underline.hat.tilde.vec.dot.ddot.overrightarrow.overleftarrow.widehat.widetilde.overbrace.underbrace.boxed.pmod.not.overset.stackrel.underset.xrightarrow.xleftarrow.xrightleftharpoons.xleftrightharpoons.xleftrightarrow.mathchoice.mathrm.mathbf.mathit.mathsf.mathbb.mathcal.mathscr.mathfrak.mathnormal.operatorname.text.textrm.mbox.textbf.textit.textsf.texttt.phantom.hphantom.vphantom.smash.llap.rlap.raisebox.rule.kern.mkern.mskip.raise.lower.color.textcolor.fcolorbox.ce.pu".split("."));
1775
+ function _(e, t, n) {
1776
+ let r = Math.max(0, Math.min(e, t)), i = Math.max(r, Math.min(e, n));
1777
+ if (i === r && e > 0) {
1778
+ if (r < e) i = r + 1;
1779
+ else return {
1780
+ start: e - 1,
1781
+ end: e
1782
+ };
1783
+ }
1784
+ return {
1785
+ start: r,
1786
+ end: i
1787
+ };
1788
+ }
1789
+ function v(t, n, r, i, a, s) {
1790
+ let c = _(t, a, s), l = e(r, "en", i);
1791
+ return {
1792
+ ...c,
1793
+ reason: n,
1794
+ message: l || r,
1795
+ code: o,
1796
+ messageKey: r,
1797
+ ...i ? { params: i } : {}
1798
+ };
1799
+ }
1800
+ function y(e, t, n, r, i) {
1801
+ return v(e, "budget", s.budget, {
1802
+ limit: n,
1803
+ kind: t
1804
+ }, r, i);
1805
+ }
1806
+ function b(e) {
1807
+ return e.length > f ? `${t(e, 63)}…` : e;
1808
+ }
1809
+ var x = class extends Error {
1810
+ kind;
1811
+ limit;
1812
+ offset;
1813
+ constructor(e, t, n) {
1814
+ super("Formula exceeds a display resource budget."), this.kind = e, this.limit = t, this.offset = n;
1815
+ }
1816
+ };
1817
+ function S(e) {
1818
+ let t = [], n = (e) => {
1819
+ if (t.length >= 2e4) throw new x("tokens", l, e.start);
1820
+ t.push(e);
1821
+ }, r = 0;
1822
+ for (; r < e.length;) {
1823
+ let t = e[r];
1824
+ if (t === " " || t === " " || t === "\r" || t === "\n") r += 1;
1825
+ else if (t === "%") for (; r < e.length && e[r] !== "\n";) r += 1;
1826
+ else if (t === "\\") {
1827
+ if (r + 1 >= e.length) {
1828
+ n({
1829
+ kind: "command",
1830
+ value: "\\",
1831
+ start: r,
1832
+ end: r + 1
1833
+ }), r += 1;
1834
+ continue;
1835
+ }
1836
+ let t = e[r + 1];
1837
+ if (t === "\\") {
1838
+ n({
1839
+ kind: "newline",
1840
+ value: "\\\\",
1841
+ start: r,
1842
+ end: r + 2
1843
+ }), r += 2;
1844
+ continue;
1845
+ }
1846
+ if (/[A-Za-z]/.test(t)) {
1847
+ let t = r + 1;
1848
+ for (; t < e.length && /[A-Za-z]/.test(e[t]);) t += 1;
1849
+ n({
1850
+ kind: "command",
1851
+ value: e.slice(r + 1, t),
1852
+ start: r,
1853
+ end: t
1854
+ }), r = t;
1855
+ continue;
1856
+ }
1857
+ n({
1858
+ kind: "command",
1859
+ value: t,
1860
+ start: r,
1861
+ end: r + 2
1862
+ }), r += 2;
1863
+ } else if (t >= "0" && t <= "9") {
1864
+ let t = /^\d+(?:\.\d*)?/.exec(e.slice(r));
1865
+ n({
1866
+ kind: "number",
1867
+ value: t[0],
1868
+ start: r,
1869
+ end: r + t[0].length
1870
+ }), r += t[0].length;
1871
+ } else if (t === "." && e[r + 1] >= "0" && e[r + 1] <= "9") {
1872
+ let t = /^(?:\d+(?:\.\d*)?|\.\d+)/.exec(e.slice(r));
1873
+ n({
1874
+ kind: "number",
1875
+ value: t[0],
1876
+ start: r,
1877
+ end: r + t[0].length
1878
+ }), r += t[0].length;
1879
+ } else /[A-Za-z]/.test(t) ? (n({
1880
+ kind: "letter",
1881
+ value: t,
1882
+ start: r,
1883
+ end: r + 1
1884
+ }), r += 1) : (n({
1885
+ kind: "punct",
1886
+ value: t,
1887
+ start: r,
1888
+ end: r + 1
1889
+ }), r += 1);
1890
+ }
1891
+ return n({
1892
+ kind: "eof",
1893
+ value: "",
1894
+ start: e.length,
1895
+ end: e.length
1896
+ }), t;
1897
+ }
1898
+ function C(e, t, n) {
1899
+ let r = e[n];
1900
+ if (!r || r.kind !== "punct" || r.value !== "{") return null;
1901
+ let i = 1;
1902
+ for (let a = n + 1; a < e.length; a += 1) {
1903
+ let n = e[a];
1904
+ if (n.kind === "eof") break;
1905
+ if (n.kind === "punct") {
1906
+ if (n.value === "{") i += 1;
1907
+ else if (n.value === "}" && (--i, i === 0)) return {
1908
+ name: t.slice(r.end, n.start).trim(),
1909
+ groupEnd: n.end,
1910
+ terminated: !0
1911
+ };
1912
+ }
1913
+ }
1914
+ return {
1915
+ name: t.slice(r.end).trim(),
1916
+ groupEnd: t.length,
1917
+ terminated: !1
1918
+ };
1919
+ }
1920
+ function w(e) {
1921
+ let t = S(e), n = [], r = /* @__PURE__ */ new Map(), i = [], a = [], o = 0, c = 0, l = 0, u = !1, f = (e) => {
1922
+ if (o + c + a.length + l > 120) throw new x("depth", 120, e);
1923
+ }, p = (t, r, i, a, o) => {
1924
+ n.length >= d || n.push(v(e.length, t, r, i, a, o));
1925
+ };
1926
+ for (let n = 0; n < t.length; n += 1) {
1927
+ let d = t[n];
1928
+ if (d.kind === "eof") break;
1929
+ if (d.kind === "command") {
1930
+ let o = d.value, m = r.get(o);
1931
+ if (m ? m.push({
1932
+ start: d.start,
1933
+ end: d.end
1934
+ }) : r.set(o, [{
1935
+ start: d.start,
1936
+ end: d.end
1937
+ }]), h.has(o) && p("unsupported-command", s["unsupported-command"], { name: b(o) }, d.start, d.end), o === "left" ? (c += 1, f(d.start)) : o === "right" && (c = Math.max(0, c - 1)), o === "begin" || o === "end") {
1938
+ let r = C(t, e, n + 1);
1939
+ if (o === "begin") {
1940
+ if (!r) p("syntax", s["environment-missing-name"], void 0, d.start, d.end);
1941
+ else if (!r.terminated) p("syntax", s["environment-unclosed"], { name: b(r.name) || "?" }, d.start, r.groupEnd);
1942
+ else if (!r.name) p("syntax", s["environment-missing-name"], void 0, d.start, r.groupEnd);
1943
+ else {
1944
+ let e = {
1945
+ name: r.name,
1946
+ start: d.start,
1947
+ groupEnd: r.groupEnd
1948
+ };
1949
+ i.push(e), a.push(e), f(d.start);
1950
+ }
1951
+ } else !r || !r.terminated || !r.name ? p("syntax", s["stray-end"], void 0, d.start, r?.groupEnd ?? d.end) : a.length === 0 ? p("syntax", s["stray-end"], void 0, d.start, r.groupEnd) : a.pop().name !== r.name && p("syntax", s.syntax, void 0, d.start, r.groupEnd);
1952
+ l = 0, u = !1;
1953
+ continue;
1954
+ }
1955
+ g.has(o) ? (l = u ? l + 1 : 1, f(d.start), u = !0) : (l = 0, u = !1);
1956
+ } else d.kind === "punct" && (d.value === "{" ? (o += 1, f(d.start)) : d.value === "}" && (o = Math.max(0, o - 1))), l = 0, u = !1;
1957
+ }
1958
+ for (let e of a) p("syntax", s["environment-unclosed"], { name: b(e.name) }, e.start, e.groupEnd);
1959
+ return n.sort((e, t) => e.start - t.start || e.end - t.end), {
1960
+ issues: n,
1961
+ commands: r,
1962
+ environments: i
1963
+ };
1964
+ }
1965
+ function T(e) {
1966
+ if (typeof e != "object" || !e) return {};
1967
+ let t = e, n = {};
1968
+ return typeof t.position == "number" && Number.isFinite(t.position) && (n.position = t.position), typeof t.length == "number" && Number.isFinite(t.length) && (n.length = t.length), typeof t.rawMessage == "string" && (n.rawMessage = t.rawMessage), typeof t.message == "string" && (n.message = t.message), n;
1969
+ }
1970
+ function E(e, t) {
1971
+ if (t.position !== void 0) {
1972
+ let n = t.length !== void 0 && t.length > 0 ? t.length : 1;
1973
+ return _(e, t.position, t.position + n);
1974
+ }
1975
+ return {
1976
+ start: 0,
1977
+ end: e
1978
+ };
1979
+ }
1980
+ function D(e, t, n) {
1981
+ let r = e.commands.get(t);
1982
+ if (!r || r.length === 0) return null;
1983
+ if (n !== void 0) {
1984
+ let e = r.find((e) => e.start === n);
1985
+ if (e) return e;
1986
+ let t = r.find((e) => e.start >= n);
1987
+ if (t) return t;
1988
+ }
1989
+ return r[0];
1990
+ }
1991
+ function O(e, t, n) {
1992
+ let r = null;
1993
+ for (let i of e.environments) i.name === t && (n === void 0 || i.start <= n ? r = i : r ||= i);
1994
+ return r ? {
1995
+ start: r.start,
1996
+ end: r.groupEnd
1997
+ } : null;
1998
+ }
1999
+ function k(e, t, n) {
2000
+ let r = T(n), i = r.rawMessage ?? r.message ?? "", a = /Undefined control sequence: (\\\S+)/.exec(i);
2001
+ if (a) {
2002
+ let n = b(a[1].slice(1)), i = D(t, n, r.position) ?? E(e.length, r);
2003
+ return v(e.length, "unsupported-command", s["unsupported-command"], { name: n }, i.start, i.end);
2004
+ }
2005
+ let o = /No such environment: (.+)$/.exec(i);
2006
+ if (o) {
2007
+ let n = b(o[1].trim()), i = O(t, n, r.position) ?? E(e.length, r);
2008
+ return v(e.length, "unsupported-environment", s["unsupported-environment"], { name: n }, i.start, i.end);
2009
+ }
2010
+ if (/Too many expansions/i.test(i)) {
2011
+ let t = E(e.length, r);
2012
+ return y(e.length, "tokens", p, t.start, t.end);
2013
+ }
2014
+ let c = /\\tag works only in display/.test(i) ? D(t, "tag", r.position) ?? E(e.length, r) : E(e.length, r);
2015
+ return v(e.length, "syntax", s.syntax, void 0, c.start, c.end);
2016
+ }
2017
+ function A(e) {
2018
+ return e.length > 2e3 ? `${t(e, u)}…` : e;
2019
+ }
2020
+ function j(e, t = !1) {
2021
+ if (e.length > 5e4) return {
2022
+ html: null,
2023
+ issues: [y(e.length, "source", c, 0, e.length)]
2024
+ };
2025
+ let r;
2026
+ try {
2027
+ r = w(e);
2028
+ } catch (t) {
2029
+ return t instanceof x ? {
2030
+ html: null,
2031
+ issues: [y(e.length, t.kind, t.limit, t.offset, t.offset + 1)]
2032
+ } : {
2033
+ html: null,
2034
+ issues: [v(e.length, "syntax", s.syntax, void 0, 0, e.length)]
2035
+ };
2036
+ }
2037
+ if (r.issues.length > 0) return {
2038
+ html: null,
2039
+ issues: r.issues
2040
+ };
2041
+ try {
2042
+ return {
2043
+ html: n.renderToString(e, {
2044
+ displayMode: t,
2045
+ output: "htmlAndMathml",
2046
+ throwOnError: !0,
2047
+ strict: "ignore",
2048
+ trust: !1,
2049
+ maxExpand: p,
2050
+ maxSize: m,
2051
+ macros: {}
2052
+ }),
2053
+ issues: []
2054
+ };
2055
+ } catch (t) {
2056
+ return {
2057
+ html: null,
2058
+ issues: [k(e, r, t)]
2059
+ };
2060
+ }
2061
+ }
2062
+ function M(e, t = !0) {
2063
+ return j(e, t).issues;
2064
+ }
2065
+ export { M as n, j as r, A as t };