solve-engine 2.25.0 → 2.27.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 (240) hide show
  1. package/dist/CalendarBackend-MdS3Bb4P.d.cts +181 -0
  2. package/dist/CalendarBackend-MdS3Bb4P.d.ts +181 -0
  3. package/dist/{Configuration-DnzYPmoK.d.cts → Configuration-BxriK9Kw.d.cts} +63 -4
  4. package/dist/{Configuration-DnzYPmoK.d.ts → Configuration-BxriK9Kw.d.ts} +63 -4
  5. package/dist/DateCalendar-B85t6Vk6.d.ts +90 -0
  6. package/dist/DateCalendar-CUGI1fT4.d.cts +90 -0
  7. package/dist/{EngineError-fR1K1rvx.d.cts → EngineError-C-kBwYlN.d.cts} +31 -4
  8. package/dist/{EngineError-fR1K1rvx.d.ts → EngineError-C-kBwYlN.d.ts} +31 -4
  9. package/dist/{FormattingSettings-bRKjU7wI.d.ts → FormattingSettings-ByO-4wiM.d.cts} +14 -0
  10. package/dist/{FormattingSettings-bRKjU7wI.d.cts → FormattingSettings-CvCzAfsz.d.ts} +14 -0
  11. package/dist/{Lexer-aB95pjoX.d.cts → Lexer-DhGhoAa2.d.cts} +13 -3
  12. package/dist/{Lexer-Bmctxl0n.d.ts → Lexer-DqtnZMC5.d.ts} +13 -3
  13. package/dist/{PackageCompatibility-CUVg8tmt.d.cts → PackageCompatibility-CNiTtC6S.d.cts} +1 -1
  14. package/dist/{PackageCompatibility-BludTs7v.d.ts → PackageCompatibility-fj_f7uqC.d.ts} +1 -1
  15. package/dist/{PackageRegistry-Dvn4i2QK.d.cts → PackageRegistry-BHBCFswo.d.cts} +328 -14
  16. package/dist/{PackageRegistry-DT-x32OM.d.ts → PackageRegistry-CNZUwWHJ.d.ts} +328 -14
  17. package/dist/{Parselet-BawfGuTF.d.cts → Parselet-DF3864la.d.cts} +19 -3
  18. package/dist/{Parselet-DqTbbtWA.d.ts → Parselet-Dgymjxzd.d.ts} +19 -3
  19. package/dist/{Token-CbP_OutD.d.cts → Token-D8f7yaz1.d.cts} +17 -0
  20. package/dist/{Token-CbP_OutD.d.ts → Token-D8f7yaz1.d.ts} +17 -0
  21. package/dist/{TokenNormalizer-CLBtiE8M.d.ts → TokenNormalizer-IF7nPRMp.d.ts} +1 -1
  22. package/dist/{TokenNormalizer-CjTDmHgB.d.cts → TokenNormalizer-Pe3_390t.d.cts} +1 -1
  23. package/dist/{ScopeManager-B636am7Y.d.ts → VMBuiltins-CZiZRKn-.d.ts} +91 -9
  24. package/dist/{ScopeManager-CdwX0VTw.d.cts → VMBuiltins-kv4rr0y5.d.cts} +91 -9
  25. package/dist/{VMCheckpoints-DDlxNssY.d.ts → VMCheckpoints-DXze6ypg.d.ts} +2 -2
  26. package/dist/{VMCheckpoints-CYqeq8IV.d.cts → VMCheckpoints-yun4ocSv.d.cts} +2 -2
  27. package/dist/{Value-Ds3Gy07C.d.cts → Value-BYHw-x7q.d.cts} +57 -1
  28. package/dist/{Value-Ds3Gy07C.d.ts → Value-BYHw-x7q.d.ts} +57 -1
  29. package/dist/{WorkerError-B1dF3VYT.d.cts → WorkerError-BLZyNq6M.d.cts} +1 -1
  30. package/dist/{WorkerError-dneODN-u.d.ts → WorkerError-CfBJYueR.d.ts} +1 -1
  31. package/dist/chunk-2SYYKQ4Q.cjs +2 -0
  32. package/dist/chunk-2SYYKQ4Q.cjs.map +1 -0
  33. package/dist/chunk-6EYKVQT3.cjs +2 -0
  34. package/dist/chunk-6EYKVQT3.cjs.map +1 -0
  35. package/dist/chunk-7RC6RBS6.cjs +2 -0
  36. package/dist/chunk-7RC6RBS6.cjs.map +1 -0
  37. package/dist/chunk-AZX4NTYN.cjs +3 -0
  38. package/dist/chunk-AZX4NTYN.cjs.map +1 -0
  39. package/dist/{chunk-JFZ5SLF7.js → chunk-BCR53EIL.js} +2 -2
  40. package/dist/{chunk-JFZ5SLF7.js.map → chunk-BCR53EIL.js.map} +1 -1
  41. package/dist/chunk-BCY2WY5P.js +5 -0
  42. package/dist/chunk-BCY2WY5P.js.map +1 -0
  43. package/dist/chunk-BLJ6E577.js +2 -0
  44. package/dist/chunk-BLJ6E577.js.map +1 -0
  45. package/dist/chunk-CL7DM2FX.js +2 -0
  46. package/dist/chunk-CL7DM2FX.js.map +1 -0
  47. package/dist/{chunk-BMXYR5LI.cjs → chunk-CQLCTKMX.cjs} +2 -2
  48. package/dist/{chunk-BMXYR5LI.cjs.map → chunk-CQLCTKMX.cjs.map} +1 -1
  49. package/dist/chunk-D4VBWPWN.js +2 -0
  50. package/dist/chunk-D4VBWPWN.js.map +1 -0
  51. package/dist/chunk-DFMAZ6XM.cjs +3 -0
  52. package/dist/chunk-DFMAZ6XM.cjs.map +1 -0
  53. package/dist/chunk-E4HAKNBQ.cjs +2 -0
  54. package/dist/chunk-E4HAKNBQ.cjs.map +1 -0
  55. package/dist/{chunk-XHQYHXRE.js → chunk-ESZNJQ2C.js} +3 -3
  56. package/dist/{chunk-XHQYHXRE.js.map → chunk-ESZNJQ2C.js.map} +1 -1
  57. package/dist/{chunk-IJMNVBIS.js → chunk-FAO6DQ74.js} +2 -2
  58. package/dist/chunk-FAO6DQ74.js.map +1 -0
  59. package/dist/{chunk-WGP4UUO5.cjs → chunk-FDKTESBC.cjs} +2 -2
  60. package/dist/{chunk-WGP4UUO5.cjs.map → chunk-FDKTESBC.cjs.map} +1 -1
  61. package/dist/{chunk-NEGZZB7F.cjs → chunk-G2V33LFM.cjs} +2 -2
  62. package/dist/{chunk-NEGZZB7F.cjs.map → chunk-G2V33LFM.cjs.map} +1 -1
  63. package/dist/chunk-GJZIJK2Q.cjs +2 -0
  64. package/dist/chunk-GJZIJK2Q.cjs.map +1 -0
  65. package/dist/chunk-GVL3ZMS7.cjs +2 -0
  66. package/dist/chunk-GVL3ZMS7.cjs.map +1 -0
  67. package/dist/{chunk-YBQPEWT7.cjs → chunk-GXO7TSXQ.cjs} +3 -3
  68. package/dist/chunk-GXO7TSXQ.cjs.map +1 -0
  69. package/dist/{chunk-OONQ3V3I.js → chunk-HANGBVEE.js} +2 -2
  70. package/dist/{chunk-OONQ3V3I.js.map → chunk-HANGBVEE.js.map} +1 -1
  71. package/dist/chunk-J4K72CQN.js +2 -0
  72. package/dist/chunk-J4K72CQN.js.map +1 -0
  73. package/dist/{chunk-72PYPENZ.js → chunk-LE6WZLJ4.js} +2 -2
  74. package/dist/{chunk-72PYPENZ.js.map → chunk-LE6WZLJ4.js.map} +1 -1
  75. package/dist/chunk-LQIRBP4Q.js +2 -0
  76. package/dist/chunk-LQIRBP4Q.js.map +1 -0
  77. package/dist/{chunk-RDYXH7ML.js → chunk-LTUYWJGO.js} +2 -2
  78. package/dist/{chunk-RDYXH7ML.js.map → chunk-LTUYWJGO.js.map} +1 -1
  79. package/dist/chunk-O5PO4D2A.cjs +2 -0
  80. package/dist/chunk-O5PO4D2A.cjs.map +1 -0
  81. package/dist/chunk-PQFI55AC.js +3 -0
  82. package/dist/chunk-PQFI55AC.js.map +1 -0
  83. package/dist/chunk-QQHHZPEW.cjs +2 -0
  84. package/dist/chunk-QQHHZPEW.cjs.map +1 -0
  85. package/dist/chunk-REZQFPVX.js +2 -0
  86. package/dist/chunk-REZQFPVX.js.map +1 -0
  87. package/dist/chunk-RRUGQ6DM.js +2 -0
  88. package/dist/chunk-RRUGQ6DM.js.map +1 -0
  89. package/dist/chunk-S3ODNMJS.js +2 -0
  90. package/dist/chunk-S3ODNMJS.js.map +1 -0
  91. package/dist/{chunk-SAF3B3AX.cjs → chunk-SE6ZCGZ5.cjs} +2 -2
  92. package/dist/{chunk-SAF3B3AX.cjs.map → chunk-SE6ZCGZ5.cjs.map} +1 -1
  93. package/dist/chunk-TC23XEAV.js +2 -0
  94. package/dist/chunk-TC23XEAV.js.map +1 -0
  95. package/dist/{chunk-FYAMQFZZ.cjs → chunk-TMQ37JQY.cjs} +3 -3
  96. package/dist/{chunk-FYAMQFZZ.cjs.map → chunk-TMQ37JQY.cjs.map} +1 -1
  97. package/dist/chunk-TPPM4QSS.cjs +2 -0
  98. package/dist/chunk-TPPM4QSS.cjs.map +1 -0
  99. package/dist/chunk-UVHD7BBC.js +3 -0
  100. package/dist/{chunk-ZDCZ5IDD.js.map → chunk-UVHD7BBC.js.map} +1 -1
  101. package/dist/{chunk-57PSJQQW.js → chunk-VB6QMU2W.js} +3 -3
  102. package/dist/chunk-VB6QMU2W.js.map +1 -0
  103. package/dist/chunk-VQO54ZMA.js +2 -0
  104. package/dist/chunk-VQO54ZMA.js.map +1 -0
  105. package/dist/{chunk-7DP57BA7.js → chunk-Y7XRA2EV.js} +2 -2
  106. package/dist/{chunk-7DP57BA7.js.map → chunk-Y7XRA2EV.js.map} +1 -1
  107. package/dist/{chunk-5IJD5L3O.cjs → chunk-YBQOQTVL.cjs} +2 -2
  108. package/dist/chunk-YBQOQTVL.cjs.map +1 -0
  109. package/dist/{chunk-EL2XUOWX.js → chunk-YG7UWQFV.js} +2 -2
  110. package/dist/{chunk-EL2XUOWX.js.map → chunk-YG7UWQFV.js.map} +1 -1
  111. package/dist/chunk-YSHWNCDH.cjs +5 -0
  112. package/dist/chunk-YSHWNCDH.cjs.map +1 -0
  113. package/dist/chunk-ZC2NPRLO.js +3 -0
  114. package/dist/chunk-ZC2NPRLO.js.map +1 -0
  115. package/dist/{chunk-FYTB7SDP.cjs → chunk-ZDJTDFTR.cjs} +2 -2
  116. package/dist/{chunk-FYTB7SDP.cjs.map → chunk-ZDJTDFTR.cjs.map} +1 -1
  117. package/dist/chunk-ZE5KKMBV.cjs +2 -0
  118. package/dist/chunk-ZE5KKMBV.cjs.map +1 -0
  119. package/dist/{chunk-4BAUQE6A.cjs → chunk-ZPHUTCJ5.cjs} +3 -3
  120. package/dist/{chunk-4BAUQE6A.cjs.map → chunk-ZPHUTCJ5.cjs.map} +1 -1
  121. package/dist/{chunk-GBCN7FNV.cjs → chunk-ZSLVLMO5.cjs} +2 -2
  122. package/dist/{chunk-GBCN7FNV.cjs.map → chunk-ZSLVLMO5.cjs.map} +1 -1
  123. package/dist/constants.cjs +1 -1
  124. package/dist/constants.d.cts +1 -1
  125. package/dist/constants.d.ts +1 -1
  126. package/dist/constants.js +1 -1
  127. package/dist/engine.cjs +1 -1
  128. package/dist/engine.d.cts +14 -12
  129. package/dist/engine.d.ts +14 -12
  130. package/dist/engine.js +1 -1
  131. package/dist/errors.cjs +1 -1
  132. package/dist/errors.d.cts +3 -3
  133. package/dist/errors.d.ts +3 -3
  134. package/dist/errors.js +1 -1
  135. package/dist/format.cjs +1 -1
  136. package/dist/format.d.cts +4 -3
  137. package/dist/format.d.ts +4 -3
  138. package/dist/format.js +1 -1
  139. package/dist/index.cjs +1 -1
  140. package/dist/index.cjs.map +1 -1
  141. package/dist/index.d.cts +15 -13
  142. package/dist/index.d.ts +15 -13
  143. package/dist/index.js +1 -1
  144. package/dist/index.js.map +1 -1
  145. package/dist/language.d.cts +12 -11
  146. package/dist/language.d.ts +12 -11
  147. package/dist/lexer.cjs +1 -1
  148. package/dist/lexer.d.cts +4 -4
  149. package/dist/lexer.d.ts +4 -4
  150. package/dist/lexer.js +1 -1
  151. package/dist/normalizer.cjs +1 -1
  152. package/dist/normalizer.d.cts +3 -3
  153. package/dist/normalizer.d.ts +3 -3
  154. package/dist/normalizer.js +1 -1
  155. package/dist/packages.cjs +1 -1
  156. package/dist/packages.d.cts +11 -10
  157. package/dist/packages.d.ts +11 -10
  158. package/dist/packages.js +1 -1
  159. package/dist/parser.cjs +1 -1
  160. package/dist/parser.d.cts +5 -4
  161. package/dist/parser.d.ts +5 -4
  162. package/dist/parser.js +1 -1
  163. package/dist/{pipeline-69q2tsLE.d.cts → pipeline-BYkKNpql.d.cts} +1 -1
  164. package/dist/{pipeline-DTqGLPsV.d.ts → pipeline-Cl7KW8CB.d.ts} +1 -1
  165. package/dist/resolvers.d.cts +2 -2
  166. package/dist/resolvers.d.ts +2 -2
  167. package/dist/temporal.cjs +2 -0
  168. package/dist/temporal.cjs.map +1 -0
  169. package/dist/temporal.d.cts +201 -0
  170. package/dist/temporal.d.ts +201 -0
  171. package/dist/temporal.js +2 -0
  172. package/dist/temporal.js.map +1 -0
  173. package/dist/testing.cjs +2 -2
  174. package/dist/testing.cjs.map +1 -1
  175. package/dist/testing.d.cts +12 -11
  176. package/dist/testing.d.ts +12 -11
  177. package/dist/testing.js +1 -1
  178. package/dist/testing.js.map +1 -1
  179. package/dist/uom.cjs +1 -1
  180. package/dist/uom.d.cts +2 -2
  181. package/dist/uom.d.ts +2 -2
  182. package/dist/uom.js +1 -1
  183. package/dist/vm.cjs +1 -1
  184. package/dist/vm.cjs.map +1 -1
  185. package/dist/vm.d.cts +8 -56
  186. package/dist/vm.d.ts +8 -56
  187. package/dist/vm.js +1 -1
  188. package/dist/vm.js.map +1 -1
  189. package/dist/worker.cjs +2 -2
  190. package/dist/worker.cjs.map +1 -1
  191. package/dist/worker.d.cts +35 -13
  192. package/dist/worker.d.ts +35 -13
  193. package/dist/worker.js +2 -2
  194. package/dist/worker.js.map +1 -1
  195. package/package.json +12 -1
  196. package/dist/chunk-4BRTUFTH.js +0 -2
  197. package/dist/chunk-4BRTUFTH.js.map +0 -1
  198. package/dist/chunk-4NZXCHQL.cjs +0 -2
  199. package/dist/chunk-4NZXCHQL.cjs.map +0 -1
  200. package/dist/chunk-57PSJQQW.js.map +0 -1
  201. package/dist/chunk-5IJD5L3O.cjs.map +0 -1
  202. package/dist/chunk-634ILVMP.cjs +0 -2
  203. package/dist/chunk-634ILVMP.cjs.map +0 -1
  204. package/dist/chunk-63ZOOUOL.js +0 -2
  205. package/dist/chunk-63ZOOUOL.js.map +0 -1
  206. package/dist/chunk-77KI7AKJ.cjs +0 -2
  207. package/dist/chunk-77KI7AKJ.cjs.map +0 -1
  208. package/dist/chunk-7N3IJSWF.js +0 -5
  209. package/dist/chunk-7N3IJSWF.js.map +0 -1
  210. package/dist/chunk-DUYTXLO2.js +0 -2
  211. package/dist/chunk-DUYTXLO2.js.map +0 -1
  212. package/dist/chunk-IJMNVBIS.js.map +0 -1
  213. package/dist/chunk-JSM3O7EM.cjs +0 -2
  214. package/dist/chunk-JSM3O7EM.cjs.map +0 -1
  215. package/dist/chunk-MZMA32NE.js +0 -3
  216. package/dist/chunk-MZMA32NE.js.map +0 -1
  217. package/dist/chunk-N4SSR7Q6.js +0 -2
  218. package/dist/chunk-N4SSR7Q6.js.map +0 -1
  219. package/dist/chunk-NMU5E7W7.js +0 -2
  220. package/dist/chunk-NMU5E7W7.js.map +0 -1
  221. package/dist/chunk-OB2VX4IL.js +0 -2
  222. package/dist/chunk-OB2VX4IL.js.map +0 -1
  223. package/dist/chunk-RAPEZR5L.cjs +0 -2
  224. package/dist/chunk-RAPEZR5L.cjs.map +0 -1
  225. package/dist/chunk-SPOVFRZO.cjs +0 -5
  226. package/dist/chunk-SPOVFRZO.cjs.map +0 -1
  227. package/dist/chunk-SQHBOWES.cjs +0 -2
  228. package/dist/chunk-SQHBOWES.cjs.map +0 -1
  229. package/dist/chunk-UF5XMZTT.js +0 -2
  230. package/dist/chunk-UF5XMZTT.js.map +0 -1
  231. package/dist/chunk-UV3EUIBT.cjs +0 -3
  232. package/dist/chunk-UV3EUIBT.cjs.map +0 -1
  233. package/dist/chunk-VMSCRVNX.cjs +0 -2
  234. package/dist/chunk-VMSCRVNX.cjs.map +0 -1
  235. package/dist/chunk-XBGK3TTU.cjs +0 -3
  236. package/dist/chunk-XBGK3TTU.cjs.map +0 -1
  237. package/dist/chunk-XX55RR4Q.js +0 -3
  238. package/dist/chunk-XX55RR4Q.js.map +0 -1
  239. package/dist/chunk-YBQPEWT7.cjs.map +0 -1
  240. package/dist/chunk-ZDCZ5IDD.js +0 -3
