solve-engine 2.38.21 → 2.38.23
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.
- package/dist/{PackageCompatibility-ZCZVGHws.d.ts → PackageCompatibility-C7ILySsH.d.ts} +1 -1
- package/dist/{PackageCompatibility-Bv42nEm2.d.cts → PackageCompatibility-CzDzOIg9.d.cts} +1 -1
- package/dist/{PackageRegistry-7dFbaAZp.d.cts → PackageRegistry-Bd8ErpwZ.d.cts} +78 -1
- package/dist/{PackageRegistry-B6s8LGCu.d.ts → PackageRegistry-D7_B0mxv.d.ts} +78 -1
- package/dist/{VMBuiltins-0C4z3yDS.d.cts → VMBuiltins-Baa90D2v.d.cts} +232 -1
- package/dist/{VMBuiltins-Bu6qaKi0.d.ts → VMBuiltins-BqkoJtHt.d.ts} +232 -1
- package/dist/chunk-54QMY2VL.cjs +2 -0
- package/dist/chunk-54QMY2VL.cjs.map +1 -0
- package/dist/{chunk-7PUNL5CJ.cjs → chunk-6FBXJYWO.cjs} +3 -3
- package/dist/{chunk-H4G3UXJV.js.map → chunk-6FBXJYWO.cjs.map} +1 -1
- package/dist/chunk-AEGR3GFA.js +3 -0
- package/dist/chunk-AEGR3GFA.js.map +1 -0
- package/dist/chunk-CR7IHPA2.cjs +2 -0
- package/dist/chunk-CR7IHPA2.cjs.map +1 -0
- package/dist/{chunk-NFASELLK.js → chunk-FBXQUQCY.js} +2 -2
- package/dist/{chunk-NFASELLK.js.map → chunk-FBXQUQCY.js.map} +1 -1
- package/dist/chunk-GITRBCSD.cjs +5 -0
- package/dist/chunk-GITRBCSD.cjs.map +1 -0
- package/dist/chunk-JVHRND2N.js +5 -0
- package/dist/chunk-JVHRND2N.js.map +1 -0
- package/dist/{chunk-H4G3UXJV.js → chunk-KSOB5FCI.js} +3 -3
- package/dist/chunk-KSOB5FCI.js.map +1 -0
- package/dist/chunk-OBQC7KDY.cjs +2 -0
- package/dist/chunk-OBQC7KDY.cjs.map +1 -0
- package/dist/{chunk-VLFP6IAY.cjs → chunk-OGBLSNQE.cjs} +2 -2
- package/dist/{chunk-VLFP6IAY.cjs.map → chunk-OGBLSNQE.cjs.map} +1 -1
- package/dist/chunk-QP4VIEXZ.js +2 -0
- package/dist/chunk-QP4VIEXZ.js.map +1 -0
- package/dist/chunk-RMBUP4XA.js +2 -0
- package/dist/chunk-RMBUP4XA.js.map +1 -0
- package/dist/chunk-UITBYTCD.cjs +3 -0
- package/dist/chunk-UITBYTCD.cjs.map +1 -0
- package/dist/chunk-X2QJE3SV.js +2 -0
- package/dist/chunk-X2QJE3SV.js.map +1 -0
- package/dist/chunk-Y5ZY6DPX.cjs +2 -0
- package/dist/chunk-Y5ZY6DPX.cjs.map +1 -0
- package/dist/chunk-ZISAN7NW.js +2 -0
- package/dist/chunk-ZISAN7NW.js.map +1 -0
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +128 -5
- package/dist/engine.d.ts +128 -5
- package/dist/engine.js +1 -1
- package/dist/engine.worker.cjs +1 -1
- package/dist/engine.worker.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/language.d.cts +3 -3
- package/dist/language.d.ts +3 -3
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +2 -2
- package/dist/packages.d.ts +2 -2
- package/dist/packages.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.d.cts +1 -1
- package/dist/vm.d.ts +1 -1
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.d.cts +2 -2
- package/dist/worker.d.ts +2 -2
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2YHOWQ43.js +0 -2
- package/dist/chunk-2YHOWQ43.js.map +0 -1
- package/dist/chunk-3JSXJSMT.js +0 -2
- package/dist/chunk-3JSXJSMT.js.map +0 -1
- package/dist/chunk-432HHLSB.cjs +0 -5
- package/dist/chunk-432HHLSB.cjs.map +0 -1
- package/dist/chunk-5QA3BI4V.js +0 -3
- package/dist/chunk-5QA3BI4V.js.map +0 -1
- package/dist/chunk-6W3JFXPQ.cjs +0 -2
- package/dist/chunk-6W3JFXPQ.cjs.map +0 -1
- package/dist/chunk-7PUNL5CJ.cjs.map +0 -1
- package/dist/chunk-EPLOL7WC.cjs +0 -2
- package/dist/chunk-EPLOL7WC.cjs.map +0 -1
- package/dist/chunk-HNXV35Q2.cjs +0 -2
- package/dist/chunk-HNXV35Q2.cjs.map +0 -1
- package/dist/chunk-JM7BIFF4.js +0 -5
- package/dist/chunk-JM7BIFF4.js.map +0 -1
- package/dist/chunk-JZQRUOO6.js +0 -2
- package/dist/chunk-JZQRUOO6.js.map +0 -1
- package/dist/chunk-K2OUNZZG.cjs +0 -2
- package/dist/chunk-K2OUNZZG.cjs.map +0 -1
- package/dist/chunk-LJIR7MLG.cjs +0 -3
- package/dist/chunk-LJIR7MLG.cjs.map +0 -1
- package/dist/chunk-SIUHB77U.js +0 -2
- package/dist/chunk-SIUHB77U.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');var d="2.38.
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
'use strict';var chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');var d="2.38.23";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-OGBLSNQE.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-OGBLSNQE.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,CAKjB,iBAAA,CAAmB,GAAA,CAInB,qBAAsB,GAAA,CAMtB,gBAAA,CAAkB,IAMlB,qBAAA,CAAuB,GACzB,EACA,MAAA,CAAQ,CACN,qBAAsB,CAAA,CACtB,aAAA,CAAe,IACf,UAAA,CAAY,CAAA,CACZ,cAAe,GACjB,CAAA,CACA,WAAY,CACV,OAAA,CAAS,MACT,cAAA,CAAgB,KAClB,EACA,iBAAA,CAAmB,CACjB,QAAS,KACX,CAAA,CACA,QAAS,CAGP,OAAA,CAAS,IACX,CACF,EAiBK,SAASC,CAAAA,CACdC,CAAAA,CACAC,EACc,CACd,OAAO,CACL,IAAA,CAAM,CAAE,GAAGD,CAAAA,CAAK,KAAM,GAAGC,CAAAA,CAAS,IAAK,CAAA,CACvC,WAAA,CAAa,CAAE,GAAGD,CAAAA,CAAK,YAAa,GAAGC,CAAAA,CAAS,WAAY,CAAA,CAC5D,UAAA,CAAY,CAAE,GAAGD,CAAAA,CAAK,WAAY,GAAGC,CAAAA,CAAS,UAAW,CAAA,CACzD,EAAA,CAAI,CAAE,GAAGD,CAAAA,CAAK,GAAI,GAAGC,CAAAA,CAAS,EAAG,CAAA,CACjC,MAAA,CAAQ,CAAE,GAAGD,CAAAA,CAAK,OAAQ,GAAGC,CAAAA,CAAS,MAAO,CAAA,CAC7C,UAAA,CAAY,CAAE,GAAGD,CAAAA,CAAK,UAAA,CAAY,GAAGC,EAAS,UAAW,CAAA,CACzD,kBAAmB,CAAE,GAAGD,EAAK,iBAAA,CAAmB,GAAGC,EAAS,iBAAkB,CAAA,CAC9E,QAAS,CAAE,GAAGD,EAAK,OAAA,CAAS,GAAGC,EAAS,OAAQ,CAClD,CACF,CAYO,IAAMC,EAAN,KAAoB,CAGzB,YAAYC,CAAAA,CAAgC,GAAI,CAC9C,IAAA,CAAK,OAASJ,CAAAA,CAAkBD,CAAAA,CAAgBK,CAAM,EACxD,CAQA,IAAOC,CAAAA,CAAiB,CACtB,IAAMC,CAAAA,CAAOD,CAAAA,CAAK,KAAA,CAAM,GAAG,EACvBE,CAAAA,CAAmB,IAAA,CAAK,OAE5B,IAAA,IAAWC,CAAAA,IAAOF,EAChB,GAAIC,CAAAA,EAAW,OAAOA,CAAAA,EAAY,QAAA,EAAYC,KAAOD,CAAAA,CACnDA,CAAAA,CAAWA,EAAoCC,CAAG,CAAA,CAAA,WAE5CC,mBAAAA,CAAa,MAAA,CACjB,wBACA,CAAA,8BAAA,EAAiCJ,CAAI,GACrC,CAAE,IAAA,CAAAA,CAAK,CACT,CAAA,CAIJ,OAAOE,CACT,CAQA,IAAOF,CAAAA,CAAcK,CAAAA,CAAgB,CACnC,IAAMJ,CAAAA,CAAOD,EAAK,KAAA,CAAM,GAAG,EAC3B,GAAIC,CAAAA,CAAK,MAAA,CAAS,CAAA,CAChB,MAAMG,mBAAAA,CAAa,MAAA,CACjB,sBACA,CAAA,cAAA,EAAiBJ,CAAI,yCACrB,CAAE,IAAA,CAAAA,CAAK,CACT,CAAA,CAGF,IAAMM,CAAAA,CAAUL,CAAAA,CAAK,CAAC,CAAA,CAChBM,CAAAA,CAAWN,EAAK,CAAC,CAAA,CAEvB,GAAI,EAAEK,CAAAA,IAAW,KAAK,MAAA,CAAA,CACpB,MAAMF,oBAAa,MAAA,CACjB,0BAAA,CACA,oCAAoCE,CAAO,CAAA,CAAA,CAC3C,CAAE,OAAA,CAAAA,CAAAA,CAAS,KAAAN,CAAK,CAClB,EAGF,IAAMQ,CAAAA,CAAgB,KAAK,MAAA,CAAOF,CAA6B,CAAA,CAC/D,GAAIE,GAAiB,OAAOA,CAAAA,EAAkB,SAC3CA,CAAAA,CAAqDD,CAAQ,EAAIF,CAAAA,CAAAA,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-VLFP6IAY.cjs","sourcesContent":["{\n \"name\": \"solve-engine\",\n \"version\": \"2.38.21\",\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,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,CAKjB,iBAAA,CAAmB,GAAA,CAInB,qBAAsB,GAAA,CAMtB,gBAAA,CAAkB,IAMlB,qBAAA,CAAuB,GACzB,EACA,MAAA,CAAQ,CACN,qBAAsB,CAAA,CACtB,aAAA,CAAe,IACf,UAAA,CAAY,CAAA,CACZ,cAAe,GACjB,CAAA,CACA,WAAY,CACV,OAAA,CAAS,MACT,cAAA,CAAgB,KAClB,EACA,iBAAA,CAAmB,CACjB,QAAS,KACX,CAAA,CACA,QAAS,CAGP,OAAA,CAAS,IACX,CACF,EAiBK,SAASC,CAAAA,CACdC,CAAAA,CACAC,EACc,CACd,OAAO,CACL,IAAA,CAAM,CAAE,GAAGD,CAAAA,CAAK,KAAM,GAAGC,CAAAA,CAAS,IAAK,CAAA,CACvC,WAAA,CAAa,CAAE,GAAGD,CAAAA,CAAK,YAAa,GAAGC,CAAAA,CAAS,WAAY,CAAA,CAC5D,UAAA,CAAY,CAAE,GAAGD,CAAAA,CAAK,WAAY,GAAGC,CAAAA,CAAS,UAAW,CAAA,CACzD,EAAA,CAAI,CAAE,GAAGD,CAAAA,CAAK,GAAI,GAAGC,CAAAA,CAAS,EAAG,CAAA,CACjC,MAAA,CAAQ,CAAE,GAAGD,CAAAA,CAAK,OAAQ,GAAGC,CAAAA,CAAS,MAAO,CAAA,CAC7C,UAAA,CAAY,CAAE,GAAGD,CAAAA,CAAK,UAAA,CAAY,GAAGC,EAAS,UAAW,CAAA,CACzD,kBAAmB,CAAE,GAAGD,EAAK,iBAAA,CAAmB,GAAGC,EAAS,iBAAkB,CAAA,CAC9E,QAAS,CAAE,GAAGD,EAAK,OAAA,CAAS,GAAGC,EAAS,OAAQ,CAClD,CACF,CAYO,IAAMC,EAAN,KAAoB,CAGzB,YAAYC,CAAAA,CAAgC,GAAI,CAC9C,IAAA,CAAK,OAASJ,CAAAA,CAAkBD,CAAAA,CAAgBK,CAAM,EACxD,CAQA,IAAOC,CAAAA,CAAiB,CACtB,IAAMC,CAAAA,CAAOD,CAAAA,CAAK,KAAA,CAAM,GAAG,EACvBE,CAAAA,CAAmB,IAAA,CAAK,OAE5B,IAAA,IAAWC,CAAAA,IAAOF,EAChB,GAAIC,CAAAA,EAAW,OAAOA,CAAAA,EAAY,QAAA,EAAYC,KAAOD,CAAAA,CACnDA,CAAAA,CAAWA,EAAoCC,CAAG,CAAA,CAAA,WAE5CC,mBAAAA,CAAa,MAAA,CACjB,wBACA,CAAA,8BAAA,EAAiCJ,CAAI,GACrC,CAAE,IAAA,CAAAA,CAAK,CACT,CAAA,CAIJ,OAAOE,CACT,CAQA,IAAOF,CAAAA,CAAcK,CAAAA,CAAgB,CACnC,IAAMJ,CAAAA,CAAOD,EAAK,KAAA,CAAM,GAAG,EAC3B,GAAIC,CAAAA,CAAK,MAAA,CAAS,CAAA,CAChB,MAAMG,mBAAAA,CAAa,MAAA,CACjB,sBACA,CAAA,cAAA,EAAiBJ,CAAI,yCACrB,CAAE,IAAA,CAAAA,CAAK,CACT,CAAA,CAGF,IAAMM,CAAAA,CAAUL,CAAAA,CAAK,CAAC,CAAA,CAChBM,CAAAA,CAAWN,EAAK,CAAC,CAAA,CAEvB,GAAI,EAAEK,CAAAA,IAAW,KAAK,MAAA,CAAA,CACpB,MAAMF,oBAAa,MAAA,CACjB,0BAAA,CACA,oCAAoCE,CAAO,CAAA,CAAA,CAC3C,CAAE,OAAA,CAAAA,CAAAA,CAAS,KAAAN,CAAK,CAClB,EAGF,IAAMQ,CAAAA,CAAgB,KAAK,MAAA,CAAOF,CAA6B,CAAA,CAC/D,GAAIE,GAAiB,OAAOA,CAAAA,EAAkB,SAC3CA,CAAAA,CAAqDD,CAAQ,EAAIF,CAAAA,CAAAA,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-OGBLSNQE.cjs","sourcesContent":["{\n \"name\": \"solve-engine\",\n \"version\": \"2.38.23\",\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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-X2GQAKL2.js';import {c as c$2}from'./chunk-PICFFFJV.js';import {ga,C as C$1,z,B,E,p,i,j,r,s,qa,l,h,g,f,e as e$1,k,Q as Q$2,V as V$1,ha,la as la$1,ra,ja,ma as ma$1,J as J$1,w,o,a as a$1,d,u as u$1,W as W$1,Y,F as F$1,_,da as da$1,ca as ca$1,ba,$,L,O,c as c$3,na,pa,ka as ka$1,ia,oa,v as v$1,q as q$1,m as m$1,b as b$2,A,n as n$1,K as K$1,fa,I,H as H$1,G as G$1,N as N$1,t as t$1,D,P as P$2,y,x,M}from'./chunk-ZSFOIBIH.js';import {b}from'./chunk-EOO6M65F.js';import {Q as Q$1,P as P$1,p as p$1,q,K,n,s as s$1,u,C as C$2,v,m,H,N,t,r as r$1}from'./chunk-A34R65WT.js';import {c as c$1,e,i as i$1,j as j$1}from'./chunk-BWTVJD5L.js';import {a}from'./chunk-PRSXXDTA.js';import {c}from'./chunk-6G2NES2I.js';var Rt={variable:"",global:"global:",tag:"#",datasource:"ds:",line:"line:"};function At(e,t){return Rt[e]+t}function xr(e,t){if(e.runLo===-1)e.runLo=t,e.runHi=t;else {if(t>=e.runLo&&t<=e.runHi)return;t===e.runHi+1?(e.runHi=t,e.runSparse!==null&&e.runSparse.delete(t)):t===e.runLo-1?(e.runLo=t,e.runSparse!==null&&e.runSparse.delete(t)):e.runSparse===null?e.runSparse=new Set([t]):e.runSparse.add(t);}}function vr(e,t){return t>=e.runLo&&t<=e.runHi?true:e.runSparse!==null&&e.runSparse.has(t)}function Mr(e,t){if(e===null||e.size===0)return t===null||t.size===0;if(t===null||e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function gt(e){return At("line",String(e))}function Ii(e){for(let t in Rt){let n=Rt[t];if(n!==""&&e.startsWith(n))return true}return false}function Nn(e,t){return At("datasource",`${e}:${JSON.stringify(t)}`)}var Ie=new Set,Nt=new Set,Xe=[],Er=[],Rn=class{constructor(){this.consumers=new Map;this.producers=new Map;this.dependencies=new Map;this.writes=new Map;this.lineReads=new Map;this.pinnedReads=new Map;this.positionReads=new Map;this.lastPositionReader=-1;this.lastPositionReads=null;this.readersThatGainedAPosition=[];this.downwardPositionReads=0;this.edgesChangedThisPass=[];this.producersChangedThisPass=null;}hasSameEdges(t,n,r,o,i){if(t===void 0||t.size!==r.length+(i?.size??0))return false;if(o.length===0){if(n!==void 0)return false}else if(n===void 0||n.size!==o.length)return false;for(let a of r)if(!t.has(a))return false;if(n!==void 0){for(let a of o)if(!n.has(a))return false}return true}registerLine(t,n,r){let o=this.pinnedReads.size!==0?this.pinnedReads.get(t):void 0,i=this.lineReads.get(t),a=this.writes.get(t);if(this.hasSameEdges(i,a,n,r,o))return Xe;if(this.edgesChangedThisPass.push(t),i)for(let l of i){if(o?.has(l))continue;let m=this.consumers.get(l);m&&m.delete(t);}let s=null;if(a)for(let l of a){let m=this.producers.get(l);m!==void 0&&(m.delete(t),r.includes(l)||(this.producersChangedThisPass??(this.producersChangedThisPass=new Set)).add(l),m.size===0&&!r.includes(l)&&(this.producers.delete(l),(s??(s=[])).push(l)));}let u=new Set(n);if(o)for(let l of o)u.add(l);this.lineReads.set(t,u);for(let l of n){let m=this.consumers.get(l);m!==void 0?m.add(t):this.consumers.set(l,new Set([t]));}for(let l of r){(a===void 0||!a.has(l))&&(this.producersChangedThisPass??(this.producersChangedThisPass=new Set)).add(l);let m=this.producers.get(l);m!==void 0?m.add(t):this.producers.set(l,new Set([t]));}if(r.length>0){this.dependencies.set(t,o===void 0?u:new Set(n)),this.writes.set(t,new Set(r));for(let l of r){let m=this.consumers.get(l);m&&m.delete(t);}}else this.writes.delete(t),this.dependencies.delete(t);return s??Xe}registerLineDataSourceDependency(t,n,r){let o=Nn(n,r),i=this.pinnedReads.get(t);i!==void 0?i.add(o):this.pinnedReads.set(t,new Set([o]));let a=this.lineReads.get(t);a===void 0?this.lineReads.set(t,new Set([o])):(a===this.dependencies.get(t)&&this.dependencies.set(t,new Set(a)),a.add(o));let s=this.consumers.get(o);s!==void 0?s.add(t):this.consumers.set(o,new Set([t]));}getAffectedLines(t){let n=new Set,r=this.consumers.get(t);if(r===void 0)return n;let o=new Set([t]),i=[r];for(let a=0;a<i.length;a++)for(let s of i[a]){if(n.has(s))continue;n.add(s);let u=this.writes.get(s);if(u!==void 0)for(let l of u){if(o.has(l))continue;o.add(l);let m=this.consumers.get(l);m!==void 0&&i.push(m);}}return n}getAffectedLinesInOrder(t){let n=this.getAffectedLines(t);if(n.size===0)return [];let r=n.size,o=new Array(r),i=new Array(r),a=new Array(r);{let h=0;for(let A of n)o[h]=A,i[h]=this.writes.get(A),a[h]=this.lineReads.get(A),h++;}let s=new Set;for(let h=0;h<r;h++){let A=i[h];if(A!==void 0)for(let j of A)s.add(j);}let u=new Map,l=[],m=[];for(let h=0;h<r;h++){let A=a[h];if(A===void 0)continue;let j=i[h];for(let Y of A){if(!s.has(Y)||j!==void 0&&j.has(Y))continue;let ee=u.get(Y);ee===void 0&&(ee=r+u.size,u.set(Y,ee)),l.push(ee),m.push(h);}}let y=r+u.size;if(u.size===0)return o;let g=[],E=[];for(let h=0;h<r;h++){let A=i[h];if(A!==void 0)for(let j of A){let Y=u.get(j);Y!==void 0&&(g.push(h),E.push(Y));}}let q=g.length,ut=l.length,Le=new Int32Array(y),Fe=new Int32Array(y);for(let h=0;h<q;h++)Le[g[h]]++,Fe[E[h]]++;for(let h=0;h<ut;h++)Le[l[h]]++,Fe[m[h]]++;let ue=new Int32Array(y+1);for(let h=0;h<y;h++)ue[h+1]=ue[h]+Le[h];let lt=new Int32Array(ue[y]),ct=Le;ct.set(ue.subarray(0,y));for(let h=0;h<q;h++)lt[ct[g[h]]++]=E[h];for(let h=0;h<ut;h++)lt[ct[l[h]]++]=m[h];let Ue=new Int32Array(y),ge=new Uint8Array(y),Ne=0;for(let h=0;h<y;h++)Fe[h]===0&&(Ue[Ne++]=h,ge[h]=1);if(Ne===0){let h=0;for(let A=1;A<r;A++)o[A]<o[h]&&(h=A);Ue[Ne++]=h,ge[h]=1;}let $e=[];for(let h=0;h<Ne;h++){let A=Ue[h];A<r&&$e.push(o[A]);let j=ue[A+1];for(let Y=ue[A];Y<j;Y++){let ee=lt[Y];--Fe[ee]===0&&ge[ee]===0&&(Ue[Ne++]=ee,ge[ee]=1);}}if($e.length<r){let h=[];for(let A=0;A<r;A++)ge[A]===0&&h.push(o[A]);h.sort((A,j)=>A-j);for(let A=0;A<h.length;A++)$e.push(h[A]);}return $e}registerLinePositionDependency(t,n){if(t===n)return;let r;if(this.lastPositionReader===t?r=this.lastPositionReads??void 0:(r=this.positionReads.get(t),this.lastPositionReader=t,this.lastPositionReads=r??null),r===void 0)r={lo:n,hi:n,sparse:null,runLo:n,runHi:n,runSparse:null},this.positionReads.set(t,r),this.lastPositionReads=r;else {if(xr(r,n),n>=r.lo&&n<=r.hi)return;if(n===r.hi+1)r.hi=n,r.sparse!==null&&r.sparse.delete(n);else if(n===r.lo-1)r.lo=n,r.sparse!==null&&r.sparse.delete(n);else if(r.sparse===null)r.sparse=new Set([n]);else {if(r.sparse.has(n))return;r.sparse.add(n);}}let o=gt(n),i=this.pinnedReads.get(t);i!==void 0?i.add(o):this.pinnedReads.set(t,new Set([o]));let a=this.lineReads.get(t);a===void 0?this.lineReads.set(t,new Set([o])):(a===this.dependencies.get(t)&&this.dependencies.set(t,new Set(a)),a.add(o));let s=this.consumers.get(o);if(s!==void 0){if(s.has(t))return;s.add(t);}else this.consumers.set(o,new Set([t]));n>t&&this.downwardPositionReads++;let u=this.readersThatGainedAPosition;(u.length===0||u[u.length-1]!==t)&&u.push(t);}reconcilePositionReads(t){let n=this.positionReads.get(t);if(n===void 0)return;if(n.runLo===-1){this.forgetPositionReads(t);return}if(!(n.lo===n.runLo&&n.hi===n.runHi&&Mr(n.sparse,n.runSparse))){for(let o of this.positionsReadFrom(n))vr(n,o)||this.dropPositionRead(t,o);n.lo=n.runLo,n.hi=n.runHi,n.sparse=n.runSparse;}n.runLo=-1,n.runHi=-1,n.runSparse=null;}forgetPositionReads(t){let n=this.positionReads.get(t);if(n!==void 0){this.positionReads.delete(t),this.lastPositionReader===t&&(this.lastPositionReader=-1,this.lastPositionReads=null);for(let r of this.positionsReadFrom(n))this.dropPositionRead(t,r);}}positionsReadBy(t){let n=this.positionReads.get(t);return n===void 0?[]:this.positionsReadFrom(n)}takeEdgeChanges(){let t=this.edgesChangedThisPass,n=this.producersChangedThisPass===null?Xe:[...this.producersChangedThisPass];return t.length!==0&&(this.edgesChangedThisPass=[]),this.producersChangedThisPass=null,{lines:t,keys:n}}takeReadersThatGainedAPosition(){if(this.readersThatGainedAPosition.length===0)return Er;let t=this.readersThatGainedAPosition;return this.readersThatGainedAPosition=[],t}hasDownwardPositionRead(){return this.downwardPositionReads>0}positionsReadFrom(t){let n=[];if(t.lo!==-1)for(let r=t.lo;r<=t.hi;r++)n.push(r);if(t.sparse!==null)for(let r of t.sparse)n.push(r);return n}dropPositionRead(t,n){let r=gt(n),o=this.consumers.get(r);if(o===void 0||!o.delete(t))return;o.size===0&&this.consumers.delete(r);let i=this.pinnedReads.get(t);i!==void 0&&(i.delete(r),i.size===0&&this.pinnedReads.delete(t)),this.lineReads.get(t)?.delete(r),n>t&&this.downwardPositionReads--;let a=this.edgesChangedThisPass;(a.length===0||a[a.length-1]!==t)&&a.push(t);}linesReadingAPosition(){return this.positionReads.keys()}getAffectedLinesByPosition(t){return this.consumers.get(gt(t))??Ie}getAffectedLinesByDataSource(t,n){return this.consumers.get(Nn(t,n))??Ie}removeLine(t){this.forgetPositionReads(t);for(let i of this.writes.get(t)??[])(this.producersChangedThisPass??(this.producersChangedThisPass=new Set)).add(i);let n=this.lineReads.get(t);if(n){for(let i of n){let a=this.consumers.get(i);a&&a.delete(t);}this.lineReads.delete(t);}let r=null,o=this.writes.get(t);if(o)for(let i of o){let a=this.producers.get(i);a!==void 0&&(a.delete(t),a.size===0&&(this.producers.delete(i),(r??(r=[])).push(i)));}return o!==void 0&&(this.dependencies.delete(t),this.writes.delete(t)),this.pinnedReads.size!==0&&this.pinnedReads.delete(t),r??Xe}getConsumers(t){return this.consumers.get(t)??Ie}directConsumersOf(t){return this.consumers.get(t)??Ie}getProducers(t){return this.producers.get(t)??Ie}getDependencies(t){return this.dependencies.get(t)??Nt}getReads(t){return this.lineReads.get(t)??Nt}getWrites(t){return this.writes.get(t)??Nt}getSnapshot(){let t={};for(let[u,l]of this.consumers)t[u]=Array.from(l);let n={};for(let[u,l]of this.writes)n[u]=Array.from(l);let r={};for(let[u,l]of this.lineReads)r[u]=Array.from(l);let o={};for(let[u,l]of this.producers)o[u]=Array.from(l);let i=At("datasource",""),a={};for(let[u,l]of this.lineReads){let m=Array.from(l).filter(y=>y.startsWith(i));m.length>0&&(a[u]=m.map(y=>y.slice(i.length)));}let s={};for(let[u,l]of this.consumers)u.startsWith(i)&&(s[u.slice(i.length)]=Array.from(l));return {consumers:t,producers:o,writes:n,reads:r,dataSourceDeps:a,dataSourceConsumers:s}}clear(){this.consumers.clear(),this.producers.clear(),this.dependencies.clear(),this.writes.clear(),this.lineReads.clear(),this.pinnedReads.clear(),this.positionReads.clear(),this.lastPositionReader=-1,this.lastPositionReads=null,this.readersThatGainedAPosition=[],this.downwardPositionReads=0,this.edgesChangedThisPass=[],this.producersChangedThisPass=null;}};function An(e,t){let n=t===2?L:M,r=n(e.n),o=n(e.d);return r===null||o===null?null:{n:r,d:o}}function Sn(e,t){let n=y(e),r=new Map;for(let[o,i]of n){if(i%t!==0)return null;r.set(o,i/t);}return x(r)}function Ir(e,t){let n=y(e);for(let[r,o]of y(t))n.set(r,(n.get(r)??0)+o);return x(n)}function xn(e,t){let n=y(e);for(let[r,o]of y(t)){let i=(n.get(r)??0)-o;i<=0?n.delete(r):n.set(r,i);}return x(n)}function kr(e,t){let n=y(e),r=new Map;for(let[o,i]of y(t)){let a=n.get(o);a!==void 0&&r.set(o,Math.min(a,i));}return x(r)}function wr(e){let t=new Set;for(let n of e)for(let r of y(n).keys())t.add(r);return [...t].sort()}function oe(e){let t=new Map;for(let n of e)t.set(n.key,n.coefficient);return E({terms:t,vars:wr(e.map(n=>n.key))})}function St(e){let t=e[0];for(let n=1;n<e.length;n++)t={kind:"mul",left:t,right:e[n]};return t}function Tr(e){return [...e.terms].map(([n,r])=>({key:n,coefficient:r})).sort((n,r)=>D(n.key,r.key,e.vars))}function En(e){if(e.vars.length<2)return null;let t=Tr(e);return t.length===2?_r(t[0],t[1]):t.length===3?Cr(t):t.length===4?Pr(t):null}function _r(e,t){let n=e.coefficient.n>0n,r=t.coefficient.n>0n;if(!n)return null;let o=xt(e,t,2);if(o!==null&&!r)return St([oe([o.a,Ze(o.b)]),oe([o.a,o.b])]);let i=xt(e,t,3);if(i===null)return null;let a=oe(r?[i.a,i.b]:[i.a,Ze(i.b)]),s=r?Ze(ze(i.a,i.b)):ze(i.a,i.b);return St([a,oe([vn(i.a),s,vn(i.b)])])}function xt(e,t,n){let r=t.coefficient.n<0n?j(t.coefficient):t.coefficient,o=An(e.coefficient,n),i=An(r,n);if(o===null||i===null)return null;let a=Sn(e.key,n),s=Sn(t.key,n);return a===null||s===null?null:{a:{key:a,coefficient:o},b:{key:s,coefficient:i}}}function Ze(e){return {key:e.key,coefficient:j(e.coefficient)}}function ze(e,t){return {key:Ir(e.key,t.key),coefficient:h(e.coefficient,t.coefficient)}}function vn(e){return ze(e,e)}function Cr(e){let[t,n,r]=e;if(t.coefficient.n<0n||r.coefficient.n<0n)return null;let o=xt(t,r,2);if(o===null)return null;let i$1=ze(o.a,o.b);if(i$1.key!==n.key)return null;let a=h(i$1.coefficient,{n:2n,d:1n}),s=n.coefficient.n<0n,u=s?j(n.coefficient):n.coefficient;return m$1(i(u,a))?{kind:"pow",base:oe([o.a,s?Ze(o.b):o.b]),exponent:p(2)}:null}function Pr(e){let t=[[[0,1],[2,3]],[[0,2],[1,3]],[[0,3],[1,2]]];for(let n of t){let r=Mn(e[n[0][0]],e[n[0][1]]),o=Mn(e[n[1][0]],e[n[1][1]]);if(!(r===null||o===null)&&Vr(r.cofactor,o.cofactor))return St([oe([r.common,o.common]),oe(r.cofactor)])}return null}function Mn(e,t){let n=kr(e.key,t.key),r={key:n,coefficient:e.coefficient},o=[{key:xn(e.key,n),coefficient:{n:1n,d:1n}},{key:xn(t.key,n),coefficient:i(t.coefficient,e.coefficient)}];return o[0].key===o[1].key?null:{common:r,cofactor:o}}function Vr(e,t){return e.length!==t.length?false:e.every((n,r)=>n.key===t[r].key&&n.coefficient.n===t[r].coefficient.n&&n.coefficient.d===t[r].coefficient.d)}var Or=12,We=4096,Dr=100000n;function Qe(e,t){let n=e<0n?-e:e,r=t<0n?-t:t;for(;r!==0n;){let o=n%r;n=r,r=o;}return n}function kn(e,t){return e===0n||t===0n?0n:e/Qe(e,t)*t}function In(e){let t=e<0n?-e:e;if(t===0n)return null;let n=[];for(let r=1n;r*r<=t;r++){if(r>Dr)return null;if(t%r!==0n)continue;n.push(r);let o=t/r;if(o!==r&&n.push(o),n.length>We)return null}return n}function wn(e,t){let n=a$1;for(let r of e)n=f(h(n,t),r);return n}function Lr(e,t){let n=[e[0]];for(let r=1;r<e.length-1;r++)n.push(f(e[r],h(n[r-1],t)));return n}function he(e){if(e.length<2)return [];if(e.length===2){let[l$1,m]=e;return l(l$1)?[]:[i(g(a$1,m),l$1)]}let t=1n;for(let l of e)t=kn(t,l.d);let n=e.map(l=>l.n*t/l.d),r=n[0],o=n[n.length-1];if(o===0n)return [];let i$1=In(o),a=In(r);if(i$1===null||a===null)throw c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial's coefficients have too many divisors to search for rational roots.",{limit:We});if(i$1.length*a.length>We)throw c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial has too many candidate rational roots to test.",{limit:We});let s=[],u=new Set;for(let l$1 of i$1)for(let m of a)for(let y of [1n,-1n]){let g={n:y*l$1/Qe(l$1,m),d:m/Qe(l$1,m)},E=`${g.n}/${g.d}`;u.has(E)||(u.add(E),l(wn(e,g))&&s.push(g));}return s}function Fr(e,t){return l(t)?q$1(e):t.n>0n?{kind:"sub",left:q$1(e),right:p(t)}:{kind:"add",left:q$1(e),right:p(j(t))}}function Ur(e,t){let n=e.length-1,r=new Map;return e.forEach((o,i)=>{if(l(o))return;let a=n-i;r.set(a===0?"":a===1?t:`${t}^${a}`,o);}),E({terms:r,vars:r.size>0?[t]:[]})}function Mt(e,t){let n=[],r=[...e],o=he(r);for(;o.length>0&&r.length>2;){for(let a of o){let s=0;for(;r.length>1&&l(wn(r,a));)r=Lr(r,a),s++;s>0&&n.push({base:Fr(t,a),power:s});}o=r.length>2?he(r):[];}return r.length-1>=1?(n.push({base:Ur(r,t),power:1}),{content:b$2,factors:n}):{content:r.length===1?r[0]:b$2,factors:n}}function $r(e){let t=[];m$1(e.content)||t.push(p(e.content));for(let r$1 of e.factors)t.push(r$1.power===1?r$1.base:r(r$1.base,p({n:BigInt(r$1.power),d:1n})));if(t.length===0)return p(b$2);let n=t[0];for(let r=1;r<t.length;r++)n={kind:"mul",left:n,right:t[r]};return n}function Br(e){let t=0n,n=1n;for(let r of e.terms.values())t=Qe(t,r.n),n=kn(n,r.d);return t===0n?b$2:{n:t,d:n}}function qr(e){let t=new Map;for(let o of e.vars){let i=1/0;for(let a of e.terms.keys()){let s=Yr(a,o);s<i&&(i=s);}i>0&&i!==1/0&&t.set(o,i);}if(t.size===0)return {monomial:t,reduced:e};let n=new Map;for(let[o,i]of e.terms){let a=vt(o);for(let[s,u]of t)a.set(s,(a.get(s)??0)-u);n.set(Kr(a),i);}let r=new Set;for(let o of n.keys())for(let i of vt(o).keys())r.add(i);return {monomial:t,reduced:{terms:n,vars:[...r].sort()}}}function Yr(e,t){return vt(e).get(t)??0}function vt(e){let t=new Map;if(e==="")return t;for(let n of e.split("*")){let r=n.indexOf("^");r===-1?t.set(n,1):t.set(n.slice(0,r),Number(n.slice(r+1)));}return t}function Kr(e){return [...e.keys()].filter(n=>(e.get(n)??0)>0).sort().map(n=>e.get(n)===1?n:`${n}^${e.get(n)}`).join("*")}function Gr(e){let t=[...e.keys()].sort(),n=null;for(let r$1 of t){let o=e.get(r$1),i=o===1?q$1(r$1):r(q$1(r$1),p({n:BigInt(o),d:1n}));n=n===null?i:{kind:"mul",left:n,right:i};}return n}function Tn(e){let t=C$1(e);if(t===null||t.terms.size===0||z(t)>Or||t.vars.length===0)return e;let n=Br(t),r=m$1(n)?t:jr(t,i(b$2,n)),{monomial:o,reduced:i$1}=qr(r),a=Gr(o),s=A(i$1);if(s===null){let q=En(i$1);return q!==null?Hr(n,a,q):Xr(n,a,i$1)??e}let u=[...B(i$1,s)].reverse(),l=Mt(u,s),m=h(n,l.content);if(l.factors.length<=1&&(l.factors[0]?.power??1)===1&&a===null&&m$1(m))return e;let g=[];m$1(m)||g.push(p(m)),a!==null&&g.push(a),g.push($r({content:b$2,factors:l.factors}));let E=g[0];for(let q=1;q<g.length;q++)E={kind:"mul",left:E,right:g[q]};return E}function jr(e,t){let n=new Map;for(let[r,o]of e.terms)n.set(r,h(o,t));return {terms:n,vars:e.vars}}function Hr(e,t,n){let r=[];m$1(e)||r.push(p(e)),t!==null&&r.push(t),r.push(n);let o=r[0];for(let i=1;i<r.length;i++)o={kind:"mul",left:o,right:r[i]};return o}function Xr(e,t,n){if(t===null&&m$1(e))return null;let r=[];m$1(e)||r.push(p(e)),t!==null&&r.push(t),r.push(E(n));let o=r[0];for(let i=1;i<r.length;i++)o={kind:"mul",left:o,right:r[i]};return o}var C={n:2n,d:1n},G={n:3n,d:1n},ke={n:4n,d:1n};function Zr(e,t,n,r){let o=j(i(t,h(G,e))),i$1=i(g(h(G,h(e,n)),h(t,t)),h(G,h(e,e))),a=h(C,h(t,h(t,t))),s=h({n:9n,d:1n},h(e,h(t,n))),u=h({n:27n,d:1n},h(h(e,e),r)),l=i(f(g(a,s),u),h({n:27n,d:1n},h(e,h(e,e))));return {p:i$1,q:l,shift:o}}function Cn(e,t,n,r){let{p:o,q:i,shift:a}=Zr(e,t,n,r),s=j(f(h(ke,h(o,h(o,o))),h({n:27n,d:1n},h(i,i))));return k(s,a$1)>0?{exact:[],approximate:Qr(o,i,a)}:l(s)?{exact:zr(o,i,a),approximate:[]}:{exact:Wr(o,i,a),approximate:[]}}function zr(e,t,n){if(l(e))return [p(n)];let r=f(i(h(G,t),e),n),o=f(j(i(h(G,t),h(C,e))),n);return [r,o].sort(k).map(p)}function Wr(e,t,n){let r=j(i(t,C)),o=f(h(i(t,C),i(t,C)),h(i(e,G),h(i(e,G),i(e,G)))),i$1=O(o),a={kind:"call",name:"cbrt",args:[{kind:"add",left:p(r),right:i$1}]},s={kind:"call",name:"cbrt",args:[{kind:"sub",left:p(r),right:i$1}]},u={kind:"add",left:a,right:s},l={kind:"sub",left:a,right:s},m={kind:"add",left:p(n),right:{kind:"div",left:{kind:"neg",operand:u},right:p(C)}},y={kind:"mul",left:{kind:"div",left:{kind:"mul",left:l,right:O(G)},right:p(C)},right:w(n$1)};return [{kind:"add",left:p(n),right:u},{kind:"sub",left:m,right:y},{kind:"add",left:m,right:y}]}function Qr(e,t,n){let r=e$1(e),o=e$1(t),i=e$1(n),a=2*Math.sqrt(-r/3),s=3*o/(2*r)*Math.sqrt(-3/r),u=Math.acos(Math.min(1,Math.max(-1,s)))/3;return [0,1,2].map(l=>a*Math.cos(u-2*Math.PI*l/3)+i).sort((l,m)=>l-m)}function Jr(e,t,n,r){let o=j(i(e,ke)),i$1=h(e,e),a=g(t,i(h(G,i$1),{n:8n,d:1n})),s=f(g(n,i(h(e,t),C)),i(h(i$1,e),{n:8n,d:1n})),u=g(f(g(r,i(h(e,n),ke)),i(h(i$1,t),{n:16n,d:1n})),i(h(G,h(i$1,i$1)),{n:256n,d:1n}));return {p:a,q:s,r:u,shift:o}}function Pn(e,t,n,r,o,i$1){let a=E=>i(E,e),{p:s,q:u,r:l$1,shift:m}=Jr(a(t),a(n),a(r),a(o)),y=l(u)?to(s,l$1):io(s,u,l$1,i$1);if(y===null)return null;let g=l(m)?y:y.map(E=>({kind:"add",left:p(m),right:E}));return {exact:eo(g),approximate:[]}}function eo(e){let t=new Set,n=[];for(let r of e){let o=t$1(Q$2(r));t.has(o)||(t.add(o),n.push(r));}return n}function to(e,t){let n=g(h(e,e),h(ke,t));if(k(n,a$1)<0)return oo(e,t);let r=N$1(n);return r!==null?no(j(e),r,l(n)):ro(e,t,n)}function no(e,t,n){let r=n?[i(e,C)]:[i(f(e,t),C),i(g(e,t),C)],o=[];for(let i of r){if(l(i)){o.push(p(a$1));continue}let a=P$2(i);o.push({kind:"neg",operand:a},a);}return o}function ro(e,t,n){let r=p(j(e)),o=O(n),i=k(e,a$1)<=0,a=[{node:Et({kind:"add",left:r,right:o}),positive:i||k(t,a$1)<=0},{node:Et({kind:"sub",left:r,right:o}),positive:i&&k(t,a$1)>=0}],s=[];for(let{node:u,positive:l}of a){let y={kind:"call",name:"sqrt",args:[l?u:{kind:"neg",operand:u}]},g=l?y:{kind:"mul",left:y,right:w(n$1)};s.push({kind:"neg",operand:g},g);}return s}function Et(e){return {kind:"div",left:e,right:p(C)}}function oo(e,t){let n=i(j(e),C),r=N$1(t),o=r===null?_n(O(t),n):O(i(f(r,n),C)),a={kind:"mul",left:r===null?_n(O(t),j(n)):O(i(g(r,n),C)),right:w(n$1)},s={kind:"add",left:o,right:a},u={kind:"sub",left:o,right:a};return [{kind:"neg",operand:s},{kind:"neg",operand:u},u,s]}function _n(e,t){let n=t.n>=0n?{kind:"add",left:e,right:p(t)}:{kind:"sub",left:e,right:p(j(t))};return {kind:"call",name:"sqrt",args:[Et(n)]}}function io(e,t,n,r){let o=[{n:1n,d:1n},h(C,e),g(h(e,e),h(ke,n)),j(h(t,t))];for(let i$1 of he(o)){if(k(i$1,a$1)<=0)continue;let a=N$1(i$1);if(a===null)continue;let s=f(e,i$1),u=i(t,a),l=i(g(s,u),C),m=i(f(s,u),C),y={n:1n,d:1n};return [...r(y,a,l),...r(y,j(a),m)]}return null}var ao=200,so=1e-14,uo=1e-10,lo=1e-10,Vn=1e-9,co=1e-8,mo=4;function we(e,t){return {re:e.re-t.re,im:e.im-t.im}}function fo(e,t){return {re:e.re*t.re-e.im*t.im,im:e.re*t.im+e.im*t.re}}function Dn(e,t){if(Math.abs(t.re)>=Math.abs(t.im)){let o=t.im/t.re,i=t.re+t.im*o;return {re:(e.re+e.im*o)/i,im:(e.im-e.re*o)/i}}let n=t.re/t.im,r=t.re*n+t.im;return {re:(e.re*n+e.im)/r,im:(e.im*n-e.re)/r}}function W(e){return Math.hypot(e.re,e.im)}function Je(e,t){let n=0,r=0;for(let o of e){let i=n*t.re-r*t.im+o;r=n*t.im+r*t.re,n=i;}return {re:n,im:r}}function po(e,t){let n=W(t),r=0;for(let o of e)r=r*n+Math.abs(o);return r}function ho(e){let t=e.length-1,n=[];for(let r=0;r<t;r++)n.push(e[r]*(t-r));return n}function bo(e){let t=[...e].reverse(),r=[...K$1(t)].reverse().map(e$1);return r.some(o=>!Number.isFinite(o))?null:r}function yo(e){let t=e.length-1,n=0;for(let a=1;a<e.length;a++)n=Math.max(n,Math.abs(e[a]));let r=1+n,o=-e[1]/t,i=[];for(let a=0;a<t;a++){let s=2*Math.PI*a/t+Math.PI/(2*t);i.push({re:o+r*Math.cos(s),im:r*Math.sin(s)});}return i}function go(e){let t=e.length-1,n=yo(e);for(let r=0;r<ao;r++){let o=0,i=1;for(let a=0;a<t;a++){let s={re:1,im:0};for(let l=0;l<t;l++)a!==l&&(s=fo(s,we(n[a],n[l])));if(s.re===0&&s.im===0){n[a]={re:n[a].re+1e-6*(a+1),im:n[a].im+1e-6};continue}let u=Dn(Je(e,n[a]),s);if(!Number.isFinite(u.re)||!Number.isFinite(u.im))return null;n[a]=we(n[a],u),o=Math.max(o,W(u)),i=Math.max(i,W(n[a]));}if(o<=so*i)return n}return null}function On(e,t,n){let r=n;for(let o=0;o<mo;o++){let i=Je(t,r);if(i.re===0&&i.im===0)break;let a=we(r,Dn(Je(e,r),i));if(!Number.isFinite(a.re)||!Number.isFinite(a.im))break;r=a;}return r}function No(e,t,n){let r=Math.max(1,W(n));if(n.im!==0&&Math.abs(n.im)<=Vn*r){let o=On(e,t,{re:n.re,im:0});if(It(e,o))return {re:o.re,im:0}}if(n.re!==0&&Math.abs(n.re)<=Vn*r){let o=On(e,t,{re:0,im:n.im});if(It(e,o))return {re:0,im:o.im}}return n}function It(e,t){return !Number.isFinite(t.re)||!Number.isFinite(t.im)?false:W(Je(e,t))<=uo*po(e,t)}function Ro(e){let t=[...e],n=t.map(r=>r.im===0);for(let r=0;r<t.length;r++){if(n[r])continue;let o={re:t[r].re,im:-t[r].im},i=-1,a=Number.POSITIVE_INFINITY;for(let m=r+1;m<t.length;m++){if(n[m])continue;let y=W(we(t[m],o));y<a&&(a=y,i=m);}if(i===-1||a>co*Math.max(1,W(t[r])))continue;let s=(t[r].re+t[i].re)/2,u=(Math.abs(t[r].im)+Math.abs(t[i].im))/2,l=t[r].im<0?-1:1;t[r]={re:s,im:l*u},t[i]={re:s,im:-l*u},n[r]=true,n[i]=true;}return t}function Ao(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let r=Math.max(1,W(e[t]),W(e[n]));if(W(we(e[t],e[n]))<=lo*r)return false}return true}function Ln(e){let t=bo(e);if(t===null)return null;if(t.length<2)return [];let n=go(t);if(n===null)return null;let r=ho(t),o=Ro(n).map(i=>No(t,r,i));for(let i of o)if(!It(t,i))return null;return Ao(o)?[...o].sort((i,a)=>i.re-a.re||i.im-a.im):null}var Fn=8;function So(e,t){let n=a$1;for(let r of e)n=f(h(n,t),r);return n}function xo(e,t){let n=[e[0]];for(let r=1;r<e.length-1;r++)n.push(f(e[r],h(n[r-1],t)));return n}function Un(e,t,n){let r=g(h(t,t),h(Eo(),h(e,n))),o=h(Mo(),e);if(k(r,a$1)<0)return vo(j(t),r,o);if(l(r))return [p(i(j(t),o))];let i$1=L(r.n),a=L(r.d);if(i$1!==null&&a!==null){let y={n:i$1,d:a},g$1=i(f(j(t),y),o),E=i(g(j(t),y),o);return k(E,g$1)<=0?[p(E),p(g$1)]:[p(g$1),p(E)]}let s=O(r),u=k(o,a$1)>0,l$1={kind:"div",left:{kind:"sub",left:p(j(t)),right:s},right:p(o)},m={kind:"div",left:{kind:"add",left:p(j(t)),right:s},right:p(o)};return u?[l$1,m]:[m,l$1]}function vo(e,t,n){let r=j(t),o$1=L(r.n),i$1=L(r.d);if(o$1!==null&&i$1!==null){let l=i({n:o$1,d:i$1},n),m=i(e,n);return [w(o(m,j(l))),w(o(m,l))]}let a=i(e,n),s=i(r,h(n,n)),u={kind:"mul",left:O(s),right:w(n$1)};return l(a)?[{kind:"neg",operand:u},u]:[{kind:"sub",left:p(a),right:u},{kind:"add",left:p(a),right:u}]}function Mo(){return {n:2n,d:1n}}function Eo(){return {n:4n,d:1n}}function Io(e){return {re:e,im:0}}function $n(e,t,n){let r=C$1({kind:"sub",left:e,right:t});if(r===null)return {kind:"unsupported",reason:"this is not a polynomial equation (it divides by an unknown, or calls a function of one)"};let o=r.vars.filter(s=>s!==n),i=z(r,n);if(o.length>0)return i!==1?{kind:"unsupported",reason:`solving for "${n}" needs the equation to be linear in it when other unknowns (${o.join(", ")}) are present`}:ko(r,n);if(i===0)return r.terms.size===0?{kind:"identity"}:{kind:"contradiction"};if(i>Fn)return {kind:"unsupported",reason:`degree ${i} is above the supported maximum of ${Fn}`};let a=[...B(r,n)].reverse();return _o(a)}function ko(e,t){let n=new Map,r=new Map;for(let[s,u]of e.terms){let l=s.split("*").filter(y=>y.length>0),m=l.indexOf(t);m===-1?r.set(s,u):(l.splice(m,1),n.set(l.join("*"),u));}let o=s=>{let u=new Set;for(let l of s.keys())for(let m of l.split("*"))m.length>0&&u.add(m.split("^")[0]);return [...u].sort()},i=E({terms:n,vars:o(n)});return {kind:"roots",exact:[{kind:"div",left:{kind:"neg",operand:E({terms:r,vars:o(r)})},right:i}],approximate:[]}}function wo(e){return e.length===4?Cn(e[0],e[1],e[2],e[3]):e.length===5?Pn(e[0],e[1],e[2],e[3],e[4],Un):null}function To(e){let t=[],n=[...e],r=0;for(;n.length>1&&l(n[n.length-1]);)n=n.slice(0,-1),r++;for(r>0&&t.push(a$1);n.length>1;){let o=he(n);if(o.length===0)break;for(let i of o){let a=0;for(;n.length>1&&l(So(n,i));)n=xo(n,i),a++;a>0&&t.push(i);}}return {roots:t.sort(k),remaining:n}}function _o(e){let{roots:t,remaining:n}=To(e),r=t.map(p),o=[],i$1=n.length-1,a=e.length-n.length;if(i$1<=0)return be(r,o,a,0,"");if(i$1===1)return r.push(p(i(j(n[1]),n[0]))),be(r,o,a+1,0,"");if(i$1===2)return r.push(...Un(n[0],n[1],n[2])),be(r,o,a+2,0,"");let s=wo(n);if(s!==null)return r.push(...s.exact),o.push(...s.approximate.map(Io)),be(r,o,a+i$1,0,"");let u=Ln(n);return u!==null?(o.push(...u),be(r,o,a+i$1,0,"")):be(r,o,a,i$1,`a degree-${i$1} factor of it has no exact solution here and the numerical method did not converge on that factor`)}function be(e,t,n,r,o){let i=e.length+t.length,a=n>=1&&(i<1||i>n);return r>0||a?{kind:"incomplete",exact:e,approximate:t,missing:a?Math.max(1,n+r-i):r,reason:a?`${i} root${i===1?"":"s"} were produced for a degree-${n+r} equation, which does not add up`:o}:{kind:"roots",exact:e,approximate:t}}var Bn={0:"sqrt",1:"abs",2:"sin",3:"cos",4:"tan",5:"log",6:"ceil",7:"floor",8:"round",11:"asin",12:"acos",13:"atan",14:"atan2",15:"sinh",16:"cosh",17:"tanh",18:"asinh",19:"acosh",20:"atanh",21:"cbrt",23:"expm1",24:"exp",26:"hypot",28:"log10",29:"log1p",30:"log2",33:"sign",34:"trunc",35:"degtorad",36:"radtodeg",61:"root",62:"fact"},Co=31,la=new Set([67,68,69,70,71,72,73,74,75,76,77,78,79]);function P(e){if(e.type===9)return e.value;if(e.type===13||e.type===12)return null;let t=e.toNumber();return Number.isFinite(t)?p(d(t)):null}function V(e){let t=Q$2(e);return t.kind==="const"?n(e$1(t.value)):K(t)}function et(e){return P$1("SYMBOLIC_UNSUPPORTED_FUNCTION",`"${e}" cannot be applied to an expression that still contains an unknown.`)}function ca(e,t){let n=P(e),r$1=P(t);return n===null||r$1===null?et("^"):V(r(n,r$1))}function ma(e){let t=P(e);return t===null?et("-"):V({kind:"neg",operand:t})}function da(e,t){let n=[];for(let o of t){let i=Q$1(o);if(i)return i;let a=P(o);if(a===null)return et(Bn[e]??`builtin ${e}`);n.push(a);}if(e===Co&&n.length===2)return V(r(n[0],n[1]));let r$1=Bn[e];return r$1===void 0?et(`builtin ${e}`):V(s(r$1,n))}function Po(e){let t=V(e);return t.type===0&&!Number.isInteger(t.toNumber())?K(e):t}function Vo(e){return e.im===0?n(e.re):K(w(o(d(e.re),d(e.im))))}function Oo(e){switch(e.kind){case "identity":return t("true for every value");case "contradiction":return t("no solution");case "unsupported":return P$1("SYMBOLIC_SOLVE_UNSUPPORTED",`Cannot solve this equation: ${e.reason}.`);case "incomplete":{let t=e.exact.length+e.approximate.length;return P$1("SYMBOLIC_SOLVE_INCOMPLETE",`Only ${t} of this equation's ${t+e.missing} roots could be found: ${e.reason}.`)}case "roots":{let t$1=e.exact.map(Po);for(let n of e.approximate)t$1.push(Vo(n));return t$1.length===0?t("no solution"):t$1.length===1?t$1[0]:C$2(1,t$1.length,t$1.map(n=>n.type===9?n.value:n.toNumber()))}}}function Yn(e,t,n){let r=P(e),o=P(t);return r===null||o===null?P$1("SYMBOLIC_NONFINITE_OPERAND","An equation side has no exact value to solve with."):Oo($n(r,o,n))}function ye(e$1,t){if(e$1.type===6&&t.type===6){if(e$1.unit===t.unit)return {lv:e$1.toNumber(),rv:t.toNumber(),unit:e$1.unit,sameMeasure:true};let n=c$1(e$1.unit),r=c$1(t.unit),o=c$2.isCurrency(e$1.unit)&&c$2.isCurrency(t.unit);if(n&&n===r){let i=e(t.toNumber(),t.unit,e$1.unit);return {lv:e$1.toNumber(),rv:i,unit:e$1.unit,sameMeasure:true}}if(o){let i=c$2.convertSync(t.toNumber(),t.unit,e$1.unit);if(i!==null)return {lv:e$1.toNumber(),rv:i,unit:e$1.unit,sameMeasure:true}}return {lv:e$1.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:false}}return e$1.type===6?{lv:e$1.toNumber(),rv:t.toNumber(),unit:e$1.unit,sameMeasure:true}:t.type===6?{lv:e$1.toNumber(),rv:t.toNumber(),unit:t.unit,sameMeasure:true}:{lv:e$1.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:true}}function Te(e,t){let n=new Array(e.length),r;for(let o=0;o<e.length;o++){let i=e[o];if(i.type!==6||i.unit===void 0){n[o]=i.toNumber();continue}if(r===void 0){r=i,n[o]=i.toNumber();continue}let{rv:a,sameMeasure:s}=ye(r,i);if(!s){let u=_e(r.unit,i.unit,t);return P$1("INCOMPATIBLE_UNITS",u??`Cannot combine incompatible units: ${r.unit??"?"} and ${i.unit??"?"}`)}n[o]=a;}return {magnitudes:n,unit:r?.unit}}var Do=1e-12;function Lo(e,t,n){let r=0;return Number.isFinite(e)&&Math.abs(e)>r&&(r=Math.abs(e)),Number.isFinite(t)&&Math.abs(t)>r&&(r=Math.abs(t)),Number.isFinite(n)&&Math.abs(n)>r&&(r=Math.abs(n)),r}function xa(e,t){let{lv:n,rv:r,sameMeasure:o}=ye(e,t);if(!o)return {lv:n,rv:r,equal:false,sameMeasure:false};if(e.type===6&&t.type===6&&e.unit!==void 0&&e.unit===t.unit&&e.exact!==void 0&&t.exact!==void 0&&c$2.isCurrency(e.unit))return {lv:n,rv:r,equal:qa(e.exact,t.exact)===0,sameMeasure:true};if(n===r)return {lv:n,rv:r,equal:true,sameMeasure:true};if(!Number.isFinite(n)||!Number.isFinite(r))return {lv:n,rv:r,equal:false,sameMeasure:true};let i=Lo(n,r,t.toNumber());return {lv:n,rv:r,equal:Math.abs(n-r)<=i*Do,sameMeasure:true}}var Fo={time:"duration",luminousIntensity:"luminous intensity"},Uo=new Set(["money","data"]),$o={add:"added",sub:"subtracted",mul:"multiplied",div:"divided"};function tt(e){if(c$2.isCurrency(e))return "money";let t=c$1(e);if(t!==void 0)return Fo[t]??t}function Kn(e){return Uo.has(e)?e:/^[aeiou]/.test(e)?`an ${e}`:`a ${e}`}function _e(e,t,n){let r=e===void 0?void 0:tt(e),o=t===void 0?void 0:tt(t);if(r!==void 0&&o!==void 0&&r!==o)return `${r} and ${o} cannot be ${n}`}function Bo(e){return e!==void 0?$o[e]??"combined":"combined"}function va(e,t){let n=tt(e),r=tt(t);if(n!==void 0&&r!==void 0&&n!==r)return `${Kn(n)} cannot be converted to ${Kn(r)}`}function Ma(e,t){let n=e.type===6?e.unit:void 0,r=t.type===6?t.unit:void 0,o=_e(n,r,"compared");return P$1("INCOMPATIBLE_UNITS",o??`Cannot compare incompatible units: ${n??"?"} and ${r??"?"}`)}function Gn(e){if(e.type===2)return e.value;let t=e.toNumber();if(!Number.isInteger(t)){let n=Number.isNaN(t)?"NaN":String(t);throw c.execution("BIGINT_INEXACT_OPERAND",`A whole-number (n) value can only be combined with another whole number, and ${n} is not one`,{operand:n})}return BigInt(t)}function Ea(){return c.execution("BIGINT_DIVISION_BY_ZERO","Division by zero: a whole-number (n) division is exact integer division, which has no answer at zero, unlike 1 / 0 which is Infinity")}function Ia(e,t){let n=jn(e),r=jn(t);return n===null||r===null?null:n<r?-1:n>r?1:0}function jn(e){if(e.type===2)return e.value;let t=e.toNumber();return Number.isInteger(t)?BigInt(t):null}function kt(e,t){return Number.isFinite(t)?Math.pow(e,t):e===1||e===-1&&!Number.isNaN(t)?1:Math.pow(e,t)}function Hn(e){return e.exact!==void 0?e.exact:ha(e.toNumber())}function qo(e,t,n){let r=e.type===6&&e.unit!==void 0&&e.exact!==void 0&&c$2.isCurrency(e.unit),o=t.type===6&&t.unit!==void 0&&t.exact!==void 0&&c$2.isCurrency(t.unit);if(!r&&!o)return null;let i,a,s;if(r&&o){if(e.unit!==t.unit||n==="div")return null;i=e.exact,a=t.exact,s=e.unit;}else if(r&&t.type!==6)i=e.exact,s=e.unit,a=Hn(t);else if(o&&e.type!==6)a=t.exact,s=t.unit,i=Hn(e);else return null;if(i===null||a===null)return null;let u;switch(n){case "add":u=ja(i,a);break;case "sub":u=ka$1(i,a);break;case "mul":u=la$1(i,a);break;case "div":if(na(a))return null;u=pa(i,a);break}return v(ra(u),s,u)}function nt(e){return e.rational!==void 0?e.rational:(e.type===0||e.type===1)&&typeof e.value=="number"&&Number.isInteger(e.value)?c$3(BigInt(e.value)):null}function ka(e,t,n){let r=nt(e);if(r===null)return null;let o=nt(t);if(o===null||n==="div"&&l(o))return null;let i$1;try{switch(n){case "add":i$1=f(r,o);break;case "sub":i$1=g(r,o);break;case "mul":i$1=h(r,o);break;case "div":i$1=i(r,o);break}}catch{return null}return p$1(e$1(i$1),i$1)}function wa(e,t,n){if(e.type!==0||t.type!==0)return null;let r=e.value,o=t.value,i=e.uncertainty??0,a=t.uncertainty??0,s,u;switch(n){case "add":s=r+o,u=Math.hypot(i,a);break;case "sub":s=r-o,u=Math.hypot(i,a);break;case "mul":s=r*o,u=Math.hypot(o*i,r*a);break;case "div":s=r/o,u=Math.hypot(i/o,r*a/(o*o));break}return q(s,u)}function Ta(e,t){let n=nt(e);if(n===null)return null;let r=nt(t);return r===null?null:k(n,r)}function _a(e,t,n$1,r,o){if(e.type===13)return e;if(t.type===13)return t;if(e.type===12)return e;if(t.type===12)return t;if(o&&(e.type===9||t.type===9)){let i=P(e),a=P(t);return i===null||a===null?P$1("SYMBOLIC_NONFINITE_OPERAND","A symbolic expression cannot combine with a value that has no exact number (NaN or infinity)."):K(Q$2({kind:o,left:i,right:a}))}if(e.type===0&&t.type===0)return n(n$1(e.value,t.value));if(e.type===2||t.type===2){let i=Gn(e),a=Gn(t);return r?s$1(r(i,a)):s$1(i+a)}if(e.type===6||t.type===6){if(o){let g=qo(e,t,o);if(g)return g}let{lv:i,rv:a,unit:s,sameMeasure:u$1}=ye(e,t);if(!u$1){let g=e.type===6?e.unit:void 0,E=t.type===6?t.unit:void 0,q=_e(g,E,Bo(o));return P$1("INCOMPATIBLE_UNITS",q??`Cannot combine incompatible units: ${g??"?"} and ${E??"?"}`)}let l=u(n$1(i,a),s),m=e.datetimeSpan===true&&t.datetimeSpan===true,y=e.datetimeSpan===true&&t.type===0||t.datetimeSpan===true&&e.type===0;return (m||y)&&(l.datetimeSpan=true),l}if(e.type===7&&t.type===7){let i=e.value,a=t.value;if(!V$1(i,a))return P$1("DIMENSION_MISMATCH",`Cannot combine matrices of different shapes: ${i.rows}x${i.cols} and ${a.rows}x${a.cols}`);let s=new Array(i.data.length);for(let u=0;u<i.data.length;u++)s[u]=n$1(i.data[u],a.data[u]);return C$2(i.rows,i.cols,s)}if(e.type===7){let i=e.value,a=t.toNumber(),s=i.data.map(u=>n$1(u,a));return C$2(i.rows,i.cols,s)}if(t.type===7){let i=t.value,a=e.toNumber(),s=i.data.map(u=>n$1(a,u));return C$2(i.rows,i.cols,s)}return n(n$1(e.toNumber(),t.toNumber()))}var Xn=254,Zn=200,Ce=class{constructor(){this.handlers=new Map;this.nextOpcode=Zn+1;}register(t){this.handlers.set(t.opcode,t.handler);}unregister(t){this.handlers.delete(t);}get(t){return this.handlers.get(t)}has(t){return this.handlers.has(t)}allocateOpcode(){if(this.nextOpcode>Xn)throw c.config("OPCODE_POOL_EXHAUSTED",`OpRegistry: dynamic opcode pool exhausted (max ${Xn-Zn} allocations).`);return this.nextOpcode++}},Va=new Ce;var Wn=ga(1);function Pe(e,t){return c$2.isCurrency(t)?e.exact??ha(e.toNumber()):null}function wt(e){if(!Number.isFinite(e))return null;if(Number.isInteger(e))return ga(BigInt(e));let t=String(e);return /^-?\d+\.\d+$/.test(t)?ia(t):null}function Qn(e,t,n){let r=Pe(e,n),o=wt(t);if(r!==null&&o!==null){let i=la$1(r,o);return v(ra(i),n,i)}return u(e.toNumber()*t,n)}function Jn(e,t,n,r){let o=Pe(e,t),i=wt(n);if(o!==null&&i!==null){let a=ja(Wn,r===1?i:ma$1(i)),s=la$1(o,a);return v(ra(s),t,s)}return u(e.toNumber()*(1+r*n),t)}function er(e){let t=wt(e);return t===null?null:ja(Wn,t)}function tr(e,t,n){let r=Pe(e,t),o=er(n);if(r===null||o===null||na(o))return null;let i=pa(r,o);return v(ra(i),t,i)}function nr(e,t,n){let r=Pe(e,t),o=er(n);if(r===null||o===null||na(o))return null;let i=ka$1(r,pa(r,o));return v(ra(i),t,i)}function rr(e,t){let n=e.unit,r=n!==void 0&&c$2.isCurrency(n)?Yo(e,n):null;if(r===null)return {unit:n,shares:[{value:e.toNumber()/t,count:t}]};let o=BigInt(t),i=r/o,a=r-i*o,s=Number(a<0n?-a:a),u=r<0n?-1n:1n,l=zn(i,t-s);return s===0?{unit:n,shares:[l]}:{unit:n,shares:[l,zn(i+u,s)]}}function zn(e,t){let n=fa(e,2);return {value:ra(n),exact:n,count:t}}function Yo(e,t){let n=Pe(e,t);return n===null?null:oa(n,2).coef}var Ko=12;function or(e,t){if(e.length===0||t.length===0)return [];let n=new Array(e.length+t.length-1).fill(a$1);return e.forEach((r,o)=>{t.forEach((i,a)=>{n[o+a]=f(n[o+a],h(r,i));});}),n}function Go(e,t){let n=[b$2];for(let r=0;r<t;r++)n=or(n,e);return n}function Tt(e,t){return e.map(n=>i(n,t))}function jo(e,t){let n=[],r=0;for(;r<e.length&&l(e[r]);)r++;r>0&&n.push({base:[a$1,b$2],power:r});let o=e.slice(r);if(o.length>1){let i=Mt([...o].reverse(),t);for(let a of i.factors){let s=C$1(a.base);if(s===null)return null;n.push({base:[...B(s,t)],power:a.power});}}return n.length>0?n:null}function Ho(e){let t=[];return e.forEach((n,r)=>{let o=n.base.length-1;for(let i=1;i<=n.power;i++)for(let a=0;a<o;a++)t.push({factor:r,power:i,degree:a});}),t}function Xo(e,t,n){let r=Go(t[e.factor].base,e.power),{quotient:o,remainder:i}=H$1(n,r);if(!G$1(i))return null;let a=new Array(e.degree).fill(a$1);return a.push(b$2),or(o,a)}function Zo(e,t){let n=t.length;for(let r=0;r<n;r++){let o=-1;for(let i=r;i<n;i++)if(!l(e[i][r])){o=i;break}if(o===-1)return null;[e[r],e[o]]=[e[o],e[r]],[t[r],t[o]]=[t[o],t[r]];for(let i$1=0;i$1<n;i$1++){if(i$1===r||l(e[i$1][r]))continue;let a=i(e[i$1][r],e[r][r]);for(let s=r;s<n;s++)e[i$1][s]=g(e[i$1][s],h(a,e[r][s]));t[i$1]=g(t[i$1],h(a,t[r]));}}return t.map((r,o)=>i(r,e[o][o]))}function _t(e,t,n){if(t.length<2||t.length-1>Ko)return null;let r=I(e,t),o=r.length>1?H$1(e,r).quotient:[...e],i=r.length>1?H$1(t,r).quotient:[...t];if(i.length===1)return {polynomial:Tt(o,i[0]),terms:[]};if(i.length===0)return null;let a=i[i.length-1],s=Tt(i,a),u=Tt(o,a),{quotient:l,remainder:m}=H$1(u,s);if(G$1(m))return {polynomial:l,terms:[]};let y=jo(s,n);if(y===null)return null;let g=zo(y,s,m);return g===null?null:{polynomial:l,terms:g}}function zo(e,t,n){let r=Ho(e),o=t.length-1;if(r.length!==o)return null;let i=[];for(let l of r){let m=Xo(l,e,t);if(m===null)return null;i.push(m);}let a=[];for(let l=0;l<o;l++)a.push(i.map(m=>m[l]??a$1));let s=[];for(let l=0;l<o;l++)s.push(n[l]??a$1);let u=Zo(a,s);return u===null?null:Wo(r,u,e)}function Wo(e,t,n){let r=new Map;e.forEach((i,a)=>{let s=`${i.factor}:${i.power}`,u=r.get(s)??[];u[i.degree]=t[a],r.set(s,u);});let o=[];for(let[i,a]of r){let[s,u]=i.split(":").map(Number),l$1=[...a].map(m=>m??a$1);l$1.every(l)||o.push({numerator:l$1,base:n[s].base,power:u});}return o}function Ve(e,t){let n=new Map;return e.forEach((r,o)=>{l(r)||n.set(o===0?"":o===1?t:`${t}^${o}`,r);}),n.size===0?p(a$1):E({terms:n,vars:e.length>1?[t]:[]})}function ir(e){let t=Ct(e);if(t===null)return e;let n=_t(t.numerator,t.denominator,t.variable);if(n===null||n.terms.length===0)return e;let r$1=n.polynomial.length>0?Ve(n.polynomial,t.variable):null;for(let o of n.terms){let i=Ve(o.base,t.variable),a=o.power===1?i:r(i,p({n:BigInt(o.power),d:1n})),s=Qo(o.numerator),u=s?o.numerator.map(m=>j(m)):o.numerator,l={kind:"div",left:Ve(u,t.variable),right:a};r$1===null?r$1=s?{kind:"neg",operand:l}:l:r$1={kind:s?"sub":"add",left:r$1,right:l};}return r$1===null?e:Q$2(r$1)}function Qo(e){return e.some(t=>t.n<0n)&&e.every(t=>t.n<=0n)}function Ct(e){if(e.kind!=="div")return null;let t=C$1(e.left),n=C$1(e.right);if(t===null||n===null)return null;let r=A(n);return r===null||t.vars.some(o=>o!==r)?null:{numerator:B(t,r),denominator:B(n,r),variable:r}}var Pt=16;function ar(){return p(a$1)}function Q(){return p(b$2)}function Jo(e,t){switch(e){case "sin":return s("cos",[t]);case "cos":return {kind:"neg",operand:s("sin",[t])};case "tan":return {kind:"div",left:Q(),right:r(s("cos",[t]),p(2))};case "exp":return s("exp",[t]);case "log":return {kind:"div",left:Q(),right:t};case "sqrt":return {kind:"div",left:Q(),right:{kind:"mul",left:p(2),right:s("sqrt",[t])}};case "asin":return {kind:"div",left:Q(),right:s("sqrt",[sr(t)])};case "acos":return {kind:"neg",operand:{kind:"div",left:Q(),right:s("sqrt",[sr(t)])}};case "atan":return {kind:"div",left:Q(),right:ei(t)};case "sinh":return s("cosh",[t]);case "cosh":return s("sinh",[t]);case "tanh":return {kind:"div",left:Q(),right:r(s("cosh",[t]),p(2))};case "abs":return s("sign",[t]);default:return null}}function sr(e){return {kind:"sub",left:Q(),right:r(e,p(2))}}function ei(e){return {kind:"add",left:Q(),right:r(e,p(2))}}function Oe(e,t,n=1){if(n<0||!Number.isInteger(n))throw c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT","A derivative order must be a whole number, at least zero.");if(n>Pt)throw c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT",`A derivative order above ${Pt} is not supported.`,{limit:Pt});let r=Q$2(e);for(let o=0;o<n;o++)r=Q$2(F(r,t));return r}function F(e,t){switch(e.kind){case "const":case "complex":return ar();case "var":return e.name===t?Q():ar();case "add":return {kind:"add",left:F(e.left,t),right:F(e.right,t)};case "sub":return {kind:"sub",left:F(e.left,t),right:F(e.right,t)};case "neg":return {kind:"neg",operand:F(e.operand,t)};case "mul":return {kind:"add",left:{kind:"mul",left:F(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:F(e.right,t)}};case "div":return {kind:"div",left:{kind:"sub",left:{kind:"mul",left:F(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:F(e.right,t)}},right:r(e.right,p(2))};case "pow":return ti(e,t);case "call":{if(e.args.length!==1)return Vt(e,t);let n=Jo(e.name,e.args[0]);return n===null?Vt(e,t):{kind:"mul",left:n,right:F(e.args[0],t)}}}}function ti(e,t){if(e.exponent.kind==="const"){let n=p(g(e.exponent.value,b$2));return {kind:"mul",left:{kind:"mul",left:e.exponent,right:r(e.base,n)},right:F(e.base,t)}}return e.base.kind==="const"&&e.base.value.n>0n?{kind:"mul",left:{kind:"mul",left:e,right:s("log",[e.base])},right:F(e.exponent,t)}:Vt(e,t)}function Vt(e,t){return s("der",[e,q$1(t)])}function ur(e,t){let n=C$1(e);if(n===null||n.vars.filter(s=>s!==t).length>0||z(n,t)>1)return null;let o=B(n,t),i=o[0]??{n:0n,d:1n},a=o[1]??{n:0n,d:1n};return l(a)?null:{slope:a,intercept:i}}function ni(e,t){let n=C$1(e);if(n===null)return null;let r$1=n.vars.filter(a=>a!==t);if(r$1.length>0)return {ok:false,reason:`it involves more than one unknown (${r$1.join(", ")})`};let o=B(n,t),i$1=p(0);return o.forEach((a,s)=>{if(l(a))return;let u=s+1,l$1=i(a,{n:BigInt(u),d:1n}),m={kind:"mul",left:p(l$1),right:u===1?q$1(t):r(q$1(t),p(u))};i$1={kind:"add",left:i$1,right:m};}),{ok:true,value:Q$2(i$1)}}function ri(e,t){if(e.kind!=="call"||e.args.length!==1)return null;let n=ur(e.args[0],t);if(n===null)return null;let r=e.args[0],o=i=>Q$2({kind:"div",left:i,right:p(n.slope)});switch(e.name){case "exp":return {ok:true,value:o(s("exp",[r]))};case "sin":return {ok:true,value:o({kind:"neg",operand:s("cos",[r])})};case "cos":return {ok:true,value:o(s("sin",[r]))};case "log":return {ok:true,value:o({kind:"sub",left:{kind:"mul",left:r,right:s("log",[r])},right:r})};default:return null}}function oi(e,t){if(e.kind!=="div"||e.left.kind!=="const"||!Ot(e.left.value))return null;let n=ur(e.right,t);if(n!==null)return {ok:true,value:Q$2({kind:"div",left:s("log",[e.right]),right:p(n.slope)})};let r=C$1(e.right);if(r!==null&&r.vars.length===1&&r.vars[0]===t){let o=B(r,t);if(o.length===3&&Ot(o[0])&&l(o[1])&&Ot(o[2]))return {ok:true,value:s("atan",[q$1(t)])}}return null}function Ot(e){return e.n===1n&&e.d===1n}function ii(e,t){let n=Ct(e);if(n===null||n.variable!==t)return null;let r=_t(n.numerator,n.denominator,t);if(r===null)return null;let o=r.polynomial.length>0?ui(r.polynomial,t):p(0);for(let i of r.terms){let a=ai(i,t);if(a===null)return {ok:false,reason:"its denominator has a repeated irreducible quadratic factor, which needs a reduction formula this does not have"};o={kind:"add",left:o,right:a};}return {ok:true,value:Q$2(o)}}function ai(e,t){let n=e.base.length-1,r$1=Ve(e.base,t);if(n===1){let o=e.numerator[0]??a$1;if(e.power===1)return {kind:"mul",left:p(o),right:s("log",[r$1])};let i$1=e.power-1,a=i(o,{n:BigInt(-i$1),d:1n});return {kind:"div",left:p(a),right:r(r$1,p({n:BigInt(i$1),d:1n}))}}return n!==2||e.power!==1?null:si(e,t,r$1)}function si(e,t,n){let r=e.numerator[0]??a$1,o=e.numerator[1]??a$1,[i,a]=e.base,s$1={n:1n,d:2n},u=h(a,s$1),l$1={kind:"mul",left:p(h(o,s$1)),right:s("log",[n])},m=g(r,h(o,u));if(l(m))return l$1;let y=O(g(i,h(u,u))),g$1={kind:"add",left:q$1(t),right:p(u)},E={kind:"mul",left:{kind:"div",left:p(m),right:y},right:s("atan",[{kind:"div",left:g$1,right:y}])};return l(o)?E:{kind:"add",left:l$1,right:E}}function ui(e,t){let n=p(0);return e.forEach((r$1,o)=>{if(l(r$1))return;let i$1=o+1,a=i(r$1,{n:BigInt(i$1),d:1n}),s={kind:"mul",left:p(a),right:i$1===1?q$1(t):r(q$1(t),p(i$1))};n={kind:"add",left:n,right:s};}),n}function De(e,t){let n=Q$2(e);if(!u$1(n).has(t))return {ok:true,value:Q$2({kind:"mul",left:n,right:q$1(t)})};let r=ni(n,t);if(r!==null)return r;let o=ri(n,t);if(o!==null)return o;let i=oi(n,t);if(i!==null)return i;let a=ii(n,t);if(a!==null)return a;if(n.kind==="add"||n.kind==="sub"){let s=De(n.left,t);if(!s.ok)return s;let u=De(n.right,t);return u.ok?{ok:true,value:Q$2({kind:n.kind,left:s.value,right:u.value})}:u}if(n.kind==="mul"&&n.left.kind==="const"){let s=De(n.right,t);return s.ok?{ok:true,value:Q$2({kind:"mul",left:n.left,right:s.value})}:s}return {ok:false,reason:"no elementary antiderivative is known for this expression"}}var Dt=16;function lr(e,t,n,r$1){if(r$1<0||!Number.isInteger(r$1)||r$1>Dt)throw c.execution("SYMBOLIC_TAYLOR_DEGREE_LIMIT",`A Taylor degree must be a whole number from 0 to ${Dt}.`,{limit:Dt});let o=p(n),i$1=1n,a=p(a$1);for(let s=0;s<=r$1;s++){s>0&&(i$1*=BigInt(s));let u=Oe(e,t,s),l$1=Q$2(v$1(u,t,o));if(l$1.kind!=="const")throw c.execution("SYMBOLIC_TAYLOR_INEXACT",`The derivative of order ${s} does not reduce to an exact number at the expansion point, so this series cannot be computed exactly.`,{order:s});let m=i(l$1.value,{n:i$1,d:1n});if(l(m))continue;let y=l(n)?q$1(t):{kind:"sub",left:q$1(t),right:o},g=s===0?p(1):s===1?y:r(y,p(s));a={kind:"add",left:a,right:{kind:"mul",left:p(m),right:g}};}return Q$2(a)}function cr(e,t){return e.map(n=>t.map(r=>Oe(n,r)))}function li(){let e=globalThis.Temporal;return e??void 0}function mr(e){if(e!==void 0&&typeof e!="string")return e;if(e==="date")return b;let t=li();if(e==="temporal"){if(t===void 0)throw c.config("CALENDAR_TEMPORAL_UNAVAILABLE",'calendar: "temporal" was asked for, but this runtime has no Temporal. Node ships it from 26 (24 behind --harmony-temporal), and Chrome, Edge, Firefox and Opera ship it; Safari does not. Pass a polyfill-backed backend from "solve-engine/temporal", or use calendar: "auto" to compute on Date where Temporal is absent.');return b$1(t)}return t===void 0?b:b$1(t)}function ci(e={}){return {pluginFunctions:{},opRegistry:new Ce,pluginFunctionOwners:{},networkEnabled:e.networkEnabled??true,calendar:mr(e.calendar)}}var dr=ci();var mi={1970:38.8,1971:40.5,1972:41.8,1973:44.4,1974:49.3,1975:53.8,1976:56.9,1977:60.6,1978:65.2,1979:72.6,1980:82.4,1981:90.9,1982:96.5,1983:99.6,1984:103.9,1985:107.6,1986:109.6,1987:113.6,1988:118.3,1989:124,1990:130.7,1991:136.2,1992:140.3,1993:144.5,1994:148.2,1995:152.4,1996:156.9,1997:160.5,1998:163,1999:166.6,2e3:172.2,2001:177.1,2002:179.9,2003:184,2004:188.9,2005:195.3,2006:201.6,2007:207.3,2008:215.3,2009:214.5,2010:218.1,2011:224.9,2012:229.6,2013:233,2014:236.7,2015:237,2016:240,2017:245.1,2018:251.1,2019:255.7,2020:258.8,2021:271,2022:292.7,2023:304.7,2024:313.7,2025:322.2,2026:332.7},pr=1970,hr=2026;function fr(e){return mi[Math.trunc(e)]}function Lt(e,t){let n=fr(e),r=fr(t);if(!(n===void 0||r===void 0||n===0))return r/n}function Ns(e,t,n){let r=Lt(t,n);if(r!==void 0)return e*r}function di(e){let t=Math.abs(e);return t<60?u(e,"s"):t<3600?u(e/60,"min"):t<86400?u(e/3600,"h"):u(e/86400,"d")}var fi=0;function Ft(e){if(e.type===6&&e.unit!==void 0){let t=a[e.unit.toLowerCase()];if(t!==void 0&&t[0]===fi)return e.toNumber()*t[1]}return e.toNumber()}function pi(e,t){if(t===1)return e;let n=`${e}s`;return a[n.toLowerCase()]===void 0?e:n}function br(e,t){let n$1,r=false;for(let o of e){if(Number.isNaN(o.toNumber())){r=true;continue}if(n$1===void 0){n$1=o;continue}let{lv:i,rv:a,sameMeasure:s}=ye(n$1,o);if(!s){let u=n$1.type===6?n$1.unit:void 0,l=o.type===6?o.unit:void 0,m=_e(u,l,"compared");return P$1("INCOMPATIBLE_UNITS",m??`Cannot compare incompatible units: ${u??"?"} and ${l??"?"}`)}(t?a>i:a<i)&&(n$1=o);}return r?n(NaN):n$1===void 0?n(t?-1/0:1/0):n$1.type===6?n$1:n(n$1.toNumber())}function rt(e,t){return t===void 0?n(e):u(e,t)}function ot(e,t){return e.type===6&&e.unit!==void 0?u(t,e.unit):n(t)}function yr(e,t){let n=Number.isFinite(t)?Math.min(100,Math.max(0,Math.trunc(t))):0;if(e.exact!==void 0){let a=oa(e.exact,n);return it(e,ra(a),n,a)}let r=e.toNumber();if(!Number.isFinite(r))return it(e,r,n);let o=Math.pow(10,n),i=r*o;return !Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER?it(e,r,n):it(e,Math.round(i)/o,n)}function it(e,t,n$1,r){let o=e.type===6&&e.unit!==void 0?u(t,e.unit):n(t);return o.decimalPlaces=n$1,r!==void 0&&(o.exact=r),o}function gr(e,t,n){if(Number.isFinite(e)&&Number.isFinite(t))return null;let r=Number.isFinite(e)?t:e;return P$1("INVALID_INTEGER_OPERAND",`${n} needs two whole numbers, and ${Number.isNaN(r)?"one of them has no value":"one of them is infinite"}`)}function Nr(e,t){let n=e,r=t;for(;r!==0;){let o=r;r=n%r,n=o;}return n}function hi(e){let t=e.length;if(t===0)return 0;let n=e.reduce((r,o)=>r+o,0)/t;return e.reduce((r,o)=>r+(o-n)*(o-n),0)}function at(e,t){let n=e.length;if(n===0)return 0;let r=t?n-1:n;return r<=0?0:hi(e)/r}var bi=12,yi=new Set(["month","months","mo","mos","mth","mths"]);function J(e$1){return e$1.type!==6||e$1.unit===void 0?e$1.toNumber():c$1(e$1.unit)!=="time"?P$1("INVALID_TERM",`a term is a length of time, and "${e$1.unit}" is not: write it as days, months or years`):yi.has(e$1.unit)?e$1.toNumber()/bi:e(e$1.toNumber(),e$1.unit,"year")}var Bs={0:e=>{let t=e[0].toNumber();return t>=0?n(Math.sqrt(t)):V(s("sqrt",[p(t)]))},1:e=>e[0].type===7?ca$1(e[0].value):ot(e[0],Math.abs(e[0].toNumber())),2:e=>n(Math.sin(Ft(e[0]))),3:e=>n(Math.cos(Ft(e[0]))),4:e=>n(Math.tan(Ft(e[0]))),5:e=>n(Math.log(e[0].toNumber())),6:e=>ot(e[0],Math.ceil(e[0].toNumber())),7:e=>ot(e[0],Math.floor(e[0].toNumber())),8:e=>e.length>=2?yr(e[0],e[1].toNumber()):ot(e[0],Math.round(e[0].toNumber())),9:e=>br(e,false),10:e=>br(e,true),11:e=>n(Math.asin(e[0].toNumber())),12:e=>n(Math.acos(e[0].toNumber())),13:e=>n(Math.atan(e[0].toNumber())),14:e=>n(Math.atan2(e[0].toNumber(),e[1].toNumber())),15:e=>n(Math.sinh(e[0].toNumber())),16:e=>n(Math.cosh(e[0].toNumber())),17:e=>n(Math.tanh(e[0].toNumber())),18:e=>n(Math.asinh(e[0].toNumber())),19:e=>n(Math.acosh(e[0].toNumber())),20:e=>n(Math.atanh(e[0].toNumber())),21:e=>n(Math.cbrt(e[0].toNumber())),22:e=>n(Math.clz32(e[0].toNumber())),23:e=>n(Math.expm1(e[0].toNumber())),24:e=>n(Math.exp(e[0].toNumber())),25:e=>n(Math.fround(e[0].toNumber())),26:e=>n(Math.hypot(...e.map(t=>t.toNumber()))),27:e=>n(Math.imul(e[0].toNumber(),e[1].toNumber())),28:e=>n(Math.log10(e[0].toNumber())),29:e=>n(Math.log1p(e[0].toNumber())),30:e=>n(Math.log2(e[0].toNumber())),31:e=>e[0].type===7?e[1].type!==0?P$1("MATRIX_POWER_UNSUPPORTED",`pow: a matrix's exponent must be a whole number, as in "pow([1,2;3,4], 2)".`):$(e[0].value,e[1].value):e[1].type===7?P$1("MATRIX_POWER_UNSUPPORTED",'pow: a matrix may only be the base, as in "pow([1,2;3,4], 2)".'):n(kt(e[0].toNumber(),e[1].toNumber())),32:()=>n(Math.random()),33:e=>n(Math.sign(e[0].toNumber())),34:e=>n(Math.trunc(e[0].toNumber())),35:e=>n(e[0].toNumber()*Math.PI/180),36:e=>n(e[0].toNumber()*180/Math.PI),37:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return t>n$1?P$1("INVALID_RANGE",`roll: invalid range, ${t} is greater than ${n$1}`):n(Math.floor(Math.random()*(n$1-t+1))+t)},38:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n$1=Math.trunc(Math.abs(e[1].toNumber())),r=gr(t,n$1,"gcd");return r||n(Nr(t,n$1))},39:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n$1=Math.trunc(Math.abs(e[1].toNumber())),r=gr(t,n$1,"lcm");return r||(t===0||n$1===0?n(0):n(t/Nr(t,n$1)*n$1))},40:e=>{let t=Math.trunc(e[0].toNumber()),n$1=Math.trunc(e[1].toNumber());if(t<0||n$1<0||n$1>t)return P$1("INVALID_RANGE",`permutation: invalid n=${t}, r=${n$1} (require 0 <= r <= n)`);let r=1;for(let o=0;o<n$1;o++)if(r*=t-o,!Number.isFinite(r))return P$1("PERMUTATION_OVERFLOW",`permutation: P(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${o+1} of ${n$1} factors)`);return n(r)},41:e=>{let t=Math.trunc(e[0].toNumber()),n$1=Math.trunc(e[1].toNumber());if(t<0||n$1<0||n$1>t)return P$1("INVALID_RANGE",`combination: invalid n=${t}, r=${n$1} (require 0 <= r <= n)`);let r=Math.min(n$1,t-n$1),o=1;for(let i=0;i<r;i++)if(o=o*(t-i)/(i+1),!Number.isFinite(o))return P$1("COMBINATION_OVERFLOW",`combination: C(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${i+1} of ${r} steps)`);return n(Math.round(o))},42:e=>{if(e.length===0)return n(0);let t=Te(e,"averaged");if(t instanceof m)return t;let n$1=t.magnitudes.reduce((r,o)=>r+o,0);return rt(n$1/t.magnitudes.length,t.unit)},43:e=>{if(e.length===0)return n(0);let t=Te(e,"ordered");if(t instanceof m)return t;let n$1=t.magnitudes.slice().sort((o,i)=>o-i),r=Math.floor(n$1.length/2);return rt(n$1.length%2===0?(n$1[r-1]+n$1[r])/2:n$1[r],t.unit)},44:e=>{let t=Te(e,"added");return t instanceof m?t:rt(t.magnitudes.reduce((n,r)=>n+r,0),t.unit)},45:e=>n(e.length),46:e=>{let[t,n$1,r]=e,{lv:o,rv:i}=ye(t,n$1);if(o===0)return P$1("PROPORTION_DIVIDE_BY_ZERO",`Cannot compute proportion: "${t.value}" is zero`);let a=r.toNumber()*(i/o);return r.type===6?u(a,r.unit):n(a)},47:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=e[2].toNumber();return n$1>r?P$1("INVALID_RANGE",`clamp: invalid range, ${n$1} is greater than ${r}`):n(Math.min(Math.max(t,n$1),r))},48:e=>r$1(e[0].toNumber()),49:e=>r$1(e[0].toNumber(),"bin"),50:e=>n(Math.trunc(e[0].toNumber())),51:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(1+n$1<=0)return P$1("INVALID_RATE",`compoundInterest: rate ${n$1} makes (1 + rate) non-positive`);let o=t*Math.pow(1+n$1,r);return e[0].type===6?u(o,e[0].unit):n(o)},52:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(1+n$1<=0)return P$1("INVALID_RATE",`interestEarned: rate ${n$1} makes (1 + rate) non-positive`);let o=t*(Math.pow(1+n$1,r)-1);return e[0].type===6?u(o,e[0].unit):n(o)},53:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);return typeof r!="number"?r:t<=0||n$1<=0?P$1("INVALID_RANGE","compoundInterestRate: principal and futureValue must both be positive"):r<=0?P$1("INVALID_RANGE","compoundInterestRate: years must be greater than 0"):n(Math.pow(n$1/t,1/r)-1)},54:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=e[2].toNumber();return t<=0||n$1<=0?P$1("INVALID_RANGE","compoundInterestYears: principal and futureValue must both be positive"):1+r<=0||r===0?P$1("INVALID_RATE",`compoundInterestYears: rate ${r} is not usable (must be > -1 and not 0)`):n(Math.log(n$1/t)/Math.log(1+r))},55:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(t<=0)return P$1("INVALID_RANGE","loanRepayment: principal must be positive");if(r<=0)return P$1("INVALID_RANGE","loanRepayment: years must be positive");if(n$1<0)return P$1("INVALID_RATE","loanRepayment: rate must not be negative");if(o<0)return P$1("INVALID_RANGE","loanRepayment: periodsPerYear must not be negative");let{totalRepayment:i}=Bt(t,n$1,r),a=o===0?i:i/(r*o);return e[0].type===6?u(a,e[0].unit):n(a)},56:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(t<=0)return P$1("INVALID_RANGE","loanInterest: principal must be positive");if(r<=0)return P$1("INVALID_RANGE","loanInterest: years must be positive");if(n$1<0)return P$1("INVALID_RATE","loanInterest: rate must not be negative");if(o<0)return P$1("INVALID_RANGE","loanInterest: periodsPerYear must not be negative");let{totalInterest:i}=Bt(t,n$1,r),a=o===0?i:i/(r*o);return e[0].type===6?u(a,e[0].unit):n(a)},57:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(t<=0)return P$1("INVALID_RANGE","monthlyPayment: principal must be positive");if(r<=0)return P$1("INVALID_RANGE","monthlyPayment: years must be positive");if(n$1<0)return P$1("INVALID_RATE","monthlyPayment: rate must not be negative");let{monthlyPayment:o}=Bt(t,n$1,r);return e[0].type===6?u(o,e[0].unit):n(o)},58:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?Jn(e[0],e[0].unit,n$1,1):n(t*(1+n$1))},59:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return 1+n$1<=0?P$1("INVALID_RATE",`taxRemove: rate ${n$1} makes (1 + rate) non-positive`):e[0].type===6?tr(e[0],e[0].unit,n$1)??u(t/(1+n$1),e[0].unit):n(t/(1+n$1))},60:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=e[2].toNumber(),o=Lt(n$1,r);if(o===void 0)return P$1("INFLATION_YEAR_OUT_OF_RANGE",`inflationAdjust: fromYear ${n$1} or toYear ${r} is outside the bundled CPI table's range (${pr}-${hr})`);let i=t*o;return e[0].type===6?u(i,e[0].unit):n(i)},61:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return n(kt(n$1,1/t))},62:e=>{let t=e[0].toNumber();if(!Number.isInteger(t)||t<0)return P$1("INVALID_FACTORIAL_INPUT",`fact: ${t} is not a non-negative integer`);if(t>170)return P$1("FACTORIAL_OVERFLOW",`fact: ${t}! exceeds the maximum representable double (170! is the largest finite factorial)`);let n$1=1;for(let r=2;r<=t;r++)n$1*=r;return n(n$1)},63:e=>e[0].type===7?ba(e[0].value):e[0],64:e=>e[0].type===7?ca$1(e[0].value):n(e[0].toNumber()),65:e=>e[0].type===7?da$1(e[0].value):n(1/e[0].toNumber()),66:e=>{let[t,n$1]=e;if(t.type===0&&n$1.type===0)return n(t.toNumber()*n$1.toNumber());let r=o=>o.type===7?o.value:{rows:1,cols:1,data:[o.toNumber()],hasSymbolic:false};return _(r(t),r(n$1))},67:e=>{let[t]=e;return t.type!==9?t:V(F$1(t.value))},68:e=>{let[t]=e;return t.type!==9?t:V(Tn(t.value))},69:e=>{let[t,n,r]=e;return r?.type!==3?P$1("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown."):Yn(t,n,r.value)},70:e=>{let[t,n,r]=e,o=$t(n,"der");if(typeof o!="string")return o;let i=P(t);return i===null?P$1("SYMBOLIC_NONFINITE_OPERAND","der needs an expression with an exact value."):V(Oe(i,o,r?.toNumber()??1))},71:e=>{let[t,n]=e,r=$t(n,"integral");if(typeof r!="string")return r;let o=P(t);if(o===null)return P$1("SYMBOLIC_NONFINITE_OPERAND","integral needs an expression with an exact value.");let i=De(o,r);return i.ok?V(i.value):P$1("SYMBOLIC_INTEGRAL_UNSUPPORTED",`Cannot integrate this: ${i.reason}.`)},72:e=>{let[t,n,r,o]=e,i=$t(n,"taylor");if(typeof i!="string")return i;let a=P(t),s=P(r);return a===null||s===null||s.kind!=="const"?P$1("SYMBOLIC_NONFINITE_OPERAND","taylor needs an expression and an exact expansion point."):V(lr(a,i,s.value,o.toNumber()))},73:e=>{let t=[];for(let a of e){let s=P(a);if(s===null)return P$1("SYMBOLIC_NONFINITE_OPERAND","jacobian needs expressions with exact values.");t.push(s);}let n=new Set;for(let a of t)for(let s of u$1(a))n.add(s);let r=[...n].sort();if(r.length===0)return P$1("SYMBOLIC_JACOBIAN_NO_VARIABLES","jacobian needs at least one unknown to differentiate against.");let o=cr(t,r),i=[];for(let a of o)for(let s of a)i.push(W$1(s));return C$2(o.length,r.length,Y(o.length,r.length,i))},74:e=>V(w(o(a$1,d(e[0].toNumber())))),75:e=>Ut("conj",e[0]),76:e=>Ut("re",e[0]),77:e=>Ut("im",e[0]),78:e=>{let t=e[0];return t.type!==9?t:V(J$1(t.value))},79:e=>{let t=e[0];return t.type!==9?t:V(ir(t.value))},85:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();if(1+n$1<=0)return P$1("INVALID_RATE",`taxIn: rate ${n$1} makes (1 + rate) non-positive`);let r=t-t/(1+n$1);return e[0].type===6?nr(e[0],e[0].unit,n$1)??u(r,e[0].unit):n(r)},86:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?Qn(e[0],n$1,e[0].unit):n(t*n$1)},87:e=>n(Math.sin(e[0].toNumber()*Math.PI/180)),88:e=>n(Math.cos(e[0].toNumber()*Math.PI/180)),89:e=>n(Math.tan(e[0].toNumber()*Math.PI/180)),90:e=>n(Math.asin(e[0].toNumber())*180/Math.PI),91:e=>n(Math.acos(e[0].toNumber())*180/Math.PI),92:e=>n(Math.atan(e[0].toNumber())*180/Math.PI),93:e=>u(e[0].toNumber(),"days"),94:e=>{let t$1=typeof e[1]?.value=="string"?e[1].value:void 0,n=typeof e[2]?.value=="string"?e[2].value:void 0;if(t$1===void 0||n===void 0)return P$1("UNKNOWN_UNIT",'both units have to be named, as in "12.5 minutes in minutes and seconds"');let r=a[t$1.toLowerCase()],o=a[n.toLowerCase()];if(r===void 0||o===void 0)return P$1("UNKNOWN_UNIT",`${t$1} and ${n}: one of these is not a unit`);if(r[0]!==o[0])return P$1("INCOMPATIBLE_UNITS",`${t$1} and ${n} measure different things`);if(o[1]>=r[1])return P$1("INCOMPATIBLE_UNITS",`${t$1} and ${n}: name the larger unit first`);let i=e[0],a$1=i.type===6&&i.unit!==void 0?a[i.unit.toLowerCase()]:void 0,s=i.toNumber()*(a$1?.[1]??r[1]),u=Math.floor(s/r[1]),l=Math.round((s-u*r[1])/o[1]*1e3)/1e3;return t(`${u} ${t$1} ${l} ${n}`)},95:e=>{let t=e[0],n=String(e[1].value),r=t.type===6&&t.unit!==void 0?t.unit:"";return r.includes("/")?P$1("INVALID_RATE_UNIT",`${r}/${n}: that is already a rate`):u(t.toNumber(),`${r}/${n}`)},96:e=>{let t=e[0],n$1=e[1];if(n$1.type===6&&t.type===6&&i$1(n$1.unit)){let l=j$1(t.toNumber(),t.unit,n$1.toNumber(),n$1.unit);if(l!==null)return di(l)}if(n$1.type!==6||n$1.unit===void 0||!n$1.unit.includes("/"))return P$1("INVALID_RATE",'at: the right-hand side has to be a rate, as in "$30/hour"');let r=n$1.unit.indexOf("/"),o=n$1.unit.slice(0,r),i=n$1.unit.slice(r+1),a$1=t.type===6?t.unit:void 0,s=a[i.toLowerCase()],u$1=a$1===void 0?void 0:a[a$1.toLowerCase()];if(u$1!==void 0&&s!==void 0&&u$1[0]===s[0]){let m=t.toNumber()*u$1[1]/s[1]*n$1.toNumber();return o===""?n(m):u(m,o)}if(a$1!==void 0&&a$1===o){let l=t.toNumber()/n$1.toNumber();return u(l,pi(i,l))}if(a$1===void 0){let l=t.toNumber()*n$1.toNumber();return o===""?n(l):u(l,o)}return P$1("INCOMPATIBLE_UNITS",`at: ${a$1} matches neither side of ${n$1.unit}`)},80:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(o<=0)return P$1("INVALID_RATE",`compounding: ${o} periods per year is not a period`);if(1+n$1/o<=0)return P$1("INVALID_RATE",`compounding: rate ${n$1} makes each period non-positive`);let i=t*Math.pow(1+n$1/o,o*r);return e[0].type===6?u(i,e[0].unit):n(i)},81:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;let o=e[3].toNumber();if(o<=0||1+n$1/o<=0)return P$1("INVALID_RATE",`compounding: rate ${n$1} over ${o} periods per year is not usable`);let i=t*(Math.pow(1+n$1/o,o*r)-1);return e[0].type===6?u(i,e[0].unit):n(i)},82:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),r=J(e[2]);if(typeof r!="number")return r;if(1+n$1<=0)return P$1("INVALID_RATE",`presentValue: rate ${n$1} makes (1 + rate) non-positive`);let o=t/Math.pow(1+n$1,r);return e[0].type===6?u(o,e[0].unit):n(o)},83:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return t===0?P$1("INVALID_RATE","roi: nothing was invested, so there is no return on it"):n((n$1-t)/t)},84:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=J(e[2]);return typeof r!="number"?r:t<=0?P$1("INVALID_RATE","annual return: the amount invested must be positive"):r<=0?P$1("INVALID_RATE","annual return: the period must be longer than zero"):n<=0?P$1("INVALID_RATE","annual return: nothing was returned, so there is no annual rate"):N(Math.pow(n/t,1/r)-1)},97:e=>yr(e[0],e[1].toNumber()),98:e=>{let t=e[1].toNumber();return !Number.isInteger(t)||t<1?P$1("INVALID_RANGE",`split: the number of shares must be a whole number of at least 1, not ${e[1].toNumber()}.`):H(rr(e[0],t))},99:e=>{let t=e[0].toNumber(),n$1=gi(e[1]),r=e[2].toNumber();if(n$1===null)return P$1("INVALID_RANGE",'savings goal: the duration must be in months or years, e.g. "in 2 years".');if(t<=0)return P$1("INVALID_RANGE","savings goal: the target must be positive.");if(n$1<=0)return P$1("INVALID_RANGE","savings goal: the duration must be positive.");if(r<0)return P$1("INVALID_RATE","savings goal: the rate must not be negative.");let o=Ni(t,r/12,n$1);return e[0].type===6?u(o,e[0].unit):n(o)},100:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),r=e[2].toNumber(),o=e[3].toNumber(),i=typeof e[4]?.value=="string"?e[4].value:"periods";if(t<=0)return P$1("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return P$1("INVALID_RANGE","savings goal: the contribution must be positive.");if(o<0)return P$1("INVALID_RATE","savings goal: the rate must not be negative.");let a=Ri(t,n,o/r);return u(a,i)},101:e=>n(Math.sqrt(at(e.map(t=>t.toNumber()),false))),102:e=>n(Math.sqrt(at(e.map(t=>t.toNumber()),true))),103:e=>n(at(e.map(t=>t.toNumber()),false)),104:e=>n(at(e.map(t=>t.toNumber()),true)),105:e=>{if(e.length===0)return n(0);let t=Te(e,"compared");if(t instanceof m)return t;let n$1=t.magnitudes;return rt(Math.max(...n$1)-Math.min(...n$1),t.unit)},106:e=>{if(e.length===0)return n(0);let t=new Map,n$1=e[0].toNumber(),r=0;for(let o of e){let i=o.toNumber(),a=(t.get(i)??0)+1;t.set(i,a),a>r&&(r=a,n$1=i);}return n(n$1)},107:e=>{let t=0,n$1=0;for(let r=0;r+1<e.length;r+=2){let o=e[r].toNumber(),i=e[r+1].toNumber();t+=o*i,n$1+=i;}return n$1===0?P$1("WEIGHTED_AVERAGE_ZERO_WEIGHT","weighted average: the weights sum to zero, so there is nothing to divide by"):n(t/n$1)}};function gi(e){if(e.type!==6)return null;let t=e.unit;return t==="months"||t==="month"?e.toNumber():t==="years"||t==="year"?e.toNumber()*12:null}function Ni(e,t,n){return t===0?e/n:e*t/(Math.pow(1+t,n)-1)}function Ri(e,t,n){let r=n===0?e/t:Math.log(1+e*n/t)/Math.log(1+n);return Math.ceil(r-1e-9)}function Ut(e,t){let n=P(t);return n===null?P$1("SYMBOLIC_NONFINITE_OPERAND",e+" needs a value with an exact number."):V(s(e,[n]))}function $t(e,t){return e?.type!==3?P$1("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown.`):e.value}function Bt(e,t,n){let r=n*12,o=t/12,i=o===0?e/r:e*o/(1-Math.pow(1+o,-r)),a=i*r,s=a-e;return {monthlyPayment:i,totalRepayment:a,totalInterest:s}}var qs=dr.pluginFunctions,Rr=65535,Ar=0;function Ai(){if(Ar>Rr)throw c.config("PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",`allocatePluginFunctionIndex: pool exhausted (max ${Rr+1} allocations).`);return Ar++}var Sr=new Map;function Ys(e){let t=Sr.get(e);return t===void 0&&(t=Ai(),Sr.set(e,t)),t}var qt=new Map;function Ks(e,t){let n=e.toLowerCase(),r=qt.get(n);r&&r!==t&&console.warn(`[asConverterRegistry] Converter name "${n}" is already registered \u2014 overwriting.`),qt.set(n,t);}function Gs(e){qt.delete(e.toLowerCase());}var st=class st{constructor(){this.values=new Map;this.listeners=new Set;this.notifyDepth=0;}get(t){return this.values.get(t)}has(t){return this.values.has(t)}set(t,n){let r=this.values.get(t);this.values.set(t,n),!(r!==void 0&&Si(r,n))&&this.notify(t,n);}notify(t,n){if(!(this.notifyDepth>=st.MAX_NOTIFY_DEPTH)){this.notifyDepth++;try{for(let r of this.listeners)r(t,n);}finally{this.notifyDepth--;}}}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}clear(){this.values.clear(),this.listeners.clear(),this.notifyDepth=0;}};st.MAX_NOTIFY_DEPTH=64;var Yt=st;function Si(e,t){if(e.type!==t.type||e.unit!==t.unit||(e.timedOut??false)!==(t.timedOut??false))return false;let n=e.value,r=t.value;if(Array.isArray(n)||Array.isArray(r)){if(!Array.isArray(n)||!Array.isArray(r)||n.length!==r.length)return false;for(let o=0;o<n.length;o++)if(!Object.is(n[o],r[o]))return false;return true}return Object.is(n,r)}var Hs=new Yt;function Xs(e){return `global:${e}`}var xi={sydney:"Australia/Sydney",melbourne:"Australia/Melbourne",brisbane:"Australia/Brisbane",perth:"Australia/Perth",adelaide:"Australia/Adelaide",canberra:"Australia/Sydney",auckland:"Pacific/Auckland",wellington:"Pacific/Auckland",fiji:"Pacific/Fiji",chicago:"America/Chicago",seattle:"America/Los_Angeles",denver:"America/Denver",phoenix:"America/Phoenix",toronto:"America/Toronto",montreal:"America/Toronto",vancouver:"America/Vancouver",ottawa:"America/Toronto",honolulu:"Pacific/Honolulu",anchorage:"America/Anchorage",miami:"America/New_York",boston:"America/New_York",atlanta:"America/New_York",dallas:"America/Chicago",houston:"America/Chicago",lima:"America/Lima",bogota:"America/Bogota",caracas:"America/Caracas",santiago:"America/Santiago",montevideo:"America/Montevideo",quito:"America/Guayaquil",london:"Europe/London",paris:"Europe/Paris",berlin:"Europe/Berlin",madrid:"Europe/Madrid",rome:"Europe/Rome",amsterdam:"Europe/Amsterdam",dublin:"Europe/Dublin",lisbon:"Europe/Lisbon",vienna:"Europe/Vienna",zurich:"Europe/Zurich",geneva:"Europe/Zurich",moscow:"Europe/Moscow",istanbul:"Europe/Istanbul",athens:"Europe/Athens",stockholm:"Europe/Stockholm",oslo:"Europe/Oslo",helsinki:"Europe/Helsinki",warsaw:"Europe/Warsaw",prague:"Europe/Prague",budapest:"Europe/Budapest",brussels:"Europe/Brussels",copenhagen:"Europe/Copenhagen",reykjavik:"Atlantic/Reykjavik",kiev:"Europe/Kyiv",kyiv:"Europe/Kyiv",tokyo:"Asia/Tokyo",osaka:"Asia/Tokyo",beijing:"Asia/Shanghai",shanghai:"Asia/Shanghai",seoul:"Asia/Seoul",singapore:"Asia/Singapore",bangkok:"Asia/Bangkok",jakarta:"Asia/Jakarta",manila:"Asia/Manila",mumbai:"Asia/Kolkata",delhi:"Asia/Kolkata",bangalore:"Asia/Kolkata",dubai:"Asia/Dubai",abudhabi:"Asia/Dubai",karachi:"Asia/Karachi",dhaka:"Asia/Dhaka",hanoi:"Asia/Ho_Chi_Minh",taipei:"Asia/Taipei",islamabad:"Asia/Karachi",riyadh:"Asia/Riyadh",telaviv:"Asia/Jerusalem",jerusalem:"Asia/Jerusalem",cairo:"Africa/Cairo",lagos:"Africa/Lagos",nairobi:"Africa/Nairobi",johannesburg:"Africa/Johannesburg",casablanca:"Africa/Casablanca",accra:"Africa/Accra",tunis:"Africa/Tunis",addisababa:"Africa/Addis_Ababa",france:"Europe/Paris",germany:"Europe/Berlin",spain:"Europe/Madrid",italy:"Europe/Rome",japan:"Asia/Tokyo",china:"Asia/Shanghai",india:"Asia/Kolkata",brazil:"America/Sao_Paulo",russia:"Europe/Moscow",australia:"Australia/Sydney",canada:"America/Toronto",mexico:"America/Mexico_City",uk:"Europe/London",usa:"America/New_York",ireland:"Europe/Dublin",netherlands:"Europe/Amsterdam",sweden:"Europe/Stockholm",norway:"Europe/Oslo",poland:"Europe/Warsaw",turkey:"Europe/Istanbul",egypt:"Africa/Cairo",nigeria:"Africa/Lagos"},vi={"new york":"America/New_York","los angeles":"America/Los_Angeles","san francisco":"America/Los_Angeles","las vegas":"America/Los_Angeles","mexico city":"America/Mexico_City","hong kong":"Asia/Hong_Kong","kuala lumpur":"Asia/Kuala_Lumpur","sao paulo":"America/Sao_Paulo","buenos aires":"America/Argentina/Buenos_Aires","rio de janeiro":"America/Sao_Paulo","cape town":"Africa/Johannesburg","new delhi":"Asia/Kolkata","united kingdom":"Europe/London","united states":"America/New_York","south africa":"Africa/Johannesburg"},Mi={pst:"America/Los_Angeles",pdt:"America/Los_Angeles",est:"America/New_York",edt:"America/New_York",cst:"America/Chicago",cdt:"America/Chicago",mst:"America/Denver",mdt:"America/Denver",hst:"Pacific/Honolulu",bst:"Europe/London",cet:"Europe/Paris",cest:"Europe/Paris",jst:"Asia/Tokyo",ist:"Asia/Kolkata",aest:"Australia/Sydney",aedt:"Australia/Sydney"},Ei={...xi,...vi,...Mi};function zs(e){let t=e.trim().toLowerCase();return t==="utc"||t==="gmt"?"UTC":Ei[t]??null}export{Va as A,ci as B,dr as C,pr as D,hr as E,Ns as F,Bs as G,qs as H,Ai as I,Ys as J,qt as K,Ks as L,Gs as M,Hs as N,Xs as O,vi as P,Ei as Q,zs as R,At as a,Ii as b,Rn as c,Pe as d,Qn as e,Jn as f,$n as g,la as h,ca as i,ma as j,da as k,Yn as l,ye as m,Te as n,xa as o,va as p,Ma as q,Gn as r,Ea as s,Ia as t,kt as u,ka as v,wa as w,Ta as x,_a as y,Ce as z};//# sourceMappingURL=chunk-QP4VIEXZ.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-QP4VIEXZ.js.map
|