solve-engine 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BytecodeBuilder-DGGeByAP.d.cts → BytecodeBuilder-BGq9ZiO3.d.cts} +2 -1
- package/dist/{BytecodeBuilder-DGGeByAP.d.ts → BytecodeBuilder-BGq9ZiO3.d.ts} +2 -1
- package/dist/{PackageCompatibility-UsSZIfHs.d.ts → PackageCompatibility-4QtIErfx.d.ts} +1 -1
- package/dist/{PackageCompatibility-cEClSSkz.d.cts → PackageCompatibility-CCdud__Q.d.cts} +1 -1
- package/dist/{PackageRegistry-B3yJHSxX.d.ts → PackageRegistry-B7wkfSrY.d.ts} +5 -5
- package/dist/{PackageRegistry-BsLmAVZJ.d.cts → PackageRegistry-Hx85XD01.d.cts} +5 -5
- package/dist/{Parselet-C4Wu055_.d.cts → Parselet-CTNpfuEB.d.cts} +2 -2
- package/dist/{Parselet-B-zoPrTa.d.ts → Parselet-DONNUpur.d.ts} +2 -2
- package/dist/{ScopeManager-DkpnlKuz.d.ts → ScopeManager-BkbDXK_R.d.ts} +3 -3
- package/dist/{ScopeManager-t6SnP6Ce.d.cts → ScopeManager-Cvgypcu4.d.cts} +3 -3
- package/dist/{VMCheckpoints-CsHmQVaD.d.ts → VMCheckpoints-9zBQnTsN.d.ts} +3 -3
- package/dist/{VMCheckpoints-C_jQvABf.d.cts → VMCheckpoints-CBMGiSqw.d.cts} +3 -3
- package/dist/{Value-CCi_Eecs.d.cts → Value-D1XlMwe2.d.cts} +40 -5
- package/dist/{Value-CCi_Eecs.d.ts → Value-D1XlMwe2.d.ts} +40 -5
- package/dist/chunk-3AVWA5IZ.cjs +2 -0
- package/dist/chunk-3AVWA5IZ.cjs.map +1 -0
- package/dist/chunk-3DD2RVBI.cjs +3 -0
- package/dist/chunk-3DD2RVBI.cjs.map +1 -0
- package/dist/{chunk-RDMJNRDO.js → chunk-4XTD4B77.js} +3 -3
- package/dist/{chunk-RDMJNRDO.js.map → chunk-4XTD4B77.js.map} +1 -1
- package/dist/chunk-5FGOIDLS.cjs +2 -0
- package/dist/chunk-5FGOIDLS.cjs.map +1 -0
- package/dist/chunk-5OIXCVB2.js +3 -0
- package/dist/chunk-5OIXCVB2.js.map +1 -0
- package/dist/{chunk-NGJMCVH4.cjs → chunk-B4P4M4ZW.cjs} +3 -3
- package/dist/{chunk-NGJMCVH4.cjs.map → chunk-B4P4M4ZW.cjs.map} +1 -1
- package/dist/{chunk-TWC7K3ZX.js → chunk-GHW2X7PS.js} +2 -2
- package/dist/{chunk-TWC7K3ZX.js.map → chunk-GHW2X7PS.js.map} +1 -1
- package/dist/chunk-GKDZ7TSX.cjs +2 -0
- package/dist/chunk-GKDZ7TSX.cjs.map +1 -0
- package/dist/{chunk-7RTKJMYS.js → chunk-HMEZJXLX.js} +2 -2
- package/dist/{chunk-7RTKJMYS.js.map → chunk-HMEZJXLX.js.map} +1 -1
- package/dist/{chunk-FDE5HWDI.cjs → chunk-HOQU47MF.cjs} +2 -2
- package/dist/{chunk-FDE5HWDI.cjs.map → chunk-HOQU47MF.cjs.map} +1 -1
- package/dist/chunk-IO374J6Z.js +2 -0
- package/dist/chunk-IO374J6Z.js.map +1 -0
- package/dist/{chunk-D5MTMRHS.cjs → chunk-KSDTVFXA.cjs} +4 -4
- package/dist/{chunk-D5MTMRHS.cjs.map → chunk-KSDTVFXA.cjs.map} +1 -1
- package/dist/{chunk-YUJNMUKM.cjs → chunk-OVQ3V4CG.cjs} +2 -2
- package/dist/{chunk-YUJNMUKM.cjs.map → chunk-OVQ3V4CG.cjs.map} +1 -1
- package/dist/{chunk-XNIWQHXY.js → chunk-P6BLASAA.js} +2 -2
- package/dist/{chunk-XNIWQHXY.js.map → chunk-P6BLASAA.js.map} +1 -1
- package/dist/{chunk-AXMQG5TS.cjs → chunk-R7T3NGUE.cjs} +2 -2
- package/dist/{chunk-AXMQG5TS.cjs.map → chunk-R7T3NGUE.cjs.map} +1 -1
- package/dist/{chunk-CT5TC3JX.cjs → chunk-SOSUS2SK.cjs} +3 -3
- package/dist/chunk-SOSUS2SK.cjs.map +1 -0
- package/dist/chunk-SWKYVSMP.js +2 -0
- package/dist/chunk-SWKYVSMP.js.map +1 -0
- package/dist/chunk-T4Y5XOT2.js +3 -0
- package/dist/chunk-T4Y5XOT2.js.map +1 -0
- package/dist/{chunk-LOM3H5ZD.js → chunk-T52Y5G24.js} +4 -4
- package/dist/{chunk-LOM3H5ZD.js.map → chunk-T52Y5G24.js.map} +1 -1
- package/dist/{chunk-JFAJN3C2.cjs → chunk-VBSMA7WJ.cjs} +2 -2
- package/dist/chunk-VBSMA7WJ.cjs.map +1 -0
- package/dist/{chunk-RSF25YSJ.js → chunk-VYWGUMFW.js} +2 -2
- package/dist/{chunk-RSF25YSJ.js.map → chunk-VYWGUMFW.js.map} +1 -1
- package/dist/chunk-XTM4HTRB.js +2 -0
- package/dist/{chunk-LBNX7TXI.js.map → chunk-XTM4HTRB.js.map} +1 -1
- package/dist/{chunk-E6Z4NQAS.js → chunk-YNMMRH44.js} +2 -2
- package/dist/chunk-YNMMRH44.js.map +1 -0
- package/dist/chunk-Z5KBBQOJ.cjs +2 -0
- package/dist/{chunk-YFWAR766.cjs.map → chunk-Z5KBBQOJ.cjs.map} +1 -1
- package/dist/chunk-ZJPAPBP3.js +2 -0
- package/dist/chunk-ZJPAPBP3.js.map +1 -0
- package/dist/{chunk-N7N7MPMK.cjs → chunk-ZOOVGXMK.cjs} +2 -2
- package/dist/{chunk-N7N7MPMK.cjs.map → chunk-ZOOVGXMK.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.d.cts +8 -8
- package/dist/engine.d.ts +8 -8
- package/dist/engine.js +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.d.cts +1 -1
- package/dist/format.d.ts +1 -1
- package/dist/format.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/language.d.cts +7 -7
- package/dist/language.d.ts +7 -7
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +7 -7
- package/dist/packages.d.ts +7 -7
- package/dist/packages.js +1 -1
- package/dist/parser.cjs +1 -1
- package/dist/parser.d.cts +4 -4
- package/dist/parser.d.ts +4 -4
- package/dist/parser.js +1 -1
- package/dist/{pipeline-72QmQlGx.d.ts → pipeline-BH7BFOTJ.d.ts} +3 -3
- package/dist/{pipeline-DCQicwWX.d.cts → pipeline-DY0rhgQG.d.cts} +3 -3
- package/dist/resolvers.d.cts +2 -2
- package/dist/resolvers.d.ts +2 -2
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +7 -7
- package/dist/testing.d.ts +7 -7
- package/dist/testing.js +1 -1
- package/dist/uom.cjs +1 -1
- package/dist/uom.d.cts +2 -2
- package/dist/uom.d.ts +2 -2
- package/dist/uom.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.d.cts +7 -7
- package/dist/vm.d.ts +7 -7
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +22 -6
- package/dist/worker.d.ts +22 -6
- package/dist/worker.js +2 -2
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2HQWM5OB.js +0 -3
- package/dist/chunk-2HQWM5OB.js.map +0 -1
- package/dist/chunk-6G3PMEPA.js +0 -2
- package/dist/chunk-6G3PMEPA.js.map +0 -1
- package/dist/chunk-6INX773F.cjs +0 -2
- package/dist/chunk-6INX773F.cjs.map +0 -1
- package/dist/chunk-6ZNNPXXE.cjs +0 -3
- package/dist/chunk-6ZNNPXXE.cjs.map +0 -1
- package/dist/chunk-ANJPS6FF.cjs +0 -2
- package/dist/chunk-ANJPS6FF.cjs.map +0 -1
- package/dist/chunk-B5NBFGNP.js +0 -3
- package/dist/chunk-B5NBFGNP.js.map +0 -1
- package/dist/chunk-CT5TC3JX.cjs.map +0 -1
- package/dist/chunk-E6Z4NQAS.js.map +0 -1
- package/dist/chunk-EVAOPEO4.js +0 -2
- package/dist/chunk-EVAOPEO4.js.map +0 -1
- package/dist/chunk-JFAJN3C2.cjs.map +0 -1
- package/dist/chunk-LBNX7TXI.js +0 -2
- package/dist/chunk-PS272DZJ.cjs +0 -2
- package/dist/chunk-PS272DZJ.cjs.map +0 -1
- package/dist/chunk-QEYTENAK.js +0 -2
- package/dist/chunk-QEYTENAK.js.map +0 -1
- package/dist/chunk-YFWAR766.cjs +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c as c$2}from'./chunk-GHW2X7PS.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$1,m,n as n$1,g as g$1,q as q$3,f as f$2,u as u$1,o as o$1,s as s$1,j as j$2,r as r$2,l,b as b$2,c as c$6}from'./chunk-XTM4HTRB.js';import {c as c$5}from'./chunk-YAYBVVG2.js';import {b}from'./chunk-YNMMRH44.js';import {ea,T,U as U$1,X,S,Y,q as q$1,aa,ma,j as j$1,$,_,ia,ra,ua}from'./chunk-VYWGUMFW.js';import {n,g,j,a,O,c as c$3,P,I,e,C as C$1,F,L,x,y as y$1,w,u,t,v,r as r$1,M,G as G$1,k,J as J$1,f as f$1,Q,K,s,q as q$2,p as p$1,o,d,A,b as b$1,B}from'./chunk-IO374J6Z.js';import {c as c$4,e as e$1,i,h,f,a as a$2}from'./chunk-WGZ3FNHI.js';import {a as a$3}from'./chunk-2JMFUQZH.js';import {c as c$1,r,d as d$1}from'./chunk-MPB7KUN5.js';var Ct=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,o,u){let m=this.lineReads.get(a);if(m)for(let b of m){let h=this.consumers.get(b);h&&h.delete(a);}this.lineReads.set(a,new Set(o));for(let b of o)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(o)),this.writes.set(a,new Set(u));for(let b of u){let h=this.consumers.get(b);h&&h.delete(a);}}}registerLineDataSourceDependency(a,o,u){let m=JSON.stringify(u),b=`${o}:${m}`;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 o=new Set,u=[a];for(;u.length>0;){let m=u.pop(),b=this.consumers.get(m);if(b)for(let h of b){if(o.has(h))continue;o.add(h);let d=this.writes.get(h);if(d)for(let y of d)u.push(y);}}return o}getAffectedLinesInOrder(a){let o=this.getAffectedLines(a);if(o.size===0)return [];let u=new Map,m=new Map;for(let y of o)u.has(y)||u.set(y,0),m.has(y)||m.set(y,[]);let b=new Map;for(let y of o){let x=this.writes.get(y);if(x)for(let A of x)b.set(A,y);}for(let y of o){let x=this.lineReads.get(y);if(x)for(let A of x){let w=b.get(A);w!==void 0&&w!==y&&(m.get(w).push(y),u.set(y,(u.get(y)??0)+1));}}let h=[];for(let[y,x]of u)x===0&&h.push(y);if(h.length===0&&o.size>0){let y=Array.from(o).sort((x,A)=>x-A);h.push(y[0]);}let d=[];for(;h.length>0;){let y=h.shift();d.push(y);for(let x of m.get(y)??[]){let A=(u.get(x)??1)-1;u.set(x,A),A===0&&h.push(x);}}if(d.length<o.size){let y=new Set(d),x=Array.from(o).filter(A=>!y.has(A)).sort((A,w)=>A-w);d.push(...x);}return d}getAffectedLinesByDataSource(a,o){let u=JSON.stringify(o),m=`${a}:${u}`;return this.dataSourceConsumers.get(m)??new Set}removeLine(a){let o=this.lineReads.get(a);if(o){for(let m of o){let b=this.consumers.get(m);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 m of u)this.dataSourceConsumers.get(m)?.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,d]of this.consumers)a[h]=Array.from(d);let o={};for(let[h,d]of this.writes)o[h]=Array.from(d);let u={};for(let[h,d]of this.lineReads)u[h]=Array.from(d);let m={};for(let[h,d]of this.dataSourceDependencies)m[h]=Array.from(d);let b={};for(let[h,d]of this.dataSourceConsumers)b[h]=Array.from(d);return {consumers:a,writes:o,reads:u,dataSourceDeps:m,dataSourceConsumers:b}}clear(){this.consumers.clear(),this.dependencies.clear(),this.writes.clear(),this.lineReads.clear(),this.dataSourceDependencies.clear(),this.dataSourceConsumers.clear();}};var Ot=class{constructor(){this.definitions=new Map;}write(a,o,u){this.definitions.has(a)||this.definitions.set(a,[]);let m=this.definitions.get(a);m.push({line:o,expr:u}),m.sort((b,h)=>b.line-h.line);}read(a,o){let u=this.definitions.get(a);if(u){for(let m=u.length-1;m>=0;m--)if(u[m].line<=o)return u[m].expr.lastResult}}invalidateDownstream(a,o){let u=this.definitions.get(a);if(!u)return;let m=u.findIndex(b=>b.line===o);m!==-1&&u.splice(m+1);}clear(){this.definitions.clear();}};function Jt(r){let a=new Date(r).getDay();return a===0||a===6}function vt(r,a){return Jt(r)?false:a?!a(r):true}function Ut(r){let a=new Date(r);return new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime()}function Rt(r,a,o,u){let m=Math.trunc(Math.abs(a)),b=a>=0?1:-1,h=new Date(r),d=0;for(;m>0;){if(h.setDate(h.getDate()+b),d++,d>u)return null;vt(h.getTime(),o)&&m--;}return h.getTime()}function Vt(r,a,o,u){let m=Ut(Math.min(r,a)),b=Ut(Math.max(r,a)),h=Math.round((b-m)/864e5);if(h>u)return null;let d=0,y=new Date(m);for(let x=0;x<=h;x++)vt(y.getTime(),o)&&d++,y.setDate(y.getDate()+1);return d}var Zt={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 ke(r){return r===1?"1 argument":`${r} arguments`}function en(r){return r.max===1/0?`at least ${ke(r.min)}`:r.min===r.max?ke(r.min):`${r.min} to ${ke(r.max)}`}function Bt(r,a){let o=Zt[r];if(o!==void 0&&!(a>=o.min&&a<=o.max))return c$1.execution("BUILTIN_ARITY_MISMATCH",`${o.name}() takes ${en(o)}, but was given ${a===0?"none":ke(a)}`,{functionName:o.name,expectedMin:o.min,expectedMax:o.max,actual:a})}function jn(r,a=200,o=5e4,u=50,m=1e5,b=2e6,h=1e4,d=100,y$1=-100,x=y,A){let w=[],I=new Map,L=0,j,$,n$1=[],Q=new Map,W=new Map,K=new Map;return {push(f){w.length<a&&w.push(f);},getMaxStackDepth(){return a},getMaxCollectionSize(){return m},getMaxAllocatedElements(){return b},getMaxFunctionCalls(){return h},getMaxDateOffsetYears(){return d},getMinDateOffsetYears(){return y$1},isHoliday(f){return A?A(f):false},pop(){return w.length===0?n(0):w.pop()},popNumber(){return c(w).toNumber()},popString(){return q(c(w),"VM.popString()")},peek(){return w[w.length-1]},getStack(){return w},registry:r,getVar(f){if(n$1.length>0){let e=n$1[n$1.length-1].get(f);if(e!==void 0)return e}return I.get(f)},setVar(f,e){I.set(f,e);},deleteVar(f){I.delete(f);},pushCallFrame(f){if(n$1.length>=u)throw c$1.execution("FUNCTION_RECURSION_LIMIT_EXCEEDED",`Function call nesting exceeded maximum depth of ${u} (possible infinite recursion, e.g. f(x) = f(x))`,{maxFunctionRecursionDepth:u});n$1.push(f);},popCallFrame(){n$1.pop();},getCallFrame(){return n$1.length>0?n$1[n$1.length-1]:void 0},defineUserFunction(f,e,t){Q.set(f,{name:f,params:e,program:t});},getUserFunction(f){return Q.get(f)},hasUserFunction(f){return Q.has(f)},getVariableEntries(){return Array.from(I.entries())},getUserFunctionDefs(){return Array.from(Q.values())},defineEquation(f,e,t){W.set(f,{variable:f,factorNames:e,rhsProgram:t});},getEquation(f){return W.get(f)},hasEquation(f){return W.has(f)},defineScalarEquation(f,e,t){K.set(f,{variable:f,lhsProgram:e,rhsProgram:t});},getScalarEquation(f){return K.get(f)},hasScalarEquation(f){return K.has(f)},reset(){w.length=0,I.clear(),n$1.length=0,Q.clear(),W.clear(),K.clear(),L=0,$&&($(),$=void 0),j=void 0;},get activeSignal(){return j},set activeSignal(f){j=f;},get abortCurrent(){return $},set abortCurrent(f){$=f;},context:x,getMaxInstructions(){return o},getInstructionCount(){return L},incrementInstructions(f){if(L+=f,L>o)throw c$1.execution("INSTRUCTION_LIMIT_EXCEEDED",`Execution exceeded maximum of ${o} instructions`)}}}function tn(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 nn(r,a){return !Number.isInteger(a)||a<0?0:r.rows*r.cols*(1+(a<2?1:2*Math.floor(Math.log2(a))))}function c(r){if(r.length===0)throw c$1.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 jt="bytecode is caller input on this entry point: rebuild the program with the engine's compiler, or fix the hand-assembled stream";function an(r){return typeof r=="number"?b(r):r}function se(r,a,o,u,m,b={}){let h=an(a);return c$1.validation({code:r,message:`Malformed bytecode: ${h} ${o}`,expected:u,found:m,suggestion:jt,context:typeof a=="number"?{opcode:a,opcodeName:h,...b}:{site:h,...b}})}function U(r,a,o,u){if(a>=r.length)throw se("MALFORMED_BYTECODE_TRUNCATED",o,`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 je(r,a,o,u,m,b){let h=U(r,a,o,u);if(h>=m)throw se("MALFORMED_BYTECODE_CONSTANT_INDEX",o,`reads ${b} entry ${h}, which does not exist`,`an index below ${m}`,`${h}`,{index:h,poolSize:m,pool:b});return h}function z(r,a,o,u,m){return Se(o,U(r,a,u,m),u)}function Se(r,a,o){let u=r[a];if(typeof u!="string")throw se("MALFORMED_BYTECODE_CONSTANT_INDEX",o,`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 q(r,a,o){if(typeof r.value!="string")throw se("MALFORMED_BYTECODE_OPERAND_TYPE",a,`expected a ${o??"string"} on the stack`,o?`a string value holding the ${o}`:"a string value",`a ${g[r.type]??"unknown"} value`,o?{role:o,valueType:r.type}:{valueType:r.type});return r.value}function Ft(r,a,o){if(r!==0&&r!==1&&r!==2)throw se("MALFORMED_BYTECODE_BODY_KIND",o,`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 rn(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 on(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 Lt=64;function ze(r,a,o,u,m,b,h,d){let y=new Map;for(let A=0;A<r.length;A++)y.set(r[A],o[A]);u.pushCallFrame(y);let x;try{x=Ze(a,u,m,b,h,d);}finally{u.popCallFrame();}if(x.type==="pending")throw c$1.execution("MAP_REDUCE_ASYNC_UNSUPPORTED","map/reduce transform bodies calling an async operation (weather, stocks, currency, ...) aren't supported");if(x.type==="error")throw x.error;return x.value}function sn(r,a,o,u,m,b,h){let d=new Map(o.getCallFrame());d.set(r,J$1(q$1(r))),o.pushCallFrame(d);let y;try{y=Ze(a,o,u,m,b,h);}finally{o.popCallFrame();}if(y.type==="pending")throw c$1.execution("SYMBOLIC_ASYNC_UNSUPPORTED","an algebra verb's expression cannot call an async operation (weather, stocks, currency, ...)");if(y.type==="error")throw y.error;return y.value}function $t(r,a){if(r.type!==6||a.type!==6)return null;let o=r.unit,u=a.unit;if(o===void 0||u===void 0)return null;let m=o.indexOf("/"),b=u.indexOf("/");if(m<0||b<0||o.slice(0,m)!==u.slice(0,b))return null;let h=a$3[o.slice(m+1).toLowerCase()],d=a$3[u.slice(b+1).toLowerCase()];return h===void 0||d===void 0||h[0]!==d[0]?null:r.toNumber()*(d[1]/h[1])}function Pt(r,a){if(r.type!==6||a.type!==6)return null;let o=r.unit,u$1=a.unit;if(o===void 0||u$1===void 0||o.includes("/")||u$1.includes("/"))return null;let m=ua[o.toUpperCase()]!==void 0,b=ua[u$1.toUpperCase()]!==void 0;return m===b?null:u(r.toNumber()*a.toNumber(),m?o:u$1)}function Yt(r,a,o){if(r.type===5)return a.type===6&&a.unit!==void 0?c$6(a,a.unit,r.toNumber(),o):a.type!==5&&a.type!==0?null:M(r.toNumber()+o*a.toNumber());if(a.type!==5)return null;let u=1+o*a.toNumber();if(r.type===0){let m=r.toNumber()*u;return r.uncertainty!==void 0?q$2(m,Math.abs(r.uncertainty*u)):n(m)}return r.type===6&&r.unit!==void 0?c$6(r,r.unit,a.toNumber(),o):null}function un(r,a){let o=r.type===5?r:a.type===5?a:null;if(o===null)return null;let u=o===r?a:r;if(u.type!==0||u.uncertainty===void 0)return null;let m=o.toNumber();return q$2(u.toNumber()*m,Math.abs(u.uncertainty*m))}function ln(r,a){let o=r.type===6?r:a,u=r.type===6?a:r;return o.type!==6||o.unit===void 0||!c$5.isCurrency(o.unit)||u.type!==0&&u.type!==5||u.rational!==void 0?null:b$2(o,u.toNumber(),o.unit)}function cn(r,a){if(a.type===5&&r.type===0&&r.uncertainty!==void 0){let o=a.toNumber();return o===0?null:q$2(r.toNumber()/o,Math.abs(r.uncertainty/o))}if(r.type===5&&a.type===0&&a.uncertainty!==void 0){let o=a.toNumber();return o===0?null:q$2(r.toNumber()/o,Math.abs(r.toNumber()*a.uncertainty/(o*o)))}return null}function mn(r){if(r.type===6){let a=r.unit;if(a&&c$4(a)==="time")try{return e$1(r.toNumber(),a,"ms")}catch{}return 0}return r.toNumber()}var Xt=260;function zt(r,a,o){let u=Math.trunc(Math.abs(a)),b=(a>=0?1:-1)>0?o.getMaxDateOffsetYears():-o.getMinDateOffsetYears(),h=Math.floor(b*Xt);if(u>h)throw c$1.execution("DATE_OFFSET_LIMIT_EXCEEDED",`A date offset of ${u.toLocaleString("en-US")} workdays is about ${Math.round(u/Xt).toLocaleString("en-US")} years, past the limit of ${b} years for a workday offset`,{requestedWorkdays:u,limitYears:b,limitWorkdays:h});let d=h*7+7,y=Rt(r,a,x=>o.isHoliday(x),d);if(y===null)throw c$1.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:d});return y}var Gt=864e5,pn={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 fn(r,a){return new Date(r,a+1,0).getDate()}function Qt(r,a){let o=Math.trunc(a),u=new Date(r);u.setDate(u.getDate()+o);let m=u.getTime();return Number.isNaN(m)?r+a*Gt:m+(a-o)*Gt}function dn(r,a){let o=Math.trunc(a),u=new Date(r),m=u.getDate();u.setDate(1),u.setMonth(u.getMonth()+o),u.setDate(Math.min(m,fn(u.getFullYear(),u.getMonth())));let b=u.getTime(),h=e$1(1,"month","ms");return Number.isNaN(b)?r+a*h:b+(a-o)*h}function he(r,a,o,u){if(a.type===6&&a.unit!==void 0){let m=a.unit,b=o*a.toNumber();if(a$2(m))return zt(r,b,u);let h=pn[m];if(h!==void 0)return dn(r,b*h);if(c$4(m)==="time"){let d=0;try{d=e$1(1,m,"day");}catch{}if(Number.isInteger(d)&&d>=1)return Qt(r,b*d)}}return r+o*mn(a)}function Wt(r,a,o){let u$1=B(r.unit);if(a.type===6&&A(a.unit)){let m=B(a.unit);return m!==u$1?O("TIMECODE_FPS_MISMATCH",`Cannot combine timecodes at different frame rates (${u$1} fps vs ${m} fps)`):o===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()+o*a.toNumber(),r.unit);if(a.type===6&&a.unit&&c$4(a.unit)==="time"){let m=e$1(a.toNumber(),a.unit,"s");return u(r.toNumber()+o*m*u$1,r.unit)}return u(r.toNumber()+o*a.toNumber(),r.unit)}function ge(r){return r.type===10?r.value:r.toNumber()!==0}function Kt(r,a){let o=l(r,a);return O("INCOMPATIBLE_UNITS",o??`Cannot convert ${r} to ${a}: they do not measure the same thing`)}var Te=65536;function bn(r,a){if(!Number.isInteger(a)||a<0)return null;if(a===0)return 1;let o=Math.abs(r.toNumber());return o<=1?1:(o<=2?1:Math.log2(o))*a}function hn(r,a){let o=1n,u=r,m=a;for(;m>0n;)m%2n===1n&&(o*=u),m/=2n,m>0n&&(u*=u);return o}var Qe=Te;function Ht(r){let a=r<0n?-r:r;if(a===0n)return 0;let o=Number(a);return Number.isFinite(o)?Math.floor(Math.log2(o))+1:a.toString(16).length*4}function qt(r,a,o){let u=n$1(r),m=n$1(a);if(u===0n)return s(0n);let b=o*Number(m);if(b<=0||Ht(u)+b<=Qe)return s(o===1?u<<m:u>>m);throw c$1.execution("BIGINT_SHIFT_LIMIT_EXCEEDED",`Shifting by ${m} would build an exact integer of about ${(Ht(u)+b).toLocaleString("en-US")} bits, past the limit of ${Qe.toLocaleString("en-US")} bits`,{shift:String(m),limitBits:Qe})}function Je(r,a){let{numerator:o,denominator:u$1}=y$1(r.unit),m=c$4(u$1),b=c$4(a.unit);if(!m||m!==b)return O("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),d=r.toNumber()*h;return o?u(d,o):n(d)}function gn(r){if(Number.isNaN(r))return "NaN";if(!isFinite(r))return r>0?"Infinity":"-Infinity";let a=r<0,o=Math.abs(r),u=Math.floor(o),m=o-u;if(m<1e-9)return `${a?"-":""}${u}`;let b=0,h=1,d=1,y=0,x=m,A=1e6;for(let I=0;I<30;I++){let L=Math.floor(x+1e-9),j=L*h+b,$=L*y+d;if($>A||(b=h,h=j,d=y,y=$,Math.abs(m-h/y)<1e-9))break;let n=x-L;if(n<1e-9)break;x=1/n;}let w=u*y+h;return `${a?"-":""}${w}/${y}`}function yn(r){return r.d===1n?String(r.n):`${r.n}/${r.d}`}function Nn(r){let a=r.toNumber(),o=r.type===5?1+a:a;return `${Math.round(o*1e6)/1e6}x`}function xn(r){if(!Number.isFinite(r))return String(r);if(r===0)return "0e+0";let[a,o]=r.toExponential().split("e");return `${a.includes(".")?a.replace(/0+$/,"").replace(/\.$/,""):a}e${o}`}function Ze(r$3,a$2,o$2,u$2,m$1,b$2){let h$2=on(r$3);if(h$2)return {type:"error",error:c$1.validation({code:"MALFORMED_BYTECODE_PROGRAM",message:`Malformed bytecode: ${h$2}`,expected:"a BytecodeProgram with opcodes, numbers and strings",found:h$2,suggestion:jt})};let{opcodes:d$2,numbers:y,strings:x$1,userFunctionBodies:A$1,anonymousBodies:w$1}=r$3,I$1=0,L$1=0,j$3=a$2.getMaxInstructions(),$$1=a$2.getMaxStackDepth(),n$2=a$2.getStack(),Q$1=o$2?.hasCollectors??false,W=j();if(d$2.length===0)return {type:"value",value:n(0)};a(a$2);try{for(;I$1<d$2.length;){if(++L$1>j$3)throw c$1.execution("INSTRUCTION_LIMIT_EXCEEDED",`Execution exceeded maximum of ${j$3} instructions`);if(n$2.length>$$1)throw c$1.execution("STACK_LIMIT_EXCEEDED",`Execution exceeded maximum stack depth of ${$$1}`);let f$3=d$2[I$1++];if(Q$1){let e=n$2.map(t=>({type:t.type,value:t.value,unit:t.unit}));o$2.fireVmStep({type:c$2.VmStep,elapsedNs:0,expression:u$2??"",opcode:f$3,opcodeName:b(f$3),ip:I$1-1,stackDepth:n$2.length,instructionNumber:L$1,stack:e});}switch(f$3){case 0:break;case 1:{let e=c(n$2);return {type:"value",value:W?k(e):e}}case 3:{let e=c(n$2);n$2.push(e),n$2.push(e);break}case 2:{let e=c(n$2),t=c(n$2);n$2.push(e),n$2.push(t);break}case 10:n$2.push(n(y[je(d$2,I$1++,f$3,"constant-pool index",y.length,"number-pool")]));break;case 11:n$2.push(s(rn(z(d$2,I$1++,x$1,f$3,"constant-pool index"),f$3)));break;case 16:{let e=ia(z(d$2,I$1++,x$1,f$3,"constant-pool index"));n$2.push(o(ra(e),e));break}case 12:n$2.push(r$1(y[je(d$2,I$1++,f$3,"constant-pool index",y.length,"number-pool")]));break;case 13:n$2.push(t(z(d$2,I$1++,x$1,f$3,"constant-pool index")));break;case 14:n$2.push(K(U(d$2,I$1++,f$3,"boolean operand")===1));break;case 20:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let p=s$1(t,e,"add");if(p){n$2.push(p);break}}if(t.rational!==void 0||e.rational!==void 0){let p=r$2(t,e,"add");if(p){n$2.push(p);break}}let i=Yt(t,e,1),l=i===null?$t(t,e):null;i!==null?n$2.push(i):l!==null?n$2.push(u(l+e.toNumber(),e.unit)):t.type===0&&e.type===0?n$2.push(n(t.value+e.value)):t.type===10&&e.type===10?n$2.push(K(t.value&&e.value)):t.type===4?e.type===4?n$2.push(O("INVALID_DATETIME_OP","Cannot add two datetimes together")):n$2.push(L(he(t.toNumber(),e,1,a$2))):t.type===6&&A(t.unit)?n$2.push(Wt(t,e,1)):e.type===4?n$2.push(L(he(e.toNumber(),t,1,a$2))):n$2.push(u$1(t,e,(p,g)=>p+g,(p,g)=>p+g,"add"));break}case 21:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let p=s$1(t,e,"sub");if(p){n$2.push(p);break}}if(t.rational!==void 0||e.rational!==void 0){let p=r$2(t,e,"sub");if(p){n$2.push(p);break}}let i=Yt(t,e,-1),l=i===null?$t(t,e):null;i!==null?n$2.push(i):l!==null?n$2.push(u(l-e.toNumber(),e.unit)):t.type===0&&e.type===0?n$2.push(n(t.value-e.value)):t.type===4?e.type===4?n$2.push(u(t.toNumber()-e.toNumber(),"ms")):n$2.push(L(he(t.toNumber(),e,-1,a$2))):t.type===6&&A(t.unit)?n$2.push(Wt(t,e,-1)):e.type===4?n$2.push(O("INVALID_DATETIME_OP","Cannot subtract a datetime from a value that is not a datetime")):n$2.push(u$1(t,e,(p,g)=>p-g,(p,g)=>p-g,"sub"));break}case 22:{let e=c(n$2),t=c(n$2),s=un(t,e);if(s){n$2.push(s);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let l=s$1(t,e,"mul");if(l){n$2.push(l);break}}if(t.rational!==void 0||e.rational!==void 0){let l=r$2(t,e,"mul");if(l){n$2.push(l);break}}let i=ln(t,e);if(i){n$2.push(i);break}t.type===0&&e.type===0?n$2.push(n(t.value*e.value)):t.type===7&&e.type===7?(d(tn(t.value,e.value),"matrix cells"),n$2.push(_(t.value,e.value))):t.type===6&&x(t.unit)&&e.type===6&&e.unit?n$2.push(Je(t,e)):e.type===6&&x(e.unit)&&t.type===6&&t.unit?n$2.push(Je(e,t)):Pt(t,e)!==null?n$2.push(Pt(t,e)):n$2.push(u$1(t,e,(l,p)=>l*p,(l,p)=>l*p,"mul"));break}case 23:{let e=c(n$2),t=c(n$2),s=cn(t,e);if(s){n$2.push(s);break}if(t.uncertainty!==void 0||e.uncertainty!==void 0){let i=s$1(t,e,"div");if(i){n$2.push(i);break}}if(t.type===6&&e.type===6){let{lv:i,rv:l,sameMeasure:p}=j$2(t,e);p?n$2.push(n(i/l)):c$5.isCurrency(t.unit)&&c$5.isCurrency(e.unit)?n$2.push(O("INCOMPATIBLE_UNITS",`Cannot combine incompatible units: ${t.unit} and ${e.unit}`)):n$2.push(w(i/l,t.unit,e.unit));}else {let i=r$2(t,e,"div");if(i){n$2.push(i);break}n$2.push(u$1(t,e,(l,p)=>l/p,(l,p)=>{if(p===0n)throw o$1();return l/p},"div"));}break}case 24:{let e=c(n$2),t=c(n$2);n$2.push(u$1(t,e,(s,i)=>s%i,(s,i)=>{if(i===0n)throw o$1();return s%i}));break}case 25:{let e=c(n$2),t=c(n$2);if(t.type===13){n$2.push(t);break}if(e.type===13){n$2.push(e);break}if(t.type===12){n$2.push(t);break}if(e.type===12){n$2.push(e);break}if(t.type===0&&e.type===0){n$2.push(n(q$3(t.value,e.value)));break}if(t.type===7||e.type===7){if(t.type!==7||e.type!==0){n$2.push(O("MATRIX_POWER_UNSUPPORTED",`^: a matrix may only be the base, raised to a whole number (as in "[1,2;3,4]^2"); "${g[t.type]} ^ ${g[e.type]}" has no matrix reading.`));break}d(nn(t.value,e.value),"matrix cells"),n$2.push($(t.value,e.value));break}if(t.type===9||e.type===9){n$2.push(f$2(t,e));break}if(t.type===2||e.type===2){let s$1=bn(t,e.toNumber());if(s$1!==null){if(s$1>Te)throw c$1.execution("BIGINT_POW_LIMIT_EXCEEDED",`That power would build an exact integer of about ${Math.round(s$1).toLocaleString("en-US")} bits, past the limit of ${Te.toLocaleString("en-US")} bits`,{limitBits:Te});n$2.push(s(hn(n$1(t),n$1(e))));break}}n$2.push(n(q$3(t.toNumber(),e.toNumber())));break}case 26:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}e.type===2?n$2.push(s(-e.value)):e.type===6&&e.exact!==void 0?n$2.push(v(-e.toNumber(),e.unit,ma(e.exact))):e.type===6?n$2.push(u(-e.toNumber(),e.unit)):e.type===5?n$2.push(M(-e.toNumber())):e.type===9?n$2.push(g$1(e)):e.type===0&&e.rational!==void 0?n$2.push(p$1(-e.toNumber(),j$1(e.rational))):e.type===0&&e.exact!==void 0?n$2.push(o(-e.toNumber(),ma(e.exact))):n$2.push(n(-e.toNumber()));break}case 27:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}e.type===6&&e.exact!==void 0?n$2.push(v(e.toNumber(),e.unit,e.exact)):e.type===6?n$2.push(u(e.toNumber(),e.unit)):e.type===5?n$2.push(M(e.toNumber())):e.type===0&&e.rational!==void 0?n$2.push(p$1(e.toNumber(),e.rational)):e.type===0&&e.exact!==void 0?n$2.push(o(e.toNumber(),e.exact)):n$2.push(n(e.toNumber()));break}case 28:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}n$2.push(q$2(t.toNumber(),Math.abs(e.toNumber())));break}case 30:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}t.type===2||e.type===2?n$2.push(qt(t,e,1)):n$2.push(n(t.toNumber()<<e.toNumber()));break}case 31:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}t.type===2||e.type===2?n$2.push(qt(t,e,-1)):n$2.push(n(t.toNumber()>>e.toNumber()));break}case 32:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}n$2.push(n(t.toNumber()>>>e.toNumber()));break}case 33:{let e=c(n$2),t=c(n$2),s$1=P(t,e);if(s$1){n$2.push(s$1);break}t.type===2||e.type===2?n$2.push(s(n$1(t)&n$1(e))):n$2.push(n(t.toNumber()&e.toNumber()));break}case 34:{let e=c(n$2),t=c(n$2),s$1=P(t,e);if(s$1){n$2.push(s$1);break}t.type===2||e.type===2?n$2.push(s(n$1(t)|n$1(e))):n$2.push(n(t.toNumber()|e.toNumber()));break}case 35:{let e=c(n$2),t=c(n$2),s$1=P(t,e);if(s$1){n$2.push(s$1);break}t.type===2||e.type===2?n$2.push(s(n$1(t)^n$1(e))):n$2.push(n(t.toNumber()^e.toNumber()));break}case 36:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}e.type===2?n$2.push(s(~e.value)):n$2.push(n(~e.toNumber()));break}case 40:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.rational!==void 0||e.rational!==void 0){let i=t$1(t,e);if(i!==null){n$2.push(K(i===0));break}}if(t.type===0&&e.type===0)n$2.push(K(t.value===e.value));else if(t.type===2||e.type===2){let i=p(t,e);n$2.push(K(i===null?t.toNumber()===e.toNumber():i===0));}else if(t.type===3&&e.type===3)n$2.push(K(t.value===e.value));else if(t.type===6&&e.type===6){let{equal:i,sameMeasure:l}=k$1(t,e);n$2.push(K(l&&i));}else if(t.type===7&&e.type===7)n$2.push(aa(t.value,e.value,(i,l)=>i===l));else if(t.type===14||e.type===14)if(t.type===14&&e.type===14){let i=t.value,l=e.value;n$2.push(K(i.r===l.r&&i.g===l.g&&i.b===l.b&&i.a===l.a));}else n$2.push(K(!1));else n$2.push(K(t.toNumber()===e.toNumber()));break}case 41:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.rational!==void 0||e.rational!==void 0){let i=t$1(t,e);if(i!==null){n$2.push(K(i!==0));break}}if(t.type===0&&e.type===0)n$2.push(K(t.value!==e.value));else if(t.type===2||e.type===2){let i=p(t,e);n$2.push(K(i===null?t.toNumber()!==e.toNumber():i!==0));}else if(t.type===3&&e.type===3)n$2.push(K(t.value!==e.value));else if(t.type===6&&e.type===6){let{equal:i,sameMeasure:l}=k$1(t,e);n$2.push(K(!l||!i));}else if(t.type===7&&e.type===7)n$2.push(aa(t.value,e.value,(i,l)=>i!==l));else if(t.type===14||e.type===14)if(t.type===14&&e.type===14){let i=t.value,l=e.value;n$2.push(K(!(i.r===l.r&&i.g===l.g&&i.b===l.b&&i.a===l.a)));}else n$2.push(K(!0));else n$2.push(K(t.toNumber()!==e.toNumber()));break}case 42:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.rational!==void 0||e.rational!==void 0){let i=t$1(t,e);if(i!==null){n$2.push(K(i<0));break}}if(t.type===0&&e.type===0)n$2.push(K(t.value<e.value));else if(t.type===2||e.type===2){let i=p(t,e);n$2.push(K(i===null?t.toNumber()<e.toNumber():i<0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:g}=k$1(t,e);n$2.push(g?K(!p&&i<l):m(t,e));}else t.type===7&&e.type===7?n$2.push(aa(t.value,e.value,(i,l)=>i<l)):n$2.push(K(t.toNumber()<e.toNumber()));break}case 43:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.rational!==void 0||e.rational!==void 0){let i=t$1(t,e);if(i!==null){n$2.push(K(i<=0));break}}if(t.type===0&&e.type===0)n$2.push(K(t.value<=e.value));else if(t.type===2||e.type===2){let i=p(t,e);n$2.push(K(i===null?t.toNumber()<=e.toNumber():i<=0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:g}=k$1(t,e);n$2.push(g?K(p||i<=l):m(t,e));}else t.type===7&&e.type===7?n$2.push(aa(t.value,e.value,(i,l)=>i<=l)):n$2.push(K(t.toNumber()<=e.toNumber()));break}case 44:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.rational!==void 0||e.rational!==void 0){let i=t$1(t,e);if(i!==null){n$2.push(K(i>0));break}}if(t.type===0&&e.type===0)n$2.push(K(t.value>e.value));else if(t.type===2||e.type===2){let i=p(t,e);n$2.push(K(i===null?t.toNumber()>e.toNumber():i>0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:g}=k$1(t,e);n$2.push(g?K(!p&&i>l):m(t,e));}else t.type===7&&e.type===7?n$2.push(aa(t.value,e.value,(i,l)=>i>l)):n$2.push(K(t.toNumber()>e.toNumber()));break}case 45:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.rational!==void 0||e.rational!==void 0){let i=t$1(t,e);if(i!==null){n$2.push(K(i>=0));break}}if(t.type===0&&e.type===0)n$2.push(K(t.value>=e.value));else if(t.type===2||e.type===2){let i=p(t,e);n$2.push(K(i===null?t.toNumber()>=e.toNumber():i>=0));}else if(t.type===6&&e.type===6){let{lv:i,rv:l,equal:p,sameMeasure:g}=k$1(t,e);n$2.push(g?K(p||i>=l):m(t,e));}else t.type===7&&e.type===7?n$2.push(aa(t.value,e.value,(i,l)=>i>=l)):n$2.push(K(t.toNumber()>=e.toNumber()));break}case 130:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}n$2.push(K(ge(t)&&ge(e)));break}case 131:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}n$2.push(K(ge(t)||ge(e)));break}case 132:{let e=c(n$2),t=c(n$2),s=c(n$2),i=P(s);if(i){n$2.push(i);break}n$2.push(ge(s)?t:e);break}case 50:{let e=U(d$2,I$1++,f$3,"plugin-function index"),t=U(d$2,I$1++,f$3,"argument count"),s=[];for(let p=0;p<t;p++)s.push(c(n$2));s.reverse();let i=a$2.context.pluginFunctions[e],l=Q(s);if(l)n$2.push(l);else if(!i)n$2.push(n(0));else {let p=i(s,m$1);if(p instanceof Promise){let g=`plugin:${e}:${s.map(B=>String(B.value??"")).join("|")}`,E=a$2.activeSignal,C=a$2.context.pluginFunctionOwners[e]??"";return {type:"pending",queryKey:g,resolver:p,packageId:C,signal:E}}n$2.push(p);}break}case 51:{let e=U(d$2,I$1++,f$3,"builtin-function index"),t=U(d$2,I$1++,f$3,"argument count"),s=Bt(e,t);if(s)throw s;let i=[],l=!1;for(let E=0;E<t;E++){let C=c(n$2);C.type===9&&(l=!0),i.push(C);}let p=Q(i);if(p){n$2.push(p);break}let g=C[e];if(g){let E=i.reverse(),C=l&&!e$2.has(e);n$2.push(C?h$1(e,E):g(E));}break}case 150:{let e=U(d$2,I$1++,f$3,"function-body index"),t=A$1?.[e];if(!t)throw c$1.internal("INTERNAL_MISSING_FUNCTION_BODY",`Internal error: DEFINE_USER_FUNCTION referenced missing body index ${e}`,{bodyIdx:e});a$2.defineUserFunction(t.name,t.params,t.program);break}case 151:{let e=z(d$2,I$1++,x$1,f$3,"function-name index"),t=U(d$2,I$1++,f$3,"argument count"),s=[];for(let g=0;g<t;g++)s.push(c(n$2));s.reverse();let i=a$2.getUserFunction(e);if(!i)throw c$1.execution("UNDEFINED_FUNCTION",`Undefined function: ${e}`,{name:e});if(t!==i.params.length)throw c$1.execution("FUNCTION_ARITY_MISMATCH",`${e} expects ${i.params.length} argument(s) but got ${t}`,{name:e,expected:i.params.length,actual:t});let l=new Map;for(let g=0;g<i.params.length;g++)l.set(i.params[g],s[g]);f$1(),a$2.pushCallFrame(l);let p;try{p=Ze(i.program,a$2,o$2,u$2,m$1);}finally{a$2.popCallFrame();}if(p.type==="pending")throw c$1.execution("USER_FUNCTION_ASYNC_UNSUPPORTED",`${e}: user-defined functions with async bodies (weather, stocks, currency, ...) aren't supported`,{name:e});if(p.type==="error")throw p.error;n$2.push(p.value);break}case 60:{let e=z(d$2,I$1++,x$1,f$3,"variable-name index"),t=a$2.getVar(e);if(t!==void 0)n$2.push(t);else if(b$2)n$2.push(J$1(q$1(e)));else throw c$1.execution("UNDEFINED_VARIABLE",`Undefined variable: ${e}`,{varName:e});break}case 61:{let e=c(n$2),t=z(d$2,I$1++,x$1,f$3,"variable-name index");a$2.setVar(t,W?k(e):e),n$2.push(e);break}case 62:{let e=z(d$2,I$1++,x$1,f$3,"variable-name index"),t=J.get(e);if(t===void 0)throw c$1.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}});n$2.push(t);break}case 63:{let e=c(n$2),t=z(d$2,I$1++,x$1,f$3,"variable-name index");J.set(t,W?k(e):e),n$2.push(e);break}case 70:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}n$2.push(n(e.toNumber()));break}case 71:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}if(e.type===14){let s=e.value;n$2.push(G$1({r:s.r,g:s.g,b:s.b,a:s.a,format:"hex"}));break}n$2.push(r$1(e.type===2?e.value:e.toNumber()));break}case 74:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}n$2.push(M(e.toNumber()));break}case 140:{let e=c(n$2),t$1=P(e);if(t$1){n$2.push(t$1);break}n$2.push(t(e.rational!==void 0?yn(e.rational):gn(e.toNumber())));break}case 141:{let e=c(n$2),t$1=P(e);if(t$1){n$2.push(t$1);break}n$2.push(t(Nn(e)));break}case 142:{let e=c(n$2),t$1=P(e);if(t$1){n$2.push(t$1);break}n$2.push(t(xn(e.toNumber())));break}case 143:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}n$2.push(r$1(e.type===2?e.value:e.toNumber(),"bin"));break}case 144:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}n$2.push(r$1(e.type===2?e.value:e.toNumber(),"oct"));break}case 145:{let e=q(c(n$2),f$3,"converter name").toLowerCase(),t=c(n$2),s=P(t);if(s){n$2.push(s);break}let i=G.get(e);i?n$2.push(i(t)):n$2.push(O("UNKNOWN_AS_CONVERTER",`Unknown converter "as ${e}"`));break}case 80:{let e=q(c(n$2),f$3,"unit name"),t=c(n$2),s=P(t);if(s){n$2.push(s);break}let i=a$1(t,e);i?n$2.push(v(t.toNumber(),e,i)):n$2.push(u(t.toNumber(),e));break}case 81:{let e=q(c(n$2),f$3,"target unit name"),t=q(c(n$2),f$3,"source unit name"),s=c(n$2),i$1=P(s);if(i$1){n$2.push(i$1);break}let l=s.toNumber(),p=c$4(t),g=c$5.isCurrency(t)&&c$5.isCurrency(e);if(p&&c$4(e)===p)n$2.push(u(e$1(l,t,e),e));else if(g){let E=c$5.convertSync(l,t,e);E!==null?n$2.push(u(E,e)):n$2.push(O("CURRENCY_RATE_UNAVAILABLE",`No exchange rate available for ${t} to ${e}`));}else {let E=i(l,t,e);E!==null?n$2.push(u(E,e)):n$2.push(Kt(t,e));}break}case 85:{let e=q(c(n$2),f$3,"unit name"),t$1=f(e);n$2.push(t(t$1.length>0?t$1.join(", "):`No known units for "${e}"`));break}case 83:{let e=q(c(n$2),f$3,"unit name"),t=c(n$2),s=P(t);if(s){n$2.push(s);break}let{value:i,unit:l}=h(t.toNumber(),e);n$2.push(u(i,l));break}case 84:{let e=q(c(n$2),f$3,"target unit name"),t=c(n$2),s=P(t);if(s){n$2.push(s);break}if(t.type===6){let i$1=t.unit,l=t.toNumber(),p=c$4(i$1),g=c$5.isCurrency(i$1)&&c$5.isCurrency(e);if(p&&c$4(e)===p)n$2.push(u(e$1(l,i$1,e),e));else if(g){let E=c$5.convertSync(l,i$1,e);E!==null?n$2.push(u(E,e)):n$2.push(O("CURRENCY_RATE_UNAVAILABLE",`No exchange rate available for ${i$1} to ${e}`));}else {let E=i(l,i$1,e);E!==null?n$2.push(u(E,e)):n$2.push(Kt(i$1,e));}}else n$2.push(u(t.toNumber(),e));break}case 82:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}n$2.push(n(e.toNumber()));break}case 110:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(e.type!==6||!e.unit){n$2.push(O("RATE_MISSING_DENOMINATOR_UNIT",'Cannot build a rate: the right-hand side of "/" has no unit'));break}let i=t.type===6?t.unit??"":"";n$2.push(w(t.toNumber()/e.toNumber(),i,e.unit));break}case 111:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.type!==6||!x(t.unit)){n$2.push(O("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){n$2.push(O("RATE_MUL_RIGHT_MISSING_UNIT","Right-hand side of a rate multiplication must have a unit matching the rate's denominator"));break}n$2.push(Je(t,e));break}case 112:{let e=q(c(n$2),f$3,"denominator unit name"),t=c(n$2),s=P(t);if(s){n$2.push(s);break}if(t.type!==6||!x(t.unit)){n$2.push(O("RATE_CONVERT_NOT_A_RATE","Cannot convert a non-rate value's denominator"));break}let{numerator:i,denominator:l}=y$1(t.unit),p=c$4(l),g=c$4(e);if(!p||p!==g){n$2.push(O("RATE_CONVERT_MEASURE_MISMATCH",`Cannot convert a "${l}"-denominated rate to "${e}" \u2014 different measures`));break}let E=e$1(1,e,l);n$2.push(w(t.toNumber()*E,i,e));break}case 120:{let e=c(n$2),t=P(e);if(t){n$2.push(t);break}let s=e.toNumber(),i=new Date,l=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0,0);l.setMinutes(s),n$2.push(L(l.getTime()));break}case 90:n$2.push(L(Date.now()));break;case 95:n$2.push(L(y[je(d$2,I$1++,f$3,"constant-pool index",y.length,"number-pool")]));break;case 91:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}n$2.push(L(he(t.toNumber(),e,1,a$2)));break}case 92:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}n$2.push(L(he(t.toNumber(),e,-1,a$2)));break}case 96:{let e=U(d$2,I$1++,f$3,"workday offset direction")===1?-1:1,t=c(n$2),s=c(n$2),i=P(s,t);if(i){n$2.push(i);break}if(t.type!==4){n$2.push(O(r.WORKDAY_OFFSET_EXPECTED_DATE,`"working days after/before/from" expects a date to count from, got ${g[t.type]??"an unsupported value"}`));break}n$2.push(L(zt(t.toNumber(),e*s.toNumber(),a$2)));break}case 97:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.type!==4||e.type!==4){n$2.push(O(r.WORKDAYS_BETWEEN_EXPECTED_DATES,`"working days between" expects two dates, got ${g[t.type]??"an unsupported value"} and ${g[e.type]??"an unsupported value"}`));break}let i=Math.ceil((a$2.getMaxDateOffsetYears()-a$2.getMinDateOffsetYears())*366),l=Vt(t.toNumber(),e.toNumber(),p=>a$2.isHoliday(p),i);if(l===null){n$2.push(O(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}n$2.push(n(l));break}case 93:case 94:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}let i=e.toNumber(),l=t.toNumber(),p=new Date(l).getDay(),g=f$3===93?(i-p+7)%7:(p-i+7)%7;g===0&&(g=7),n$2.push(L(Qt(l,f$3===93?g:-g)));break}case 152:{let e$1=U(d$2,I$1++,f$3,"row count"),t=U(d$2,I$1++,f$3,"column count"),s=e$1*t,i=e(s,"matrix cells"),l=null;for(let p=s-1;p>=0;p--){let g=c(n$2);l===null&&(l=P(g)),i[p]=g.type===10||g.type===9?g.value:g.toNumber();}if(l){n$2.push(l);break}n$2.push(C$1(e$1,t,Y(e$1,t,i)));break}case 153:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.type!==7){n$2.push(O("MATRIX_INDEX_NOT_A_MATRIX",'Cannot index a non-matrix value with "[...]".'));break}let i=t.value,l=Math.trunc(e.toNumber());if(l<0||l>=i.data.length){n$2.push(O("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 p=S(i,l);n$2.push(X(p));break}case 154:{let e=c(n$2),t=c(n$2),s=c(n$2),i=P(s,t,e);if(i){n$2.push(i);break}if(s.type!==7){n$2.push(O("MATRIX_INDEX_NOT_A_MATRIX",'Cannot index a non-matrix value with "[...]".'));break}let l=s.value,p=Math.trunc(t.toNumber()),g=Math.trunc(e.toNumber());if(!U$1(l,p,g)){n$2.push(O("MATRIX_INDEX_OUT_OF_BOUNDS",`[${p}, ${g}] is out of bounds for a ${l.rows}x${l.cols} matrix.`));break}let E=T(l,p,g);n$2.push(X(E));break}case 156:{let e=c(n$2),t=c(n$2),s=P(t,e);if(s){n$2.push(s);break}if(t.type!==0||e.type!==0){n$2.push(O("INVALID_RANGE_BOUND",`A range's bounds must be plain numbers (e.g. "0:3").`));break}let i=t.value,l=e.value;if(!Number.isInteger(i)||!Number.isInteger(l)){n$2.push(O("NON_INTEGER_RANGE_BOUND",`A range's bounds must be whole numbers, got "${i}:${l}".`));break}if(i>l){n$2.push(O("DESCENDING_RANGE",`A range's min (${i}) cannot be greater than its max (${l}) \u2014 did you mean "${l}:${i}"?`));break}n$2.push(F(i,l));break}case 155:{let e$1=c(n$2),t=c(n$2),s=c(n$2),i=P(s,t,e$1);if(i){n$2.push(i);break}if(s.type!==7){n$2.push(O("MATRIX_INDEX_NOT_A_MATRIX",'Cannot slice a non-matrix value with "[...]".'));break}if(t.type!==8||e$1.type!==8){n$2.push(O("INVALID_MATRIX_SLICE_BOUND",'Matrix slicing needs range bounds (e.g. "a[0:1, 1:2]").'));break}let l=s.value,p=t.value,g=e$1.value;if(p.min<0||p.max>=l.rows||g.min<0||g.max>=l.cols){n$2.push(O("MATRIX_INDEX_OUT_OF_BOUNDS",`Slice [${p.min}:${p.max}, ${g.min}:${g.max}] is out of bounds for a ${l.rows}x${l.cols} matrix.`));break}let E=p.max-p.min+1,C=g.max-g.min+1,B=e(E*C,"matrix cells");for(let V=0;V<E;V++)for(let D=0;D<C;D++)B[V+D*E]=T(l,p.min+V,g.min+D);n$2.push(C$1(E,C,B));break}case 157:{let e$1=U(d$2,I$1++,f$3,"body kind"),t=U(d$2,I$1++,f$3,"body reference"),s=U(d$2,I$1++,f$3,"collection count");Ft(e$1,t,f$3);let i=new Array(s);for(let k=s-1;k>=0;k--)i[k]=c(n$2);let l=[],p;if(e$1===0){let k=w$1?.[t];if(!k)throw c$1.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: MAP_INVOKE referenced missing anonymous body index ${t}`,{ref:t});l=k.params,p=k.program;}else if(e$1===2){let k=Se(x$1,t,f$3),v=a$2.getUserFunction(k);if(!v){n$2.push(O("UNDEFINED_FUNCTION",`map: undefined function "${k}"`));break}if(v.params.length!==s){n$2.push(O("FUNCTION_ARITY_MISMATCH",`map: "${k}" expects ${v.params.length} argument(s) but ${s} collection(s) were given`));break}l=v.params,p=v.program;}let g=-1,E=new Array(s),C$2;for(let k=0;k<s;k++){let v=ea(i[k],a$2.getMaxCollectionSize());if(!Array.isArray(v)){C$2=v;break}if(c$3(v.length,"collection elements"),g===-1)g=v.length;else if(v.length!==g){C$2=O("MAP_COLLECTION_LENGTH_MISMATCH",`map: all collections must have the same length (got ${g} and ${v.length}).`);break}E[k]=v;}if(C$2){n$2.push(C$2);break}let B=e(g,"matrix cells"),V;for(let k=0;k<g;k++){let v=new Array(s);for(let ye=0;ye<s;ye++)v[ye]=E[ye][k];let ae=e$1===1?C[t]?.(v)??O("UNKNOWN_BUILTIN_FUNCTION",`map: unknown builtin function index ${t}`):ze(l,p,v,a$2,o$2,u$2,m$1,!!b$2),et=P(ae);if(et){V=et;break}B[k]=ae.type===10||ae.type===9?ae.value:ae.toNumber();}if(V){n$2.push(V);break}let D=i[0],R=D?.type===7?D.value:void 0;R&&R.rows*R.cols===g?n$2.push(C$1(R.rows,R.cols,B)):n$2.push(C$1(1,g,B));break}case 160:{let e=U(d$2,I$1++,f$3,"plot body reference"),t=U(d$2,I$1++,f$3,"plot expression"),s=Se(x$1,t,f$3),i=c(n$2).toNumber(),l=c(n$2).toNumber(),p=w$1?.[e];if(!p)throw c$1.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: PLOT_INVOKE referenced missing anonymous body index ${e}`,{ref:e});if(!Number.isFinite(l)||!Number.isFinite(i)){n$2.push(O("PLOT_INVALID_RANGE",`plot: the range bounds must be finite numbers (got ${l} to ${i})`));break}let g=[];for(let D=0;D<Lt;D++){let R=l+D/(Lt-1)*(i-l),k;try{k=ze(p.params,p.program,[n(R)],a$2,o$2,u$2,m$1,!!b$2).toNumber();}catch{continue}Number.isFinite(k)&&g.push([R,k]);}let E=g.map(D=>D[1]),C=E.length?Math.min(...E):0,B=E.length?Math.max(...E):0,V=D=>Number.isInteger(D)?String(D):String(Number(D.toFixed(2)));n$2.push(I({kind:"plot",points:g,label:`${s} over [${V(l)}, ${V(i)}]`,domain:[l,i],range:[C,B],expr:s}));break}case 158:{let e=U(d$2,I$1++,f$3,"body kind"),t=U(d$2,I$1++,f$3,"body reference"),s=U(d$2,I$1++,f$3,"initial-value flag");Ft(e,t,f$3);let i=s?c(n$2):void 0,l=c(n$2),p=[],g;if(e===0){let D=w$1?.[t];if(!D)throw c$1.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: REDUCE_INVOKE referenced missing anonymous body index ${t}`,{ref:t});p=D.params,g=D.program;}else if(e===2){let D=Se(x$1,t,f$3),R=a$2.getUserFunction(D);if(!R){n$2.push(O("UNDEFINED_FUNCTION",`reduce: undefined function "${D}"`));break}if(R.params.length!==2){n$2.push(O("FUNCTION_ARITY_MISMATCH",`reduce: "${D}" must take exactly 2 arguments (accumulator, element), got ${R.params.length}`));break}p=R.params,g=R.program;}let E=ea(l,a$2.getMaxCollectionSize());if(!Array.isArray(E)){n$2.push(E);break}c$3(E.length,"collection elements");let C$1,B;if(i!==void 0){let D=P(i);if(D){n$2.push(D);break}C$1=i,B=0;}else {if(E.length===0){n$2.push(O("REDUCE_EMPTY_COLLECTION","reduce: cannot reduce an empty collection without an initial value."));break}C$1=E[0],B=1;}let V;for(let D=B;D<E.length;D++){let R=[C$1,E[D]],k=e===1?C[t]?.(R)??O("UNKNOWN_BUILTIN_FUNCTION",`reduce: unknown builtin function index ${t}`):ze(p,g,R,a$2,o$2,u$2,m$1,!!b$2),v=P(k);if(v){V=v;break}C$1=k;}if(V){n$2.push(V);break}n$2.push(C$1);break}case 159:{let e=U(d$2,I$1++,f$3,"body reference"),t=w$1?.[e];if(!t)throw c$1.internal("INTERNAL_MISSING_ANONYMOUS_BODY",`Internal error: BIND_UNKNOWN referenced missing anonymous body index ${e}`,{ref:e});n$2.push(sn(t.params[0],t.program,a$2,o$2,u$2,m$1,!!b$2));break}}}let K$1=c(n$2);return {type:"value",value:W?k(K$1):K$1}}catch(K){return {type:"error",error:d$1(K)}}finally{b$1();}}export{Ct as a,Ot as b,jn as c,Ze as d};//# sourceMappingURL=chunk-ZJPAPBP3.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ZJPAPBP3.js.map
|