@@ -1,15 +1,52 @@
1
- import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-DqTbbtWA.js';
2
- import { V as Value, a as ValueType } from './Value-Ds3Gy07C.js';
3
- import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-Bmctxl0n.js';
1
+ import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-Dgymjxzd.js';
2
+ import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-DqtnZMC5.js';
4
3
  import { IAsyncResolver } from './resolvers.js';
5
- import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-CLBtiE8M.js';
6
- import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-B636am7Y.js';
4
+ import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-IF7nPRMp.js';
5
+ import { D as DependencyGraph, V as VM, f as DagSnapshot, g as EngineContext, S as ScopeManager, P as PluginFunctionHandler, A as AsConverter } from './VMBuiltins-CZiZRKn-.js';
6
+ import { V as Value, b as ValueType, D as DatetimeGrain } from './Value-BYHw-x7q.js';
7
7
  import { a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.js';
8
+ import { C as CalendarBackend } from './CalendarBackend-MdS3Bb4P.js';
8
9
  import { QueryClient } from '@tanstack/query-core';
9
- import { E as EngineError } from './EngineError-fR1K1rvx.js';
10
- import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-DTqGLPsV.js';
11
- import { T as Token } from './Token-CbP_OutD.js';
12
- import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-DnzYPmoK.js';
10
+ import { E as EngineError } from './EngineError-C-kBwYlN.js';
11
+ import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-Cl7KW8CB.js';
12
+ import { T as Token } from './Token-D8f7yaz1.js';
13
+ import { D as DateAmbiguity, E as EngineConfigOverride, a as EngineConfig } from './Configuration-BxriK9Kw.js';
14
+
15
+ /**
16
+ * Choosing the calendar backend an engine computes dates with.
17
+ *
18
+ * The engine prefers Temporal. Where the runtime has it, dates are computed
19
+ * on `Temporal` (Chrome, Edge, Firefox and Opera ship it, and Node from 26);
20
+ * where it does not (Node 22 and 24, Safari, iOS), they are computed on
21
+ * `Date`, which is what every engine did before the backend existed.
22
+ *
23
+ * The engine bundles no polyfill. What it carries is the adapter, a few
24
+ * kilobytes that translate the backend's plain-number contract onto whichever
25
+ * implementation is present. A host that wants Temporal on a runtime without
26
+ * it installs a polyfill itself and passes the backend, which is what the
27
+ * `solve-engine/temporal` subpath is for.
28
+ *
29
+ * The two backends are held to the same answers: `scripts/test-temporal.mjs`
30
+ * runs the date suites under both, in three time zones, and the differential
31
+ * suite compares them case by case. That is what makes preferring one safe
32
+ * rather than a coin toss, because it means a reader on Firefox and a reader
33
+ * on Safari see the same number.
34
+ *
35
+ * @module resolveCalendar
36
+ */
37
+
38
+ /**
39
+ * How an engine picks its calendar backend.
40
+ *
41
+ * - `"auto"`, the default: Temporal where the runtime has it, `Date` otherwise.
42
+ * - `"temporal"`: Temporal, refusing to build an engine on a runtime without
43
+ * it rather than quietly computing on `Date`.
44
+ * - `"date"`: the `Date` backend, whatever the runtime has. What to pin when a
45
+ * result must not depend on where it was computed.
46
+ * - A {@link CalendarBackend}: that backend, for a host supplying its own (a
47
+ * polyfill-backed one, or a zone-bound one).
48
+ */
49
+ type CalendarOption = "auto" | "temporal" | "date" | CalendarBackend;
13
50
 
14
51
  /**
15
52
  * One line's compiled bytecode, plus the variables it reads and writes.
@@ -519,6 +556,8 @@ type SerializedValue = {
519
556
  } | {
520
557
  t: ValueType.Datetime;
521
558
  v: SerializedNumber;
559
+ g?: DatetimeGrain;
560
+ z?: string;
522
561
  } | {
523
562
  t: ValueType.Percentage;
524
563
  v: SerializedNumber;
@@ -992,6 +1031,194 @@ interface UnifiedParsingOptions {
992
1031
  includeDiagnostics?: boolean;
993
1032
  }
994
1033
 
1034
+ /**
1035
+ * What the host's own locale says about the order the three groups of a
1036
+ * numeric date are written in.
1037
+ *
1038
+ * A reader who types `03/04/2026` means one of two days, and which one is a
1039
+ * question about where they are rather than about the characters. The engine
1040
+ * has never had an answer to that question, so `date.inputOrder` made the host
1041
+ * state it. This module is how a host can instead ask the machine, and it asks
1042
+ * exactly one thing: the day/month/year field order. Never the calendar
1043
+ * system, never the numbering system, never the display language, all of which
1044
+ * the engine decides for itself elsewhere.
1045
+ *
1046
+ * Asked of `Intl` rather than answered from a table of locales. A table goes
1047
+ * stale, and worse, it disagrees with the host's own date pickers on the same
1048
+ * machine: `Intl` is where the operating system's answer already lives, so it
1049
+ * is the only answer that can agree with everything else the reader sees.
1050
+ *
1051
+ * Pure `Intl`, importing nothing of the engine's. That is the constraint
1052
+ * `engine/EngineContext.ts` states for this directory: `calendar/` is imported
1053
+ * by `vm/`, which `engine/` imports, so anything here reaching back into
1054
+ * `engine/` closes a cycle. It sits beside `IntlZone.ts`, already the shared
1055
+ * "ask Intl about zones" module under the same rule.
1056
+ *
1057
+ * Nothing here is called unless a host asked for it. `date.inputOrder` still
1058
+ * defaults to `'auto'`, and only the value `'locale'` reaches this module, so
1059
+ * a default engine constructs no `Intl.DateTimeFormat` on this path at all.
1060
+ *
1061
+ * @module HostLocale
1062
+ */
1063
+ /**
1064
+ * The three field orders a Gregorian numeric date can be written in.
1065
+ *
1066
+ * Declared here rather than imported from `constants/Configuration.ts` because
1067
+ * this module may not import from the engine's layers (see the module note),
1068
+ * and because it is a narrower set than `DateInputOrder`: an inference can
1069
+ * only ever produce a concrete order, never `'auto'` and never `'locale'`.
1070
+ */
1071
+ type DateFieldOrder = "DMY" | "MDY" | "YMD";
1072
+
1073
+ /**
1074
+ * How this engine reads a numeric date literal, decided once and reported.
1075
+ *
1076
+ * `03/04/2026` names one of two days, and the engine has to pick one. Which it
1077
+ * picks has always been settled by `date.inputOrder`, but nothing said so: the
1078
+ * answer came back as a date with no account of how it was read, and a host
1079
+ * had no way to show the reader "day first" or to discover that its own
1080
+ * setting was the reason a document looked wrong.
1081
+ *
1082
+ * This module is the one place that decision is made, so the normaliser that
1083
+ * fuses a literal and the surfaces that explain one cannot disagree about it.
1084
+ * Two halves:
1085
+ *
1086
+ * - The engine-wide one, {@link resolveDateOrderPolicy}, run once per engine
1087
+ * and reported through `ExpressionEngine.getDateReading()`. It names the
1088
+ * order AND where the order came from.
1089
+ * - The per-literal one, {@link classifyRun} and {@link readNumericDate},
1090
+ * which decide what one run of digits means under that order, and, where it
1091
+ * means nothing, whether saying so is better than answering the arithmetic
1092
+ * the run is spelled like.
1093
+ * - The sentence, {@link composeReadingNote}, which says the same thing to a
1094
+ * reader. Composed here so that five hosts do not write five different
1095
+ * sentences about one fact, and so the note a hover shows and the message a
1096
+ * refusal carries cannot drift apart.
1097
+ *
1098
+ * @module DateReading
1099
+ */
1100
+
1101
+ /** Scoped error codes the datetime package owns (see `errors/ErrorCode.ts` convention). */
1102
+ declare const DatetimeErrorCodes: {
1103
+ /**
1104
+ * `date.inputLocale` is not a BCP-47 locale tag (`"en_US"` with an
1105
+ * underscore is the usual mistake). Raised at engine construction, because a
1106
+ * locale that is silently ignored is a date order that is silently wrong.
1107
+ */
1108
+ readonly DATE_INPUT_LOCALE_INVALID: "DATE_INPUT_LOCALE_INVALID";
1109
+ /**
1110
+ * A date-shaped run the resolved order cannot read, which another supported
1111
+ * order can (`12/25/2026` on a day-first engine), or a year-last run on a
1112
+ * year-first engine, which has no day and month roles to apply to it. The
1113
+ * message names the order actually used, the group that broke, the reading
1114
+ * that would work, and the two ways out. A recoverable Error VALUE, never a
1115
+ * throw, and suppressed by `date.onAmbiguous: 'arithmetic'`.
1116
+ */
1117
+ readonly DATE_ORDER_MISMATCH: "DATE_ORDER_MISMATCH";
1118
+ /**
1119
+ * A run whose shape is unmistakably a date attempt and which names no real
1120
+ * day under any reading: `31/04/2026`, `29/02/2026`, `13/13/2026`,
1121
+ * `2026-02-29`, `2026-13-01`. Separate from {@link DATE_ORDER_MISMATCH}
1122
+ * because no change of order fixes it, so the message must not suggest one.
1123
+ */
1124
+ readonly DATE_NOT_A_CALENDAR_DAY: "DATE_NOT_A_CALENDAR_DAY";
1125
+ };
1126
+ /** Every error code the datetime package's date-reading rules can produce. */
1127
+ type DatetimeErrorCode = (typeof DatetimeErrorCodes)[keyof typeof DatetimeErrorCodes];
1128
+ /**
1129
+ * An order a literal can actually be read under: the three concrete field
1130
+ * orders, plus `'auto'` for the historic per-separator reading.
1131
+ *
1132
+ * Narrower than `DateInputOrder` on purpose. `'locale'` is a request for an
1133
+ * inference, not an order, and it is resolved away by
1134
+ * {@link resolveDateOrderPolicy} before anything that reads a literal sees it,
1135
+ * so the word cannot reach the normaliser, a worker or a snapshot.
1136
+ */
1137
+ type ResolvedDateOrder = "auto" | DateFieldOrder;
1138
+ /**
1139
+ * Where a resolved order came from, which is the part a reader needs and a
1140
+ * bug report should carry.
1141
+ *
1142
+ * - `'config'`: the host named `'DMY'`, `'MDY'` or `'YMD'` outright. No
1143
+ * inference ran and `date.inputLocale` was not consulted.
1144
+ * - `'locale'`: inferred from the tag the host gave in `date.inputLocale`.
1145
+ * - `'host-locale'`: inferred from the tag this machine resolves to.
1146
+ * - `'separator'`: `'auto'`, the historic reading, where a slash date is
1147
+ * day-first and a hyphen date month-first unless it is ISO-shaped.
1148
+ * - `'fallback'`: an inference was asked for and could not be made, so the
1149
+ * engine reads dates exactly as an `'auto'` engine does. Visible on purpose:
1150
+ * this is the case where a host should offer the reader a manual choice.
1151
+ */
1152
+ type DateOrderSource = "config" | "locale" | "host-locale" | "separator" | "fallback";
1153
+ /**
1154
+ * The reading policy one engine applies to every numeric date literal in every
1155
+ * line it evaluates.
1156
+ *
1157
+ * Resolved once, in the `ExpressionEngine` constructor, and then carried
1158
+ * rather than re-derived: the normaliser rule runs on every keystroke, so an
1159
+ * `Intl` call per literal would be a per-keystroke cost for an answer that
1160
+ * cannot change, and a per-expression bytecode cache keyed on text would go
1161
+ * stale against an order that could.
1162
+ */
1163
+ interface DateReadingPolicy {
1164
+ /** The order every ambiguous numeric literal is read under. Never `'locale'`. */
1165
+ readonly order: ResolvedDateOrder;
1166
+ /** Where {@link order} came from. See {@link DateOrderSource}. */
1167
+ readonly orderSource: DateOrderSource;
1168
+ /** The BCP-47 tag the order was inferred from, when it was inferred from one. */
1169
+ readonly locale?: string;
1170
+ /** What a run no order can read does: refuse it, or leave it to arithmetic. From `date.onAmbiguous`. */
1171
+ readonly onAmbiguous: DateAmbiguity;
1172
+ }
1173
+ /**
1174
+ * How one date literal in one line was read, with the span it occupies and a
1175
+ * sentence a host can show.
1176
+ *
1177
+ * Derived, never stored. A line can hold two literals
1178
+ * (`31/12/2026 - 01/01/2026`), which one value cannot represent, and a derived
1179
+ * date (`03/04/2026 + 1 day`) is no longer the literal that was read, so a
1180
+ * reading recorded on the answer would be right for the common line and
1181
+ * quietly wrong for the rest. It costs a re-lex of the lines a reader actually
1182
+ * asks about, and nothing at all on the rest.
1183
+ */
1184
+ interface DateReading {
1185
+ /** The literal exactly as typed, `"03/04/2026"`. */
1186
+ readonly text: string;
1187
+ /** Offset of the first character in the line, for an editor underline. */
1188
+ readonly start: number;
1189
+ /** Offset one past the last character. */
1190
+ readonly end: number;
1191
+ /** The day it was read as, `"2026-04-03"`, or null when the literal was refused. */
1192
+ readonly iso: string | null;
1193
+ /** The order actually applied, or null when no order could be. */
1194
+ readonly order: DateFieldOrder | "ISO" | "spelled" | null;
1195
+ /** Where that order came from. `'iso'` and `'spelled'` mean the literal settled itself. */
1196
+ readonly orderSource: DateOrderSource | "iso" | "spelled";
1197
+ /** The BCP-47 tag the order was inferred from, when it was inferred from one. */
1198
+ readonly locale?: string;
1199
+ /** Whether the other order also names a real day, so the reading is a genuine choice. */
1200
+ readonly contested: boolean;
1201
+ /** Whether a two-digit year was windowed to a century. */
1202
+ readonly shortYear: boolean;
1203
+ /** The ISO of the reading not taken, when {@link contested}. */
1204
+ readonly alternative?: string;
1205
+ /** The error code, when the literal was refused. */
1206
+ readonly problem?: DatetimeErrorCode;
1207
+ /**
1208
+ * The sentence a host shows, composed here rather than assembled by each
1209
+ * host from the parts, so five hosts do not write five different sentences
1210
+ * about one fact.
1211
+ */
1212
+ readonly note: string;
1213
+ /**
1214
+ * Whether the note is worth showing: the reading was contested, a two-digit
1215
+ * year was windowed, or the literal was refused. A boolean the engine
1216
+ * computes rather than a judgement each host re-derives, which is what stops
1217
+ * the note being either wallpaper or absent.
1218
+ */
1219
+ readonly needsNote: boolean;
1220
+ }
1221
+
995
1222
  /**
996
1223
  * One line of a derivation: a readable account of a single operation and the
997
1224
  * value it arrives at.
@@ -1484,6 +1711,8 @@ interface EngineRestoreOptions {
1484
1711
  config?: EngineConfigOverride;
1485
1712
  /** Turn on the diagnostic pipeline, as in the constructor's `diagnostics`. */
1486
1713
  diagnostics?: boolean;
1714
+ /** The calendar backend for the restored engine, as in the constructor's `calendar`. */
1715
+ calendar?: CalendarOption;
1487
1716
  /**
1488
1717
  * Override the locale the snapshot recorded. Rarely needed: the snapshot's
1489
1718
  * own {@link EngineSnapshot.locale} is used by default, so a restored engine
@@ -1509,6 +1738,28 @@ interface EngineOptions {
1509
1738
  config?: EngineConfigOverride;
1510
1739
  /** Turn on the diagnostic pipeline (per-stage timing and detail). Defaults to `false`. */
1511
1740
  diagnostics?: boolean;
1741
+ /**
1742
+ * The calendar the engine computes dates with: which local day an instant
1743
+ * falls on, what a month later is, whether a day is a Saturday, how a date
1744
+ * is written out. See {@link CalendarBackend}.
1745
+ *
1746
+ * Defaults to the built-in `Date` backend, read in the host process's time
1747
+ * zone, which is what every engine computed with before this option
1748
+ * existed; leaving it unset changes nothing. The `Temporal` backend from
1749
+ * `solve-engine/temporal` carries a time zone of its own.
1750
+ *
1751
+ * Every site the engine owns reads the backend passed here: the VM's date
1752
+ * opcodes, the plugin functions and `as` converters through their
1753
+ * execution context, the rules that fuse a date literal, and the parser
1754
+ * for the forms that read a literal while parsing (`days in <period>`,
1755
+ * the stocks and historical-currency date phrases). Two sites sit outside
1756
+ * the engine and are told separately: `formatValue` takes the backend on
1757
+ * its `FormattingSettings.calendar`, and a worker runtime takes it on
1758
+ * `WorkerRuntimeOptions.calendar`, because a backend is an object of
1759
+ * functions and does not cross the message boundary. The inline offload
1760
+ * worker computes with the `Date` backend.
1761
+ */
1762
+ calendar?: CalendarOption;
1512
1763
  /**
1513
1764
  * Run a few throwaway expressions through the pipeline at construction, so
1514
1765
  * the first real one is not the one that pays for JIT warmup.
@@ -1604,6 +1855,11 @@ declare class ExpressionEngine {
1604
1855
  */
1605
1856
  private readonly context;
1606
1857
  private config;
1858
+ /**
1859
+ * How this engine reads an ambiguous numeric date literal, resolved once
1860
+ * from `config.date` at construction. See {@link getDateReading}.
1861
+ */
1862
+ private readonly dateReading;
1607
1863
  private diagnosticPipeline;
1608
1864
  /**
1609
1865
  * Direct reference to the timeline collector registered above (when
@@ -1949,6 +2205,61 @@ declare class ExpressionEngine {
1949
2205
  * in effect after merging with DEFAULT_CONFIG.
1950
2206
  */
1951
2207
  getConfig(): EngineConfig;
2208
+ /**
2209
+ * How this engine reads an ambiguous numeric date literal, and where that
2210
+ * reading came from.
2211
+ *
2212
+ * A settings panel renders this ("Dates are read day first, from your
2213
+ * system locale en-GB"), and a bug report should paste it: "why did
2214
+ * `03/04/2026` render as 4 March" is answerable from one line of it and
2215
+ * unanswerable without. `orderSource: 'fallback'` is the visible signal
2216
+ * that an inference was asked for and could not be made, which is the
2217
+ * difference between a decision and a guess, and the case where a host
2218
+ * should offer the reader a manual choice.
2219
+ *
2220
+ * Resolved once at construction from `config.date`, so this is a read of a
2221
+ * settled fact rather than a fresh inference, and two calls on one engine
2222
+ * cannot disagree.
2223
+ *
2224
+ * @returns The frozen policy: the order, its source, and the locale tag it
2225
+ * was inferred from where it was inferred from one.
2226
+ */
2227
+ getDateReading(): DateReadingPolicy;
2228
+ /**
2229
+ * How every date literal in a line was read, with the span each occupies.
2230
+ *
2231
+ * This is what an editor puts behind a hover or an underline, beside the
2232
+ * {@link tokenizeForClassification} it already calls per keystroke. It
2233
+ * lexes and normalises only, so no line is evaluated and no document state
2234
+ * is touched, and it is the only surface that carries source offsets and
2235
+ * the only one that can describe two literals on one line.
2236
+ *
2237
+ * The reading is recomputed rather than remembered. A line can hold two
2238
+ * literals (`31/12/2026 - 01/01/2026`), which one answer cannot represent,
2239
+ * and a derived date (`03/04/2026 + 1 day`) is no longer the literal that
2240
+ * was read, so a reading recorded on the value would be right for the
2241
+ * common line and quietly wrong for the rest. It reaches the same answer
2242
+ * because it calls the same function the normaliser did.
2243
+ *
2244
+ * `needsNote` is the field to branch on: it is true exactly when the
2245
+ * reading was a genuine choice between two real days, when a two-digit
2246
+ * year was windowed to a century, or when the literal was refused. A host
2247
+ * that shows `note` on every date writes wallpaper; a host that shows it
2248
+ * on none leaves the reader to guess.
2249
+ *
2250
+ * @param text - The line to read. Not evaluated.
2251
+ * @returns One record per date literal, in the order they appear.
2252
+ */
2253
+ readDates(text: string): DateReading[];
2254
+ /**
2255
+ * Turns one fused date token back into the reading that produced it.
2256
+ *
2257
+ * The numeric shapes go through `readNumericDate` again, so the account and
2258
+ * the answer are the same decision rather than two that agree by
2259
+ * inspection. Anything else (a spelled-out month, an ISO timestamp) settled
2260
+ * itself, and is described from the instant the token already carries.
2261
+ */
2262
+ private describeDateLiteral;
1952
2263
  /**
1953
2264
  * Get the underlying diagnostic pipeline for advanced usage.
1954
2265
  */
@@ -3267,16 +3578,19 @@ interface IEnginePackage {
3267
3578
  * keyword registration is needed for a custom name: the AS parselet
3268
3579
  * accepts any bare-word token after "as" and reads its raw text.
3269
3580
  *
3270
- * Each handler is a pure, synchronous `(value: Value) => Value`, for
3271
- * async conversions (e.g. a live currency-style lookup), use
3272
- * {@link asyncResolvers} instead.
3581
+ * Each handler is a pure, synchronous `(value: Value, context?) => Value`.
3582
+ * The optional second argument is the same per-line execution context a
3583
+ * plugin function receives; a converter that reads a date takes the
3584
+ * engine's calendar backend from it (`calendarOf(context)`) so it answers
3585
+ * as the engine's own date arithmetic would. For async conversions (e.g. a
3586
+ * live currency-style lookup), use {@link asyncResolvers} instead.
3273
3587
  *
3274
3588
  * @example
3275
3589
  * ```ts
3276
3590
  * asConverters: { roman: (v) => stringValue(toRomanNumeral(v.toNumber())) }
3277
3591
  * ```
3278
3592
  */
3279
- asConverters?: Record<string, (value: Value) => Value>;
3593
+ asConverters?: Record<string, AsConverter>;
3280
3594
  }
