solve-engine 2.38.27 → 2.38.28

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 (122) hide show
  1. package/dist/{PackageCompatibility-DwcUeOGJ.d.ts → PackageCompatibility-BfRpqwmD.d.ts} +1 -1
  2. package/dist/{PackageCompatibility-BJja2o8r.d.cts → PackageCompatibility-CcfNMlWN.d.cts} +1 -1
  3. package/dist/{PackageRegistry-Cj73Whk9.d.ts → PackageRegistry-ClAKDDOP.d.ts} +4 -4
  4. package/dist/{PackageRegistry-DqzsjxGQ.d.cts → PackageRegistry-DLLVZW0S.d.cts} +4 -4
  5. package/dist/{Parselet-DmMY2s9Y.d.cts → Parselet-ClR3Blwp.d.cts} +1 -1
  6. package/dist/{Parselet-Br1tHash.d.ts → Parselet-DkAFnfU2.d.ts} +1 -1
  7. package/dist/{VMBuiltins-BqkoJtHt.d.ts → VMBuiltins-Bk8TQNF1.d.ts} +2 -2
  8. package/dist/{VMBuiltins-Baa90D2v.d.cts → VMBuiltins-ClXnXk9K.d.cts} +2 -2
  9. package/dist/{Value-B55Hvn3e.d.cts → Value-wMuCzPn0.d.cts} +18 -2
  10. package/dist/{Value-B55Hvn3e.d.ts → Value-wMuCzPn0.d.ts} +18 -2
  11. package/dist/{chunk-SFCLGBCD.js → chunk-34RTVUU3.js} +3 -3
  12. package/dist/{chunk-SFCLGBCD.js.map → chunk-34RTVUU3.js.map} +1 -1
  13. package/dist/{chunk-QP4VIEXZ.js → chunk-36JGHDZR.js} +2 -2
  14. package/dist/chunk-36JGHDZR.js.map +1 -0
  15. package/dist/chunk-3ZFJLH4W.cjs +2 -0
  16. package/dist/chunk-3ZFJLH4W.cjs.map +1 -0
  17. package/dist/{chunk-EZ7R3ZHM.cjs → chunk-4AX7GIZY.cjs} +3 -3
  18. package/dist/{chunk-EZ7R3ZHM.cjs.map → chunk-4AX7GIZY.cjs.map} +1 -1
  19. package/dist/chunk-4H27GUVY.js +2 -0
  20. package/dist/chunk-4H27GUVY.js.map +1 -0
  21. package/dist/{chunk-JVDNK45F.cjs → chunk-5BRJQREI.cjs} +4 -4
  22. package/dist/{chunk-JVDNK45F.cjs.map → chunk-5BRJQREI.cjs.map} +1 -1
  23. package/dist/{chunk-AWGSR2GZ.js → chunk-BNVE6I22.js} +2 -2
  24. package/dist/{chunk-AWGSR2GZ.js.map → chunk-BNVE6I22.js.map} +1 -1
  25. package/dist/chunk-CAJKB4WQ.js +2 -0
  26. package/dist/chunk-CAJKB4WQ.js.map +1 -0
  27. package/dist/{chunk-ZSFOIBIH.js → chunk-CUH3FEWI.js} +2 -2
  28. package/dist/chunk-CUH3FEWI.js.map +1 -0
  29. package/dist/{chunk-NMZRAJLJ.cjs → chunk-FZTGWNVU.cjs} +2 -2
  30. package/dist/{chunk-NMZRAJLJ.cjs.map → chunk-FZTGWNVU.cjs.map} +1 -1
  31. package/dist/{chunk-RMBUP4XA.js → chunk-GMHYWVOG.js} +2 -2
  32. package/dist/{chunk-RMBUP4XA.js.map → chunk-GMHYWVOG.js.map} +1 -1
  33. package/dist/{chunk-OGD4YTZW.js → chunk-HPJ5SQEL.js} +3 -3
  34. package/dist/{chunk-OGD4YTZW.js.map → chunk-HPJ5SQEL.js.map} +1 -1
  35. package/dist/{chunk-FKNZ3VFB.cjs → chunk-HTB3D3FU.cjs} +3 -3
  36. package/dist/{chunk-FKNZ3VFB.cjs.map → chunk-HTB3D3FU.cjs.map} +1 -1
  37. package/dist/chunk-KVHLLR67.cjs +3 -0
  38. package/dist/chunk-KVHLLR67.cjs.map +1 -0
  39. package/dist/{chunk-Z4MIX43O.cjs → chunk-NIDVZMKV.cjs} +2 -2
  40. package/dist/chunk-NIDVZMKV.cjs.map +1 -0
  41. package/dist/chunk-NW5MM3Q6.js +3 -0
  42. package/dist/chunk-NW5MM3Q6.js.map +1 -0
  43. package/dist/{chunk-T24WU3LV.js → chunk-QXZVDT54.js} +2 -2
  44. package/dist/{chunk-T24WU3LV.js.map → chunk-QXZVDT54.js.map} +1 -1
  45. package/dist/chunk-SXLHFK7M.cjs +2 -0
  46. package/dist/{chunk-NH74IT7B.cjs.map → chunk-SXLHFK7M.cjs.map} +1 -1
  47. package/dist/{chunk-OBQC7KDY.cjs → chunk-TIWNKFSD.cjs} +2 -2
  48. package/dist/{chunk-OBQC7KDY.cjs.map → chunk-TIWNKFSD.cjs.map} +1 -1
  49. package/dist/chunk-TSVKHY5E.js +2 -0
  50. package/dist/{chunk-A34R65WT.js.map → chunk-TSVKHY5E.js.map} +1 -1
  51. package/dist/chunk-U5PPRJ3B.cjs +2 -0
  52. package/dist/chunk-U5PPRJ3B.cjs.map +1 -0
  53. package/dist/chunk-VOWMVLVV.cjs +2 -0
  54. package/dist/chunk-VOWMVLVV.cjs.map +1 -0
  55. package/dist/{chunk-F3UM5JNL.cjs → chunk-VZ4FEVWA.cjs} +2 -2
  56. package/dist/{chunk-F3UM5JNL.cjs.map → chunk-VZ4FEVWA.cjs.map} +1 -1
  57. package/dist/{chunk-TFZNEEJR.js → chunk-XAKFFIMQ.js} +3 -3
  58. package/dist/{chunk-TFZNEEJR.js.map → chunk-XAKFFIMQ.js.map} +1 -1
  59. package/dist/constants.cjs +1 -1
  60. package/dist/constants.js +1 -1
  61. package/dist/engine.cjs +1 -1
  62. package/dist/engine.d.cts +7 -7
  63. package/dist/engine.d.ts +7 -7
  64. package/dist/engine.js +1 -1
  65. package/dist/engine.worker.cjs +1 -1
  66. package/dist/engine.worker.js +1 -1
  67. package/dist/format.cjs +1 -1
  68. package/dist/format.d.cts +1 -1
  69. package/dist/format.d.ts +1 -1
  70. package/dist/format.js +1 -1
  71. package/dist/index.cjs +1 -1
  72. package/dist/index.d.cts +7 -7
  73. package/dist/index.d.ts +7 -7
  74. package/dist/index.js +1 -1
  75. package/dist/language.d.cts +6 -6
  76. package/dist/language.d.ts +6 -6
  77. package/dist/packages.cjs +1 -1
  78. package/dist/packages.d.cts +5 -5
  79. package/dist/packages.d.ts +5 -5
  80. package/dist/packages.js +1 -1
  81. package/dist/parser.d.cts +3 -3
  82. package/dist/parser.d.ts +3 -3
  83. package/dist/{pipeline-CADMN2D1.d.ts → pipeline-CLegjVrf.d.ts} +1 -1
  84. package/dist/{pipeline-C1-CJnFJ.d.cts → pipeline-DKNPr6s8.d.cts} +1 -1
  85. package/dist/resolvers.d.cts +1 -1
  86. package/dist/resolvers.d.ts +1 -1
  87. package/dist/testing.cjs +2 -2
  88. package/dist/testing.d.cts +6 -6
  89. package/dist/testing.d.ts +6 -6
  90. package/dist/testing.js +1 -1
  91. package/dist/uom.cjs +1 -1
  92. package/dist/uom.d.cts +1 -1
  93. package/dist/uom.d.ts +1 -1
  94. package/dist/uom.js +1 -1
  95. package/dist/vm.cjs +1 -1
  96. package/dist/vm.d.cts +4 -4
  97. package/dist/vm.d.ts +4 -4
  98. package/dist/vm.js +1 -1
  99. package/dist/worker.cjs +2 -2
  100. package/dist/worker.d.cts +5 -5
  101. package/dist/worker.d.ts +5 -5
  102. package/dist/worker.js +1 -1
  103. package/package.json +1 -1
  104. package/dist/chunk-54QMY2VL.cjs +0 -2
  105. package/dist/chunk-54QMY2VL.cjs.map +0 -1
  106. package/dist/chunk-5TCSFTZD.js +0 -2
  107. package/dist/chunk-5TCSFTZD.js.map +0 -1
  108. package/dist/chunk-5TVI2UPZ.cjs +0 -2
  109. package/dist/chunk-5TVI2UPZ.cjs.map +0 -1
  110. package/dist/chunk-6FBXJYWO.cjs +0 -3
  111. package/dist/chunk-6FBXJYWO.cjs.map +0 -1
  112. package/dist/chunk-A34R65WT.js +0 -2
  113. package/dist/chunk-KSOB5FCI.js +0 -3
  114. package/dist/chunk-KSOB5FCI.js.map +0 -1
  115. package/dist/chunk-NH74IT7B.cjs +0 -2
  116. package/dist/chunk-QP4VIEXZ.js.map +0 -1
  117. package/dist/chunk-Y5ZY6DPX.cjs +0 -2
  118. package/dist/chunk-Y5ZY6DPX.cjs.map +0 -1
  119. package/dist/chunk-Z4MIX43O.cjs.map +0 -1
  120. package/dist/chunk-ZISAN7NW.js +0 -2
  121. package/dist/chunk-ZISAN7NW.js.map +0 -1
  122. package/dist/chunk-ZSFOIBIH.js.map +0 -1
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');var d="2.38.27";var m=d;var l={date:{maxOffsetYears:100,minOffsetYears:-100,defaultFormat:"YYYY-MM-DD",inputOrder:"auto",onAmbiguous:"refuse"},performance:{defaultCacheSize:2e3,maxDocumentLines:1e5},validation:{maxExpressionLength:2e3,maxComplexity:500,maxNestingDepth:50,autoBalanceParens:false},vm:{maxStackDepth:200,maxInstructions:5e4,maxCollectionSize:1e5,maxAllocatedElements:2e6,maxFunctionCalls:1e4,maxGoalSeekIterations:100},worker:{maxConcurrentWorkers:4,idleTimeoutMs:3e4,maxRetries:3,baseBackoffMs:1e3},diagnostic:{enabled:false,vmTraceEnabled:false},backgroundRefresh:{enabled:false},network:{enabled:true}};function n(s,e){return {date:{...s.date,...e.date},performance:{...s.performance,...e.performance},validation:{...s.validation,...e.validation},vm:{...s.vm,...e.vm},worker:{...s.worker,...e.worker},diagnostic:{...s.diagnostic,...e.diagnostic},backgroundRefresh:{...s.backgroundRefresh,...e.backgroundRefresh},network:{...s.network,...e.network}}}var c=class{constructor(e={}){this.config=n(l,e);}get(e){let o=e.split("."),t=this.config;for(let i of o)if(t&&typeof t=="object"&&i in t)t=t[i];else throw chunk6SYU4MH7_cjs.c.config("CONFIG_PATH_NOT_FOUND",`Configuration path not found: ${e}`,{path:e});return t}set(e,o){let t=e.split(".");if(t.length<2)throw chunk6SYU4MH7_cjs.c.config("INVALID_CONFIG_PATH",`Invalid path: ${e}. Must be in format 'section.property'`,{path:e});let i=t[0],u=t[1];if(!(i in this.config))throw chunk6SYU4MH7_cjs.c.config("CONFIG_SECTION_NOT_FOUND",`Configuration section not found: ${i}`,{section:i,path:e});let a=this.config[i];if(a&&typeof a=="object")a[u]=o;else throw chunk6SYU4MH7_cjs.c.config("CONFIG_PROPERTY_NOT_FOUND",`Configuration property not found: ${e}`,{path:e})}getConfig(){return n(this.config,{})}update(e){this.config=n(this.config,e);}reset(){this.config=n(l,{});}validate(){let e=[];return this.config.performance.maxDocumentLines>1e5&&e.push("maxDocumentLines cannot exceed 100,000"),this.config.date.maxOffsetYears>1e3&&e.push("maxOffsetYears cannot exceed 1000"),{valid:e.length===0,error:e.join("; "),warnings:[]}}};exports.a=m;exports.b=l;exports.c=n;exports.d=c;//# sourceMappingURL=chunk-F3UM5JNL.cjs.map
2
- //# sourceMappingURL=chunk-F3UM5JNL.cjs.map
1
+ 'use strict';var chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');var d="2.38.28";var m=d;var l={date:{maxOffsetYears:100,minOffsetYears:-100,defaultFormat:"YYYY-MM-DD",inputOrder:"auto",onAmbiguous:"refuse"},performance:{defaultCacheSize:2e3,maxDocumentLines:1e5},validation:{maxExpressionLength:2e3,maxComplexity:500,maxNestingDepth:50,autoBalanceParens:false},vm:{maxStackDepth:200,maxInstructions:5e4,maxCollectionSize:1e5,maxAllocatedElements:2e6,maxFunctionCalls:1e4,maxGoalSeekIterations:100},worker:{maxConcurrentWorkers:4,idleTimeoutMs:3e4,maxRetries:3,baseBackoffMs:1e3},diagnostic:{enabled:false,vmTraceEnabled:false},backgroundRefresh:{enabled:false},network:{enabled:true}};function n(s,e){return {date:{...s.date,...e.date},performance:{...s.performance,...e.performance},validation:{...s.validation,...e.validation},vm:{...s.vm,...e.vm},worker:{...s.worker,...e.worker},diagnostic:{...s.diagnostic,...e.diagnostic},backgroundRefresh:{...s.backgroundRefresh,...e.backgroundRefresh},network:{...s.network,...e.network}}}var c=class{constructor(e={}){this.config=n(l,e);}get(e){let o=e.split("."),t=this.config;for(let i of o)if(t&&typeof t=="object"&&i in t)t=t[i];else throw chunk6SYU4MH7_cjs.c.config("CONFIG_PATH_NOT_FOUND",`Configuration path not found: ${e}`,{path:e});return t}set(e,o){let t=e.split(".");if(t.length<2)throw chunk6SYU4MH7_cjs.c.config("INVALID_CONFIG_PATH",`Invalid path: ${e}. Must be in format 'section.property'`,{path:e});let i=t[0],u=t[1];if(!(i in this.config))throw chunk6SYU4MH7_cjs.c.config("CONFIG_SECTION_NOT_FOUND",`Configuration section not found: ${i}`,{section:i,path:e});let a=this.config[i];if(a&&typeof a=="object")a[u]=o;else throw chunk6SYU4MH7_cjs.c.config("CONFIG_PROPERTY_NOT_FOUND",`Configuration property not found: ${e}`,{path:e})}getConfig(){return n(this.config,{})}update(e){this.config=n(this.config,e);}reset(){this.config=n(l,{});}validate(){let e=[];return this.config.performance.maxDocumentLines>1e5&&e.push("maxDocumentLines cannot exceed 100,000"),this.config.date.maxOffsetYears>1e3&&e.push("maxOffsetYears cannot exceed 1000"),{valid:e.length===0,error:e.join("; "),warnings:[]}}};exports.a=m;exports.b=l;exports.c=n;exports.d=c;//# sourceMappingURL=chunk-VZ4FEVWA.cjs.map
2
+ //# sourceMappingURL=chunk-VZ4FEVWA.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/constants/version.ts","../src/constants/Configuration.ts"],"names":["version","ENGINE_VERSION","DEFAULT_CONFIG","mergeEngineConfig","base","override","ConfigManager","config","path","keys","current","key","ErrorFactory","value","section","property","sectionConfig","errors"],"mappings":"mEAEE,IAAAA,EAAW,SAAA,CCcN,IAAMC,EAAyBD,ECgb/B,IAAME,EAA+B,CACzC,IAAA,CAAM,CAIJ,cAAA,CAAgB,GAAA,CAChB,eAAgB,IAAA,CAChB,aAAA,CAAe,aACf,UAAA,CAAY,MAAA,CAIZ,YAAa,QACf,CAAA,CACA,YAAa,CAIX,gBAAA,CAAkB,IAalB,gBAAA,CAAkB,GACpB,EACC,UAAA,CAAY,CACV,oBAAqB,GAAA,CACrB,aAAA,CAAe,IACf,eAAA,CAAiB,EAAA,CACjB,kBAAmB,KACrB,CAAA,CACA,GAAI,CACF,aAAA,CAAe,IACf,eAAA,CAAiB,GAAA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A,MAAA,CAAOI,CAAAA,CAAqC,CAC1C,IAAA,CAAK,MAAA,CAASJ,EAAkB,IAAA,CAAK,MAAA,CAAQI,CAAM,EACrD,CAcA,OAAc,CACZ,IAAA,CAAK,OAASJ,CAAAA,CAAkBD,CAAAA,CAAgB,EAAE,EACpD,CAKA,QAAA,EAA6B,CAC3B,IAAMe,CAAAA,CAAmB,GAGzB,OAAI,IAAA,CAAK,OAAO,WAAA,CAAY,gBAAA,CAAmB,KAC7CA,CAAAA,CAAO,IAAA,CAAK,wCAAwC,CAAA,CAIlD,IAAA,CAAK,OAAO,IAAA,CAAK,cAAA,CAAiB,KACpCA,CAAAA,CAAO,IAAA,CAAK,mCAAmC,CAAA,CAG1C,CACL,MAAOA,CAAAA,CAAO,MAAA,GAAW,EACzB,KAAA,CAAOA,CAAAA,CAAO,KAAK,IAAI,CAAA,CACvB,SAAU,EACZ,CACF,CACF","file":"chunk-F3UM5JNL.cjs","sourcesContent":["{\n \"name\": \"solve-engine\",\n \"version\": \"2.38.27\",\n \"description\": \"An embeddable expression engine for natural-language calculations: units, currencies, percentages, dates and matrices, with the parsing and evaluation plumbing already built.\",\n \"keywords\": [\n \"expression-evaluator\",\n \"calculator\",\n \"bytecode-vm\",\n \"parser\",\n \"lexer\",\n \"dsl\",\n \"markdown\",\n \"obsidian\"\n ],\n \"license\": \"MIT\",\n \"author\": \"Liam Riddell\",\n \"homepage\": \"https://liamriddell.github.io/solve-engine/\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/LiamRiddell/solve-engine.git\",\n \"directory\": \"packages/engine\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/LiamRiddell/solve-engine/issues\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"files\": [\n \"dist\",\n \"LICENSE\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./engine\": {\n \"import\": {\n \"types\": \"./dist/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n },\n \"require\": {\n \"types\": \"./dist/engine.d.cts\",\n \"default\": \"./dist/engine.cjs\"\n }\n },\n \"./vm\": {\n \"import\": {\n \"types\": \"./dist/vm.d.ts\",\n \"default\": \"./dist/vm.js\"\n },\n \"require\": {\n \"types\": \"./dist/vm.d.cts\",\n \"default\": \"./dist/vm.cjs\"\n }\n },\n \"./format\": {\n \"import\": {\n \"types\": \"./dist/format.d.ts\",\n \"default\": \"./dist/format.js\"\n },\n \"require\": {\n \"types\": \"./dist/format.d.cts\",\n \"default\": \"./dist/format.cjs\"\n }\n },\n \"./language\": {\n \"import\": {\n \"types\": \"./dist/language.d.ts\",\n \"default\": \"./dist/language.js\"\n },\n \"require\": {\n \"types\": \"./dist/language.d.cts\",\n \"default\": \"./dist/language.cjs\"\n }\n },\n \"./packages\": {\n \"import\": {\n \"types\": \"./dist/packages.d.ts\",\n \"default\": \"./dist/packages.js\"\n },\n \"require\": {\n \"types\": \"./dist/packages.d.cts\",\n \"default\": \"./dist/packages.cjs\"\n }\n },\n \"./constants\": {\n \"import\": {\n \"types\": \"./dist/constants.d.ts\",\n \"default\": \"./dist/constants.js\"\n },\n \"require\": {\n \"types\": \"./dist/constants.d.cts\",\n \"default\": \"./dist/constants.cjs\"\n }\n },\n \"./lexer\": {\n \"import\": {\n \"types\": \"./dist/lexer.d.ts\",\n \"default\": \"./dist/lexer.js\"\n },\n \"require\": {\n \"types\": \"./dist/lexer.d.cts\",\n \"default\": \"./dist/lexer.cjs\"\n }\n },\n \"./parser\": {\n \"import\": {\n \"types\": \"./dist/parser.d.ts\",\n \"default\": \"./dist/parser.js\"\n },\n \"require\": {\n \"types\": \"./dist/parser.d.cts\",\n \"default\": \"./dist/parser.cjs\"\n }\n },\n \"./normalizer\": {\n \"import\": {\n \"types\": \"./dist/normalizer.d.ts\",\n \"default\": \"./dist/normalizer.js\"\n },\n \"require\": {\n \"types\": \"./dist/normalizer.d.cts\",\n \"default\": \"./dist/normalizer.cjs\"\n }\n },\n \"./resolvers\": {\n \"import\": {\n \"types\": \"./dist/resolvers.d.ts\",\n \"default\": \"./dist/resolvers.js\"\n },\n \"require\": {\n \"types\": \"./dist/resolvers.d.cts\",\n \"default\": \"./dist/resolvers.cjs\"\n }\n },\n \"./errors\": {\n \"import\": {\n \"types\": \"./dist/errors.d.ts\",\n \"default\": \"./dist/errors.js\"\n },\n \"require\": {\n \"types\": \"./dist/errors.d.cts\",\n \"default\": \"./dist/errors.cjs\"\n }\n },\n \"./utilities\": {\n \"import\": {\n \"types\": \"./dist/utilities.d.ts\",\n \"default\": \"./dist/utilities.js\"\n },\n \"require\": {\n \"types\": \"./dist/utilities.d.cts\",\n \"default\": \"./dist/utilities.cjs\"\n }\n },\n \"./uom\": {\n \"import\": {\n \"types\": \"./dist/uom.d.ts\",\n \"default\": \"./dist/uom.js\"\n },\n \"require\": {\n \"types\": \"./dist/uom.d.cts\",\n \"default\": \"./dist/uom.cjs\"\n }\n },\n \"./services\": {\n \"import\": {\n \"types\": \"./dist/services.d.ts\",\n \"default\": \"./dist/services.js\"\n },\n \"require\": {\n \"types\": \"./dist/services.d.cts\",\n \"default\": \"./dist/services.cjs\"\n }\n },\n \"./worker\": {\n \"import\": {\n \"types\": \"./dist/worker.d.ts\",\n \"default\": \"./dist/worker.js\"\n },\n \"require\": {\n \"types\": \"./dist/worker.d.cts\",\n \"default\": \"./dist/worker.cjs\"\n }\n },\n \"./engine-worker\": {\n \"import\": {\n \"types\": \"./dist/engine.worker.d.ts\",\n \"default\": \"./dist/engine.worker.js\"\n },\n \"require\": {\n \"types\": \"./dist/engine.worker.d.cts\",\n \"default\": \"./dist/engine.worker.cjs\"\n }\n },\n \"./testing\": {\n \"import\": {\n \"types\": \"./dist/testing.d.ts\",\n \"default\": \"./dist/testing.js\"\n },\n \"require\": {\n \"types\": \"./dist/testing.d.cts\",\n \"default\": \"./dist/testing.cjs\"\n }\n },\n \"./temporal\": {\n \"import\": {\n \"types\": \"./dist/temporal.d.ts\",\n \"default\": \"./dist/temporal.js\"\n },\n \"require\": {\n \"types\": \"./dist/temporal.d.cts\",\n \"default\": \"./dist/temporal.cjs\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"prepublishOnly\": \"npm run build && node ../../scripts/assert-publishable.mjs .\",\n \"dev\": \"tsup --watch\",\n \"test\": \"jest --config jest.config.cjs --no-coverage\",\n \"typecheck\": \"tsgo --noEmit --skipLibCheck\",\n \"typecheck:tsc\": \"tsc --noEmit --skipLibCheck\"\n },\n \"dependencies\": {\n \"@tanstack/query-core\": \"^5.102.8\"\n },\n \"devDependencies\": {\n \"@jest/globals\": \"^30.5.1\",\n \"@types/node\": \"^26.4.1\",\n \"convert\": \"^7.0.0\",\n \"jest\": \"^30.5.1\",\n \"temporal-polyfill\": \"1.0.4\",\n \"ts-jest\": \"^29.4.12\",\n \"tsup\": \"8.5.1\",\n \"typescript\": \"5.9.3\"\n },\n \"//sideEffects\": \"Load-bearing claim, not boilerplate. tsup's splitting emits bare chunk imports at the top of dist/index.js, and this field tells Rollup, webpack and Vite they may delete them, which esbuild reports as [ignored-bare-import] once per import during `npm run size`. The engine does have module-level work to lose: registerAllTokenTypes(), _PrecedenceParser.BP_TABLE and its cached token ids, and several process-wide registries. It is safe because every chunk doing that work is also imported for its bindings somewhere, so no bundler can drop it. That is a property of how tsup currently splits the code rather than a design guarantee, so `npm run smoke:bundled` (scripts/check-tree-shaking.mjs) proves it on every run of `npm run verify` instead of assuming it, and its header explains the two fixes if it ever stops holding.\",\n \"sideEffects\": false\n}\n","/**\n * The running engine's own semver version, sourced directly from this\n * package's package.json so it can never drift from what's actually\n * published. Exists so IEnginePackage.engineVersion range checks\n * (api/EngineVersionCompatibility.ts) have something real to check\n * against.\n */\nimport { version } from \"../../package.json\";\n\n/**\n * The running engine's version, taken from package.json.\n *\n * What a package's `engineVersion` range is checked against at registration.\n * A prerelease is compared by its coerced release version, so a 1.0.0 beta\n * satisfies `^1.0.0`. See `api/EngineVersionCompatibility.ts`.\n */\nexport const ENGINE_VERSION: string = version;\n","/**\n * Configuration Module for solve-js Engine\n * \n * This module provides the **single source of truth** for all engine configuration.\n * Every configurable aspect of the engine, from safety limits and performance\n * budgets to VM constraints and worker pool sizing, is defined here.\n * \n * ### Design principles\n * \n * 1. **Engine owns its config.** The engine defines its own config shape and defaults.\n * Consumers (e.g., the Obsidian plugin) pass partial overrides; all unspecified\n * fields fall back to `DEFAULT_CONFIG`.\n * \n * 2. **Self-documenting.** Every interface and field has descriptive JSDoc so the\n * config is understandable at a glance, whether you're using the engine as an\n * npm package or reading the source.\n * \n * 3. **Minimal consumer knowledge.** Consumers only need to pass `Partial<EngineConfig>`.\n * They don't need to replicate the full config shape, just the fields they\n * want to override.\n * \n * @module Configuration\n */\n\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n/**\n * A host's test for whether a calendar date is a public holiday, given the\n * `Date` for that day at local midnight. Return `true` to exclude it from\n * working-day arithmetic.\n */\nexport type HolidayPredicate = (date: Date) => boolean;\n\n/**\n * The host-supplied public-holiday calendar, in the same \"bring your own data\"\n * shape the stocks and weather packages already use for a host callback (see\n * `packages/stocks/StocksPackage.ts`): weekends are decidable from the date\n * alone, holidays are not, so they come from the host or not at all.\n *\n * Either a {@link HolidayPredicate}, for a host that computes holidays itself\n * (an existing library, a region rule), or an iterable of specific dates as\n * `YYYY-MM-DD` strings, epoch-millisecond numbers or `Date` objects, for a host\n * that just has a list. Resolved to one internal predicate by\n * `vm/HolidayCalendar.ts`'s `resolveHolidayPredicate()`.\n *\n * Left unset, working-day arithmetic skips weekends only, which is the honest\n * default: the engine excludes exactly the days it can prove are non-working.\n */\nexport type HolidayCalendar = HolidayPredicate | Iterable<string | number | Date>;\n\n/**\n * Date-related configuration.\n * Controls the bounds and formatting for date/time expression evaluation\n * (e.g., `today + 20 days`, `last monday`).\n */\n/**\n * How an ambiguous all-numeric date literal is read.\n *\n * - `'auto'`: by separator, the historic behaviour. A slash date is\n * day-first (`25/12/2023`), a hyphen date is month-first (`12-25-2023`)\n * unless its first group is four digits, which makes it ISO (`2023-12-25`).\n * - `'DMY'` / `'MDY'` / `'YMD'`: a fixed order for every numeric separator, so\n * a host can match its readers' locale. `'MDY'` is what lets a US reader's\n * `12/25/2023` parse, which `'auto'` refuses because the slash defaults to\n * day-first.\n * - `'locale'`: the order the reader's own machine writes dates in, asked of\n * `Intl` once per engine (see `calendar/HostLocale.ts`). Where that cannot\n * be answered, the engine reads dates exactly as `'auto'` does and reports\n * the fact through `ExpressionEngine.getDateReading()`, rather than guessing.\n * A host that is not the reader (a server rendering someone else's document)\n * names the reader instead, through {@link DateConfig.inputLocale}.\n *\n * Only ambiguous literals are affected. A spelled-out month (`March 9, 2024`)\n * is never ambiguous; nor is a hyphen literal with a four-digit leading group\n * (`2024-03-09`), which has no reading but year-month-day and is read as ISO\n * under every order, timestamp or not.\n */\nexport type DateInputOrder = 'auto' | 'locale' | 'DMY' | 'MDY' | 'YMD';\n\n/**\n * What a date-shaped numeric run the configured order cannot read does: report\n * the problem, or fall through to the arithmetic it is spelled like. See\n * {@link DateConfig.onAmbiguous}.\n */\nexport type DateAmbiguity = 'refuse' | 'arithmetic';\n\n/** Date-related engine configuration: offset limits, input order, holidays. */\nexport interface DateConfig {\n /**\n * The order an ambiguous all-numeric date literal is read in. Defaults to\n * `'auto'` (by separator, the historic behaviour). See {@link DateInputOrder}.\n */\n readonly inputOrder: DateInputOrder;\n /**\n * The BCP-47 tag `'locale'` reads the order from, `\"en-US\"` or `\"de-DE\"`.\n * Unset, the host machine is asked.\n *\n * Read ONLY when {@link inputOrder} is `'locale'`. Setting it beside any\n * other order changes no result: a field that quietly switched inference on\n * would make the predictable mistake a wrong reading rather than no change.\n * Its shape is checked wherever it is set, though, and a tag `Intl` refuses\n * (`\"en_US\"`, with an underscore) raises `DATE_INPUT_LOCALE_INVALID` at\n * construction, because a locale silently ignored is a date order silently\n * wrong.\n *\n * Deliberately separate from the engine's `locale` option, which is a\n * language (`'en' | 'de' | 'fr'`) and carries no region. Day/month order is a\n * region question: a bare `en` probes as month-first while a UK machine\n * resolves to `en-GB` and probes as day-first, so wiring the two together\n * would flip every existing British engine to month-first.\n */\n readonly inputLocale?: string;\n /**\n * What a date-shaped numeric run the resolved order cannot read does.\n * Defaults to `'refuse'`.\n *\n * - `'refuse'`: the line reports a structured Error value naming the\n * problem, DATE_ORDER_MISMATCH when another order would have read it and\n * DATE_NOT_A_CALENDAR_DAY when no order names a real day. `12/25/2026` on\n * a day-first engine says there is no month 25, rather than answering\n * 0.00.\n * - `'arithmetic'`: the run falls through to the division or subtraction it\n * is spelled like, which is what every version before this one did.\n * `12/25/2026` is 0.00 again, and `2026-02-29` is 1,995.\n *\n * The refusal is scoped to runs nobody writes as arithmetic: a two-step\n * chain ending in a four-digit denominator (`03/04/2026` as division is\n * 0.0004), and an ISO-shaped hyphen run. A four-digit LEADING group is\n * ordinary arithmetic (`1000/10/5` is 20, `1024/8/2` is 64) and is never\n * refused, and neither is a run whose groups are all one or two digits\n * (`12/13/14` stays 0.07), because a two-digit year is too weak a signal to\n * hang a refusal on.\n *\n * The one refusal this setting does not restore is the dot form\n * (`25.12.2026` under a month-first order): its only other outcome is a\n * parse error, and an error is not an answer.\n */\n readonly onAmbiguous: DateAmbiguity;\n /**\n * How far forward a date offset whose COST grows with the offset may reach,\n * in years. Enforced by `vm/VM.ts`'s `addBusinessDays()`.\n *\n * Bounds the walk, not the calendar. Every other date offset in the engine\n * is arithmetic on a Date field, so `today + 100000 days` costs exactly what\n * one day costs and needs no ceiling; workdays are the one offset that has\n * to step day by day, because which days are skipped depends on where each\n * step lands. `today + 100000000 workdays` therefore froze the host for\n * thirteen seconds inside a single ADD opcode (where `vm.maxInstructions`\n * cannot see it) and then answered \"Invalid Date\", and a trillion never\n * returned at all.\n *\n * Release hardening: this field was declared, documented as a \"safety\n * limit\", and read nowhere, so it bounded nothing. A limit a host can\n * configure and the engine ignores is worse than no limit, because it reads\n * as protection that is not there.\n */\n readonly maxOffsetYears: number;\n /** How far BACK the same walk may reach, in years, as a negative number. See {@link maxOffsetYears}. */\n readonly minOffsetYears: number;\n /** Default date string format for display (moment.js format string) */\n readonly defaultFormat: string;\n /**\n * Public-holiday calendar for working-day arithmetic (`N working days after\n * <date>`, `working days between <date> and <date>`, `<date> + N workdays`).\n * See {@link HolidayCalendar}.\n *\n * Optional and unset by default: with no calendar, working-day arithmetic\n * skips weekends only. A host that wants holidays excluded too supplies one\n * here (`new ExpressionEngine({ config: { date: { holidays } } })`), the\n * same way stocks and weather take a host data source. Threaded into the VM\n * by `engine/ExpressionEngine.ts` exactly as {@link maxOffsetYears} is,\n * because working-day math is a VM operation several grammar forms share, so\n * the calendar has to be one source the VM owns rather than per-package state\n * the VM cannot see.\n */\n readonly holidays?: HolidayCalendar;\n}\n\n/**\n * Performance-related configuration.\n * Controls caching, timeouts, and processing limits to prevent runaway\n * resource consumption on large documents.\n */\nexport interface PerformanceConfig {\n /**\n * Maximum number of entries in {@link ExpressionEngine}'s bytecode cache\n * (per-instance, keyed by expression text) before the oldest entry is\n * evicted. Raise this for documents with many distinct expressions if\n * repeated re-evaluation (e.g. scrolling) is re-parsing instead of\n * hitting cache, bug fix (release hardening pass): this field used to\n * be read nowhere; the cache size was a hardcoded, unconfigurable\n * constant. Note this does NOT bound {@link LineCache}, which has no\n * size limit of its own.\n */\n readonly defaultCacheSize: number;\n /**\n * Maximum lines a document may have for the engine to process it in one\n * pass. Enforced by `ExpressionEngine.parseDocument()` and by\n * `engine/DocumentModel.ts`'s `setDocument()`, the two entry points that\n * take a whole document.\n *\n * A document costs memory per line whatever each line says: a parsed line\n * record, a cache entry, a dependency-graph node. Two hundred thousand\n * lines of `1 + 1` therefore exhausted the heap and aborted the process\n * before any per-line limit had anything to object to, which is the same\n * shape of hole as an unbounded expression and needs the same kind of\n * ceiling. Refusing the document names the limit; a host that genuinely has\n * a larger one raises this field.\n *\n * Release hardening: declared and read nowhere until now.\n */\n readonly maxDocumentLines: number;\n}\n\n/**\n * Validation / safety-limit configuration.\n * Protects against runaway expressions that could cause excessive memory use\n * or stack overflow. These limits are checked during lexing and parsing.\n */\n/** Bounds on untrusted input: expression length and nesting depth. */\nexport interface ValidationConfig {\n /** Maximum expression length in characters. Prevents excessively long strings from entering the pipeline. */\n readonly maxExpressionLength: number;\n /** Maximum expression complexity score (`tokens + functionCalls×5 + nestingDepth×10`). Protects against deeply nested or combinatorially complex expressions. */\n readonly maxComplexity: number;\n /** Maximum parentheses nesting depth. Prevents stack overflow in the recursive-descent parser. */\n readonly maxNestingDepth: number;\n /**\n * Auto-balance unmatched parentheses by appending missing closing parens\n * or prepending missing opening parens. When disabled, unbalanced expressions\n * cause parse errors instead of being silently corrected.\n *\n * Disabled by default for strict parsing. Enable for forgiving user input\n * (e.g., chat-style calculators where users often omit closing parens).\n * Has zero overhead when disabled, the O(n) paren-count scan is skipped.\n */\n readonly autoBalanceParens: boolean;\n}\n\n/**\n * Worker pool configuration.\n * Controls the parallel execution workers used for batch evaluation.\n */\nexport interface WorkerConfig {\n /** Maximum number of concurrent Web Workers allowed */\n readonly maxConcurrentWorkers: number;\n /** Time (ms) a worker stays alive while idle before being terminated */\n readonly idleTimeoutMs: number;\n /** Maximum retry attempts for a failed worker operation */\n readonly maxRetries: number;\n /** Base backoff delay (ms) between retries (exponential backoff applied on top) */\n readonly baseBackoffMs: number;\n} /**\n * Diagnostic / telemetry configuration.\n * Controls the diagnostic event pipeline for profiling and debugging.\n * All diagnostics are disabled by default for maximum production performance.\n */\n export interface DiagnosticConfig {\n /** Master switch: enable the diagnostic pipeline (collectors receive events for all pipeline stages) */\n readonly enabled: boolean;\n /** Enable VM trace mode, emits per-opcode execution events (very verbose; disables some optimizations) */\n readonly vmTraceEnabled: boolean;\n }\n\n /**\n * Proactive background refresh of live async values.\n *\n * Off by default. When a live value (a stock quote, an FX rate) has gone\n * stale, today it only refetches on the next re-evaluation (a keystroke), so a\n * note left open silently ages. With this enabled, the engine drives a refetch\n * on each such value's own cadence (the resolver's `refetchIntervalMs`) for the\n * values currently on screen, and pushes the fresh result to the host through\n * the same event stream the pull path uses. It needs timers and a live editor\n * consuming that stream, so a headless or batch host leaves it off.\n */\n export interface BackgroundRefreshConfig {\n /** Master switch. When false, no timers run and every value refreshes only on re-evaluation. */\n readonly enabled: boolean;\n }\n\n /**\n * Whether the engine may reach the network at all.\n *\n * On by default, which is the historic behaviour: a city name or a currency\n * pair in a line fetches live data from a public endpoint as soon as the\n * line evaluates. A host embedding the engine somewhere that must not make\n * outbound requests (an offline document, a sandboxed evaluation, a tenant\n * with egress rules) switches it off here and gets the same engine with no\n * egress: every live-data form answers with a `NETWORK_DISABLED` error\n * naming the setting, instead of a request.\n *\n * The gate closes before any request is made. It stops every async\n * resolver a package registers (weather, currency, stocks, crypto,\n * knowledge, and any host-supplied one) unless the resolver declares\n * itself `local` (it reads engine state, never a network; the engine's own\n * global-variable resolver is the one built-in case). It also refuses the\n * result of a plugin function that returns a promise. That last case is a\n * boundary rather than a guarantee: such a function has already run by the\n * time the engine sees the promise, so a package that fetches inside a\n * plugin function rather than through an async resolver may still have\n * started its request. The documented shape for live data is the resolver\n * (`createQueryResolver`), which this gate stops cold.\n *\n * Rates a host primes by hand (`currencyExchangeService.primeRates`) keep\n * working with the network off, which is what an offline host with its own\n * rate table wants.\n */\n export interface NetworkConfig {\n /** Master switch. When false, no async resolver runs and no live value is fetched. */\n readonly enabled: boolean;\n }\n\n /**\n * Virtual Machine configuration.\n * Controls the internal bytecode VM that executes compiled expressions.\n */\n export interface VMConfig {\n /** Maximum stack depth (value slots) for VM execution, prevents stack overflow in recursive/pratt-parser generated bytecode */\n readonly maxStackDepth: number;\n /** Maximum opcodes executed per expression, halts runaway infinite loops */\n readonly maxInstructions: number;\n /**\n * Maximum elements a collection may be expanded to before `map`/`reduce`/\n * `sum`/`prod` will iterate it.\n *\n * A Range is stored as its two bounds and costs nothing until something\n * materializes it, at which point it becomes one Value per element. Twenty\n * characters (`sum(x, 1:100000000)`) therefore asked for a hundred million\n * of them, and neither `maxInstructions` nor `maxStackDepth` could see it:\n * the expansion happens inside a single opcode, so the instruction counter\n * is never consulted while it runs, and the elements never reach the value\n * stack. V8 aborted the whole process with \"Reached heap limit\", which a\n * host embedding the engine cannot catch.\n */\n readonly maxCollectionSize: number;\n /**\n * Maximum elements (collection Values, matrix cells) one evaluation may\n * materialize in total.\n *\n * `maxCollectionSize` above bounds a single collection. This bounds the sum\n * of everything an expression asks for, which is a different question and\n * the one that actually protects the host: two collections that are\n * individually legal are legal together, and an operation whose result is\n * the PRODUCT of two legal operands is bounded by neither of them. A matrix\n * multiply is exactly that shape, so three lines within every other limit\n * (`:a = map(1*x, 0:20000)`, `:b = transpose(a)`, `b * a`) asked for four\n * hundred million cells and aborted the process.\n *\n * Counted in elements rather than bytes, because a count is what a call\n * site has before it allocates. An element is 8 bytes as a numeric matrix\n * cell and closer to a hundred as a full Value, so the default is worth\n * roughly 16 MB of matrix or 200 MB of expanded collection: far past any\n * document and far short of what an editor cannot survive.\n */\n readonly maxAllocatedElements: number;\n /**\n * Maximum user-defined-function calls one evaluation may make in TOTAL,\n * however deeply or widely they nest.\n *\n * `maxFunctionRecursionDepth` bounds how DEEP calls nest and cannot see\n * how MANY there are, and those are different numbers. Twenty-two lines of\n * `f(n)(v) = f(n-1)(v) + f(n-1)(v)` reach a depth of only 22 against a\n * limit of 50, and make 2,097,152 calls doing it: a fatal heap abort in\n * under a second. `maxInstructions` cannot bound it either, because\n * `executeBytecode()` re-enters itself per call and each reentrant call\n * gets its OWN instruction count, so recursion refreshes its allowance on\n * the way in. This is the tally that does not refresh; see\n * `vm/AllocationBudget.ts`, which holds it for the same reason it holds\n * the element tally.\n *\n * Counted in calls rather than in the instructions they run, because the\n * call is the thing that multiplies: every call allocates a frame, its\n * arguments and its result whatever its body says.\n */\n readonly maxFunctionCalls: number;\n /**\n * Hard ceiling on how many bisection steps goal seek (`solve line N for\n * <var> = <target>`, see `packages/goalseek/`) may take before it gives up\n * with a structured error rather than continuing.\n *\n * Goal seek re-evaluates the target line's expression once per step while\n * narrowing an interval, and an untrusted document must never be able to\n * make that loop spin. `maxInstructions` bounds each individual\n * re-evaluation, but not how many of them the search performs, so this is\n * the tally that bounds the search itself, the same reason `maxFunctionCalls`\n * exists alongside `maxInstructions`. Bisection halves the interval every\n * step, so a hundred steps resolves an input to roughly one part in 2^100:\n * far past any precision a document needs, and a definite stop either way.\n */\n readonly maxGoalSeekIterations: number;\n }\n\n/**\n * Complete engine configuration.\n *\n * Every field has a default in `DEFAULT_CONFIG`. To customize, pass a\n * `Partial<EngineConfig>` when constructing `ExpressionEngine`. Only the\n * sections/fields you supply are overridden; all others use their defaults.\n *\n * @example\n * ```typescript\n * import { ExpressionEngine } from \"solve-js\";\n *\n * const engine = new ExpressionEngine({ config: {\n * validation: {\n * maxExpressionLength: 1000,\n * maxComplexity: 200,\n * },\n * // date, performance, vm, worker, diagnostic all use defaults\n * } });\n * ```\n */\nexport interface EngineConfig {\n /** Date/time expression evaluation bounds and formatting */\n readonly date: DateConfig;\n /** Performance budgets and cache sizing */\n readonly performance: PerformanceConfig;\n /** Safety limits for expression complexity */\n readonly validation: ValidationConfig;\n /** Internal bytecode VM configuration */\n readonly vm: VMConfig;\n /** Parallel worker pool configuration */\n readonly worker: WorkerConfig;\n /** Diagnostic pipeline configuration */\n readonly diagnostic: DiagnosticConfig;\n /** Proactive background refresh of live async values */\n readonly backgroundRefresh: BackgroundRefreshConfig;\n /** Whether live data may be fetched at all. See {@link NetworkConfig}. */\n readonly network: NetworkConfig;\n }\n\n/**\n * A partial {@link EngineConfig} override, one section at a time.\n *\n * Overrides are merged per section over {@link DEFAULT_CONFIG}, so you can set a\n * single field of one section (`{ validation: { maxExpressionLength: 1000 } }`)\n * and keep every other default in that section. A plain `Partial<EngineConfig>`\n * cannot express that, it demands a whole section object, which is why the\n * documented overrides never typechecked against it. This is the type the\n * constructor and {@link createEngine} accept.\n */\nexport type EngineConfigOverride = {\n readonly [K in keyof EngineConfig]?: Partial<EngineConfig[K]>;\n};\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: EngineConfig = {\n date: {\n // A century of workdays is about 26,000 steps, which is microseconds,\n // and past any offset a person means. The walk is what these bound; see\n // DateConfig above for why no other date offset needs a ceiling.\n maxOffsetYears: 100,\n minOffsetYears: -100,\n defaultFormat: 'YYYY-MM-DD',\n inputOrder: 'auto',\n // A date-shaped run no order can read reports the problem rather than\n // answering the fraction it is spelled like. See DateConfig.onAmbiguous\n // for the shapes this covers and the ones it deliberately does not.\n onAmbiguous: 'refuse',\n },\n performance: {\n // Preserves the effective cache size the hardcoded (now-removed)\n // BYTECODE_CACHE_MAX_ENTRIES constant had, so wiring this field up\n // doesn't silently shrink the default cache for existing consumers.\n defaultCacheSize: 2000,\n // Raised from the 10,000 this field was declared with, which was never\n // enforced and turned out to be under what this engine already supports:\n // its paging design is tested against a 20,000-line document\n // (`engine/PageManager.ts` and its spec) and its throughput benchmark\n // parses a 50,000-line one. Twice the largest of those, and the same\n // number `ConfigManager.validate()` already refuses to go above.\n //\n // Measured under a 256MB heap: setting a 100,000-line document costs\n // 64MB, evaluating every line of a 20,000-line one costs 106MB, and\n // 200,000 lines aborts the process before a single expression is looked\n // at. A host with a small heap should lower this; the ceiling is here to\n // stop the size that cannot work anywhere.\n maxDocumentLines: 100000,\n },\n validation: {\n maxExpressionLength: 2000,\n maxComplexity: 500,\n maxNestingDepth: 50,\n autoBalanceParens: false,\n },\n vm: {\n maxStackDepth: 200,\n maxInstructions: 50000,\n // Two orders of magnitude above anything a person types by hand (the\n // longest range in the test suite is 1000 elements) and small enough\n // that expanding it is measured in milliseconds rather than in whether\n // the host survives.\n maxCollectionSize: 100000,\n // Twenty times the single-collection ceiling above, so an expression may\n // legitimately handle a number of large collections, and two hundred\n // times below the allocation that took the process down.\n maxAllocatedElements: 2000000,\n // Six hundred times the largest call count any test or example makes\n // (five levels of composition is sixteen calls), and small enough that\n // the calls it does allow cost single-digit megabytes rather than the\n // heap. A document that needs more than ten thousand calls on one line\n // is doing something a calculator was not built for.\n maxFunctionCalls: 10000,\n // A hundred bisection steps resolve an input to one part in 2^100, far\n // finer than any document needs and a firm stop for an untrusted one. A\n // continuous, monotonic relationship converges in tens of steps, well\n // under this; hitting it means the target is unreachable or the\n // relationship is not the smooth one goal seek assumes.\n maxGoalSeekIterations: 100,\n },\n worker: {\n maxConcurrentWorkers: 4,\n idleTimeoutMs: 30000,\n maxRetries: 3,\n baseBackoffMs: 1000,\n },\n diagnostic: {\n enabled: false,\n vmTraceEnabled: false,\n },\n backgroundRefresh: {\n enabled: false,\n },\n network: {\n // On, because it is what every existing consumer gets today. A host that\n // must not make outbound requests turns it off; see NetworkConfig.\n enabled: true,\n },\n };\n\n/**\n * Merge a partial config override onto a base `EngineConfig`, section by\n * section, `{ ...base.section, ...override.section }` for each of the 8\n * top-level sections, not a single top-level spread.\n *\n * A shallow `{ ...base, ...override }` at the TOP level replaces an entire\n * section wholesale the moment a caller overrides even one field in it\n * (e.g. `{ performance: { defaultCacheSize: 500 } }` would silently drop\n * every other `performance.*` field back to `undefined`, not to its\n * default). This function exists specifically so every config consumer\n * shares one correct merge instead of each hand-rolling (and risking) its\n * own. `ConfigManager` and `ExpressionEngine` both call this rather than\n * either duplicating the section list or instantiating a whole\n * `ConfigManager` just to reuse its private merge logic.\n */\nexport function mergeEngineConfig(\n base: EngineConfig,\n override: EngineConfigOverride\n): EngineConfig {\n return {\n date: { ...base.date, ...override.date },\n performance: { ...base.performance, ...override.performance },\n validation: { ...base.validation, ...override.validation },\n vm: { ...base.vm, ...override.vm },\n worker: { ...base.worker, ...override.worker },\n diagnostic: { ...base.diagnostic, ...override.diagnostic },\n backgroundRefresh: { ...base.backgroundRefresh, ...override.backgroundRefresh },\n network: { ...base.network, ...override.network },\n };\n}\n\n/**\n * Configuration manager for engine settings\n *\n * @example\n * ```typescript\n * const configManager = new ConfigManager();\n * configManager.set('performance.defaultCacheSize', 2000);\n * const cacheSize = configManager.get('performance.defaultCacheSize');\n * ```\n */\nexport class ConfigManager {\n private config: EngineConfig;\n\n constructor(config: Partial<EngineConfig> = {}) {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, config);\n }\n\n /**\n * Get configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @returns Configuration value\n */\n get<T>(path: string): T {\n const keys = path.split('.');\n let current: unknown = this.config;\n\n for (const key of keys) {\n if (current && typeof current === 'object' && key in current) {\n current = (current as Record<string, unknown>)[key];\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PATH_NOT_FOUND\",\n `Configuration path not found: ${path}`,\n { path }\n );\n }\n }\n\n return current as T;\n }\n\n /**\n * Set configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @param value - New value\n */\n set<T>(path: string, value: T): void {\n const keys = path.split('.');\n if (keys.length < 2) {\n throw ErrorFactory.config(\n \"INVALID_CONFIG_PATH\",\n `Invalid path: ${path}. Must be in format 'section.property'`,\n { path }\n );\n }\n \n const section = keys[0];\n const property = keys[1];\n \n if (!(section in this.config)) {\n throw ErrorFactory.config(\n \"CONFIG_SECTION_NOT_FOUND\",\n `Configuration section not found: ${section}`,\n { section, path }\n );\n }\n \n const sectionConfig = this.config[section as keyof EngineConfig];\n if (sectionConfig && typeof sectionConfig === 'object') {\n (sectionConfig as unknown as Record<string, unknown>)[property] = value;\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PROPERTY_NOT_FOUND\",\n `Configuration property not found: ${path}`,\n { path }\n );\n }\n }\n\n /**\n * Get complete configuration.\n *\n * A detached copy, section objects included. A top-level spread would hand\n * the caller this manager's own section objects, so `getConfig().vm.x = 1`\n * would be an undeclared back door into {@link set}, bypassing its path\n * validation and reaching every later {@link get}.\n */\n getConfig(): EngineConfig {\n return mergeEngineConfig(this.config, {});\n }\n\n /**\n * Update multiple configuration values\n */\n update(config: Partial<EngineConfig>): void {\n this.config = mergeEngineConfig(this.config, config);\n }\n\n /**\n * Reset to default configuration.\n *\n * Goes through {@link mergeEngineConfig} for the same reason the constructor\n * does. A top-level `{ ...DEFAULT_CONFIG }` copies the six section\n * references, not the sections, so after a reset this manager's\n * `performance` object WAS `DEFAULT_CONFIG.performance` and the next\n * `set('performance.x', ...)` wrote into the module constant. That constant\n * is what every `ExpressionEngine` is built from, so one manager's reset\n * could change the cache size, instruction ceiling or allocation budget of\n * every engine constructed later in the process.\n */\n reset(): void {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, {});\n }\n\n /**\n * Validate configuration values\n */\n validate(): ValidationResult {\n const errors: string[] = [];\n\n // Validate performance config\n if (this.config.performance.maxDocumentLines > 100000) {\n errors.push('maxDocumentLines cannot exceed 100,000');\n }\n\n // Validate date config\n if (this.config.date.maxOffsetYears > 1000) {\n errors.push('maxOffsetYears cannot exceed 1000');\n }\n\n return {\n valid: errors.length === 0,\n error: errors.join('; '),\n warnings: []\n };\n }\n}\n\n/**\n * Result type for {@link ConfigManager.validate}.\n */\nexport interface ValidationResult {\n valid: boolean;\n error?: string;\n warnings?: string[];\n}\n\n"]}
1
+ {"version":3,"sources":["../package.json","../src/constants/version.ts","../src/constants/Configuration.ts"],"names":["version","ENGINE_VERSION","DEFAULT_CONFIG","mergeEngineConfig","base","override","ConfigManager","config","path","keys","current","key","ErrorFactory","value","section","property","sectionConfig","errors"],"mappings":"mEAEE,IAAAA,EAAW,SAAA,CCcN,IAAMC,EAAyBD,ECgb/B,IAAME,EAA+B,CACzC,IAAA,CAAM,CAIJ,cAAA,CAAgB,GAAA,CAChB,eAAgB,IAAA,CAChB,aAAA,CAAe,aACf,UAAA,CAAY,MAAA,CAIZ,YAAa,QACf,CAAA,CACA,YAAa,CAIX,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AA,KAElE,MAAMD,oBAAa,MAAA,CACjB,2BAAA,CACA,qCAAqCJ,CAAI,CAAA,CAAA,CACzC,CAAE,IAAA,CAAAA,CAAK,CACT,CAEJ,CAUA,WAA0B,CACxB,OAAOL,EAAkB,IAAA,CAAK,MAAA,CAAQ,EAAE,CAC1C,CAKA,MAAA,CAAOI,CAAAA,CAAqC,CAC1C,IAAA,CAAK,MAAA,CAASJ,EAAkB,IAAA,CAAK,MAAA,CAAQI,CAAM,EACrD,CAcA,OAAc,CACZ,IAAA,CAAK,OAASJ,CAAAA,CAAkBD,CAAAA,CAAgB,EAAE,EACpD,CAKA,QAAA,EAA6B,CAC3B,IAAMe,CAAAA,CAAmB,GAGzB,OAAI,IAAA,CAAK,OAAO,WAAA,CAAY,gBAAA,CAAmB,KAC7CA,CAAAA,CAAO,IAAA,CAAK,wCAAwC,CAAA,CAIlD,IAAA,CAAK,OAAO,IAAA,CAAK,cAAA,CAAiB,KACpCA,CAAAA,CAAO,IAAA,CAAK,mCAAmC,CAAA,CAG1C,CACL,MAAOA,CAAAA,CAAO,MAAA,GAAW,EACzB,KAAA,CAAOA,CAAAA,CAAO,KAAK,IAAI,CAAA,CACvB,SAAU,EACZ,CACF,CACF","file":"chunk-VZ4FEVWA.cjs","sourcesContent":["{\n \"name\": \"solve-engine\",\n \"version\": \"2.38.28\",\n \"description\": \"An embeddable expression engine for natural-language calculations: units, currencies, percentages, dates and matrices, with the parsing and evaluation plumbing already built.\",\n \"keywords\": [\n \"expression-evaluator\",\n \"calculator\",\n \"bytecode-vm\",\n \"parser\",\n \"lexer\",\n \"dsl\",\n \"markdown\",\n \"obsidian\"\n ],\n \"license\": \"MIT\",\n \"author\": \"Liam Riddell\",\n \"homepage\": \"https://liamriddell.github.io/solve-engine/\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/LiamRiddell/solve-engine.git\",\n \"directory\": \"packages/engine\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/LiamRiddell/solve-engine/issues\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"files\": [\n \"dist\",\n \"LICENSE\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./engine\": {\n \"import\": {\n \"types\": \"./dist/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n },\n \"require\": {\n \"types\": \"./dist/engine.d.cts\",\n \"default\": \"./dist/engine.cjs\"\n }\n },\n \"./vm\": {\n \"import\": {\n \"types\": \"./dist/vm.d.ts\",\n \"default\": \"./dist/vm.js\"\n },\n \"require\": {\n \"types\": \"./dist/vm.d.cts\",\n \"default\": \"./dist/vm.cjs\"\n }\n },\n \"./format\": {\n \"import\": {\n \"types\": \"./dist/format.d.ts\",\n \"default\": \"./dist/format.js\"\n },\n \"require\": {\n \"types\": \"./dist/format.d.cts\",\n \"default\": \"./dist/format.cjs\"\n }\n },\n \"./language\": {\n \"import\": {\n \"types\": \"./dist/language.d.ts\",\n \"default\": \"./dist/language.js\"\n },\n \"require\": {\n \"types\": \"./dist/language.d.cts\",\n \"default\": \"./dist/language.cjs\"\n }\n },\n \"./packages\": {\n \"import\": {\n \"types\": \"./dist/packages.d.ts\",\n \"default\": \"./dist/packages.js\"\n },\n \"require\": {\n \"types\": \"./dist/packages.d.cts\",\n \"default\": \"./dist/packages.cjs\"\n }\n },\n \"./constants\": {\n \"import\": {\n \"types\": \"./dist/constants.d.ts\",\n \"default\": \"./dist/constants.js\"\n },\n \"require\": {\n \"types\": \"./dist/constants.d.cts\",\n \"default\": \"./dist/constants.cjs\"\n }\n },\n \"./lexer\": {\n \"import\": {\n \"types\": \"./dist/lexer.d.ts\",\n \"default\": \"./dist/lexer.js\"\n },\n \"require\": {\n \"types\": \"./dist/lexer.d.cts\",\n \"default\": \"./dist/lexer.cjs\"\n }\n },\n \"./parser\": {\n \"import\": {\n \"types\": \"./dist/parser.d.ts\",\n \"default\": \"./dist/parser.js\"\n },\n \"require\": {\n \"types\": \"./dist/parser.d.cts\",\n \"default\": \"./dist/parser.cjs\"\n }\n },\n \"./normalizer\": {\n \"import\": {\n \"types\": \"./dist/normalizer.d.ts\",\n \"default\": \"./dist/normalizer.js\"\n },\n \"require\": {\n \"types\": \"./dist/normalizer.d.cts\",\n \"default\": \"./dist/normalizer.cjs\"\n }\n },\n \"./resolvers\": {\n \"import\": {\n \"types\": \"./dist/resolvers.d.ts\",\n \"default\": \"./dist/resolvers.js\"\n },\n \"require\": {\n \"types\": \"./dist/resolvers.d.cts\",\n \"default\": \"./dist/resolvers.cjs\"\n }\n },\n \"./errors\": {\n \"import\": {\n \"types\": \"./dist/errors.d.ts\",\n \"default\": \"./dist/errors.js\"\n },\n \"require\": {\n \"types\": \"./dist/errors.d.cts\",\n \"default\": \"./dist/errors.cjs\"\n }\n },\n \"./utilities\": {\n \"import\": {\n \"types\": \"./dist/utilities.d.ts\",\n \"default\": \"./dist/utilities.js\"\n },\n \"require\": {\n \"types\": \"./dist/utilities.d.cts\",\n \"default\": \"./dist/utilities.cjs\"\n }\n },\n \"./uom\": {\n \"import\": {\n \"types\": \"./dist/uom.d.ts\",\n \"default\": \"./dist/uom.js\"\n },\n \"require\": {\n \"types\": \"./dist/uom.d.cts\",\n \"default\": \"./dist/uom.cjs\"\n }\n },\n \"./services\": {\n \"import\": {\n \"types\": \"./dist/services.d.ts\",\n \"default\": \"./dist/services.js\"\n },\n \"require\": {\n \"types\": \"./dist/services.d.cts\",\n \"default\": \"./dist/services.cjs\"\n }\n },\n \"./worker\": {\n \"import\": {\n \"types\": \"./dist/worker.d.ts\",\n \"default\": \"./dist/worker.js\"\n },\n \"require\": {\n \"types\": \"./dist/worker.d.cts\",\n \"default\": \"./dist/worker.cjs\"\n }\n },\n \"./engine-worker\": {\n \"import\": {\n \"types\": \"./dist/engine.worker.d.ts\",\n \"default\": \"./dist/engine.worker.js\"\n },\n \"require\": {\n \"types\": \"./dist/engine.worker.d.cts\",\n \"default\": \"./dist/engine.worker.cjs\"\n }\n },\n \"./testing\": {\n \"import\": {\n \"types\": \"./dist/testing.d.ts\",\n \"default\": \"./dist/testing.js\"\n },\n \"require\": {\n \"types\": \"./dist/testing.d.cts\",\n \"default\": \"./dist/testing.cjs\"\n }\n },\n \"./temporal\": {\n \"import\": {\n \"types\": \"./dist/temporal.d.ts\",\n \"default\": \"./dist/temporal.js\"\n },\n \"require\": {\n \"types\": \"./dist/temporal.d.cts\",\n \"default\": \"./dist/temporal.cjs\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"prepublishOnly\": \"npm run build && node ../../scripts/assert-publishable.mjs .\",\n \"dev\": \"tsup --watch\",\n \"test\": \"jest --config jest.config.cjs --no-coverage\",\n \"typecheck\": \"tsgo --noEmit --skipLibCheck\",\n \"typecheck:tsc\": \"tsc --noEmit --skipLibCheck\"\n },\n \"dependencies\": {\n \"@tanstack/query-core\": \"^5.102.8\"\n },\n \"devDependencies\": {\n \"@jest/globals\": \"^30.5.1\",\n \"@types/node\": \"^26.4.1\",\n \"convert\": \"^7.0.0\",\n \"jest\": \"^30.5.1\",\n \"temporal-polyfill\": \"1.0.4\",\n \"ts-jest\": \"^29.4.12\",\n \"tsup\": \"8.5.1\",\n \"typescript\": \"5.9.3\"\n },\n \"//sideEffects\": \"Load-bearing claim, not boilerplate. tsup's splitting emits bare chunk imports at the top of dist/index.js, and this field tells Rollup, webpack and Vite they may delete them, which esbuild reports as [ignored-bare-import] once per import during `npm run size`. The engine does have module-level work to lose: registerAllTokenTypes(), _PrecedenceParser.BP_TABLE and its cached token ids, and several process-wide registries. It is safe because every chunk doing that work is also imported for its bindings somewhere, so no bundler can drop it. That is a property of how tsup currently splits the code rather than a design guarantee, so `npm run smoke:bundled` (scripts/check-tree-shaking.mjs) proves it on every run of `npm run verify` instead of assuming it, and its header explains the two fixes if it ever stops holding.\",\n \"sideEffects\": false\n}\n","/**\n * The running engine's own semver version, sourced directly from this\n * package's package.json so it can never drift from what's actually\n * published. Exists so IEnginePackage.engineVersion range checks\n * (api/EngineVersionCompatibility.ts) have something real to check\n * against.\n */\nimport { version } from \"../../package.json\";\n\n/**\n * The running engine's version, taken from package.json.\n *\n * What a package's `engineVersion` range is checked against at registration.\n * A prerelease is compared by its coerced release version, so a 1.0.0 beta\n * satisfies `^1.0.0`. See `api/EngineVersionCompatibility.ts`.\n */\nexport const ENGINE_VERSION: string = version;\n","/**\n * Configuration Module for solve-js Engine\n * \n * This module provides the **single source of truth** for all engine configuration.\n * Every configurable aspect of the engine, from safety limits and performance\n * budgets to VM constraints and worker pool sizing, is defined here.\n * \n * ### Design principles\n * \n * 1. **Engine owns its config.** The engine defines its own config shape and defaults.\n * Consumers (e.g., the Obsidian plugin) pass partial overrides; all unspecified\n * fields fall back to `DEFAULT_CONFIG`.\n * \n * 2. **Self-documenting.** Every interface and field has descriptive JSDoc so the\n * config is understandable at a glance, whether you're using the engine as an\n * npm package or reading the source.\n * \n * 3. **Minimal consumer knowledge.** Consumers only need to pass `Partial<EngineConfig>`.\n * They don't need to replicate the full config shape, just the fields they\n * want to override.\n * \n * @module Configuration\n */\n\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n/**\n * A host's test for whether a calendar date is a public holiday, given the\n * `Date` for that day at local midnight. Return `true` to exclude it from\n * working-day arithmetic.\n */\nexport type HolidayPredicate = (date: Date) => boolean;\n\n/**\n * The host-supplied public-holiday calendar, in the same \"bring your own data\"\n * shape the stocks and weather packages already use for a host callback (see\n * `packages/stocks/StocksPackage.ts`): weekends are decidable from the date\n * alone, holidays are not, so they come from the host or not at all.\n *\n * Either a {@link HolidayPredicate}, for a host that computes holidays itself\n * (an existing library, a region rule), or an iterable of specific dates as\n * `YYYY-MM-DD` strings, epoch-millisecond numbers or `Date` objects, for a host\n * that just has a list. Resolved to one internal predicate by\n * `vm/HolidayCalendar.ts`'s `resolveHolidayPredicate()`.\n *\n * Left unset, working-day arithmetic skips weekends only, which is the honest\n * default: the engine excludes exactly the days it can prove are non-working.\n */\nexport type HolidayCalendar = HolidayPredicate | Iterable<string | number | Date>;\n\n/**\n * Date-related configuration.\n * Controls the bounds and formatting for date/time expression evaluation\n * (e.g., `today + 20 days`, `last monday`).\n */\n/**\n * How an ambiguous all-numeric date literal is read.\n *\n * - `'auto'`: by separator, the historic behaviour. A slash date is\n * day-first (`25/12/2023`), a hyphen date is month-first (`12-25-2023`)\n * unless its first group is four digits, which makes it ISO (`2023-12-25`).\n * - `'DMY'` / `'MDY'` / `'YMD'`: a fixed order for every numeric separator, so\n * a host can match its readers' locale. `'MDY'` is what lets a US reader's\n * `12/25/2023` parse, which `'auto'` refuses because the slash defaults to\n * day-first.\n * - `'locale'`: the order the reader's own machine writes dates in, asked of\n * `Intl` once per engine (see `calendar/HostLocale.ts`). Where that cannot\n * be answered, the engine reads dates exactly as `'auto'` does and reports\n * the fact through `ExpressionEngine.getDateReading()`, rather than guessing.\n * A host that is not the reader (a server rendering someone else's document)\n * names the reader instead, through {@link DateConfig.inputLocale}.\n *\n * Only ambiguous literals are affected. A spelled-out month (`March 9, 2024`)\n * is never ambiguous; nor is a hyphen literal with a four-digit leading group\n * (`2024-03-09`), which has no reading but year-month-day and is read as ISO\n * under every order, timestamp or not.\n */\nexport type DateInputOrder = 'auto' | 'locale' | 'DMY' | 'MDY' | 'YMD';\n\n/**\n * What a date-shaped numeric run the configured order cannot read does: report\n * the problem, or fall through to the arithmetic it is spelled like. See\n * {@link DateConfig.onAmbiguous}.\n */\nexport type DateAmbiguity = 'refuse' | 'arithmetic';\n\n/** Date-related engine configuration: offset limits, input order, holidays. */\nexport interface DateConfig {\n /**\n * The order an ambiguous all-numeric date literal is read in. Defaults to\n * `'auto'` (by separator, the historic behaviour). See {@link DateInputOrder}.\n */\n readonly inputOrder: DateInputOrder;\n /**\n * The BCP-47 tag `'locale'` reads the order from, `\"en-US\"` or `\"de-DE\"`.\n * Unset, the host machine is asked.\n *\n * Read ONLY when {@link inputOrder} is `'locale'`. Setting it beside any\n * other order changes no result: a field that quietly switched inference on\n * would make the predictable mistake a wrong reading rather than no change.\n * Its shape is checked wherever it is set, though, and a tag `Intl` refuses\n * (`\"en_US\"`, with an underscore) raises `DATE_INPUT_LOCALE_INVALID` at\n * construction, because a locale silently ignored is a date order silently\n * wrong.\n *\n * Deliberately separate from the engine's `locale` option, which is a\n * language (`'en' | 'de' | 'fr'`) and carries no region. Day/month order is a\n * region question: a bare `en` probes as month-first while a UK machine\n * resolves to `en-GB` and probes as day-first, so wiring the two together\n * would flip every existing British engine to month-first.\n */\n readonly inputLocale?: string;\n /**\n * What a date-shaped numeric run the resolved order cannot read does.\n * Defaults to `'refuse'`.\n *\n * - `'refuse'`: the line reports a structured Error value naming the\n * problem, DATE_ORDER_MISMATCH when another order would have read it and\n * DATE_NOT_A_CALENDAR_DAY when no order names a real day. `12/25/2026` on\n * a day-first engine says there is no month 25, rather than answering\n * 0.00.\n * - `'arithmetic'`: the run falls through to the division or subtraction it\n * is spelled like, which is what every version before this one did.\n * `12/25/2026` is 0.00 again, and `2026-02-29` is 1,995.\n *\n * The refusal is scoped to runs nobody writes as arithmetic: a two-step\n * chain ending in a four-digit denominator (`03/04/2026` as division is\n * 0.0004), and an ISO-shaped hyphen run. A four-digit LEADING group is\n * ordinary arithmetic (`1000/10/5` is 20, `1024/8/2` is 64) and is never\n * refused, and neither is a run whose groups are all one or two digits\n * (`12/13/14` stays 0.07), because a two-digit year is too weak a signal to\n * hang a refusal on.\n *\n * The one refusal this setting does not restore is the dot form\n * (`25.12.2026` under a month-first order): its only other outcome is a\n * parse error, and an error is not an answer.\n */\n readonly onAmbiguous: DateAmbiguity;\n /**\n * How far forward a date offset whose COST grows with the offset may reach,\n * in years. Enforced by `vm/VM.ts`'s `addBusinessDays()`.\n *\n * Bounds the walk, not the calendar. Every other date offset in the engine\n * is arithmetic on a Date field, so `today + 100000 days` costs exactly what\n * one day costs and needs no ceiling; workdays are the one offset that has\n * to step day by day, because which days are skipped depends on where each\n * step lands. `today + 100000000 workdays` therefore froze the host for\n * thirteen seconds inside a single ADD opcode (where `vm.maxInstructions`\n * cannot see it) and then answered \"Invalid Date\", and a trillion never\n * returned at all.\n *\n * Release hardening: this field was declared, documented as a \"safety\n * limit\", and read nowhere, so it bounded nothing. A limit a host can\n * configure and the engine ignores is worse than no limit, because it reads\n * as protection that is not there.\n */\n readonly maxOffsetYears: number;\n /** How far BACK the same walk may reach, in years, as a negative number. See {@link maxOffsetYears}. */\n readonly minOffsetYears: number;\n /** Default date string format for display (moment.js format string) */\n readonly defaultFormat: string;\n /**\n * Public-holiday calendar for working-day arithmetic (`N working days after\n * <date>`, `working days between <date> and <date>`, `<date> + N workdays`).\n * See {@link HolidayCalendar}.\n *\n * Optional and unset by default: with no calendar, working-day arithmetic\n * skips weekends only. A host that wants holidays excluded too supplies one\n * here (`new ExpressionEngine({ config: { date: { holidays } } })`), the\n * same way stocks and weather take a host data source. Threaded into the VM\n * by `engine/ExpressionEngine.ts` exactly as {@link maxOffsetYears} is,\n * because working-day math is a VM operation several grammar forms share, so\n * the calendar has to be one source the VM owns rather than per-package state\n * the VM cannot see.\n */\n readonly holidays?: HolidayCalendar;\n}\n\n/**\n * Performance-related configuration.\n * Controls caching, timeouts, and processing limits to prevent runaway\n * resource consumption on large documents.\n */\nexport interface PerformanceConfig {\n /**\n * Maximum number of entries in {@link ExpressionEngine}'s bytecode cache\n * (per-instance, keyed by expression text) before the oldest entry is\n * evicted. Raise this for documents with many distinct expressions if\n * repeated re-evaluation (e.g. scrolling) is re-parsing instead of\n * hitting cache, bug fix (release hardening pass): this field used to\n * be read nowhere; the cache size was a hardcoded, unconfigurable\n * constant. Note this does NOT bound {@link LineCache}, which has no\n * size limit of its own.\n */\n readonly defaultCacheSize: number;\n /**\n * Maximum lines a document may have for the engine to process it in one\n * pass. Enforced by `ExpressionEngine.parseDocument()` and by\n * `engine/DocumentModel.ts`'s `setDocument()`, the two entry points that\n * take a whole document.\n *\n * A document costs memory per line whatever each line says: a parsed line\n * record, a cache entry, a dependency-graph node. Two hundred thousand\n * lines of `1 + 1` therefore exhausted the heap and aborted the process\n * before any per-line limit had anything to object to, which is the same\n * shape of hole as an unbounded expression and needs the same kind of\n * ceiling. Refusing the document names the limit; a host that genuinely has\n * a larger one raises this field.\n *\n * Release hardening: declared and read nowhere until now.\n */\n readonly maxDocumentLines: number;\n}\n\n/**\n * Validation / safety-limit configuration.\n * Protects against runaway expressions that could cause excessive memory use\n * or stack overflow. These limits are checked during lexing and parsing.\n */\n/** Bounds on untrusted input: expression length and nesting depth. */\nexport interface ValidationConfig {\n /** Maximum expression length in characters. Prevents excessively long strings from entering the pipeline. */\n readonly maxExpressionLength: number;\n /** Maximum expression complexity score (`tokens + functionCalls×5 + nestingDepth×10`). Protects against deeply nested or combinatorially complex expressions. */\n readonly maxComplexity: number;\n /** Maximum parentheses nesting depth. Prevents stack overflow in the recursive-descent parser. */\n readonly maxNestingDepth: number;\n /**\n * Auto-balance unmatched parentheses by appending missing closing parens\n * or prepending missing opening parens. When disabled, unbalanced expressions\n * cause parse errors instead of being silently corrected.\n *\n * Disabled by default for strict parsing. Enable for forgiving user input\n * (e.g., chat-style calculators where users often omit closing parens).\n * Has zero overhead when disabled, the O(n) paren-count scan is skipped.\n */\n readonly autoBalanceParens: boolean;\n}\n\n/**\n * Worker pool configuration.\n * Controls the parallel execution workers used for batch evaluation.\n */\nexport interface WorkerConfig {\n /** Maximum number of concurrent Web Workers allowed */\n readonly maxConcurrentWorkers: number;\n /** Time (ms) a worker stays alive while idle before being terminated */\n readonly idleTimeoutMs: number;\n /** Maximum retry attempts for a failed worker operation */\n readonly maxRetries: number;\n /** Base backoff delay (ms) between retries (exponential backoff applied on top) */\n readonly baseBackoffMs: number;\n} /**\n * Diagnostic / telemetry configuration.\n * Controls the diagnostic event pipeline for profiling and debugging.\n * All diagnostics are disabled by default for maximum production performance.\n */\n export interface DiagnosticConfig {\n /** Master switch: enable the diagnostic pipeline (collectors receive events for all pipeline stages) */\n readonly enabled: boolean;\n /** Enable VM trace mode, emits per-opcode execution events (very verbose; disables some optimizations) */\n readonly vmTraceEnabled: boolean;\n }\n\n /**\n * Proactive background refresh of live async values.\n *\n * Off by default. When a live value (a stock quote, an FX rate) has gone\n * stale, today it only refetches on the next re-evaluation (a keystroke), so a\n * note left open silently ages. With this enabled, the engine drives a refetch\n * on each such value's own cadence (the resolver's `refetchIntervalMs`) for the\n * values currently on screen, and pushes the fresh result to the host through\n * the same event stream the pull path uses. It needs timers and a live editor\n * consuming that stream, so a headless or batch host leaves it off.\n */\n export interface BackgroundRefreshConfig {\n /** Master switch. When false, no timers run and every value refreshes only on re-evaluation. */\n readonly enabled: boolean;\n }\n\n /**\n * Whether the engine may reach the network at all.\n *\n * On by default, which is the historic behaviour: a city name or a currency\n * pair in a line fetches live data from a public endpoint as soon as the\n * line evaluates. A host embedding the engine somewhere that must not make\n * outbound requests (an offline document, a sandboxed evaluation, a tenant\n * with egress rules) switches it off here and gets the same engine with no\n * egress: every live-data form answers with a `NETWORK_DISABLED` error\n * naming the setting, instead of a request.\n *\n * The gate closes before any request is made. It stops every async\n * resolver a package registers (weather, currency, stocks, crypto,\n * knowledge, and any host-supplied one) unless the resolver declares\n * itself `local` (it reads engine state, never a network; the engine's own\n * global-variable resolver is the one built-in case). It also refuses the\n * result of a plugin function that returns a promise. That last case is a\n * boundary rather than a guarantee: such a function has already run by the\n * time the engine sees the promise, so a package that fetches inside a\n * plugin function rather than through an async resolver may still have\n * started its request. The documented shape for live data is the resolver\n * (`createQueryResolver`), which this gate stops cold.\n *\n * Rates a host primes by hand (`currencyExchangeService.primeRates`) keep\n * working with the network off, which is what an offline host with its own\n * rate table wants.\n */\n export interface NetworkConfig {\n /** Master switch. When false, no async resolver runs and no live value is fetched. */\n readonly enabled: boolean;\n }\n\n /**\n * Virtual Machine configuration.\n * Controls the internal bytecode VM that executes compiled expressions.\n */\n export interface VMConfig {\n /** Maximum stack depth (value slots) for VM execution, prevents stack overflow in recursive/pratt-parser generated bytecode */\n readonly maxStackDepth: number;\n /** Maximum opcodes executed per expression, halts runaway infinite loops */\n readonly maxInstructions: number;\n /**\n * Maximum elements a collection may be expanded to before `map`/`reduce`/\n * `sum`/`prod` will iterate it.\n *\n * A Range is stored as its two bounds and costs nothing until something\n * materializes it, at which point it becomes one Value per element. Twenty\n * characters (`sum(x, 1:100000000)`) therefore asked for a hundred million\n * of them, and neither `maxInstructions` nor `maxStackDepth` could see it:\n * the expansion happens inside a single opcode, so the instruction counter\n * is never consulted while it runs, and the elements never reach the value\n * stack. V8 aborted the whole process with \"Reached heap limit\", which a\n * host embedding the engine cannot catch.\n */\n readonly maxCollectionSize: number;\n /**\n * Maximum elements (collection Values, matrix cells) one evaluation may\n * materialize in total.\n *\n * `maxCollectionSize` above bounds a single collection. This bounds the sum\n * of everything an expression asks for, which is a different question and\n * the one that actually protects the host: two collections that are\n * individually legal are legal together, and an operation whose result is\n * the PRODUCT of two legal operands is bounded by neither of them. A matrix\n * multiply is exactly that shape, so three lines within every other limit\n * (`:a = map(1*x, 0:20000)`, `:b = transpose(a)`, `b * a`) asked for four\n * hundred million cells and aborted the process.\n *\n * Counted in elements rather than bytes, because a count is what a call\n * site has before it allocates. An element is 8 bytes as a numeric matrix\n * cell and closer to a hundred as a full Value, so the default is worth\n * roughly 16 MB of matrix or 200 MB of expanded collection: far past any\n * document and far short of what an editor cannot survive.\n */\n readonly maxAllocatedElements: number;\n /**\n * Maximum user-defined-function calls one evaluation may make in TOTAL,\n * however deeply or widely they nest.\n *\n * `maxFunctionRecursionDepth` bounds how DEEP calls nest and cannot see\n * how MANY there are, and those are different numbers. Twenty-two lines of\n * `f(n)(v) = f(n-1)(v) + f(n-1)(v)` reach a depth of only 22 against a\n * limit of 50, and make 2,097,152 calls doing it: a fatal heap abort in\n * under a second. `maxInstructions` cannot bound it either, because\n * `executeBytecode()` re-enters itself per call and each reentrant call\n * gets its OWN instruction count, so recursion refreshes its allowance on\n * the way in. This is the tally that does not refresh; see\n * `vm/AllocationBudget.ts`, which holds it for the same reason it holds\n * the element tally.\n *\n * Counted in calls rather than in the instructions they run, because the\n * call is the thing that multiplies: every call allocates a frame, its\n * arguments and its result whatever its body says.\n */\n readonly maxFunctionCalls: number;\n /**\n * Hard ceiling on how many bisection steps goal seek (`solve line N for\n * <var> = <target>`, see `packages/goalseek/`) may take before it gives up\n * with a structured error rather than continuing.\n *\n * Goal seek re-evaluates the target line's expression once per step while\n * narrowing an interval, and an untrusted document must never be able to\n * make that loop spin. `maxInstructions` bounds each individual\n * re-evaluation, but not how many of them the search performs, so this is\n * the tally that bounds the search itself, the same reason `maxFunctionCalls`\n * exists alongside `maxInstructions`. Bisection halves the interval every\n * step, so a hundred steps resolves an input to roughly one part in 2^100:\n * far past any precision a document needs, and a definite stop either way.\n */\n readonly maxGoalSeekIterations: number;\n }\n\n/**\n * Complete engine configuration.\n *\n * Every field has a default in `DEFAULT_CONFIG`. To customize, pass a\n * `Partial<EngineConfig>` when constructing `ExpressionEngine`. Only the\n * sections/fields you supply are overridden; all others use their defaults.\n *\n * @example\n * ```typescript\n * import { ExpressionEngine } from \"solve-js\";\n *\n * const engine = new ExpressionEngine({ config: {\n * validation: {\n * maxExpressionLength: 1000,\n * maxComplexity: 200,\n * },\n * // date, performance, vm, worker, diagnostic all use defaults\n * } });\n * ```\n */\nexport interface EngineConfig {\n /** Date/time expression evaluation bounds and formatting */\n readonly date: DateConfig;\n /** Performance budgets and cache sizing */\n readonly performance: PerformanceConfig;\n /** Safety limits for expression complexity */\n readonly validation: ValidationConfig;\n /** Internal bytecode VM configuration */\n readonly vm: VMConfig;\n /** Parallel worker pool configuration */\n readonly worker: WorkerConfig;\n /** Diagnostic pipeline configuration */\n readonly diagnostic: DiagnosticConfig;\n /** Proactive background refresh of live async values */\n readonly backgroundRefresh: BackgroundRefreshConfig;\n /** Whether live data may be fetched at all. See {@link NetworkConfig}. */\n readonly network: NetworkConfig;\n }\n\n/**\n * A partial {@link EngineConfig} override, one section at a time.\n *\n * Overrides are merged per section over {@link DEFAULT_CONFIG}, so you can set a\n * single field of one section (`{ validation: { maxExpressionLength: 1000 } }`)\n * and keep every other default in that section. A plain `Partial<EngineConfig>`\n * cannot express that, it demands a whole section object, which is why the\n * documented overrides never typechecked against it. This is the type the\n * constructor and {@link createEngine} accept.\n */\nexport type EngineConfigOverride = {\n readonly [K in keyof EngineConfig]?: Partial<EngineConfig[K]>;\n};\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: EngineConfig = {\n date: {\n // A century of workdays is about 26,000 steps, which is microseconds,\n // and past any offset a person means. The walk is what these bound; see\n // DateConfig above for why no other date offset needs a ceiling.\n maxOffsetYears: 100,\n minOffsetYears: -100,\n defaultFormat: 'YYYY-MM-DD',\n inputOrder: 'auto',\n // A date-shaped run no order can read reports the problem rather than\n // answering the fraction it is spelled like. See DateConfig.onAmbiguous\n // for the shapes this covers and the ones it deliberately does not.\n onAmbiguous: 'refuse',\n },\n performance: {\n // Preserves the effective cache size the hardcoded (now-removed)\n // BYTECODE_CACHE_MAX_ENTRIES constant had, so wiring this field up\n // doesn't silently shrink the default cache for existing consumers.\n defaultCacheSize: 2000,\n // Raised from the 10,000 this field was declared with, which was never\n // enforced and turned out to be under what this engine already supports:\n // its paging design is tested against a 20,000-line document\n // (`engine/PageManager.ts` and its spec) and its throughput benchmark\n // parses a 50,000-line one. Twice the largest of those, and the same\n // number `ConfigManager.validate()` already refuses to go above.\n //\n // Measured under a 256MB heap: setting a 100,000-line document costs\n // 64MB, evaluating every line of a 20,000-line one costs 106MB, and\n // 200,000 lines aborts the process before a single expression is looked\n // at. A host with a small heap should lower this; the ceiling is here to\n // stop the size that cannot work anywhere.\n maxDocumentLines: 100000,\n },\n validation: {\n maxExpressionLength: 2000,\n maxComplexity: 500,\n maxNestingDepth: 50,\n autoBalanceParens: false,\n },\n vm: {\n maxStackDepth: 200,\n maxInstructions: 50000,\n // Two orders of magnitude above anything a person types by hand (the\n // longest range in the test suite is 1000 elements) and small enough\n // that expanding it is measured in milliseconds rather than in whether\n // the host survives.\n maxCollectionSize: 100000,\n // Twenty times the single-collection ceiling above, so an expression may\n // legitimately handle a number of large collections, and two hundred\n // times below the allocation that took the process down.\n maxAllocatedElements: 2000000,\n // Six hundred times the largest call count any test or example makes\n // (five levels of composition is sixteen calls), and small enough that\n // the calls it does allow cost single-digit megabytes rather than the\n // heap. A document that needs more than ten thousand calls on one line\n // is doing something a calculator was not built for.\n maxFunctionCalls: 10000,\n // A hundred bisection steps resolve an input to one part in 2^100, far\n // finer than any document needs and a firm stop for an untrusted one. A\n // continuous, monotonic relationship converges in tens of steps, well\n // under this; hitting it means the target is unreachable or the\n // relationship is not the smooth one goal seek assumes.\n maxGoalSeekIterations: 100,\n },\n worker: {\n maxConcurrentWorkers: 4,\n idleTimeoutMs: 30000,\n maxRetries: 3,\n baseBackoffMs: 1000,\n },\n diagnostic: {\n enabled: false,\n vmTraceEnabled: false,\n },\n backgroundRefresh: {\n enabled: false,\n },\n network: {\n // On, because it is what every existing consumer gets today. A host that\n // must not make outbound requests turns it off; see NetworkConfig.\n enabled: true,\n },\n };\n\n/**\n * Merge a partial config override onto a base `EngineConfig`, section by\n * section, `{ ...base.section, ...override.section }` for each of the 8\n * top-level sections, not a single top-level spread.\n *\n * A shallow `{ ...base, ...override }` at the TOP level replaces an entire\n * section wholesale the moment a caller overrides even one field in it\n * (e.g. `{ performance: { defaultCacheSize: 500 } }` would silently drop\n * every other `performance.*` field back to `undefined`, not to its\n * default). This function exists specifically so every config consumer\n * shares one correct merge instead of each hand-rolling (and risking) its\n * own. `ConfigManager` and `ExpressionEngine` both call this rather than\n * either duplicating the section list or instantiating a whole\n * `ConfigManager` just to reuse its private merge logic.\n */\nexport function mergeEngineConfig(\n base: EngineConfig,\n override: EngineConfigOverride\n): EngineConfig {\n return {\n date: { ...base.date, ...override.date },\n performance: { ...base.performance, ...override.performance },\n validation: { ...base.validation, ...override.validation },\n vm: { ...base.vm, ...override.vm },\n worker: { ...base.worker, ...override.worker },\n diagnostic: { ...base.diagnostic, ...override.diagnostic },\n backgroundRefresh: { ...base.backgroundRefresh, ...override.backgroundRefresh },\n network: { ...base.network, ...override.network },\n };\n}\n\n/**\n * Configuration manager for engine settings\n *\n * @example\n * ```typescript\n * const configManager = new ConfigManager();\n * configManager.set('performance.defaultCacheSize', 2000);\n * const cacheSize = configManager.get('performance.defaultCacheSize');\n * ```\n */\nexport class ConfigManager {\n private config: EngineConfig;\n\n constructor(config: Partial<EngineConfig> = {}) {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, config);\n }\n\n /**\n * Get configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @returns Configuration value\n */\n get<T>(path: string): T {\n const keys = path.split('.');\n let current: unknown = this.config;\n\n for (const key of keys) {\n if (current && typeof current === 'object' && key in current) {\n current = (current as Record<string, unknown>)[key];\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PATH_NOT_FOUND\",\n `Configuration path not found: ${path}`,\n { path }\n );\n }\n }\n\n return current as T;\n }\n\n /**\n * Set configuration value by path\n * \n * @param path - Dot-notation path to config value\n * @param value - New value\n */\n set<T>(path: string, value: T): void {\n const keys = path.split('.');\n if (keys.length < 2) {\n throw ErrorFactory.config(\n \"INVALID_CONFIG_PATH\",\n `Invalid path: ${path}. Must be in format 'section.property'`,\n { path }\n );\n }\n \n const section = keys[0];\n const property = keys[1];\n \n if (!(section in this.config)) {\n throw ErrorFactory.config(\n \"CONFIG_SECTION_NOT_FOUND\",\n `Configuration section not found: ${section}`,\n { section, path }\n );\n }\n \n const sectionConfig = this.config[section as keyof EngineConfig];\n if (sectionConfig && typeof sectionConfig === 'object') {\n (sectionConfig as unknown as Record<string, unknown>)[property] = value;\n } else {\n throw ErrorFactory.config(\n \"CONFIG_PROPERTY_NOT_FOUND\",\n `Configuration property not found: ${path}`,\n { path }\n );\n }\n }\n\n /**\n * Get complete configuration.\n *\n * A detached copy, section objects included. A top-level spread would hand\n * the caller this manager's own section objects, so `getConfig().vm.x = 1`\n * would be an undeclared back door into {@link set}, bypassing its path\n * validation and reaching every later {@link get}.\n */\n getConfig(): EngineConfig {\n return mergeEngineConfig(this.config, {});\n }\n\n /**\n * Update multiple configuration values\n */\n update(config: Partial<EngineConfig>): void {\n this.config = mergeEngineConfig(this.config, config);\n }\n\n /**\n * Reset to default configuration.\n *\n * Goes through {@link mergeEngineConfig} for the same reason the constructor\n * does. A top-level `{ ...DEFAULT_CONFIG }` copies the six section\n * references, not the sections, so after a reset this manager's\n * `performance` object WAS `DEFAULT_CONFIG.performance` and the next\n * `set('performance.x', ...)` wrote into the module constant. That constant\n * is what every `ExpressionEngine` is built from, so one manager's reset\n * could change the cache size, instruction ceiling or allocation budget of\n * every engine constructed later in the process.\n */\n reset(): void {\n this.config = mergeEngineConfig(DEFAULT_CONFIG, {});\n }\n\n /**\n * Validate configuration values\n */\n validate(): ValidationResult {\n const errors: string[] = [];\n\n // Validate performance config\n if (this.config.performance.maxDocumentLines > 100000) {\n errors.push('maxDocumentLines cannot exceed 100,000');\n }\n\n // Validate date config\n if (this.config.date.maxOffsetYears > 1000) {\n errors.push('maxOffsetYears cannot exceed 1000');\n }\n\n return {\n valid: errors.length === 0,\n error: errors.join('; '),\n warnings: []\n };\n }\n}\n\n/**\n * Result type for {@link ConfigManager.validate}.\n */\nexport interface ValidationResult {\n valid: boolean;\n error?: string;\n warnings?: string[];\n}\n\n"]}
@@ -1,3 +1,3 @@
1
- import {b,a as a$1}from'./chunk-HLZRNZEU.js';import {g,D}from'./chunk-5TCSFTZD.js';import {Z as Z$1,R,ua,sa}from'./chunk-ZSFOIBIH.js';import {b as b$1}from'./chunk-EOO6M65F.js';import {g as g$1,o,p}from'./chunk-J4K72CQN.js';import {m}from'./chunk-A34R65WT.js';import {c}from'./chunk-BWTVJD5L.js';import {a}from'./chunk-LHLW7JLS.js';var F={floatResult:{decimalPlaces:2,enableSeperator:true},numberResult:{decimalSeparatorLocale:"en-US"},hexResult:{enablePadding:false,paddingZeros:0},unitOfMeasurementResult:{decimalPlaces:2},percentageResult:{decimalPlaces:2},dateResult:{format:"long"}};function A(t,e,r,o){let n=r.floatResult.enableSeperator,s=r.numberResult.decimalSeparatorLocale;if(o!==void 0&&Number.isFinite(t)){let m=t.toLocaleString(s||"en-US",{minimumFractionDigits:o,maximumFractionDigits:o,useGrouping:n});return `${e.display.resultPrefix}${m}`}let a=r.floatResult.decimalPlaces,c=a$1(t,a,s||"en-US")??b(t,a,n,s);return `${e.display.resultPrefix}${c}`}function k(t,e,r,o){let n=o.floatResult.decimalPlaces,s=o.floatResult.enableSeperator,a=o.numberResult.decimalSeparatorLocale||"en-US",i=Math.max(n,1),c=t.toLocaleString(a,{useGrouping:s,minimumFractionDigits:0,maximumFractionDigits:n}),m=Math.abs(e).toLocaleString(a,{useGrouping:s,minimumFractionDigits:1,maximumFractionDigits:i});return `${r.display.resultPrefix}${c} \xB1 ${m}`}function j(t,e,r){if(typeof t=="number"&&!Number.isFinite(t))return `= ${t}`;let o=typeof t=="bigint"?t<0n:t<0,n=o?"-":"",s=c=>typeof t=="bigint"?(o?-t:t).toString(c):Math.abs(Math.trunc(t)).toString(c);if(r==="bin")return `= ${n}0b${s(2)}`;if(r==="oct")return `= ${n}0o${s(8)}`;let a=e.hexResult.enablePadding?e.hexResult.paddingZeros:0,i=s(16).toUpperCase().padStart(a,"0");return `= ${n}0x${i}`}var B=2e4;function G(t){let e=t<0n?-t:t;if(Number.isFinite(Number(e)))return `= ${t}`;let r=e.toString(16).length*4;if(r*Math.LN2/Math.LN10<=B)return `= ${t}`;let o=r*Math.LN2/Math.LN10,n=Math.floor(o),s=Math.pow(10,o-n);return `= ${t<0n?"-":""}~${s.toFixed(3)}e+${n} (an exact integer of about ${(n+1).toLocaleString("en-US")} digits, too large to print)`}function Z(t){return `= ${t}`}function V(t){return `= ${t}`}function W(t,e,r,o$1){let n=r.calendar??b$1,s=r.dateResult?.format??"long",a=o$1!==void 0&&!g$1(o$1),i=a?n.fieldsInZone(o$1,t):n.fields(t),c=a?0:n.fields(t).millisecond,m=i.hour===0&&i.minute===0&&i.second===0&&c===0;if(s==="long"){let f=a?o(o$1,t,e.code):n.formatLongDate(t,e.code);if(m)return `= ${f}`;let $=a?p(o$1,t,e.code):n.formatTimeOfDay(t,e.code);return `= ${f}, ${$}`}let u=f=>String(f).padStart(2,"0"),d=i.year,p$1=u(i.month0+1),g=u(i.day),l;if(s==="iso"?l=`${d}-${p$1}-${g}`:s==="dmy"?l=`${g}/${p$1}/${d}`:l=`${p$1}/${g}/${d}`,m)return `= ${l}`;let b=`${u(i.hour)}:${u(i.minute)}:${u(i.second)}`;return s==="iso"?`= ${l}T${b}`:`= ${l} ${b}`}function Y(t){let e=t<0?"-":"",r=Math.round(Math.abs(t)/1e3),o=Math.floor(r/3600),n=Math.floor(r%3600/60),s=r%60,a=String(n).padStart(2,"0");if(s===0)return `${e}${o}:${a}`;let i=String(s).padStart(2,"0");return `${e}${o}:${a}:${i}`}var H={s:1,sec:1,secs:1,second:1,seconds:1,min:60,mins:60,minute:60,minutes:60,h:3600,hr:3600,hrs:3600,hour:3600,hours:3600},K=60;function X(t,e){let r=e.indexOf("/");if(r<=0)return;let o=H[e.slice(0,r).toLowerCase()];if(o===void 0)return;let n=e.slice(r+1);if(c(n)!=="length")return;let s=t*o;if(!Number.isFinite(s)||Math.abs(s)<K)return;let a=s<0?"-":"",i=Math.round(Math.abs(s)),c$1=Math.floor(i/3600),m=String(Math.floor(i%3600/60)).padStart(2,"0"),u=String(i%60).padStart(2,"0"),d=c$1===0?`${Math.floor(i/60)}:${u}`:`${c$1}:${m}:${u}`;return `${a}${d} /${n}`}var O=new Map;function q(t){let e=O.get(t);return e===void 0&&(e=new Intl.NumberFormat(t).formatToParts(1.1).find(r=>r.type==="decimal")?.value??".",O.set(t,e)),e}function S(t,e,r){let o=/^(-?)(\d+)(?:\.(\d+))?$/.exec(t);if(!o)return t;let[,n,s,a]=o,i=r?BigInt(s).toLocaleString(e,{useGrouping:true}):s;return a===void 0?`${n}${i}`:`${n}${i}${q(e)}${a}`}function J(t,e,r,o,n,s,a){if(e!==void 0&&a===void 0){let f=X(t,e);if(f!==void 0)return `= ${f}`}if(e==="ms"&&s)return `= ${Y(t)}`;e==="l100km"&&(e="l/100km"),e==="mps2"&&(e="m/s\xB2");let i=a??o.unitOfMeasurementResult.decimalPlaces,c=o.floatResult.enableSeperator,m=o.numberResult.decimalSeparatorLocale||"en-US",d=e&&["days","weeks","months","years","hours","minutes","seconds","day","week","month","year","hour","minute","second"].includes(e),p=a===void 0?a$1(t,i,m):void 0,g;p!==void 0?g=p:d&&t===Math.floor(t)?g=S(t.toString(),m,c):g=S(t.toFixed(i),m,c);let l=e?ua[e.toUpperCase()]:void 0;if(l){let f=n?S(sa(n,i),m,c):g,$=l.spaced?" ":"";return `= ${l.position==="prefix"?`${l.symbol}${$}${f}`:`${f}${$}${l.symbol}`}`}return `= ${n?S(sa(n,i),m,c):g} ${e||""}`.trim()}function _(t,e){if(typeof t=="boolean")return t?"true":"false";if(typeof t=="object"&&t!==null)return R(t);let r=e.floatResult.decimalPlaces,o=e.floatResult.enableSeperator,n=e.numberResult.decimalSeparatorLocale;return b(t,r,o,n)}function Q(t,e,r){let o=Z$1(t),n=[];for(let s=0;s<t.rows;s++){let a=[];for(let i=0;i<t.cols;i++)a.push(_(o[s*t.cols+i],r));n.push(a.join(", "));}return `${e.display.resultPrefix}[${n.join("; ")}]`}function yt(t,e){let r=e||F,o=Z$1(t),n=[];for(let a=0;a<t.rows;a++){let i=[];for(let c=0;c<t.cols;c++)i.push(_(o[a*t.cols+c],r));n.push(i);}let s=[];for(let a=0;a<t.cols;a++){let i=0;for(let c=0;c<t.rows;c++)i=Math.max(i,n[c][a].length);s.push(i);}return n.map(a=>`[ ${a.map((i,c)=>i.padStart(s[c])).join(" ")} ]`).join(`
2
- `)}function z(t,e,r){return `${r.display.resultPrefix}${t}:${e}`}function v(t,e,r){let o=r.percentageResult.decimalPlaces;return `= ${(t*100).toFixed(o)}${e.display.percentageSuffix}`}function tt(t,e){return `= ${t} ${e||""}`.trim()}function et(t){if(t.addr===void 0)return `/${t.prefix}`;let e=D(t.addr);return t.prefix===void 0?e:`${e}/${t.prefix}`}function nt(t,e,r){let o=e.display.resultPrefix,n=m$1=>{let u=t.unit!==void 0?new m(6,m$1.value,t.unit):new m(0,m$1.value);u.exact=m$1.exact;let d=rt(u,r);return d.startsWith(o)?d.slice(o.length):d},[s,a]=t.shares,i=`${n(s)} each`;if(a===void 0)return `${o}${i}`;let c=a.count===1?"share":"shares";return `${o}${i}, with ${a.count} ${c} paying ${n(a)}`}function rt(t,e){let r=e||F,o=r.numberResult.decimalSeparatorLocale||"en",n=a(o);switch(t.type){case 0:return t.uncertainty!==void 0?k(t.value,t.uncertainty,n,r):A(t.value,n,r,t.decimalPlaces);case 1:return j(t.value,r,t.unit);case 2:return G(t.value);case 3:return Z(t.value);case 10:return V(t.value);case 4:return W(t.value,n,r,t.zone);case 6:return J(t.value,t.unit,n,r,t.exact,t.datetimeSpan,t.decimalPlaces);case 7:return Q(t.value,n,r);case 8:{let s=t.value;return z(s.min,s.max,n)}case 14:return `${n.display.resultPrefix}${g(t.value)}`;case 15:return nt(t.value,n,r);case 16:return `${n.display.resultPrefix}${t.value.label}`;case 17:return `${n.display.resultPrefix}${et(t.value)}`;case 9:return R(t.value);case 5:return v(t.value,n,r);case 11:return tt(t.value,t.unit);case 13:return t.unit??String(t.value);default:return `= ${String(t.value)}`}}export{F as a,yt as b,rt as c};//# sourceMappingURL=chunk-TFZNEEJR.js.map
3
- //# sourceMappingURL=chunk-TFZNEEJR.js.map
1
+ import {b,a as a$1}from'./chunk-HLZRNZEU.js';import {g,D}from'./chunk-CAJKB4WQ.js';import {Z as Z$1,R,ua,sa}from'./chunk-CUH3FEWI.js';import {b as b$1}from'./chunk-EOO6M65F.js';import {g as g$1,o,p}from'./chunk-J4K72CQN.js';import {m}from'./chunk-TSVKHY5E.js';import {c}from'./chunk-BWTVJD5L.js';import {a}from'./chunk-LHLW7JLS.js';var F={floatResult:{decimalPlaces:2,enableSeperator:true},numberResult:{decimalSeparatorLocale:"en-US"},hexResult:{enablePadding:false,paddingZeros:0},unitOfMeasurementResult:{decimalPlaces:2},percentageResult:{decimalPlaces:2},dateResult:{format:"long"}};function A(t,e,r,o){let n=r.floatResult.enableSeperator,s=r.numberResult.decimalSeparatorLocale;if(o!==void 0&&Number.isFinite(t)){let m=t.toLocaleString(s||"en-US",{minimumFractionDigits:o,maximumFractionDigits:o,useGrouping:n});return `${e.display.resultPrefix}${m}`}let a=r.floatResult.decimalPlaces,c=a$1(t,a,s||"en-US")??b(t,a,n,s);return `${e.display.resultPrefix}${c}`}function k(t,e,r,o){let n=o.floatResult.decimalPlaces,s=o.floatResult.enableSeperator,a=o.numberResult.decimalSeparatorLocale||"en-US",i=Math.max(n,1),c=t.toLocaleString(a,{useGrouping:s,minimumFractionDigits:0,maximumFractionDigits:n}),m=Math.abs(e).toLocaleString(a,{useGrouping:s,minimumFractionDigits:1,maximumFractionDigits:i});return `${r.display.resultPrefix}${c} \xB1 ${m}`}function j(t,e,r){if(typeof t=="number"&&!Number.isFinite(t))return `= ${t}`;let o=typeof t=="bigint"?t<0n:t<0,n=o?"-":"",s=c=>typeof t=="bigint"?(o?-t:t).toString(c):Math.abs(Math.trunc(t)).toString(c);if(r==="bin")return `= ${n}0b${s(2)}`;if(r==="oct")return `= ${n}0o${s(8)}`;let a=e.hexResult.enablePadding?e.hexResult.paddingZeros:0,i=s(16).toUpperCase().padStart(a,"0");return `= ${n}0x${i}`}var B=2e4;function G(t){let e=t<0n?-t:t;if(Number.isFinite(Number(e)))return `= ${t}`;let r=e.toString(16).length*4;if(r*Math.LN2/Math.LN10<=B)return `= ${t}`;let o=r*Math.LN2/Math.LN10,n=Math.floor(o),s=Math.pow(10,o-n);return `= ${t<0n?"-":""}~${s.toFixed(3)}e+${n} (an exact integer of about ${(n+1).toLocaleString("en-US")} digits, too large to print)`}function Z(t){return `= ${t}`}function V(t){return `= ${t}`}function W(t,e,r,o$1){let n=r.calendar??b$1,s=r.dateResult?.format??"long",a=o$1!==void 0&&!g$1(o$1),i=a?n.fieldsInZone(o$1,t):n.fields(t),c=a?0:n.fields(t).millisecond,m=i.hour===0&&i.minute===0&&i.second===0&&c===0;if(s==="long"){let f=a?o(o$1,t,e.code):n.formatLongDate(t,e.code);if(m)return `= ${f}`;let $=a?p(o$1,t,e.code):n.formatTimeOfDay(t,e.code);return `= ${f}, ${$}`}let u=f=>String(f).padStart(2,"0"),d=i.year,p$1=u(i.month0+1),g=u(i.day),l;if(s==="iso"?l=`${d}-${p$1}-${g}`:s==="dmy"?l=`${g}/${p$1}/${d}`:l=`${p$1}/${g}/${d}`,m)return `= ${l}`;let b=`${u(i.hour)}:${u(i.minute)}:${u(i.second)}`;return s==="iso"?`= ${l}T${b}`:`= ${l} ${b}`}function Y(t){let e=t<0?"-":"",r=Math.round(Math.abs(t)/1e3),o=Math.floor(r/3600),n=Math.floor(r%3600/60),s=r%60,a=String(n).padStart(2,"0");if(s===0)return `${e}${o}:${a}`;let i=String(s).padStart(2,"0");return `${e}${o}:${a}:${i}`}var H={s:1,sec:1,secs:1,second:1,seconds:1,min:60,mins:60,minute:60,minutes:60,h:3600,hr:3600,hrs:3600,hour:3600,hours:3600},K=60;function X(t,e){let r=e.indexOf("/");if(r<=0)return;let o=H[e.slice(0,r).toLowerCase()];if(o===void 0)return;let n=e.slice(r+1);if(c(n)!=="length")return;let s=t*o;if(!Number.isFinite(s)||Math.abs(s)<K)return;let a=s<0?"-":"",i=Math.round(Math.abs(s)),c$1=Math.floor(i/3600),m=String(Math.floor(i%3600/60)).padStart(2,"0"),u=String(i%60).padStart(2,"0"),d=c$1===0?`${Math.floor(i/60)}:${u}`:`${c$1}:${m}:${u}`;return `${a}${d} /${n}`}var O=new Map;function q(t){let e=O.get(t);return e===void 0&&(e=new Intl.NumberFormat(t).formatToParts(1.1).find(r=>r.type==="decimal")?.value??".",O.set(t,e)),e}function S(t,e,r){let o=/^(-?)(\d+)(?:\.(\d+))?$/.exec(t);if(!o)return t;let[,n,s,a]=o,i=r?BigInt(s).toLocaleString(e,{useGrouping:true}):s;return a===void 0?`${n}${i}`:`${n}${i}${q(e)}${a}`}function J(t,e,r,o,n,s,a){if(e!==void 0&&a===void 0){let f=X(t,e);if(f!==void 0)return `= ${f}`}if(e==="ms"&&s)return `= ${Y(t)}`;e==="l100km"&&(e="l/100km"),e==="mps2"&&(e="m/s\xB2");let i=a??o.unitOfMeasurementResult.decimalPlaces,c=o.floatResult.enableSeperator,m=o.numberResult.decimalSeparatorLocale||"en-US",d=e&&["days","weeks","months","years","hours","minutes","seconds","day","week","month","year","hour","minute","second"].includes(e),p=a===void 0?a$1(t,i,m):void 0,g;p!==void 0?g=p:d&&t===Math.floor(t)?g=S(t.toString(),m,c):g=S(t.toFixed(i),m,c);let l=e?ua[e.toUpperCase()]:void 0;if(l){let f=n?S(sa(n,i),m,c):g,$=l.spaced?" ":"";return `= ${l.position==="prefix"?`${l.symbol}${$}${f}`:`${f}${$}${l.symbol}`}`}return `= ${n?S(sa(n,i),m,c):g} ${e||""}`.trim()}function _(t,e){if(typeof t=="boolean")return t?"true":"false";if(typeof t=="object"&&t!==null)return R(t);let r=e.floatResult.decimalPlaces,o=e.floatResult.enableSeperator,n=e.numberResult.decimalSeparatorLocale;return b(t,r,o,n)}function Q(t,e,r){let o=Z$1(t),n=[];for(let s=0;s<t.rows;s++){let a=[];for(let i=0;i<t.cols;i++)a.push(_(o[s*t.cols+i],r));n.push(a.join(", "));}return `${e.display.resultPrefix}[${n.join("; ")}]`}function yt(t,e){let r=e||F,o=Z$1(t),n=[];for(let a=0;a<t.rows;a++){let i=[];for(let c=0;c<t.cols;c++)i.push(_(o[a*t.cols+c],r));n.push(i);}let s=[];for(let a=0;a<t.cols;a++){let i=0;for(let c=0;c<t.rows;c++)i=Math.max(i,n[c][a].length);s.push(i);}return n.map(a=>`[ ${a.map((i,c)=>i.padStart(s[c])).join(" ")} ]`).join(`
2
+ `)}function z(t,e,r){return `${r.display.resultPrefix}${t}:${e}`}function v(t,e,r){let o=r.percentageResult.decimalPlaces;return `= ${(t*100).toFixed(o)}${e.display.percentageSuffix}`}function tt(t,e){return `= ${t} ${e||""}`.trim()}function et(t){if(t.addr===void 0)return `/${t.prefix}`;let e=D(t.addr);return t.prefix===void 0?e:`${e}/${t.prefix}`}function nt(t,e,r){let o=e.display.resultPrefix,n=m$1=>{let u=t.unit!==void 0?new m(6,m$1.value,t.unit):new m(0,m$1.value);u.exact=m$1.exact;let d=rt(u,r);return d.startsWith(o)?d.slice(o.length):d},[s,a]=t.shares,i=`${n(s)} each`;if(a===void 0)return `${o}${i}`;let c=a.count===1?"share":"shares";return `${o}${i}, with ${a.count} ${c} paying ${n(a)}`}function rt(t,e){let r=e||F,o=r.numberResult.decimalSeparatorLocale||"en",n=a(o);switch(t.type){case 0:return t.uncertainty!==void 0?k(t.value,t.uncertainty,n,r):A(t.value,n,r,t.decimalPlaces);case 1:return j(t.value,r,t.unit);case 2:return G(t.value);case 3:return Z(t.value);case 10:return V(t.value);case 4:return W(t.value,n,r,t.zone);case 6:return J(t.value,t.unit,n,r,t.exact,t.datetimeSpan,t.decimalPlaces);case 7:return Q(t.value,n,r);case 8:{let s=t.value;return z(s.min,s.max,n)}case 14:return `${n.display.resultPrefix}${g(t.value)}`;case 15:return nt(t.value,n,r);case 16:return `${n.display.resultPrefix}${t.value.label}`;case 17:return `${n.display.resultPrefix}${et(t.value)}`;case 9:return R(t.value);case 5:return v(t.value,n,r);case 11:return tt(t.value,t.unit);case 13:return t.unit??String(t.value);default:return `= ${String(t.value)}`}}export{F as a,yt as b,rt as c};//# sourceMappingURL=chunk-XAKFFIMQ.js.map
3
+ //# sourceMappingURL=chunk-XAKFFIMQ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/format/FormattingSettings.ts","../src/format/FormatEngine.ts"],"names":["DEFAULT_FORMATTING_SETTINGS","formatNumber","value","locale","settings","decimalPlaces","sep","loc","formatted","dp","tooSmallToPrintText","autoFormatIntegerOrFloat","formatUncertain","center","uncertainty","useGrouping","spreadMax","centerText","spreadText","formatHex","base","negative","sign","digits","radix","padding","hex","MAX_DISPLAYED_BIGINT_DIGITS","formatBigInt","magnitude","bits","log10","exponent","mantissa","formatString","formatBoolean","formatDatetime","zone","calendar","DATE_CALENDAR","format","named","isFixedOffset","d","millisecond","isMidnight","dateStr","longDateInZone","timeStr","timeOfDayInZone","p2","n","year","month","day","datePart","time","formatMsDuration","ms","totalSeconds","hours","minutes","seconds","mm","ss","PACE_TIME_UNITS","PACE_CLOCK_FLOOR_SECONDS","formatPace","unit","slash","perSecond","distance","getMeasure","whole","clock","decimalMarkByLocale","decimalMark","mark","part","localiseFixedDecimal","fixed","match","integer","fraction","integerText","formatUom","exact","isDatetimeSpan","explicitPlaces","pace","isTimeSpan","tooSmall","currencyDisplay","CURRENCY_DISPLAY","moneyText","decimalToFixed","formatMatrixEntry","entry","formatSymbolic","formatMatrix","m","rowMajor","columnMajorToRowMajor","rows","r","cells","c","formatMatrixAligned","us","row","colWidth","width","cell","formatRange","min","max","formatPercentage","formatUnit","formatIpCidr","data","dotted","formatIp","formatSplit","prefix","render","share","v","Value","text","formatValue","high","each","shareWord","localeCode","getLocale","formatColour"],"mappings":"4UA2DO,IAAMA,EAAkD,CAC7D,WAAA,CAAa,CACX,aAAA,CAAe,EACf,eAAA,CAAiB,IACnB,CAAA,CACA,YAAA,CAAc,CACZ,sBAAA,CAAwB,OAC1B,CAAA,CACA,SAAA,CAAW,CACT,aAAA,CAAe,KAAA,CACf,YAAA,CAAc,CAChB,EACA,uBAAA,CAAyB,CACvB,aAAA,CAAe,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,EAAO,OAAA,CAAQ,YAAY,GAAGmH,EAAAA,CAAapH,CAAAA,CAAM,KAAmB,CAAC,CAAA,CAAA,CACjF,OACE,OAAOgG,CAAAA,CAAehG,EAAM,KAAqB,CAAA,CACnD,OACE,OAAOkH,CAAAA,CAAiBlH,EAAM,KAAA,CAAiBC,CAAAA,CAAQyG,CAAE,CAAA,CAC3D,KAAA,EAAA,CACE,OAAOS,EAAAA,CAAWnH,CAAAA,CAAM,MAAiBA,CAAAA,CAAM,IAAI,EACrD,KAAA,EAAA,CAKE,OAAOA,EAAM,IAAA,EAAQ,MAAA,CAAOA,EAAM,KAAK,CAAA,CACzC,QACE,OAAO,CAAA,EAAA,EAAK,OAAOA,CAAAA,CAAM,KAAK,CAAC,CAAA,CACnC,CACF","file":"chunk-TFZNEEJR.js","sourcesContent":["import type { CalendarBackend } from \"@solve-js/calendar/CalendarBackend\";\n/**\n * How a Datetime value is rendered.\n *\n * - `'long'`: the spelled-out form, \"Tuesday, March 10, 2026\" (the default).\n * - `'iso'`: \"2026-03-10\" (ISO 8601, with a `T`-separated time when present).\n * - `'dmy'`: \"10/03/2026\" (day first).\n * - `'mdy'`: \"03/10/2026\" (month first).\n *\n * The weekday and long month name in `'long'` are localised through the same\n * locale the number separators come from; the numeric forms are locale-neutral.\n */\nexport type DateOutputFormat = \"long\" | \"iso\" | \"dmy\" | \"mdy\";\n\n/**\n * Minimal formatting settings interface for the engine\n * This allows the engine to format values without depending on app-specific settings\n */\nexport interface FormattingSettings {\n /**\n * The calendar backend a date is written out through: which local day and\n * wall-clock time an instant shows as. Pass the same backend the engine\n * was given as its `calendar` option, so a date displays in the zone it\n * was computed in. Absent means the built-in `Date` backend, the process's\n * own zone, which is what every engine computes with by default.\n *\n * A backend is an object of functions, so it cannot cross a `postMessage`\n * boundary: a worker runtime takes its backend from `WorkerRuntimeOptions`\n * and applies it to the formatting it receives.\n */\n calendar?: CalendarBackend;\n floatResult: {\n decimalPlaces: number;\n enableSeperator: boolean;\n };\n numberResult: {\n decimalSeparatorLocale: string;\n };\n hexResult: {\n enablePadding: boolean;\n paddingZeros: number;\n };\n unitOfMeasurementResult: {\n decimalPlaces: number;\n };\n percentageResult: {\n decimalPlaces: number;\n };\n /**\n * Optional so a host that built a `FormattingSettings` before this field\n * existed still compiles; a missing `dateResult` reads as `'long'`, the\n * historic output.\n */\n dateResult?: {\n format: DateOutputFormat;\n };\n}\n\n/** Formatting used when a host supplies none. */\nexport const DEFAULT_FORMATTING_SETTINGS: FormattingSettings = {\n floatResult: {\n decimalPlaces: 2,\n enableSeperator: true,\n },\n numberResult: {\n decimalSeparatorLocale: \"en-US\",\n },\n hexResult: {\n enablePadding: false,\n paddingZeros: 0,\n },\n unitOfMeasurementResult: {\n decimalPlaces: 2,\n },\n percentageResult: {\n decimalPlaces: 2,\n },\n dateResult: {\n format: \"long\",\n },\n};\n","import { Value, ValueType, type MatrixData, type MatrixEntry, type RangeData, type ColourData, type SplitData, type SplitShare, type ChartData, type IpCidrData } from \"@solve-js/vm/Value\";\nimport { formatColour } from \"@solve-js/packages/colour/ColourMath\";\nimport { formatIp } from \"@solve-js/packages/ip/IpMath\";\nimport { decimalToFixed, type DecimalData } from \"@solve-js/decimal\";\nimport { getLocale, type ILocale } from \"@solve-js/constants/locales\";\nimport { autoFormatIntegerOrFloat, tooSmallToPrintText } from \"@solve-js/utilities/Number\";\nimport { getMeasure } from \"@solve-js/uom/UomConverter\";\nimport { FormattingSettings, DEFAULT_FORMATTING_SETTINGS } from \"./FormattingSettings\";\nimport { CURRENCY_DISPLAY } from \"@solve-js/uom/CurrencyAliases\";\nimport { columnMajorToRowMajor } from \"@solve-js/vm/MatrixOps\";\nimport { formatSymbolic, type SymbolicNode } from \"@solve-js/symbolic\";\nimport { DATE_CALENDAR } from \"@solve-js/calendar/DateCalendar\";\nimport { isFixedOffset, longDateInZone, timeOfDayInZone } from \"@solve-js/calendar/IntlZone\";\n\nfunction formatNumber(value: number, locale: ILocale, settings: FormattingSettings, decimalPlaces?: number): string {\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n // An explicit precision (`3.14159 to 4 dp`, `round(1.5, 2)`) shows EXACTLY that\n // many places with trailing zeros kept, where the default trims them and shows\n // an integer with none. The value was already rounded to this precision when\n // it was set (see VMBuiltins' roundToPlaces, exact where an exact decimal was\n // there), so rendering it to the same place count reproduces that rounding.\n if (decimalPlaces !== undefined && Number.isFinite(value)) {\n const formatted = value.toLocaleString(loc || \"en-US\", {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n useGrouping: sep,\n });\n return `${locale.display.resultPrefix}${formatted}`;\n }\n const dp = settings.floatResult.decimalPlaces;\n // A value below the decimal budget is shown to three significant digits\n // rather than as a zero it cannot be told apart from. Only when the budget is\n // the default one: an explicit `to N dp` above asked for those places and is\n // given them, zeros included.\n const tooSmall = tooSmallToPrintText(value, dp, loc || \"en-US\");\n const formatted = tooSmall ?? autoFormatIntegerOrFloat(value, dp, sep, loc);\n return `${locale.display.resultPrefix}${formatted}`;\n}\n\n/**\n * Renders a measurement that carries a one-sigma uncertainty as\n * `center ± spread`, e.g. `49.2 ± 2.0`.\n *\n * The center is shown the way any number is, whole numbers as integers and\n * trailing zeros trimmed, so a tolerance-free-looking center still reads\n * cleanly (\"30 ± 2.24\", not \"30.00 ± 2.24\"). The spread is shown to the same\n * decimal-place budget but always keeps at least one fractional digit, which is\n * what distinguishes it as a tolerance and gives \"± 2.0\" rather than \"± 2\".\n * Both use `Intl` with `maximumFractionDigits`, so the trailing-zero trimming is\n * locale-correct (a comma-decimal locale is not string-sliced on \".\").\n *\n * The symbol is always the `±` glyph on output, even when the input was the\n * ASCII `+/-`, since the glyph is the conventional notation and unambiguous to\n * read back.\n */\nfunction formatUncertain(center: number, uncertainty: number, locale: ILocale, settings: FormattingSettings): string {\n const dp = settings.floatResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n // The spread needs room for at least one fractional digit, so a zero-decimal\n // budget cannot leave minimumFractionDigits above maximumFractionDigits.\n const spreadMax = Math.max(dp, 1);\n const centerText = center.toLocaleString(loc, { useGrouping, minimumFractionDigits: 0, maximumFractionDigits: dp });\n const spreadText = Math.abs(uncertainty).toLocaleString(loc, { useGrouping, minimumFractionDigits: 1, maximumFractionDigits: spreadMax });\n return `${locale.display.resultPrefix}${centerText} ± ${spreadText}`;\n}\n\n/**\n * Renders a number in whichever base it is tagged with.\n *\n * The zero padding is a hexadecimal setting and stays one. Applying it to a\n * binary rendering would pad `0b101` out to the same digit count as a hex\n * value, which is a different quantity of zeros and not what the setting asks\n * for.\n */\nfunction formatHex(value: number | bigint, settings: FormattingSettings, base?: string): string {\n // An infinity or a NaN has no digits in any base, and asking for them\n // produced `0xINFINITY`, a literal that reads back as nothing at all. Render\n // the value itself, which is what every other non-finite result shows.\n if (typeof value === \"number\" && !Number.isFinite(value)) return `= ${value}`;\n\n // Truncate and take the sign off before converting. `Number.toString(radix)`\n // does neither: it renders -255 as \"-ff\", which lands the minus inside the\n // literal as `0x-FF`, and it renders 255.7 as \"ff.b3333333333\", inventing\n // fractional hex digits for a notation that has no use for them. Both were\n // visible on `as hex` until the builtins started sharing this path.\n //\n // A bigint needs neither truncation nor a Math call, and must not be routed\n // through one: passing it to Math.trunc() throws, and converting it to a\n // double first is exactly the precision loss it is carried as a bigint to\n // avoid.\n const negative = typeof value === \"bigint\" ? value < 0n : value < 0;\n const sign = negative ? \"-\" : \"\";\n const digits = (radix: number): string =>\n typeof value === \"bigint\"\n ? (negative ? -value : value).toString(radix)\n : Math.abs(Math.trunc(value)).toString(radix);\n\n if (base === \"bin\") return `= ${sign}0b${digits(2)}`;\n if (base === \"oct\") return `= ${sign}0o${digits(8)}`;\n const padding = settings.hexResult.enablePadding ? settings.hexResult.paddingZeros : 0;\n const hex = digits(16).toUpperCase().padStart(padding, \"0\");\n return `= ${sign}0x${hex}`;\n}\n\n/**\n * How many decimal digits of an exact integer this will render in full.\n *\n * A little above the ~19,729 digits of the largest bigint the VM will build\n * (`vm/VM.ts`'s MAX_EXACT_POW_BITS / MAX_EXACT_SHIFT_BITS, 65,536 bits), so\n * every value the engine can produce through `^` or `<<` still prints exactly\n * and this ceiling only ever meets a value that came from somewhere else.\n */\nconst MAX_DISPLAYED_BIGINT_DIGITS = 20000;\n\n/**\n * Renders an exact integer, or describes it when writing it out is itself the\n * expensive operation.\n *\n * This used to be a bare `= ${value}` template, which renders whatever it is\n * handed: `1n << 100000000` took 8.5 seconds here turning a 12.5MB integer\n * into a thirty-million-character string, and a host has no way to opt out,\n * since displaying the answer is what it asked the engine for. The VM's own\n * ceiling on `<<` and `^` now stops that value existing, so this is the\n * backstop for every other way a large bigint can arrive (repeated `x * x`,\n * a Value a host built itself), and it costs one comparison for every value\n * that is not absurd.\n *\n * The digit count is estimated from the bit length rather than measured, since\n * measuring means doing the conversion this exists to avoid. Bit length comes\n * off the hexadecimal form, which is linear in the size of the value where the\n * decimal form is not.\n */\nfunction formatBigInt(value: bigint): string {\n const magnitude = value < 0n ? -value : value;\n // Every bigint a person actually reads takes this line and nothing else:\n // anything a double can hold is at most 309 digits, so it is printable\n // without measuring it at all.\n if (Number.isFinite(Number(magnitude))) return `= ${value}`;\n const bits = magnitude.toString(16).length * 4;\n if (bits * Math.LN2 / Math.LN10 <= MAX_DISPLAYED_BIGINT_DIGITS) return `= ${value}`;\n const log10 = bits * Math.LN2 / Math.LN10;\n const exponent = Math.floor(log10);\n const mantissa = Math.pow(10, log10 - exponent);\n const sign = value < 0n ? \"-\" : \"\";\n return `= ${sign}~${mantissa.toFixed(3)}e+${exponent} (an exact integer of about ${(exponent + 1).toLocaleString(\"en-US\")} digits, too large to print)`;\n}\n\nfunction formatString(value: string): string {\n return `= ${value}`;\n}\n\nfunction formatBoolean(value: boolean): string {\n return `= ${value}`;\n}\n\n/**\n * Renders a Datetime value locale-aware, the previous implementation\n * called `d.toLocaleString()` with no arguments, which always uses the JS\n * runtime's own default locale and never actually consulted `locale.code`\n * despite receiving it as a parameter (both branches of its old\n * `dateFormat === \"default\"` check were byte-for-byte identical, dead\n * groundwork for a distinction that was never implemented). Concretely,\n * this meant every configured locale (including the shipped German one)\n * always displayed weekday/month names in English. See GitHub issue #77.\n *\n * Uses `weekday`/`month`: \"long\" for a spelled-out date (\"Monday,\n * November 17, 2025\" / \"lundi 17 novembre 2025\") since that's what a\n * literal weekday name is for; a bare numeric date doesn't need\n * localizing beyond the decimal/thousands separators `formatNumber()`\n * already handles. The time-of-day portion is only appended when it's\n * not exactly local midnight, bare date literals (\"today\", \"17/11/2025\")\n * always anchor to local midnight, and showing \"00:00:00\" on every one of\n * those would be noise, not information.\n *\n * Reads the calendar backend on the settings, or the built-in `Date` one\n * when the settings name none: `formatValue` is a free function a host calls\n * with a value and settings, with no engine in hand, so the host passes the\n * backend its engine computes with (`FormattingSettings.calendar`) and a\n * date shows the day it was computed on, in that backend's zone.\n */\nfunction formatDatetime(value: number, locale: ILocale, settings: FormattingSettings, zone?: string): string {\n const calendar = settings.calendar ?? DATE_CALENDAR;\n const format = settings.dateResult?.format ?? \"long\";\n\n // A date that names a zone is read in it. `3 April 2026 in Tokyo` is Tokyo's\n // 3 April, and rendering the instant behind it in the reader's own zone\n // showed them 2 April: the right moment, answering a question nobody asked.\n //\n // Only a named zone, deliberately. An ISO literal carrying `Z` or an offset\n // records the synthetic fixed-offset form, and how those display is a\n // separate question this does not answer: they keep reading in the zone the\n // engine computes in, as they always have.\n const named = zone !== undefined && !isFixedOffset(zone);\n const d = named ? calendar.fieldsInZone(zone, value) : calendar.fields(value);\n const millisecond = named ? 0 : calendar.fields(value).millisecond;\n const isMidnight = d.hour === 0 && d.minute === 0 && d.second === 0 && millisecond === 0;\n\n // The spelled-out default, localised through the locale's own names.\n if (format === \"long\") {\n const dateStr = named ? longDateInZone(zone, value, locale.code) : calendar.formatLongDate(value, locale.code);\n if (isMidnight) return `= ${dateStr}`;\n const timeStr = named ? timeOfDayInZone(zone, value, locale.code) : calendar.formatTimeOfDay(value, locale.code);\n return `= ${dateStr}, ${timeStr}`;\n }\n\n // The numeric forms, built from the local calendar fields so they read the\n // same regardless of the JS runtime's own default locale.\n const p2 = (n: number) => String(n).padStart(2, \"0\");\n const year = d.year;\n const month = p2(d.month0 + 1);\n const day = p2(d.day);\n let datePart: string;\n if (format === \"iso\") datePart = `${year}-${month}-${day}`;\n else if (format === \"dmy\") datePart = `${day}/${month}/${year}`;\n else datePart = `${month}/${day}/${year}`; // mdy\n\n if (isMidnight) return `= ${datePart}`;\n const time = `${p2(d.hour)}:${p2(d.minute)}:${p2(d.second)}`;\n // ISO joins date and time with `T`; the slash forms with a space.\n return format === \"iso\" ? `= ${datePart}T${time}` : `= ${datePart} ${time}`;\n}\n\n/**\n * Renders a millisecond duration as clock-style `H:MM` (or `H:MM:SS` when\n * there's a non-zero seconds component). `ms` is never a user-typeable\n * unit (confirmed: it appears nowhere in `lexer/units.ts`), it's only\n * ever produced by subtracting two clock times/datetimes (`9:30 - 8:30`,\n * `VM.ts`'s Datetime SUB case), so this is a safe, narrow special case,\n * not a general change to how durations display.\n */\nfunction formatMsDuration(ms: number): string {\n const sign = ms < 0 ? \"-\" : \"\";\n const totalSeconds = Math.round(Math.abs(ms) / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n const mm = String(minutes).padStart(2, \"0\");\n if (seconds === 0) return `${sign}${hours}:${mm}`;\n const ss = String(seconds).padStart(2, \"0\");\n return `${sign}${hours}:${mm}:${ss}`;\n}\n\n/**\n * The time units a pace can be written in, and what one of each is in seconds.\n *\n * A short list rather than a measure lookup, because a pace is minutes and\n * seconds by convention and nobody writes a pace in weeks.\n */\nconst PACE_TIME_UNITS: Readonly<Record<string, number>> = {\n\ts: 1, sec: 1, secs: 1, second: 1, seconds: 1,\n\tmin: 60, mins: 60, minute: 60, minutes: 60,\n\th: 3600, hr: 3600, hrs: 3600, hour: 3600, hours: 3600,\n};\n\n/**\n * Below this many seconds per unit, a pace keeps its ordinary rendering.\n *\n * A clock shows whole seconds, and rounding to one is immaterial at a runner's\n * pace and a real loss below a minute: `0.90 seconds/m` would read `0:01 /m`,\n * which is a different number. A minute per unit is where the rounding stops\n * mattering.\n */\nconst PACE_CLOCK_FLOOR_SECONDS = 60;\n\n/**\n * A time over a distance, written the way a runner writes it.\n *\n * `4:30/km` is four and a half minutes to cover a kilometre, and `270.00\n * seconds/km` is the same number in a spelling nobody uses. So a quantity whose\n * unit is a time over a length is shown on a clock, matching what the `pace`\n * function has always printed.\n *\n * Returns undefined for everything else, which is every other unit the engine\n * carries: a speed (`90 km/h`) is a length over a time and reads as a number, a\n * rate of pay is money over a time, and a pace faster than a minute per unit\n * keeps its digits. Callers keep the rendering they had.\n */\nfunction formatPace(value: number, unit: string): string | undefined {\n\tconst slash = unit.indexOf(\"/\");\n\tif (slash <= 0) return undefined;\n\tconst perSecond = PACE_TIME_UNITS[unit.slice(0, slash).toLowerCase()];\n\tif (perSecond === undefined) return undefined;\n\tconst distance = unit.slice(slash + 1);\n\tif (getMeasure(distance) !== \"length\") return undefined;\n\n\tconst seconds = value * perSecond;\n\tif (!Number.isFinite(seconds) || Math.abs(seconds) < PACE_CLOCK_FLOOR_SECONDS) return undefined;\n\t// The same shape `formatMsDuration` writes, so a pace and a stretch of time\n\t// read alike, with the hours dropped when there are none.\n\tconst sign = seconds < 0 ? \"-\" : \"\";\n\tconst whole = Math.round(Math.abs(seconds));\n\tconst hours = Math.floor(whole / 3600);\n\tconst mm = String(Math.floor((whole % 3600) / 60)).padStart(2, \"0\");\n\tconst ss = String(whole % 60).padStart(2, \"0\");\n\tconst clock = hours === 0 ? `${Math.floor(whole / 60)}:${ss}` : `${hours}:${mm}:${ss}`;\n\treturn `${sign}${clock} /${distance}`;\n}\n\n/** The decimal mark each locale writes, looked up once per locale rather than on every value. */\nconst decimalMarkByLocale = new Map<string, string>();\n\nfunction decimalMark(loc: string): string {\n let mark = decimalMarkByLocale.get(loc);\n if (mark === undefined) {\n mark = new Intl.NumberFormat(loc).formatToParts(1.1).find((part) => part.type === \"decimal\")?.value ?? \".\";\n decimalMarkByLocale.set(loc, mark);\n }\n return mark;\n}\n\n/**\n * Write a fixed-decimal string (`\"1234567.50\"`) the way `loc` writes numbers:\n * its decimal mark, and its digit grouping when `useGrouping` is on.\n *\n * Every quantity and every money amount used to be rendered with a bare\n * `toFixed`, so a plain `52000` showed as `52,000` while `£52000` showed as\n * `£52000.00`, and the `enableSeperator` setting had no effect on the one\n * value type people most want grouped. The digits are taken from the string\n * rather than re-rendered from the double, because an exact money amount has\n * already been rounded from its decimal (see {@link formatUom}) and\n * re-rendering would undo that. `BigInt` carries the integer part through\n * `Intl` so grouping follows the locale's own rule (Indian lakhs included)\n * rather than a hand-written every-three-digits. Anything that is not plain\n * digits, an `Infinity` or an exponent form, is returned as it came.\n */\nfunction localiseFixedDecimal(fixed: string, loc: string, useGrouping: boolean): string {\n const match = /^(-?)(\\d+)(?:\\.(\\d+))?$/.exec(fixed);\n if (!match) return fixed;\n const [, sign, integer, fraction] = match;\n const integerText = useGrouping ? BigInt(integer).toLocaleString(loc, { useGrouping: true }) : integer;\n if (fraction === undefined) return `${sign}${integerText}`;\n return `${sign}${integerText}${decimalMark(loc)}${fraction}`;\n}\n\nfunction formatUom(value: number, unit: string | undefined, locale: ILocale, settings: FormattingSettings, exact?: DecimalData, isDatetimeSpan?: boolean, explicitPlaces?: number): string {\n // A time over a distance is a pace, and a runner reads a pace on a clock.\n // Not when the line named its own place count, which asked for digits.\n if (unit !== undefined && explicitPlaces === undefined) {\n const pace = formatPace(value, unit);\n if (pace !== undefined) return `= ${pace}`;\n }\n // A clock only for the gap between two datetimes, which is marked as such.\n // A quantity in milliseconds is a quantity: `40ms + 120ms` is 190 ms, not\n // 0:00, and every neighbouring spelling already agreed (`40 milliseconds`).\n if (unit === \"ms\" && isDatetimeSpan) return `= ${formatMsDuration(value)}`;\n // A fuel-consumption unit is stored slash-free (so it is not read as a rate)\n // but shown the way it is written.\n if (unit === \"l100km\") unit = \"l/100km\";\n if (unit === \"mps2\") unit = \"m/s²\";\n\n // `1.23456 km to 4 dp` asked for four places and used to be given the\n // setting's two, because a quantity's own place count was never read here the\n // way a plain number's already was.\n const dp = explicitPlaces ?? settings.unitOfMeasurementResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n\n // For TimeSpan values (days, weeks, hours, etc.), format as integer if the value is a whole number\n const timeSpanUnits = [\"days\", \"weeks\", \"months\", \"years\", \"hours\", \"minutes\", \"seconds\", \"day\", \"week\", \"month\", \"year\", \"hour\", \"minute\", \"second\"];\n const isTimeSpan = unit && timeSpanUnits.includes(unit);\n\n // A conversion can land far below the decimal budget, and `1 Hz in MHz`\n // printing `0.00 MHz` is indistinguishable from a real zero. Three\n // significant digits instead, in exponent form once the zeros stop being\n // countable. Not for an explicit `to N dp`, which asked for those places, and\n // not for money below: a currency zero is a real answer, and `$0.001` is\n // `$0.00` because a tenth of a penny is not a payable amount.\n const tooSmall = explicitPlaces === undefined ? tooSmallToPrintText(value, dp, loc) : undefined;\n\n let formatted: string;\n if (tooSmall !== undefined) {\n formatted = tooSmall;\n } else if (isTimeSpan && value === Math.floor(value)) {\n // For whole number TimeSpan values, format as integer\n formatted = localiseFixedDecimal(value.toString(), loc, useGrouping);\n } else {\n // For other values, use the configured decimal places\n formatted = localiseFixedDecimal(value.toFixed(dp), loc, useGrouping);\n }\n\n // Currency display: symbol + culturally-conventional placement (e.g.\n // \"$100.00\" prefix vs \"100.00 kr\" suffix) instead of the generic\n // \"amount CODE\" fallback below. See uom/CurrencyAliases.ts's\n // CURRENCY_DISPLAY table for the exact set covered and the reasoning\n // behind each placement choice. Any currency code NOT in that table\n // (most of the ~150 `CurrencyExchange.isCurrency()` recognizes) falls\n // through to the unchanged \"amount CODE\" format below.\n const currencyDisplay = unit ? CURRENCY_DISPLAY[unit.toUpperCase()] : undefined;\n if (currencyDisplay) {\n // An exact money amount rounds from its decimal, not from the double: a\n // half-cent like \"$1.005\" reads as \"$1.01\" here, where \"(1.005).toFixed(2)\"\n // answers \"1.00\" because the double it is handed already sits below the\n // value the user typed. Amounts with no exact decimal (a currency\n // conversion, whose rate is a double) keep the toFixed rendering above.\n const moneyText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n const sep = currencyDisplay.spaced ? \" \" : \"\";\n const withSymbol = currencyDisplay.position === \"prefix\"\n ? `${currencyDisplay.symbol}${sep}${moneyText}`\n : `${moneyText}${sep}${currencyDisplay.symbol}`;\n return `= ${withSymbol}`;\n }\n\n // The unit is written as the symbol the value carries. There used to be a\n // `unitOfMeasurementResult.unitNames` setting here whose two branches were\n // the same expression, so it never changed anything, and it was removed\n // rather than implemented: the engine has no unit-name data to render from.\n // The generated unit table maps a spelling to [measure, ratio] only, and\n // names cannot be recovered from it, because units that differ by an OFFSET\n // share a ratio, so \"20 C\" would come back as \"20 kelvins\". A real\n // implementation needs a hand-authored name per unit plus pluralization and\n // per-locale spelling (metre against meter), which is a feature rather than\n // the repair of a dead ternary.\n //\n // An exact currency with no symbol in the display table above (one of the\n // less common ISO codes) still rounds from its decimal here, so \"1.005 UYW\"\n // reads the same way \"$1.005\" does. Non-currency Uoms never carry an exact,\n // so this leaves \"1.50 kg\" exactly as it was.\n const genericText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n return `= ${genericText} ${unit || \"\"}`.trim();\n}\n\nfunction formatMatrixEntry(entry: MatrixEntry, settings: FormattingSettings): string {\n if (typeof entry === \"boolean\") return entry ? \"true\" : \"false\";\n if (typeof entry === \"object\" && entry !== null) return formatSymbolic(entry);\n const dp = settings.floatResult.decimalPlaces;\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n return autoFormatIntegerOrFloat(entry, dp, sep, loc);\n}\n\n/**\n * Renders a Matrix matching its own literal syntax: a single row (1xN,\n * including plain vectors) as `[a, b, c]`, a single column (Nx1) as\n * `[a; b; c]`, and a general shape as `[r0c0, r0c1; r1c0, r1c1]`, row-major\n * textual output read back out of the column-major storage\n * (`columnMajorToRowMajor()`), matching how `[1,2;3,4]` is written.\n */\nfunction formatMatrix(m: MatrixData, locale: ILocale, settings: FormattingSettings): string {\n const rowMajor = columnMajorToRowMajor(m);\n const rows: string[] = [];\n for (let r = 0; r < m.rows; r++) {\n const cells: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n cells.push(formatMatrixEntry(rowMajor[r * m.cols + c], settings));\n }\n rows.push(cells.join(\", \"));\n }\n return `${locale.display.resultPrefix}[${rows.join(\"; \")}]`;\n}\n\n/**\n * Render a matrix as a multi-line, column-aligned block: one row per line (the\n * newline is where {@link formatValue}'s compact form writes `;`), each column\n * right-padded to its widest cell, and every row wrapped in `[ ... ]`. For\n * display where a grid reads better than a line, e.g. a docs notepad or a REPL:\n *\n * ```text\n * [ 1 2 ]\n * [ 30 4 ]\n * ```\n *\n * This is deliberately separate from {@link formatValue}, whose single-line\n * matrix form stays the stable, assertable text the API and the worker DTO use.\n * A 1xN row vector is one line; an Nx1 column vector is N lines.\n */\nexport function formatMatrixAligned(m: MatrixData, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const rowMajor = columnMajorToRowMajor(m);\n const cells: string[][] = [];\n for (let r = 0; r < m.rows; r++) {\n const row: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n row.push(formatMatrixEntry(rowMajor[r * m.cols + c], us));\n }\n cells.push(row);\n }\n const colWidth: number[] = [];\n for (let c = 0; c < m.cols; c++) {\n let width = 0;\n for (let r = 0; r < m.rows; r++) width = Math.max(width, cells[r][c].length);\n colWidth.push(width);\n }\n return cells\n .map((row) => `[ ${row.map((cell, c) => cell.padStart(colWidth[c])).join(\" \")} ]`)\n .join(\"\\n\");\n}\n\nfunction formatRange(min: number, max: number, locale: ILocale): string {\n return `${locale.display.resultPrefix}${min}:${max}`;\n}\n\nfunction formatPercentage(value: number, locale: ILocale, settings: FormattingSettings): string {\n // ValueType.Percentage stores a fraction (0.25 for 25%). See Value.ts's\n // documented contract and the sole producer, VM.ts's TO_PERCENTAGE opcode\n // (`right/left - 1`, e.g. 0.25 for \"800 to 1000\"). Multiply by 100 before\n // formatting; without this every percentage-change result displayed as\n // e.g. \"0.25%\" instead of \"25.00%\".\n const dp = settings.percentageResult.decimalPlaces;\n const formatted = (value * 100).toFixed(dp);\n return `= ${formatted}${locale.display.percentageSuffix}`;\n}\n\nfunction formatUnit(value: number, unit: string | undefined): string {\n return `= ${value} ${unit || \"\"}`.trim();\n}\n\n/**\n * Renders a per-person bill split: \"= $45.00 each\", or, when the division is\n * uneven, \"= $33.33 each, with 1 share paying $33.34\". Each share's amount is\n * rendered through the ordinary value formatter (a throwaway {@link Value}), so\n * a currency share honours the same symbol placement, decimal places and locale\n * as any other money and a bare share trims trailing zeros the way a plain\n * number does; the \"= \" prefix is added once, around the whole sentence, not\n * per share.\n */\n/**\n * An IP/CIDR as text: the dotted quad, plus `/prefix` when present, or a bare\n * `/prefix` when there is no address (`netmask of /24` before it resolves).\n */\nfunction formatIpCidr(data: IpCidrData): string {\n\tif (data.addr === undefined) return `/${data.prefix}`;\n\tconst dotted = formatIp(data.addr);\n\treturn data.prefix === undefined ? dotted : `${dotted}/${data.prefix}`;\n}\n\nfunction formatSplit(data: SplitData, locale: ILocale, settings: FormattingSettings): string {\n const prefix = locale.display.resultPrefix;\n const render = (share: SplitShare): string => {\n const v = data.unit !== undefined\n ? new Value(ValueType.Uom, share.value, data.unit)\n : new Value(ValueType.Number, share.value);\n v.exact = share.exact;\n const text = formatValue(v, settings);\n return text.startsWith(prefix) ? text.slice(prefix.length) : text;\n };\n\n const [base, high] = data.shares;\n const each = `${render(base)} each`;\n if (high === undefined) return `${prefix}${each}`;\n const shareWord = high.count === 1 ? \"share\" : \"shares\";\n return `${prefix}${each}, with ${high.count} ${shareWord} paying ${render(high)}`;\n}\n\n/**\n * Render an evaluated {@link Value} as a display string, dispatching on\n * `value.type` to the type-specific formatter (number, hex, datetime, unit\n * of measurement, matrix, range, percentage, ...).\n *\n * Most branches produce a `\"= \"`-prefixed result string (matching the\n * plugin's inline-result convention); `ValueType.Error` is the one\n * exception, it returns the human-readable error message directly\n * (stored in `value.unit`), not an `\"= \"`-prefixed string.\n *\n * @param value - The evaluated value to format.\n * @param settings - Locale/precision/separator options; defaults to\n * {@link DEFAULT_FORMATTING_SETTINGS} when omitted.\n * @example\n * ```typescript\n * const value = engine.evaluateExpression(\"10 USD to GBP\");\n * formatValue(value); // \"= £7.85\" (exact output depends on live exchange rates)\n * ```\n */\nexport function formatValue(value: Value, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const localeCode = us.numberResult.decimalSeparatorLocale || \"en\";\n const locale = getLocale(localeCode);\n\n switch (value.type) {\n case ValueType.Number:\n // A measurement with a tolerance renders as \"center ± spread\"; every\n // other number is unchanged, so a plain value is byte-for-byte what it was.\n if (value.uncertainty !== undefined) {\n return formatUncertain(value.value as number, value.uncertainty, locale, us);\n }\n return formatNumber(value.value as number, locale, us, value.decimalPlaces);\n case ValueType.Hex:\n return formatHex(value.value as number | bigint, us, value.unit);\n case ValueType.BigInt:\n return formatBigInt(value.value as bigint);\n case ValueType.String:\n return formatString(value.value as string);\n case ValueType.Boolean:\n return formatBoolean(value.value as boolean);\n case ValueType.Datetime:\n return formatDatetime(value.value as number, locale, us, value.zone);\n case ValueType.Uom:\n return formatUom(value.value as number, value.unit, locale, us, value.exact, value.datetimeSpan, value.decimalPlaces);\n case ValueType.Matrix:\n return formatMatrix(value.value as MatrixData, locale, us);\n case ValueType.Range: {\n const r = value.value as RangeData;\n return formatRange(r.min, r.max, locale);\n }\n case ValueType.Colour:\n return `${locale.display.resultPrefix}${formatColour(value.value as ColourData)}`;\n case ValueType.Split:\n return formatSplit(value.value as SplitData, locale, us);\n case ValueType.Chart:\n // A chart is drawn from its data by the host; the text answer is its label\n // (`sin(x) over [0, 6.28]`, or the series a sparkline came from).\n return `${locale.display.resultPrefix}${(value.value as ChartData).label}`;\n case ValueType.IpCidr:\n return `${locale.display.resultPrefix}${formatIpCidr(value.value as IpCidrData)}`;\n case ValueType.Symbolic:\n return formatSymbolic(value.value as SymbolicNode);\n case ValueType.Percentage:\n return formatPercentage(value.value as number, locale, us);\n case ValueType.Unit:\n return formatUnit(value.value as number, value.unit);\n case ValueType.Error:\n // errorValue(code, message) stores the human-readable message in\n // `.unit` (code goes in `.value`), falling through to the default\n // case here previously displayed the raw code (e.g.\n // \"CURRENCY_RATE_UNAVAILABLE\") instead of the actual message.\n return value.unit ?? String(value.value);\n default:\n return `= ${String(value.value)}`;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/format/FormattingSettings.ts","../src/format/FormatEngine.ts"],"names":["DEFAULT_FORMATTING_SETTINGS","formatNumber","value","locale","settings","decimalPlaces","sep","loc","formatted","dp","tooSmallToPrintText","autoFormatIntegerOrFloat","formatUncertain","center","uncertainty","useGrouping","spreadMax","centerText","spreadText","formatHex","base","negative","sign","digits","radix","padding","hex","MAX_DISPLAYED_BIGINT_DIGITS","formatBigInt","magnitude","bits","log10","exponent","mantissa","formatString","formatBoolean","formatDatetime","zone","calendar","DATE_CALENDAR","format","named","isFixedOffset","d","millisecond","isMidnight","dateStr","longDateInZone","timeStr","timeOfDayInZone","p2","n","year","month","day","datePart","time","formatMsDuration","ms","totalSeconds","hours","minutes","seconds","mm","ss","PACE_TIME_UNITS","PACE_CLOCK_FLOOR_SECONDS","formatPace","unit","slash","perSecond","distance","getMeasure","whole","clock","decimalMarkByLocale","decimalMark","mark","part","localiseFixedDecimal","fixed","match","integer","fraction","integerText","formatUom","exact","isDatetimeSpan","explicitPlaces","pace","isTimeSpan","tooSmall","currencyDisplay","CURRENCY_DISPLAY","moneyText","decimalToFixed","formatMatrixEntry","entry","formatSymbolic","formatMatrix","m","rowMajor","columnMajorToRowMajor","rows","r","cells","c","formatMatrixAligned","us","row","colWidth","width","cell","formatRange","min","max","formatPercentage","formatUnit","formatIpCidr","data","dotted","formatIp","formatSplit","prefix","render","share","v","Value","text","formatValue","high","each","shareWord","localeCode","getLocale","formatColour"],"mappings":"4UA2DO,IAAMA,EAAkD,CAC7D,WAAA,CAAa,CACX,aAAA,CAAe,EACf,eAAA,CAAiB,IACnB,CAAA,CACA,YAAA,CAAc,CACZ,sBAAA,CAAwB,OAC1B,CAAA,CACA,SAAA,CAAW,CACT,aAAA,CAAe,KAAA,CACf,YAAA,CAAc,CAChB,EACA,uBAAA,CAAyB,CACvB,aAAA,CAAe,CACjB,EACA,gBAAA,CAAkB,CAChB,aAAA,CAAe,CACjB,EACA,UAAA,CAAY,CACV,OAAQ,MACV,CACF,EClEA,SAASC,CAAAA,CAAaC,CAAAA,CAAeC,CAAAA,CAAiBC,EAA8BC,CAAAA,CAAgC,CAClH,IAAMC,CAAAA,CAAMF,EAAS,WAAA,CAAY,eAAA,CAC3BG,CAAAA,CAAMH,CAAAA,CAAS,aAAa,sBAAA,CAMlC,GAAIC,IAAkB,MAAA,EAAa,MAAA,CAAO,SAASH,CAAK,CAAA,CAAG,CACzD,IAAMM,EAAYN,CAAAA,CAAM,cAAA,CAAeK,CAAAA,EAAO,OAAA,CAAS,CACrD,qBAAA,CAAuBF,CAAAA,CACvB,qBAAA,CAAuBA,CAAAA,CACvB,YAAaC,CACf,CAAC,EACD,OAAO,CAAA,EAAGH,EAAO,OAAA,CAAQ,YAAY,CAAA,EAAGK,CAAS,EACnD,CACA,IAAMC,CAAAA,CAAKL,CAAAA,CAAS,YAAY,aAAA,CAM1BI,CAAAA,CADWE,GAAAA,CAAoBR,CAAAA,CAAOO,EAAIF,CAAAA,EAAO,OAAO,CAAA,EAChCI,CAAAA,CAAyBT,EAAOO,CAAAA,CAAIH,CAAAA,CAAKC,CAAG,CAAA,CAC1E,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,CAChB,OAAO+G,CAAAA,CAAYT,CAAAA,CAAE,IAAKA,CAAAA,CAAE,GAAA,CAAKrG,CAAM,CACzC,CACA,QACE,OAAO,CAAA,EAAGA,EAAO,OAAA,CAAQ,YAAY,GAAGoI,CAAAA,CAAarI,CAAAA,CAAM,KAAmB,CAAC,CAAA,CAAA,CACjF,QACE,OAAOwH,EAAAA,CAAYxH,EAAM,KAAA,CAAoBC,CAAAA,CAAQyG,CAAE,CAAA,CACzD,KAAA,EAAA,CAGE,OAAO,CAAA,EAAGzG,CAAAA,CAAO,QAAQ,YAAY,CAAA,EAAID,EAAM,KAAA,CAAoB,KAAK,CAAA,CAAA,CAC1E,KAAA,EAAA,CACE,OAAO,CAAA,EAAGC,EAAO,OAAA,CAAQ,YAAY,GAAGmH,EAAAA,CAAapH,CAAAA,CAAM,KAAmB,CAAC,CAAA,CAAA,CACjF,OACE,OAAOgG,CAAAA,CAAehG,EAAM,KAAqB,CAAA,CACnD,OACE,OAAOkH,CAAAA,CAAiBlH,EAAM,KAAA,CAAiBC,CAAAA,CAAQyG,CAAE,CAAA,CAC3D,KAAA,EAAA,CACE,OAAOS,EAAAA,CAAWnH,CAAAA,CAAM,MAAiBA,CAAAA,CAAM,IAAI,EACrD,KAAA,EAAA,CAKE,OAAOA,EAAM,IAAA,EAAQ,MAAA,CAAOA,EAAM,KAAK,CAAA,CACzC,QACE,OAAO,CAAA,EAAA,EAAK,OAAOA,CAAAA,CAAM,KAAK,CAAC,CAAA,CACnC,CACF","file":"chunk-XAKFFIMQ.js","sourcesContent":["import type { CalendarBackend } from \"@solve-js/calendar/CalendarBackend\";\n/**\n * How a Datetime value is rendered.\n *\n * - `'long'`: the spelled-out form, \"Tuesday, March 10, 2026\" (the default).\n * - `'iso'`: \"2026-03-10\" (ISO 8601, with a `T`-separated time when present).\n * - `'dmy'`: \"10/03/2026\" (day first).\n * - `'mdy'`: \"03/10/2026\" (month first).\n *\n * The weekday and long month name in `'long'` are localised through the same\n * locale the number separators come from; the numeric forms are locale-neutral.\n */\nexport type DateOutputFormat = \"long\" | \"iso\" | \"dmy\" | \"mdy\";\n\n/**\n * Minimal formatting settings interface for the engine\n * This allows the engine to format values without depending on app-specific settings\n */\nexport interface FormattingSettings {\n /**\n * The calendar backend a date is written out through: which local day and\n * wall-clock time an instant shows as. Pass the same backend the engine\n * was given as its `calendar` option, so a date displays in the zone it\n * was computed in. Absent means the built-in `Date` backend, the process's\n * own zone, which is what every engine computes with by default.\n *\n * A backend is an object of functions, so it cannot cross a `postMessage`\n * boundary: a worker runtime takes its backend from `WorkerRuntimeOptions`\n * and applies it to the formatting it receives.\n */\n calendar?: CalendarBackend;\n floatResult: {\n decimalPlaces: number;\n enableSeperator: boolean;\n };\n numberResult: {\n decimalSeparatorLocale: string;\n };\n hexResult: {\n enablePadding: boolean;\n paddingZeros: number;\n };\n unitOfMeasurementResult: {\n decimalPlaces: number;\n };\n percentageResult: {\n decimalPlaces: number;\n };\n /**\n * Optional so a host that built a `FormattingSettings` before this field\n * existed still compiles; a missing `dateResult` reads as `'long'`, the\n * historic output.\n */\n dateResult?: {\n format: DateOutputFormat;\n };\n}\n\n/** Formatting used when a host supplies none. */\nexport const DEFAULT_FORMATTING_SETTINGS: FormattingSettings = {\n floatResult: {\n decimalPlaces: 2,\n enableSeperator: true,\n },\n numberResult: {\n decimalSeparatorLocale: \"en-US\",\n },\n hexResult: {\n enablePadding: false,\n paddingZeros: 0,\n },\n unitOfMeasurementResult: {\n decimalPlaces: 2,\n },\n percentageResult: {\n decimalPlaces: 2,\n },\n dateResult: {\n format: \"long\",\n },\n};\n","import { Value, ValueType, type MatrixData, type MatrixEntry, type RangeData, type ColourData, type SplitData, type SplitShare, type ChartData, type IpCidrData } from \"@solve-js/vm/Value\";\nimport { formatColour } from \"@solve-js/packages/colour/ColourMath\";\nimport { formatIp } from \"@solve-js/packages/ip/IpMath\";\nimport { decimalToFixed, type DecimalData } from \"@solve-js/decimal\";\nimport { getLocale, type ILocale } from \"@solve-js/constants/locales\";\nimport { autoFormatIntegerOrFloat, tooSmallToPrintText } from \"@solve-js/utilities/Number\";\nimport { getMeasure } from \"@solve-js/uom/UomConverter\";\nimport { FormattingSettings, DEFAULT_FORMATTING_SETTINGS } from \"./FormattingSettings\";\nimport { CURRENCY_DISPLAY } from \"@solve-js/uom/CurrencyAliases\";\nimport { columnMajorToRowMajor } from \"@solve-js/vm/MatrixOps\";\nimport { formatSymbolic, type SymbolicNode } from \"@solve-js/symbolic\";\nimport { DATE_CALENDAR } from \"@solve-js/calendar/DateCalendar\";\nimport { isFixedOffset, longDateInZone, timeOfDayInZone } from \"@solve-js/calendar/IntlZone\";\n\nfunction formatNumber(value: number, locale: ILocale, settings: FormattingSettings, decimalPlaces?: number): string {\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n // An explicit precision (`3.14159 to 4 dp`, `round(1.5, 2)`) shows EXACTLY that\n // many places with trailing zeros kept, where the default trims them and shows\n // an integer with none. The value was already rounded to this precision when\n // it was set (see VMBuiltins' roundToPlaces, exact where an exact decimal was\n // there), so rendering it to the same place count reproduces that rounding.\n if (decimalPlaces !== undefined && Number.isFinite(value)) {\n const formatted = value.toLocaleString(loc || \"en-US\", {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n useGrouping: sep,\n });\n return `${locale.display.resultPrefix}${formatted}`;\n }\n const dp = settings.floatResult.decimalPlaces;\n // A value below the decimal budget is shown to three significant digits\n // rather than as a zero it cannot be told apart from. Only when the budget is\n // the default one: an explicit `to N dp` above asked for those places and is\n // given them, zeros included.\n const tooSmall = tooSmallToPrintText(value, dp, loc || \"en-US\");\n const formatted = tooSmall ?? autoFormatIntegerOrFloat(value, dp, sep, loc);\n return `${locale.display.resultPrefix}${formatted}`;\n}\n\n/**\n * Renders a measurement that carries a one-sigma uncertainty as\n * `center ± spread`, e.g. `49.2 ± 2.0`.\n *\n * The center is shown the way any number is, whole numbers as integers and\n * trailing zeros trimmed, so a tolerance-free-looking center still reads\n * cleanly (\"30 ± 2.24\", not \"30.00 ± 2.24\"). The spread is shown to the same\n * decimal-place budget but always keeps at least one fractional digit, which is\n * what distinguishes it as a tolerance and gives \"± 2.0\" rather than \"± 2\".\n * Both use `Intl` with `maximumFractionDigits`, so the trailing-zero trimming is\n * locale-correct (a comma-decimal locale is not string-sliced on \".\").\n *\n * The symbol is always the `±` glyph on output, even when the input was the\n * ASCII `+/-`, since the glyph is the conventional notation and unambiguous to\n * read back.\n */\nfunction formatUncertain(center: number, uncertainty: number, locale: ILocale, settings: FormattingSettings): string {\n const dp = settings.floatResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n // The spread needs room for at least one fractional digit, so a zero-decimal\n // budget cannot leave minimumFractionDigits above maximumFractionDigits.\n const spreadMax = Math.max(dp, 1);\n const centerText = center.toLocaleString(loc, { useGrouping, minimumFractionDigits: 0, maximumFractionDigits: dp });\n const spreadText = Math.abs(uncertainty).toLocaleString(loc, { useGrouping, minimumFractionDigits: 1, maximumFractionDigits: spreadMax });\n return `${locale.display.resultPrefix}${centerText} ± ${spreadText}`;\n}\n\n/**\n * Renders a number in whichever base it is tagged with.\n *\n * The zero padding is a hexadecimal setting and stays one. Applying it to a\n * binary rendering would pad `0b101` out to the same digit count as a hex\n * value, which is a different quantity of zeros and not what the setting asks\n * for.\n */\nfunction formatHex(value: number | bigint, settings: FormattingSettings, base?: string): string {\n // An infinity or a NaN has no digits in any base, and asking for them\n // produced `0xINFINITY`, a literal that reads back as nothing at all. Render\n // the value itself, which is what every other non-finite result shows.\n if (typeof value === \"number\" && !Number.isFinite(value)) return `= ${value}`;\n\n // Truncate and take the sign off before converting. `Number.toString(radix)`\n // does neither: it renders -255 as \"-ff\", which lands the minus inside the\n // literal as `0x-FF`, and it renders 255.7 as \"ff.b3333333333\", inventing\n // fractional hex digits for a notation that has no use for them. Both were\n // visible on `as hex` until the builtins started sharing this path.\n //\n // A bigint needs neither truncation nor a Math call, and must not be routed\n // through one: passing it to Math.trunc() throws, and converting it to a\n // double first is exactly the precision loss it is carried as a bigint to\n // avoid.\n const negative = typeof value === \"bigint\" ? value < 0n : value < 0;\n const sign = negative ? \"-\" : \"\";\n const digits = (radix: number): string =>\n typeof value === \"bigint\"\n ? (negative ? -value : value).toString(radix)\n : Math.abs(Math.trunc(value)).toString(radix);\n\n if (base === \"bin\") return `= ${sign}0b${digits(2)}`;\n if (base === \"oct\") return `= ${sign}0o${digits(8)}`;\n const padding = settings.hexResult.enablePadding ? settings.hexResult.paddingZeros : 0;\n const hex = digits(16).toUpperCase().padStart(padding, \"0\");\n return `= ${sign}0x${hex}`;\n}\n\n/**\n * How many decimal digits of an exact integer this will render in full.\n *\n * A little above the ~19,729 digits of the largest bigint the VM will build\n * (`vm/VM.ts`'s MAX_EXACT_POW_BITS / MAX_EXACT_SHIFT_BITS, 65,536 bits), so\n * every value the engine can produce through `^` or `<<` still prints exactly\n * and this ceiling only ever meets a value that came from somewhere else.\n */\nconst MAX_DISPLAYED_BIGINT_DIGITS = 20000;\n\n/**\n * Renders an exact integer, or describes it when writing it out is itself the\n * expensive operation.\n *\n * This used to be a bare `= ${value}` template, which renders whatever it is\n * handed: `1n << 100000000` took 8.5 seconds here turning a 12.5MB integer\n * into a thirty-million-character string, and a host has no way to opt out,\n * since displaying the answer is what it asked the engine for. The VM's own\n * ceiling on `<<` and `^` now stops that value existing, so this is the\n * backstop for every other way a large bigint can arrive (repeated `x * x`,\n * a Value a host built itself), and it costs one comparison for every value\n * that is not absurd.\n *\n * The digit count is estimated from the bit length rather than measured, since\n * measuring means doing the conversion this exists to avoid. Bit length comes\n * off the hexadecimal form, which is linear in the size of the value where the\n * decimal form is not.\n */\nfunction formatBigInt(value: bigint): string {\n const magnitude = value < 0n ? -value : value;\n // Every bigint a person actually reads takes this line and nothing else:\n // anything a double can hold is at most 309 digits, so it is printable\n // without measuring it at all.\n if (Number.isFinite(Number(magnitude))) return `= ${value}`;\n const bits = magnitude.toString(16).length * 4;\n if (bits * Math.LN2 / Math.LN10 <= MAX_DISPLAYED_BIGINT_DIGITS) return `= ${value}`;\n const log10 = bits * Math.LN2 / Math.LN10;\n const exponent = Math.floor(log10);\n const mantissa = Math.pow(10, log10 - exponent);\n const sign = value < 0n ? \"-\" : \"\";\n return `= ${sign}~${mantissa.toFixed(3)}e+${exponent} (an exact integer of about ${(exponent + 1).toLocaleString(\"en-US\")} digits, too large to print)`;\n}\n\nfunction formatString(value: string): string {\n return `= ${value}`;\n}\n\nfunction formatBoolean(value: boolean): string {\n return `= ${value}`;\n}\n\n/**\n * Renders a Datetime value locale-aware, the previous implementation\n * called `d.toLocaleString()` with no arguments, which always uses the JS\n * runtime's own default locale and never actually consulted `locale.code`\n * despite receiving it as a parameter (both branches of its old\n * `dateFormat === \"default\"` check were byte-for-byte identical, dead\n * groundwork for a distinction that was never implemented). Concretely,\n * this meant every configured locale (including the shipped German one)\n * always displayed weekday/month names in English. See GitHub issue #77.\n *\n * Uses `weekday`/`month`: \"long\" for a spelled-out date (\"Monday,\n * November 17, 2025\" / \"lundi 17 novembre 2025\") since that's what a\n * literal weekday name is for; a bare numeric date doesn't need\n * localizing beyond the decimal/thousands separators `formatNumber()`\n * already handles. The time-of-day portion is only appended when it's\n * not exactly local midnight, bare date literals (\"today\", \"17/11/2025\")\n * always anchor to local midnight, and showing \"00:00:00\" on every one of\n * those would be noise, not information.\n *\n * Reads the calendar backend on the settings, or the built-in `Date` one\n * when the settings name none: `formatValue` is a free function a host calls\n * with a value and settings, with no engine in hand, so the host passes the\n * backend its engine computes with (`FormattingSettings.calendar`) and a\n * date shows the day it was computed on, in that backend's zone.\n */\nfunction formatDatetime(value: number, locale: ILocale, settings: FormattingSettings, zone?: string): string {\n const calendar = settings.calendar ?? DATE_CALENDAR;\n const format = settings.dateResult?.format ?? \"long\";\n\n // A date that names a zone is read in it. `3 April 2026 in Tokyo` is Tokyo's\n // 3 April, and rendering the instant behind it in the reader's own zone\n // showed them 2 April: the right moment, answering a question nobody asked.\n //\n // Only a named zone, deliberately. An ISO literal carrying `Z` or an offset\n // records the synthetic fixed-offset form, and how those display is a\n // separate question this does not answer: they keep reading in the zone the\n // engine computes in, as they always have.\n const named = zone !== undefined && !isFixedOffset(zone);\n const d = named ? calendar.fieldsInZone(zone, value) : calendar.fields(value);\n const millisecond = named ? 0 : calendar.fields(value).millisecond;\n const isMidnight = d.hour === 0 && d.minute === 0 && d.second === 0 && millisecond === 0;\n\n // The spelled-out default, localised through the locale's own names.\n if (format === \"long\") {\n const dateStr = named ? longDateInZone(zone, value, locale.code) : calendar.formatLongDate(value, locale.code);\n if (isMidnight) return `= ${dateStr}`;\n const timeStr = named ? timeOfDayInZone(zone, value, locale.code) : calendar.formatTimeOfDay(value, locale.code);\n return `= ${dateStr}, ${timeStr}`;\n }\n\n // The numeric forms, built from the local calendar fields so they read the\n // same regardless of the JS runtime's own default locale.\n const p2 = (n: number) => String(n).padStart(2, \"0\");\n const year = d.year;\n const month = p2(d.month0 + 1);\n const day = p2(d.day);\n let datePart: string;\n if (format === \"iso\") datePart = `${year}-${month}-${day}`;\n else if (format === \"dmy\") datePart = `${day}/${month}/${year}`;\n else datePart = `${month}/${day}/${year}`; // mdy\n\n if (isMidnight) return `= ${datePart}`;\n const time = `${p2(d.hour)}:${p2(d.minute)}:${p2(d.second)}`;\n // ISO joins date and time with `T`; the slash forms with a space.\n return format === \"iso\" ? `= ${datePart}T${time}` : `= ${datePart} ${time}`;\n}\n\n/**\n * Renders a millisecond duration as clock-style `H:MM` (or `H:MM:SS` when\n * there's a non-zero seconds component). `ms` is never a user-typeable\n * unit (confirmed: it appears nowhere in `lexer/units.ts`), it's only\n * ever produced by subtracting two clock times/datetimes (`9:30 - 8:30`,\n * `VM.ts`'s Datetime SUB case), so this is a safe, narrow special case,\n * not a general change to how durations display.\n */\nfunction formatMsDuration(ms: number): string {\n const sign = ms < 0 ? \"-\" : \"\";\n const totalSeconds = Math.round(Math.abs(ms) / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n const mm = String(minutes).padStart(2, \"0\");\n if (seconds === 0) return `${sign}${hours}:${mm}`;\n const ss = String(seconds).padStart(2, \"0\");\n return `${sign}${hours}:${mm}:${ss}`;\n}\n\n/**\n * The time units a pace can be written in, and what one of each is in seconds.\n *\n * A short list rather than a measure lookup, because a pace is minutes and\n * seconds by convention and nobody writes a pace in weeks.\n */\nconst PACE_TIME_UNITS: Readonly<Record<string, number>> = {\n\ts: 1, sec: 1, secs: 1, second: 1, seconds: 1,\n\tmin: 60, mins: 60, minute: 60, minutes: 60,\n\th: 3600, hr: 3600, hrs: 3600, hour: 3600, hours: 3600,\n};\n\n/**\n * Below this many seconds per unit, a pace keeps its ordinary rendering.\n *\n * A clock shows whole seconds, and rounding to one is immaterial at a runner's\n * pace and a real loss below a minute: `0.90 seconds/m` would read `0:01 /m`,\n * which is a different number. A minute per unit is where the rounding stops\n * mattering.\n */\nconst PACE_CLOCK_FLOOR_SECONDS = 60;\n\n/**\n * A time over a distance, written the way a runner writes it.\n *\n * `4:30/km` is four and a half minutes to cover a kilometre, and `270.00\n * seconds/km` is the same number in a spelling nobody uses. So a quantity whose\n * unit is a time over a length is shown on a clock, matching what the `pace`\n * function has always printed.\n *\n * Returns undefined for everything else, which is every other unit the engine\n * carries: a speed (`90 km/h`) is a length over a time and reads as a number, a\n * rate of pay is money over a time, and a pace faster than a minute per unit\n * keeps its digits. Callers keep the rendering they had.\n */\nfunction formatPace(value: number, unit: string): string | undefined {\n\tconst slash = unit.indexOf(\"/\");\n\tif (slash <= 0) return undefined;\n\tconst perSecond = PACE_TIME_UNITS[unit.slice(0, slash).toLowerCase()];\n\tif (perSecond === undefined) return undefined;\n\tconst distance = unit.slice(slash + 1);\n\tif (getMeasure(distance) !== \"length\") return undefined;\n\n\tconst seconds = value * perSecond;\n\tif (!Number.isFinite(seconds) || Math.abs(seconds) < PACE_CLOCK_FLOOR_SECONDS) return undefined;\n\t// The same shape `formatMsDuration` writes, so a pace and a stretch of time\n\t// read alike, with the hours dropped when there are none.\n\tconst sign = seconds < 0 ? \"-\" : \"\";\n\tconst whole = Math.round(Math.abs(seconds));\n\tconst hours = Math.floor(whole / 3600);\n\tconst mm = String(Math.floor((whole % 3600) / 60)).padStart(2, \"0\");\n\tconst ss = String(whole % 60).padStart(2, \"0\");\n\tconst clock = hours === 0 ? `${Math.floor(whole / 60)}:${ss}` : `${hours}:${mm}:${ss}`;\n\treturn `${sign}${clock} /${distance}`;\n}\n\n/** The decimal mark each locale writes, looked up once per locale rather than on every value. */\nconst decimalMarkByLocale = new Map<string, string>();\n\nfunction decimalMark(loc: string): string {\n let mark = decimalMarkByLocale.get(loc);\n if (mark === undefined) {\n mark = new Intl.NumberFormat(loc).formatToParts(1.1).find((part) => part.type === \"decimal\")?.value ?? \".\";\n decimalMarkByLocale.set(loc, mark);\n }\n return mark;\n}\n\n/**\n * Write a fixed-decimal string (`\"1234567.50\"`) the way `loc` writes numbers:\n * its decimal mark, and its digit grouping when `useGrouping` is on.\n *\n * Every quantity and every money amount used to be rendered with a bare\n * `toFixed`, so a plain `52000` showed as `52,000` while `£52000` showed as\n * `£52000.00`, and the `enableSeperator` setting had no effect on the one\n * value type people most want grouped. The digits are taken from the string\n * rather than re-rendered from the double, because an exact money amount has\n * already been rounded from its decimal (see {@link formatUom}) and\n * re-rendering would undo that. `BigInt` carries the integer part through\n * `Intl` so grouping follows the locale's own rule (Indian lakhs included)\n * rather than a hand-written every-three-digits. Anything that is not plain\n * digits, an `Infinity` or an exponent form, is returned as it came.\n */\nfunction localiseFixedDecimal(fixed: string, loc: string, useGrouping: boolean): string {\n const match = /^(-?)(\\d+)(?:\\.(\\d+))?$/.exec(fixed);\n if (!match) return fixed;\n const [, sign, integer, fraction] = match;\n const integerText = useGrouping ? BigInt(integer).toLocaleString(loc, { useGrouping: true }) : integer;\n if (fraction === undefined) return `${sign}${integerText}`;\n return `${sign}${integerText}${decimalMark(loc)}${fraction}`;\n}\n\nfunction formatUom(value: number, unit: string | undefined, locale: ILocale, settings: FormattingSettings, exact?: DecimalData, isDatetimeSpan?: boolean, explicitPlaces?: number): string {\n // A time over a distance is a pace, and a runner reads a pace on a clock.\n // Not when the line named its own place count, which asked for digits.\n if (unit !== undefined && explicitPlaces === undefined) {\n const pace = formatPace(value, unit);\n if (pace !== undefined) return `= ${pace}`;\n }\n // A clock only for the gap between two datetimes, which is marked as such.\n // A quantity in milliseconds is a quantity: `40ms + 120ms` is 190 ms, not\n // 0:00, and every neighbouring spelling already agreed (`40 milliseconds`).\n if (unit === \"ms\" && isDatetimeSpan) return `= ${formatMsDuration(value)}`;\n // A fuel-consumption unit is stored slash-free (so it is not read as a rate)\n // but shown the way it is written.\n if (unit === \"l100km\") unit = \"l/100km\";\n if (unit === \"mps2\") unit = \"m/s²\";\n\n // `1.23456 km to 4 dp` asked for four places and used to be given the\n // setting's two, because a quantity's own place count was never read here the\n // way a plain number's already was.\n const dp = explicitPlaces ?? settings.unitOfMeasurementResult.decimalPlaces;\n const useGrouping = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale || \"en-US\";\n\n // For TimeSpan values (days, weeks, hours, etc.), format as integer if the value is a whole number\n const timeSpanUnits = [\"days\", \"weeks\", \"months\", \"years\", \"hours\", \"minutes\", \"seconds\", \"day\", \"week\", \"month\", \"year\", \"hour\", \"minute\", \"second\"];\n const isTimeSpan = unit && timeSpanUnits.includes(unit);\n\n // A conversion can land far below the decimal budget, and `1 Hz in MHz`\n // printing `0.00 MHz` is indistinguishable from a real zero. Three\n // significant digits instead, in exponent form once the zeros stop being\n // countable. Not for an explicit `to N dp`, which asked for those places, and\n // not for money below: a currency zero is a real answer, and `$0.001` is\n // `$0.00` because a tenth of a penny is not a payable amount.\n const tooSmall = explicitPlaces === undefined ? tooSmallToPrintText(value, dp, loc) : undefined;\n\n let formatted: string;\n if (tooSmall !== undefined) {\n formatted = tooSmall;\n } else if (isTimeSpan && value === Math.floor(value)) {\n // For whole number TimeSpan values, format as integer\n formatted = localiseFixedDecimal(value.toString(), loc, useGrouping);\n } else {\n // For other values, use the configured decimal places\n formatted = localiseFixedDecimal(value.toFixed(dp), loc, useGrouping);\n }\n\n // Currency display: symbol + culturally-conventional placement (e.g.\n // \"$100.00\" prefix vs \"100.00 kr\" suffix) instead of the generic\n // \"amount CODE\" fallback below. See uom/CurrencyAliases.ts's\n // CURRENCY_DISPLAY table for the exact set covered and the reasoning\n // behind each placement choice. Any currency code NOT in that table\n // (most of the ~150 `CurrencyExchange.isCurrency()` recognizes) falls\n // through to the unchanged \"amount CODE\" format below.\n const currencyDisplay = unit ? CURRENCY_DISPLAY[unit.toUpperCase()] : undefined;\n if (currencyDisplay) {\n // An exact money amount rounds from its decimal, not from the double: a\n // half-cent like \"$1.005\" reads as \"$1.01\" here, where \"(1.005).toFixed(2)\"\n // answers \"1.00\" because the double it is handed already sits below the\n // value the user typed. Amounts with no exact decimal (a currency\n // conversion, whose rate is a double) keep the toFixed rendering above.\n const moneyText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n const sep = currencyDisplay.spaced ? \" \" : \"\";\n const withSymbol = currencyDisplay.position === \"prefix\"\n ? `${currencyDisplay.symbol}${sep}${moneyText}`\n : `${moneyText}${sep}${currencyDisplay.symbol}`;\n return `= ${withSymbol}`;\n }\n\n // The unit is written as the symbol the value carries. There used to be a\n // `unitOfMeasurementResult.unitNames` setting here whose two branches were\n // the same expression, so it never changed anything, and it was removed\n // rather than implemented: the engine has no unit-name data to render from.\n // The generated unit table maps a spelling to [measure, ratio] only, and\n // names cannot be recovered from it, because units that differ by an OFFSET\n // share a ratio, so \"20 C\" would come back as \"20 kelvins\". A real\n // implementation needs a hand-authored name per unit plus pluralization and\n // per-locale spelling (metre against meter), which is a feature rather than\n // the repair of a dead ternary.\n //\n // An exact currency with no symbol in the display table above (one of the\n // less common ISO codes) still rounds from its decimal here, so \"1.005 UYW\"\n // reads the same way \"$1.005\" does. Non-currency Uoms never carry an exact,\n // so this leaves \"1.50 kg\" exactly as it was.\n const genericText = exact ? localiseFixedDecimal(decimalToFixed(exact, dp), loc, useGrouping) : formatted;\n return `= ${genericText} ${unit || \"\"}`.trim();\n}\n\nfunction formatMatrixEntry(entry: MatrixEntry, settings: FormattingSettings): string {\n if (typeof entry === \"boolean\") return entry ? \"true\" : \"false\";\n if (typeof entry === \"object\" && entry !== null) return formatSymbolic(entry);\n const dp = settings.floatResult.decimalPlaces;\n const sep = settings.floatResult.enableSeperator;\n const loc = settings.numberResult.decimalSeparatorLocale;\n return autoFormatIntegerOrFloat(entry, dp, sep, loc);\n}\n\n/**\n * Renders a Matrix matching its own literal syntax: a single row (1xN,\n * including plain vectors) as `[a, b, c]`, a single column (Nx1) as\n * `[a; b; c]`, and a general shape as `[r0c0, r0c1; r1c0, r1c1]`, row-major\n * textual output read back out of the column-major storage\n * (`columnMajorToRowMajor()`), matching how `[1,2;3,4]` is written.\n */\nfunction formatMatrix(m: MatrixData, locale: ILocale, settings: FormattingSettings): string {\n const rowMajor = columnMajorToRowMajor(m);\n const rows: string[] = [];\n for (let r = 0; r < m.rows; r++) {\n const cells: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n cells.push(formatMatrixEntry(rowMajor[r * m.cols + c], settings));\n }\n rows.push(cells.join(\", \"));\n }\n return `${locale.display.resultPrefix}[${rows.join(\"; \")}]`;\n}\n\n/**\n * Render a matrix as a multi-line, column-aligned block: one row per line (the\n * newline is where {@link formatValue}'s compact form writes `;`), each column\n * right-padded to its widest cell, and every row wrapped in `[ ... ]`. For\n * display where a grid reads better than a line, e.g. a docs notepad or a REPL:\n *\n * ```text\n * [ 1 2 ]\n * [ 30 4 ]\n * ```\n *\n * This is deliberately separate from {@link formatValue}, whose single-line\n * matrix form stays the stable, assertable text the API and the worker DTO use.\n * A 1xN row vector is one line; an Nx1 column vector is N lines.\n */\nexport function formatMatrixAligned(m: MatrixData, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const rowMajor = columnMajorToRowMajor(m);\n const cells: string[][] = [];\n for (let r = 0; r < m.rows; r++) {\n const row: string[] = [];\n for (let c = 0; c < m.cols; c++) {\n row.push(formatMatrixEntry(rowMajor[r * m.cols + c], us));\n }\n cells.push(row);\n }\n const colWidth: number[] = [];\n for (let c = 0; c < m.cols; c++) {\n let width = 0;\n for (let r = 0; r < m.rows; r++) width = Math.max(width, cells[r][c].length);\n colWidth.push(width);\n }\n return cells\n .map((row) => `[ ${row.map((cell, c) => cell.padStart(colWidth[c])).join(\" \")} ]`)\n .join(\"\\n\");\n}\n\nfunction formatRange(min: number, max: number, locale: ILocale): string {\n return `${locale.display.resultPrefix}${min}:${max}`;\n}\n\nfunction formatPercentage(value: number, locale: ILocale, settings: FormattingSettings): string {\n // ValueType.Percentage stores a fraction (0.25 for 25%). See Value.ts's\n // documented contract and the sole producer, VM.ts's TO_PERCENTAGE opcode\n // (`right/left - 1`, e.g. 0.25 for \"800 to 1000\"). Multiply by 100 before\n // formatting; without this every percentage-change result displayed as\n // e.g. \"0.25%\" instead of \"25.00%\".\n const dp = settings.percentageResult.decimalPlaces;\n const formatted = (value * 100).toFixed(dp);\n return `= ${formatted}${locale.display.percentageSuffix}`;\n}\n\nfunction formatUnit(value: number, unit: string | undefined): string {\n return `= ${value} ${unit || \"\"}`.trim();\n}\n\n/**\n * Renders a per-person bill split: \"= $45.00 each\", or, when the division is\n * uneven, \"= $33.33 each, with 1 share paying $33.34\". Each share's amount is\n * rendered through the ordinary value formatter (a throwaway {@link Value}), so\n * a currency share honours the same symbol placement, decimal places and locale\n * as any other money and a bare share trims trailing zeros the way a plain\n * number does; the \"= \" prefix is added once, around the whole sentence, not\n * per share.\n */\n/**\n * An IP/CIDR as text: the dotted quad, plus `/prefix` when present, or a bare\n * `/prefix` when there is no address (`netmask of /24` before it resolves).\n */\nfunction formatIpCidr(data: IpCidrData): string {\n\tif (data.addr === undefined) return `/${data.prefix}`;\n\tconst dotted = formatIp(data.addr);\n\treturn data.prefix === undefined ? dotted : `${dotted}/${data.prefix}`;\n}\n\nfunction formatSplit(data: SplitData, locale: ILocale, settings: FormattingSettings): string {\n const prefix = locale.display.resultPrefix;\n const render = (share: SplitShare): string => {\n const v = data.unit !== undefined\n ? new Value(ValueType.Uom, share.value, data.unit)\n : new Value(ValueType.Number, share.value);\n v.exact = share.exact;\n const text = formatValue(v, settings);\n return text.startsWith(prefix) ? text.slice(prefix.length) : text;\n };\n\n const [base, high] = data.shares;\n const each = `${render(base)} each`;\n if (high === undefined) return `${prefix}${each}`;\n const shareWord = high.count === 1 ? \"share\" : \"shares\";\n return `${prefix}${each}, with ${high.count} ${shareWord} paying ${render(high)}`;\n}\n\n/**\n * Render an evaluated {@link Value} as a display string, dispatching on\n * `value.type` to the type-specific formatter (number, hex, datetime, unit\n * of measurement, matrix, range, percentage, ...).\n *\n * Most branches produce a `\"= \"`-prefixed result string (matching the\n * plugin's inline-result convention); `ValueType.Error` is the one\n * exception, it returns the human-readable error message directly\n * (stored in `value.unit`), not an `\"= \"`-prefixed string.\n *\n * @param value - The evaluated value to format.\n * @param settings - Locale/precision/separator options; defaults to\n * {@link DEFAULT_FORMATTING_SETTINGS} when omitted.\n * @example\n * ```typescript\n * const value = engine.evaluateExpression(\"10 USD to GBP\");\n * formatValue(value); // \"= £7.85\" (exact output depends on live exchange rates)\n * ```\n */\nexport function formatValue(value: Value, settings?: FormattingSettings): string {\n const us = settings || DEFAULT_FORMATTING_SETTINGS;\n const localeCode = us.numberResult.decimalSeparatorLocale || \"en\";\n const locale = getLocale(localeCode);\n\n switch (value.type) {\n case ValueType.Number:\n // A measurement with a tolerance renders as \"center ± spread\"; every\n // other number is unchanged, so a plain value is byte-for-byte what it was.\n if (value.uncertainty !== undefined) {\n return formatUncertain(value.value as number, value.uncertainty, locale, us);\n }\n return formatNumber(value.value as number, locale, us, value.decimalPlaces);\n case ValueType.Hex:\n return formatHex(value.value as number | bigint, us, value.unit);\n case ValueType.BigInt:\n return formatBigInt(value.value as bigint);\n case ValueType.String:\n return formatString(value.value as string);\n case ValueType.Boolean:\n return formatBoolean(value.value as boolean);\n case ValueType.Datetime:\n return formatDatetime(value.value as number, locale, us, value.zone);\n case ValueType.Uom:\n return formatUom(value.value as number, value.unit, locale, us, value.exact, value.datetimeSpan, value.decimalPlaces);\n case ValueType.Matrix:\n return formatMatrix(value.value as MatrixData, locale, us);\n case ValueType.Range: {\n const r = value.value as RangeData;\n return formatRange(r.min, r.max, locale);\n }\n case ValueType.Colour:\n return `${locale.display.resultPrefix}${formatColour(value.value as ColourData)}`;\n case ValueType.Split:\n return formatSplit(value.value as SplitData, locale, us);\n case ValueType.Chart:\n // A chart is drawn from its data by the host; the text answer is its label\n // (`sin(x) over [0, 6.28]`, or the series a sparkline came from).\n return `${locale.display.resultPrefix}${(value.value as ChartData).label}`;\n case ValueType.IpCidr:\n return `${locale.display.resultPrefix}${formatIpCidr(value.value as IpCidrData)}`;\n case ValueType.Symbolic:\n return formatSymbolic(value.value as SymbolicNode);\n case ValueType.Percentage:\n return formatPercentage(value.value as number, locale, us);\n case ValueType.Unit:\n return formatUnit(value.value as number, value.unit);\n case ValueType.Error:\n // errorValue(code, message) stores the human-readable message in\n // `.unit` (code goes in `.value`), falling through to the default\n // case here previously displayed the raw code (e.g.\n // \"CURRENCY_RATE_UNAVAILABLE\") instead of the actual message.\n return value.unit ?? String(value.value);\n default:\n return `= ${String(value.value)}`;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkF3UM5JNL_cjs=require('./chunk-F3UM5JNL.cjs');require('./chunk-6SYU4MH7.cjs');Object.defineProperty(exports,"ConfigManager",{enumerable:true,get:function(){return chunkF3UM5JNL_cjs.d}});Object.defineProperty(exports,"DEFAULT_CONFIG",{enumerable:true,get:function(){return chunkF3UM5JNL_cjs.b}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkF3UM5JNL_cjs.a}});//# sourceMappingURL=constants.cjs.map
1
+ 'use strict';var chunkVZ4FEVWA_cjs=require('./chunk-VZ4FEVWA.cjs');require('./chunk-6SYU4MH7.cjs');Object.defineProperty(exports,"ConfigManager",{enumerable:true,get:function(){return chunkVZ4FEVWA_cjs.d}});Object.defineProperty(exports,"DEFAULT_CONFIG",{enumerable:true,get:function(){return chunkVZ4FEVWA_cjs.b}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkVZ4FEVWA_cjs.a}});//# sourceMappingURL=constants.cjs.map
2
2
  //# sourceMappingURL=constants.cjs.map
