reactive-md 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG-ch.md +34 -0
  2. package/CHANGELOG.md +34 -0
  3. package/README-ch.md +7 -7
  4. package/README-en.md +7 -7
  5. package/README.md +7 -7
  6. package/THIRD_PARTY_NOTICES.md +0 -57
  7. package/cli/help.mjs +6 -4
  8. package/cli/init.mjs +1 -1
  9. package/cli/migrate.mjs +1 -1
  10. package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
  11. package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
  12. package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
  13. package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
  14. package/dist-library/authoring-Bwu_zCWs.js +768 -0
  15. package/dist-library/choice-values-BItGjPD2.js +58 -0
  16. package/dist-library/compile-B35rfzKr.js +1742 -0
  17. package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
  18. package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
  19. package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
  20. package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
  21. package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
  22. package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
  23. package/dist-library/conditional-branches-CIhJXasR.js +17 -0
  24. package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
  25. package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
  26. package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
  27. package/dist-library/data-table-CSAkm1eU.js +290 -0
  28. package/dist-library/data-table-model-DruztQFt.js +391 -0
  29. package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
  30. package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
  31. package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
  32. package/dist-library/default-options-By16CVw1.js +131 -0
  33. package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
  34. package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
  35. package/dist-library/display-Bb6hAG5T.js +2065 -0
  36. package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
  37. package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
  38. package/dist-library/font-aliases-CKYjwn4o.js +4 -0
  39. package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
  40. package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
  41. package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
  42. package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
  43. package/dist-library/layout-CPQggKxk.js +592 -0
  44. package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
  45. package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
  46. package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
  47. package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
  48. package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
  49. package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
  50. package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
  51. package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
  52. package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
  53. package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
  54. package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
  55. package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
  56. package/dist-library/reactive-md-authoring.js +277 -269
  57. package/dist-library/reactive-md-build.js +327 -33
  58. package/dist-library/reactive-md-compiler-session.js +3 -3
  59. package/dist-library/reactive-md-compiler-standard.js +10 -10
  60. package/dist-library/reactive-md-compiler.js +3 -3
  61. package/dist-library/reactive-md-contracts.js +4 -4
  62. package/dist-library/reactive-md-default-packs.js +4 -3
  63. package/dist-library/reactive-md-default-preset.js +3 -3
  64. package/dist-library/reactive-md-export.js +6 -6
  65. package/dist-library/reactive-md-minimal-preset.js +3 -2
  66. package/dist-library/reactive-md-minimal-react-preset.js +18 -17
  67. package/dist-library/reactive-md-minimal.css +1 -1
  68. package/dist-library/reactive-md-observability.js +2 -2
  69. package/dist-library/reactive-md-pack-style-manifest.js +8 -0
  70. package/dist-library/reactive-md-plugin-chart.js +13 -9
  71. package/dist-library/reactive-md-plugin-data.js +4 -4
  72. package/dist-library/reactive-md-plugin-diagram.js +3 -3
  73. package/dist-library/reactive-md-plugin-forms.js +5 -5
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +10 -10
  76. package/dist-library/reactive-md-plugin-network.js +5 -5
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-react-component-accordion.js +3 -3
  79. package/dist-library/reactive-md-react-component-alert.js +3 -3
  80. package/dist-library/reactive-md-react-component-anchor.js +3 -3
  81. package/dist-library/reactive-md-react-component-badge.js +3 -3
  82. package/dist-library/reactive-md-react-component-card.js +3 -3
  83. package/dist-library/reactive-md-react-component-chart.js +2 -2
  84. package/dist-library/reactive-md-react-component-checkbox.js +2 -2
  85. package/dist-library/reactive-md-react-component-checklist.js +2 -2
  86. package/dist-library/reactive-md-react-component-choices.js +2 -2
  87. package/dist-library/reactive-md-react-component-column.js +1 -1
  88. package/dist-library/reactive-md-react-component-coordinate.js +2 -2
  89. package/dist-library/reactive-md-react-component-counter.js +2 -2
  90. package/dist-library/reactive-md-react-component-data-table.js +2 -2
  91. package/dist-library/reactive-md-react-component-date.js +2 -2
  92. package/dist-library/reactive-md-react-component-diagram.js +2 -2
  93. package/dist-library/reactive-md-react-component-disclosure.js +3 -3
  94. package/dist-library/reactive-md-react-component-edge.js +1 -1
  95. package/dist-library/reactive-md-react-component-else.js +10 -0
  96. package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
  97. package/dist-library/reactive-md-react-component-gallery.js +2 -2
  98. package/dist-library/reactive-md-react-component-grid.js +3 -3
  99. package/dist-library/reactive-md-react-component-if.js +3 -3
  100. package/dist-library/reactive-md-react-component-input.js +2 -2
  101. package/dist-library/reactive-md-react-component-jump.js +3 -3
  102. package/dist-library/reactive-md-react-component-multi-select.js +2 -2
  103. package/dist-library/reactive-md-react-component-node.js +2 -2
  104. package/dist-library/reactive-md-react-component-number.js +2 -2
  105. package/dist-library/reactive-md-react-component-option.js +1 -1
  106. package/dist-library/reactive-md-react-component-panel.js +3 -3
  107. package/dist-library/reactive-md-react-component-plot.js +2 -2
  108. package/dist-library/reactive-md-react-component-progress.js +2 -2
  109. package/dist-library/reactive-md-react-component-quiz.js +2 -2
  110. package/dist-library/reactive-md-react-component-radio-group.js +2 -2
  111. package/dist-library/reactive-md-react-component-range-slider.js +2 -2
  112. package/dist-library/reactive-md-react-component-section.js +3 -3
  113. package/dist-library/reactive-md-react-component-select.js +2 -2
  114. package/dist-library/reactive-md-react-component-slider.js +2 -2
  115. package/dist-library/reactive-md-react-component-step.js +3 -3
  116. package/dist-library/reactive-md-react-component-steps.js +3 -3
  117. package/dist-library/reactive-md-react-component-tab.js +3 -3
  118. package/dist-library/reactive-md-react-component-table.js +2 -2
  119. package/dist-library/reactive-md-react-component-tabs.js +3 -3
  120. package/dist-library/reactive-md-react-component-text.js +3 -3
  121. package/dist-library/reactive-md-react-component-textarea.js +2 -2
  122. package/dist-library/reactive-md-react-component-timeline.js +2 -2
  123. package/dist-library/reactive-md-react-component-timer.js +2 -2
  124. package/dist-library/reactive-md-react-component-toggle.js +2 -2
  125. package/dist-library/reactive-md-react-component-tooltip.js +3 -3
  126. package/dist-library/reactive-md-react-component-validation.js +3 -3
  127. package/dist-library/reactive-md-react-minimal.js +4 -4
  128. package/dist-library/reactive-md-react-pack-controls.js +4 -4
  129. package/dist-library/reactive-md-react-pack-data.js +3 -3
  130. package/dist-library/reactive-md-react-pack-layout.js +25 -24
  131. package/dist-library/reactive-md-react-pack-visuals.js +2 -2
  132. package/dist-library/reactive-md-react-packed.js +6 -6
  133. package/dist-library/reactive-md-react-server.js +37 -36
  134. package/dist-library/reactive-md-react-static-server.js +2 -2
  135. package/dist-library/reactive-md-react-static.js +1 -1
  136. package/dist-library/reactive-md-react-unstyled.js +12 -12
  137. package/dist-library/reactive-md-react.js +12 -12
  138. package/dist-library/reactive-md-scan.js +1 -1
  139. package/dist-library/reactive-md-sdk.js +23 -9
  140. package/dist-library/reactive-md-standalone-configured.js +2 -2
  141. package/dist-library/reactive-md-standalone-host.js +2 -2
  142. package/dist-library/reactive-md-testing-browser.js +2 -2
  143. package/dist-library/reactive-md-testing-react.js +6 -6
  144. package/dist-library/reactive-md-testing.js +6 -6
  145. package/dist-library/reactive-md-vite.js +25 -9
  146. package/dist-library/reactive-md-worker-pool.js +3 -3
  147. package/dist-library/reactive-md.css +1 -1
  148. package/dist-library/reactive-md.js +52 -43
  149. package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
  150. package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
  151. package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
  152. package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
  153. package/dist-library/rmd-pack-layout.css +9 -0
  154. package/dist-library/rmd-pack-resource-layout.css +9 -0
  155. package/dist-library/runtime-BHeuLOv_.js +1369 -0
  156. package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
  157. package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
  158. package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
  159. package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
  160. package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
  161. package/dist-library/shareable-CHCDnl6j.js +844 -0
  162. package/dist-library/types/authoring/catalog.d.ts +3 -1
  163. package/dist-library/types/authoring/index.d.ts +1 -1
  164. package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
  165. package/dist-library/types/components/chart/default-chart.d.ts +7 -0
  166. package/dist-library/types/components/entries/else.d.ts +3 -0
  167. package/dist-library/types/components/layout/layout.d.ts +5 -0
  168. package/dist-library/types/components/shared/visuals.d.ts +1 -1
  169. package/dist-library/types/components/table/data-table-model.d.ts +95 -2
  170. package/dist-library/types/components/table/data-table.d.ts +2 -2
  171. package/dist-library/types/contracts/component-kernel.d.ts +5 -0
  172. package/dist-library/types/contracts/font-aliases.d.ts +18 -0
  173. package/dist-library/types/contracts/number-literal.d.ts +2 -0
  174. package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
  175. package/dist-library/types/export/index.d.ts +4 -1
  176. package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
  177. package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
  178. package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
  179. package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
  180. package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
  181. package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
  182. package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
  183. package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
  184. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
  185. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
  186. package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
  187. package/dist-library/types/local/evaluation/computations.d.ts +13 -5
  188. package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
  189. package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
  190. package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
  191. package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
  192. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
  193. package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
  194. package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
  195. package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
  196. package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
  197. package/dist-library/types/local/evaluation/validation.d.ts +8 -6
  198. package/dist-library/types/local/index.d.ts +4 -3
  199. package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
  200. package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
  201. package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
  202. package/dist-library/types/local/runtime/runtime.d.ts +3 -1
  203. package/dist-library/types/local/runtime/state.d.ts +30 -15
  204. package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
  205. package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
  206. package/dist-library/types/local/source/authoring.d.ts +10 -0
  207. package/dist-library/types/local/source/source-migration.d.ts +1 -0
  208. package/dist-library/types/local/types.d.ts +33 -2
  209. package/dist-library/types/react/component-api.d.ts +21 -2
  210. package/dist-library/types/react/component-utils.d.ts +11 -0
  211. package/dist-library/types/react/font-aliases.d.ts +2 -0
  212. package/dist-library/types/react/package-core.d.ts +3 -0
  213. package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
  214. package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
  215. package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
  216. package/dist-library/types/react/sdk-core.d.ts +3 -1
  217. package/dist-library/types/sdk/assembly.d.ts +3 -0
  218. package/dist-library/types/sdk/font.d.ts +13 -0
  219. package/dist-library/types/sdk/index.d.ts +1 -0
  220. package/dist-library/types/sdk/theme.d.ts +5 -0
  221. package/dist-library/types/sdk/types.d.ts +6 -0
  222. package/dist-library/types/sdk/version.d.ts +1 -1
  223. package/dist-library/types/shareable.d.ts +15 -3
  224. package/dist-library/types/standalone/prepare.d.ts +4 -2
  225. package/dist-library/types/standalone/session-core.d.ts +4 -1
  226. package/dist-library/types/vite/index.d.ts +3 -0
  227. package/dist-library/types/vite/registration.d.ts +1 -0
  228. package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
  229. package/dist-library/types-FYhRWRn9.js +3 -0
  230. package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
  231. package/dist-library/validation-DRuW0Wl9.js +433 -0
  232. package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
  233. package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
  234. package/dist-library/visuals-7xzoL9ql.js +49340 -0
  235. package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
  236. package/dist-standalone/reactive-md-standalone.css +1 -1
  237. package/dist-standalone/reactive-md-standalone.js +128 -368
  238. package/docs/README-ch.md +3 -1
  239. package/docs/README.md +3 -1
  240. package/docs/compatibility/api-stability-ch.md +1 -1
  241. package/docs/compatibility/api-stability-en.md +1 -1
  242. package/docs/compatibility/compatibility-ch.md +15 -15
  243. package/docs/compatibility/compatibility-en.md +15 -15
  244. package/docs/compatibility/compatibility-manifest.schema.json +3 -2
  245. package/docs/compatibility/deprecation-ch.md +2 -2
  246. package/docs/compatibility/deprecation-en.md +2 -2
  247. package/docs/compatibility/source-versioning-ch.md +22 -14
  248. package/docs/compatibility/source-versioning-en.md +22 -13
  249. package/docs/compatibility/support-matrix-ch.md +4 -3
  250. package/docs/compatibility/support-matrix-en.md +4 -3
  251. package/docs/development/component-development-ch.md +2 -2
  252. package/docs/development/component-development-en.md +2 -2
  253. package/docs/development/component-protocol-ch.md +18 -18
  254. package/docs/development/component-protocol-en.md +14 -14
  255. package/docs/guides/local-guide-ch.md +109 -20
  256. package/docs/guides/local-guide-en.md +109 -20
  257. package/docs/integration/author-tools-ch.md +1 -1
  258. package/docs/integration/author-tools-en.md +1 -1
  259. package/docs/integration/editor-ch.md +3 -3
  260. package/docs/integration/editor-en.md +3 -3
  261. package/docs/integration/extension-sdk-ch.md +29 -3
  262. package/docs/integration/extension-sdk-en.md +29 -3
  263. package/docs/integration/local-integration-ch.md +3 -3
  264. package/docs/integration/local-integration-en.md +3 -3
  265. package/docs/integration/pdf-export-ch.md +42 -0
  266. package/docs/integration/pdf-export-en.md +42 -0
  267. package/docs/integration/shareable-export-ch.md +11 -19
  268. package/docs/integration/shareable-export-en.md +11 -19
  269. package/docs/reference/diagnostics-counting-ch.md +24 -1
  270. package/docs/reference/diagnostics-counting-en.md +24 -1
  271. package/docs/reference/local-interaction-syntax-ch.md +222 -33
  272. package/docs/reference/local-interaction-syntax-en.md +220 -31
  273. package/docs/reference/public-api-ch.md +24 -18
  274. package/docs/reference/public-api-en.md +24 -18
  275. package/docs/reference/theme-protocol-ch.md +1 -1
  276. package/docs/reference/theme-protocol-en.md +1 -1
  277. package/docs/releases/release-0.10.0-ch.md +45 -0
  278. package/docs/releases/release-0.10.0-en.md +45 -0
  279. package/examples/conformance/README-ch.md +3 -3
  280. package/examples/conformance/README.md +3 -3
  281. package/examples/conformance/local-draft-4.json +441 -0
  282. package/examples/integration/README-ch.md +3 -3
  283. package/examples/integration/README.md +3 -3
  284. package/examples/integration/chat-session/package.json +1 -1
  285. package/examples/local/README-ch.md +1 -1
  286. package/examples/local/README.md +1 -1
  287. package/package.json +6 -1
  288. package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
  289. package/dist-library/authoring-B14SsOXZ.js +0 -893
  290. package/dist-library/compile-D50B5_Ww.js +0 -1249
  291. package/dist-library/computations-CffoW7Ff.js +0 -340
  292. package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
  293. package/dist-library/default-options-DU5dxuU6.js +0 -125
  294. package/dist-library/layout-BfUzzO2b.js +0 -553
  295. package/dist-library/runtime-CuJndKqK.js +0 -1289
  296. package/dist-library/shareable-C6mUerpQ.js +0 -817
  297. package/dist-library/types-daDo2c_w.js +0 -3
  298. package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
  299. package/dist-library/visuals-CoVSjVD8.js +0 -49159