3281
3595
 
3282
- export { type ApplyChangesResult as A, type BatcherMetrics as B, type CompletionItem as C, DocumentModel as D, ExpressionEngine as E, type LineCacheEntryInfo as F, type LineState as G, type LinesUpdatedEvent as H, type IEnginePackage as I, type ParsedLine as J, LanguageService as L, type ParsingResult as P, SNAPSHOT_FORMAT as S, type UnifiedParsingOptions as U, type ViewportRange as V, type EngineOptions as a, type EngineRestoreOptions as b, type EngineSnapshot as c, type Explanation as d, type ExplanationStep as e, SNAPSHOT_VERSION as f, type SerializedAnonymousBody as g, type SerializedBytecode as h, type SerializedDecimal as i, type SerializedLineCacheEntry as j, type SerializedNumber as k, type SerializedRational as l, type SerializedUserFunction as m, type SerializedValue as n, SnapshotErrorCodes as o, type LanguageServiceOptions as p, type SemanticToken as q, type LineChange as r, type InlineSolvePosition as s, type AsyncCachePackageInfo as t, type AsyncErrorEvent as u, AsyncResolutionBatcher as v, type AsyncResolutionEvent as w, type BytecodeCacheEntry as x, type CacheSnapshot as y, type CheckpointSnapshot as z };
3596
+ export { type ApplyChangesResult as A, type BatcherMetrics as B, type CompletionItem as C, type DateOrderSource as D, ExpressionEngine as E, type BytecodeCacheEntry as F, type CacheSnapshot as G, type CheckpointSnapshot as H, type IEnginePackage as I, type LineCacheEntryInfo as J, type LineState as K, LanguageService as L, type LinesUpdatedEvent as M, type ParsedLine as N, type ParsingResult as P, type ResolvedDateOrder as R, SNAPSHOT_FORMAT as S, type UnifiedParsingOptions as U, type ViewportRange as V, type EngineOptions as a, type DateReading as b, type DateReadingPolicy as c, type EngineRestoreOptions as d, type EngineSnapshot as e, type Explanation as f, type ExplanationStep as g, SNAPSHOT_VERSION as h, type SerializedAnonymousBody as i, type SerializedBytecode as j, type SerializedDecimal as k, type SerializedLineCacheEntry as l, type SerializedNumber as m, type SerializedRational as n, type SerializedUserFunction as o, type SerializedValue as p, SnapshotErrorCodes as q, type LanguageServiceOptions as r, type SemanticToken as s, DocumentModel as t, type LineChange as u, type InlineSolvePosition as v, type AsyncCachePackageInfo as w, type AsyncErrorEvent as x, AsyncResolutionBatcher as y, type AsyncResolutionEvent as z };
@@ -1,6 +1,7 @@
1
1
  import { B as BytecodeBuilder } from './BytecodeBuilder-DSWKZi4f.cjs';
