@nxgt/material 3.75.0 → 3.76.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 (239) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +37 -1
  3. package/dist/{alert-dialog-BfO_ri-N.js → alert-dialog-653apk3f.js} +8 -7
  4. package/dist/{async-slice-roMAJVzG.js → async-slice-CXLbQuOc.js} +1 -1
  5. package/dist/{bubble-input-B7BVd9fX.js → bubble-input-CQwVSoU3.js} +30 -29
  6. package/dist/{button-DgenqmpS.js → button-3op3rtZh.js} +5 -4
  7. package/dist/calculator-BaSMe0SK.js +1189 -0
  8. package/dist/calculator-announce-DRd2c6Dq.js +89 -0
  9. package/dist/calculator-context-BugcKuVG.js +10 -0
  10. package/dist/calculator-field.js +172 -0
  11. package/dist/calculator-panel-announce-AZSnZUSr.js +29 -0
  12. package/dist/calculator-segment-BlJE1LaS.js +22 -0
  13. package/dist/calculator.js +2 -0
  14. package/dist/charts.js +3 -3
  15. package/dist/{chip-CiDczNxO.js → chip-MuKDwtkG.js} +2 -2
  16. package/dist/{code-editor-CohlhFsA.js → code-editor-Bp2RrdNx.js} +13 -13
  17. package/dist/code-editor.js +37 -37
  18. package/dist/{code-language-items-Cs8GLYDp.js → code-language-items-B7WR5ua_.js} +19 -24
  19. package/dist/components/base-content.css +9 -4
  20. package/dist/components/ui/collections/server-table/server-table-phone-row.css +10 -3
  21. package/dist/{components-zJdfH4im.js → components-Ci3Zo8kC.js} +15837 -17245
  22. package/dist/components.js +37 -28
  23. package/dist/conversion-variant-BDFAxqe9.js +529 -0
  24. package/dist/copy-to-clipboard-Be5Ffvs_.js +7 -0
  25. package/dist/currency-B-r3ig11.js +16 -0
  26. package/dist/currency-field-BJ9rSrif.js +285 -0
  27. package/dist/{number.utils-BG_eEt5g.js → date.utils-DUvqcjan.js} +1 -7
  28. package/dist/dialog-Bm5LvVlB.js +166 -0
  29. package/dist/dist-BZe2evxL.js +139 -0
  30. package/dist/dist-CxhKjOYm.js +28 -0
  31. package/dist/dist-DHdUUM1w.js +241 -0
  32. package/dist/{dist-C4wtXCjf.js → dist-DOK3zo5C.js} +33 -32
  33. package/dist/dist-DWZXlCZR.js +182 -0
  34. package/dist/dist-DkQbkF9T.js +33 -0
  35. package/dist/dnd.js +1 -1
  36. package/dist/{dropdown-menu-CzR6JP31.js → dropdown-menu-xlZ6NYUA.js} +160 -159
  37. package/dist/editor.js +299 -298
  38. package/dist/{empty-state-DjHGMp5F.js → empty-state-C0kviQdW.js} +2 -2
  39. package/dist/{field-blur-CdASxjL7.js → field-blur-DkiZOVNV.js} +178 -180
  40. package/dist/{field-blur-context-kZ4SD7xu.js → field-blur-context-BLGgf_3z.js} +2 -2
  41. package/dist/financial-variant-BsZEa5sF.js +459 -0
  42. package/dist/{hooks-Dqq8O3Az.js → hooks-Dg94jPRq.js} +12 -12
  43. package/dist/hooks.js +2 -2
  44. package/dist/{hover-card-BPKqte4a.js → hover-card-B1g55Hi6.js} +44 -43
  45. package/dist/i18n.js +3 -3
  46. package/dist/icon-badge-BcW66bRk.js +17 -0
  47. package/dist/{icon-button-Cr-DyDGg.js → icon-button-Cogxy1cy.js} +5 -4
  48. package/dist/{in-dialog-Vwkyp-M5.js → in-dialog-D61Yeaol.js} +2 -1
  49. package/dist/input-CC2joTjB.js +56 -0
  50. package/dist/key-layout-cR79xfGE.js +38 -0
  51. package/dist/lib/calculator/index.d.ts +16 -0
  52. package/dist/lib/calculator-field/index.d.ts +12 -0
  53. package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +2 -2
  54. package/dist/lib/components/ui/feedback/moment/moment-body.d.ts +17 -2
  55. package/dist/lib/components/ui/feedback/moment/moment-passive.d.ts +13 -0
  56. package/dist/lib/components/ui/feedback/moment/moment.d.ts +16 -2
  57. package/dist/lib/components/ui/fields/calculator-field/apply-calculated.d.ts +17 -0
  58. package/dist/lib/components/ui/fields/calculator-field/calculator-field-content.d.ts +16 -0
  59. package/dist/lib/components/ui/fields/calculator-field/calculator-field-trigger.d.ts +4 -0
  60. package/dist/lib/components/ui/fields/calculator-field/calculator-field.d.ts +12 -0
  61. package/dist/lib/components/ui/fields/calculator-field/calculator-field.types.d.ts +31 -0
  62. package/dist/lib/components/ui/fields/calculator-field/calculator-form-field.d.ts +4 -0
  63. package/dist/lib/components/ui/fields/calculator-field/index.d.ts +3 -0
  64. package/dist/lib/components/ui/fields/calculator-field/use-calculator-field.d.ts +15 -0
  65. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  66. package/dist/lib/components/ui/fields/currency-field/currency-field.d.ts +7 -1
  67. package/dist/lib/components/ui/layout/app-shell/app-sidebar-context.d.ts +4 -0
  68. package/dist/lib/components/ui/widgets/calculator/calculator-announce.d.ts +27 -0
  69. package/dist/lib/components/ui/widgets/calculator/calculator-clipboard.d.ts +19 -0
  70. package/dist/lib/components/ui/widgets/calculator/calculator-context.d.ts +49 -0
  71. package/dist/lib/components/ui/widgets/calculator/calculator-feedback.d.ts +18 -0
  72. package/dist/lib/components/ui/widgets/calculator/calculator-keyboard.d.ts +30 -0
  73. package/dist/lib/components/ui/widgets/calculator/calculator-storage.d.ts +17 -0
  74. package/dist/lib/components/ui/widgets/calculator/calculator-variant-steps.d.ts +16 -0
  75. package/dist/lib/components/ui/widgets/calculator/calculator.d.ts +11 -0
  76. package/dist/lib/components/ui/widgets/calculator/calculator.selectors.d.ts +23 -0
  77. package/dist/lib/components/ui/widgets/calculator/calculator.slice.d.ts +1881 -0
  78. package/dist/lib/components/ui/widgets/calculator/currency.d.ts +9 -0
  79. package/dist/lib/components/ui/widgets/calculator/engine.d.ts +22 -0
  80. package/dist/lib/components/ui/widgets/calculator/index.d.ts +3 -0
  81. package/dist/lib/components/ui/widgets/calculator/partials/calculator-announcer.d.ts +2 -0
  82. package/dist/lib/components/ui/widgets/calculator/partials/calculator-display.d.ts +3 -0
  83. package/dist/lib/components/ui/widgets/calculator/partials/calculator-key.d.ts +17 -0
  84. package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +8 -0
  85. package/dist/lib/components/ui/widgets/calculator/partials/calculator-loading.d.ts +6 -0
  86. package/dist/lib/components/ui/widgets/calculator/partials/calculator-memory.d.ts +2 -0
  87. package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-announce.d.ts +10 -0
  88. package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-body.d.ts +9 -0
  89. package/dist/lib/components/ui/widgets/calculator/partials/calculator-screen.d.ts +4 -0
  90. package/dist/lib/components/ui/widgets/calculator/partials/calculator-segment.d.ts +21 -0
  91. package/dist/lib/components/ui/widgets/calculator/partials/calculator-shell.d.ts +9 -0
  92. package/dist/lib/components/ui/widgets/calculator/partials/calculator-switcher.d.ts +5 -0
  93. package/dist/lib/components/ui/widgets/calculator/partials/calculator-tape.d.ts +4 -0
  94. package/dist/lib/components/ui/widgets/calculator/partials/calculator-tools.d.ts +4 -0
  95. package/dist/lib/components/ui/widgets/calculator/partials/keypad-navigation.d.ts +24 -0
  96. package/dist/lib/components/ui/widgets/calculator/types.d.ts +102 -0
  97. package/dist/lib/components/ui/widgets/calculator/use-calculator-clipboard.d.ts +19 -0
  98. package/dist/lib/components/ui/widgets/calculator/use-calculator-conversion.d.ts +4 -0
  99. package/dist/lib/components/ui/widgets/calculator/use-calculator-feedback.d.ts +3 -0
  100. package/dist/lib/components/ui/widgets/calculator/use-calculator-keyboard.d.ts +22 -0
  101. package/dist/lib/components/ui/widgets/calculator/use-calculator-persistence.d.ts +14 -0
  102. package/dist/lib/components/ui/widgets/calculator/use-calculator-pos.d.ts +25 -0
  103. package/dist/lib/components/ui/widgets/calculator/use-calculator-press.d.ts +26 -0
  104. package/dist/lib/components/ui/widgets/calculator/use-calculator-tape.d.ts +29 -0
  105. package/dist/lib/components/ui/widgets/calculator/use-calculator-value.d.ts +9 -0
  106. package/dist/lib/components/ui/widgets/calculator/use-calculator-variant.d.ts +23 -0
  107. package/dist/lib/components/ui/widgets/calculator/use-calculator.d.ts +10 -0
  108. package/dist/lib/components/ui/widgets/calculator/use-engine-settings.d.ts +10 -0
  109. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-fields.d.ts +19 -0
  110. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-labels.d.ts +17 -0
  111. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-math.d.ts +31 -0
  112. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-names.d.ts +4 -0
  113. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-panel.d.ts +7 -0
  114. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-rates.d.ts +29 -0
  115. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-result.d.ts +15 -0
  116. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-state.d.ts +36 -0
  117. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-variant.d.ts +3 -0
  118. package/dist/lib/components/ui/widgets/calculator/variants/conversion/use-conversion.d.ts +24 -0
  119. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-change.d.ts +4 -0
  120. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-figures.d.ts +43 -0
  121. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-format.d.ts +12 -0
  122. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan-math.d.ts +14 -0
  123. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan.d.ts +4 -0
  124. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-margin.d.ts +4 -0
  125. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-math.d.ts +10 -0
  126. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-panel.d.ts +7 -0
  127. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-parts.d.ts +35 -0
  128. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-table.d.ts +7 -0
  129. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-variant.d.ts +3 -0
  130. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-vat.d.ts +4 -0
  131. package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +51 -0
  132. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-announce.d.ts +16 -0
  133. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-aside.d.ts +2 -0
  134. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-display.d.ts +2 -0
  135. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-fields.d.ts +2 -0
  136. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-layout.d.ts +9 -0
  137. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-line.d.ts +6 -0
  138. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-names.d.ts +2 -0
  139. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-state.d.ts +3 -0
  140. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-tender.d.ts +2 -0
  141. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket-data.d.ts +41 -0
  142. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket.d.ts +5 -0
  143. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-totals.d.ts +2 -0
  144. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-types.d.ts +76 -0
  145. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-variant.d.ts +3 -0
  146. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-vat.d.ts +2 -0
  147. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-view.d.ts +28 -0
  148. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.d.ts +19 -0
  149. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-base.d.ts +11 -0
  150. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-bitpad.d.ts +14 -0
  151. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-display.d.ts +9 -0
  152. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-layout.d.ts +6 -0
  153. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-names.d.ts +2 -0
  154. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.d.ts +14 -0
  155. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-reduce.d.ts +29 -0
  156. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-state.d.ts +22 -0
  157. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-toolbar.d.ts +5 -0
  158. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-variant.d.ts +3 -0
  159. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-word.d.ts +15 -0
  160. package/dist/lib/components/ui/widgets/calculator/variants/registry.d.ts +21 -0
  161. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-layout.d.ts +3 -0
  162. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-names.d.ts +2 -0
  163. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-toolbar.d.ts +2 -0
  164. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-variant.d.ts +3 -0
  165. package/dist/lib/components/ui/widgets/calculator/variants/standard/standard-layout.d.ts +3 -0
  166. package/dist/lib/components/ui/widgets/calculator/variants/variant-loader.d.ts +34 -0
  167. package/dist/lib/components/ui/widgets/calculator/variants/variant-logic.d.ts +40 -0
  168. package/dist/lib/components/ui/widgets/calculator/variants/variant-types.d.ts +62 -0
  169. package/dist/lib/i18n/resources/en/en.d.ts +412 -0
  170. package/dist/lib/i18n/resources/en/material.json.d.ts +412 -0
  171. package/dist/lib/i18n/resources/fr/fr.d.ts +412 -0
  172. package/dist/lib/i18n/resources/fr/material.json.d.ts +412 -0
  173. package/dist/lib/i18n/resources/resources.d.ts +824 -0
  174. package/dist/lib/i18n/translator.d.ts +1 -1
  175. package/dist/lib.js +4 -3
  176. package/dist/main.js +50 -40
  177. package/dist/map.js +66 -65
  178. package/dist/material.css +1 -1
  179. package/dist/native-select-w_FlBLHV.js +40 -0
  180. package/dist/number.utils-CSueQZcv.js +7 -0
  181. package/dist/pdf-reader.js +1 -1
  182. package/dist/percent-field-lahyDJDG.js +14 -0
  183. package/dist/picker-surface-CV09H7Nb.js +1220 -0
  184. package/dist/popover-Cd7DkND4.js +233 -0
  185. package/dist/pos-types-DKCkOTYy.js +49 -0
  186. package/dist/pos-variant-GrUfbTTP.js +603 -0
  187. package/dist/print.js +1 -1
  188. package/dist/programmer-variant-eKJNKENL.js +501 -0
  189. package/dist/programmer-word-CNCF7DJF.js +15 -0
  190. package/dist/{public-DC9VQw4Z.js → public-y6g4ddxd.js} +895 -892
  191. package/dist/{rich-code-block-DBSL9zEN.js → rich-code-block-CRQ0iyLb.js} +5 -5
  192. package/dist/scientific-variant-2y3UxAAU.js +149 -0
  193. package/dist/{sortable-provider-C4tk5esY.js → sortable-provider-DdiI3Fwk.js} +2 -2
  194. package/dist/{spinner-B2MubVWb.js → spinner-C1QIewWv.js} +133 -159
  195. package/dist/standard-layout-BuSRr3TY.js +40 -0
  196. package/dist/tabs-DzEqMb1W.js +383 -0
  197. package/dist/{icon-badge-B9uvDoyY.js → text-field-BAdY-kpO.js} +20 -34
  198. package/dist/theme-picker.js +3 -3
  199. package/dist/{theme-toggle-BInlu21G.js → theme-toggle-C_VeiiCm.js} +2 -2
  200. package/dist/toggle-FeCCJqbg.js +40 -0
  201. package/dist/{toggle-group-DXXlqid2.js → toggle-group-CVMxEpWi.js} +1 -1
  202. package/dist/{toolbar-items-CRJSx1MU.js → toolbar-items-D310xDuM.js} +333 -554
  203. package/dist/{translate-material-pVlPJ1v4.js → translate-material-BypJJ1l5.js} +1 -1
  204. package/dist/{translator-BoYCward.js → translator-DJkf4J7t.js} +824 -0
  205. package/dist/{typography-B6YMbCge.js → typography-CYEquVeb.js} +1 -1
  206. package/dist/{use-chat-composer-BvWQogJe.js → use-chat-composer-DMXu9E1O.js} +4198 -4600
  207. package/dist/{use-heading-spy-B_Z4ArDh.js → use-heading-spy-DJR8YYm6.js} +19 -19
  208. package/dist/{use-material-translation-CIS2n3RB.js → use-material-translation-CD6QoVal.js} +1 -1
  209. package/dist/{use-return-focus-DNQtADAR.js → use-return-focus-Cevw_6yq.js} +106 -105
  210. package/dist/useLatest-C2PnQEeD.js +8 -0
  211. package/docs/README.md +1 -0
  212. package/docs/components/feedback-and-status.md +10 -1
  213. package/docs/components/form-fields.md +1 -0
  214. package/docs/components/rich-widgets.md +108 -0
  215. package/docs/getting-started.md +1 -0
  216. package/docs/guides/calculator.md +468 -0
  217. package/docs/guides/forms.md +4 -2
  218. package/docs/guides/i18n.md +5 -0
  219. package/docs/previews/rich-widgets-calculator-conversion.webp +0 -0
  220. package/docs/previews/rich-widgets-calculator-point-of-sale.webp +0 -0
  221. package/docs/previews/rich-widgets-calculator.webp +0 -0
  222. package/docs/roadmap.md +9 -3
  223. package/docs/troubleshooting.md +134 -0
  224. package/lib/components/base-content.css +9 -4
  225. package/lib/components/ui/collections/server-table/server-table-phone-row.css +10 -3
  226. package/lib/components/ui/widgets/calculator/calculator-bands.css +146 -0
  227. package/lib/components/ui/widgets/calculator/calculator-display.css +83 -0
  228. package/lib/components/ui/widgets/calculator/calculator-keys.css +118 -0
  229. package/lib/components/ui/widgets/calculator/calculator-pos-ticket.css +185 -0
  230. package/lib/components/ui/widgets/calculator/calculator-pos.css +38 -0
  231. package/lib/components/ui/widgets/calculator/calculator-tape.css +71 -0
  232. package/lib/components/ui/widgets/calculator/calculator.css +97 -0
  233. package/lib/components/ui/widgets/calculator/variants/conversion/conversion.css +98 -0
  234. package/lib/components/ui/widgets/calculator/variants/financial/financial.css +162 -0
  235. package/lib/components/ui/widgets/calculator/variants/programmer/programmer.css +162 -0
  236. package/package.json +17 -3
  237. package/dist/dialog-AGsB3bv4.js +0 -219
  238. package/dist/dist-B7RjY7SL.js +0 -158
  239. package/dist/dist-lmHmz_bu.js +0 -419