@@ -1,8 +1,8 @@
1
1
  import { C as e, E as t } from "./limits-CFERRrlC.js";
2
- import { _ as n, s as r } from "./document-theme-DBAfnk7y.js";
2
+ import { _ as n, s as r } from "./document-theme-CJvN-nC1.js";
3
3
  import { a as i, i as a, n as o, r as s, t as c } from "./react-BbyAgeXc.js";
4
4
  import { n as l, t as u } from "./motion-tokens-Czk0RDmS.js";
5
- import { A as d, C as f, D as p, F as m, L as h, M as g, N as _, O as v, P as y, S as b, _ as x, d as S, i as C, j as w, l as T, m as E, n as D, o as O, p as k, r as A, t as j, u as M, v as N, x as P, y as F } from "./component-utils-eSj5IdG4.js";
5
+ import { C as d, F as f, I as p, M as m, N as h, O as g, P as _, R as v, S as y, a as b, b as x, d as S, f as C, h as w, i as T, j as E, k as D, m as O, r as k, s as A, t as j, u as M, v as N, w as P, y as F } from "./component-utils-ZM3jUJNy.js";
6
6
  import * as I from "react";
7
7
  import { createContext as L, createElement as R, forwardRef as z, useCallback as B, useContext as V, useEffect as H, useId as ee, useInsertionEffect as te, useLayoutEffect as U, useMemo as ne, useRef as W, useState as G, useSyncExternalStore as re } from "react";
8
8
  import { Fragment as ie, jsx as K, jsxs as q } from "react/jsx-runtime";
@@ -4960,10 +4960,10 @@ function cl(e, t, n) {
4960
4960
  }
4961
4961
  // src/components/controls/controls.tsx
4962
4962
  function ll(e, t) {
4963
- if (e.content.attrs[t] !== void 0) return Math.max(0, Math.floor(N(e, t, 0)));
4963
+ if (e.content.attrs[t] !== void 0) return Math.max(0, Math.floor(F(e, t, 0)));
4964
4964
  }