2
- import { T as Token } from './Token-CbP_OutD.cjs';
3
- import { D as DiagnosticPipeline } from './pipeline-69q2tsLE.cjs';
2
+ import { T as Token } from './Token-D8f7yaz1.cjs';
3
+ import { D as DiagnosticPipeline } from './pipeline-BYkKNpql.cjs';
4
+ import { C as CalendarBackend } from './CalendarBackend-MdS3Bb4P.cjs';
4
5
 
5
6
  /**
6
7
  * Dual-keyed ParseletRegistry, accepts both string token types and
@@ -153,6 +154,15 @@ declare class PrecedenceParser {
153
154
  private readonly decimalSeparator;
154
155
  /** The locale's thousands separator, cached from {@link localeCode}. */
155
156
  private readonly thousandsSeparator;
157
+ /**
158
+ * The calendar backend of the engine this parser belongs to, for the few
159
+ * parselets that read a fused date literal or the current year while
160
+ * parsing (`days in <period>`, the stocks and historical-currency date
161
+ * phrases). The literal was built through the same backend by the
162
+ * normaliser, so reading it back here through any other could name the
163
+ * wrong day. The `Date` backend for a parser built outside an engine.
164
+ */
165
+ private readonly calendar;
156
166
  /**
157
167
  * The binding power the current infix parselet is being invoked at, i.e. the
158
168
  * `minBp` of the expression it sits inside. Set immediately before each Tier-2
@@ -195,9 +205,15 @@ declare class PrecedenceParser {
195
205
  private static readonly INFIX_OPCODE;
196
206
  /** Shared with every BytecodeBuilder so a nested-body builder resolves plugin calls by name. */