@@ -0,0 +1,501 @@
1
+ import { t as e } from "./use-material-translation-CD6QoVal.js";
2
+ import { t } from "./toggle-FeCCJqbg.js";
3
+ import { n } from "./calculator-context-BugcKuVG.js";
4
+ import { i as r, n as i, s as a } from "./key-layout-cR79xfGE.js";
5
+ import { t as o } from "./programmer-word-CNCF7DJF.js";
6
+ import { t as s } from "./calculator-segment-BlJE1LaS.js";
7
+ import { useId as c, useState as l } from "react";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ import { calculate as f, formatExpression as p, sessionOptions as m, toCanonical as h, tokenize as g } from "@nxgt/material-core/calculator";
10
+ import { BASES as _, WORD_SIZES as v, bits as y, changeWord as b, parseBase as ee, programmerOptions as x, toBase as S, toggleBit as C, wrap as w } from "@nxgt/material-core/calculator/programmer";
11
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-state.ts
12
+ var T = (e) => ({
13
+ size: e.size,
14
+ signed: e.signed
15
+ }), E = (e) => x(e), D = /(?:\s*(?:mod|and|or|xor|nand|nor|shl|shr|rol|ror|[-+*/^&|])\s*)+$/, O = (e) => e.replace(D, "").trim(), k = (e) => {
16
+ try {
17
+ return BigInt(e);
18
+ } catch {
19
+ return;
20
+ }
21
+ };
22
+ function A(e, t) {
23
+ if (e.justEvaluated && e.result) return k(e.result);
24
+ let n = O(e.expression);
25
+ if (n === "") return;
26
+ let r = f(n, m(e, E(t)));
27
+ return r.ok ? k(h(r.value)) : void 0;
28
+ }
29
+ var j = (e, t, n) => S(e, t, n), M = (e, t, n) => S(e, t, n, {
30
+ group: !0,
31
+ upper: !0
32
+ });
33
+ function N(e, t, n) {
34
+ let r = T(n);
35
+ return {
36
+ ...e,
37
+ expression: j(w(t, r), n.base, r),
38
+ result: "",
39
+ error: "",
40
+ justEvaluated: !1
41
+ };
42
+ }
43
+ //#endregion
44
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.ts
45
+ function te(e, t, n) {
46
+ if (!e || !n || t.error || !t.justEvaluated || !t.result) return e;
47
+ let r = k(t.result);
48
+ if (r === void 0) return e;
49
+ let i = M(r, n.base, T(n));
50
+ return {
51
+ ...e,
52
+ values: {
53
+ ...e.values,
54
+ value: i
55
+ }
56
+ };
57
+ }
58
+ var P = {
59
+ 16: ["material.calculator.programmer.hex", "Hexadecimal"],
60
+ 10: ["material.calculator.programmer.dec", "Decimal"],
61
+ 8: ["material.calculator.programmer.oct", "Octal"],
62
+ 2: ["material.calculator.programmer.bin", "Binary"]
63
+ };
64
+ function F(e, t) {
65
+ let [n, r] = P[e];
66
+ return {
67
+ key: "material.calculator.programmer.unavailable",
68
+ fallback: "Not available in {base}",
69
+ values: { base: t(n, r) }
70
+ };
71
+ }
72
+ //#endregion
73
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-display.ts
74
+ var I = /[0-9a-f]+$/i;
75
+ function L(e, t) {
76
+ let { session: n } = e, r = t.programmer ?? o, i = T(r), a = p(n.expression, { locale: t.locale });
77
+ if (n.error) return {
78
+ expression: a,
79
+ result: "",
80
+ kind: "error",
81
+ value: "",
82
+ error: n.error
83
+ };
84
+ let s = A(n, r);
85
+ if (s !== void 0) return {
86
+ expression: a,
87
+ result: M(s, r.base, i),
88
+ kind: n.justEvaluated ? "result" : "preview",
89
+ value: String(s),
90
+ error: ""
91
+ };
92
+ let c = O(n.expression);
93
+ if (c === "") return {
94
+ expression: a,
95
+ result: "0",
96
+ kind: "empty",
97
+ value: "",
98
+ error: ""
99
+ };
100
+ let l = I.exec(c)?.[0] ?? "", u = l ? ee(l, r.base, i) : void 0;
101
+ return {
102
+ expression: a,
103
+ result: u?.ok ? M(u.value, r.base, i) : "0",
104
+ kind: "preview",
105
+ value: "",
106
+ error: ""
107
+ };
108
+ }
109
+ //#endregion
110
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-layout.ts
111
+ var R = (e, t, n, i, a) => r(e, t, n, "function", i, a, 2), z = (e) => ({ ...r(`h${e}`, e, e.toUpperCase(), "digit", `hex-${e}`, `Digit ${e.toUpperCase()}`, 2) }), B = [
112
+ [
113
+ z("a"),
114
+ z("b"),
115
+ z("c"),
116
+ z("d"),
117
+ z("e"),
118
+ z("f")
119
+ ],
120
+ [
121
+ R("and", "and", "AND", "and", "And"),
122
+ R("or", "or", "OR", "or", "Or"),
123
+ R("xor", "xor", "XOR", "xor", "Exclusive or"),
124
+ R("not", "not", "NOT", "not", "Not"),
125
+ R("nand", "nand", "NAND", "nand", "Not and"),
126
+ R("nor", "nor", "NOR", "nor", "Not or")
127
+ ],
128
+ [
129
+ R("shl", "shl", "<<", "shift-left", "Shift left"),
130
+ R("shr", "shr", ">>", "shift-right", "Shift right (arithmetic)"),
131
+ R("rol", "rol", "ROL", "rotate-left", "Rotate left"),
132
+ R("ror", "ror", "ROR", "rotate-right", "Rotate right"),
133
+ r("open", "(", "(", "bracket", "open-paren", "Open parenthesis", 2),
134
+ r("close", ")", ")", "bracket", "close-paren", "Close parenthesis", 2)
135
+ ]
136
+ ], V = {
137
+ columns: 12,
138
+ split: B.length,
139
+ rows: [
140
+ ...B,
141
+ a([
142
+ r("clear", "C", "C", "utility", "clear", "Clear all"),
143
+ r("sign", "±", "±", "utility", "sign", "Change sign"),
144
+ r("mod", "mod", "mod", "operator", "modulo", "Modulo"),
145
+ r("divide", "/", "÷", "operator", "divide", "Divided by")
146
+ ]),
147
+ a([
148
+ i(7),
149
+ i(8),
150
+ i(9),
151
+ r("multiply", "*", "×", "operator", "multiply", "Times")
152
+ ]),
153
+ a([
154
+ i(4),
155
+ i(5),
156
+ i(6),
157
+ r("subtract", "-", "−", "operator", "subtract", "Minus")
158
+ ]),
159
+ a([
160
+ i(1),
161
+ i(2),
162
+ i(3),
163
+ r("add", "+", "+", "operator", "add", "Plus")
164
+ ]),
165
+ a([
166
+ i(0, 2),
167
+ r("backspace", "backspace", "⌫", "utility", "backspace", "Delete last character"),
168
+ r("equals", "=", "=", "equals", "equals", "Equals")
169
+ ])
170
+ ]
171
+ }, H = [
172
+ "CE",
173
+ "ans",
174
+ "^"
175
+ ], U = {
176
+ 16: {
177
+ key: "material.calculator.programmer.set-hex",
178
+ fallback: "Hexadecimal digits"
179
+ },
180
+ 10: {
181
+ key: "material.calculator.programmer.set-dec",
182
+ fallback: "Decimal digits"
183
+ },
184
+ 8: {
185
+ key: "material.calculator.programmer.set-oct",
186
+ fallback: "Octal digits"
187
+ },
188
+ 2: {
189
+ key: "material.calculator.programmer.set-bin",
190
+ fallback: "Binary digits"
191
+ }
192
+ };
193
+ function W(e, t) {
194
+ try {
195
+ return g(e, E(t).dialect, {
196
+ wordSize: t.size,
197
+ signed: t.signed
198
+ }).filter((e) => e.k !== "end");
199
+ } catch {
200
+ return;
201
+ }
202
+ }
203
+ function G(e, t, n) {
204
+ let r = W(e, t);
205
+ if (!r) return;
206
+ let i = e;
207
+ for (let e of [...r].reverse()) {
208
+ if (e.k !== "num" || !e.v) continue;
209
+ let t = k(h(e.v));
210
+ if (t === void 0) return;
211
+ i = i.slice(0, e.s.start) + j(t, n.base, T(n)) + i.slice(e.s.end);
212
+ }
213
+ return i;
214
+ }
215
+ function K(e, t, n, r) {
216
+ let i = {
217
+ ...t,
218
+ base: n
219
+ }, a = O(e.expression) !== e.expression.trim();
220
+ if (r !== void 0 && !a) {
221
+ let a = e.justEvaluated ? [] : W(e.expression, t), o = ((a?.[0]?.text === "-" ? a.slice(1) : a)?.length ?? 0) > 1;
222
+ return {
223
+ programmer: i,
224
+ session: N(e, r, i),
225
+ announcement: o ? {
226
+ key: "material.calculator.programmer.converted",
227
+ fallback: "Converted to {value}",
228
+ values: { value: M(r, n, T(i)) }
229
+ } : U[n]
230
+ };
231
+ }
232
+ if (e.expression.trim() === "") return {
233
+ programmer: i,
234
+ session: e,
235
+ announcement: U[n]
236
+ };
237
+ let o = G(e.expression, t, i);
238
+ return o === void 0 ? {
239
+ programmer: t,
240
+ session: e,
241
+ announcement: {
242
+ key: "material.calculator.programmer.base-kept",
243
+ fallback: "Base not changed: the expression is not valid"
244
+ }
245
+ } : {
246
+ programmer: i,
247
+ session: {
248
+ ...e,
249
+ expression: o
250
+ },
251
+ announcement: U[n]
252
+ };
253
+ }
254
+ //#endregion
255
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-reduce.ts
256
+ var q = (e, t) => e ? {
257
+ key: "material.calculator.programmer.bit-on",
258
+ fallback: "Bit {bit} is 1",
259
+ values: { bit: t }
260
+ } : {
261
+ key: "material.calculator.programmer.bit-off",
262
+ fallback: "Bit {bit} is 0",
263
+ values: { bit: t }
264
+ };
265
+ function J(e, t, n) {
266
+ let r = A(e, t);
267
+ if (n.type === "base") return K(e, t, n.base, r);
268
+ if (n.type === "bit") {
269
+ let i = r ?? (O(e.expression) === "" ? 0n : void 0);
270
+ if (i === void 0) return {
271
+ programmer: t,
272
+ session: e,
273
+ announcement: null
274
+ };
275
+ let a = T(t), o = BigInt(n.index), s = C(i, o, a), c = (y(s, a) >> o & 1n) == 1n;
276
+ return {
277
+ programmer: t,
278
+ session: N(e, s, t),
279
+ announcement: q(c, n.index)
280
+ };
281
+ }
282
+ let i = n.type === "size" ? {
283
+ ...t,
284
+ size: n.size
285
+ } : {
286
+ ...t,
287
+ signed: n.signed
288
+ }, a = b(r ?? 0n, T(i)), o = Y(e.ans, i);
289
+ return {
290
+ programmer: i,
291
+ session: r === void 0 ? {
292
+ ...e,
293
+ ans: o
294
+ } : {
295
+ ...N(e, a.value, i),
296
+ ans: o
297
+ },
298
+ announcement: a.announce
299
+ };
300
+ }
301
+ function Y(e, t) {
302
+ let n = k(e);
303
+ return n === void 0 ? e : String(w(n, T(t)));
304
+ }
305
+ //#endregion
306
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-bitpad.tsx
307
+ function X({ value: t, programmer: n, onToggle: r }) {
308
+ let { t: i } = e(), [a, o] = l(!1), s = c(), f = t === void 0, p = y(t ?? 0n, T(n)), m = Array.from({ length: n.size / 4 }, (e, t) => t).reverse().map((e) => [
309
+ 3,
310
+ 2,
311
+ 1,
312
+ 0
313
+ ].map((t) => e * 4 + t));
314
+ return /* @__PURE__ */ d("div", {
315
+ "data-slot": "calculator-bitpad",
316
+ className: "nxgt-prog-bitpad",
317
+ children: [/* @__PURE__ */ u("button", {
318
+ type: "button",
319
+ className: "nxgt-prog-bits-toggle",
320
+ "aria-expanded": a,
321
+ "aria-controls": s,
322
+ onClick: () => o(!a),
323
+ children: i("material.calculator.programmer.bits", "Bit pad")
324
+ }), /* @__PURE__ */ u("div", {
325
+ id: s,
326
+ role: "group",
327
+ "aria-label": i("material.calculator.programmer.bits", "Bit pad"),
328
+ dir: "ltr",
329
+ hidden: !a,
330
+ "data-size": n.size,
331
+ className: "nxgt-prog-bits",
332
+ children: m.map((e) => /* @__PURE__ */ u("div", {
333
+ className: "nxgt-prog-nibble",
334
+ children: e.map((e) => {
335
+ let t = (p >> BigInt(e) & 1n) == 1n;
336
+ return /* @__PURE__ */ d("button", {
337
+ type: "button",
338
+ "aria-pressed": t,
339
+ "aria-disabled": f || void 0,
340
+ "aria-label": i("material.calculator.programmer.bit", "Bit {n}", { n: e }),
341
+ "data-pw": `calculator-bit-${e}`,
342
+ className: "nxgt-prog-bit",
343
+ onClick: () => {
344
+ f || r(e);
345
+ },
346
+ children: [/* @__PURE__ */ u("span", {
347
+ "aria-hidden": "true",
348
+ children: +!!t
349
+ }), /* @__PURE__ */ u("small", {
350
+ "aria-hidden": "true",
351
+ children: e
352
+ })]
353
+ }, e);
354
+ })
355
+ }, e[0]))
356
+ })]
357
+ });
358
+ }
359
+ //#endregion
360
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.tsx
361
+ var Z = {
362
+ 16: "HEX",
363
+ 10: "DEC",
364
+ 8: "OCT",
365
+ 2: "BIN"
366
+ }, Q = {
367
+ 16: ["material.calculator.programmer.hex", "Hexadecimal"],
368
+ 10: ["material.calculator.programmer.dec", "Decimal"],
369
+ 8: ["material.calculator.programmer.oct", "Octal"],
370
+ 2: ["material.calculator.programmer.bin", "Binary"]
371
+ };
372
+ function ne({ value: t, programmer: n, onBase: r }) {
373
+ let { t: i } = e(), a = c(), o = T(n);
374
+ return /* @__PURE__ */ d("fieldset", {
375
+ dir: "ltr",
376
+ "data-slot": "calculator-bases",
377
+ className: "nxgt-prog-bases",
378
+ children: [/* @__PURE__ */ u("legend", {
379
+ className: "sr-only",
380
+ children: i("material.calculator.programmer.base", "Number base")
381
+ }), [..._].reverse().map((e) => {
382
+ let s = `${a}-${e}`;
383
+ return /* @__PURE__ */ d("label", {
384
+ className: "nxgt-prog-base",
385
+ "data-pw": `calculator-base-${e}`,
386
+ children: [
387
+ /* @__PURE__ */ u("input", {
388
+ type: "radio",
389
+ name: a,
390
+ className: "sr-only",
391
+ checked: n.base === e,
392
+ "aria-label": i(Q[e][0], Q[e][1]),
393
+ "aria-describedby": s,
394
+ onChange: () => r(e)
395
+ }),
396
+ /* @__PURE__ */ u("span", {
397
+ "aria-hidden": "true",
398
+ className: "nxgt-prog-base-name",
399
+ children: Z[e]
400
+ }),
401
+ /* @__PURE__ */ u("output", {
402
+ id: s,
403
+ className: "nxgt-prog-base-value",
404
+ children: M(t, e, o)
405
+ })
406
+ ]
407
+ }, e);
408
+ })]
409
+ });
410
+ }
411
+ //#endregion
412
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-toolbar.tsx
413
+ var re = v.map((e) => ({
414
+ id: `${e}`,
415
+ glyph: `${e}`,
416
+ name: `${e} bits`
417
+ })), $ = (e) => {
418
+ try {
419
+ return e === "" ? 0n : BigInt(e);
420
+ } catch {
421
+ return 0n;
422
+ }
423
+ }, ie = (e) => e.value === "" ? e.kind === "empty" ? 0n : void 0 : $(e.value);
424
+ function ae() {
425
+ let { t: r } = e(), { state: i, display: a, setProgrammer: o } = n(), c = i.programmer;
426
+ return /* @__PURE__ */ d("div", {
427
+ "data-slot": "calculator-toolbar",
428
+ className: "nxgt-prog-toolbar",
429
+ children: [
430
+ /* @__PURE__ */ u(ne, {
431
+ value: $(a.value),
432
+ programmer: c,
433
+ onBase: (e) => o({
434
+ type: "base",
435
+ base: e
436
+ })
437
+ }),
438
+ /* @__PURE__ */ d("div", {
439
+ className: "nxgt-calc-toolbar",
440
+ children: [/* @__PURE__ */ u(s, {
441
+ label: r("material.calculator.programmer.size", "Word size"),
442
+ choices: re,
443
+ value: `${c.size}`,
444
+ nameKey: (e) => `material.calculator.programmer.size-${e}`,
445
+ onChange: (e) => {
446
+ let t = v.find((t) => `${t}` === e);
447
+ t && o({
448
+ type: "size",
449
+ size: t
450
+ });
451
+ }
452
+ }), /* @__PURE__ */ u(t, {
453
+ size: "sm",
454
+ pressed: c.signed,
455
+ onPressedChange: (e) => o({
456
+ type: "signed",
457
+ signed: e
458
+ }),
459
+ "aria-label": r("material.calculator.programmer.signed", "Signed"),
460
+ className: "nxgt-calc-second",
461
+ "data-pw": "calculator-signed",
462
+ children: r("material.calculator.programmer.signed", "Signed")
463
+ })]
464
+ }),
465
+ /* @__PURE__ */ u(X, {
466
+ value: ie(a),
467
+ programmer: c,
468
+ onToggle: (e) => o({
469
+ type: "bit",
470
+ index: e
471
+ })
472
+ })
473
+ ]
474
+ });
475
+ }
476
+ //#endregion
477
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-variant.ts
478
+ var oe = {
479
+ part: {
480
+ layout: V,
481
+ extraKeys: H,
482
+ programmer: !0,
483
+ toolbar: ae
484
+ },
485
+ logic: {
486
+ options: (e, t) => t.programmer ? {
487
+ ...e,
488
+ ...E(t.programmer)
489
+ } : e,
490
+ display: L,
491
+ said: te,
492
+ refused: F,
493
+ reduce: J,
494
+ copy: (e, t) => {
495
+ let n = k(e);
496
+ return n === void 0 ? void 0 : S(n, t.base, T(t), { upper: !0 });
497
+ }
498
+ }
499
+ };
500
+ //#endregion
501
+ export { oe as variant };
@@ -0,0 +1,15 @@
1
+ //#region lib/components/ui/widgets/calculator/variants/programmer/programmer-word.ts
2
+ var e = {
3
+ base: 10,
4
+ size: 64,
5
+ signed: !0
6
+ }, t = (t) => ({
7
+ ...e,
8
+ size: t.defaultWordSize ?? e.size,
9
+ signed: t.defaultSigned ?? e.signed
10
+ });
11
+ function n(e, t) {
12
+ return /^[0-9a-f]$/.test(e) && Number.parseInt(e, 16) >= t;
13
+ }
14
+ //#endregion
15
+ export { n, t as r, e as t };