4965
4965
  function ul(e) {
4966
- let t = w(e), n = v(e, "label", t.content.name || t.t("Input", "输入")), r = (b(t.content, "type") ?? "text") === "email";
4966
+ let t = m(e), n = D(e, "label", t.content.name || t.t("Input", "输入")), r = (d(t.content, "type") ?? "text") === "email";
4967
4967
  return /* @__PURE__ */ K(fl, {
4968
4968
  context: e,
4969
4969
  label: n,
@@ -4971,7 +4971,7 @@ function ul(e) {
4971
4971
  });
4972
4972
  }
4973
4973
  function dl(e) {
4974
- let t = w(e), n = v(e, "label", t.t("Text", "文本")), r = Math.min(40, Math.max(1, Math.floor(N(e, "rows", 4))));
4974
+ let t = m(e), n = D(e, "label", t.t("Text", "文本")), r = Math.min(40, Math.max(1, Math.floor(F(e, "rows", 4))));
4975
4975
  return /* @__PURE__ */ K(fl, {
4976
4976
  context: e,
4977
4977
  label: n,
@@ -4980,34 +4980,34 @@ function dl(e) {
4980
4980
  });
4981
4981
  }
4982
4982
  function fl({ context: e, label: t, email: n = !1, multiline: r = !1, rows: i }) {
4983
- let a = d(e), o = w(e), s = ee(), c = y(e), { content: l, mode: u, t: _ } = o, { write: x, error: E, setError: D } = h(e), O = v(e, "placeholder", ""), k = f(e, "required", !1), M = k.ok ? k.value : !1, N = (b(l, "required") ?? "").includes("{{"), { disabled: P, invalid: F } = g(e), I = m(e), L = ll(e, "min-length"), R = ll(e, "max-length"), z = S(T(e)), B = r ? "local-textarea" : `local-input${n ? " local-input-email" : ""}`, { draft: V, setDraft: H, setFocused: te, touched: U, setTouched: ne, draftError: W, setDraftError: G, composing: re, pendingDraft: ie } = cl(e, z, D), ae = (e) => ol(e, {
4984
- required: M,
4983
+ let a = E(e), o = m(e), s = ee(), c = f(e), { content: l, mode: u, t: _ } = o, { write: y, error: x, setError: S } = v(e), w = D(e, "placeholder", ""), O = P(e, "required", !1), k = O.ok ? O.value : !1, A = (d(l, "required") ?? "").includes("{{"), { disabled: N, invalid: F } = h(e), I = p(e), L = ll(e, "min-length"), R = ll(e, "max-length"), z = C(M(e)), B = r ? "local-textarea" : `local-input${n ? " local-input-email" : ""}`, { draft: V, setDraft: H, setFocused: te, touched: U, setTouched: ne, draftError: W, setDraftError: G, composing: re, pendingDraft: ie } = cl(e, z, S), ae = (e) => ol(e, {
4984
+ required: k,
4985
4985
  minLength: L,
4986
4986
  maxLength: R,
4987
4987
  email: n
4988
4988
  }, _);
4989
4989
  if (sl(e, (e) => {
4990
4990
  if (re.current) return "invalid";
4991
- let t = S(e), n = ie.current ?? t;
4992
- if (M && n === "") return "required";
4991
+ let t = C(e), n = ie.current ?? t;
4992
+ if (k && n === "") return "required";
4993
4993
  if (n !== t) return "invalid";
4994
- }), u === "static") return /* @__PURE__ */ K(C, {
4994
+ }), u === "static") return /* @__PURE__ */ K(b, {
4995
4995
  authorRoot: a(),
4996
4996
  className: B,
4997
4997
  label: t,
4998
- value: p(z),
4998
+ value: g(z),
4999
4999
  multiline: r
5000
5000
  });
5001
5001
  let oe = (e) => {
5002
- x(e) && (ie.current = void 0);
5002
+ y(e) && (ie.current = void 0);
5003
5003
  }, se = {
5004
5004
  id: `${s}-${r ? "textarea" : "input"}`,
5005
5005
  className: "md-text-input",
5006
5006
  value: V,
5007
- placeholder: O || void 0,
5008
- disabled: P,
5009
- "aria-required": M || void 0,
5010
- "aria-invalid": W || E || I.invalid || !k.ok ? !0 : void 0,
5007
+ placeholder: w || void 0,
5008
+ disabled: N,
5009
+ "aria-required": k || void 0,
5010
+ "aria-invalid": W || x || I.invalid || !O.ok ? !0 : void 0,
5011
5011
  "aria-describedby": I.describedBy,
5012
5012
  onFocus: () => te(!0),
5013
5013
  onBlur: () => {
@@ -5017,7 +5017,7 @@ function fl({ context: e, label: t, email: n = !1, multiline: r = !1, rows: i })
5017
5017
  },
5018
5018
  onChange: (e) => {
5019
5019
  let t = e.target.value;
5020
- H(t), D(null), U && G(ae(t)), !re.current && ae(t) === null && oe(t);
5020
+ H(t), S(null), U && G(ae(t)), !re.current && ae(t) === null && oe(t);
5021
5021
  },
5022
5022
  onCompositionStart: () => {
5023
5023
  re.current = !0;
@@ -5046,11 +5046,11 @@ function fl({ context: e, label: t, email: n = !1, multiline: r = !1, rows: i })
5046
5046
  ...se,
5047
5047
  type: n ? "email" : "text"
5048
5048
  }),
5049
- /* @__PURE__ */ K(A, {
5050
- value: p(z),
5049
+ /* @__PURE__ */ K(T, {
5050
+ value: g(z),
5051
5051
  block: r
5052
5052
  }),
5053
- /* @__PURE__ */ K(j, { message: F || !k.ok ? _("Cannot compute", "无法计算") : W ?? E ?? (N && M && z === "" ? _("This field is required", "请填写此字段") : null) })
5053
+ /* @__PURE__ */ K(j, { message: F || !O.ok ? _("Cannot compute", "无法计算") : W ?? x ?? (A && k && z === "" ? _("This field is required", "请填写此字段") : null) })
5054
5054
  ]
5055
5055
  });
5056
5056
  }
@@ -5072,7 +5072,7 @@ function ml(e, t, n, r, i) {
5072
5072
  return Math.abs(o - Math.round(o)) > 1e-9 * Math.max(1, Math.abs(o)) ? i(`Must be a multiple of ${r}`, `需要按步长 ${r} 取值`) : null;
5073
5073
  }
5074
5074
  function hl(e) {
5075
- let t = d(e), n = w(e), r = ee(), i = y(e), { mode: a, t: o } = n, { write: s, error: c, setError: l } = h(e), u = v(e, "label", o("Number", "数字")), { disabled: f, invalid: _ } = g(e), b = m(e), x = F(e, "min"), S = F(e, "max"), E = x.present && !x.error ? x.value : void 0, D = S.present && !S.error ? S.value : void 0, O = x.error || S.error, k = N(e, "step", 1), M = T(e), P = typeof M == "number" && Number.isFinite(M) ? String(M) : "", I = typeof M == "number" && Number.isFinite(M) ? ml(M, E, D, k, o) : null, { draft: L, setDraft: R, focused: z, setFocused: B, touched: V, setTouched: H, draftError: te, setDraftError: U, composing: ne, pendingDraft: W } = cl(e, P, l);
5075
+ let t = E(e), n = m(e), r = ee(), i = f(e), { mode: a, t: o } = n, { write: s, error: c, setError: l } = v(e), u = D(e, "label", o("Number", "数字")), { disabled: d, invalid: _ } = h(e), y = p(e), S = x(e, "min"), C = x(e, "max"), w = S.present && !S.error ? S.value : void 0, O = C.present && !C.error ? C.value : void 0, k = S.error || C.error, A = F(e, "step", 1), N = M(e), P = typeof N == "number" && Number.isFinite(N) ? String(N) : "", I = typeof N == "number" && Number.isFinite(N) ? ml(N, w, O, A, o) : null, { draft: L, setDraft: R, focused: z, setFocused: B, touched: V, setTouched: H, draftError: te, setDraftError: U, composing: ne, pendingDraft: W } = cl(e, P, l);
5076
5076
  sl(e, (e) => {
5077
5077
  if (ne.current) return "invalid";
5078
5078
  let t = W.current;
@@ -5082,22 +5082,22 @@ function hl(e) {
5082
5082
  }
5083
5083
  });
5084
5084
  let G = /* @__PURE__ */ q(ie, { children: [
5085
- E === void 0 ? "" : o(`Min ${E}`, `最小 ${E}`),
5086
- E !== void 0 && D !== void 0 ? " · " : "",
5087
- D === void 0 ? "" : o(`Max ${D}`, `最大 ${D}`),
5088
- k === void 0 ? "" : o(` · Step ${k}`, ` · 步长 ${k}`)
5085
+ w === void 0 ? "" : o(`Min ${w}`, `最小 ${w}`),
5086
+ w !== void 0 && O !== void 0 ? " · " : "",
5087
+ O === void 0 ? "" : o(`Max ${O}`, `最大 ${O}`),
5088
+ A === void 0 ? "" : o(` · Step ${A}`, ` · 步长 ${A}`)
5089
5089
  ] });
5090
- if (a === "static") return /* @__PURE__ */ K(C, {
5090
+ if (a === "static") return /* @__PURE__ */ K(b, {
5091
5091
  authorRoot: t(),
5092
5092
  className: "local-number",
5093
5093
  label: u,
5094
- value: p(P),
5094
+ value: g(P),
5095
5095
  hint: G
5096
5096
  });
5097
5097
  let re = (e, t) => {
5098
5098
  let n = pl(e);
5099
5099
  if (n.kind !== "valid") return t && U(o("Enter a valid number", "请输入有效数字")), !1;
5100
- let r = ml(n.value, E, D, k, o);
5100
+ let r = ml(n.value, w, O, A, o);
5101
5101
  if (r) return t && U(r), !1;
5102
5102
  U(null);
5103
5103
  let i = s(n.value);
@@ -5120,12 +5120,12 @@ function hl(e) {
5120
5120
  type: "text",
5121
5121
  inputMode: "decimal",
5122
5122
  value: L,
5123
- min: E,
5124
- max: D,
5125
- step: k,
5126
- disabled: f,
5127
- "aria-invalid": te || c || b.invalid || O || !z && I ? !0 : void 0,
5128
- "aria-describedby": b.describedBy,
5123
+ min: w,
5124
+ max: O,
5125
+ step: A,
5126
+ disabled: d,
5127
+ "aria-invalid": te || c || y.invalid || k || !z && I ? !0 : void 0,
5128
+ "aria-describedby": y.describedBy,
5129
5129
  onFocus: () => B(!0),
5130
5130
  onBlur: () => {
5131
5131
  B(!1), H(!0), re(L, !0);
@@ -5141,25 +5141,25 @@ function hl(e) {
5141
5141
  ne.current = !1, R(e.currentTarget.value), re(e.currentTarget.value, V);
5142
5142
  }
5143
5143
  }),
5144
- /* @__PURE__ */ K(A, { value: p(P) }),
5145
- E !== void 0 || D !== void 0 || k !== void 0 ? /* @__PURE__ */ K("span", {
5144
+ /* @__PURE__ */ K(T, { value: g(P) }),
5145
+ w !== void 0 || O !== void 0 || A !== void 0 ? /* @__PURE__ */ K("span", {
5146
5146
  className: "md-hint",
5147
5147
  children: G
5148
5148
  }) : null,
5149
- /* @__PURE__ */ K(j, { message: _ || O ? o("Cannot compute", "无法计算") : te ?? c ?? (z ? null : I) })
5149
+ /* @__PURE__ */ K(j, { message: _ || k ? o("Cannot compute", "无法计算") : te ?? c ?? (z ? null : I) })
5150
5150
  ]
5151
5151
  });
5152
5152
  }
5153
5153
  function gl(e) {
5154
- let t = d(e), n = w(e), r = ee(), i = y(e), { content: a, mode: o, t: s } = n, { write: c, error: l } = h(e), u = v(e, "label", s("Toggle", "开关")), { disabled: f, invalid: p } = g(e), _ = m(e), b = T(e) === !0, S = b ? s("On", "开") : s("Off", "关");
5155
- return o === "static" ? /* @__PURE__ */ K(C, {
5154
+ let t = E(e), n = m(e), r = ee(), i = f(e), { content: a, mode: o, t: s } = n, { write: c, error: l } = v(e), u = D(e, "label", s("Toggle", "开关")), { disabled: d, invalid: g } = h(e), _ = p(e), y = M(e) === !0, x = y ? s("On", "开") : s("Off", "关");
5155
+ return o === "static" ? /* @__PURE__ */ K(b, {
5156
5156
  authorRoot: t(),
5157
5157
  className: "md-toggle local-toggle",
5158
5158
  label: u,
5159
- value: S
5159
+ value: x
5160
5160
  }) : /* @__PURE__ */ q("div", {
5161
5161
  className: "md-control md-toggle local-toggle",
5162
- ...t(O(x(a))),
5162
+ ...t(A(N(a))),
5163
5163
  "data-rmd-component": "toggle",
5164
5164
  ...i,
5165
5165
  children: [
@@ -5169,28 +5169,28 @@ function gl(e) {
5169
5169
  children: [/* @__PURE__ */ K("input", {
5170
5170
  id: `${r}-toggle`,
5171
5171
  type: "checkbox",
5172
- checked: b,
5173
- disabled: f,
5172
+ checked: y,
5173
+ disabled: d,
5174
5174
  "aria-invalid": _.invalid || void 0,
5175
5175
  "aria-describedby": _.describedBy,
5176
5176
  onChange: (e) => c(e.target.checked)
5177
5177
  }), /* @__PURE__ */ K("span", { children: u })]
5178
5178
  }),
5179
- /* @__PURE__ */ K(A, { value: S }),
5180
- /* @__PURE__ */ K(j, { message: p ? s("Cannot compute", "无法计算") : l })
5179
+ /* @__PURE__ */ K(T, { value: x }),
5180
+ /* @__PURE__ */ K(j, { message: g ? s("Cannot compute", "无法计算") : l })
5181
5181
  ]
5182
5182
  });
5183
5183
  }
5184
5184
  function _l(e) {
5185
- let t = d(e), n = w(e), r = ee(), i = y(e), { content: a, mode: o, t: s } = n, { write: c, error: l } = h(e), u = v(e, "label", s("Checkbox", "勾选")), { disabled: f, invalid: p } = g(e), _ = m(e), b = T(e) === !0, S = b ? s("Checked", "已勾选") : s("Unchecked", "未勾选");
5186
- return o === "static" ? /* @__PURE__ */ K(C, {
5185
+ let t = E(e), n = m(e), r = ee(), i = f(e), { content: a, mode: o, t: s } = n, { write: c, error: l } = v(e), u = D(e, "label", s("Checkbox", "勾选")), { disabled: d, invalid: g } = h(e), _ = p(e), y = M(e) === !0, x = y ? s("Checked", "已勾选") : s("Unchecked", "未勾选");
5186
+ return o === "static" ? /* @__PURE__ */ K(b, {
5187
5187
  authorRoot: t(),
5188
5188
  className: "local-checkbox",
5189
5189
  label: u,
5190
- value: S
5190
+ value: x
5191
5191
  }) : /* @__PURE__ */ q("div", {
5192
5192
  className: "md-control local-checkbox",
5193
- ...t(O(x(a))),
5193
+ ...t(A(N(a))),
5194
5194
  "data-rmd-component": "checkbox",
5195
5195
  ...i,
5196
5196
  children: [
@@ -5200,15 +5200,15 @@ function _l(e) {
5200
5200
  children: [/* @__PURE__ */ K("input", {
5201
5201
  id: `${r}-checkbox`,
5202
5202
  type: "checkbox",
5203
- checked: b,
5204
- disabled: f,
5203
+ checked: y,
5204
+ disabled: d,
5205
5205
  "aria-invalid": _.invalid || void 0,
5206
5206
  "aria-describedby": _.describedBy,
5207
5207
  onChange: (e) => c(e.target.checked)
5208
5208
  }), /* @__PURE__ */ K("span", { children: u })]
5209
5209
  }),
5210
- /* @__PURE__ */ K(A, { value: S }),
5211
- /* @__PURE__ */ K(j, { message: p ? s("Cannot compute", "无法计算") : l })
5210
+ /* @__PURE__ */ K(T, { value: x }),
5211
+ /* @__PURE__ */ K(j, { message: g ? s("Cannot compute", "无法计算") : l })
5212
5212
  ]
5213
5213
  });
5214
5214
  }
@@ -5229,16 +5229,16 @@ function bl(e) {
5229
5229
  return `${String(e.getFullYear()).padStart(4, "0")}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
5230
5230
  }
5231
5231
  function xl(e) {
5232
- let t = d(e), n = w(e), r = ee(), i = y(e), { content: a, mode: o, locale: s, t: c } = n, { write: l, error: u } = h(e), x = v(e, "label", c("Date", "日期")), { disabled: S, invalid: E } = g(e), D = m(e), O = f(e, "required", !1), k = O.ok ? O.value : !1, N = (b(a, "required") ?? "").includes("{{"), P = M(e, "min"), F = M(e, "max"), I = P.present && !P.error ? P.value : "", L = F.present && !F.error ? F.value : "", R = P.error || F.error || !O.ok, z = T(e), B = typeof z == "string" ? z : "", [V, H] = G(!1);
5232
+ let t = E(e), n = m(e), r = ee(), i = f(e), { content: a, mode: o, locale: s, t: c } = n, { write: l, error: u } = v(e), y = D(e, "label", c("Date", "日期")), { disabled: x, invalid: C } = h(e), w = p(e), O = P(e, "required", !1), k = O.ok ? O.value : !1, A = (d(a, "required") ?? "").includes("{{"), N = S(e, "min"), F = S(e, "max"), I = N.present && !N.error ? N.value : "", L = F.present && !F.error ? F.value : "", R = N.error || F.error || !O.ok, z = M(e), B = typeof z == "string" ? z : "", [V, H] = G(!1);
5233
5233
  _(e, () => H(!1));
5234
- let te = B !== "" && (I !== "" && B < I || L !== "" && B > L) ? c(`Date must be between ${I || "…"} and ${L || "…"}`, `日期必须在 ${I || "…"} 与 ${L || "…"} 之间`) : null, U = (k && B === "" && (V || N) ? c("Select a date", "请选择日期") : null) ?? te;
5235
- if (o === "static") return /* @__PURE__ */ K(C, {
5234
+ let te = B !== "" && (I !== "" && B < I || L !== "" && B > L) ? c(`Date must be between ${I || "…"} and ${L || "…"}`, `日期必须在 ${I || "…"} 与 ${L || "…"} 之间`) : null, U = (k && B === "" && (V || A) ? c("Select a date", "请选择日期") : null) ?? te;
5235
+ if (o === "static") return /* @__PURE__ */ K(b, {
5236
5236
  authorRoot: t(),
5237
5237
  className: "local-date",
5238
- label: x,
5239
- value: p(B)
5238
+ label: y,
5239
+ value: g(B)
5240
5240
  });
5241
- let ne = E || R ? c("Cannot compute", "无法计算") : U ?? u, W = ne ? `${r}-date-error` : void 0;
5241
+ let ne = C || R ? c("Cannot compute", "无法计算") : U ?? u, W = ne ? `${r}-date-error` : void 0;
5242
5242
  return /* @__PURE__ */ q("div", {
5243
5243
  ...t(),
5244
5244
  className: "md-control local-date local-date-picker",
@@ -5247,7 +5247,7 @@ function xl(e) {
5247
5247
  children: [
5248
5248
  /* @__PURE__ */ K(xt, {
5249
5249
  id: `${r}-date`,
5250
- label: x,
5250
+ label: y,
5251
5251
  value: yl(B),
5252
5252
  onChange: (e) => {
5253
5253
  H(!0), l(e ? bl(e) : "");
@@ -5261,64 +5261,89 @@ function xl(e) {
5261
5261
  previousMonthLabel: c("Previous month", "上个月"),
5262
5262
  nextMonthLabel: c("Next month", "下个月"),
5263
5263
  clearLabel: c("Clear", "清除"),
5264
- calendarLabel: c(`${x} calendar`, `${x} 日历`),
5264
+ calendarLabel: c(`${y} calendar`, `${y} 日历`),
5265
5265
  statusLabel: (e) => e ? c(`Selected ${e}`, `已选择 ${e}`) : c("Choose a day", "请选择日期"),
5266
5266
  showToday: !0,
5267
- disabled: S,
5267
+ disabled: x,
5268
5268
  "aria-required": k || void 0,
5269
- invalid: !!ne || D.invalid,
5270
- describedBy: [D.describedBy, W].filter(Boolean).join(" ") || void 0
5269
+ invalid: !!ne || w.invalid,
5270
+ describedBy: [w.describedBy, W].filter(Boolean).join(" ") || void 0
5271
5271
  }, n.resetToken),
5272
5272
  /* @__PURE__ */ K(j, {
5273
5273
  id: W,
5274
5274
  message: ne
5275
5275
  }),
5276
- /* @__PURE__ */ K(A, { value: p(B) })
5276
+ /* @__PURE__ */ K(T, { value: g(B) })
5277
5277
  ]
5278
5278
  });
5279
5279
  }
5280
5280
  function Sl(e) {
5281
- let t = d(e), n = w(e), r = ee(), { content: i, mode: a, t: o } = n, { write: s, error: c } = h(e), l = v(e, "label", o("Select", "选择")), { disabled: u, invalid: f } = g(e), _ = m(e), y = e.children.options(), b = T(e), S = typeof b == "string" ? b : "", E = y.some((e) => e.value === S) ? S : y[0]?.value ?? "", k = y.find((e) => e.value === E), M = k ? P(e, k) || E : "";
5282
- if (y.length === 0) return /* @__PURE__ */ K(D, { message: o("Missing options", "缺少选项") });
5283
- if (a === "static") return /* @__PURE__ */ K(C, {
5281
+ return d(e.content, "options") !== void 0;
5282
+ }
5283
+ function Cl({ authorRoot: e, className: t, component: n, label: r, message: i }) {
5284
+ return /* @__PURE__ */ q("div", {
5285
+ ...e,
5286
+ className: `md-control ${t} local-empty-options`,
5287
+ "data-rmd-component": n,
5288
+ "data-rmd-empty-options": "",
5289
+ "aria-disabled": "true",
5290
+ children: [/* @__PURE__ */ K("span", {
5291
+ className: "md-label",
5292
+ children: r
5293
+ }), /* @__PURE__ */ K("span", {
5294
+ className: "md-hint",
5295
+ children: i
5296
+ })]
5297
+ });
5298
+ }
5299
+ function wl(e) {
5300
+ let t = E(e), n = m(e), r = ee(), { content: i, mode: a, t: o } = n, { write: s, error: c } = v(e), l = D(e, "label", o("Select", "选择")), { disabled: u, invalid: d } = h(e), f = p(e), _ = e.children.options(), x = M(e), S = typeof x == "string" ? x : "", C = _.some((e) => e.value === S) ? S : Sl(e) ? "" : _[0]?.value ?? "", w = _.find((e) => e.value === C), O = w ? y(e, w) || C : "";
5301
+ if (_.length === 0) return Sl(e) ? /* @__PURE__ */ K(Cl, {
5302
+ authorRoot: t(),
5303
+ className: "local-select",
5304
+ component: "select",
5305
+ label: l,
5306
+ message: o("No options", "没有选项")
5307
+ }) : /* @__PURE__ */ K(k, { message: o("Missing options", "缺少选项") });
5308
+ if (a === "static") return /* @__PURE__ */ K(b, {
5284
5309
  authorRoot: t(),
5285
5310
  className: "md-select local-select",
5286
5311
  label: l,
5287
- value: p(M)
5312
+ value: g(O)
5288
5313
  });
5289
- let N = y.map((t, n) => ({
5314
+ let P = _.map((t, n) => ({
5290
5315
  value: `${r}-option-${n}`,
5291
- label: P(e, t) || t.value
5292
- })), F = N[Math.max(0, y.findIndex((e) => e.value === E))]?.value ?? "", I = f ? o("Cannot compute", "无法计算") : c, L = I ? `${r}-select-error` : void 0;
5316
+ label: y(e, t) || t.value
5317
+ })), F = P[Math.max(0, _.findIndex((e) => e.value === C))]?.value ?? "", I = d ? o("Cannot compute", "无法计算") : c, L = I ? `${r}-select-error` : void 0;
5293
5318
  return /* @__PURE__ */ q("div", {
5294
5319
  className: "md-control md-select local-select",
5295
- ...t(O(x(i))),
5320
+ ...t(A(N(i))),
5296
5321
  "data-rmd-part": "control",
5297
5322
  children: [
5298
5323
  /* @__PURE__ */ K(al, {
5299
5324
  id: `${r}-select`,
5300
5325
  label: l,
5301
- options: N,
5326
+ options: P,
5302
5327
  value: F,
5303
5328
  placeholder: o("Select an option", "请选择选项"),
5304
5329
  onValueChange: (e) => {
5305
- let t = N.findIndex((t) => t.value === e), n = y[t];
5330
+ let t = P.findIndex((t) => t.value === e), n = _[t];
5306
5331
  n && s(n.value);
5307
5332
  },
5308
5333
  disabled: u,
5309
- invalid: !!I || _.invalid,
5310
- describedBy: [_.describedBy, L].filter(Boolean).join(" ") || void 0
5334
+ invalid: !!I || f.invalid,
5335
+ describedBy: [f.describedBy, L].filter(Boolean).join(" ") || void 0
5311
5336
  }, n.resetToken),
5312
5337
  /* @__PURE__ */ K(j, {
5313
5338
  id: L,
5314
5339
  message: I
5315
5340
  }),
5316
- /* @__PURE__ */ K(A, { value: p(M) })
5341
+ /* @__PURE__ */ K(T, { value: g(O) })
5317
5342
  ]
5318
5343
  });
5319
5344
  }
5320
- function Cl(e) {
5321
- let t = d(e), n = w(e), r = ee(), { content: a, mode: l, visible: u, t: f } = n, { write: _, error: y } = h(e), b = v(e, "label", f("Options", "选项")), { disabled: S, invalid: E } = g(e), k = m(e), M = e.children.options(), N = T(e), F = typeof N == "string" ? N : "", I = M.findIndex((e) => e.value === F), L = I >= 0 ? I : 0, R = I >= 0 ? M[I] : void 0, z = R ? P(e, R) : "", B = W([]), V = s() ?? !1, te = M.length >= 2 && M.length <= 4, U = i(L);
5345
+ function Tl(e) {
5346
+ let t = E(e), n = m(e), r = ee(), { content: a, mode: l, visible: u, t: d } = n, { write: f, error: _ } = v(e), x = D(e, "label", d("Options", "选项")), { disabled: S, invalid: C } = h(e), w = p(e), O = e.children.options(), P = M(e), F = typeof P == "string" ? P : "", I = O.findIndex((e) => e.value === F), L = I >= 0 ? I : 0, R = I >= 0 ? O[I] : void 0, z = R ? y(e, R) : "", B = W([]), V = s() ?? !1, te = O.length >= 2 && O.length <= 4, U = i(L);
5322
5347
  if (H(() => {
5323
5348
  let e = I >= 0 ? I : 0;
5324
5349
  if (!te || V) {
@@ -5332,42 +5357,48 @@ function Cl(e) {
5332
5357
  V,
5333
5358
  te,
5334
5359
  I
5335
- ]), M.length === 0) return /* @__PURE__ */ K(D, { message: f("Missing options", "缺少选项") });
5336
- if (l === "static") return /* @__PURE__ */ K(C, {
5360
+ ]), O.length === 0) return Sl(e) ? /* @__PURE__ */ K(Cl, {
5361
+ authorRoot: t(),
5362
+ className: "local-choices",
5363
+ component: "choices",
5364
+ label: x,
5365
+ message: d("No options", "没有选项")
5366
+ }) : /* @__PURE__ */ K(k, { message: d("Missing options", "缺少选项") });
5367
+ if (l === "static") return /* @__PURE__ */ K(b, {
5337
5368
  authorRoot: t(),
5338
5369
  className: "local-choices",
5339
- label: b,
5340
- value: p(z)
5370
+ label: x,
5371
+ value: g(z)
5341
5372
  });
5342
5373
  let ne = (e) => {
5343
- let t = M[e];
5344
- t && (_(t.value), B.current[e]?.focus());
5374
+ let t = O[e];
5375
+ t && (f(t.value), B.current[e]?.focus());
5345
5376
  }, G = (e, t) => {
5346
5377
  let n = -1;
5347
- e.key === "ArrowRight" || e.key === "ArrowDown" ? n = (t + 1) % M.length : e.key === "ArrowLeft" || e.key === "ArrowUp" ? n = (t - 1 + M.length) % M.length : e.key === "Home" ? n = 0 : e.key === "End" && (n = M.length - 1), !(n < 0) && (e.preventDefault(), ne(n));
5378
+ e.key === "ArrowRight" || e.key === "ArrowDown" ? n = (t + 1) % O.length : e.key === "ArrowLeft" || e.key === "ArrowUp" ? n = (t - 1 + O.length) % O.length : e.key === "Home" ? n = 0 : e.key === "End" && (n = O.length - 1), !(n < 0) && (e.preventDefault(), ne(n));
5348
5379
  };
5349
5380
  return /* @__PURE__ */ q("div", {
5350
5381
  className: "md-control local-choices",
5351
- ...t(O(x(a))),
5382
+ ...t(A(N(a))),
5352
5383
  "data-rmd-component": "choices",
5353
5384
  children: [
5354
5385
  /* @__PURE__ */ K("span", {
5355
5386
  className: "md-label",
5356
5387
  id: `${r}-choices-label`,
5357
- children: b
5388
+ children: x
5358
5389
  }),
5359
5390
  /* @__PURE__ */ K(c.div, {
5360
5391
  className: "local-choice-list",
5361
5392
  role: "radiogroup",
5362
5393
  "aria-labelledby": `${r}-choices-label`,
5363
5394
  "aria-disabled": S || void 0,
5364
- "aria-invalid": k.invalid || void 0,
5365
- "aria-describedby": k.describedBy,
5395
+ "aria-invalid": w.invalid || void 0,
5396
+ "aria-describedby": w.describedBy,
5366
5397
  "data-rmd-choices": te ? "uiarc" : void 0,
5367
5398
  "data-rmd-part": "list",
5368
5399
  "data-rmd-segments": te ? "" : void 0,
5369
5400
  style: te ? { "--pu-choice-index": U } : void 0,
5370
- children: M.map((e, t) => {
5401
+ children: O.map((e, t) => {
5371
5402
  let r = e.value === F;
5372
5403
  return /* @__PURE__ */ K("button", {
5373
5404
  ref: (e) => {
@@ -5381,64 +5412,70 @@ function Cl(e) {
5381
5412
  className: `local-choice${r ? " is-selected" : ""}`,
5382
5413
  "data-rmd-appearance": "custom",
5383
5414
  "data-rmd-part": "segment",
5384
- onClick: () => _(e.value),
5415
+ onClick: () => f(e.value),
5385
5416
  onKeyDown: (e) => G(e, t),
5386
5417
  children: n.renderInline(e.content.children, u)
5387
5418
  }, e.content.id);
5388
5419
  })
5389
5420
  }),
5390
- /* @__PURE__ */ K(A, { value: p(z) }),
5391
- /* @__PURE__ */ K(j, { message: E ? f("Cannot compute", "无法计算") : y })
5421
+ /* @__PURE__ */ K(T, { value: g(z) }),
5422
+ /* @__PURE__ */ K(j, { message: C ? d("Cannot compute", "无法计算") : _ })
5392
5423
  ]
5393
5424
  });
5394
5425
  }
5395
- function wl(e) {
5396
- let t = d(e), n = w(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, { write: c, error: l } = h(e), u = v(e, "label", s("Options", "选项")), { disabled: f, invalid: _ } = g(e), y = m(e), b = e.children.options(), S = T(e), E = typeof S == "string" ? S : "", k = r, M = b.find((e) => e.value === E), N = M ? P(e, M) : "";
5397
- return b.length === 0 ? /* @__PURE__ */ K(D, { message: s("Missing options", "缺少选项") }) : a === "static" ? /* @__PURE__ */ K(C, {
5426
+ function El(e) {
5427
+ let t = E(e), n = m(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, { write: c, error: l } = v(e), u = D(e, "label", s("Options", "选项")), { disabled: d, invalid: f } = h(e), _ = p(e), x = e.children.options(), S = M(e), C = typeof S == "string" ? S : "", w = r, O = x.find((e) => e.value === C), P = O ? y(e, O) : "";
5428
+ return x.length === 0 ? Sl(e) ? /* @__PURE__ */ K(Cl, {
5429
+ authorRoot: t(),
5430
+ className: "local-radio-group",
5431
+ component: "radio-group",
5432
+ label: u,
5433
+ message: s("No options", "没有选项")
5434
+ }) : /* @__PURE__ */ K(k, { message: s("Missing options", "缺少选项") }) : a === "static" ? /* @__PURE__ */ K(b, {
5398
5435
  authorRoot: t(),
5399
5436
  className: "local-radio-group",
5400
5437
  label: u,
5401
- value: p(N)
5438
+ value: g(P)
5402
5439
  }) : /* @__PURE__ */ q("fieldset", {
5403
5440
  className: "md-control local-radio-group",
5404
- ...t(O(x(i))),
5441
+ ...t(A(N(i))),
5405
5442
  "data-rmd-component": "radio-group",
5406
- disabled: f,
5407
- "aria-invalid": y.invalid || void 0,
5408
- "aria-describedby": y.describedBy,
5443
+ disabled: d,
5444
+ "aria-invalid": _.invalid || void 0,
5445
+ "aria-describedby": _.describedBy,
5409
5446
  children: [
5410
5447
  /* @__PURE__ */ K("legend", {
5411
5448
  className: "md-label",
5412
5449
  children: u
5413
5450
  }),
5414
- b.map((e) => /* @__PURE__ */ q("label", {
5451
+ x.map((e) => /* @__PURE__ */ q("label", {
5415
5452
  className: "local-radio-option",
5416
5453
  children: [/* @__PURE__ */ K("input", {
5417
5454
  type: "radio",
5418
- name: k,
5455
+ name: w,
5419
5456
  value: e.value,
5420
- checked: E === e.value,
5457
+ checked: C === e.value,
5421
5458
  onChange: () => c(e.value)
5422
5459
  }), /* @__PURE__ */ K("span", { children: n.renderInline(e.content.children, o) })]
5423
5460
  }, e.content.id)),
5424
- /* @__PURE__ */ K(A, { value: p(N) }),
5425
- /* @__PURE__ */ K(j, { message: _ ? s("Cannot compute", "无法计算") : l })
5461
+ /* @__PURE__ */ K(T, { value: g(P) }),
5462
+ /* @__PURE__ */ K(j, { message: f ? s("Cannot compute", "无法计算") : l })
5426
5463
  ]
5427
5464
  });
5428
5465
  }
5429
- function Tl(e) {
5466
+ function Dl(e) {
5430
5467
  return (e.children.find((e) => e.kind === "list")?.children ?? []).filter((e) => e.kind === "listItem").map((e, t) => ({
5431
5468
  id: `item-${t + 1}`,
5432
5469
  content: e
5433
5470
  }));
5434
5471
  }
5435
- function El(e) {
5436
- let t = d(e), n = w(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, { write: c, error: l } = h(e), u = v(e, "label", s("Checklist", "清单")), { disabled: f, invalid: p } = g(e), _ = m(e), y = Tl(i), b = T(e), S = Array.isArray(b) ? b.filter((e) => typeof e == "string") : [];
5437
- if (y.length === 0) return /* @__PURE__ */ K(D, { message: s("Checklist requires a task list", "清单需要任务列表") });
5438
- let C = (e) => e ? s("Checked", "已勾选") : s("Unchecked", "未勾选");
5472
+ function Ol(e) {
5473
+ let t = E(e), n = m(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, { write: c, error: l } = v(e), u = D(e, "label", s("Checklist", "清单")), { disabled: d, invalid: f } = h(e), g = p(e), _ = Dl(i), y = M(e), b = Array.isArray(y) ? y.filter((e) => typeof e == "string") : [];
5474
+ if (_.length === 0) return /* @__PURE__ */ K(k, { message: s("Checklist requires a task list", "清单需要任务列表") });
5475
+ let x = (e) => e ? s("Checked", "已勾选") : s("Unchecked", "未勾选");
5439
5476
  if (a === "static") return /* @__PURE__ */ q("div", {
5440
5477
  className: "local-checklist local-static-checklist",
5441
- ...t(O(x(i))),
5478
+ ...t(A(N(i))),
5442
5479
  role: "group",
5443
5480
  "aria-label": u,
5444
5481
  children: [/* @__PURE__ */ K("span", {
@@ -5446,13 +5483,13 @@ function El(e) {
5446
5483
  children: u
5447
5484
  }), /* @__PURE__ */ K("ul", {
5448
5485
  className: "local-static-list",
5449
- children: y.map((e) => {
5450
- let t = S.includes(e.id);
5486
+ children: _.map((e) => {
5487
+ let t = b.includes(e.id);
5451
5488
  return /* @__PURE__ */ q("li", {
5452
5489
  className: "local-static-list-item",
5453
5490
  children: [/* @__PURE__ */ K("span", {
5454
5491
  className: "local-static-state",
5455
- children: C(t)
5492
+ children: x(t)
5456
5493
  }), /* @__PURE__ */ K("span", {
5457
5494
  className: `local-static-item${t ? " is-checked" : ""}`,
5458
5495
  children: n.renderInline(e.content.children, o)
@@ -5461,31 +5498,31 @@ function El(e) {
5461
5498
  })
5462
5499
  })]
5463
5500
  });
5464
- let k = (e, t) => {
5465
- let n = new Set(S);
5466
- t ? n.add(e) : n.delete(e), c(y.filter((e) => n.has(e.id)).map((e) => e.id));
5501
+ let S = (e, t) => {
5502
+ let n = new Set(b);
5503
+ t ? n.add(e) : n.delete(e), c(_.filter((e) => n.has(e.id)).map((e) => e.id));
5467
5504
  };
5468
5505
  return /* @__PURE__ */ q("fieldset", {
5469
5506
  className: "local-checklist",
5470
- ...t(O(x(i))),
5507
+ ...t(A(N(i))),
5471
5508
  "data-rmd-component": "checklist",
5472
- disabled: f,
5473
- "aria-invalid": _.invalid || void 0,
5474
- "aria-describedby": _.describedBy,
5509
+ disabled: d,
5510
+ "aria-invalid": g.invalid || void 0,
5511
+ "aria-describedby": g.describedBy,
5475
5512
  children: [
5476
5513
  /* @__PURE__ */ K("legend", {
5477
5514
  className: "md-label",
5478
5515
  children: u
5479
5516
  }),
5480
- y.map((e) => {
5481
- let t = S.includes(e.id);
5517
+ _.map((e) => {
5518
+ let t = b.includes(e.id);
5482
5519
  return /* @__PURE__ */ q("div", {
5483
5520
  className: "local-checklist-item",
5484
5521
  children: [/* @__PURE__ */ K("input", {
5485
5522
  id: `${r}-${e.id}`,
5486
5523
  type: "checkbox",
5487
5524
  checked: t,
5488
- onChange: (t) => k(e.id, t.target.checked)
5525
+ onChange: (t) => S(e.id, t.target.checked)
5489
5526
  }), /* @__PURE__ */ K("label", {
5490
5527
  className: `local-checklist-text${t ? " is-checked" : ""}`,
5491
5528
  htmlFor: `${r}-${e.id}`,
@@ -5493,42 +5530,42 @@ function El(e) {
5493
5530
  })]
5494
5531
  }, e.id);
5495
5532
  }),
5496
- /* @__PURE__ */ K(A, {
5533
+ /* @__PURE__ */ K(T, {
5497
5534
  block: !0,
5498
5535
  value: /* @__PURE__ */ K("ul", {
5499
5536
  className: "local-static-list",
5500
- children: y.map((t) => {
5501
- let n = S.includes(t.id);
5537
+ children: _.map((t) => {
5538
+ let n = b.includes(t.id);
5502
5539
  return /* @__PURE__ */ q("li", {
5503
5540
  className: "local-static-list-item",
5504
5541
  children: [/* @__PURE__ */ K("span", {
5505
5542
  className: "local-static-state",
5506
- children: C(n)
5543
+ children: x(n)
5507
5544
  }), /* @__PURE__ */ K("span", {
5508
5545
  className: `local-static-item${n ? " is-checked" : ""}`,
5509
- children: E(e, t.content.children)
5546
+ children: w(e, t.content.children)
5510
5547
  })]
5511
5548
  }, t.id);
5512
5549
  })
5513
5550
  })
5514
5551
  }),
5515
- /* @__PURE__ */ K(j, { message: p ? s("Cannot compute", "无法计算") : l })
5552
+ /* @__PURE__ */ K(j, { message: f ? s("Cannot compute", "无法计算") : l })
5516
5553
  ]
5517
5554
  });
5518
5555
  }
5519
- function Dl(e) {
5520
- let t = d(e), { content: n, runtime: r, mode: i, t: a } = w(e), { write: o, error: s } = h(e), c = v(e, "label", a("Counter", "计数")), { disabled: l, invalid: u } = g(e), f = m(e), p = N(e, "min", 0), _ = b(n, "max") === void 0 ? void 0 : N(e, "max", 0), y = N(e, "step", 1), x = T(e), S = typeof x == "number" && Number.isFinite(x) ? x : p, E = Number.isFinite(y) && y > 0 ? y : 1, D = 1e-9 * Math.max(1, Math.abs(S)), O = S - E >= p - D, k = _ === void 0 || S + E <= _ + D;
5521
- if (i === "static") return /* @__PURE__ */ K(C, {
5556
+ function kl(e) {
5557
+ let t = E(e), { content: n, runtime: r, mode: i, t: a } = m(e), { write: o, error: s } = v(e), c = D(e, "label", a("Counter", "计数")), { disabled: l, invalid: u } = h(e), f = p(e), g = F(e, "min", 0), _ = d(n, "max") === void 0 ? void 0 : F(e, "max", 0), y = F(e, "step", 1), x = M(e), S = typeof x == "number" && Number.isFinite(x) ? x : g, C = Number.isFinite(y) && y > 0 ? y : 1, w = 1e-9 * Math.max(1, Math.abs(S)), O = S - C >= g - w, k = _ === void 0 || S + C <= _ + w;
5558
+ if (i === "static") return /* @__PURE__ */ K(b, {
5522
5559
  authorRoot: t(),
5523
5560
  className: "local-counter",
5524
5561
  label: c,
5525
5562
  value: String(S)
5526
5563
  });
5527
- let M = (t) => {
5564
+ let A = (t) => {
5528
5565
  if (e.dispatchAuthorAction?.(t === 1 ? "increment" : "decrement")) return;
5529
- let n = Number((S + t * E).toFixed(12));
5566
+ let n = Number((S + t * C).toFixed(12));
5530
5567
  o(n);
5531
- }, P = () => {
5568
+ }, N = () => {
5532
5569
  e.dispatchAuthorAction?.("reset") || r.reset(n);
5533
5570
  };
5534
5571
  return /* @__PURE__ */ q("div", {
@@ -5552,7 +5589,7 @@ function Dl(e) {
5552
5589
  className: "md-button md-button-secondary local-counter-button",
5553
5590
  "aria-label": `${c} ${a("decrease", "减少")}`,
5554
5591
  disabled: l || !O,
5555
- onClick: () => M(-1),
5592
+ onClick: () => A(-1),
5556
5593
  children: "−"
5557
5594
  }),
5558
5595
  /* @__PURE__ */ K("span", {
@@ -5568,68 +5605,68 @@ function Dl(e) {
5568
5605
  className: "md-button md-button-secondary local-counter-button",
5569
5606
  "aria-label": `${c} ${a("increase", "增加")}`,
5570
5607
  disabled: l || !k,
5571
- onClick: () => M(1),
5608
+ onClick: () => A(1),
5572
5609
  children: "+"
5573
5610
  }),
5574
5611
  /* @__PURE__ */ K("button", {
5575
5612
  type: "button",
5576
5613
  className: "md-button md-button-quiet local-counter-reset",
5577
5614
  disabled: l,
5578
- onClick: P,
5615
+ onClick: N,
5579
5616
  children: a("Reset", "恢复初值")
5580
5617
  })
5581
5618
  ]
5582
5619
  }),
5583
- /* @__PURE__ */ K(A, { value: String(S) }),
5620
+ /* @__PURE__ */ K(T, { value: String(S) }),
5584
5621
  /* @__PURE__ */ K(j, { message: u ? a("Cannot compute", "无法计算") : s })
5585
5622
  ]
5586
5623
  });
5587
5624
  }
5588
- function Ol(e) {
5589
- let t = d(e), { content: n, runtime: i, mode: a, visible: o, locale: s, t: c } = w(e), l = v(e, "label", c("Timer", "计时器")), u = m(e), f = N(e, "duration", 60), p = Math.floor(f), h = T(e), g = typeof h == "number" && Number.isFinite(h) ? Math.max(0, Math.ceil(h)) : p, [y, b] = G(!1), [x, S] = G(!1), E = W(0), O = W(g);
5590
- O.current = g;
5591
- let [M, P] = G(null), F = B((e) => {
5625
+ function Al(e) {
5626
+ let t = E(e), { content: n, runtime: i, mode: a, visible: o, locale: s, t: c } = m(e), l = D(e, "label", c("Timer", "计时器")), u = p(e), d = F(e, "duration", 60), f = Math.floor(d), h = M(e), g = typeof h == "number" && Number.isFinite(h) ? Math.max(0, Math.ceil(h)) : f, [v, y] = G(!1), [x, S] = G(!1), C = W(0), w = W(g);
5627
+ w.current = g;
5628
+ let [A, N] = G(null), P = B((e) => {
5592
5629
  let t = i.set(n, e);
5593
- t.length && P(t.map((e) => r(e, s)).join("; "));
5630
+ t.length && N(t.map((e) => r(e, s)).join("; "));
5594
5631
  }, [
5595
5632
  n,
5596
5633
  s,
5597
5634
  i
5598
5635
  ]);
5599
5636
  if (H(() => {
5600
- if (!y) return;
5637
+ if (!v) return;
5601
5638
  let e = window.setInterval(() => {
5602
- let e = Math.max(0, Math.ceil((E.current - performance.now()) / 1e3));
5603
- e !== O.current && (O.current = e, F(e)), e <= 0 && (b(!1), S(!0));
5639
+ let e = Math.max(0, Math.ceil((C.current - performance.now()) / 1e3));
5640
+ e !== w.current && (w.current = e, P(e)), e <= 0 && (y(!1), S(!0));
5604
5641
  }, 200);
5605
5642
  return () => window.clearInterval(e);
5606
- }, [y, F]), H(() => {
5607
- if (o || !y) return;
5608
- let e = Math.max(0, Math.ceil((E.current - performance.now()) / 1e3));
5609
- O.current = e, F(e), b(!1);
5643
+ }, [v, P]), H(() => {
5644
+ if (o || !v) return;
5645
+ let e = Math.max(0, Math.ceil((C.current - performance.now()) / 1e3));
5646
+ w.current = e, P(e), y(!1);
5610
5647
  }, [
5611
5648
  o,
5612
- y,
5613
- F
5649
+ v,
5650
+ P
5614
5651
  ]), _(e, () => {
5615
- b(!1), S(!1), P(null);
5616
- }), !Number.isFinite(f) || p <= 0) return /* @__PURE__ */ K(D, { message: c("Timer duration must be a positive number of seconds", "计时时长必须是大于 0 的秒数") });
5617
- if (a === "static") return /* @__PURE__ */ K(C, {
5652
+ y(!1), S(!1), N(null);
5653
+ }), !Number.isFinite(d) || f <= 0) return /* @__PURE__ */ K(k, { message: c("Timer duration must be a positive number of seconds", "计时时长必须是大于 0 的秒数") });
5654
+ if (a === "static") return /* @__PURE__ */ K(b, {
5618
5655
  authorRoot: t(),
5619
5656
  className: "local-timer",
5620
5657
  label: l,
5621
- value: k(g, c)
5658
+ value: O(g, c)
5622
5659
  });
5623
5660
  let I = () => {
5624
- if (y) return;
5625
- let e = g > 0 ? g : p;
5626
- g <= 0 && (O.current = p, F(p)), E.current = performance.now() + e * 1e3, S(!1), P(null), b(!0);
5661
+ if (v) return;
5662
+ let e = g > 0 ? g : f;
5663
+ g <= 0 && (w.current = f, P(f)), C.current = performance.now() + e * 1e3, S(!1), N(null), y(!0);
5627
5664
  }, L = () => {
5628
- if (!y) return;
5629
- let e = Math.max(0, Math.ceil((E.current - performance.now()) / 1e3));
5630
- O.current = e, F(e), b(!1);
5665
+ if (!v) return;
5666
+ let e = Math.max(0, Math.ceil((C.current - performance.now()) / 1e3));
5667
+ w.current = e, P(e), y(!1);
5631
5668
  }, R = () => {
5632
- b(!1), S(!1), P(null), O.current = p, i.reset(n);
5669
+ y(!1), S(!1), N(null), w.current = f, i.reset(n);
5633
5670
  };
5634
5671
  return /* @__PURE__ */ q("div", {
5635
5672
  ...t(),
@@ -5649,7 +5686,7 @@ function Ol(e) {
5649
5686
  className: "local-timer-value",
5650
5687
  role: "timer",
5651
5688
  "aria-label": c(`${g} seconds remaining`, `剩余 ${g} 秒`),
5652
- children: k(g, c)
5689
+ children: O(g, c)
5653
5690
  })]
5654
5691
  }),
5655
5692
  /* @__PURE__ */ q("div", {
@@ -5659,14 +5696,14 @@ function Ol(e) {
5659
5696
  type: "button",
5660
5697
  className: "md-button md-button-primary",
5661
5698
  onClick: I,
5662
- disabled: y,
5699
+ disabled: v,
5663
5700
  children: c("Start", "开始")
5664
5701
  }),
5665
5702
  /* @__PURE__ */ K("button", {
5666
5703
  type: "button",
5667
5704
  className: "md-button md-button-secondary",
5668
5705
  onClick: L,
5669
- disabled: !y,
5706
+ disabled: !v,
5670
5707
  children: c("Pause", "暂停")
5671
5708
  }),
5672
5709
  /* @__PURE__ */ K("button", {
@@ -5681,21 +5718,21 @@ function Ol(e) {
5681
5718
  className: "local-timer-status",
5682
5719
  role: "status",
5683
5720
  "aria-live": "polite",
5684
- children: x ? c("Completed", "计时完成") : y ? c("Running", "计时中") : c("Paused", "已暂停")
5721
+ children: x ? c("Completed", "计时完成") : v ? c("Running", "计时中") : c("Paused", "已暂停")
5685
5722
  }),
5686
- /* @__PURE__ */ K(A, { value: k(g, c) }),
5687
- /* @__PURE__ */ K(j, { message: M })
5723
+ /* @__PURE__ */ K(T, { value: O(g, c) }),
5724
+ /* @__PURE__ */ K(j, { message: A })
5688
5725
  ]
5689
5726
  });
5690
5727
  }
5691
- function kl(e) {
5692
- let t = d(e), { content: n, t: r } = w(e), i = v(e, "label", r("Progress", "进度")), a = N(e, "max", 100), o = e.props.value;
5693
- if (!Number.isFinite(a) || a <= 0) return /* @__PURE__ */ K(D, { message: r("Progress maximum must be positive", "进度上限必须是正数") });
5694
- if (o == null) return /* @__PURE__ */ K(D, { message: r("Cannot compute", "无法计算") });
5728
+ function jl(e) {
5729
+ let t = E(e), { content: n, t: r } = m(e), i = D(e, "label", r("Progress", "进度")), a = F(e, "max", 100), o = e.props.value;
5730
+ if (!Number.isFinite(a) || a <= 0) return /* @__PURE__ */ K(k, { message: r("Progress maximum must be positive", "进度上限必须是正数") });
5731
+ if (o == null) return /* @__PURE__ */ K(k, { message: r("Cannot compute", "无法计算") });
5695
5732
  let s = typeof o == "number" ? o : typeof o == "string" && o.trim() !== "" ? Number(o) : NaN;
5696
- if (!Number.isFinite(s)) return /* @__PURE__ */ K(D, { message: r("Cannot compute", "无法计算") });
5697
- if (s < 0 || s > a) return /* @__PURE__ */ K(D, { message: r(`Progress value must be between 0 and ${a}`, `进度值需要在 0 到 ${a} 之间`) });
5698
- let c = s / a * 100, l = x(n);
5733
+ if (!Number.isFinite(s)) return /* @__PURE__ */ K(k, { message: r("Cannot compute", "无法计算") });
5734
+ if (s < 0 || s > a) return /* @__PURE__ */ K(k, { message: r(`Progress value must be between 0 and ${a}`, `进度值需要在 0 到 ${a} 之间`) });
5735
+ let c = s / a * 100, l = N(n);
5699
5736
  return /* @__PURE__ */ q("div", {
5700
5737
  className: "local-progress",
5701
5738
  "data-rmd-component": "progress",
@@ -5723,38 +5760,44 @@ function kl(e) {
5723
5760
  })]
5724
5761
  });
5725
5762
  }
5726
- function Al(e) {
5727
- let t = d(e), n = w(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, { write: c, error: l, setError: u } = h(e), f = v(e, "label", s("Multi select", "多选")), { disabled: y, invalid: b } = g(e), S = m(e), k = e.children.options(), M = T(e), F = Array.isArray(M) ? M.filter((e) => typeof e == "string") : [], I = k.filter((e) => F.includes(e.value)).map((t) => P(e, t) || t.value), L = N(e, "max-selected", k.length), R = Number.isFinite(L) ? Math.max(0, Math.floor(L)) : k.length, [z, B] = G("");
5763
+ function Ml(e) {
5764
+ let t = E(e), n = m(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, { write: c, error: l, setError: u } = v(e), d = D(e, "label", s("Multi select", "多选")), { disabled: f, invalid: x } = h(e), S = p(e), C = e.children.options(), O = M(e), P = Array.isArray(O) ? O.filter((e) => typeof e == "string") : [], I = C.filter((e) => P.includes(e.value)).map((t) => y(e, t) || t.value), L = F(e, "max-selected", C.length), R = Number.isFinite(L) ? Math.max(0, Math.floor(L)) : C.length, [z, B] = G("");
5728
5765
  if (_(e, () => {
5729
5766
  B(""), u(null);
5730
- }), k.length === 0) return /* @__PURE__ */ K(D, { message: s("Missing options", "缺少选项") });
5731
- if (a === "static") return /* @__PURE__ */ K(C, {
5767
+ }), C.length === 0) return Sl(e) ? /* @__PURE__ */ K(Cl, {
5732
5768
  authorRoot: t(),
5733
5769
  className: "local-multi-select",
5734
- label: f,
5735
- value: p(I.join(", "))
5770
+ component: "multi-select",
5771
+ label: d,
5772
+ message: s("No options", "没有选项")
5773
+ }) : /* @__PURE__ */ K(k, { message: s("Missing options", "缺少选项") });
5774
+ if (a === "static") return /* @__PURE__ */ K(b, {
5775
+ authorRoot: t(),
5776
+ className: "local-multi-select",
5777
+ label: d,
5778
+ value: g(I.join(", "))
5736
5779
  });
5737
- let V = new Set(F), H = F.length >= R, te = z.trim().toLocaleLowerCase(), U = te ? k.filter((t) => `${E(e, t.content.children)} ${t.value}`.toLocaleLowerCase().includes(te)) : k, ne = (e, t) => {
5780
+ let V = new Set(P), H = P.length >= R, te = z.trim().toLocaleLowerCase(), U = te ? C.filter((t) => `${w(e, t.content.children)} ${t.value}`.toLocaleLowerCase().includes(te)) : C, ne = (e, t) => {
5738
5781
  let n = new Set(V);
5739
5782
  if (t) {
5740
5783
  if (!n.has(e) && n.size >= R) return;
5741
5784
  n.add(e);
5742
5785
  } else n.delete(e);
5743
- c(k.filter((e) => n.has(e.value)).map((e) => e.value));
5786
+ c(C.filter((e) => n.has(e.value)).map((e) => e.value));
5744
5787
  }, W = () => {
5745
- B(""), F.length > 0 && c([]);
5788
+ B(""), P.length > 0 && c([]);
5746
5789
  };
5747
5790
  return /* @__PURE__ */ q("fieldset", {
5748
5791
  className: "local-multi-select",
5749
- ...t(O(x(i))),
5792
+ ...t(A(N(i))),
5750
5793
  "data-rmd-component": "multi-select",
5751
- disabled: y,
5794
+ disabled: f,
5752
5795
  "aria-invalid": S.invalid || void 0,
5753
5796
  "aria-describedby": S.describedBy,
5754
5797
  children: [
5755
5798
  /* @__PURE__ */ K("legend", {
5756
5799
  className: "md-label",
5757
- children: f
5800
+ children: d
5758
5801
  }),
5759
5802
  /* @__PURE__ */ q("div", {
5760
5803
  className: "local-multi-toolbar",
@@ -5764,7 +5807,7 @@ function Al(e) {
5764
5807
  className: "md-text-input local-multi-search",
5765
5808
  value: z,
5766
5809
  placeholder: s("Search options", "搜索选项"),
5767
- "aria-label": s(`Search ${f}`, `搜索${f}`),
5810
+ "aria-label": s(`Search ${d}`, `搜索${d}`),
5768
5811
  onChange: (e) => B(e.target.value)
5769
5812
  }), /* @__PURE__ */ K("button", {
5770
5813
  type: "button",
@@ -5776,7 +5819,7 @@ function Al(e) {
5776
5819
  /* @__PURE__ */ K("div", {
5777
5820
  className: "local-multi-list",
5778
5821
  role: "group",
5779
- "aria-label": f,
5822
+ "aria-label": d,
5780
5823
  children: U.length === 0 ? /* @__PURE__ */ K("span", {
5781
5824
  className: "local-multi-empty",
5782
5825
  children: s("No matching options", "没有匹配选项")
@@ -5797,22 +5840,22 @@ function Al(e) {
5797
5840
  className: "local-multi-count",
5798
5841
  role: "status",
5799
5842
  "aria-live": "polite",
5800
- children: s(`${F.length} of ${R} selected`, `已选 ${F.length}/${R}`)
5843
+ children: s(`${P.length} of ${R} selected`, `已选 ${P.length}/${R}`)
5801
5844
  }),
5802
- /* @__PURE__ */ K(A, { value: p(I.join(", ")) }),
5803
- /* @__PURE__ */ K(j, { message: b ? s("Cannot compute", "无法计算") : l })
5845
+ /* @__PURE__ */ K(T, { value: g(I.join(", ")) }),
5846
+ /* @__PURE__ */ K(j, { message: x ? s("Cannot compute", "无法计算") : l })
5804
5847
  ]
5805
5848
  });
5806
5849
  }
5807
- function jl(e) {
5808
- let t = d(e), n = w(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, c = v(e, "label", s("Quiz", "测验")), l = b(i, "type") === "number" ? "number" : "choice", u = (b(i, "answer") ?? "").trim(), f = N(e, "tolerance", 0), p = Number.isFinite(f) && f >= 0 ? f : 0, { disabled: m, invalid: h } = g(e), y = e.children.options(), x = v(e, "explanation", ""), [S, C] = G(""), [T, E] = G(null);
5850
+ function Nl(e) {
5851
+ let t = E(e), n = m(e), r = ee(), { content: i, mode: a, visible: o, t: s } = n, c = D(e, "label", s("Quiz", "测验")), l = d(i, "type") === "number" ? "number" : "choice", u = (d(i, "answer") ?? "").trim(), f = F(e, "tolerance", 0), p = Number.isFinite(f) && f >= 0 ? f : 0, { disabled: g, invalid: v } = h(e), y = e.children.options(), b = D(e, "explanation", ""), [x, S] = G(""), [C, w] = G(null);
5809
5852
  _(e, () => {
5810
- C(""), E(null);
5853
+ S(""), w(null);
5811
5854
  });
5812
5855
  let O = l === "number" ? Number(u) : NaN;
5813
- if (l === "number" && !Number.isFinite(O)) return /* @__PURE__ */ K(D, { message: s("Quiz answer must be a number", "测验答案必须是数字") });
5814
- if (l === "choice" && y.length === 0) return /* @__PURE__ */ K(D, { message: s("Missing options", "缺少选项") });
5815
- let k = y.map((e) => e.label || e.value);
5856
+ if (l === "number" && !Number.isFinite(O)) return /* @__PURE__ */ K(k, { message: s("Quiz answer must be a number", "测验答案必须是数字") });
5857
+ if (l === "choice" && y.length === 0) return /* @__PURE__ */ K(k, { message: s("Missing options", "缺少选项") });
5858
+ let A = y.map((e) => e.label || e.value);
5816
5859
  if (a === "static") return /* @__PURE__ */ q("div", {
5817
5860
  ...t(),
5818
5861
  className: "local-quiz local-static-quiz",
@@ -5834,18 +5877,18 @@ function jl(e) {
5834
5877
  });
5835
5878
  let M = () => {
5836
5879
  if (l === "choice") {
5837
- if (S === "") {
5838
- E("incomplete");
5880
+ if (x === "") {
5881
+ w("incomplete");
5839
5882
  return;
5840
5883
  }
5841
- E(S === u ? "correct" : "incorrect");
5884
+ w(x === u ? "correct" : "incorrect");
5842
5885
  return;
5843
5886
  }
5844
- let e = S.trim(), t = e === "" ? NaN : Number(e);
5845
- E(Number.isFinite(t) ? Math.abs(t - O) <= p ? "correct" : "incorrect" : "incomplete");
5846
- }, P = () => {
5847
- C(""), E(null);
5848
- }, F = T === null ? null : T === "correct" ? `${s("Correct", "回答正确")}` : T === "incorrect" ? `${s("Not quite", "回答不正确")}` : l === "number" ? s("Enter a number first", "请先输入数字") : s("Choose an answer first", "请先选择答案"), I = T === "correct" ? " is-correct" : T === "incorrect" ? " is-incorrect" : "";
5887
+ let e = x.trim(), t = e === "" ? NaN : Number(e);
5888
+ w(Number.isFinite(t) ? Math.abs(t - O) <= p ? "correct" : "incorrect" : "incomplete");
5889
+ }, N = () => {
5890
+ S(""), w(null);
5891
+ }, P = C === null ? null : C === "correct" ? `${s("Correct", "回答正确")}` : C === "incorrect" ? `${s("Not quite", "回答不正确")}` : l === "number" ? s("Enter a number first", "请先输入数字") : s("Choose an answer first", "请先选择答案"), I = C === "correct" ? " is-correct" : C === "incorrect" ? " is-incorrect" : "";
5849
5892
  return /* @__PURE__ */ q("div", {
5850
5893
  ...t(),
5851
5894
  className: "local-quiz",
@@ -5855,7 +5898,7 @@ function jl(e) {
5855
5898
  children: [
5856
5899
  l === "choice" ? /* @__PURE__ */ q("fieldset", {
5857
5900
  className: "local-quiz-options",
5858
- disabled: m,
5901
+ disabled: g,
5859
5902
  children: [/* @__PURE__ */ K("legend", {
5860
5903
  className: "md-label",
5861
5904
  children: c
@@ -5865,9 +5908,9 @@ function jl(e) {
5865
5908
  type: "radio",
5866
5909
  name: `${r}-quiz`,
5867
5910
  value: e.value,
5868
- checked: S === e.value,
5911
+ checked: x === e.value,
5869
5912
  onChange: () => {
5870
- C(e.value), E(null);
5913
+ S(e.value), w(null);
5871
5914
  }
5872
5915
  }), /* @__PURE__ */ K("span", { children: n.renderInline(e.content.children, o) })]
5873
5916
  }, e.content.id))]
@@ -5882,11 +5925,11 @@ function jl(e) {
5882
5925
  className: "md-text-input local-quiz-input",
5883
5926
  type: "text",
5884
5927
  inputMode: "decimal",
5885
- value: S,
5886
- disabled: m,
5928
+ value: x,
5929
+ disabled: g,
5887
5930
  "aria-label": c,
5888
5931
  onChange: (e) => {
5889
- C(e.target.value), E(null);
5932
+ S(e.target.value), w(null);
5890
5933
  }
5891
5934
  })]
5892
5935
  }),
@@ -5895,14 +5938,14 @@ function jl(e) {
5895
5938
  children: [/* @__PURE__ */ K("button", {
5896
5939
  type: "button",
5897
5940
  className: "md-button md-button-primary local-quiz-check",
5898
- disabled: m,
5941
+ disabled: g,
5899
5942
  onClick: M,
5900
5943
  children: s("Check answer", "检查答案")
5901
5944
  }), /* @__PURE__ */ K("button", {
5902
5945
  type: "button",
5903
5946
  className: "md-button md-button-secondary local-quiz-again",
5904
- disabled: m,
5905
- onClick: P,
5947
+ disabled: g,
5948
+ onClick: N,
5906
5949
  children: s("Try again", "再试一次")
5907
5950
  })]
5908
5951
  }),
@@ -5910,18 +5953,18 @@ function jl(e) {
5910
5953
  className: `local-quiz-feedback${I}`,
5911
5954
  role: "status",
5912
5955
  "aria-live": "polite",
5913
- children: F ? `${T === "correct" ? "✓ " : T === "incorrect" ? "✗ " : ""}${F}` : ""
5956
+ children: P ? `${C === "correct" ? "✓ " : C === "incorrect" ? "✗ " : ""}${P}` : ""
5914
5957
  }),
5915
- T !== null && x ? /* @__PURE__ */ K("div", {
5958
+ C !== null && b ? /* @__PURE__ */ K("div", {
5916
5959
  className: "local-quiz-explanation",
5917
- children: x
5960
+ children: b
5918
5961
  }) : null,
5919
- /* @__PURE__ */ K(A, {
5962
+ /* @__PURE__ */ K(T, {
5920
5963
  block: !0,
5921
- value: l === "choice" ? `${F ? `${F} · ` : ""}${k.join(" · ")}` : F || s("No answer yet", "尚未作答")
5964
+ value: l === "choice" ? `${P ? `${P} · ` : ""}${A.join(" · ")}` : P || s("No answer yet", "尚未作答")
5922
5965
  }),
5923
- /* @__PURE__ */ K(j, { message: h ? s("Cannot compute", "无法计算") : null })
5966
+ /* @__PURE__ */ K(j, { message: v ? s("Cannot compute", "无法计算") : null })
5924
5967
  ]
5925
5968
  });
5926
5969
  }
5927
- export { xl as a, hl as c, wl as d, Sl as f, gl as h, Dl as i, kl as l, Ol as m, El as n, ul as o, dl as p, Cl as r, Al as s, _l as t, jl as u };
5970
+ export { xl as a, hl as c, El as d, wl as f, gl as h, kl as i, jl as l, Al as m, Ol as n, ul as o, dl as p, Tl as r, Ml as s, _l as t, Nl as u };