197
207
  private pluginFunctionIndex?;
198
- constructor(parseletRegistry: ParseletRegistry, maxDepth?: number, localeCode?: string, pluginFunctionIndex?: ReadonlyMap<string, number>);
208
+ constructor(parseletRegistry: ParseletRegistry, maxDepth?: number, localeCode?: string, pluginFunctionIndex?: ReadonlyMap<string, number>, calendar?: CalendarBackend);
199
209
  /** Get locale code for NumberParselet to normalize separators */
200
210
  getLocaleCode(): string;
211
+ /**
212
+ * The calendar backend a parselet reads a date with at parse time: the
213
+ * engine's own, so a fused literal reads back through the backend that
214
+ * built it. See the field's doc for the sites that need it.
215
+ */
216
+ getCalendar(): CalendarBackend;
201
217
  /**
202
218
  * Set the diagnostic pipeline for parselet matching events.
203
219
  * Cleared after each non-cached parse to avoid holding refs.
@@ -1,6 +1,7 @@
1
1
  import { B as BytecodeBuilder } from './BytecodeBuilder-DSWKZi4f.js';
2
- import { T as Token } from './Token-CbP_OutD.js';
3
- import { D as DiagnosticPipeline } from './pipeline-DTqGLPsV.js';
2
+ import { T as Token } from './Token-D8f7yaz1.js';
3
+ import { D as DiagnosticPipeline } from './pipeline-Cl7KW8CB.js';
4
+ import { C as CalendarBackend } from './CalendarBackend-MdS3Bb4P.js';
4
5
 
5
6
  /**
6
7
  * Dual-keyed ParseletRegistry, accepts both string token types and
@@ -153,6 +154,15 @@ declare class PrecedenceParser {
153
154
  private readonly decimalSeparator;
154
155
  /** The locale's thousands separator, cached from {@link localeCode}. */