package/dist/constants.js CHANGED
@@ -1,2 +1,2 @@
1
- export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-T24WU3LV.js';import'./chunk-6G2NES2I.js';//# sourceMappingURL=constants.js.map
1
+ export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-QXZVDT54.js';import'./chunk-6G2NES2I.js';//# sourceMappingURL=constants.js.map
2
2
  //# sourceMappingURL=constants.js.map
package/dist/engine.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkFKNZ3VFB_cjs=require('./chunk-FKNZ3VFB.cjs');require('./chunk-EFJCC6FJ.cjs');var chunkJVDNK45F_cjs=require('./chunk-JVDNK45F.cjs');require('./chunk-P5YWBIIU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-R3W53ZMP.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-CR7IHPA2.cjs'),require('./chunk-OBQC7KDY.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-EZ7R3ZHM.cjs'),require('./chunk-W4XLVZ6R.cjs'),require('./chunk-Y5ZY6DPX.cjs'),require('./chunk-K3PZ66XR.cjs'),require('./chunk-YV4GDW5A.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-GDLYXRMA.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-54QMY2VL.cjs'),require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-Z4MIX43O.cjs');var chunkEQNKDTMX_cjs=require('./chunk-EQNKDTMX.cjs');require('./chunk-E4HAKNBQ.cjs'),require('./chunk-NH74IT7B.cjs'),require('./chunk-PHWIO4P3.cjs'),require('./chunk-F3UM5JNL.cjs'),require('./chunk-3MG7VIPL.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-72J5V7SN.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-6SYU4MH7.cjs');Object.defineProperty(exports,"DocumentModel",{enumerable:true,get:function(){return chunkFKNZ3VFB_cjs.a}});Object.defineProperty(exports,"EvalTier",{enumerable:true,get:function(){return chunkFKNZ3VFB_cjs.b}});Object.defineProperty(exports,"ThreeTierEvaluator",{enumerable:true,get:function(){return chunkFKNZ3VFB_cjs.c}});Object.defineProperty(exports,"evaluateDocument",{enumerable:true,get:function(){return chunkFKNZ3VFB_cjs.d}});Object.defineProperty(exports,"AsyncResolutionBatcher",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.i}});Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.o}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.f}});Object.defineProperty(exports,"checkExpressionComplexity",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.k}});Object.defineProperty(exports,"checkExpressionLength",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.j}});Object.defineProperty(exports,"extractReadsAndWrites",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.l}});Object.defineProperty(exports,"findInlineSolvesInLine",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.n}});Object.defineProperty(exports,"isEmptyLine",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.m}});Object.defineProperty(exports,"setEngineWorkerFactory",{enumerable:true,get:function(){return chunkJVDNK45F_cjs.g}});Object.defineProperty(exports,"DATE_CALENDAR",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.b}});Object.defineProperty(exports,"DateCalendar",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.a}});Object.defineProperty(exports,"calendarOf",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.c}});Object.defineProperty(exports,"dateCalendarInZone",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.d}});//# sourceMappingURL=engine.cjs.map
1
+ 'use strict';var chunkHTB3D3FU_cjs=require('./chunk-HTB3D3FU.cjs');require('./chunk-EFJCC6FJ.cjs');var chunk5BRJQREI_cjs=require('./chunk-5BRJQREI.cjs');require('./chunk-P5YWBIIU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-R3W53ZMP.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-CR7IHPA2.cjs'),require('./chunk-TIWNKFSD.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-4AX7GIZY.cjs'),require('./chunk-W4XLVZ6R.cjs'),require('./chunk-U5PPRJ3B.cjs'),require('./chunk-K3PZ66XR.cjs'),require('./chunk-YV4GDW5A.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-GDLYXRMA.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-VOWMVLVV.cjs'),require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-3ZFJLH4W.cjs'),require('./chunk-NIDVZMKV.cjs');var chunkEQNKDTMX_cjs=require('./chunk-EQNKDTMX.cjs');require('./chunk-E4HAKNBQ.cjs'),require('./chunk-SXLHFK7M.cjs'),require('./chunk-PHWIO4P3.cjs'),require('./chunk-VZ4FEVWA.cjs'),require('./chunk-3MG7VIPL.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-72J5V7SN.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-6SYU4MH7.cjs');Object.defineProperty(exports,"DocumentModel",{enumerable:true,get:function(){return chunkHTB3D3FU_cjs.a}});Object.defineProperty(exports,"EvalTier",{enumerable:true,get:function(){return chunkHTB3D3FU_cjs.b}});Object.defineProperty(exports,"ThreeTierEvaluator",{enumerable:true,get:function(){return chunkHTB3D3FU_cjs.c}});Object.defineProperty(exports,"evaluateDocument",{enumerable:true,get:function(){return chunkHTB3D3FU_cjs.d}});Object.defineProperty(exports,"AsyncResolutionBatcher",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.i}});Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.o}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.f}});Object.defineProperty(exports,"checkExpressionComplexity",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.k}});Object.defineProperty(exports,"checkExpressionLength",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.j}});Object.defineProperty(exports,"extractReadsAndWrites",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.l}});Object.defineProperty(exports,"findInlineSolvesInLine",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.n}});Object.defineProperty(exports,"isEmptyLine",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.m}});Object.defineProperty(exports,"setEngineWorkerFactory",{enumerable:true,get:function(){return chunk5BRJQREI_cjs.g}});Object.defineProperty(exports,"DATE_CALENDAR",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.b}});Object.defineProperty(exports,"DateCalendar",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.a}});Object.defineProperty(exports,"calendarOf",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.c}});Object.defineProperty(exports,"dateCalendarInZone",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.d}});//# sourceMappingURL=engine.cjs.map
2
2
  //# sourceMappingURL=engine.cjs.map