solve-engine 2.34.2 → 2.34.4
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/{chunk-INKOUIXV.js → chunk-DJRGEWPI.js} +2 -2
- package/dist/{chunk-INKOUIXV.js.map → chunk-DJRGEWPI.js.map} +1 -1
- package/dist/chunk-ESNTBS6Z.js +3 -0
- package/dist/{chunk-GVFLZTIE.js.map → chunk-ESNTBS6Z.js.map} +1 -1
- package/dist/chunk-EVY2Y4FT.js +2 -0
- package/dist/chunk-EVY2Y4FT.js.map +1 -0
- package/dist/chunk-GR2ZEYRG.js +3 -0
- package/dist/chunk-GR2ZEYRG.js.map +1 -0
- package/dist/chunk-J4Y4MAX4.cjs +2 -0
- package/dist/chunk-J4Y4MAX4.cjs.map +1 -0
- package/dist/chunk-LQHIRKDZ.cjs +3 -0
- package/dist/chunk-LQHIRKDZ.cjs.map +1 -0
- package/dist/{chunk-SDB2A3UL.cjs → chunk-MCJDFVAJ.cjs} +2 -2
- package/dist/{chunk-SDB2A3UL.cjs.map → chunk-MCJDFVAJ.cjs.map} +1 -1
- package/dist/{chunk-F33PW6UP.cjs → chunk-PDD5YQBD.cjs} +4 -4
- package/dist/{chunk-F33PW6UP.cjs.map → chunk-PDD5YQBD.cjs.map} +1 -1
- package/dist/{chunk-YX37ZCK3.cjs → chunk-T7NEEJYP.cjs} +3 -3
- package/dist/{chunk-YX37ZCK3.cjs.map → chunk-T7NEEJYP.cjs.map} +1 -1
- package/dist/chunk-UUCFL3D6.js +2 -0
- package/dist/{chunk-EQ37UQGY.js.map → chunk-UUCFL3D6.js.map} +1 -1
- package/dist/{chunk-H57IABQ2.js → chunk-VI7YREQQ.js} +4 -4
- package/dist/{chunk-H57IABQ2.js.map → chunk-VI7YREQQ.js.map} +1 -1
- package/dist/{chunk-ASO4V4WR.cjs → chunk-XWDABNQX.cjs} +2 -2
- package/dist/{chunk-ASO4V4WR.cjs.map → chunk-XWDABNQX.cjs.map} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.js +1 -1
- package/dist/engine.worker.cjs +1 -1
- package/dist/engine.worker.js +1 -1
- package/dist/engine.worker.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/packages.cjs +1 -1
- package/dist/packages.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-EQ37UQGY.js +0 -2
- package/dist/chunk-ETQBU454.js +0 -2
- package/dist/chunk-ETQBU454.js.map +0 -1
- package/dist/chunk-F6FRMZWE.js +0 -3
- package/dist/chunk-F6FRMZWE.js.map +0 -1
- package/dist/chunk-FAA47IKC.cjs +0 -2
- package/dist/chunk-FAA47IKC.cjs.map +0 -1
- package/dist/chunk-GVFLZTIE.js +0 -3
- package/dist/chunk-ZTEZBVBC.cjs +0 -3
- package/dist/chunk-ZTEZBVBC.cjs.map +0 -1
package/dist/testing.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkPDD5YQBD_cjs=require('./chunk-PDD5YQBD.cjs');require('./chunk-P5YWBIIU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-R3W53ZMP.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-MCJDFVAJ.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-IAXRJ5II.cjs'),require('./chunk-R2SZFJTT.cjs');var chunkLQHIRKDZ_cjs=require('./chunk-LQHIRKDZ.cjs');require('./chunk-NMZRAJLJ.cjs'),require('./chunk-M4UC2PB6.cjs'),require('./chunk-K3PZ66XR.cjs'),require('./chunk-YV4GDW5A.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-GDLYXRMA.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-J4Y4MAX4.cjs'),require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-5N4XDULO.cjs'),require('./chunk-EQNKDTMX.cjs'),require('./chunk-E4HAKNBQ.cjs');var chunkNH74IT7B_cjs=require('./chunk-NH74IT7B.cjs');require('./chunk-PHWIO4P3.cjs');var chunkXWDABNQX_cjs=require('./chunk-XWDABNQX.cjs');require('./chunk-3MG7VIPL.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-72J5V7SN.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs');var chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new chunkPDD5YQBD_cjs.o({locale:e,packages:r?chunkLQHIRKDZ_cjs.z:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof chunk6SYU4MH7_cjs.b)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new chunkNH74IT7B_cjs.m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=chunkPDD5YQBD_cjs.a(this.pkg,t),s=$.indexOf(e),a=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a.length>0){let u=a.map(g=>`[${g.severity}] ${g.detail}`).join(`
|
|
2
2
|
`);throw new i({code:"PACKAGE_VOCABULARY_COLLISION",message:`Package "${this.pkg.name}" collides with another package:
|
|
3
|
-
${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=
|
|
3
|
+
${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=chunkXWDABNQX_cjs.a){let e=chunkPDD5YQBD_cjs.b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}exports.COMMON_PROSE_WORDS=O;exports.ExpectationError=i;exports.ExpressionAssertion=d;exports.PackageAssertion=p;exports.createTestEngine=V;exports.expectExpression=D;exports.expectPackage=L;//# sourceMappingURL=testing.cjs.map
|
|
4
4
|
//# sourceMappingURL=testing.cjs.map
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {o,a,b}from'./chunk-
|
|
1
|
+
import {o,a,b}from'./chunk-VI7YREQQ.js';import'./chunk-RU3KGJRA.js';import'./chunk-2RWAXT6O.js';import'./chunk-RMDCGYZM.js';import'./chunk-MIQBJGGR.js';import'./chunk-UUCFL3D6.js';import'./chunk-JP4JMQOG.js';import'./chunk-TZ3Q6GOC.js';import'./chunk-XEIDV5JP.js';import {z}from'./chunk-GR2ZEYRG.js';import'./chunk-AWGSR2GZ.js';import'./chunk-TJKN466F.js';import'./chunk-U5MESNRT.js';import'./chunk-DB5ISONG.js';import'./chunk-76F3LCIL.js';import'./chunk-EOKHRS2T.js';import'./chunk-TCZSPH4A.js';import'./chunk-EVY2Y4FT.js';import'./chunk-X2GQAKL2.js';import'./chunk-PICFFFJV.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-IHPYXJIY.js';import'./chunk-EOO6M65F.js';import'./chunk-J4K72CQN.js';import {m}from'./chunk-A34R65WT.js';import'./chunk-BWTVJD5L.js';import {a as a$1}from'./chunk-DJRGEWPI.js';import'./chunk-6NL7RBAG.js';import'./chunk-JPFCXLJV.js';import'./chunk-APYRNAU2.js';import'./chunk-FAO6DQ74.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import {b as b$1}from'./chunk-6G2NES2I.js';var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o$1=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new o({locale:e,packages:r?z:[]});for(let a of o$1)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof b$1)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=a(this.pkg,t),s=$.indexOf(e),a$1=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a$1.length>0){let u=a$1.map(g=>`[${g.severity}] ${g.detail}`).join(`
|
|
2
2
|
`);throw new i({code:"PACKAGE_VOCABULARY_COLLISION",message:`Package "${this.pkg.name}" collides with another package:
|
|
3
3
|
${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a$1.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=a$1){let e=b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}export{O as COMMON_PROSE_WORDS,i as ExpectationError,d as ExpressionAssertion,p as PackageAssertion,V as createTestEngine,D as expectExpression,L as expectPackage};//# sourceMappingURL=testing.js.map
|
|
4
4
|
//# sourceMappingURL=testing.js.map
|
package/dist/vm.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkMCJDFVAJ_cjs=require('./chunk-MCJDFVAJ.cjs');require('./chunk-HG4NPDN5.cjs');var chunkJ4Y4MAX4_cjs=require('./chunk-J4Y4MAX4.cjs');require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5N4XDULO.cjs'),require('./chunk-EQNKDTMX.cjs'),require('./chunk-E4HAKNBQ.cjs');var chunkNH74IT7B_cjs=require('./chunk-NH74IT7B.cjs');require('./chunk-PHWIO4P3.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-6SYU4MH7.cjs');var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};Object.defineProperty(exports,"DependencyGraph",{enumerable:true,get:function(){return chunkMCJDFVAJ_cjs.a}});Object.defineProperty(exports,"ScopeManager",{enumerable:true,get:function(){return chunkMCJDFVAJ_cjs.b}});Object.defineProperty(exports,"createVM",{enumerable:true,get:function(){return chunkMCJDFVAJ_cjs.c}});Object.defineProperty(exports,"executeBytecode",{enumerable:true,get:function(){return chunkMCJDFVAJ_cjs.d}});Object.defineProperty(exports,"OpRegistry",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.w}});Object.defineProperty(exports,"allocatePluginFunctionIndex",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.F}});Object.defineProperty(exports,"binaryOp",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.v}});Object.defineProperty(exports,"builtinFunctions",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.D}});Object.defineProperty(exports,"pluginFunctionIndexFor",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.G}});Object.defineProperty(exports,"pluginFunctionRegistry",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.E}});Object.defineProperty(exports,"sharedOpRegistry",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.x}});Object.defineProperty(exports,"unifyUom",{enumerable:true,get:function(){return chunkJ4Y4MAX4_cjs.j}});Object.defineProperty(exports,"Value",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.m}});Object.defineProperty(exports,"ValueType",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.g}});Object.defineProperty(exports,"bigIntValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.s}});Object.defineProperty(exports,"chargeAllocation",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.c}});Object.defineProperty(exports,"checkAllocation",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.d}});Object.defineProperty(exports,"checkedArray",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.e}});Object.defineProperty(exports,"colVectorValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.E}});Object.defineProperty(exports,"hexValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.r}});Object.defineProperty(exports,"matrixValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.C}});Object.defineProperty(exports,"numberValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.n}});Object.defineProperty(exports,"rangeValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.F}});Object.defineProperty(exports,"rowVectorValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.D}});Object.defineProperty(exports,"stringValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.t}});Object.defineProperty(exports,"uomValue",{enumerable:true,get:function(){return chunkNH74IT7B_cjs.u}});exports.VMCheckpointer=l;//# sourceMappingURL=vm.cjs.map
|
|
2
2
|
//# sourceMappingURL=vm.cjs.map
|
package/dist/vm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as DependencyGraph,b as ScopeManager,c as createVM,d as executeBytecode}from'./chunk-
|
|
1
|
+
export{a as DependencyGraph,b as ScopeManager,c as createVM,d as executeBytecode}from'./chunk-UUCFL3D6.js';import'./chunk-JP4JMQOG.js';export{w as OpRegistry,F as allocatePluginFunctionIndex,v as binaryOp,D as builtinFunctions,G as pluginFunctionIndexFor,E as pluginFunctionRegistry,x as sharedOpRegistry,j as unifyUom}from'./chunk-EVY2Y4FT.js';import'./chunk-X2GQAKL2.js';import'./chunk-PICFFFJV.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-IHPYXJIY.js';import'./chunk-EOO6M65F.js';import'./chunk-J4K72CQN.js';export{m as Value,g as ValueType,s as bigIntValue,c as chargeAllocation,d as checkAllocation,e as checkedArray,E as colVectorValue,r as hexValue,C as matrixValue,n as numberValue,F as rangeValue,D as rowVectorValue,t as stringValue,u as uomValue}from'./chunk-A34R65WT.js';import'./chunk-BWTVJD5L.js';import'./chunk-PRSXXDTA.js';import'./chunk-6G2NES2I.js';var l=class{constructor(t){this.checkpoints=[];this.vm=t;}snapshot(t,n,e){if(e.length===0)return null;let r=this.checkpoints.length>0?this.checkpoints[this.checkpoints.length-1]:null,o=Object.create(r?.variables??null),i=Object.create(r?.functions??null);for(let s of e){if(this.vm.hasUserFunction(s)){let p=this.vm.getUserFunction(s);p&&(i[s]=p);continue}let u=this.vm.getVar(s);u!==void 0&&(o[s]=u);}let c={lineNumber:t,lineId:n,variables:o,functions:i,parent:r};return this.checkpoints.push(c),c}restoreTo(t){let n=this.getNearestCheckpoint(t);if(!n){this.vm.reset();return}let e=[],r=n;for(;r;)e.unshift(r),r=r.parent;this.vm.reset();for(let o of e){for(let i of Object.keys(o.variables))this.vm.setVar(i,o.variables[i]);for(let i of Object.keys(o.functions)){let c=o.functions[i];this.vm.defineUserFunction(c.name,c.params,c.program);}}}getNearestCheckpoint(t){let n=null;for(let e of this.checkpoints)if(e.lineNumber<=t)n=e;else break;return n}getCheckpointAt(t){return this.checkpoints.find(n=>n.lineNumber===t)}getAllCheckpoints(){return this.checkpoints}lookupVariable(t){if(this.checkpoints.length===0)return;let e=this.checkpoints[this.checkpoints.length-1].variables;for(;e;){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];e=Object.getPrototypeOf(e);}}clear(){this.checkpoints=[];}get count(){return this.checkpoints.length}get isEmpty(){return this.checkpoints.length===0}get vmInstance(){return this.vm}};export{l as VMCheckpointer};//# sourceMappingURL=vm.js.map
|
|
2
2
|
//# sourceMappingURL=vm.js.map
|
package/dist/worker.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var chunkHSTGWWU2_cjs=require('./chunk-HSTGWWU2.cjs'),
|
|
2
|
-
`).forEach((u,d)=>a.set(d+1,u)):o.method==="evaluateLines"?o.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,o.args[0]),a},V=(o,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:chunkHSTGWWU2_cjs.b(chunk6SYU4MH7_cjs.d(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let T=o.evaluateLine(d,f);T&&u.push({lineNumber:d,value:m(T,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},U=o=>{p?.();let a=o.getEventStream().getReader();p=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;V(o,d);}}catch{}})();},j=o=>{try{let a=$(n,o.packages);t=new
|
|
1
|
+
'use strict';var chunkHSTGWWU2_cjs=require('./chunk-HSTGWWU2.cjs'),chunkPDD5YQBD_cjs=require('./chunk-PDD5YQBD.cjs');require('./chunk-P5YWBIIU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-R3W53ZMP.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-MCJDFVAJ.cjs'),require('./chunk-HG4NPDN5.cjs');var chunkIAXRJ5II_cjs=require('./chunk-IAXRJ5II.cjs');require('./chunk-R2SZFJTT.cjs');var chunkLQHIRKDZ_cjs=require('./chunk-LQHIRKDZ.cjs');require('./chunk-NMZRAJLJ.cjs');var chunkM4UC2PB6_cjs=require('./chunk-M4UC2PB6.cjs');require('./chunk-K3PZ66XR.cjs'),require('./chunk-YV4GDW5A.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-GDLYXRMA.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-J4Y4MAX4.cjs'),require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs');var chunk5TVI2UPZ_cjs=require('./chunk-5TVI2UPZ.cjs'),chunk5N4XDULO_cjs=require('./chunk-5N4XDULO.cjs');require('./chunk-EQNKDTMX.cjs'),require('./chunk-E4HAKNBQ.cjs'),require('./chunk-NH74IT7B.cjs'),require('./chunk-PHWIO4P3.cjs');var chunkXWDABNQX_cjs=require('./chunk-XWDABNQX.cjs');require('./chunk-3MG7VIPL.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-72J5V7SN.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs');var chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');function B(e){if(e?.date?.inputOrder!=="locale")return e;let r={...e.date,inputOrder:chunkM4UC2PB6_cjs.h({...chunkXWDABNQX_cjs.b.date,...e.date}).order};return delete r.inputLocale,{...e,date:r}}var x=class{constructor(r){this.nextId=1;this.pending=new Map;this.resolvedListeners=new Set;this.asyncErrorListeners=new Set;this.terminated=false;this.transport=r,this.transport.onMessage(n=>this.onMessage(n));}init(r){let n=this.nextId++;return new Promise((t,s)=>{this.pending.set(n,{resolve:()=>t(),reject:s}),this.transport.postMessage({kind:"init",id:n,localeCode:r.localeCode,diagnostics:r.diagnostics,config:B(r.config),packages:r.packages,formatting:r.formatting});})}parseDocument(r,n){let{signal:t,...s}=n??{},i=Object.keys(s).length>0?s:void 0;return this.call("parseDocument",[r,i],t)}evaluateLines(r,n){return this.call("evaluateLines",[r],n?.signal)}evaluateExpression(r,n){return this.call("evaluateExpression",[r],n?.signal)}onResolved(r){return this.resolvedListeners.add(r),()=>this.resolvedListeners.delete(r)}onAsyncError(r){return this.asyncErrorListeners.add(r),()=>this.asyncErrorListeners.delete(r)}terminate(){if(this.terminated)return;this.terminated=true;let r=chunkHSTGWWU2_cjs.e();for(let n of this.pending.values())this.unhook(n),n.reject(r);this.pending.clear(),this.resolvedListeners.clear(),this.asyncErrorListeners.clear(),this.transport.terminate();}call(r,n,t){if(this.terminated)return Promise.reject(chunkHSTGWWU2_cjs.e());if(t?.aborted)return Promise.reject(chunkHSTGWWU2_cjs.d(r));let s=this.nextId++;return new Promise((i,l)=>{let c={resolve:i,reject:l};if(t){let p=()=>{this.pending.has(s)&&(this.pending.delete(s),this.transport.postMessage({kind:"cancel",id:s}),l(chunkHSTGWWU2_cjs.d(r)));};c.signal=t,c.onAbort=p,t.addEventListener("abort",p,{once:true});}this.pending.set(s,c),this.transport.postMessage({kind:"request",id:s,method:r,args:n});})}onMessage(r){let n=r;switch(n.kind){case "ready":case "result":{let t=n.kind==="result"?n.value:void 0;this.settle(n.id,s=>s.resolve(t));break}case "error":this.settle(n.id,t=>t.reject(chunkHSTGWWU2_cjs.c(n.error)));break;case "async-update":for(let t of [...this.resolvedListeners])t(n.lines);break;case "async-error":for(let t of [...this.asyncErrorListeners])t({queryKey:n.queryKey,packageId:n.packageId,error:chunkHSTGWWU2_cjs.c(n.error)});break}}settle(r,n){let t=this.pending.get(r);t&&(this.pending.delete(r),this.unhook(t),n(t));}unhook(r){r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort);}};async function G(e){let r=new x(e.transport);return await r.init(e),r}function F(e){return e>0?"Infinity":e<0?"-Infinity":"NaN"}function H(e){let r=e.data.map(n=>typeof n=="object"&&n!==null?chunk5N4XDULO_cjs.R(n):typeof n=="number"&&!Number.isFinite(n)?F(n):n);return {rows:e.rows,cols:e.cols,cells:r,hasSymbolic:e.hasSymbolic}}function m(e,r){let n=e.toNumber(),t={type:e.type,text:chunkIAXRJ5II_cjs.c(e,r),number:Number.isFinite(n)?n:0};Number.isFinite(n)||(t.nonFinite=F(n)),e.unit!==void 0&&(t.unit=e.unit),e.timedOut!==void 0&&(t.timedOut=e.timedOut),e.grain!==void 0&&(t.grain=e.grain),e.zone!==void 0&&(t.zone=e.zone);let s=e.value;if(typeof s=="bigint")t.bigint=s.toString();else if(e.type===7)t.matrix=H(s);else if(e.type===8){let i=s;t.range={min:i.min,max:i.max};}else if(e.type===14){let i=s;t.colour={hex:chunk5TVI2UPZ_cjs.f(i),r:i.r,g:i.g,b:i.b,a:i.a,format:i.format,css:chunk5TVI2UPZ_cjs.g(i)};}else if(e.type===16){let i=s;t.chart={kind:i.kind,points:i.points.map(l=>[l[0],l[1]]),label:i.label,domain:[i.domain[0],i.domain[1]],range:[i.range[0],i.range[1]],...i.expr!==void 0?{expr:i.expr}:{}};}else if(e.type===17){let i=s;t.ipCidr={...i.addr!==void 0?{addr:i.addr}:{},...i.prefix!==void 0?{prefix:i.prefix}:{},text:chunkIAXRJ5II_cjs.c(e).replace(/^=\s*/,"")};}return t}function q(e,r){return e?m(e,r):null}function J(e,r){return {start:e.start,end:e.end,expression:e.expression,lineNumber:e.lineNumber,columnNumber:e.columnNumber,result:q(e.result,r),error:e.error??null}}function y(e,r){return {lineNumber:e.lineNumber,text:e.text,startPosition:e.startPosition,endPosition:e.endPosition,isEmpty:e.isEmpty,hasInlineSolves:e.hasInlineSolves,inlineSolves:e.inlineSolves.map(n=>J(n,r)),expression:e.expression,result:q(e.result,r),error:e.error}}function R(e,r){let n={lines:e.lines.map(t=>y(t,r)),totalLines:e.totalLines,errors:[...e.errors]};return e.diagnostics!==void 0&&(n.diagnostics=e.diagnostics),n}function $(e,r){if(r===void 0)return e;let n=new Map(e.map(s=>[s.name,s])),t=[];for(let s of r){let i=n.get(s);if(!i)throw chunk6SYU4MH7_cjs.c.config(chunkHSTGWWU2_cjs.a.WORKER_UNKNOWN_PACKAGE,`No package named "${s}" is available in this worker runtime`,{name:s,available:[...n.keys()]});t.push(i);}return t}function Q(e,r={}){let n=r.packages??chunkLQHIRKDZ_cjs.z,t=null,s,i=new Map,l=new Map,c=null,p=null,g=o=>e.postMessage(o),E=(o,a)=>{g({kind:"error",id:o,error:chunkHSTGWWU2_cjs.b(chunk6SYU4MH7_cjs.d(a))});},D=o=>{let a=new Map;return o.method==="parseDocument"?o.args[0].split(`
|
|
2
|
+
`).forEach((u,d)=>a.set(d+1,u)):o.method==="evaluateLines"?o.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,o.args[0]),a},V=(o,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:chunkHSTGWWU2_cjs.b(chunk6SYU4MH7_cjs.d(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let T=o.evaluateLine(d,f);T&&u.push({lineNumber:d,value:m(T,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},U=o=>{p?.();let a=o.getEventStream().getReader();p=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;V(o,d);}}catch{}})();},j=o=>{try{let a=$(n,o.packages);t=new chunkPDD5YQBD_cjs.o({locale:o.localeCode??"en",diagnostics:o.diagnostics??!1,config:o.config,packages:a,calendar:r.calendar}),s=r.calendar?{...o.formatting??chunkIAXRJ5II_cjs.a,calendar:r.calendar}:o.formatting,U(t),g({kind:"ready",id:o.id});}catch(a){E(o.id,a);}},K=(o,a)=>{let{method:u,args:d}=a;switch(u){case "parseDocument":return R(o.parseDocument(d[0],d[1]),s);case "evaluateLines":return o.evaluateLines(d[0]).map(f=>y(f,s));case "evaluateExpression":return m(o.evaluateExpression(d[0]),s);default:throw chunk6SYU4MH7_cjs.c.execution(chunkHSTGWWU2_cjs.a.WORKER_UNKNOWN_METHOD,`The worker runtime has no method named "${String(u)}"`,{method:u})}},_=o=>{let a=t;if(!a){E(o.id,chunk6SYU4MH7_cjs.c.execution(chunkHSTGWWU2_cjs.a.WORKER_NOT_INITIALISED,"The worker received a request before its engine finished initialising"));return}c?.abort();let u=new AbortController;c=u,l=D(o),i.set(o.id,u),a.setKeystrokeSignal(u.signal);try{let d=K(a,o);g({kind:"result",id:o.id,value:d});}catch(d){E(o.id,d);}finally{i.delete(o.id),a.setKeystrokeSignal(null);}};return e.onMessage(o=>{let a=o;switch(a.kind){case "init":j(a);break;case "request":_(a);break;case "cancel":i.get(a.id)?.abort();break}}),()=>{p?.(),p=null,c?.abort(),c=null,l=new Map;for(let o of i.values())o.abort();i.clear(),t?.clear(),t=null,e.terminate();}}function X(e){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e))}function Y(){let e=null,r=null,n=true,t=(l,c)=>{let p=X(c);queueMicrotask(()=>{n&&l()?.(p);});};return {client:{postMessage:l=>t(()=>r,l),onMessage:l=>{e=l;},terminate:()=>{n=false;}},host:{postMessage:l=>t(()=>e,l),onMessage:l=>{r=l;},terminate:()=>{n=false;}}}}function Z(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{let n=t=>r(t.data);typeof e.addEventListener=="function"?e.addEventListener("message",n):e.onmessage=n,e.start?.();},terminate:()=>{e.terminate?.(),e.close?.();}}}function ee(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{e.on("message",n=>r(n));},terminate:()=>{e.terminate?.(),e.close?.();}}}exports.createLinkedTransports=Y;exports.createWorkerEngine=G;exports.eventTargetTransport=Z;exports.messagePortTransport=ee;exports.serializeParsedLine=y;exports.serializeParsingResult=R;exports.serializeValue=m;exports.startWorkerRuntime=Q;//# sourceMappingURL=worker.cjs.map
|
|
3
3
|
//# sourceMappingURL=worker.cjs.map
|
package/dist/worker.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {a as a$1,e,d,c as c$2,b}from'./chunk-YID47OPR.js';import {o}from'./chunk-
|
|
1
|
+
import {a as a$1,e,d,c as c$2,b}from'./chunk-YID47OPR.js';import {o}from'./chunk-VI7YREQQ.js';import'./chunk-RU3KGJRA.js';import'./chunk-2RWAXT6O.js';import'./chunk-RMDCGYZM.js';import'./chunk-MIQBJGGR.js';import'./chunk-UUCFL3D6.js';import'./chunk-JP4JMQOG.js';import {c,a}from'./chunk-TZ3Q6GOC.js';import'./chunk-XEIDV5JP.js';import {z}from'./chunk-GR2ZEYRG.js';import'./chunk-AWGSR2GZ.js';import {h}from'./chunk-TJKN466F.js';import'./chunk-U5MESNRT.js';import'./chunk-DB5ISONG.js';import'./chunk-76F3LCIL.js';import'./chunk-EOKHRS2T.js';import'./chunk-TCZSPH4A.js';import'./chunk-EVY2Y4FT.js';import'./chunk-X2GQAKL2.js';import'./chunk-PICFFFJV.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import {g,f}from'./chunk-5TCSFTZD.js';import {R as R$1}from'./chunk-IHPYXJIY.js';import'./chunk-EOO6M65F.js';import'./chunk-J4K72CQN.js';import'./chunk-A34R65WT.js';import'./chunk-BWTVJD5L.js';import {b as b$1}from'./chunk-DJRGEWPI.js';import'./chunk-6NL7RBAG.js';import'./chunk-JPFCXLJV.js';import'./chunk-APYRNAU2.js';import'./chunk-FAO6DQ74.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import {c as c$1,d as d$1}from'./chunk-6G2NES2I.js';function B(e){if(e?.date?.inputOrder!=="locale")return e;let r={...e.date,inputOrder:h({...b$1.date,...e.date}).order};return delete r.inputLocale,{...e,date:r}}var x=class{constructor(r){this.nextId=1;this.pending=new Map;this.resolvedListeners=new Set;this.asyncErrorListeners=new Set;this.terminated=false;this.transport=r,this.transport.onMessage(n=>this.onMessage(n));}init(r){let n=this.nextId++;return new Promise((t,s)=>{this.pending.set(n,{resolve:()=>t(),reject:s}),this.transport.postMessage({kind:"init",id:n,localeCode:r.localeCode,diagnostics:r.diagnostics,config:B(r.config),packages:r.packages,formatting:r.formatting});})}parseDocument(r,n){let{signal:t,...s}=n??{},i=Object.keys(s).length>0?s:void 0;return this.call("parseDocument",[r,i],t)}evaluateLines(r,n){return this.call("evaluateLines",[r],n?.signal)}evaluateExpression(r,n){return this.call("evaluateExpression",[r],n?.signal)}onResolved(r){return this.resolvedListeners.add(r),()=>this.resolvedListeners.delete(r)}onAsyncError(r){return this.asyncErrorListeners.add(r),()=>this.asyncErrorListeners.delete(r)}terminate(){if(this.terminated)return;this.terminated=true;let r=e();for(let n of this.pending.values())this.unhook(n),n.reject(r);this.pending.clear(),this.resolvedListeners.clear(),this.asyncErrorListeners.clear(),this.transport.terminate();}call(r,n,t){if(this.terminated)return Promise.reject(e());if(t?.aborted)return Promise.reject(d(r));let s=this.nextId++;return new Promise((i,l)=>{let c={resolve:i,reject:l};if(t){let p=()=>{this.pending.has(s)&&(this.pending.delete(s),this.transport.postMessage({kind:"cancel",id:s}),l(d(r)));};c.signal=t,c.onAbort=p,t.addEventListener("abort",p,{once:true});}this.pending.set(s,c),this.transport.postMessage({kind:"request",id:s,method:r,args:n});})}onMessage(r){let n=r;switch(n.kind){case "ready":case "result":{let t=n.kind==="result"?n.value:void 0;this.settle(n.id,s=>s.resolve(t));break}case "error":this.settle(n.id,t=>t.reject(c$2(n.error)));break;case "async-update":for(let t of [...this.resolvedListeners])t(n.lines);break;case "async-error":for(let t of [...this.asyncErrorListeners])t({queryKey:n.queryKey,packageId:n.packageId,error:c$2(n.error)});break}}settle(r,n){let t=this.pending.get(r);t&&(this.pending.delete(r),this.unhook(t),n(t));}unhook(r){r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort);}};async function G(e){let r=new x(e.transport);return await r.init(e),r}function F(e){return e>0?"Infinity":e<0?"-Infinity":"NaN"}function H(e){let r=e.data.map(n=>typeof n=="object"&&n!==null?R$1(n):typeof n=="number"&&!Number.isFinite(n)?F(n):n);return {rows:e.rows,cols:e.cols,cells:r,hasSymbolic:e.hasSymbolic}}function m(e,r){let n=e.toNumber(),t={type:e.type,text:c(e,r),number:Number.isFinite(n)?n:0};Number.isFinite(n)||(t.nonFinite=F(n)),e.unit!==void 0&&(t.unit=e.unit),e.timedOut!==void 0&&(t.timedOut=e.timedOut),e.grain!==void 0&&(t.grain=e.grain),e.zone!==void 0&&(t.zone=e.zone);let s=e.value;if(typeof s=="bigint")t.bigint=s.toString();else if(e.type===7)t.matrix=H(s);else if(e.type===8){let i=s;t.range={min:i.min,max:i.max};}else if(e.type===14){let i=s;t.colour={hex:f(i),r:i.r,g:i.g,b:i.b,a:i.a,format:i.format,css:g(i)};}else if(e.type===16){let i=s;t.chart={kind:i.kind,points:i.points.map(l=>[l[0],l[1]]),label:i.label,domain:[i.domain[0],i.domain[1]],range:[i.range[0],i.range[1]],...i.expr!==void 0?{expr:i.expr}:{}};}else if(e.type===17){let i=s;t.ipCidr={...i.addr!==void 0?{addr:i.addr}:{},...i.prefix!==void 0?{prefix:i.prefix}:{},text:c(e).replace(/^=\s*/,"")};}return t}function q(e,r){return e?m(e,r):null}function J(e,r){return {start:e.start,end:e.end,expression:e.expression,lineNumber:e.lineNumber,columnNumber:e.columnNumber,result:q(e.result,r),error:e.error??null}}function y(e,r){return {lineNumber:e.lineNumber,text:e.text,startPosition:e.startPosition,endPosition:e.endPosition,isEmpty:e.isEmpty,hasInlineSolves:e.hasInlineSolves,inlineSolves:e.inlineSolves.map(n=>J(n,r)),expression:e.expression,result:q(e.result,r),error:e.error}}function R(e,r){let n={lines:e.lines.map(t=>y(t,r)),totalLines:e.totalLines,errors:[...e.errors]};return e.diagnostics!==void 0&&(n.diagnostics=e.diagnostics),n}function $(e,r){if(r===void 0)return e;let n=new Map(e.map(s=>[s.name,s])),t=[];for(let s of r){let i=n.get(s);if(!i)throw c$1.config(a$1.WORKER_UNKNOWN_PACKAGE,`No package named "${s}" is available in this worker runtime`,{name:s,available:[...n.keys()]});t.push(i);}return t}function Q(e,r={}){let n=r.packages??z,t=null,s,i=new Map,l=new Map,c=null,p=null,g=o=>e.postMessage(o),E=(o,a)=>{g({kind:"error",id:o,error:b(d$1(a))});},D=o=>{let a=new Map;return o.method==="parseDocument"?o.args[0].split(`
|
|
2
2
|
`).forEach((u,d)=>a.set(d+1,u)):o.method==="evaluateLines"?o.args[0].forEach((u,d)=>a.set(d+1,u)):a.set(-1,o.args[0]),a},V=(o,a)=>{if(a.type==="error"){g({kind:"async-error",queryKey:a.queryKey,packageId:a.packageId,error:b(d$1(a.error))});return}let u=[];for(let d of a.lineNumbers){let f=l.get(d);if(f!==void 0)try{let T=o.evaluateLine(d,f);T&&u.push({lineNumber:d,value:m(T,s)});}catch{}}u.length>0&&g({kind:"async-update",lines:u});},U=o=>{p?.();let a=o.getEventStream().getReader();p=()=>{a.cancel();},(async()=>{try{for(;;){let{done:u,value:d}=await a.read();if(u)return;V(o,d);}}catch{}})();},j=o$1=>{try{let a$1=$(n,o$1.packages);t=new o({locale:o$1.localeCode??"en",diagnostics:o$1.diagnostics??!1,config:o$1.config,packages:a$1,calendar:r.calendar}),s=r.calendar?{...o$1.formatting??a,calendar:r.calendar}:o$1.formatting,U(t),g({kind:"ready",id:o$1.id});}catch(a){E(o$1.id,a);}},K=(o,a)=>{let{method:u,args:d}=a;switch(u){case "parseDocument":return R(o.parseDocument(d[0],d[1]),s);case "evaluateLines":return o.evaluateLines(d[0]).map(f=>y(f,s));case "evaluateExpression":return m(o.evaluateExpression(d[0]),s);default:throw c$1.execution(a$1.WORKER_UNKNOWN_METHOD,`The worker runtime has no method named "${String(u)}"`,{method:u})}},_=o=>{let a=t;if(!a){E(o.id,c$1.execution(a$1.WORKER_NOT_INITIALISED,"The worker received a request before its engine finished initialising"));return}c?.abort();let u=new AbortController;c=u,l=D(o),i.set(o.id,u),a.setKeystrokeSignal(u.signal);try{let d=K(a,o);g({kind:"result",id:o.id,value:d});}catch(d){E(o.id,d);}finally{i.delete(o.id),a.setKeystrokeSignal(null);}};return e.onMessage(o=>{let a=o;switch(a.kind){case "init":j(a);break;case "request":_(a);break;case "cancel":i.get(a.id)?.abort();break}}),()=>{p?.(),p=null,c?.abort(),c=null,l=new Map;for(let o of i.values())o.abort();i.clear(),t?.clear(),t=null,e.terminate();}}function X(e){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e))}function Y(){let e=null,r=null,n=true,t=(l,c)=>{let p=X(c);queueMicrotask(()=>{n&&l()?.(p);});};return {client:{postMessage:l=>t(()=>r,l),onMessage:l=>{e=l;},terminate:()=>{n=false;}},host:{postMessage:l=>t(()=>e,l),onMessage:l=>{r=l;},terminate:()=>{n=false;}}}}function Z(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{let n=t=>r(t.data);typeof e.addEventListener=="function"?e.addEventListener("message",n):e.onmessage=n,e.start?.();},terminate:()=>{e.terminate?.(),e.close?.();}}}function ee(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{e.on("message",n=>r(n));},terminate:()=>{e.terminate?.(),e.close?.();}}}export{Y as createLinkedTransports,G as createWorkerEngine,Z as eventTargetTransport,ee as messagePortTransport,y as serializeParsedLine,R as serializeParsingResult,m as serializeValue,Q as startWorkerRuntime};//# sourceMappingURL=worker.js.map
|
|
3
3
|
//# sourceMappingURL=worker.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solve-engine",
|
|
3
|
-
"version": "2.34.
|
|
3
|
+
"version": "2.34.4",
|
|
4
4
|
"description": "An embeddable expression engine for natural-language calculations: units, currencies, percentages, dates and matrices, with the parsing and evaluation plumbing already built.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expression-evaluator",
|
package/dist/chunk-EQ37UQGY.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {c as c$1}from'./chunk-JP4JMQOG.js';import {y,C,a as a$1,G,J,e as e$2,h as h$1,t as t$1,p,k as k$2,m as m$1,n as n$1,g as g$1,q as q$2,f as f$2,u as u$1,o as o$1,r as r$2,s as s$1,j as j$3,l,N as N$1,b as b$2,c as c$5}from'./chunk-ETQBU454.js';import {c as c$4}from'./chunk-PICFFFJV.js';import {b}from'./chunk-TZYMXNIB.js';import {ea,T,U,X,S,Y,q,aa,ma,j as j$2,$,_,ia,ra,ua}from'./chunk-IHPYXJIY.js';import {j as j$4}from'./chunk-J4K72CQN.js';import {g,j as j$1,n,a,P,c as c$2,Q as Q$1,I,e,C as C$1,F,M,x,y as y$1,w,u,t,v,r as r$1,N,G as G$1,k as k$1,K,f as f$1,R as R$1,L,s,q as q$1,p as p$1,o,d as d$1,A,b as b$1,B}from'./chunk-A34R65WT.js';import {c as c$3,e as e$1,k,h,f,a as a$2}from'./chunk-BWTVJD5L.js';import {a as a$3}from'./chunk-PRSXXDTA.js';import {c,d,r,s as s$2}from'./chunk-6G2NES2I.js';var $n=class{constructor(){this.consumers=new Map;this.dependencies=new Map;this.writes=new Map;this.lineReads=new Map;this.dataSourceDependencies=new Map;this.dataSourceConsumers=new Map;}registerLine(a,s,u){let c=this.lineReads.get(a);if(c)for(let b of c){let h=this.consumers.get(b);h&&h.delete(a);}this.lineReads.set(a,new Set(s));for(let b of s)this.consumers.has(b)||this.consumers.set(b,new Set),this.consumers.get(b).add(a);if(u.length>0){this.dependencies.set(a,new Set(s)),this.writes.set(a,new Set(u));for(let b of u){let h=this.consumers.get(b);h&&h.delete(a);}}}registerLineDataSourceDependency(a,s,u){let c=JSON.stringify(u),b=`${s}:${c}`;this.dataSourceDependencies.has(a)||this.dataSourceDependencies.set(a,new Set),this.dataSourceDependencies.get(a).add(b),this.dataSourceConsumers.has(b)||this.dataSourceConsumers.set(b,new Set),this.dataSourceConsumers.get(b).add(a);}getAffectedLines(a){let s=new Set,u=[a];for(;u.length>0;){let c=u.pop(),b=this.consumers.get(c);if(b)for(let h of b){if(s.has(h))continue;s.add(h);let f=this.writes.get(h);if(f)for(let y of f)u.push(y);}}return s}getAffectedLinesInOrder(a){let s=this.getAffectedLines(a);if(s.size===0)return [];let u=new Map,c=new Map;for(let y of s)u.has(y)||u.set(y,0),c.has(y)||c.set(y,[]);let b=new Map;for(let y of s){let E=this.writes.get(y);if(E)for(let S of E)b.set(S,y);}for(let y of s){let E=this.lineReads.get(y);if(E)for(let S of E){let T=b.get(S);T!==void 0&&T!==y&&(c.get(T).push(y),u.set(y,(u.get(y)??0)+1));}}let h=[];for(let[y,E]of u)E===0&&h.push(y);if(h.length===0&&s.size>0){let y=Array.from(s).sort((E,S)=>E-S);h.push(y[0]);}let f=[];for(let y=0;y<h.length;y++){let E=h[y];f.push(E);for(let S of c.get(E)??[]){let T=(u.get(S)??1)-1;u.set(S,T),T===0&&h.push(S);}}if(f.length<s.size){let y=new Set(f),E=Array.from(s).filter(S=>!y.has(S)).sort((S,T)=>S-T);f.push(...E);}return f}getAffectedLinesByDataSource(a,s){let u=JSON.stringify(s),c=`${a}:${u}`;return this.dataSourceConsumers.get(c)??new Set}removeLine(a){let s=this.lineReads.get(a);if(s){for(let c of s){let b=this.consumers.get(c);b&&b.delete(a);}this.lineReads.delete(a);}this.dependencies.delete(a),this.writes.delete(a);let u=this.dataSourceDependencies.get(a);if(u){for(let c of u)this.dataSourceConsumers.get(c)?.delete(a);this.dataSourceDependencies.delete(a);}}getConsumers(a){return this.consumers.get(a)??new Set}getDependencies(a){return this.dependencies.get(a)??new Set}getWrites(a){return this.writes.get(a)??new Set}getSnapshot(){let a={};for(let[h,f]of this.consumers)a[h]=Array.from(f);let s={};for(let[h,f]of this.writes)s[h]=Array.from(f);let u={};for(let[h,f]of this.lineReads)u[h]=Array.from(f);let c={};for(let[h,f]of this.dataSourceDependencies)c[h]=Array.from(f);let b={};for(let[h,f]of this.dataSourceConsumers)b[h]=Array.from(f);return {consumers:a,writes:s,reads:u,dataSourceDeps:c,dataSourceConsumers:b}}clear(){this.consumers.clear(),this.dependencies.clear(),this.writes.clear(),this.lineReads.clear(),this.dataSourceDependencies.clear(),this.dataSourceConsumers.clear();}};var Pn=class{constructor(){this.definitions=new Map;}write(a,s,u){this.definitions.has(a)||this.definitions.set(a,[]);let c=this.definitions.get(a);c.push({line:s,expr:u}),c.sort((b,h)=>b.line-h.line);}read(a,s){let u=this.definitions.get(a);if(u){for(let c=u.length-1;c>=0;c--)if(u[c].line<=s)return u[c].expr.lastResult}}invalidateDownstream(a,s){let u=this.definitions.get(a);if(!u)return;let c=u.findIndex(b=>b.line===s);c!==-1&&u.splice(c+1);}clear(){this.definitions.clear();}};var nn={kg:{dim:[1,0,0,0],si:1},g:{dim:[1,0,0,0],si:.001},tonne:{dim:[1,0,0,0],si:1e3},t:{dim:[1,0,0,0],si:1e3},m:{dim:[0,1,0,0],si:1},cm:{dim:[0,1,0,0],si:.01},mm:{dim:[0,1,0,0],si:.001},km:{dim:[0,1,0,0],si:1e3},s:{dim:[0,0,1,0],si:1},ms:{dim:[0,0,1,0],si:.001},min:{dim:[0,0,1,0],si:60},minute:{dim:[0,0,1,0],si:60},minutes:{dim:[0,0,1,0],si:60},h:{dim:[0,0,1,0],si:3600},hr:{dim:[0,0,1,0],si:3600},hour:{dim:[0,0,1,0],si:3600},hours:{dim:[0,0,1,0],si:3600},A:{dim:[0,0,0,1],si:1},mA:{dim:[0,0,0,1],si:.001},kA:{dim:[0,0,0,1],si:1e3},ampere:{dim:[0,0,0,1],si:1},amperes:{dim:[0,0,0,1],si:1},mps2:{dim:[0,1,-2,0],si:1},N:{dim:[1,1,-2,0],si:1},kN:{dim:[1,1,-2,0],si:1e3},newton:{dim:[1,1,-2,0],si:1},newtons:{dim:[1,1,-2,0],si:1},J:{dim:[1,2,-2,0],si:1},kJ:{dim:[1,2,-2,0],si:1e3},MJ:{dim:[1,2,-2,0],si:1e6},joule:{dim:[1,2,-2,0],si:1},joules:{dim:[1,2,-2,0],si:1},Wh:{dim:[1,2,-2,0],si:3600},kWh:{dim:[1,2,-2,0],si:36e5},W:{dim:[1,2,-3,0],si:1},kW:{dim:[1,2,-3,0],si:1e3},MW:{dim:[1,2,-3,0],si:1e6},watt:{dim:[1,2,-3,0],si:1},watts:{dim:[1,2,-3,0],si:1},Pa:{dim:[1,-1,-2,0],si:1},kPa:{dim:[1,-1,-2,0],si:1e3},MPa:{dim:[1,-1,-2,0],si:1e6},pascal:{dim:[1,-1,-2,0],si:1},pascals:{dim:[1,-1,-2,0],si:1},V:{dim:[1,2,-3,-1],si:1},mV:{dim:[1,2,-3,-1],si:.001},kV:{dim:[1,2,-3,-1],si:1e3},volt:{dim:[1,2,-3,-1],si:1},volts:{dim:[1,2,-3,-1],si:1}},st={"1,1,-2,0":"N","1,2,-2,0":"J","1,2,-3,0":"W","1,-1,-2,0":"Pa","1,2,-3,-1":"V"},ot=r=>r.join(",");function tn(r,a,s){if(r.type!==6||a.type!==6)return null;let u$1=r.unit?nn[r.unit]:void 0,c=a.unit?nn[a.unit]:void 0;if(u$1===void 0||c===void 0)return null;let b=[u$1.dim[0]+(s?c.dim[0]:-c.dim[0]),u$1.dim[1]+(s?c.dim[1]:-c.dim[1]),u$1.dim[2]+(s?c.dim[2]:-c.dim[2]),u$1.dim[3]+(s?c.dim[3]:-c.dim[3])],h=st[ot(b)];if(h===void 0)return null;let f=r.toNumber()*u$1.si,y=a.toNumber()*c.si,E=s?f*y:f/y;return u(E/nn[h].si,h)}function ut(r,a){let s=a.fields(r).weekday;return s===0||s===6}function Wn(r,a,s){return ut(r,s)?false:a?!a(r):true}function Yn(r,a){let s=a.fields(r);return a.localMidnight(s.year,s.month0,s.day)}function Gn(r,a,s,u,c){let b=Math.trunc(Math.abs(a)),h=a>=0?1:-1,f=r,y=0;for(;b>0;){if(f=c.addDays(f,h),y++,y>u)return null;Wn(f,s,c)&&b--;}return f}function Xn(r,a,s,u,c){let b=Yn(Math.min(r,a),c),h=Yn(Math.max(r,a),c),f=Math.round((h-b)/864e5);if(f>u)return null;let y=0,E=b;for(let S=0;S<=f;S++)Wn(E,s,c)&&y++,E=c.addDays(E,1);return y}var lt={0:{name:"sqrt",min:1,max:1},1:{name:"abs",min:1,max:1},2:{name:"sin",min:1,max:1},3:{name:"cos",min:1,max:1},4:{name:"tan",min:1,max:1},5:{name:"log",min:1,max:1},6:{name:"ceil",min:1,max:1},7:{name:"floor",min:1,max:1},8:{name:"round",min:1,max:2},9:{name:"min",min:1,max:1/0},10:{name:"max",min:1,max:1/0},11:{name:"asin",min:1,max:1},12:{name:"acos",min:1,max:1},13:{name:"atan",min:1,max:1},14:{name:"atan2",min:2,max:2},15:{name:"sinh",min:1,max:1},16:{name:"cosh",min:1,max:1},17:{name:"tanh",min:1,max:1},18:{name:"asinh",min:1,max:1},19:{name:"acosh",min:1,max:1},20:{name:"atanh",min:1,max:1},21:{name:"cbrt",min:1,max:1},22:{name:"clz32",min:1,max:1},23:{name:"expm1",min:1,max:1},24:{name:"exp",min:1,max:1},25:{name:"fround",min:1,max:1},26:{name:"hypot",min:1,max:1/0},27:{name:"imul",min:2,max:2},28:{name:"log10",min:1,max:1},29:{name:"log1p",min:1,max:1},30:{name:"log2",min:1,max:1},31:{name:"pow",min:2,max:2},32:{name:"random",min:0,max:0},33:{name:"sign",min:1,max:1},34:{name:"trunc",min:1,max:1},35:{name:"degtorad",min:1,max:1},36:{name:"radtodeg",min:1,max:1},37:{name:"roll",min:2,max:2},38:{name:"gcd",min:2,max:2},39:{name:"lcm",min:2,max:2},40:{name:"permutation",min:2,max:2},41:{name:"combination",min:2,max:2},42:{name:"average",min:0,max:1/0},43:{name:"median",min:0,max:1/0},44:{name:"total",min:0,max:1/0},45:{name:"count",min:0,max:1/0},46:{name:"proportion",min:3,max:3},47:{name:"clamp",min:3,max:3},48:{name:"hex",min:1,max:1},49:{name:"bin",min:1,max:1},50:{name:"int",min:1,max:1},51:{name:"compoundInterest",min:3,max:3},52:{name:"interestEarned",min:3,max:3},53:{name:"compoundInterestRate",min:3,max:3},54:{name:"compoundInterestYears",min:3,max:3},55:{name:"loanRepayment",min:4,max:4},56:{name:"loanInterest",min:4,max:4},57:{name:"monthlyPayment",min:3,max:3},58:{name:"taxAdd",min:2,max:2},59:{name:"taxRemove",min:2,max:2},60:{name:"inflationAdjust",min:3,max:3},61:{name:"root",min:2,max:2},62:{name:"fact",min:1,max:1},63:{name:"transpose",min:1,max:1},64:{name:"det",min:1,max:1},65:{name:"inv",min:1,max:1},66:{name:"dot",min:2,max:2},67:{name:"expand",min:1,max:1},68:{name:"factor",min:1,max:1},69:{name:"solve",min:3,max:3},70:{name:"der",min:2,max:3},71:{name:"integral",min:2,max:2},72:{name:"taylor",min:4,max:4},73:{name:"jacobian",min:1,max:1/0},74:{name:"imaginary",min:1,max:1},75:{name:"conj",min:1,max:1},76:{name:"re",min:1,max:1},77:{name:"im",min:1,max:1},78:{name:"cancel",min:1,max:1},79:{name:"apart",min:1,max:1},80:{name:"compoundInterestEvery",min:4,max:4},81:{name:"compoundInterestEarnedEvery",min:4,max:4},82:{name:"presentValue",min:3,max:3},83:{name:"roi",min:2,max:2},84:{name:"annualisedReturn",min:3,max:3},85:{name:"taxIn",min:2,max:2},86:{name:"taxOn",min:2,max:2},87:{name:"sind",min:1,max:1},88:{name:"cosd",min:1,max:1},89:{name:"tand",min:1,max:1},90:{name:"asind",min:1,max:1},91:{name:"acosd",min:1,max:1},92:{name:"atand",min:1,max:1},93:{name:"daysCount",min:1,max:1},94:{name:"asTwoUnits",min:3,max:3},95:{name:"makeRate",min:2,max:2},96:{name:"atRate",min:2,max:2},97:{name:"roundToPlaces",min:2,max:2},98:{name:"splitEach",min:2,max:2},99:{name:"savingsGoalPayment",min:3,max:3},100:{name:"savingsGoalPeriods",min:5,max:5},101:{name:"standardDeviation",min:0,max:1/0},102:{name:"sampleStandardDeviation",min:0,max:1/0},103:{name:"variance",min:0,max:1/0},104:{name:"sampleVariance",min:0,max:1/0},105:{name:"spread",min:0,max:1/0},106:{name:"mode",min:0,max:1/0},107:{name:"weightedAverage",min:2,max:1/0}};function Te(r){return r===1?"1 argument":`${r} arguments`}function ct(r){return r.max===1/0?`at least ${Te(r.min)}`:r.min===r.max?Te(r.min):`${r.min} to ${Te(r.max)}`}function Kn(r,a){let s=lt[r];if(s!==void 0&&!(a>=s.min&&a<=s.max))return c.execution("BUILTIN_ARITY_MISMATCH",`${s.name}() takes ${ct(s)}, but was given ${a===0?"none":Te(a)}`,{functionName:s.name,expectedMin:s.min,expectedMax:s.max,actual:a})}function da(r,a=200,s=5e4,u=50,c$1=1e5,b=2e6,h=1e4,f=100,y$1=-100,E=y,S){let T=[],x=new Map,Y=0,z,W,t=[],J=new Map,oe=new Map,H=new Map;return {push(_){if(T.length>=a)throw c.execution("STACK_LIMIT_EXCEEDED",`Execution exceeded maximum stack depth of ${a}`);T.push(_);},getMaxStackDepth(){return a},getMaxCollectionSize(){return c$1},getMaxAllocatedElements(){return b},getMaxFunctionCalls(){return h},getMaxDateOffsetYears(){return f},getMinDateOffsetYears(){return y$1},isHoliday(_){return S?S(_):false},pop(){return m(T)},popNumber(){return m(T).toNumber()},popString(){return j(m(T),"VM.popString()")},peek(){return T[T.length-1]},getStack(){return T},registry:r,getVar(_){if(t.length>0){let g=t[t.length-1].get(_);if(g!==void 0)return g}return x.get(_)},setVar(_,g){x.set(_,g);},deleteVar(_){x.delete(_);},pushCallFrame(_){if(t.length>=u)throw c.execution("FUNCTION_RECURSION_LIMIT_EXCEEDED",`Function call nesting exceeded maximum depth of ${u} (possible infinite recursion, e.g. f(x) = f(x))`,{maxFunctionRecursionDepth:u});t.push(_);},popCallFrame(){t.pop();},getCallFrame(){return t.length>0?t[t.length-1]:void 0},defineUserFunction(_,g,e){J.set(_,{name:_,params:g,program:e});},getUserFunction(_){return J.get(_)},hasUserFunction(_){return J.has(_)},getVariableEntries(){return Array.from(x.entries())},getUserFunctionDefs(){return Array.from(J.values())},defineEquation(_,g,e){oe.set(_,{variable:_,factorNames:g,rhsProgram:e});},getEquation(_){return oe.get(_)},hasEquation(_){return oe.has(_)},defineScalarEquation(_,g,e){H.set(_,{variable:_,lhsProgram:g,rhsProgram:e});},getScalarEquation(_){return H.get(_)},hasScalarEquation(_){return H.has(_)},reset(){T.length=0,x.clear(),t.length=0,J.clear(),oe.clear(),H.clear(),Y=0,W&&(W(),W=void 0),z=void 0;},get activeSignal(){return z},set activeSignal(_){z=_;},get abortCurrent(){return W},set abortCurrent(_){W=_;},context:E,getMaxInstructions(){return s},getInstructionCount(){return Y},incrementInstructions(_){if(Y+=_,Y>s)throw c.execution("INSTRUCTION_LIMIT_EXCEEDED",`Execution exceeded maximum of ${s} instructions`)}}}function mt(r,a){return r.rows===1&&r.cols===1?a.data.length:a.rows===1&&a.cols===1?r.data.length:r.cols!==a.rows?0:r.rows*a.cols}function dt(r,a){return !Number.isInteger(a)||a<0?0:r.rows*r.cols*(1+(a<2?1:2*Math.floor(Math.log2(a))))}function Hn(r,a,s){return r.context.networkEnabled?P("CURRENCY_RATE_UNAVAILABLE",`No exchange rate available for ${a} to ${s}`):P("NETWORK_DISABLED",`No exchange rate for ${a} to ${s}: live data is switched off for this engine (network.enabled is false)`)}function m(r){if(r.length===0)throw c.internal({code:"STACK_UNDERFLOW",message:"Stack underflow: an opcode expected a value on the stack but it was empty",expected:"at least one value on the VM stack",found:"an empty stack",suggestion:"this indicates corrupted bytecode or a bug in a package's parselet (mismatched push/pop counts), not a user-input error"});return r.pop()}var at="bytecode is caller input on this entry point: rebuild the program with the engine's compiler, or fix the hand-assembled stream";function ft(r){return typeof r=="number"?b(r):r}function se(r,a,s,u,c$1,b={}){let h=ft(a);return c.validation({code:r,message:`Malformed bytecode: ${h} ${s}`,expected:u,found:c$1,suggestion:at,context:typeof a=="number"?{opcode:a,opcodeName:h,...b}:{site:h,...b}})}function R(r,a,s,u){if(a>=r.length)throw se("MALFORMED_BYTECODE_TRUNCATED",s,`is missing its ${u}: the program ends mid-instruction`,`an operand byte at offset ${a}`,`a program only ${r.length} byte(s) long`,{offset:a,length:r.length,role:u});return r[a]}function an(r,a,s,u,c,b){let h=R(r,a,s,u);if(h>=c)throw se("MALFORMED_BYTECODE_CONSTANT_INDEX",s,`reads ${b} entry ${h}, which does not exist`,`an index below ${c}`,`${h}`,{index:h,poolSize:c,pool:b});return h}function Q(r,a,s,u,c){return Ae(s,R(r,a,u,c),u)}function Ae(r,a,s){let u=r[a];if(typeof u!="string")throw se("MALFORMED_BYTECODE_CONSTANT_INDEX",s,`reads string-pool entry ${a}, which is ${a>=r.length?"past the end of the pool":"not a string"}`,`an index below ${r.length}, holding a string`,a>=r.length?`${a}`:typeof u,{index:a,poolSize:r.length,pool:"string-pool"});return u}function j(r,a,s){if(typeof r.value!="string")throw se("MALFORMED_BYTECODE_OPERAND_TYPE",a,`expected a ${s??"string"} on the stack`,s?`a string value holding the ${s}`:"a string value",`a ${g[r.type]??"unknown"} value`,s?{role:s,valueType:r.type}:{valueType:r.type});return r.value}function qn(r,a,s){if(r!==0&&r!==1&&r!==2)throw se("MALFORMED_BYTECODE_BODY_KIND",s,`has body kind ${r}, which is not one this VM knows`,"0 (inline body), 1 (builtin function) or 2 (user-defined function)",`${r}`,{kind:r,ref:a})}function pt(r,a){try{return BigInt(r)}catch{throw se("MALFORMED_BYTECODE_BIGINT_LITERAL",a,`cannot read "${r}" as a whole number`,"a string holding an integer, with no decimal point or separators",`"${r}"`,{literal:r})}}function bt(r){if(r===null||typeof r!="object")return `expected a bytecode program, got ${r===null?"null":typeof r}`;let a=r;return typeof a.opcodes?.length!="number"?"the program has no `opcodes` array":typeof a.numbers?.length!="number"?"the program has no `numbers` pool":typeof a.strings?.length!="number"?"the program has no `strings` pool":null}var rn=64,ht=new Set(["BIGINT_DIVISION_BY_ZERO","BIGINT_INEXACT_OPERAND","SYMBOLIC_DIVISION_BY_ZERO","INVALID_DECIMAL_PLACES","INVALID_ROUNDING_INCREMENT"]);function sn(r,a,s,u,c$1,b,h,f){let y=new Map;for(let x=0;x<r.length;x++)y.set(r[x],s[x]);let E=u.getStack(),S=E.length;u.pushCallFrame(y);let T;try{T=ln(a,u,c$1,b,h,f);}finally{u.popCallFrame(),E.length>S&&(E.length=S);}if(T.type==="pending")throw c.execution("MAP_REDUCE_ASYNC_UNSUPPORTED","map/reduce transform bodies calling an async operation (weather, stocks, currency, ...) aren't supported");if(T.type==="error")throw T.error;return T.value}function gt(r,a,s,u,c$1,b,h){let f=new Map(s.getCallFrame());f.set(r,K(q(r)));let y=s.getStack(),E=y.length;s.pushCallFrame(f);let S;try{S=ln(a,s,u,c$1,b,h);}finally{s.popCallFrame(),y.length>E&&(y.length=E);}if(S.type==="pending")throw c.execution("SYMBOLIC_ASYNC_UNSUPPORTED","an algebra verb's expression cannot call an async operation (weather, stocks, currency, ...)");if(S.type==="error")throw S.error;return S.value}function jn(r,a){if(r.type!==6||a.type!==6)return null;let s=r.unit,u=a.unit;if(s===void 0||u===void 0)return null;let c=s.indexOf("/"),b=u.indexOf("/");if(c<0||b<0||s.slice(0,c)!==u.slice(0,b))return null;let h=a$3[s.slice(c+1).toLowerCase()],f=a$3[u.slice(b+1).toLowerCase()];return h===void 0||f===void 0||h[0]!==f[0]?null:r.toNumber()*(f[1]/h[1])}function yt(r,a){if(r.type!==6||a.type!==6)return null;let s=r.unit,u$1=a.unit;if(s===void 0||u$1===void 0||s.includes("/")||u$1.includes("/"))return null;let c=ua[s.toUpperCase()]!==void 0,b=ua[u$1.toUpperCase()]!==void 0;return c===b?null:u(r.toNumber()*a.toNumber(),c?s:u$1)}function zn(r,a,s){if(r.type===5)return a.type===6&&a.unit!==void 0?c$5(a,a.unit,r.toNumber(),s):a.type!==5&&a.type!==0?null:N(r.toNumber()+s*a.toNumber());if(a.type!==5)return null;let u=1+s*a.toNumber();if(r.type===0){let c=r.toNumber()*u;return r.uncertainty!==void 0?q$1(c,Math.abs(r.uncertainty*u)):n(c)}return r.type===6&&r.unit!==void 0?c$5(r,r.unit,a.toNumber(),s):null}function Nt(r,a){let s=r.type===5?r:a.type===5?a:null;if(s===null)return null;let u=s===r?a:r;if(u.type!==0||u.uncertainty===void 0)return null;let c=s.toNumber();return q$1(u.toNumber()*c,Math.abs(u.uncertainty*c))}function xt(r,a){let s=r.type===6?r:a,u=r.type===6?a:r;return s.type!==6||s.unit===void 0||!c$4.isCurrency(s.unit)||u.type!==0&&u.type!==5||u.rational!==void 0?null:b$2(s,u.toNumber(),s.unit)}function Et(r,a){if(a.type===5&&r.type===0&&r.uncertainty!==void 0){let s=a.toNumber();return s===0?null:q$1(r.toNumber()/s,Math.abs(r.uncertainty/s))}if(r.type===5&&a.type===0&&a.uncertainty!==void 0){let s=a.toNumber();return s===0?null:q$1(r.toNumber()/s,Math.abs(r.toNumber()*a.uncertainty/(s*s)))}return null}function It(r){if(r.type===6){let a=r.unit;if(a&&c$3(a)==="time")try{return e$1(r.toNumber(),a,"ms")}catch{}return 0}return r.toNumber()}var Jn=260;function rt(r,a,s){let u=Math.trunc(Math.abs(a)),b=(a>=0?1:-1)>0?s.getMaxDateOffsetYears():-s.getMinDateOffsetYears(),h=Math.floor(b*Jn);if(u>h)throw c.execution("DATE_OFFSET_LIMIT_EXCEEDED",`A date offset of ${u.toLocaleString("en-US")} workdays is about ${Math.round(u/Jn).toLocaleString("en-US")} years, past the limit of ${b} years for a workday offset`,{requestedWorkdays:u,limitYears:b,limitWorkdays:h});let f=h*7+7,y=Gn(r,a,E=>s.isHoliday(E),f,s.context.calendar);if(y===null)throw c.execution("DATE_OFFSET_LIMIT_EXCEEDED",`A working-day offset of ${u.toLocaleString("en-US")} could not be reached within the ${b}-year limit; the configured holiday calendar leaves too few working days`,{requestedWorkdays:u,limitYears:b,maxCalendarSteps:f});return y}var Zn=864e5,kt={month:1,months:1,mo:1,year:12,years:12,yr:12,y:12,a:12,decade:120,decades:120,dec:120,century:1200,centuries:1200,millennium:12e3,millennia:12e3};function it(r,a,s){let u=Math.trunc(a),c=s.addDays(r,u);return Number.isNaN(c)?r+a*Zn:c+(a-u)*Zn}function _t(r,a,s){let u=Math.trunc(a),c=s.addMonths(r,u),b=e$1(1,"month","ms");return Number.isNaN(c)?r+a*b:c+(a-u)*b}function Ne(r,a,s,u){if(a.type===6&&a.unit!==void 0){let c=a.unit,b=s*a.toNumber();if(a$2(c))return rt(r,b,u);let h=kt[c];if(h!==void 0)return _t(r,b*h,u.context.calendar);if(c$3(c)==="time"){let f=0;try{f=e$1(1,c,"day");}catch{}if(Number.isInteger(f)&&f>=1)return it(r,b*f,u.context.calendar)}}return r+s*It(a)}function Qn(r,a,s){let u$1=B(r.unit);if(a.type===6&&A(a.unit)){let c=B(a.unit);return c!==u$1?P("TIMECODE_FPS_MISMATCH",`Cannot combine timecodes at different frame rates (${u$1} fps vs ${c} fps)`):s===1?u(r.toNumber()+a.toNumber(),r.unit):u(r.toNumber()-a.toNumber(),"frames")}if(a.type===6&&a.unit==="frames")return u(r.toNumber()+s*a.toNumber(),r.unit);if(a.type===6&&a.unit&&c$3(a.unit)==="time"){let c=e$1(a.toNumber(),a.unit,"s");return u(r.toNumber()+s*c*u$1,r.unit)}return u(r.toNumber()+s*a.toNumber(),r.unit)}function xe(r){return r.type===10?r.value:r.toNumber()!==0}function Mt(r,a,s){let u=N$1(a);if(u===null)return c$3(a)!==void 0||c$4.isCurrency(a)?P(s$2.DATETIME_NOT_CONVERTIBLE,`A date cannot be read in "${a}". "in <name>" after a date names a time zone, as in "2026-04-03 in Tokyo"`):P(s$2.DATETIME_ZONE_UNKNOWN,`"${a}" is not a time zone this engine knows. Name a city ("in Tokyo"), a standard abbreviation ("in JST") or "in UTC"`);let c=r.toNumber();if(r.grain!=="date"&&r.grain!=="datetime")return M(c,"instant",u);let b=s.context.calendar,h=b.fields(c);if(r.grain==="date")return M(j$4(h.year,h.month0,h.day,0,0,u,b),"instant",u);let f=j$4(h.year,h.month0,h.day,h.hour,h.minute,u,b);return M(f+h.second*1e3+h.millisecond,"instant",u)}function et(r,a){let s=l(r,a);return P("INCOMPATIBLE_UNITS",s??`Cannot convert ${r} to ${a}: they do not measure the same thing`)}var Ce=65536;function Dt(r,a){if(!Number.isInteger(a)||a<0)return null;if(a===0)return 1;let s=Math.abs(r.toNumber());return s<=1?1:(s<=2?1:Math.log2(s))*a}function St(r,a){let s=1n,u=r,c=a;for(;c>0n;)c%2n===1n&&(s*=u),c/=2n,c>0n&&(u*=u);return s}var on=Ce;function nt(r){let a=r<0n?-r:r;if(a===0n)return 0;let s=Number(a);return Number.isFinite(s)?Math.floor(Math.log2(s))+1:a.toString(16).length*4}function tt(r,a,s$1){let u=n$1(r),c$1=n$1(a);if(u===0n)return s(0n);let b=s$1*Number(c$1);if(b<=0||nt(u)+b<=on)return s(s$1===1?u<<c$1:u>>c$1);throw c.execution("BIGINT_SHIFT_LIMIT_EXCEEDED",`Shifting by ${c$1} would build an exact integer of about ${(nt(u)+b).toLocaleString("en-US")} bits, past the limit of ${on.toLocaleString("en-US")} bits`,{shift:String(c$1),limitBits:on})}function un(r,a){let{numerator:s,denominator:u$1}=y$1(r.unit),c=c$3(u$1),b=c$3(a.unit);if(!c||c!==b)return P("RATE_MUL_MEASURE_MISMATCH",`Cannot multiply a "${u$1}"-denominated rate by "${a.unit}" \u2014 different measures`);let h=e$1(a.toNumber(),a.unit,u$1),f=r.toNumber()*h;return s?u(f,s):n(f)}function Tt(r){if(Number.isNaN(r))return "NaN";if(!isFinite(r))return r>0?"Infinity":"-Infinity";let a=r<0,s=Math.abs(r),u=Math.floor(s),c=s-u;if(c<1e-9)return `${a?"-":""}${u}`;let b=0,h=1,f=1,y=0,E=c,S=1e6;for(let x=0;x<30;x++){let Y=Math.floor(E+1e-9),z=Y*h+b,W=Y*y+f;if(W>S||(b=h,h=z,f=y,y=W,Math.abs(c-h/y)<1e-9))break;let t=E-Y;if(t<1e-9)break;E=1/t;}let T=u*y+h;return `${a?"-":""}${T}/${y}`}function At(r){return r.d===1n?String(r.n):`${r.n}/${r.d}`}function Ct(r){let a=r.toNumber(),s=r.type===5?1+a:a;return `${Math.round(s*1e6)/1e6}x`}function Ot(r){if(!Number.isFinite(r))return String(r);if(r===0)return "0e+0";let[a,s]=r.toExponential().split("e");return `${a.includes(".")?a.replace(/0+$/,"").replace(/\.$/,""):a}e${s}`}function ln(r$3,a$2,s$2,u$2,c$5,b$2){let h$2=bt(r$3);if(h$2)return {type:"error",error:c.validation({code:"MALFORMED_BYTECODE_PROGRAM",message:`Malformed bytecode: ${h$2}`,expected:"a BytecodeProgram with opcodes, numbers and strings",found:h$2,suggestion:at})};let{opcodes:f$3,numbers:y,strings:E,userFunctionBodies:S$1,anonymousBodies:T$1}=r$3,x$1=0,Y$1=0,z=a$2.getMaxInstructions(),W=a$2.getMaxStackDepth(),t$2=a$2.getStack(),J$1=t$2.length,oe=s$2?.hasCollectors??false,H=j$1();if(f$3.length===0)return {type:"value",value:n(0)};a(a$2);try{for(;x$1<f$3.length;){if(++Y$1>z)throw c.execution("INSTRUCTION_LIMIT_EXCEEDED",`Execution exceeded maximum of ${z} instructions`);if(t$2.length>W)throw c.execution("STACK_LIMIT_EXCEEDED",`Execution exceeded maximum stack depth of ${W}`);let g$2=f$3[x$1++];if(oe){let e=t$2.map(n=>({type:n.type,value:n.value,unit:n.unit}));s$2.fireVmStep({type:c$1.VmStep,elapsedNs:0,expression:u$2??"",opcode:g$2,opcodeName:b(g$2),ip:x$1-1,stackDepth:t$2.length,instructionNumber:Y$1,stack:e});}switch(g$2){case 0:break;case 1:{let e=m(t$2);return {type:"value",value:H?k$1(e):e}}case 3:{let e=m(t$2);t$2.push(e),t$2.push(e);break}case 2:{let e=m(t$2),n=m(t$2);t$2.push(e),t$2.push(n);break}case 10:t$2.push(n(y[an(f$3,x$1++,g$2,"constant-pool index",y.length,"number-pool")]));break;case 11:t$2.push(s(pt(Q(f$3,x$1++,E,g$2,"constant-pool index"),g$2)));break;case 16:{let e=ia(Q(f$3,x$1++,E,g$2,"constant-pool index"));t$2.push(o(ra(e),e));break}case 12:t$2.push(r$1(y[an(f$3,x$1++,g$2,"constant-pool index",y.length,"number-pool")]));break;case 13:t$2.push(t(Q(f$3,x$1++,E,g$2,"constant-pool index")));break;case 14:t$2.push(L(R(f$3,x$1++,g$2,"boolean operand")===1));break;case 20:{let e=m(t$2),n$1=m(t$2);if(n$1.type===0&&e.type===0&&n$1.rational===void 0&&e.rational===void 0&&n$1.uncertainty===void 0&&e.uncertainty===void 0){t$2.push(n(n$1.value+e.value));break}let o=Q$1(n$1,e);if(o){t$2.push(o);break}if(n$1.uncertainty!==void 0||e.uncertainty!==void 0){let d=s$1(n$1,e,"add");if(d){t$2.push(d);break}}if(n$1.rational!==void 0||e.rational!==void 0){let d=r$2(n$1,e,"add");if(d){t$2.push(d);break}}let i=zn(n$1,e,1),l=i===null?jn(n$1,e):null;i!==null?t$2.push(i):l!==null?t$2.push(u(l+e.toNumber(),e.unit)):n$1.type===0&&e.type===0?t$2.push(n(n$1.value+e.value)):n$1.type===10&&e.type===10?t$2.push(L(n$1.value&&e.value)):n$1.type===4?e.type===4?t$2.push(P("INVALID_DATETIME_OP","Cannot add two datetimes together")):t$2.push(M(Ne(n$1.toNumber(),e,1,a$2),n$1.grain,n$1.zone)):n$1.type===6&&A(n$1.unit)?t$2.push(Qn(n$1,e,1)):e.type===4?t$2.push(M(Ne(e.toNumber(),n$1,1,a$2),e.grain,e.zone)):n$1.type===3&&e.type===3?t$2.push(t(n$1.value+e.value)):t$2.push(u$1(n$1,e,(d,p)=>d+p,(d,p)=>d+p,"add"));break}case 21:{let e=m(t$2),n$1=m(t$2);if(n$1.type===0&&e.type===0&&n$1.rational===void 0&&e.rational===void 0&&n$1.uncertainty===void 0&&e.uncertainty===void 0){t$2.push(n(n$1.value-e.value));break}let o=Q$1(n$1,e);if(o){t$2.push(o);break}if(n$1.uncertainty!==void 0||e.uncertainty!==void 0){let d=s$1(n$1,e,"sub");if(d){t$2.push(d);break}}if(n$1.rational!==void 0||e.rational!==void 0){let d=r$2(n$1,e,"sub");if(d){t$2.push(d);break}}let i=zn(n$1,e,-1),l=i===null?jn(n$1,e):null;if(i!==null)t$2.push(i);else if(l!==null)t$2.push(u(l-e.toNumber(),e.unit));else if(n$1.type===0&&e.type===0)t$2.push(n(n$1.value-e.value));else if(n$1.type===4)if(e.type===4){let d=u(n$1.toNumber()-e.toNumber(),"ms");d.datetimeSpan=!0,t$2.push(d);}else t$2.push(M(Ne(n$1.toNumber(),e,-1,a$2),n$1.grain,n$1.zone));else n$1.type===6&&A(n$1.unit)?t$2.push(Qn(n$1,e,-1)):e.type===4?t$2.push(P("INVALID_DATETIME_OP","Cannot subtract a datetime from a value that is not a datetime")):t$2.push(u$1(n$1,e,(d,p)=>d-p,(d,p)=>d-p,"sub"));break}case 22:{let e=m(t$2),n$1=m(t$2);if(n$1.type===0&&e.type===0&&n$1.rational===void 0&&e.rational===void 0&&n$1.uncertainty===void 0&&e.uncertainty===void 0){t$2.push(n(n$1.value*e.value));break}let o=Nt(n$1,e);if(o){t$2.push(o);break}if(n$1.uncertainty!==void 0||e.uncertainty!==void 0){let l=s$1(n$1,e,"mul");if(l){t$2.push(l);break}}if(n$1.rational!==void 0||e.rational!==void 0){let l=r$2(n$1,e,"mul");if(l){t$2.push(l);break}}let i=xt(n$1,e);if(i){t$2.push(i);break}if(n$1.type===0&&e.type===0)t$2.push(n(n$1.value*e.value));else if(n$1.type===7&&e.type===7)d$1(mt(n$1.value,e.value),"matrix cells"),t$2.push(_(n$1.value,e.value));else if(n$1.type===6&&x(n$1.unit)&&e.type===6&&e.unit)t$2.push(un(n$1,e));else if(e.type===6&&x(e.unit)&&n$1.type===6&&n$1.unit)t$2.push(un(e,n$1));else {let l=yt(n$1,e);if(l!==null){t$2.push(l);break}let d=tn(n$1,e,!0);d?t$2.push(d):t$2.push(u$1(n$1,e,(p,M)=>p*M,(p,M)=>p*M,"mul"));}break}case 23:{let e=m(t$2),n$1=m(t$2);if(n$1.type===0&&e.type===0&&n$1.rational===void 0&&e.rational===void 0&&n$1.uncertainty===void 0&&e.uncertainty===void 0){let i=n$1.value,l=e.value;if(Number.isInteger(i)&&Number.isInteger(l)){let d=r$2(n$1,e,"div");if(d){t$2.push(d);break}}t$2.push(n(i/l));break}let o=Et(n$1,e);if(o){t$2.push(o);break}if(n$1.uncertainty!==void 0||e.uncertainty!==void 0){let i=s$1(n$1,e,"div");if(i){t$2.push(i);break}}if(n$1.type===6&&e.type===6){let{lv:i,rv:l,sameMeasure:d}=j$3(n$1,e);if(d)t$2.push(n(i/l));else if(c$4.isCurrency(n$1.unit)&&c$4.isCurrency(e.unit))t$2.push(P("INCOMPATIBLE_UNITS",`Cannot combine incompatible units: ${n$1.unit} and ${e.unit}`));else {let p=tn(n$1,e,!1);if(p){t$2.push(p);break}t$2.push(w(i/l,n$1.unit,e.unit));}}else {let i=r$2(n$1,e,"div");if(i){t$2.push(i);break}t$2.push(u$1(n$1,e,(l,d)=>l/d,(l,d)=>{if(d===0n)throw o$1();return l/d},"div"));}break}case 24:{let e=m(t$2),n=m(t$2);t$2.push(u$1(n,e,(o,i)=>o%i,(o,i)=>{if(i===0n)throw o$1();return o%i}));break}case 25:{let e=m(t$2),n$2=m(t$2);if(n$2.type===13){t$2.push(n$2);break}if(e.type===13){t$2.push(e);break}if(n$2.type===12){t$2.push(n$2);break}if(e.type===12){t$2.push(e);break}if(n$2.type===0&&e.type===0){t$2.push(n(q$2(n$2.value,e.value)));break}if(n$2.type===7||e.type===7){if(n$2.type!==7||e.type!==0){t$2.push(P("MATRIX_POWER_UNSUPPORTED",`^: a matrix may only be the base, raised to a whole number (as in "[1,2;3,4]^2"); "${g[n$2.type]} ^ ${g[e.type]}" has no matrix reading.`));break}d$1(dt(n$2.value,e.value),"matrix cells"),t$2.push($(n$2.value,e.value));break}if(n$2.type===9||e.type===9){t$2.push(f$2(n$2,e));break}if(n$2.type===2||e.type===2){let o=Dt(n$2,e.toNumber());if(o!==null){if(o>Ce)throw c.execution("BIGINT_POW_LIMIT_EXCEEDED",`That power would build an exact integer of about ${Math.round(o).toLocaleString("en-US")} bits, past the limit of ${Ce.toLocaleString("en-US")} bits`,{limitBits:Ce});t$2.push(s(St(n$1(n$2),n$1(e))));break}}t$2.push(n(q$2(n$2.toNumber(),e.toNumber())));break}case 26:{let e=m(t$2),n$1=Q$1(e);if(n$1){t$2.push(n$1);break}e.type===2?t$2.push(s(-e.value)):e.type===6&&e.exact!==void 0?t$2.push(v(-e.toNumber(),e.unit,ma(e.exact))):e.type===6?t$2.push(u(-e.toNumber(),e.unit)):e.type===5?t$2.push(N(-e.toNumber())):e.type===9?t$2.push(g$1(e)):e.type===0&&e.rational!==void 0?t$2.push(p$1(-e.toNumber(),j$2(e.rational))):e.type===0&&e.exact!==void 0?t$2.push(o(-e.toNumber(),ma(e.exact))):t$2.push(n(-e.toNumber()));break}case 27:{let e=m(t$2),n$1=Q$1(e);if(n$1){t$2.push(n$1);break}e.type===6&&e.exact!==void 0?t$2.push(v(e.toNumber(),e.unit,e.exact)):e.type===6?t$2.push(u(e.toNumber(),e.unit)):e.type===5?t$2.push(N(e.toNumber())):e.type===0&&e.rational!==void 0?t$2.push(p$1(e.toNumber(),e.rational)):e.type===0&&e.exact!==void 0?t$2.push(o(e.toNumber(),e.exact)):t$2.push(n(e.toNumber()));break}case 28:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}t$2.push(q$1(n.toNumber(),Math.abs(e.toNumber())));break}case 30:{let e=m(t$2),n$1=m(t$2),o=Q$1(n$1,e);if(o){t$2.push(o);break}n$1.type===2||e.type===2?t$2.push(tt(n$1,e,1)):t$2.push(n(n$1.toNumber()<<e.toNumber()));break}case 31:{let e=m(t$2),n$1=m(t$2),o=Q$1(n$1,e);if(o){t$2.push(o);break}n$1.type===2||e.type===2?t$2.push(tt(n$1,e,-1)):t$2.push(n(n$1.toNumber()>>e.toNumber()));break}case 32:{let e=m(t$2),n$1=m(t$2),o=Q$1(n$1,e);if(o){t$2.push(o);break}t$2.push(n(n$1.toNumber()>>>e.toNumber()));break}case 33:{let e=m(t$2),n$2=m(t$2),o=Q$1(n$2,e);if(o){t$2.push(o);break}n$2.type===2||e.type===2?t$2.push(s(n$1(n$2)&n$1(e))):t$2.push(n(n$2.toNumber()&e.toNumber()));break}case 34:{let e=m(t$2),n$2=m(t$2),o=Q$1(n$2,e);if(o){t$2.push(o);break}n$2.type===2||e.type===2?t$2.push(s(n$1(n$2)|n$1(e))):t$2.push(n(n$2.toNumber()|e.toNumber()));break}case 35:{let e=m(t$2),n$2=m(t$2),o=Q$1(n$2,e);if(o){t$2.push(o);break}n$2.type===2||e.type===2?t$2.push(s(n$1(n$2)^n$1(e))):t$2.push(n(n$2.toNumber()^e.toNumber()));break}case 36:{let e=m(t$2),n$1=Q$1(e);if(n$1){t$2.push(n$1);break}e.type===2?t$2.push(s(~e.value)):t$2.push(n(~e.toNumber()));break}case 40:{let e=m(t$2),n=m(t$2);if(n.type===0&&e.type===0&&n.rational===void 0&&e.rational===void 0){t$2.push(L(n.value===e.value));break}let o=Q$1(n,e);if(o){t$2.push(o);break}if(n.rational!==void 0||e.rational!==void 0){let i=t$1(n,e);if(i!==null){t$2.push(L(i===0));break}}if(n.type===0&&e.type===0)t$2.push(L(n.value===e.value));else if(n.type===2||e.type===2){let i=p(n,e);t$2.push(L(i===null?n.toNumber()===e.toNumber():i===0));}else if(n.type===3&&e.type===3)t$2.push(L(n.value===e.value));else if(n.type===6&&e.type===6){let{equal:i,sameMeasure:l}=k$2(n,e);t$2.push(L(l&&i));}else if(n.type===7&&e.type===7)t$2.push(aa(n.value,e.value,(i,l)=>i===l));else if(n.type===14||e.type===14)if(n.type===14&&e.type===14){let i=n.value,l=e.value;t$2.push(L(i.r===l.r&&i.g===l.g&&i.b===l.b&&i.a===l.a));}else t$2.push(L(!1));else t$2.push(L(n.toNumber()===e.toNumber()));break}case 41:{let e=m(t$2),n=m(t$2);if(n.type===0&&e.type===0&&n.rational===void 0&&e.rational===void 0){t$2.push(L(n.value!==e.value));break}let o=Q$1(n,e);if(o){t$2.push(o);break}if(n.rational!==void 0||e.rational!==void 0){let i=t$1(n,e);if(i!==null){t$2.push(L(i!==0));break}}if(n.type===0&&e.type===0)t$2.push(L(n.value!==e.value));else if(n.type===2||e.type===2){let i=p(n,e);t$2.push(L(i===null?n.toNumber()!==e.toNumber():i!==0));}else if(n.type===3&&e.type===3)t$2.push(L(n.value!==e.value));else if(n.type===6&&e.type===6){let{equal:i,sameMeasure:l}=k$2(n,e);t$2.push(L(!l||!i));}else if(n.type===7&&e.type===7)t$2.push(aa(n.value,e.value,(i,l)=>i!==l));else if(n.type===14||e.type===14)if(n.type===14&&e.type===14){let i=n.value,l=e.value;t$2.push(L(!(i.r===l.r&&i.g===l.g&&i.b===l.b&&i.a===l.a)));}else t$2.push(L(!0));else t$2.push(L(n.toNumber()!==e.toNumber()));break}case 42:{let e=m(t$2),n=m(t$2);if(n.type===0&&e.type===0&&n.rational===void 0&&e.rational===void 0){t$2.push(L(n.value<e.value));break}let o=Q$1(n,e);if(o){t$2.push(o);break}if(n.rational!==void 0||e.rational!==void 0){let i=t$1(n,e);if(i!==null){t$2.push(L(i<0));break}}if(n.type===0&&e.type===0)t$2.push(L(n.value<e.value));else if(n.type===2||e.type===2){let i=p(n,e);t$2.push(L(i===null?n.toNumber()<e.toNumber():i<0));}else if(n.type===6&&e.type===6){let{lv:i,rv:l,equal:d,sameMeasure:p}=k$2(n,e);t$2.push(p?L(!d&&i<l):m$1(n,e));}else n.type===7&&e.type===7?t$2.push(aa(n.value,e.value,(i,l)=>i<l)):t$2.push(L(n.toNumber()<e.toNumber()));break}case 43:{let e=m(t$2),n=m(t$2);if(n.type===0&&e.type===0&&n.rational===void 0&&e.rational===void 0){t$2.push(L(n.value<=e.value));break}let o=Q$1(n,e);if(o){t$2.push(o);break}if(n.rational!==void 0||e.rational!==void 0){let i=t$1(n,e);if(i!==null){t$2.push(L(i<=0));break}}if(n.type===0&&e.type===0)t$2.push(L(n.value<=e.value));else if(n.type===2||e.type===2){let i=p(n,e);t$2.push(L(i===null?n.toNumber()<=e.toNumber():i<=0));}else if(n.type===6&&e.type===6){let{lv:i,rv:l,equal:d,sameMeasure:p}=k$2(n,e);t$2.push(p?L(d||i<=l):m$1(n,e));}else n.type===7&&e.type===7?t$2.push(aa(n.value,e.value,(i,l)=>i<=l)):t$2.push(L(n.toNumber()<=e.toNumber()));break}case 44:{let e=m(t$2),n=m(t$2);if(n.type===0&&e.type===0&&n.rational===void 0&&e.rational===void 0){t$2.push(L(n.value>e.value));break}let o=Q$1(n,e);if(o){t$2.push(o);break}if(n.rational!==void 0||e.rational!==void 0){let i=t$1(n,e);if(i!==null){t$2.push(L(i>0));break}}if(n.type===0&&e.type===0)t$2.push(L(n.value>e.value));else if(n.type===2||e.type===2){let i=p(n,e);t$2.push(L(i===null?n.toNumber()>e.toNumber():i>0));}else if(n.type===6&&e.type===6){let{lv:i,rv:l,equal:d,sameMeasure:p}=k$2(n,e);t$2.push(p?L(!d&&i>l):m$1(n,e));}else n.type===7&&e.type===7?t$2.push(aa(n.value,e.value,(i,l)=>i>l)):t$2.push(L(n.toNumber()>e.toNumber()));break}case 45:{let e=m(t$2),n=m(t$2);if(n.type===0&&e.type===0&&n.rational===void 0&&e.rational===void 0){t$2.push(L(n.value>=e.value));break}let o=Q$1(n,e);if(o){t$2.push(o);break}if(n.rational!==void 0||e.rational!==void 0){let i=t$1(n,e);if(i!==null){t$2.push(L(i>=0));break}}if(n.type===0&&e.type===0)t$2.push(L(n.value>=e.value));else if(n.type===2||e.type===2){let i=p(n,e);t$2.push(L(i===null?n.toNumber()>=e.toNumber():i>=0));}else if(n.type===6&&e.type===6){let{lv:i,rv:l,equal:d,sameMeasure:p}=k$2(n,e);t$2.push(p?L(d||i>=l):m$1(n,e));}else n.type===7&&e.type===7?t$2.push(aa(n.value,e.value,(i,l)=>i>=l)):t$2.push(L(n.toNumber()>=e.toNumber()));break}case 130:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}t$2.push(L(xe(n)&&xe(e)));break}case 131:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}t$2.push(L(xe(n)||xe(e)));break}case 132:{let e=m(t$2),n=m(t$2),o=m(t$2),i=Q$1(o);if(i){t$2.push(i);break}t$2.push(xe(o)?n:e);break}case 50:case 161:{let e;if(g$2===161){let d=R(f$3,x$1++,g$2,"plugin-function index (low byte)"),p=R(f$3,x$1++,g$2,"plugin-function index (high byte)");e=d|p<<8;}else e=R(f$3,x$1++,g$2,"plugin-function index");let n=R(f$3,x$1++,g$2,"argument count"),o=[];for(let d=0;d<n;d++)o.push(m(t$2));o.reverse();let i=a$2.context.pluginFunctions[e],l=R$1(o);if(l)t$2.push(l);else if(!i)t$2.push(P("UNKNOWN_PLUGIN_FUNCTION",`Plugin function index ${e} is not registered with this engine`));else {let d=i(o,c$5);if(d instanceof Promise){if(!a$2.context.networkEnabled){d.catch(()=>{}),t$2.push(P("NETWORK_DISABLED","Live data is switched off for this engine (network.enabled is false), so the result of this call was not awaited"));break}let p=`plugin:${e}:${o.map(V=>`${V.type}:${String(V.value??"")}${V.unit?`:${V.unit}`:""}`).join("|")}`,M=a$2.activeSignal,C=a$2.context.pluginFunctionOwners[e]??"";return {type:"pending",queryKey:p,resolver:d,packageId:C,signal:M}}t$2.push(d);}break}case 51:{let e=R(f$3,x$1++,g$2,"builtin-function index"),n=R(f$3,x$1++,g$2,"argument count"),o=Kn(e,n);if(o)throw o;let i=[],l=!1;for(let M=0;M<n;M++){let C=m(t$2);C.type===9&&(l=!0),i.push(C);}let d=R$1(i);if(d){t$2.push(d);break}let p=C[e];if(p){let M=i.reverse(),C=l&&!e$2.has(e);t$2.push(C?h$1(e,M):p(M));}else t$2.push(P("UNKNOWN_BUILTIN_FUNCTION",`Builtin function index ${e} is not registered`));break}case 150:{let e=R(f$3,x$1++,g$2,"function-body index"),n=S$1?.[e];if(!n)throw c.internal("INTERNAL_MISSING_FUNCTION_BODY",`Internal error: DEFINE_USER_FUNCTION referenced missing body index ${e}`,{bodyIdx:e});a$2.defineUserFunction(n.name,n.params,n.program);break}case 151:{let e=Q(f$3,x$1++,E,g$2,"function-name index"),n=R(f$3,x$1++,g$2,"argument count"),o=[];for(let p=0;p<n;p++)o.push(m(t$2));o.reverse();let i=a$2.getUserFunction(e);if(!i)throw c.execution("UNDEFINED_FUNCTION",`Undefined function: ${e}`,{name:e});if(n!==i.params.length)throw c.execution("FUNCTION_ARITY_MISMATCH",`${e} expects ${i.params.length} argument(s) but got ${n}`,{name:e,expected:i.params.length,actual:n});let l=new Map;for(let p=0;p<i.params.length;p++)l.set(i.params[p],o[p]);f$1(),a$2.pushCallFrame(l);let d;try{d=ln(i.program,a$2,s$2,u$2,c$5);}finally{a$2.popCallFrame();}if(d.type==="pending")throw c.execution("USER_FUNCTION_ASYNC_UNSUPPORTED",`${e}: user-defined functions with async bodies (weather, stocks, currency, ...) aren't supported`,{name:e});if(d.type==="error")throw d.error;t$2.push(d.value);break}case 60:{let e=Q(f$3,x$1++,E,g$2,"variable-name index"),n=a$2.getVar(e);if(n!==void 0)t$2.push(n);else if(b$2)t$2.push(K(q(e)));else throw c.execution("UNDEFINED_VARIABLE",`Undefined variable: ${e}`,{varName:e});break}case 61:{let e=m(t$2),n=Q(f$3,x$1++,E,g$2,"variable-name index");a$2.setVar(n,H?k$1(e):e),t$2.push(e);break}case 62:{let e=Q(f$3,x$1++,E,g$2,"variable-name index"),n=J.get(e);if(n===void 0)throw c.internal({code:"GLOBAL_VARIABLE_NOT_RESOLVED",message:`Global variable "${e}" was read before it resolved`,expected:`global variable "${e}" to already be resolved (async preflight should guarantee this)`,found:"no value in the global variable store",context:{varName:e}});t$2.push(n);break}case 63:{let e=m(t$2),n=Q(f$3,x$1++,E,g$2,"variable-name index");J.set(n,H?k$1(e):e),t$2.push(e);break}case 70:{let e=m(t$2),n$1=Q$1(e);if(n$1){t$2.push(n$1);break}t$2.push(n(e.toNumber()));break}case 71:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}if(e.type===14){let o=e.value;t$2.push(G$1({r:o.r,g:o.g,b:o.b,a:o.a,format:"hex"}));break}t$2.push(r$1(e.type===2?e.value:e.toNumber()));break}case 74:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}t$2.push(N(e.toNumber()));break}case 140:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}t$2.push(t(e.rational!==void 0?At(e.rational):Tt(e.toNumber())));break}case 141:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}t$2.push(t(Ct(e)));break}case 142:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}t$2.push(t(Ot(e.toNumber())));break}case 143:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}t$2.push(r$1(e.type===2?e.value:e.toNumber(),"bin"));break}case 144:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}t$2.push(r$1(e.type===2?e.value:e.toNumber(),"oct"));break}case 145:{let e=j(m(t$2),g$2,"converter name").toLowerCase(),n=m(t$2),o=Q$1(n);if(o){t$2.push(o);break}let i=G.get(e);i?t$2.push(i(n,c$5)):t$2.push(P("UNKNOWN_AS_CONVERTER",`Unknown converter "as ${e}"`));break}case 80:{let e=j(m(t$2),g$2,"unit name"),n=m(t$2),o=Q$1(n);if(o){t$2.push(o);break}let i=a$1(n,e);i?t$2.push(v(n.toNumber(),e,i)):t$2.push(u(n.toNumber(),e));break}case 81:{let e=j(m(t$2),g$2,"target unit name"),n=j(m(t$2),g$2,"source unit name"),o=m(t$2),i=Q$1(o);if(i){t$2.push(i);break}let l=o.toNumber(),d=c$3(n);if(d&&c$3(e)===d)t$2.push(u(e$1(l,n,e),e));else if(c$4.isCurrency(n)&&c$4.isCurrency(e)){let p=c$4.convertSync(l,n,e);p!==null?t$2.push(u(p,e)):t$2.push(Hn(a$2,n,e));}else {let p=k(l,n,e);p!==null?t$2.push(u(p,e)):t$2.push(et(n,e));}break}case 85:{let e=j(m(t$2),g$2,"unit name"),n=f(e);t$2.push(t(n.length>0?n.join(", "):`No known units for "${e}"`));break}case 83:{let e=j(m(t$2),g$2,"unit name"),n=m(t$2),o=Q$1(n);if(o){t$2.push(o);break}let{value:i,unit:l}=h(n.toNumber(),e);t$2.push(u(i,l));break}case 84:{let e=j(m(t$2),g$2,"target unit name"),n=m(t$2),o=Q$1(n);if(o){t$2.push(o);break}if(n.type===6){let i=n.unit,l=n.toNumber(),d=c$3(i);if(d&&c$3(e)===d)t$2.push(u(e$1(l,i,e),e));else if(c$4.isCurrency(i)&&c$4.isCurrency(e)){let p=c$4.convertSync(l,i,e);p!==null?t$2.push(u(p,e)):t$2.push(Hn(a$2,i,e));}else {let p=k(l,i,e);p!==null?t$2.push(u(p,e)):t$2.push(et(i,e));}}else n.type===4?t$2.push(Mt(n,e,a$2)):t$2.push(u(n.toNumber(),e));break}case 82:{let e=m(t$2),n$1=Q$1(e);if(n$1){t$2.push(n$1);break}t$2.push(n(e.toNumber()));break}case 110:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}if(e.type!==6||!e.unit){t$2.push(P("RATE_MISSING_DENOMINATOR_UNIT",'Cannot build a rate: the right-hand side of "/" has no unit'));break}let i=n.type===6?n.unit??"":"";t$2.push(w(n.toNumber()/e.toNumber(),i,e.unit));break}case 111:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}if(n.type!==6||!x(n.unit)){t$2.push(P("RATE_MUL_LEFT_NOT_A_RATE",'Left-hand side of a rate multiplication must be a rate (e.g. "$50/week")'));break}if(e.type!==6||!e.unit){t$2.push(P("RATE_MUL_RIGHT_MISSING_UNIT","Right-hand side of a rate multiplication must have a unit matching the rate's denominator"));break}t$2.push(un(n,e));break}case 112:{let e=j(m(t$2),g$2,"denominator unit name"),n=m(t$2),o=Q$1(n);if(o){t$2.push(o);break}if(n.type!==6||!x(n.unit)){t$2.push(P("RATE_CONVERT_NOT_A_RATE","Cannot convert a non-rate value's denominator"));break}let{numerator:i,denominator:l}=y$1(n.unit),d=c$3(l),p=c$3(e);if(!d||d!==p){t$2.push(P("RATE_CONVERT_MEASURE_MISMATCH",`Cannot convert a "${l}"-denominated rate to "${e}" \u2014 different measures`));break}let M=e$1(1,e,l);t$2.push(w(n.toNumber()*M,i,e));break}case 120:{let e=m(t$2),n=Q$1(e);if(n){t$2.push(n);break}let o=e.toNumber(),i=a$2.context.calendar,l=i.fields(i.now());t$2.push(M(i.localWallClock(l.year,l.month0,l.day,o),"datetime"));break}case 90:t$2.push(M(a$2.context.calendar.now(),"instant"));break;case 95:t$2.push(M(y[an(f$3,x$1++,g$2,"constant-pool index",y.length,"number-pool")],"date"));break;case 91:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}t$2.push(M(Ne(n.toNumber(),e,1,a$2),n.grain,n.zone));break}case 92:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}t$2.push(M(Ne(n.toNumber(),e,-1,a$2),n.grain,n.zone));break}case 96:{let e=R(f$3,x$1++,g$2,"workday offset direction")===1?-1:1,n=m(t$2),o=m(t$2),i=Q$1(o,n);if(i){t$2.push(i);break}if(n.type!==4){t$2.push(P(r.WORKDAY_OFFSET_EXPECTED_DATE,`"working days after/before/from" expects a date to count from, got ${g[n.type]??"an unsupported value"}`));break}t$2.push(M(rt(n.toNumber(),e*o.toNumber(),a$2)));break}case 97:{let e=m(t$2),n$1=m(t$2),o=Q$1(n$1,e);if(o){t$2.push(o);break}if(n$1.type!==4||e.type!==4){t$2.push(P(r.WORKDAYS_BETWEEN_EXPECTED_DATES,`"working days between" expects two dates, got ${g[n$1.type]??"an unsupported value"} and ${g[e.type]??"an unsupported value"}`));break}let i=Math.ceil((a$2.getMaxDateOffsetYears()-a$2.getMinDateOffsetYears())*366),l=Xn(n$1.toNumber(),e.toNumber(),d=>a$2.isHoliday(d),i,a$2.context.calendar);if(l===null){t$2.push(P(r.WORKDAYS_BETWEEN_RANGE_TOO_LARGE,`The two dates are more than ${a$2.getMaxDateOffsetYears()-a$2.getMinDateOffsetYears()} years apart, past the working-day count's limit`));break}t$2.push(n(l));break}case 93:case 94:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}let i=e.toNumber(),l=n.toNumber(),d=a$2.context.calendar.fields(l).weekday,p=g$2===93?(i-d+7)%7:(d-i+7)%7;p===0&&(p=7),t$2.push(M(it(l,g$2===93?p:-p,a$2.context.calendar)));break}case 152:{let e$1=R(f$3,x$1++,g$2,"row count"),n=R(f$3,x$1++,g$2,"column count"),o=e$1*n,i=e(o,"matrix cells"),l=null;for(let d=o-1;d>=0;d--){let p=m(t$2);l===null&&(l=Q$1(p)),i[d]=p.type===10||p.type===9?p.value:p.toNumber();}if(l){t$2.push(l);break}t$2.push(C$1(e$1,n,Y(e$1,n,i)));break}case 153:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}if(n.type!==7){t$2.push(P("MATRIX_INDEX_NOT_A_MATRIX",'Cannot index a non-matrix value with "[...]".'));break}let i=n.value,l=Math.trunc(e.toNumber());if(l<0||l>=i.data.length){t$2.push(P("MATRIX_INDEX_OUT_OF_BOUNDS",`Index ${l} is out of bounds for a ${i.rows}x${i.cols} matrix (valid range: 0-${i.data.length-1}).`));break}let d=S(i,l);t$2.push(X(d));break}case 154:{let e=m(t$2),n=m(t$2),o=m(t$2),i=Q$1(o,n,e);if(i){t$2.push(i);break}if(o.type!==7){t$2.push(P("MATRIX_INDEX_NOT_A_MATRIX",'Cannot index a non-matrix value with "[...]".'));break}let l=o.value,d=Math.trunc(n.toNumber()),p=Math.trunc(e.toNumber());if(!U(l,d,p)){t$2.push(P("MATRIX_INDEX_OUT_OF_BOUNDS",`[${d}, ${p}] is out of bounds for a ${l.rows}x${l.cols} matrix.`));break}let M=T(l,d,p);t$2.push(X(M));break}case 156:{let e=m(t$2),n=m(t$2),o=Q$1(n,e);if(o){t$2.push(o);break}if(n.type!==0||e.type!==0){t$2.push(P("INVALID_RANGE_BOUND",`A range's bounds must be plain numbers (e.g. "0:3").`));break}let i=n.value,l=e.value;if(!Number.isInteger(i)||!Number.isInteger(l)){t$2.push(P("NON_INTEGER_RANGE_BOUND",`A range's bounds must be whole numbers, got "${i}:${l}".`));break}if(i>l){t$2.push(P("DESCENDING_RANGE",`A range's min (${i}) cannot be greater than its max (${l}) \u2014 did you mean "${l}:${i}"?`));break}t$2.push(F(i,l));break}case 155:{let e$1=m(t$2),n=m(t$2),o=m(t$2),i=Q$1(o,n,e$1);if(i){t$2.push(i);break}if(o.type!==7){t$2.push(P("MATRIX_INDEX_NOT_A_MATRIX",'Cannot slice a non-matrix value with "[...]".'));break}if(n.type!==8||e$1.type!==8){t$2.push(P("INVALID_MATRIX_SLICE_BOUND",'Matrix slicing needs range bounds (e.g. "a[0:1, 1:2]").'));break}let l=o.value,d=n.value,p=e$1.value;if(d.min<0||d.max>=l.rows||p.min<0||p.max>=l.cols){t$2.push(P("MATRIX_INDEX_OUT_OF_BOUNDS",`Slice [${d.min}:${d.max}, ${p.min}:${p.max}] is out of bounds for a ${l.rows}x${l.cols} matrix.`));break}let M=d.max-d.min+1,C=p.max-p.min+1,V=e(M*C,"matrix cells");for(let L=0;L<M;L++)for(let v=0;v<C;v++)V[L+v*M]=T(l,d.min+L,p.min+v);t$2.push(C$1(M,C,V));break}case 157:{let e$1=R(f$3,x$1++,g$2,"body kind"),n=R(f$3,x$1++,g$2,"body reference"),o=R(f$3,x$1++,g$2,"collection count");qn(e$1,n,g$2);let i=new Array(o);for(let D=o-1;D>=0;D--)i[D]=m(t$2);let l=[],d;if(e$1===0){let D=T$1?.[n];if(!D)throw c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: MAP_INVOKE referenced missing anonymous body index ${n}`,{ref:n});l=D.params,d=D.program;}else if(e$1===2){let D=Ae(E,n,g$2),U=a$2.getUserFunction(D);if(!U){t$2.push(P("UNDEFINED_FUNCTION",`map: undefined function "${D}"`));break}if(U.params.length!==o){t$2.push(P("FUNCTION_ARITY_MISMATCH",`map: "${D}" expects ${U.params.length} argument(s) but ${o} collection(s) were given`));break}l=U.params,d=U.program;}let p=-1,M=new Array(o),C$2;for(let D=0;D<o;D++){let U=ea(i[D],a$2.getMaxCollectionSize());if(!Array.isArray(U)){C$2=U;break}if(c$2(U.length,"collection elements"),p===-1)p=U.length;else if(U.length!==p){C$2=P("MAP_COLLECTION_LENGTH_MISMATCH",`map: all collections must have the same length (got ${p} and ${U.length}).`);break}M[D]=U;}if(C$2){t$2.push(C$2);break}let V=e(p,"matrix cells"),L;for(let D=0;D<p;D++){let U=new Array(o);for(let ee=0;ee<o;ee++)U[ee]=M[ee][D];let P$1=e$1===1?C[n]?.(U)??P("UNKNOWN_BUILTIN_FUNCTION",`map: unknown builtin function index ${n}`):sn(l,d,U,a$2,s$2,u$2,c$5,!!b$2),me=Q$1(P$1);if(me){L=me;break}V[D]=P$1.type===10||P$1.type===9?P$1.value:P$1.toNumber();}if(L){t$2.push(L);break}let v=i[0],B=v?.type===7?v.value:void 0;B&&B.rows*B.cols===p?t$2.push(C$1(B.rows,B.cols,V)):t$2.push(C$1(1,p,V));break}case 160:{let e=R(f$3,x$1++,g$2,"plot body reference"),n$1=R(f$3,x$1++,g$2,"plot expression"),o=Ae(E,n$1,g$2),i=m(t$2).toNumber(),l=m(t$2).toNumber(),d$1=T$1?.[e];if(!d$1)throw c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: PLOT_INVOKE referenced missing anonymous body index ${e}`,{ref:e});if(!Number.isFinite(l)||!Number.isFinite(i)){t$2.push(P("PLOT_INVALID_RANGE",`plot: the range bounds must be finite numbers (got ${l} to ${i})`));break}let p=[],M=0,C;for(let D=0;D<rn;D++){let U=l+D/(rn-1)*(i-l),P$1;try{P$1=sn(d$1.params,d$1.program,[n(U)],a$2,s$2,u$2,c$5,!!b$2);}catch(ee){let Oe=d(ee);if(!ht.has(Oe.code))throw ee;M++,C=P(Oe.code,Oe.message);continue}if(P$1.type===13||P$1.type===12){M++,C=P$1;continue}let me=P$1.toNumber();Number.isFinite(me)&&p.push([U,me]);}if(M===rn&&C!==void 0){t$2.push(P(String(C.value),`plot: ${o} has no value at any point over [${l}, ${i}]: ${String(C.unit)}`));break}let V=p.map(D=>D[1]),L=V.length?Math.min(...V):0,v=V.length?Math.max(...V):0,B=D=>Number.isInteger(D)?String(D):String(Number(D.toFixed(2)));t$2.push(I({kind:"plot",points:p,label:`${o} over [${B(l)}, ${B(i)}]`,domain:[l,i],range:[L,v],expr:o}));break}case 158:{let e=R(f$3,x$1++,g$2,"body kind"),n=R(f$3,x$1++,g$2,"body reference"),o=R(f$3,x$1++,g$2,"initial-value flag");qn(e,n,g$2);let i=o?m(t$2):void 0,l=m(t$2),d=[],p;if(e===0){let v=T$1?.[n];if(!v)throw c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: REDUCE_INVOKE referenced missing anonymous body index ${n}`,{ref:n});d=v.params,p=v.program;}else if(e===2){let v=Ae(E,n,g$2),B=a$2.getUserFunction(v);if(!B){t$2.push(P("UNDEFINED_FUNCTION",`reduce: undefined function "${v}"`));break}if(B.params.length!==2){t$2.push(P("FUNCTION_ARITY_MISMATCH",`reduce: "${v}" must take exactly 2 arguments (accumulator, element), got ${B.params.length}`));break}d=B.params,p=B.program;}let M=ea(l,a$2.getMaxCollectionSize());if(!Array.isArray(M)){t$2.push(M);break}c$2(M.length,"collection elements");let C$1,V;if(i!==void 0){let v=Q$1(i);if(v){t$2.push(v);break}C$1=i,V=0;}else {if(M.length===0){t$2.push(P("REDUCE_EMPTY_COLLECTION","reduce: cannot reduce an empty collection without an initial value."));break}C$1=M[0],V=1;}let L;for(let v=V;v<M.length;v++){let B=[C$1,M[v]],D=e===1?C[n]?.(B)??P("UNKNOWN_BUILTIN_FUNCTION",`reduce: unknown builtin function index ${n}`):sn(d,p,B,a$2,s$2,u$2,c$5,!!b$2),U=Q$1(D);if(U){L=U;break}C$1=D;}if(L){t$2.push(L);break}t$2.push(C$1);break}case 159:{let e=R(f$3,x$1++,g$2,"body reference"),n=T$1?.[e];if(!n)throw c.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: BIND_UNKNOWN referenced missing anonymous body index ${e}`,{ref:e});t$2.push(gt(n.params[0],n.program,a$2,s$2,u$2,c$5,!!b$2));break}default:throw se("MALFORMED_BYTECODE_UNKNOWN_OPCODE",g$2,"has no handler in this virtual machine","an opcode the dispatch switch handles (see parser/OpCode.ts)",`opcode ${g$2} at offset ${x$1-1}`,{offset:x$1-1})}}let _$1=m(t$2);return {type:"value",value:H?k$1(_$1):_$1}}catch(_){return t$2.length>J$1&&(t$2.length=J$1),{type:"error",error:d(_)}}finally{b$1();}}export{$n as a,Pn as b,da as c,ln as d};//# sourceMappingURL=chunk-EQ37UQGY.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-EQ37UQGY.js.map
|
package/dist/chunk-ETQBU454.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-X2GQAKL2.js';import {c as c$2}from'./chunk-PICFFFJV.js';import {ga,C,z,B as B$1,E,p,i,j,r,s,qa,l,h,g,f,e as e$1,k,Q as Q$1,V as V$1,ha,la,ra,ja,ma,J as J$1,w as w$1,o,a as a$1,d,u as u$1,W,Y,F,_,da,ca,ba,$,L,O,c as c$3,na as na$1,pa,ka,ia,oa,v as v$1,q as q$1,m,b as b$2,A,n as n$1,K as K$2,fa,I,H as H$1,G,N as N$1,t as t$1,D,P as P$2,y,x,M}from'./chunk-IHPYXJIY.js';import {b}from'./chunk-EOO6M65F.js';import {Q,P as P$1,p as p$1,q,K as K$1,n,s as s$1,u,C as C$1,v,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';function Zt(e,t){let n=t===2?L:M,o=n(e.n),r=n(e.d);return o===null||r===null?null:{n:o,d:r}}function Ht(e,t){let n=y(e),o=new Map;for(let[r,i]of n){if(i%t!==0)return null;o.set(r,i/t);}return x(o)}function Qn(e,t){let n=y(e);for(let[o,r]of y(t))n.set(o,(n.get(o)??0)+r);return x(n)}function Wt(e,t){let n=y(e);for(let[o,r]of y(t)){let i=(n.get(o)??0)-r;i<=0?n.delete(o):n.set(o,i);}return x(n)}function zn(e,t){let n=y(e),o=new Map;for(let[r,i]of y(t)){let a=n.get(r);a!==void 0&&o.set(r,Math.min(a,i));}return x(o)}function Jn(e){let t=new Set;for(let n of e)for(let o of y(n).keys())t.add(o);return [...t].sort()}function J(e){let t=new Map;for(let n of e)t.set(n.key,n.coefficient);return E({terms:t,vars:Jn(e.map(n=>n.key))})}function ze(e){let t=e[0];for(let n=1;n<e.length;n++)t={kind:"mul",left:t,right:e[n]};return t}function eo(e){return [...e.terms].map(([n,o])=>({key:n,coefficient:o})).sort((n,o)=>D(n.key,o.key,e.vars))}function Jt(e){if(e.vars.length<2)return null;let t=eo(e);return t.length===2?to(t[0],t[1]):t.length===3?no(t):t.length===4?oo(t):null}function to(e,t){let n=e.coefficient.n>0n,o=t.coefficient.n>0n;if(!n)return null;let r=Je(e,t,2);if(r!==null&&!o)return ze([J([r.a,we(r.b)]),J([r.a,r.b])]);let i=Je(e,t,3);if(i===null)return null;let a=J(o?[i.a,i.b]:[i.a,we(i.b)]),u=o?we(Oe(i.a,i.b)):Oe(i.a,i.b);return ze([a,J([Qt(i.a),u,Qt(i.b)])])}function Je(e,t,n){let o=t.coefficient.n<0n?j(t.coefficient):t.coefficient,r=Zt(e.coefficient,n),i=Zt(o,n);if(r===null||i===null)return null;let a=Ht(e.key,n),u=Ht(t.key,n);return a===null||u===null?null:{a:{key:a,coefficient:r},b:{key:u,coefficient:i}}}function we(e){return {key:e.key,coefficient:j(e.coefficient)}}function Oe(e,t){return {key:Qn(e.key,t.key),coefficient:h(e.coefficient,t.coefficient)}}function Qt(e){return Oe(e,e)}function no(e){let[t,n,o]=e;if(t.coefficient.n<0n||o.coefficient.n<0n)return null;let r=Je(t,o,2);if(r===null)return null;let i$1=Oe(r.a,r.b);if(i$1.key!==n.key)return null;let a=h(i$1.coefficient,{n:2n,d:1n}),u=n.coefficient.n<0n,l=u?j(n.coefficient):n.coefficient;return m(i(l,a))?{kind:"pow",base:J([r.a,u?we(r.b):r.b]),exponent:p(2)}:null}function oo(e){let t=[[[0,1],[2,3]],[[0,2],[1,3]],[[0,3],[1,2]]];for(let n of t){let o=zt(e[n[0][0]],e[n[0][1]]),r=zt(e[n[1][0]],e[n[1][1]]);if(!(o===null||r===null)&&ro(o.cofactor,r.cofactor))return ze([J([o.common,r.common]),J(o.cofactor)])}return null}function zt(e,t){let n=zn(e.key,t.key),o={key:n,coefficient:e.coefficient},r=[{key:Wt(e.key,n),coefficient:{n:1n,d:1n}},{key:Wt(t.key,n),coefficient:i(t.coefficient,e.coefficient)}];return r[0].key===r[1].key?null:{common:o,cofactor:r}}function ro(e,t){return e.length!==t.length?false:e.every((n,o)=>n.key===t[o].key&&n.coefficient.n===t[o].coefficient.n&&n.coefficient.d===t[o].coefficient.d)}var io=12,Ce=4096;function De(e,t){let n=e<0n?-e:e,o=t<0n?-t:t;for(;o!==0n;){let r=n%o;n=o,o=r;}return n}function tn(e,t){return e===0n||t===0n?0n:e/De(e,t)*t}function en(e){let t=e<0n?-e:e;if(t===0n)return null;let n=[];for(let o=1n;o*o<=t;o++){if(t%o!==0n)continue;n.push(o);let r=t/o;if(r!==o&&n.push(r),n.length>Ce)return null}return n}function nn(e,t){let n=a$1;for(let o of e)n=f(h(n,t),o);return n}function ao(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(f(e[o],h(n[o-1],t)));return n}function se(e){if(e.length<2)return [];let t=1n;for(let s of e)t=tn(t,s.d);let n=e.map(s=>s.n*t/s.d),o=n[0],r=n[n.length-1];if(r===0n)return [];let i=en(r),a=en(o);if(i===null||a===null)throw c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial's coefficients have too many divisors to search for rational roots.",{limit:Ce});if(i.length*a.length>Ce)throw c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial has too many candidate rational roots to test.",{limit:Ce});let u=[],l$1=new Set;for(let s of i)for(let p of a)for(let h of [1n,-1n]){let N={n:h*s/De(s,p),d:p/De(s,p)},S=`${N.n}/${N.d}`;l$1.has(S)||(l$1.add(S),l(nn(e,N))&&u.push(N));}return u}function uo(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 lo(e,t){let n=e.length-1,o=new Map;return e.forEach((r,i)=>{if(l(r))return;let a=n-i;o.set(a===0?"":a===1?t:`${t}^${a}`,r);}),E({terms:o,vars:o.size>0?[t]:[]})}function tt(e,t){let n=[],o=[...e],r=se(o);for(;r.length>0&&o.length>2;){for(let a of r){let u=0;for(;o.length>1&&l(nn(o,a));)o=ao(o,a),u++;u>0&&n.push({base:uo(t,a),power:u});}r=o.length>2?se(o):[];}return o.length-1>=1?(n.push({base:lo(o,t),power:1}),{content:b$2,factors:n}):{content:o.length===1?o[0]:b$2,factors:n}}function so(e){let t=[];m(e.content)||t.push(p(e.content));for(let o of e.factors)t.push(o.power===1?o.base:r(o.base,p({n:BigInt(o.power),d:1n})));if(t.length===0)return p(b$2);let n=t[0];for(let o=1;o<t.length;o++)n={kind:"mul",left:n,right:t[o]};return n}function co(e){let t=0n,n=1n;for(let o of e.terms.values())t=De(t,o.n),n=tn(n,o.d);return t===0n?b$2:{n:t,d:n}}function mo(e){let t=new Map;for(let r of e.vars){let i=1/0;for(let a of e.terms.keys()){let u=fo(a,r);u<i&&(i=u);}i>0&&i!==1/0&&t.set(r,i);}if(t.size===0)return {monomial:t,reduced:e};let n=new Map;for(let[r,i]of e.terms){let a=et(r);for(let[u,l]of t)a.set(u,(a.get(u)??0)-l);n.set(po(a),i);}let o=new Set;for(let r of n.keys())for(let i of et(r).keys())o.add(i);return {monomial:t,reduced:{terms:n,vars:[...o].sort()}}}function fo(e,t){return et(e).get(t)??0}function et(e){let t=new Map;if(e==="")return t;for(let n of e.split("*")){let o=n.indexOf("^");o===-1?t.set(n,1):t.set(n.slice(0,o),Number(n.slice(o+1)));}return t}function po(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 bo(e){let t=[...e.keys()].sort(),n=null;for(let o of t){let r$1=e.get(o),i=r$1===1?q$1(o):r(q$1(o),p({n:BigInt(r$1),d:1n}));n=n===null?i:{kind:"mul",left:n,right:i};}return n}function on(e){let t=C(e);if(t===null||t.terms.size===0||z(t)>io||t.vars.length===0)return e;let n=co(t),o=m(n)?t:yo(t,i(b$2,n)),{monomial:r,reduced:i$1}=mo(o),a=bo(r),u=A(i$1);if(u===null){let W=Jt(i$1);return W!==null?ho(n,a,W):No(n,a,i$1)??e}let l=[...B$1(i$1,u)].reverse(),s=tt(l,u),p$1=h(n,s.content);if(s.factors.length<=1&&(s.factors[0]?.power??1)===1&&a===null&&m(p$1))return e;let N=[];m(p$1)||N.push(p(p$1)),a!==null&&N.push(a),N.push(so({content:b$2,factors:s.factors}));let S=N[0];for(let W=1;W<N.length;W++)S={kind:"mul",left:S,right:N[W]};return S}function yo(e,t){let n=new Map;for(let[o,r]of e.terms)n.set(o,h(r,t));return {terms:n,vars:e.vars}}function ho(e,t,n){let o=[];m(e)||o.push(p(e)),t!==null&&o.push(t),o.push(n);let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}function No(e,t,n){if(t===null&&m(e))return null;let o=[];m(e)||o.push(p(e)),t!==null&&o.push(t),o.push(E(n));let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}var T={n:2n,d:1n},B={n:3n,d:1n},he={n:4n,d:1n};function go(e,t,n,o){let r=j(i(t,h(B,e))),i$1=i(g(h(B,h(e,n)),h(t,t)),h(B,h(e,e))),a=h(T,h(t,h(t,t))),u=h({n:9n,d:1n},h(e,h(t,n))),l=h({n:27n,d:1n},h(h(e,e),o)),s=i(f(g(a,u),l),h({n:27n,d:1n},h(e,h(e,e))));return {p:i$1,q:s,shift:r}}function an(e,t,n,o){let{p:r,q:i,shift:a}=go(e,t,n,o),u=j(f(h(he,h(r,h(r,r))),h({n:27n,d:1n},h(i,i))));return k(u,a$1)>0?{exact:[],approximate:xo(r,i,a)}:l(u)?{exact:Ro(r,i,a),approximate:[]}:{exact:Ao(r,i,a),approximate:[]}}function Ro(e,t,n){if(l(e))return [p(n)];let o=f(i(h(B,t),e),n),r=f(j(i(h(B,t),h(T,e))),n);return [o,r].sort(k).map(p)}function Ao(e,t,n){let o=j(i(t,T)),r=f(h(i(t,T),i(t,T)),h(i(e,B),h(i(e,B),i(e,B)))),i$1=O(r),a={kind:"call",name:"cbrt",args:[{kind:"add",left:p(o),right:i$1}]},u={kind:"call",name:"cbrt",args:[{kind:"sub",left:p(o),right:i$1}]},l={kind:"add",left:a,right:u},s={kind:"sub",left:a,right:u},p$1={kind:"add",left:p(n),right:{kind:"div",left:{kind:"neg",operand:l},right:p(T)}},h$1={kind:"mul",left:{kind:"div",left:{kind:"mul",left:s,right:O(B)},right:p(T)},right:w$1(n$1)};return [{kind:"add",left:p(n),right:l},{kind:"sub",left:p$1,right:h$1},{kind:"add",left:p$1,right:h$1}]}function xo(e,t,n){let o=e$1(e),r=e$1(t),i=e$1(n),a=2*Math.sqrt(-o/3),u=3*r/(2*o)*Math.sqrt(-3/o),l=Math.acos(Math.min(1,Math.max(-1,u)))/3;return [0,1,2].map(s=>a*Math.cos(l-2*Math.PI*s/3)+i).sort((s,p)=>s-p)}function vo(e,t,n,o){let r=j(i(e,he)),i$1=h(e,e),a=g(t,i(h(B,i$1),{n:8n,d:1n})),u=f(g(n,i(h(e,t),T)),i(h(i$1,e),{n:8n,d:1n})),l=g(f(g(o,i(h(e,n),he)),i(h(i$1,t),{n:16n,d:1n})),i(h(B,h(i$1,i$1)),{n:256n,d:1n}));return {p:a,q:u,r:l,shift:r}}function un(e,t,n,o,r,i$1){let a=S=>i(S,e),{p:u,q:l$1,r:s,shift:p$1}=vo(a(t),a(n),a(o),a(r)),h=l(l$1)?Io(u,s):_o(u,l$1,s,i$1);if(h===null)return null;let N=l(p$1)?h:h.map(S=>({kind:"add",left:p(p$1),right:S}));return {exact:Mo(N),approximate:[]}}function Mo(e){let t=new Set,n=[];for(let o of e){let r=t$1(Q$1(o));t.has(r)||(t.add(r),n.push(o));}return n}function Io(e,t){let n=g(h(e,e),h(he,t));if(k(n,a$1)<0)return ko(e,t);let o=N$1(n);return o!==null?Eo(j(e),o,l(n)):So(e,t,n)}function Eo(e,t,n){let o=n?[i(e,T)]:[i(f(e,t),T),i(g(e,t),T)],r=[];for(let i of o){if(l(i)){r.push(p(a$1));continue}let a=P$2(i);r.push({kind:"neg",operand:a},a);}return r}function So(e,t,n){let o=p(j(e)),r=O(n),i=k(e,a$1)<=0,a=[{node:nt({kind:"add",left:o,right:r}),positive:i||k(t,a$1)<=0},{node:nt({kind:"sub",left:o,right:r}),positive:i&&k(t,a$1)>=0}],u=[];for(let{node:l,positive:s}of a){let h={kind:"call",name:"sqrt",args:[s?l:{kind:"neg",operand:l}]},N=s?h:{kind:"mul",left:h,right:w$1(n$1)};u.push({kind:"neg",operand:N},N);}return u}function nt(e){return {kind:"div",left:e,right:p(T)}}function ko(e,t){let n=i(j(e),T),o=N$1(t),r=o===null?rn(O(t),n):O(i(f(o,n),T)),a={kind:"mul",left:o===null?rn(O(t),j(n)):O(i(g(o,n),T)),right:w$1(n$1)},u={kind:"add",left:r,right:a},l={kind:"sub",left:r,right:a};return [{kind:"neg",operand:u},{kind:"neg",operand:l},l,u]}function rn(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:[nt(n)]}}function _o(e,t,n,o){let r=[{n:1n,d:1n},h(T,e),g(h(e,e),h(he,n)),j(h(t,t))];for(let i$1 of se(r)){if(k(i$1,a$1)<=0)continue;let a=N$1(i$1);if(a===null)continue;let u=f(e,i$1),l=i(t,a),s=i(g(u,l),T),p=i(f(u,l),T),h={n:1n,d:1n};return [...o(h,a,s),...o(h,j(a),p)]}return null}var To=200,Vo=1e-14,wo=1e-10,Oo=1e-10,ln=1e-9,Co=1e-8,Do=4;function Ne(e,t){return {re:e.re-t.re,im:e.im-t.im}}function Po(e,t){return {re:e.re*t.re-e.im*t.im,im:e.re*t.im+e.im*t.re}}function cn(e,t){if(Math.abs(t.re)>=Math.abs(t.im)){let r=t.im/t.re,i=t.re+t.im*r;return {re:(e.re+e.im*r)/i,im:(e.im-e.re*r)/i}}let n=t.re/t.im,o=t.re*n+t.im;return {re:(e.re*n+e.im)/o,im:(e.im*n-e.re)/o}}function K(e){return Math.hypot(e.re,e.im)}function Pe(e,t){let n=0,o=0;for(let r of e){let i=n*t.re-o*t.im+r;o=n*t.im+o*t.re,n=i;}return {re:n,im:o}}function Lo(e,t){let n=K(t),o=0;for(let r of e)o=o*n+Math.abs(r);return o}function Fo(e){let t=e.length-1,n=[];for(let o=0;o<t;o++)n.push(e[o]*(t-o));return n}function Uo(e){let t=[...e].reverse(),o=[...K$2(t)].reverse().map(e$1);return o.some(r=>!Number.isFinite(r))?null:o}function $o(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 o=1+n,r=-e[1]/t,i=[];for(let a=0;a<t;a++){let u=2*Math.PI*a/t+Math.PI/(2*t);i.push({re:r+o*Math.cos(u),im:o*Math.sin(u)});}return i}function Bo(e){let t=e.length-1,n=$o(e);for(let o=0;o<To;o++){let r=0,i=1;for(let a=0;a<t;a++){let u={re:1,im:0};for(let s=0;s<t;s++)a!==s&&(u=Po(u,Ne(n[a],n[s])));if(u.re===0&&u.im===0){n[a]={re:n[a].re+1e-6*(a+1),im:n[a].im+1e-6};continue}let l=cn(Pe(e,n[a]),u);if(!Number.isFinite(l.re)||!Number.isFinite(l.im))return null;n[a]=Ne(n[a],l),r=Math.max(r,K(l)),i=Math.max(i,K(n[a]));}if(r<=Vo*i)return n}return null}function sn(e,t,n){let o=n;for(let r=0;r<Do;r++){let i=Pe(t,o);if(i.re===0&&i.im===0)break;let a=Ne(o,cn(Pe(e,o),i));if(!Number.isFinite(a.re)||!Number.isFinite(a.im))break;o=a;}return o}function qo(e,t,n){let o=Math.max(1,K(n));if(n.im!==0&&Math.abs(n.im)<=ln*o){let r=sn(e,t,{re:n.re,im:0});if(ot(e,r))return {re:r.re,im:0}}if(n.re!==0&&Math.abs(n.re)<=ln*o){let r=sn(e,t,{re:0,im:n.im});if(ot(e,r))return {re:0,im:r.im}}return n}function ot(e,t){return !Number.isFinite(t.re)||!Number.isFinite(t.im)?false:K(Pe(e,t))<=wo*Lo(e,t)}function Yo(e){let t=[...e],n=t.map(o=>o.im===0);for(let o=0;o<t.length;o++){if(n[o])continue;let r={re:t[o].re,im:-t[o].im},i=-1,a=Number.POSITIVE_INFINITY;for(let p=o+1;p<t.length;p++){if(n[p])continue;let h=K(Ne(t[p],r));h<a&&(a=h,i=p);}if(i===-1||a>Co*Math.max(1,K(t[o])))continue;let u=(t[o].re+t[i].re)/2,l=(Math.abs(t[o].im)+Math.abs(t[i].im))/2,s=t[o].im<0?-1:1;t[o]={re:u,im:s*l},t[i]={re:u,im:-s*l},n[o]=true,n[i]=true;}return t}function Go(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let o=Math.max(1,K(e[t]),K(e[n]));if(K(Ne(e[t],e[n]))<=Oo*o)return false}return true}function mn(e){let t=Uo(e);if(t===null)return null;if(t.length<2)return [];let n=Bo(t);if(n===null)return null;let o=Fo(t),r=Yo(n).map(i=>qo(t,o,i));for(let i of r)if(!ot(t,i))return null;return Go(r)?[...r].sort((i,a)=>i.re-a.re||i.im-a.im):null}var fn=8;function jo(e,t){let n=a$1;for(let o of e)n=f(h(n,t),o);return n}function Ko(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(f(e[o],h(n[o-1],t)));return n}function dn(e,t,n){let o=g(h(t,t),h(Ho(),h(e,n))),r=h(Zo(),e);if(k(o,a$1)<0)return Xo(j(t),o,r);if(l(o))return [p(i(j(t),r))];let i$1=L(o.n),a=L(o.d);if(i$1!==null&&a!==null){let h={n:i$1,d:a},N=i(f(j(t),h),r),S=i(g(j(t),h),r);return k(S,N)<=0?[p(S),p(N)]:[p(N),p(S)]}let u=O(o),l$1=k(r,a$1)>0,s={kind:"div",left:{kind:"sub",left:p(j(t)),right:u},right:p(r)},p$1={kind:"div",left:{kind:"add",left:p(j(t)),right:u},right:p(r)};return l$1?[s,p$1]:[p$1,s]}function Xo(e,t,n){let o$1=j(t),r=L(o$1.n),i$1=L(o$1.d);if(r!==null&&i$1!==null){let s=i({n:r,d:i$1},n),p=i(e,n);return [w$1(o(p,j(s))),w$1(o(p,s))]}let a=i(e,n),u=i(o$1,h(n,n)),l$1={kind:"mul",left:O(u),right:w$1(n$1)};return l(a)?[{kind:"neg",operand:l$1},l$1]:[{kind:"sub",left:p(a),right:l$1},{kind:"add",left:p(a),right:l$1}]}function Zo(){return {n:2n,d:1n}}function Ho(){return {n:4n,d:1n}}function Wo(e){return {re:e,im:0}}function pn(e,t,n){let o=C({kind:"sub",left:e,right:t});if(o===null)return {kind:"unsupported",reason:"this is not a polynomial equation (it divides by an unknown, or calls a function of one)"};let r=o.vars.filter(u=>u!==n),i=z(o,n);if(r.length>0)return i!==1?{kind:"unsupported",reason:`solving for "${n}" needs the equation to be linear in it when other unknowns (${r.join(", ")}) are present`}:Qo(o,n);if(i===0)return o.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$1(o,n)].reverse();return er(a)}function Qo(e,t){let n=new Map,o=new Map;for(let[u,l]of e.terms){let s=u.split("*").filter(h=>h.length>0),p=s.indexOf(t);p===-1?o.set(u,l):(s.splice(p,1),n.set(s.join("*"),l));}let r=u=>{let l=new Set;for(let s of u.keys())for(let p of s.split("*"))p.length>0&&l.add(p.split("^")[0]);return [...l].sort()},i=E({terms:n,vars:r(n)});return {kind:"roots",exact:[{kind:"div",left:{kind:"neg",operand:E({terms:o,vars:r(o)})},right:i}],approximate:[]}}function zo(e){return e.length===4?an(e[0],e[1],e[2],e[3]):e.length===5?un(e[0],e[1],e[2],e[3],e[4],dn):null}function Jo(e){let t=[],n=[...e],o=0;for(;n.length>1&&l(n[n.length-1]);)n=n.slice(0,-1),o++;for(o>0&&t.push(a$1);n.length>1;){let r=se(n);if(r.length===0)break;for(let i of r){let a=0;for(;n.length>1&&l(jo(n,i));)n=Ko(n,i),a++;a>0&&t.push(i);}}return {roots:t.sort(k),remaining:n}}function er(e){let{roots:t,remaining:n}=Jo(e),o=t.map(p),r=[],i$1=n.length-1,a=e.length-n.length;if(i$1<=0)return ce(o,r,a,0,"");if(i$1===1)return o.push(p(i(j(n[1]),n[0]))),ce(o,r,a+1,0,"");if(i$1===2)return o.push(...dn(n[0],n[1],n[2])),ce(o,r,a+2,0,"");let u=zo(n);if(u!==null)return o.push(...u.exact),r.push(...u.approximate.map(Wo)),ce(o,r,a+i$1,0,"");let l=mn(n);return l!==null?(r.push(...l),ce(o,r,a+i$1,0,"")):ce(o,r,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 ce(e,t,n,o,r){let i=e.length+t.length,a=n>=1&&(i<1||i>n);return o>0||a?{kind:"incomplete",exact:e,approximate:t,missing:a?Math.max(1,n+o-i):o,reason:a?`${i} root${i===1?"":"s"} were produced for a degree-${n+o} equation, which does not add up`:r}:{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"},tr=31,Vi=new Set([67,68,69,70,71,72,73,74,75,76,77,78,79]);function V(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 w(e){let t=Q$1(e);return t.kind==="const"?n(e$1(t.value)):K$1(t)}function Le(e){return P$1("SYMBOLIC_UNSUPPORTED_FUNCTION",`"${e}" cannot be applied to an expression that still contains an unknown.`)}function wi(e,t){let n=V(e),o=V(t);return n===null||o===null?Le("^"):w(r(n,o))}function Oi(e){let t=V(e);return t===null?Le("-"):w({kind:"neg",operand:t})}function Ci(e,t){let n=[];for(let r of t){let i=Q(r);if(i)return i;let a=V(r);if(a===null)return Le(bn[e]??`builtin ${e}`);n.push(a);}if(e===tr&&n.length===2)return w(r(n[0],n[1]));let o=bn[e];return o===void 0?Le(`builtin ${e}`):w(s(o,n))}function nr(e){let t=w(e);return t.type===0&&!Number.isInteger(t.toNumber())?K$1(e):t}function or(e){return e.im===0?n(e.re):K$1(w$1(o(d(e.re),d(e.im))))}function rr(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(nr);for(let n of e.approximate)t$1.push(or(n));return t$1.length===0?t("no solution"):t$1.length===1?t$1[0]:C$1(1,t$1.length,t$1.map(n=>n.type===9?n.value:n.toNumber()))}}}function hn(e,t,n){let o=V(e),r=V(t);return o===null||r===null?P$1("SYMBOLIC_NONFINITE_OPERAND","An equation side has no exact value to solve with."):rr(pn(o,r,n))}function ge(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),o=c$1(t.unit),r=c$2.isCurrency(e$1.unit)&&c$2.isCurrency(t.unit);if(n&&n===o){let i=e(t.toNumber(),t.unit,e$1.unit);return {lv:e$1.toNumber(),rv:i,unit:e$1.unit,sameMeasure:true}}if(r){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}}var ir=1e-12;function ar(e,t,n){let o=0;return Number.isFinite(e)&&Math.abs(e)>o&&(o=Math.abs(e)),Number.isFinite(t)&&Math.abs(t)>o&&(o=Math.abs(t)),Number.isFinite(n)&&Math.abs(n)>o&&(o=Math.abs(n)),o}function ji(e,t){let{lv:n,rv:o,sameMeasure:r}=ge(e,t);if(!r)return {lv:n,rv:o,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:o,equal:qa(e.exact,t.exact)===0,sameMeasure:true};if(n===o)return {lv:n,rv:o,equal:true,sameMeasure:true};if(!Number.isFinite(n)||!Number.isFinite(o))return {lv:n,rv:o,equal:false,sameMeasure:true};let i=ar(n,o,t.toNumber());return {lv:n,rv:o,equal:Math.abs(n-o)<=i*ir,sameMeasure:true}}var ur={time:"duration",luminousIntensity:"luminous intensity"},lr=new Set(["money","data"]),sr={add:"added",sub:"subtracted",mul:"multiplied",div:"divided"};function Fe(e){if(c$2.isCurrency(e))return "money";let t=c$1(e);if(t!==void 0)return ur[t]??t}function Nn(e){return lr.has(e)?e:/^[aeiou]/.test(e)?`an ${e}`:`a ${e}`}function $e(e,t,n){let o=e===void 0?void 0:Fe(e),r=t===void 0?void 0:Fe(t);if(o!==void 0&&r!==void 0&&o!==r)return `${o} and ${r} cannot be ${n}`}function cr(e){return e!==void 0?sr[e]??"combined":"combined"}function Ki(e,t){let n=Fe(e),o=Fe(t);if(n!==void 0&&o!==void 0&&n!==o)return `${Nn(n)} cannot be converted to ${Nn(o)}`}function Xi(e,t){let n=e.type===6?e.unit:void 0,o=t.type===6?t.unit:void 0,r=$e(n,o,"compared");return P$1("INCOMPATIBLE_UNITS",r??`Cannot compare incompatible units: ${n??"?"} and ${o??"?"}`)}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 Zi(){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 Hi(e,t){let n=Rn(e),o=Rn(t);return n===null||o===null?null:n<o?-1:n>o?1:0}function Rn(e){if(e.type===2)return e.value;let t=e.toNumber();return Number.isInteger(t)?BigInt(t):null}function rt(e,t){return Number.isFinite(t)?Math.pow(e,t):e===1||e===-1&&!Number.isNaN(t)?1:Math.pow(e,t)}function An(e){return e.exact!==void 0?e.exact:ha(e.toNumber())}function mr(e,t,n){let o=e.type===6&&e.unit!==void 0&&e.exact!==void 0&&c$2.isCurrency(e.unit),r=t.type===6&&t.unit!==void 0&&t.exact!==void 0&&c$2.isCurrency(t.unit);if(!o&&!r)return null;let i,a,u;if(o&&r){if(e.unit!==t.unit||n==="div")return null;i=e.exact,a=t.exact,u=e.unit;}else if(o&&t.type!==6)i=e.exact,u=e.unit,a=An(t);else if(r&&e.type!==6)a=t.exact,u=t.unit,i=An(e);else return null;if(i===null||a===null)return null;let l;switch(n){case "add":l=ja(i,a);break;case "sub":l=ka(i,a);break;case "mul":l=la(i,a);break;case "div":if(na$1(a))return null;l=pa(i,a);break}return v(ra(l),u,l)}function Ue(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 Wi(e,t,n){let o=Ue(e);if(o===null)return null;let r=Ue(t);if(r===null||n==="div"&&l(r))return null;let i$1;try{switch(n){case "add":i$1=f(o,r);break;case "sub":i$1=g(o,r);break;case "mul":i$1=h(o,r);break;case "div":i$1=i(o,r);break}}catch{return null}return p$1(e$1(i$1),i$1)}function Qi(e,t,n){if(e.type!==0||t.type!==0)return null;let o=e.value,r=t.value,i=e.uncertainty??0,a=t.uncertainty??0,u,l;switch(n){case "add":u=o+r,l=Math.hypot(i,a);break;case "sub":u=o-r,l=Math.hypot(i,a);break;case "mul":u=o*r,l=Math.hypot(r*i,o*a);break;case "div":u=o/r,l=Math.hypot(i/r,o*a/(r*r));break}return q(u,l)}function zi(e,t){let n=Ue(e);if(n===null)return null;let o=Ue(t);return o===null?null:k(n,o)}function Ji(e,t,n$1,o,r){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(r&&(e.type===9||t.type===9)){let i=V(e),a=V(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$1(Q$1({kind:r,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 o?s$1(o(i,a)):s$1(i+a)}if(e.type===6||t.type===6){if(r){let N=mr(e,t,r);if(N)return N}let{lv:i,rv:a,unit:u$1,sameMeasure:l}=ge(e,t);if(!l){let N=e.type===6?e.unit:void 0,S=t.type===6?t.unit:void 0,W=$e(N,S,cr(r));return P$1("INCOMPATIBLE_UNITS",W??`Cannot combine incompatible units: ${N??"?"} and ${S??"?"}`)}let s=u(n$1(i,a),u$1),p=e.datetimeSpan===true&&t.datetimeSpan===true,h=e.datetimeSpan===true&&t.type===0||t.datetimeSpan===true&&e.type===0;return (p||h)&&(s.datetimeSpan=true),s}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 u=new Array(i.data.length);for(let l=0;l<i.data.length;l++)u[l]=n$1(i.data[l],a.data[l]);return C$1(i.rows,i.cols,u)}if(e.type===7){let i=e.value,a=t.toNumber(),u=i.data.map(l=>n$1(l,a));return C$1(i.rows,i.cols,u)}if(t.type===7){let i=t.value,a=e.toNumber(),u=i.data.map(l=>n$1(a,l));return C$1(i.rows,i.cols,u)}return n(n$1(e.toNumber(),t.toNumber()))}var xn=254,vn=200,Re=class{constructor(){this.handlers=new Map;this.nextOpcode=vn+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-vn} allocations).`);return this.nextOpcode++}},na=new Re;var In=ga(1);function Ae(e,t){return c$2.isCurrency(t)?e.exact??ha(e.toNumber()):null}function it(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 En(e,t,n){let o=Ae(e,n),r=it(t);if(o!==null&&r!==null){let i=la(o,r);return v(ra(i),n,i)}return u(e.toNumber()*t,n)}function Sn(e,t,n,o){let r=Ae(e,t),i=it(n);if(r!==null&&i!==null){let a=ja(In,o===1?i:ma(i)),u=la(r,a);return v(ra(u),t,u)}return u(e.toNumber()*(1+o*n),t)}function kn(e){let t=it(e);return t===null?null:ja(In,t)}function _n(e,t,n){let o=Ae(e,t),r=kn(n);if(o===null||r===null||na$1(r))return null;let i=pa(o,r);return v(ra(i),t,i)}function Tn(e,t,n){let o=Ae(e,t),r=kn(n);if(o===null||r===null||na$1(r))return null;let i=ka(o,pa(o,r));return v(ra(i),t,i)}function Vn(e,t){let n=e.unit,o=n!==void 0&&c$2.isCurrency(n)?fr(e,n):null;if(o===null)return {unit:n,shares:[{value:e.toNumber()/t,count:t}]};let r=BigInt(t),i=o/r,a=o-i*r,u=Number(a<0n?-a:a),l=o<0n?-1n:1n,s=Mn(i,t-u);return u===0?{unit:n,shares:[s]}:{unit:n,shares:[s,Mn(i+l,u)]}}function Mn(e,t){let n=fa(e,2);return {value:ra(n),exact:n,count:t}}function fr(e,t){let n=Ae(e,t);return n===null?null:oa(n,2).coef}var dr=12;function wn(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((o,r)=>{t.forEach((i,a)=>{n[r+a]=f(n[r+a],h(o,i));});}),n}function pr(e,t){let n=[b$2];for(let o=0;o<t;o++)n=wn(n,e);return n}function at(e,t){return e.map(n=>i(n,t))}function br(e,t){let n=[],o=0;for(;o<e.length&&l(e[o]);)o++;o>0&&n.push({base:[a$1,b$2],power:o});let r=e.slice(o);if(r.length>1){let i=tt([...r].reverse(),t);for(let a of i.factors){let u=C(a.base);if(u===null)return null;n.push({base:[...B$1(u,t)],power:a.power});}}return n.length>0?n:null}function yr(e){let t=[];return e.forEach((n,o)=>{let r=n.base.length-1;for(let i=1;i<=n.power;i++)for(let a=0;a<r;a++)t.push({factor:o,power:i,degree:a});}),t}function hr(e,t,n){let o=pr(t[e.factor].base,e.power),{quotient:r,remainder:i}=H$1(n,o);if(!G(i))return null;let a=new Array(e.degree).fill(a$1);return a.push(b$2),wn(r,a)}function Nr(e,t){let n=t.length;for(let o=0;o<n;o++){let r=-1;for(let i=o;i<n;i++)if(!l(e[i][o])){r=i;break}if(r===-1)return null;[e[o],e[r]]=[e[r],e[o]],[t[o],t[r]]=[t[r],t[o]];for(let i$1=0;i$1<n;i$1++){if(i$1===o||l(e[i$1][o]))continue;let a=i(e[i$1][o],e[o][o]);for(let u=o;u<n;u++)e[i$1][u]=g(e[i$1][u],h(a,e[o][u]));t[i$1]=g(t[i$1],h(a,t[o]));}}return t.map((o,r)=>i(o,e[r][r]))}function ut(e,t,n){if(t.length<2||t.length-1>dr)return null;let o=I(e,t),r=o.length>1?H$1(e,o).quotient:[...e],i=o.length>1?H$1(t,o).quotient:[...t];if(i.length===1)return {polynomial:at(r,i[0]),terms:[]};if(i.length===0)return null;let a=i[i.length-1],u=at(i,a),l=at(r,a),{quotient:s,remainder:p}=H$1(l,u);if(G(p))return {polynomial:s,terms:[]};let h=br(u,n);if(h===null)return null;let N=gr(h,u,p);return N===null?null:{polynomial:s,terms:N}}function gr(e,t,n){let o=yr(e),r=t.length-1;if(o.length!==r)return null;let i=[];for(let s of o){let p=hr(s,e,t);if(p===null)return null;i.push(p);}let a=[];for(let s=0;s<r;s++)a.push(i.map(p=>p[s]??a$1));let u=[];for(let s=0;s<r;s++)u.push(n[s]??a$1);let l=Nr(a,u);return l===null?null:Rr(o,l,e)}function Rr(e,t,n){let o=new Map;e.forEach((i,a)=>{let u=`${i.factor}:${i.power}`,l=o.get(u)??[];l[i.degree]=t[a],o.set(u,l);});let r=[];for(let[i,a]of o){let[u,l$1]=i.split(":").map(Number),s=[...a].map(p=>p??a$1);s.every(l)||r.push({numerator:s,base:n[u].base,power:l$1});}return r}function xe(e,t){let n=new Map;return e.forEach((o,r)=>{l(o)||n.set(r===0?"":r===1?t:`${t}^${r}`,o);}),n.size===0?p(a$1):E({terms:n,vars:e.length>1?[t]:[]})}function On(e){let t=lt(e);if(t===null)return e;let n=ut(t.numerator,t.denominator,t.variable);if(n===null||n.terms.length===0)return e;let o=n.polynomial.length>0?xe(n.polynomial,t.variable):null;for(let r$1 of n.terms){let i=xe(r$1.base,t.variable),a=r$1.power===1?i:r(i,p({n:BigInt(r$1.power),d:1n})),u=Ar(r$1.numerator),l=u?r$1.numerator.map(p=>j(p)):r$1.numerator,s={kind:"div",left:xe(l,t.variable),right:a};o===null?o=u?{kind:"neg",operand:s}:s:o={kind:u?"sub":"add",left:o,right:s};}return o===null?e:Q$1(o)}function Ar(e){return e.some(t=>t.n<0n)&&e.every(t=>t.n<=0n)}function lt(e){if(e.kind!=="div")return null;let t=C(e.left),n=C(e.right);if(t===null||n===null)return null;let o=A(n);return o===null||t.vars.some(r=>r!==o)?null:{numerator:B$1(t,o),denominator:B$1(n,o),variable:o}}var st=16;function Cn(){return p(a$1)}function X(){return p(b$2)}function xr(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:X(),right:r(s("cos",[t]),p(2))};case "exp":return s("exp",[t]);case "log":return {kind:"div",left:X(),right:t};case "sqrt":return {kind:"div",left:X(),right:{kind:"mul",left:p(2),right:s("sqrt",[t])}};case "asin":return {kind:"div",left:X(),right:s("sqrt",[Dn(t)])};case "acos":return {kind:"neg",operand:{kind:"div",left:X(),right:s("sqrt",[Dn(t)])}};case "atan":return {kind:"div",left:X(),right:vr(t)};case "sinh":return s("cosh",[t]);case "cosh":return s("sinh",[t]);case "tanh":return {kind:"div",left:X(),right:r(s("cosh",[t]),p(2))};case "abs":return s("sign",[t]);default:return null}}function Dn(e){return {kind:"sub",left:X(),right:r(e,p(2))}}function vr(e){return {kind:"add",left:X(),right:r(e,p(2))}}function ve(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>st)throw c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT",`A derivative order above ${st} is not supported.`,{limit:st});let o=Q$1(e);for(let r=0;r<n;r++)o=Q$1(P(o,t));return o}function P(e,t){switch(e.kind){case "const":case "complex":return Cn();case "var":return e.name===t?X():Cn();case "add":return {kind:"add",left:P(e.left,t),right:P(e.right,t)};case "sub":return {kind:"sub",left:P(e.left,t),right:P(e.right,t)};case "neg":return {kind:"neg",operand:P(e.operand,t)};case "mul":return {kind:"add",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}};case "div":return {kind:"div",left:{kind:"sub",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}},right:r(e.right,p(2))};case "pow":return Mr(e,t);case "call":{if(e.args.length!==1)return ct(e,t);let n=xr(e.name,e.args[0]);return n===null?ct(e,t):{kind:"mul",left:n,right:P(e.args[0],t)}}}}function Mr(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:P(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:P(e.exponent,t)}:ct(e,t)}function ct(e,t){return s("der",[e,q$1(t)])}function Pn(e,t){let n=C(e);if(n===null||n.vars.filter(u=>u!==t).length>0||z(n,t)>1)return null;let r=B$1(n,t),i=r[0]??{n:0n,d:1n},a=r[1]??{n:0n,d:1n};return l(a)?null:{slope:a,intercept:i}}function Ir(e,t){let n=C(e);if(n===null)return null;let o=n.vars.filter(a=>a!==t);if(o.length>0)return {ok:false,reason:`it involves more than one unknown (${o.join(", ")})`};let r$1=B$1(n,t),i$1=p(0);return r$1.forEach((a,u)=>{if(l(a))return;let l$1=u+1,s=i(a,{n:BigInt(l$1),d:1n}),p$1={kind:"mul",left:p(s),right:l$1===1?q$1(t):r(q$1(t),p(l$1))};i$1={kind:"add",left:i$1,right:p$1};}),{ok:true,value:Q$1(i$1)}}function Er(e,t){if(e.kind!=="call"||e.args.length!==1)return null;let n=Pn(e.args[0],t);if(n===null)return null;let o=e.args[0],r=i=>Q$1({kind:"div",left:i,right:p(n.slope)});switch(e.name){case "exp":return {ok:true,value:r(s("exp",[o]))};case "sin":return {ok:true,value:r({kind:"neg",operand:s("cos",[o])})};case "cos":return {ok:true,value:r(s("sin",[o]))};case "log":return {ok:true,value:r({kind:"sub",left:{kind:"mul",left:o,right:s("log",[o])},right:o})};default:return null}}function Sr(e,t){if(e.kind!=="div"||e.left.kind!=="const"||!mt(e.left.value))return null;let n=Pn(e.right,t);if(n!==null)return {ok:true,value:Q$1({kind:"div",left:s("log",[e.right]),right:p(n.slope)})};let o=C(e.right);if(o!==null&&o.vars.length===1&&o.vars[0]===t){let r=B$1(o,t);if(r.length===3&&mt(r[0])&&l(r[1])&&mt(r[2]))return {ok:true,value:s("atan",[q$1(t)])}}return null}function mt(e){return e.n===1n&&e.d===1n}function kr(e,t){let n=lt(e);if(n===null||n.variable!==t)return null;let o=ut(n.numerator,n.denominator,t);if(o===null)return null;let r=o.polynomial.length>0?Vr(o.polynomial,t):p(0);for(let i of o.terms){let a=_r(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"};r={kind:"add",left:r,right:a};}return {ok:true,value:Q$1(r)}}function _r(e,t){let n=e.base.length-1,o=xe(e.base,t);if(n===1){let r$1=e.numerator[0]??a$1;if(e.power===1)return {kind:"mul",left:p(r$1),right:s("log",[o])};let i$1=e.power-1,a=i(r$1,{n:BigInt(-i$1),d:1n});return {kind:"div",left:p(a),right:r(o,p({n:BigInt(i$1),d:1n}))}}return n!==2||e.power!==1?null:Tr(e,t,o)}function Tr(e,t,n){let o=e.numerator[0]??a$1,r=e.numerator[1]??a$1,[i,a]=e.base,u={n:1n,d:2n},l$1=h(a,u),s$1={kind:"mul",left:p(h(r,u)),right:s("log",[n])},p$1=g(o,h(r,l$1));if(l(p$1))return s$1;let h$1=O(g(i,h(l$1,l$1))),N={kind:"add",left:q$1(t),right:p(l$1)},S={kind:"mul",left:{kind:"div",left:p(p$1),right:h$1},right:s("atan",[{kind:"div",left:N,right:h$1}])};return l(r)?S:{kind:"add",left:s$1,right:S}}function Vr(e,t){let n=p(0);return e.forEach((o,r$1)=>{if(l(o))return;let i$1=r$1+1,a=i(o,{n:BigInt(i$1),d:1n}),u={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:u};}),n}function Me(e,t){let n=Q$1(e);if(!u$1(n).has(t))return {ok:true,value:Q$1({kind:"mul",left:n,right:q$1(t)})};let o=Ir(n,t);if(o!==null)return o;let r=Er(n,t);if(r!==null)return r;let i=Sr(n,t);if(i!==null)return i;let a=kr(n,t);if(a!==null)return a;if(n.kind==="add"||n.kind==="sub"){let u=Me(n.left,t);if(!u.ok)return u;let l=Me(n.right,t);return l.ok?{ok:true,value:Q$1({kind:n.kind,left:u.value,right:l.value})}:l}if(n.kind==="mul"&&n.left.kind==="const"){let u=Me(n.right,t);return u.ok?{ok:true,value:Q$1({kind:"mul",left:n.left,right:u.value})}:u}return {ok:false,reason:"no elementary antiderivative is known for this expression"}}var ft=16;function Ln(e,t,n,o){if(o<0||!Number.isInteger(o)||o>ft)throw c.execution("SYMBOLIC_TAYLOR_DEGREE_LIMIT",`A Taylor degree must be a whole number from 0 to ${ft}.`,{limit:ft});let r$1=p(n),i$1=1n,a=p(a$1);for(let u=0;u<=o;u++){u>0&&(i$1*=BigInt(u));let l$1=ve(e,t,u),s=Q$1(v$1(l$1,t,r$1));if(s.kind!=="const")throw c.execution("SYMBOLIC_TAYLOR_INEXACT",`The derivative of order ${u} does not reduce to an exact number at the expansion point, so this series cannot be computed exactly.`,{order:u});let p$1=i(s.value,{n:i$1,d:1n});if(l(p$1))continue;let h=l(n)?q$1(t):{kind:"sub",left:q$1(t),right:r$1},N=u===0?p(1):u===1?h:r(h,p(u));a={kind:"add",left:a,right:{kind:"mul",left:p(p$1),right:N}};}return Q$1(a)}function Fn(e,t){return e.map(n=>t.map(o=>ve(n,o)))}function wr(){let e=globalThis.Temporal;return e??void 0}function Un(e){if(e!==void 0&&typeof e!="string")return e;if(e==="date")return b;let t=wr();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 Or(e={}){return {pluginFunctions:{},opRegistry:new Re,pluginFunctionOwners:{},networkEnabled:e.networkEnabled??true,calendar:Un(e.calendar)}}var $n=Or();var Cr={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},qn=1970,Yn=2026;function Bn(e){return Cr[Math.trunc(e)]}function dt(e,t){let n=Bn(e),o=Bn(t);if(!(n===void 0||o===void 0||n===0))return o/n}function Ba(e,t,n){let o=dt(t,n);if(o!==void 0)return e*o}function Dr(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 Pr=0;function pt(e){if(e.type===6&&e.unit!==void 0){let t=a[e.unit.toLowerCase()];if(t!==void 0&&t[0]===Pr)return e.toNumber()*t[1]}return e.toNumber()}function Lr(e,t){if(t===1)return e;let n=`${e}s`;return a[n.toLowerCase()]===void 0?e:n}function Gn(e,t){let n$1,o=false;for(let r of e){if(Number.isNaN(r.toNumber())){o=true;continue}if(n$1===void 0){n$1=r;continue}let{lv:i,rv:a,sameMeasure:u}=ge(n$1,r);if(!u){let l=n$1.type===6?n$1.unit:void 0,s=r.type===6?r.unit:void 0,p=$e(l,s,"compared");return P$1("INCOMPATIBLE_UNITS",p??`Cannot compare incompatible units: ${l??"?"} and ${s??"?"}`)}(t?a>i:a<i)&&(n$1=r);}return o?n(NaN):n$1===void 0?n(t?-1/0:1/0):n$1.type===6?n$1:n(n$1.toNumber())}function Be(e,t){return e.type===6&&e.unit!==void 0?u(t,e.unit):n(t)}function jn(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 qe(e,ra(a),n,a)}let o=e.toNumber();if(!Number.isFinite(o))return qe(e,o,n);let r=Math.pow(10,n),i=o*r;return !Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER?qe(e,o,n):qe(e,Math.round(i)/r,n)}function qe(e,t,n$1,o){let r=e.type===6&&e.unit!==void 0?u(t,e.unit):n(t);return r.decimalPlaces=n$1,o!==void 0&&(r.exact=o),r}function Kn(e,t,n){if(Number.isFinite(e)&&Number.isFinite(t))return null;let o=Number.isFinite(e)?t:e;return P$1("INVALID_INTEGER_OPERAND",`${n} needs two whole numbers, and ${Number.isNaN(o)?"one of them has no value":"one of them is infinite"}`)}function Xn(e,t){let n=e,o=t;for(;o!==0;){let r=o;o=n%o,n=r;}return n}function Fr(e){let t=e.length;if(t===0)return 0;let n=e.reduce((o,r)=>o+r,0)/t;return e.reduce((o,r)=>o+(r-n)*(r-n),0)}function Ye(e,t){let n=e.length;if(n===0)return 0;let o=t?n-1:n;return o<=0?0:Fr(e)/o}var Ur=12,$r=new Set(["month","months","mo","mos","mth","mths"]);function Z(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`):$r.has(e$1.unit)?e$1.toNumber()/Ur:e(e$1.toNumber(),e$1.unit,"year")}var cu={0:e=>{let t=e[0].toNumber();return t>=0?n(Math.sqrt(t)):w(s("sqrt",[p(t)]))},1:e=>e[0].type===7?ca(e[0].value):Be(e[0],Math.abs(e[0].toNumber())),2:e=>n(Math.sin(pt(e[0]))),3:e=>n(Math.cos(pt(e[0]))),4:e=>n(Math.tan(pt(e[0]))),5:e=>n(Math.log(e[0].toNumber())),6:e=>Be(e[0],Math.ceil(e[0].toNumber())),7:e=>Be(e[0],Math.floor(e[0].toNumber())),8:e=>e.length>=2?jn(e[0],e[1].toNumber()):Be(e[0],Math.round(e[0].toNumber())),9:e=>Gn(e,false),10:e=>Gn(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(rt(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())),o=Kn(t,n$1,"gcd");return o||n(Xn(t,n$1))},39:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n$1=Math.trunc(Math.abs(e[1].toNumber())),o=Kn(t,n$1,"lcm");return o||(t===0||n$1===0?n(0):n(t/Xn(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 o=1;for(let r=0;r<n$1;r++)if(o*=t-r,!Number.isFinite(o))return P$1("PERMUTATION_OVERFLOW",`permutation: P(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${r+1} of ${n$1} factors)`);return n(o)},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 o=Math.min(n$1,t-n$1),r=1;for(let i=0;i<o;i++)if(r=r*(t-i)/(i+1),!Number.isFinite(r))return P$1("COMBINATION_OVERFLOW",`combination: C(${t}, ${n$1}) exceeds the maximum representable double (it passed it after ${i+1} of ${o} steps)`);return n(Math.round(r))},42:e=>{if(e.length===0)return n(0);let t=e.reduce((n,o)=>n+o.toNumber(),0);return n(t/e.length)},43:e=>{if(e.length===0)return n(0);let t=e.map(o=>o.toNumber()).sort((o,r)=>o-r),n$1=Math.floor(t.length/2);return n(t.length%2===0?(t[n$1-1]+t[n$1])/2:t[n$1])},44:e=>n(e.reduce((t,n)=>t+n.toNumber(),0)),45:e=>n(e.length),46:e=>{let[t,n$1,o]=e,{lv:r,rv:i}=ge(t,n$1);if(r===0)return P$1("PROPORTION_DIVIDE_BY_ZERO",`Cannot compute proportion: "${t.value}" is zero`);let a=o.toNumber()*(i/r);return o.type===6?u(a,o.unit):n(a)},47:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return n$1>o?P$1("INVALID_RANGE",`clamp: invalid range, ${n$1} is greater than ${o}`):n(Math.min(Math.max(t,n$1),o))},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(),o=Z(e[2]);if(typeof o!="number")return o;if(1+n$1<=0)return P$1("INVALID_RATE",`compoundInterest: rate ${n$1} makes (1 + rate) non-positive`);let r=t*Math.pow(1+n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},52:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=Z(e[2]);if(typeof o!="number")return o;if(1+n$1<=0)return P$1("INVALID_RATE",`interestEarned: rate ${n$1} makes (1 + rate) non-positive`);let r=t*(Math.pow(1+n$1,o)-1);return e[0].type===6?u(r,e[0].unit):n(r)},53:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=Z(e[2]);return typeof o!="number"?o:t<=0||n$1<=0?P$1("INVALID_RANGE","compoundInterestRate: principal and futureValue must both be positive"):o<=0?P$1("INVALID_RANGE","compoundInterestRate: years must be greater than 0"):n(Math.pow(n$1/t,1/o)-1)},54:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=e[2].toNumber();return t<=0||n$1<=0?P$1("INVALID_RANGE","compoundInterestYears: principal and futureValue must both be positive"):1+o<=0||o===0?P$1("INVALID_RATE",`compoundInterestYears: rate ${o} is not usable (must be > -1 and not 0)`):n(Math.log(n$1/t)/Math.log(1+o))},55:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=Z(e[2]);if(typeof o!="number")return o;let r=e[3].toNumber();if(t<=0)return P$1("INVALID_RANGE","loanRepayment: principal must be positive");if(o<=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(r<0)return P$1("INVALID_RANGE","loanRepayment: periodsPerYear must not be negative");let{totalRepayment:i}=ht(t,n$1,o),a=r===0?i:i/(o*r);return e[0].type===6?u(a,e[0].unit):n(a)},56:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=Z(e[2]);if(typeof o!="number")return o;let r=e[3].toNumber();if(t<=0)return P$1("INVALID_RANGE","loanInterest: principal must be positive");if(o<=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(r<0)return P$1("INVALID_RANGE","loanInterest: periodsPerYear must not be negative");let{totalInterest:i}=ht(t,n$1,o),a=r===0?i:i/(o*r);return e[0].type===6?u(a,e[0].unit):n(a)},57:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=Z(e[2]);if(typeof o!="number")return o;if(t<=0)return P$1("INVALID_RANGE","monthlyPayment: principal must be positive");if(o<=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:r}=ht(t,n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},58:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?Sn(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?_n(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(),o=e[2].toNumber(),r=dt(n$1,o);if(r===void 0)return P$1("INFLATION_YEAR_OUT_OF_RANGE",`inflationAdjust: fromYear ${n$1} or toYear ${o} is outside the bundled CPI table's range (${qn}-${Yn})`);let i=t*r;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(rt(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 o=2;o<=t;o++)n$1*=o;return n(n$1)},63:e=>e[0].type===7?ba(e[0].value):e[0],64:e=>e[0].type===7?ca(e[0].value):n(e[0].toNumber()),65:e=>e[0].type===7?da(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 o=r=>r.type===7?r.value:{rows:1,cols:1,data:[r.toNumber()],hasSymbolic:false};return _(o(t),o(n$1))},67:e=>{let[t]=e;return t.type!==9?t:w(F(t.value))},68:e=>{let[t]=e;return t.type!==9?t:w(on(t.value))},69:e=>{let[t,n,o]=e;return o?.type!==3?P$1("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown."):hn(t,n,o.value)},70:e=>{let[t,n,o]=e,r=yt(n,"der");if(typeof r!="string")return r;let i=V(t);return i===null?P$1("SYMBOLIC_NONFINITE_OPERAND","der needs an expression with an exact value."):w(ve(i,r,o?.toNumber()??1))},71:e=>{let[t,n]=e,o=yt(n,"integral");if(typeof o!="string")return o;let r=V(t);if(r===null)return P$1("SYMBOLIC_NONFINITE_OPERAND","integral needs an expression with an exact value.");let i=Me(r,o);return i.ok?w(i.value):P$1("SYMBOLIC_INTEGRAL_UNSUPPORTED",`Cannot integrate this: ${i.reason}.`)},72:e=>{let[t,n,o,r]=e,i=yt(n,"taylor");if(typeof i!="string")return i;let a=V(t),u=V(o);return a===null||u===null||u.kind!=="const"?P$1("SYMBOLIC_NONFINITE_OPERAND","taylor needs an expression and an exact expansion point."):w(Ln(a,i,u.value,r.toNumber()))},73:e=>{let t=[];for(let a of e){let u=V(a);if(u===null)return P$1("SYMBOLIC_NONFINITE_OPERAND","jacobian needs expressions with exact values.");t.push(u);}let n=new Set;for(let a of t)for(let u of u$1(a))n.add(u);let o=[...n].sort();if(o.length===0)return P$1("SYMBOLIC_JACOBIAN_NO_VARIABLES","jacobian needs at least one unknown to differentiate against.");let r=Fn(t,o),i=[];for(let a of r)for(let u of a)i.push(W(u));return C$1(r.length,o.length,Y(r.length,o.length,i))},74:e=>w(w$1(o(a$1,d(e[0].toNumber())))),75:e=>bt("conj",e[0]),76:e=>bt("re",e[0]),77:e=>bt("im",e[0]),78:e=>{let t=e[0];return t.type!==9?t:w(J$1(t.value))},79:e=>{let t=e[0];return t.type!==9?t:w(On(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 o=t-t/(1+n$1);return e[0].type===6?Tn(e[0],e[0].unit,n$1)??u(o,e[0].unit):n(o)},86:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber();return e[0].type===6?En(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 o=a[t$1.toLowerCase()],r=a[n.toLowerCase()];if(o===void 0||r===void 0)return P$1("UNKNOWN_UNIT",`${t$1} and ${n}: one of these is not a unit`);if(o[0]!==r[0])return P$1("INCOMPATIBLE_UNITS",`${t$1} and ${n} measure different things`);if(r[1]>=o[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,u=i.toNumber()*(a$1?.[1]??o[1]),l=Math.floor(u/o[1]),s=Math.round((u-l*o[1])/r[1]*1e3)/1e3;return t(`${l} ${t$1} ${s} ${n}`)},95:e=>{let t=e[0],n=String(e[1].value),o=t.type===6&&t.unit!==void 0?t.unit:"";return o.includes("/")?P$1("INVALID_RATE_UNIT",`${o}/${n}: that is already a rate`):u(t.toNumber(),`${o}/${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 s=j$1(t.toNumber(),t.unit,n$1.toNumber(),n$1.unit);if(s!==null)return Dr(s)}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 o=n$1.unit.indexOf("/"),r=n$1.unit.slice(0,o),i=n$1.unit.slice(o+1),a$1=t.type===6?t.unit:void 0,u$1=a[i.toLowerCase()],l=a$1===void 0?void 0:a[a$1.toLowerCase()];if(l!==void 0&&u$1!==void 0&&l[0]===u$1[0]){let p=t.toNumber()*l[1]/u$1[1]*n$1.toNumber();return r===""?n(p):u(p,r)}if(a$1!==void 0&&a$1===r){let s=t.toNumber()/n$1.toNumber();return u(s,Lr(i,s))}if(a$1===void 0){let s=t.toNumber()*n$1.toNumber();return r===""?n(s):u(s,r)}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(),o=Z(e[2]);if(typeof o!="number")return o;let r=e[3].toNumber();if(r<=0)return P$1("INVALID_RATE",`compounding: ${r} periods per year is not a period`);if(1+n$1/r<=0)return P$1("INVALID_RATE",`compounding: rate ${n$1} makes each period non-positive`);let i=t*Math.pow(1+n$1/r,r*o);return e[0].type===6?u(i,e[0].unit):n(i)},81:e=>{let t=e[0].toNumber(),n$1=e[1].toNumber(),o=Z(e[2]);if(typeof o!="number")return o;let r=e[3].toNumber();if(r<=0||1+n$1/r<=0)return P$1("INVALID_RATE",`compounding: rate ${n$1} over ${r} periods per year is not usable`);let i=t*(Math.pow(1+n$1/r,r*o)-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(),o=Z(e[2]);if(typeof o!="number")return o;if(1+n$1<=0)return P$1("INVALID_RATE",`presentValue: rate ${n$1} makes (1 + rate) non-positive`);let r=t/Math.pow(1+n$1,o);return e[0].type===6?u(r,e[0].unit):n(r)},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(),o=Z(e[2]);return typeof o!="number"?o:t<=0?P$1("INVALID_RATE","annual return: the amount invested must be positive"):o<=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/o)-1)},97:e=>jn(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(Vn(e[0],t))},99:e=>{let t=e[0].toNumber(),n$1=Br(e[1]),o=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(o<0)return P$1("INVALID_RATE","savings goal: the rate must not be negative.");let r=qr(t,o/12,n$1);return e[0].type===6?u(r,e[0].unit):n(r)},100:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=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(r<0)return P$1("INVALID_RATE","savings goal: the rate must not be negative.");let a=Yr(t,n,r/o);return u(a,i)},101:e=>n(Math.sqrt(Ye(e.map(t=>t.toNumber()),false))),102:e=>n(Math.sqrt(Ye(e.map(t=>t.toNumber()),true))),103:e=>n(Ye(e.map(t=>t.toNumber()),false)),104:e=>n(Ye(e.map(t=>t.toNumber()),true)),105:e=>{if(e.length===0)return n(0);let t=e.map(n=>n.toNumber());return n(Math.max(...t)-Math.min(...t))},106:e=>{if(e.length===0)return n(0);let t=new Map,n$1=e[0].toNumber(),o=0;for(let r of e){let i=r.toNumber(),a=(t.get(i)??0)+1;t.set(i,a),a>o&&(o=a,n$1=i);}return n(n$1)},107:e=>{let t=0,n$1=0;for(let o=0;o+1<e.length;o+=2){let r=e[o].toNumber(),i=e[o+1].toNumber();t+=r*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 Br(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 qr(e,t,n){return t===0?e/n:e*t/(Math.pow(1+t,n)-1)}function Yr(e,t,n){let o=n===0?e/t:Math.log(1+e*n/t)/Math.log(1+n);return Math.ceil(o-1e-9)}function bt(e,t){let n=V(t);return n===null?P$1("SYMBOLIC_NONFINITE_OPERAND",e+" needs a value with an exact number."):w(s(e,[n]))}function yt(e,t){return e?.type!==3?P$1("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown.`):e.value}function ht(e,t,n){let o=n*12,r=t/12,i=r===0?e/o:e*r/(1-Math.pow(1+r,-o)),a=i*o,u=a-e;return {monthlyPayment:i,totalRepayment:a,totalInterest:u}}var mu=$n.pluginFunctions,Zn=65535,Hn=0;function Gr(){if(Hn>Zn)throw c.config("PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",`allocatePluginFunctionIndex: pool exhausted (max ${Zn+1} allocations).`);return Hn++}var Wn=new Map;function fu(e){let t=Wn.get(e);return t===void 0&&(t=Gr(),Wn.set(e,t)),t}var Nt=new Map;function du(e,t){let n=e.toLowerCase(),o=Nt.get(n);o&&o!==t&&console.warn(`[asConverterRegistry] Converter name "${n}" is already registered \u2014 overwriting.`),Nt.set(n,t);}function pu(e){Nt.delete(e.toLowerCase());}var Ge=class Ge{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 o=this.values.get(t);this.values.set(t,n),!(o!==void 0&&jr(o,n))&&this.notify(t,n);}notify(t,n){if(!(this.notifyDepth>=Ge.MAX_NOTIFY_DEPTH)){this.notifyDepth++;try{for(let o of this.listeners)o(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;}};Ge.MAX_NOTIFY_DEPTH=64;var gt=Ge;function jr(e,t){if(e.type!==t.type||e.unit!==t.unit||(e.timedOut??false)!==(t.timedOut??false))return false;let n=e.value,o=t.value;if(Array.isArray(n)||Array.isArray(o)){if(!Array.isArray(n)||!Array.isArray(o)||n.length!==o.length)return false;for(let r=0;r<n.length;r++)if(!Object.is(n[r],o[r]))return false;return true}return Object.is(n,o)}var yu=new gt;function hu(e){return `global:${e}`}var Kr={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"},Xr={"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"},Zr={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"},Hr={...Kr,...Xr,...Zr};function gu(e){let t=e.trim().toLowerCase();return t==="utc"||t==="gmt"?"UTC":Hr[t]??null}export{Yn as A,Ba as B,cu as C,mu as D,Gr as E,fu as F,Nt as G,du as H,pu as I,yu as J,hu as K,Xr as L,Hr as M,gu as N,Ae as a,En as b,Sn as c,pn as d,Vi as e,wi as f,Oi as g,Ci as h,hn as i,ge as j,ji as k,Ki as l,Xi as m,gn as n,Zi as o,Hi as p,rt as q,Wi as r,Qi as s,zi as t,Ji as u,Re as v,na as w,Or as x,$n as y,qn as z};//# sourceMappingURL=chunk-ETQBU454.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-ETQBU454.js.map
|