155
156
  private readonly thousandsSeparator;
157
+ /**
158
+ * The calendar backend of the engine this parser belongs to, for the few
159
+ * parselets that read a fused date literal or the current year while
160
+ * parsing (`days in <period>`, the stocks and historical-currency date
161
+ * phrases). The literal was built through the same backend by the
162
+ * normaliser, so reading it back here through any other could name the
163
+ * wrong day. The `Date` backend for a parser built outside an engine.
164
+ */
165
+ private readonly calendar;
156
166
  /**
157
167
  * The binding power the current infix parselet is being invoked at, i.e. the
158
168
  * `minBp` of the expression it sits inside. Set immediately before each Tier-2
@@ -195,9 +205,15 @@ declare class PrecedenceParser {
195
205
  private static readonly INFIX_OPCODE;
196
206
  /** Shared with every BytecodeBuilder so a nested-body builder resolves plugin calls by name. */
197
207
  private pluginFunctionIndex?;
198
- constructor(parseletRegistry: ParseletRegistry, maxDepth?: number, localeCode?: string, pluginFunctionIndex?: ReadonlyMap<string, number>);
208
+ constructor(parseletRegistry: ParseletRegistry, maxDepth?: number, localeCode?: string, pluginFunctionIndex?: ReadonlyMap<string, number>, calendar?: CalendarBackend);
199
209
  /** Get locale code for NumberParselet to normalize separators */
200
210
  getLocaleCode(): string;
211
+ /**
212
+ * The calendar backend a parselet reads a date with at parse time: the
213
+ * engine's own, so a fused literal reads back through the backend that
214
+ * built it. See the field's doc for the sites that need it.
215
+ */
216
+ getCalendar(): CalendarBackend;
201
217
  /**
202
218
  * Set the diagnostic pipeline for parselet matching events.
203
219
  * Cleared after each non-cached parse to avoid holding refs.
@@ -33,6 +33,23 @@ interface Token {
33
33
  * the one thing the parser will see rather than as its parts.
34
34
  */
35
35
  sourceEnd?: number;
36
+ /**
37
+ * Why a fused token stands for something the engine refuses to read, when
38
+ * it does.
39
+ *
40
+ * Set by a normaliser rule that has decided a run is not what it is spelled
41
+ * like and will not be read as arithmetic either: a date literal naming no
42
+ * real day. The parselet for the fused type turns it into an Error value.
43
+ *
44
+ * Carried here rather than packed into `value`, because `value` is what a
45
+ * parse error and the editor's per-keystroke token API print, and a reader
46
+ * shown `{"code":"...","message":"..."}` is being shown the engine's
47
+ * internals. `value` stays the text the reader typed.
48
+ */
49
+ fault?: {
50
+ readonly code: string;
51
+ readonly message: string;
52
+ };
36
53
  }
37
54
  /**
38
55
  * Canonical token type name constants.
@@ -33,6 +33,23 @@ interface Token {
33
33
  * the one thing the parser will see rather than as its parts.
34
34
  */
35
35
  sourceEnd?: number;
36
+ /**
37
+ * Why a fused token stands for something the engine refuses to read, when
38
+ * it does.
39
+ *
40
+ * Set by a normaliser rule that has decided a run is not what it is spelled
41
+ * like and will not be read as arithmetic either: a date literal naming no
42
+ * real day. The parselet for the fused type turns it into an Error value.
43
+ *
44
+ * Carried here rather than packed into `value`, because `value` is what a
45
+ * parse error and the editor's per-keystroke token API print, and a reader
46
+ * shown `{"code":"...","message":"..."}` is being shown the engine's
47
+ * internals. `value` stays the text the reader typed.
48
+ */
49
+ fault?: {
50
+ readonly code: string;
51
+ readonly message: string;
52
+ };
36
53
  }
37
54
  /**
38
55
  * Canonical token type name constants.
@@ -1,4 +1,4 @@
1
- import { T as Token } from './Token-CbP_OutD.js';
1
+ import { T as Token } from './Token-D8f7yaz1.js';
2
2
 
3
3
  /**
4
4
  * NormalizerRule, pluggable token normalization rule for the
@@ -1,4 +1,4 @@
1
- import { T as Token } from './Token-CbP_OutD.cjs';
1
+ import { T as Token } from './Token-D8f7yaz1.cjs';
2
2
 
3
3
  /**
4
4
  * NormalizerRule, pluggable token normalization rule for the