solve-engine 1.0.0-beta.2 → 1.0.0-beta.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/{Lexer-D9l4Yrk2.d.ts → Lexer-Cfm79Dak.d.cts} +18 -2
- package/dist/{Lexer-BJdhlnej.d.cts → Lexer-W9MBOP0V.d.ts} +18 -2
- package/dist/{PackageRegistry-DaH4aIKP.d.ts → PackageRegistry-CjDt-Jy_.d.ts} +60 -4
- package/dist/{PackageRegistry-D-Tv_7ca.d.cts → PackageRegistry-pHtKythi.d.cts} +60 -4
- package/dist/{Parselet-CK8cQu2a.d.cts → Parselet-Cu0bLSis.d.cts} +1 -1
- package/dist/{Parselet-ConOIdRO.d.ts → Parselet-DEdF9I7n.d.ts} +1 -1
- package/dist/{Token-0jpvUdPY.d.cts → Token-BzG5G4ja.d.cts} +44 -0
- package/dist/{Token-0jpvUdPY.d.ts → Token-BzG5G4ja.d.ts} +44 -0
- package/dist/TokenNormalizer-DGVa24Q-.d.cts +377 -0
- package/dist/TokenNormalizer-t_GotBxr.d.ts +377 -0
- package/dist/{chunk-HWSZJQCI.js → chunk-2CS6OMZK.js} +37 -15
- package/dist/chunk-2CS6OMZK.js.map +1 -0
- package/dist/{chunk-XJCMXB2E.cjs → chunk-2MV4HBKC.cjs} +187 -61
- package/dist/chunk-2MV4HBKC.cjs.map +1 -0
- package/dist/{chunk-J73SJHR3.cjs → chunk-2NPS5DQ3.cjs} +558 -341
- package/dist/chunk-2NPS5DQ3.cjs.map +1 -0
- package/dist/{chunk-QWY3VEZN.js → chunk-3MNKQZ77.js} +65 -12
- package/dist/chunk-3MNKQZ77.js.map +1 -0
- package/dist/{chunk-RZCWSXTA.cjs → chunk-43G3JT2E.cjs} +1491 -218
- package/dist/chunk-43G3JT2E.cjs.map +1 -0
- package/dist/{chunk-WQTTOGXC.cjs → chunk-4AVD7NZW.cjs} +4 -4
- package/dist/{chunk-WQTTOGXC.cjs.map → chunk-4AVD7NZW.cjs.map} +1 -1
- package/dist/{chunk-HTXVVJRA.cjs → chunk-4CVLFLOB.cjs} +112 -2
- package/dist/chunk-4CVLFLOB.cjs.map +1 -0
- package/dist/{chunk-5YEMOYSE.js → chunk-6GCKCWLB.js} +9 -3
- package/dist/chunk-6GCKCWLB.js.map +1 -0
- package/dist/{chunk-EBSPLUW4.cjs → chunk-AHCLWAM5.cjs} +28 -10
- package/dist/chunk-AHCLWAM5.cjs.map +1 -0
- package/dist/{chunk-KVILKGMS.js → chunk-AJA6LUI7.js} +36 -2
- package/dist/chunk-AJA6LUI7.js.map +1 -0
- package/dist/{chunk-EHAHVROS.cjs → chunk-CLVQBF5C.cjs} +5 -5
- package/dist/{chunk-EHAHVROS.cjs.map → chunk-CLVQBF5C.cjs.map} +1 -1
- package/dist/{chunk-34RRD7PC.js → chunk-CYFK5SY2.js} +111 -3
- package/dist/chunk-CYFK5SY2.js.map +1 -0
- package/dist/{chunk-M5LX5AOO.js → chunk-DDQVZGLO.js} +25 -12
- package/dist/chunk-DDQVZGLO.js.map +1 -0
- package/dist/{chunk-LR7YASZF.cjs → chunk-EAAHVJ4P.cjs} +3 -3
- package/dist/chunk-EAAHVJ4P.cjs.map +1 -0
- package/dist/{chunk-3PPFLFH4.js → chunk-FIFQPKBA.js} +1417 -144
- package/dist/chunk-FIFQPKBA.js.map +1 -0
- package/dist/{chunk-RIN643A3.js → chunk-GPPLSM2Z.js} +61 -2
- package/dist/chunk-GPPLSM2Z.js.map +1 -0
- package/dist/{chunk-4QADQTWS.js → chunk-KHJUSHFU.js} +231 -14
- package/dist/chunk-KHJUSHFU.js.map +1 -0
- package/dist/{chunk-NMD5VRN4.cjs → chunk-M4F66R4O.cjs} +74 -73
- package/dist/chunk-M4F66R4O.cjs.map +1 -0
- package/dist/{chunk-6NTVRDQV.cjs → chunk-M4Q47KHF.cjs} +126 -73
- package/dist/chunk-M4Q47KHF.cjs.map +1 -0
- package/dist/{chunk-LIPPNDBE.js → chunk-M5E34VG5.js} +3 -3
- package/dist/{chunk-LIPPNDBE.js.map → chunk-M5E34VG5.js.map} +1 -1
- package/dist/{chunk-53B6KDDJ.cjs → chunk-MBNQVDVC.cjs} +38 -3
- package/dist/{chunk-53B6KDDJ.cjs.map → chunk-MBNQVDVC.cjs.map} +1 -1
- package/dist/{chunk-SDGRK7EP.js → chunk-MEOHSQEH.js} +6 -5
- package/dist/chunk-MEOHSQEH.js.map +1 -0
- package/dist/{chunk-NMCRQP3Z.cjs → chunk-MTX2KVU7.cjs} +71 -70
- package/dist/chunk-MTX2KVU7.cjs.map +1 -0
- package/dist/{chunk-QNJ4ACRT.cjs → chunk-NJTXJ5AG.cjs} +37 -15
- package/dist/chunk-NJTXJ5AG.cjs.map +1 -0
- package/dist/{chunk-C4XZV6E7.cjs → chunk-NZFKROS7.cjs} +26 -20
- package/dist/chunk-NZFKROS7.cjs.map +1 -0
- package/dist/{chunk-64W6GLLZ.js → chunk-OFXOTECC.js} +24 -6
- package/dist/chunk-OFXOTECC.js.map +1 -0
- package/dist/{chunk-3YNVWKR2.cjs → chunk-OUHT5Z36.cjs} +28 -5
- package/dist/chunk-OUHT5Z36.cjs.map +1 -0
- package/dist/{chunk-EIGTWK5N.js → chunk-OWRHDUJD.js} +3 -3
- package/dist/chunk-OWRHDUJD.js.map +1 -0
- package/dist/{chunk-4MG4XKO2.js → chunk-PCPX42KL.js} +38 -3
- package/dist/{chunk-4MG4XKO2.js.map → chunk-PCPX42KL.js.map} +1 -1
- package/dist/{chunk-GW32KPCU.cjs → chunk-R24DI24X.cjs} +61 -2
- package/dist/chunk-R24DI24X.cjs.map +1 -0
- package/dist/{chunk-XVWCOTR6.js → chunk-SFQWJMKT.js} +7 -6
- package/dist/chunk-SFQWJMKT.js.map +1 -0
- package/dist/{chunk-6BKTCEUP.cjs → chunk-TY3TLZAW.cjs} +36 -2
- package/dist/chunk-TY3TLZAW.cjs.map +1 -0
- package/dist/{chunk-DM3LMRBC.js → chunk-UKPGSAZW.js} +187 -61
- package/dist/chunk-UKPGSAZW.js.map +1 -0
- package/dist/{chunk-NH2O2AUR.js → chunk-WC5FFSHB.js} +26 -4
- package/dist/chunk-WC5FFSHB.js.map +1 -0
- package/dist/{chunk-CLL7RUQV.cjs → chunk-WWOLFXTX.cjs} +40 -18
- package/dist/chunk-WWOLFXTX.cjs.map +1 -0
- package/dist/{chunk-JBSYC7BB.cjs → chunk-X2BWAZAU.cjs} +66 -53
- package/dist/chunk-X2BWAZAU.cjs.map +1 -0
- package/dist/{chunk-GOLDJNMZ.js → chunk-XBTEO4OB.js} +28 -5
- package/dist/chunk-XBTEO4OB.js.map +1 -0
- package/dist/{chunk-EPOXXJBK.js → chunk-YU2CUNFO.js} +3 -3
- package/dist/{chunk-EPOXXJBK.js.map → chunk-YU2CUNFO.js.map} +1 -1
- package/dist/constants.cjs +4 -4
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +29 -30
- package/dist/engine.d.cts +6 -6
- package/dist/engine.d.ts +6 -6
- package/dist/engine.js +19 -20
- package/dist/format.cjs +7 -8
- package/dist/format.cjs.map +1 -1
- package/dist/format.js +2 -3
- package/dist/format.js.map +1 -1
- package/dist/index.cjs +28 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/dist/language.cjs +74 -12
- package/dist/language.cjs.map +1 -1
- package/dist/language.d.cts +6 -6
- package/dist/language.d.ts +6 -6
- package/dist/language.js +68 -6
- package/dist/language.js.map +1 -1
- package/dist/lexer.cjs +19 -19
- package/dist/lexer.d.cts +3 -3
- package/dist/lexer.d.ts +3 -3
- package/dist/lexer.js +7 -7
- package/dist/normalizer.cjs +12 -12
- package/dist/normalizer.d.cts +4 -210
- package/dist/normalizer.d.ts +4 -210
- package/dist/normalizer.js +6 -6
- package/dist/packages.cjs +36 -37
- package/dist/packages.d.cts +5 -47
- package/dist/packages.d.ts +5 -47
- package/dist/packages.js +13 -14
- package/dist/parser.cjs +12 -12
- package/dist/parser.d.cts +3 -2
- package/dist/parser.d.ts +3 -2
- package/dist/parser.js +4 -4
- package/dist/resolvers.d.cts +1 -1
- package/dist/resolvers.d.ts +1 -1
- package/dist/uom.cjs +14 -14
- package/dist/uom.d.cts +12 -4
- package/dist/uom.d.ts +12 -4
- package/dist/uom.js +4 -4
- package/dist/vm.cjs +17 -17
- package/dist/vm.js +6 -6
- package/package.json +2 -1
- package/dist/NormalizerRule-BrVoVjmP.d.cts +0 -163
- package/dist/NormalizerRule-CEjf1FyD.d.ts +0 -163
- package/dist/chunk-34RRD7PC.js.map +0 -1
- package/dist/chunk-3PPFLFH4.js.map +0 -1
- package/dist/chunk-3YNVWKR2.cjs.map +0 -1
- package/dist/chunk-4QADQTWS.js.map +0 -1
- package/dist/chunk-5YEMOYSE.js.map +0 -1
- package/dist/chunk-64W6GLLZ.js.map +0 -1
- package/dist/chunk-6BKTCEUP.cjs.map +0 -1
- package/dist/chunk-6NTVRDQV.cjs.map +0 -1
- package/dist/chunk-C4XZV6E7.cjs.map +0 -1
- package/dist/chunk-CLL7RUQV.cjs.map +0 -1
- package/dist/chunk-DM3LMRBC.js.map +0 -1
- package/dist/chunk-EBSPLUW4.cjs.map +0 -1
- package/dist/chunk-EIGTWK5N.js.map +0 -1
- package/dist/chunk-GOLDJNMZ.js.map +0 -1
- package/dist/chunk-GW32KPCU.cjs.map +0 -1
- package/dist/chunk-HTXVVJRA.cjs.map +0 -1
- package/dist/chunk-HWSZJQCI.js.map +0 -1
- package/dist/chunk-J73SJHR3.cjs.map +0 -1
- package/dist/chunk-JBSYC7BB.cjs.map +0 -1
- package/dist/chunk-KVILKGMS.js.map +0 -1
- package/dist/chunk-LR7YASZF.cjs.map +0 -1
- package/dist/chunk-M5LX5AOO.js.map +0 -1
- package/dist/chunk-NH2O2AUR.js.map +0 -1
- package/dist/chunk-NMCRQP3Z.cjs.map +0 -1
- package/dist/chunk-NMD5VRN4.cjs.map +0 -1
- package/dist/chunk-OT6OJY7C.cjs +0 -114
- package/dist/chunk-OT6OJY7C.cjs.map +0 -1
- package/dist/chunk-QNJ4ACRT.cjs.map +0 -1
- package/dist/chunk-QWY3VEZN.js.map +0 -1
- package/dist/chunk-RFYD5TJE.js +0 -111
- package/dist/chunk-RFYD5TJE.js.map +0 -1
- package/dist/chunk-RIN643A3.js.map +0 -1
- package/dist/chunk-RZCWSXTA.cjs.map +0 -1
- package/dist/chunk-SDGRK7EP.js.map +0 -1
- package/dist/chunk-XJCMXB2E.cjs.map +0 -1
- package/dist/chunk-XVWCOTR6.js.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk47LRVGOT_cjs = require('./chunk-47LRVGOT.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunk2NPS5DQ3_cjs = require('./chunk-2NPS5DQ3.cjs');
|
|
5
|
+
var chunk2MV4HBKC_cjs = require('./chunk-2MV4HBKC.cjs');
|
|
6
6
|
var chunkMZOVP3WI_cjs = require('./chunk-MZOVP3WI.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunk4CVLFLOB_cjs = require('./chunk-4CVLFLOB.cjs');
|
|
8
8
|
var chunkOC6LTXYS_cjs = require('./chunk-OC6LTXYS.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkNJTXJ5AG_cjs = require('./chunk-NJTXJ5AG.cjs');
|
|
10
|
+
var chunkMBNQVDVC_cjs = require('./chunk-MBNQVDVC.cjs');
|
|
10
11
|
var chunkM4N5GA5Z_cjs = require('./chunk-M4N5GA5Z.cjs');
|
|
11
12
|
|
|
12
13
|
// src/vm/DependencyGraph.ts
|
|
@@ -332,7 +333,7 @@ var ScopeManager = class {
|
|
|
332
333
|
};
|
|
333
334
|
|
|
334
335
|
// src/vm/VM.ts
|
|
335
|
-
function createVM(registry, maxStackDepth = 200, maxInstructions = 5e4, maxFunctionRecursionDepth = 50, context =
|
|
336
|
+
function createVM(registry, maxStackDepth = 200, maxInstructions = 5e4, maxFunctionRecursionDepth = 50, context = chunk2NPS5DQ3_cjs.defaultEngineContext) {
|
|
336
337
|
const stack = [];
|
|
337
338
|
const variables = /* @__PURE__ */ new Map();
|
|
338
339
|
let instructionCount = 0;
|
|
@@ -494,12 +495,49 @@ function invokeFrameBody(params, program, args, vm, pipeline, expression, contex
|
|
|
494
495
|
}
|
|
495
496
|
return bodyResult.value;
|
|
496
497
|
}
|
|
498
|
+
function unifyRatePeriods(l, r) {
|
|
499
|
+
if (l.type !== 6 /* Uom */ || r.type !== 6 /* Uom */) return null;
|
|
500
|
+
const leftUnit = l.unit;
|
|
501
|
+
const rightUnit = r.unit;
|
|
502
|
+
if (leftUnit === void 0 || rightUnit === void 0) return null;
|
|
503
|
+
const leftSlash = leftUnit.indexOf("/");
|
|
504
|
+
const rightSlash = rightUnit.indexOf("/");
|
|
505
|
+
if (leftSlash < 0 || rightSlash < 0) return null;
|
|
506
|
+
if (leftUnit.slice(0, leftSlash) !== rightUnit.slice(0, rightSlash)) return null;
|
|
507
|
+
const leftPeriod = chunkMBNQVDVC_cjs.UNIT_TABLE[leftUnit.slice(leftSlash + 1).toLowerCase()];
|
|
508
|
+
const rightPeriod = chunkMBNQVDVC_cjs.UNIT_TABLE[rightUnit.slice(rightSlash + 1).toLowerCase()];
|
|
509
|
+
if (leftPeriod === void 0 || rightPeriod === void 0) return null;
|
|
510
|
+
if (leftPeriod[0] !== rightPeriod[0]) return null;
|
|
511
|
+
return l.toNumber() * (rightPeriod[1] / leftPeriod[1]);
|
|
512
|
+
}
|
|
513
|
+
function moneyTimesQuantity(l, r) {
|
|
514
|
+
if (l.type !== 6 /* Uom */ || r.type !== 6 /* Uom */) return null;
|
|
515
|
+
const leftUnit = l.unit;
|
|
516
|
+
const rightUnit = r.unit;
|
|
517
|
+
if (leftUnit === void 0 || rightUnit === void 0) return null;
|
|
518
|
+
if (leftUnit.includes("/") || rightUnit.includes("/")) return null;
|
|
519
|
+
const leftIsMoney = chunk4CVLFLOB_cjs.CURRENCY_DISPLAY[leftUnit.toUpperCase()] !== void 0;
|
|
520
|
+
const rightIsMoney = chunk4CVLFLOB_cjs.CURRENCY_DISPLAY[rightUnit.toUpperCase()] !== void 0;
|
|
521
|
+
if (leftIsMoney === rightIsMoney) return null;
|
|
522
|
+
return chunkOC6LTXYS_cjs.uomValue(l.toNumber() * r.toNumber(), leftIsMoney ? leftUnit : rightUnit);
|
|
523
|
+
}
|
|
524
|
+
function combinePercentage(l, r, sign) {
|
|
525
|
+
if (l.type === 5 /* Percentage */) {
|
|
526
|
+
if (r.type !== 5 /* Percentage */ && r.type !== 0 /* Number */) return null;
|
|
527
|
+
return chunkOC6LTXYS_cjs.percentageValue(l.toNumber() + sign * r.toNumber());
|
|
528
|
+
}
|
|
529
|
+
if (r.type !== 5 /* Percentage */) return null;
|
|
530
|
+
const factor = 1 + sign * r.toNumber();
|
|
531
|
+
if (l.type === 0 /* Number */) return chunkOC6LTXYS_cjs.numberValue(l.toNumber() * factor);
|
|
532
|
+
if (l.type === 6 /* Uom */ && l.unit !== void 0) return chunkOC6LTXYS_cjs.uomValue(l.toNumber() * factor, l.unit);
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
497
535
|
function extractDurationMs(value) {
|
|
498
536
|
if (value.type === 6 /* Uom */) {
|
|
499
537
|
const unit = value.unit;
|
|
500
|
-
if (unit &&
|
|
538
|
+
if (unit && chunkNJTXJ5AG_cjs.getMeasure(unit) === "time") {
|
|
501
539
|
try {
|
|
502
|
-
return
|
|
540
|
+
return chunkNJTXJ5AG_cjs.convertUnit(value.toNumber(), unit, "ms");
|
|
503
541
|
} catch {
|
|
504
542
|
}
|
|
505
543
|
}
|
|
@@ -533,8 +571,8 @@ function combineTimecode(tc, r, sign) {
|
|
|
533
571
|
if (r.type === 6 /* Uom */ && r.unit === "frames") {
|
|
534
572
|
return chunkOC6LTXYS_cjs.uomValue(tc.toNumber() + sign * r.toNumber(), tc.unit);
|
|
535
573
|
}
|
|
536
|
-
if (r.type === 6 /* Uom */ && r.unit &&
|
|
537
|
-
const seconds =
|
|
574
|
+
if (r.type === 6 /* Uom */ && r.unit && chunkNJTXJ5AG_cjs.getMeasure(r.unit) === "time") {
|
|
575
|
+
const seconds = chunkNJTXJ5AG_cjs.convertUnit(r.toNumber(), r.unit, "s");
|
|
538
576
|
return chunkOC6LTXYS_cjs.uomValue(tc.toNumber() + sign * seconds * fps, tc.unit);
|
|
539
577
|
}
|
|
540
578
|
return chunkOC6LTXYS_cjs.uomValue(tc.toNumber() + sign * r.toNumber(), tc.unit);
|
|
@@ -545,15 +583,15 @@ function isTruthy(value) {
|
|
|
545
583
|
}
|
|
546
584
|
function multiplyRateByMatchingUom(rate, multiplier) {
|
|
547
585
|
const { numerator, denominator } = chunkOC6LTXYS_cjs.splitRateUnit(rate.unit);
|
|
548
|
-
const rateMeasure =
|
|
549
|
-
const multiplierMeasure =
|
|
586
|
+
const rateMeasure = chunkNJTXJ5AG_cjs.getMeasure(denominator);
|
|
587
|
+
const multiplierMeasure = chunkNJTXJ5AG_cjs.getMeasure(multiplier.unit);
|
|
550
588
|
if (!rateMeasure || rateMeasure !== multiplierMeasure) {
|
|
551
589
|
return chunkOC6LTXYS_cjs.errorValue(
|
|
552
590
|
"RATE_MUL_MEASURE_MISMATCH",
|
|
553
591
|
`Cannot multiply a "${denominator}"-denominated rate by "${multiplier.unit}" \u2014 different measures`
|
|
554
592
|
);
|
|
555
593
|
}
|
|
556
|
-
const multiplierInDenominatorUnit =
|
|
594
|
+
const multiplierInDenominatorUnit = chunkNJTXJ5AG_cjs.convertUnit(multiplier.toNumber(), multiplier.unit, denominator);
|
|
557
595
|
const total = rate.toNumber() * multiplierInDenominatorUnit;
|
|
558
596
|
return numerator ? chunkOC6LTXYS_cjs.uomValue(total, numerator) : chunkOC6LTXYS_cjs.numberValue(total);
|
|
559
597
|
}
|
|
@@ -584,9 +622,10 @@ function toFractionString(n) {
|
|
|
584
622
|
const numerator = whole * k1 + h1;
|
|
585
623
|
return `${negative ? "-" : ""}${numerator}/${k1}`;
|
|
586
624
|
}
|
|
587
|
-
function toMultiplierString(
|
|
588
|
-
const
|
|
589
|
-
|
|
625
|
+
function toMultiplierString(value) {
|
|
626
|
+
const n = value.toNumber();
|
|
627
|
+
const multiple = value.type === 5 /* Percentage */ ? 1 + n : n;
|
|
628
|
+
return `${Math.round(multiple * 1e6) / 1e6}x`;
|
|
590
629
|
}
|
|
591
630
|
function toScientificString(n) {
|
|
592
631
|
if (n === 0) return "0e+0";
|
|
@@ -675,14 +714,20 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
675
714
|
// ═══════════════════════════════════════════════════════════════
|
|
676
715
|
case 20 /* ADD */: {
|
|
677
716
|
const r = safePop(stack), l = safePop(stack);
|
|
678
|
-
|
|
717
|
+
const pctAdd = combinePercentage(l, r, 1);
|
|
718
|
+
const ratePeriodAdd = pctAdd === null ? unifyRatePeriods(l, r) : null;
|
|
719
|
+
if (pctAdd !== null) {
|
|
720
|
+
stack.push(pctAdd);
|
|
721
|
+
} else if (ratePeriodAdd !== null) {
|
|
722
|
+
stack.push(chunkOC6LTXYS_cjs.uomValue(ratePeriodAdd + r.toNumber(), r.unit));
|
|
723
|
+
} else if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
679
724
|
stack.push(chunkOC6LTXYS_cjs.numberValue(l.value + r.value));
|
|
680
725
|
} else if (l.type === 10 /* Boolean */ && r.type === 10 /* Boolean */) {
|
|
681
726
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.value && r.value));
|
|
682
727
|
} else if (l.type === 4 /* Datetime */) {
|
|
683
728
|
if (r.type === 4 /* Datetime */) {
|
|
684
729
|
stack.push(chunkOC6LTXYS_cjs.errorValue("INVALID_DATETIME_OP", "Cannot add two datetimes together"));
|
|
685
|
-
} else if (r.type === 6 /* Uom */ &&
|
|
730
|
+
} else if (r.type === 6 /* Uom */ && chunkNJTXJ5AG_cjs.isWorkdayUnit(r.unit)) {
|
|
686
731
|
stack.push(chunkOC6LTXYS_cjs.datetimeValue(addBusinessDays(l.toNumber(), r.toNumber())));
|
|
687
732
|
} else {
|
|
688
733
|
stack.push(chunkOC6LTXYS_cjs.datetimeValue(l.toNumber() + extractDurationMs(r)));
|
|
@@ -690,18 +735,24 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
690
735
|
} else if (l.type === 6 /* Uom */ && chunkOC6LTXYS_cjs.isTimecodeUnit(l.unit)) {
|
|
691
736
|
stack.push(combineTimecode(l, r, 1));
|
|
692
737
|
} else {
|
|
693
|
-
stack.push(
|
|
738
|
+
stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a + b, (a, b) => a + b, "add"));
|
|
694
739
|
}
|
|
695
740
|
break;
|
|
696
741
|
}
|
|
697
742
|
case 21 /* SUB */: {
|
|
698
743
|
const r = safePop(stack), l = safePop(stack);
|
|
699
|
-
|
|
744
|
+
const pctSub = combinePercentage(l, r, -1);
|
|
745
|
+
const ratePeriodSub = pctSub === null ? unifyRatePeriods(l, r) : null;
|
|
746
|
+
if (pctSub !== null) {
|
|
747
|
+
stack.push(pctSub);
|
|
748
|
+
} else if (ratePeriodSub !== null) {
|
|
749
|
+
stack.push(chunkOC6LTXYS_cjs.uomValue(ratePeriodSub - r.toNumber(), r.unit));
|
|
750
|
+
} else if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
700
751
|
stack.push(chunkOC6LTXYS_cjs.numberValue(l.value - r.value));
|
|
701
752
|
} else if (l.type === 4 /* Datetime */) {
|
|
702
753
|
if (r.type === 4 /* Datetime */) {
|
|
703
754
|
stack.push(chunkOC6LTXYS_cjs.uomValue(l.toNumber() - r.toNumber(), "ms"));
|
|
704
|
-
} else if (r.type === 6 /* Uom */ &&
|
|
755
|
+
} else if (r.type === 6 /* Uom */ && chunkNJTXJ5AG_cjs.isWorkdayUnit(r.unit)) {
|
|
705
756
|
stack.push(chunkOC6LTXYS_cjs.datetimeValue(addBusinessDays(l.toNumber(), -r.toNumber())));
|
|
706
757
|
} else {
|
|
707
758
|
stack.push(chunkOC6LTXYS_cjs.datetimeValue(l.toNumber() - extractDurationMs(r)));
|
|
@@ -709,7 +760,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
709
760
|
} else if (l.type === 6 /* Uom */ && chunkOC6LTXYS_cjs.isTimecodeUnit(l.unit)) {
|
|
710
761
|
stack.push(combineTimecode(l, r, -1));
|
|
711
762
|
} else {
|
|
712
|
-
stack.push(
|
|
763
|
+
stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a - b, (a, b) => a - b, "sub"));
|
|
713
764
|
}
|
|
714
765
|
break;
|
|
715
766
|
}
|
|
@@ -718,35 +769,37 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
718
769
|
if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
719
770
|
stack.push(chunkOC6LTXYS_cjs.numberValue(l.value * r.value));
|
|
720
771
|
} else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
|
|
721
|
-
stack.push(
|
|
772
|
+
stack.push(chunk4CVLFLOB_cjs.matrixMultiply(l.value, r.value));
|
|
722
773
|
} else if (l.type === 6 /* Uom */ && chunkOC6LTXYS_cjs.isRateUnit(l.unit) && r.type === 6 /* Uom */ && r.unit) {
|
|
723
774
|
stack.push(multiplyRateByMatchingUom(l, r));
|
|
724
775
|
} else if (r.type === 6 /* Uom */ && chunkOC6LTXYS_cjs.isRateUnit(r.unit) && l.type === 6 /* Uom */ && l.unit) {
|
|
725
776
|
stack.push(multiplyRateByMatchingUom(r, l));
|
|
777
|
+
} else if (moneyTimesQuantity(l, r) !== null) {
|
|
778
|
+
stack.push(moneyTimesQuantity(l, r));
|
|
726
779
|
} else {
|
|
727
|
-
stack.push(
|
|
780
|
+
stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a * b, (a, b) => a * b, "mul"));
|
|
728
781
|
}
|
|
729
782
|
break;
|
|
730
783
|
}
|
|
731
784
|
case 23 /* DIV */: {
|
|
732
785
|
const r = safePop(stack), l = safePop(stack);
|
|
733
786
|
if (l.type === 6 /* Uom */ && r.type === 6 /* Uom */) {
|
|
734
|
-
const { lv, rv, sameMeasure } =
|
|
787
|
+
const { lv, rv, sameMeasure } = chunk2NPS5DQ3_cjs.unifyUom(l, r);
|
|
735
788
|
if (sameMeasure) {
|
|
736
789
|
stack.push(chunkOC6LTXYS_cjs.numberValue(lv / rv));
|
|
737
|
-
} else if (
|
|
790
|
+
} else if (chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(l.unit) && chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(r.unit)) {
|
|
738
791
|
stack.push(chunkOC6LTXYS_cjs.errorValue("INCOMPATIBLE_UNITS", `Cannot combine incompatible units: ${l.unit} and ${r.unit}`));
|
|
739
792
|
} else {
|
|
740
793
|
stack.push(chunkOC6LTXYS_cjs.rateValue(lv / rv, l.unit, r.unit));
|
|
741
794
|
}
|
|
742
795
|
} else {
|
|
743
|
-
stack.push(
|
|
796
|
+
stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a / b, (a, b) => a / b, "div"));
|
|
744
797
|
}
|
|
745
798
|
break;
|
|
746
799
|
}
|
|
747
800
|
case 24 /* MOD */: {
|
|
748
801
|
const r = safePop(stack), l = safePop(stack);
|
|
749
|
-
stack.push(
|
|
802
|
+
stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a % b, (a, b) => a % b));
|
|
750
803
|
break;
|
|
751
804
|
}
|
|
752
805
|
case 25 /* EXP */: {
|
|
@@ -772,7 +825,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
772
825
|
break;
|
|
773
826
|
}
|
|
774
827
|
if (l.type === 9 /* Symbolic */ || r.type === 9 /* Symbolic */) {
|
|
775
|
-
stack.push(
|
|
828
|
+
stack.push(chunk2NPS5DQ3_cjs.symbolicPow(l, r));
|
|
776
829
|
break;
|
|
777
830
|
}
|
|
778
831
|
stack.push(chunkOC6LTXYS_cjs.numberValue(Math.pow(l.toNumber(), r.toNumber())));
|
|
@@ -782,7 +835,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
782
835
|
const v = safePop(stack);
|
|
783
836
|
if (v.type === 2 /* BigInt */) stack.push(chunkOC6LTXYS_cjs.bigIntValue(-v.value));
|
|
784
837
|
else if (v.type === 6 /* Uom */) stack.push(chunkOC6LTXYS_cjs.uomValue(-v.toNumber(), v.unit));
|
|
785
|
-
else if (v.type === 9 /* Symbolic */) stack.push(
|
|
838
|
+
else if (v.type === 9 /* Symbolic */) stack.push(chunk2NPS5DQ3_cjs.symbolicNeg(v));
|
|
786
839
|
else stack.push(chunkOC6LTXYS_cjs.numberValue(-v.toNumber()));
|
|
787
840
|
break;
|
|
788
841
|
}
|
|
@@ -861,10 +914,10 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
861
914
|
if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
862
915
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.value === r.value));
|
|
863
916
|
} else if (l.type === 6 /* Uom */ && r.type === 6 /* Uom */) {
|
|
864
|
-
const { lv, rv, sameMeasure } =
|
|
917
|
+
const { lv, rv, sameMeasure } = chunk2NPS5DQ3_cjs.unifyUom(l, r);
|
|
865
918
|
stack.push(chunkOC6LTXYS_cjs.boolValue(sameMeasure && lv === rv));
|
|
866
919
|
} else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
|
|
867
|
-
stack.push(
|
|
920
|
+
stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a === b));
|
|
868
921
|
} else {
|
|
869
922
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.toNumber() === r.toNumber()));
|
|
870
923
|
}
|
|
@@ -875,10 +928,10 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
875
928
|
if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
876
929
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.value !== r.value));
|
|
877
930
|
} else if (l.type === 6 /* Uom */ && r.type === 6 /* Uom */) {
|
|
878
|
-
const { lv, rv, sameMeasure } =
|
|
931
|
+
const { lv, rv, sameMeasure } = chunk2NPS5DQ3_cjs.unifyUom(l, r);
|
|
879
932
|
stack.push(chunkOC6LTXYS_cjs.boolValue(!sameMeasure || lv !== rv));
|
|
880
933
|
} else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
|
|
881
|
-
stack.push(
|
|
934
|
+
stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a !== b));
|
|
882
935
|
} else {
|
|
883
936
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.toNumber() !== r.toNumber()));
|
|
884
937
|
}
|
|
@@ -889,7 +942,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
889
942
|
if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
890
943
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.value < r.value));
|
|
891
944
|
} else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
|
|
892
|
-
stack.push(
|
|
945
|
+
stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a < b));
|
|
893
946
|
} else {
|
|
894
947
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.toNumber() < r.toNumber()));
|
|
895
948
|
}
|
|
@@ -900,7 +953,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
900
953
|
if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
901
954
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.value <= r.value));
|
|
902
955
|
} else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
|
|
903
|
-
stack.push(
|
|
956
|
+
stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a <= b));
|
|
904
957
|
} else {
|
|
905
958
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.toNumber() <= r.toNumber()));
|
|
906
959
|
}
|
|
@@ -911,7 +964,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
911
964
|
if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
912
965
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.value > r.value));
|
|
913
966
|
} else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
|
|
914
|
-
stack.push(
|
|
967
|
+
stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a > b));
|
|
915
968
|
} else {
|
|
916
969
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.toNumber() > r.toNumber()));
|
|
917
970
|
}
|
|
@@ -922,7 +975,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
922
975
|
if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
|
|
923
976
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.value >= r.value));
|
|
924
977
|
} else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
|
|
925
|
-
stack.push(
|
|
978
|
+
stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a >= b));
|
|
926
979
|
} else {
|
|
927
980
|
stack.push(chunkOC6LTXYS_cjs.boolValue(l.toNumber() >= r.toNumber()));
|
|
928
981
|
}
|
|
@@ -982,11 +1035,11 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
982
1035
|
if (arg.type === 9 /* Symbolic */) sawSymbolic = true;
|
|
983
1036
|
args.push(arg);
|
|
984
1037
|
}
|
|
985
|
-
const fn =
|
|
1038
|
+
const fn = chunk2NPS5DQ3_cjs.builtinFunctions[fnIdx];
|
|
986
1039
|
if (fn) {
|
|
987
1040
|
const ordered = args.reverse();
|
|
988
|
-
const routeSymbolically = sawSymbolic && !
|
|
989
|
-
stack.push(routeSymbolically ?
|
|
1041
|
+
const routeSymbolically = sawSymbolic && !chunk2NPS5DQ3_cjs.SYMBOLIC_NATIVE_BUILTINS.has(fnIdx);
|
|
1042
|
+
stack.push(routeSymbolically ? chunk2NPS5DQ3_cjs.symbolicBuiltin(fnIdx, ordered) : fn(ordered));
|
|
990
1043
|
}
|
|
991
1044
|
break;
|
|
992
1045
|
}
|
|
@@ -1052,7 +1105,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1052
1105
|
if (val !== void 0) {
|
|
1053
1106
|
stack.push(val);
|
|
1054
1107
|
} else if (symbolicTolerant) {
|
|
1055
|
-
stack.push(chunkOC6LTXYS_cjs.symbolicValue(
|
|
1108
|
+
stack.push(chunkOC6LTXYS_cjs.symbolicValue(chunk4CVLFLOB_cjs.varNode(varName)));
|
|
1056
1109
|
} else {
|
|
1057
1110
|
throw chunkM4N5GA5Z_cjs.ErrorFactory.execution(
|
|
1058
1111
|
"UNDEFINED_VARIABLE",
|
|
@@ -1071,7 +1124,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1071
1124
|
}
|
|
1072
1125
|
case 62 /* LOAD_GLOBAL_VAR */: {
|
|
1073
1126
|
const varName = strings[opcodes[ip++]];
|
|
1074
|
-
const globalValue =
|
|
1127
|
+
const globalValue = chunk2NPS5DQ3_cjs.sharedGlobalVariableStore.get(varName);
|
|
1075
1128
|
if (globalValue === void 0) {
|
|
1076
1129
|
throw chunkM4N5GA5Z_cjs.ErrorFactory.internal({
|
|
1077
1130
|
code: "GLOBAL_VARIABLE_NOT_RESOLVED",
|
|
@@ -1087,7 +1140,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1087
1140
|
case 63 /* STORE_GLOBAL_VAR */: {
|
|
1088
1141
|
const val = safePop(stack);
|
|
1089
1142
|
const varName = strings[opcodes[ip++]];
|
|
1090
|
-
|
|
1143
|
+
chunk2NPS5DQ3_cjs.sharedGlobalVariableStore.set(varName, hasArena ? chunkOC6LTXYS_cjs.persistentValue(val) : val);
|
|
1091
1144
|
stack.push(val);
|
|
1092
1145
|
break;
|
|
1093
1146
|
}
|
|
@@ -1116,7 +1169,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1116
1169
|
}
|
|
1117
1170
|
case 141 /* TO_MULTIPLIER */: {
|
|
1118
1171
|
const v = safePop(stack);
|
|
1119
|
-
stack.push(chunkOC6LTXYS_cjs.stringValue(toMultiplierString(v
|
|
1172
|
+
stack.push(chunkOC6LTXYS_cjs.stringValue(toMultiplierString(v)));
|
|
1120
1173
|
break;
|
|
1121
1174
|
}
|
|
1122
1175
|
case 142 /* TO_SCI */: {
|
|
@@ -1139,7 +1192,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1139
1192
|
case 145 /* CALL_AS_CONVERTER */: {
|
|
1140
1193
|
const name = safePop(stack).value.toLowerCase();
|
|
1141
1194
|
const value = safePop(stack);
|
|
1142
|
-
const converter =
|
|
1195
|
+
const converter = chunk2NPS5DQ3_cjs.asConverterRegistry.get(name);
|
|
1143
1196
|
if (!converter) {
|
|
1144
1197
|
stack.push(chunkOC6LTXYS_cjs.errorValue("UNKNOWN_AS_CONVERTER", `Unknown converter "as ${name}"`));
|
|
1145
1198
|
} else {
|
|
@@ -1160,12 +1213,12 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1160
1213
|
const toUnit = safePop(stack).value;
|
|
1161
1214
|
const fromUnit = safePop(stack).value;
|
|
1162
1215
|
const val = safePop(stack).toNumber();
|
|
1163
|
-
const measure =
|
|
1164
|
-
const isCurrency =
|
|
1165
|
-
if (measure &&
|
|
1166
|
-
stack.push(chunkOC6LTXYS_cjs.uomValue(
|
|
1216
|
+
const measure = chunkNJTXJ5AG_cjs.getMeasure(fromUnit);
|
|
1217
|
+
const isCurrency = chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(fromUnit) && chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(toUnit);
|
|
1218
|
+
if (measure && chunkNJTXJ5AG_cjs.getMeasure(toUnit) === measure) {
|
|
1219
|
+
stack.push(chunkOC6LTXYS_cjs.uomValue(chunkNJTXJ5AG_cjs.convertUnit(val, fromUnit, toUnit), toUnit));
|
|
1167
1220
|
} else if (isCurrency) {
|
|
1168
|
-
const converted =
|
|
1221
|
+
const converted = chunk2MV4HBKC_cjs.sharedCurrencyExchange.convertSync(val, fromUnit, toUnit);
|
|
1169
1222
|
if (converted !== null) {
|
|
1170
1223
|
stack.push(chunkOC6LTXYS_cjs.uomValue(converted, toUnit));
|
|
1171
1224
|
} else {
|
|
@@ -1178,14 +1231,14 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1178
1231
|
}
|
|
1179
1232
|
case 85 /* UOM_POSSIBILITIES */: {
|
|
1180
1233
|
const unit = safePop(stack).value;
|
|
1181
|
-
const possibilities =
|
|
1234
|
+
const possibilities = chunkNJTXJ5AG_cjs.getConvertiblePossibilities(unit);
|
|
1182
1235
|
stack.push(chunkOC6LTXYS_cjs.stringValue(possibilities.length > 0 ? possibilities.join(", ") : `No known units for "${unit}"`));
|
|
1183
1236
|
break;
|
|
1184
1237
|
}
|
|
1185
1238
|
case 83 /* UOM_BEST */: {
|
|
1186
1239
|
const unit = safePop(stack).value;
|
|
1187
1240
|
const val = safePop(stack).toNumber();
|
|
1188
|
-
const { value, unit: bestUnit } =
|
|
1241
|
+
const { value, unit: bestUnit } = chunkNJTXJ5AG_cjs.getBestUnit(val, unit);
|
|
1189
1242
|
stack.push(chunkOC6LTXYS_cjs.uomValue(value, bestUnit));
|
|
1190
1243
|
break;
|
|
1191
1244
|
}
|
|
@@ -1195,12 +1248,12 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1195
1248
|
if (left.type === 6 /* Uom */) {
|
|
1196
1249
|
const fromUnit = left.unit;
|
|
1197
1250
|
const val = left.toNumber();
|
|
1198
|
-
const measure =
|
|
1199
|
-
const isCurrency =
|
|
1200
|
-
if (measure &&
|
|
1201
|
-
stack.push(chunkOC6LTXYS_cjs.uomValue(
|
|
1251
|
+
const measure = chunkNJTXJ5AG_cjs.getMeasure(fromUnit);
|
|
1252
|
+
const isCurrency = chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(fromUnit) && chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(toUnit);
|
|
1253
|
+
if (measure && chunkNJTXJ5AG_cjs.getMeasure(toUnit) === measure) {
|
|
1254
|
+
stack.push(chunkOC6LTXYS_cjs.uomValue(chunkNJTXJ5AG_cjs.convertUnit(val, fromUnit, toUnit), toUnit));
|
|
1202
1255
|
} else if (isCurrency) {
|
|
1203
|
-
const converted =
|
|
1256
|
+
const converted = chunk2MV4HBKC_cjs.sharedCurrencyExchange.convertSync(val, fromUnit, toUnit);
|
|
1204
1257
|
if (converted !== null) {
|
|
1205
1258
|
stack.push(chunkOC6LTXYS_cjs.uomValue(converted, toUnit));
|
|
1206
1259
|
} else {
|
|
@@ -1256,8 +1309,8 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1256
1309
|
break;
|
|
1257
1310
|
}
|
|
1258
1311
|
const { numerator, denominator } = chunkOC6LTXYS_cjs.splitRateUnit(rate.unit);
|
|
1259
|
-
const rateMeasure =
|
|
1260
|
-
const targetMeasure =
|
|
1312
|
+
const rateMeasure = chunkNJTXJ5AG_cjs.getMeasure(denominator);
|
|
1313
|
+
const targetMeasure = chunkNJTXJ5AG_cjs.getMeasure(newDenominatorUnit);
|
|
1261
1314
|
if (!rateMeasure || rateMeasure !== targetMeasure) {
|
|
1262
1315
|
stack.push(chunkOC6LTXYS_cjs.errorValue(
|
|
1263
1316
|
"RATE_CONVERT_MEASURE_MISMATCH",
|
|
@@ -1265,7 +1318,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1265
1318
|
));
|
|
1266
1319
|
break;
|
|
1267
1320
|
}
|
|
1268
|
-
const factor =
|
|
1321
|
+
const factor = chunkNJTXJ5AG_cjs.convertUnit(1, newDenominatorUnit, denominator);
|
|
1269
1322
|
stack.push(chunkOC6LTXYS_cjs.rateValue(rate.toNumber() * factor, numerator, newDenominatorUnit));
|
|
1270
1323
|
break;
|
|
1271
1324
|
}
|
|
@@ -1328,7 +1381,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1328
1381
|
const cellVal = safePop(stack);
|
|
1329
1382
|
rowMajor[i] = cellVal.type === 10 /* Boolean */ ? cellVal.value : cellVal.type === 9 /* Symbolic */ ? cellVal.value : cellVal.toNumber();
|
|
1330
1383
|
}
|
|
1331
|
-
stack.push(chunkOC6LTXYS_cjs.matrixValue(rows, cols,
|
|
1384
|
+
stack.push(chunkOC6LTXYS_cjs.matrixValue(rows, cols, chunk4CVLFLOB_cjs.rowMajorToColumnMajor(rows, cols, rowMajor)));
|
|
1332
1385
|
break;
|
|
1333
1386
|
}
|
|
1334
1387
|
case 153 /* MAT_INDEX1 */: {
|
|
@@ -1354,8 +1407,8 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1354
1407
|
));
|
|
1355
1408
|
break;
|
|
1356
1409
|
}
|
|
1357
|
-
const cell =
|
|
1358
|
-
stack.push(
|
|
1410
|
+
const cell = chunk4CVLFLOB_cjs.matIndex(m, index);
|
|
1411
|
+
stack.push(chunk4CVLFLOB_cjs.matrixEntryToValue(cell));
|
|
1359
1412
|
break;
|
|
1360
1413
|
}
|
|
1361
1414
|
case 154 /* MAT_INDEX2 */: {
|
|
@@ -1379,15 +1432,15 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1379
1432
|
const m = matrixVal.value;
|
|
1380
1433
|
const row = Math.trunc(rowVal.toNumber());
|
|
1381
1434
|
const col = Math.trunc(colVal.toNumber());
|
|
1382
|
-
if (!
|
|
1435
|
+
if (!chunk4CVLFLOB_cjs.inBounds(m, row, col)) {
|
|
1383
1436
|
stack.push(chunkOC6LTXYS_cjs.errorValue(
|
|
1384
1437
|
"MATRIX_INDEX_OUT_OF_BOUNDS",
|
|
1385
1438
|
`[${row}, ${col}] is out of bounds for a ${m.rows}x${m.cols} matrix.`
|
|
1386
1439
|
));
|
|
1387
1440
|
break;
|
|
1388
1441
|
}
|
|
1389
|
-
const cell =
|
|
1390
|
-
stack.push(
|
|
1442
|
+
const cell = chunk4CVLFLOB_cjs.matAt(m, row, col);
|
|
1443
|
+
stack.push(chunk4CVLFLOB_cjs.matrixEntryToValue(cell));
|
|
1391
1444
|
break;
|
|
1392
1445
|
}
|
|
1393
1446
|
case 156 /* RANGE_NEW */: {
|
|
@@ -1457,7 +1510,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1457
1510
|
const data = new Array(newRows * newCols);
|
|
1458
1511
|
for (let r = 0; r < newRows; r++) {
|
|
1459
1512
|
for (let c = 0; c < newCols; c++) {
|
|
1460
|
-
data[r + c * newRows] =
|
|
1513
|
+
data[r + c * newRows] = chunk4CVLFLOB_cjs.matAt(m, rowRange.min + r, colRange.min + c);
|
|
1461
1514
|
}
|
|
1462
1515
|
}
|
|
1463
1516
|
stack.push(chunkOC6LTXYS_cjs.matrixValue(newRows, newCols, data));
|
|
@@ -1511,7 +1564,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1511
1564
|
const cellArrays = new Array(collectionCount);
|
|
1512
1565
|
let mapEarlyError;
|
|
1513
1566
|
for (let i = 0; i < collectionCount; i++) {
|
|
1514
|
-
const resolved =
|
|
1567
|
+
const resolved = chunk4CVLFLOB_cjs.collectionToValues(rawCollections[i]);
|
|
1515
1568
|
if (!Array.isArray(resolved)) {
|
|
1516
1569
|
mapEarlyError = resolved;
|
|
1517
1570
|
break;
|
|
@@ -1536,7 +1589,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1536
1589
|
for (let i = 0; i < collectionLength; i++) {
|
|
1537
1590
|
const args = new Array(collectionCount);
|
|
1538
1591
|
for (let j = 0; j < collectionCount; j++) args[j] = cellArrays[j][i];
|
|
1539
|
-
const resultVal = kind === 1 ?
|
|
1592
|
+
const resultVal = kind === 1 ? chunk2NPS5DQ3_cjs.builtinFunctions[ref]?.(args) ?? chunkOC6LTXYS_cjs.errorValue("UNKNOWN_BUILTIN_FUNCTION", `map: unknown builtin function index ${ref}`) : invokeFrameBody(paramNames, program, args, vm, pipeline, expression, context, !!symbolicTolerant);
|
|
1540
1593
|
if (resultVal.type === 13 /* Error */) {
|
|
1541
1594
|
mapError = resultVal;
|
|
1542
1595
|
break;
|
|
@@ -1586,7 +1639,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1586
1639
|
paramNames = fn.params;
|
|
1587
1640
|
program = fn.program;
|
|
1588
1641
|
}
|
|
1589
|
-
const cells =
|
|
1642
|
+
const cells = chunk4CVLFLOB_cjs.collectionToValues(collectionVal);
|
|
1590
1643
|
if (!Array.isArray(cells)) {
|
|
1591
1644
|
stack.push(cells);
|
|
1592
1645
|
break;
|
|
@@ -1611,7 +1664,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
|
|
|
1611
1664
|
let reduceError;
|
|
1612
1665
|
for (let i = startIdx; i < cells.length; i++) {
|
|
1613
1666
|
const args = [acc, cells[i]];
|
|
1614
|
-
const resultVal = kind === 1 ?
|
|
1667
|
+
const resultVal = kind === 1 ? chunk2NPS5DQ3_cjs.builtinFunctions[ref]?.(args) ?? chunkOC6LTXYS_cjs.errorValue("UNKNOWN_BUILTIN_FUNCTION", `reduce: unknown builtin function index ${ref}`) : invokeFrameBody(paramNames, program, args, vm, pipeline, expression, context, !!symbolicTolerant);
|
|
1615
1668
|
if (resultVal.type === 13 /* Error */) {
|
|
1616
1669
|
reduceError = resultVal;
|
|
1617
1670
|
break;
|
|
@@ -1638,5 +1691,5 @@ exports.DependencyGraph = DependencyGraph;
|
|
|
1638
1691
|
exports.ScopeManager = ScopeManager;
|
|
1639
1692
|
exports.createVM = createVM;
|
|
1640
1693
|
exports.executeBytecode = executeBytecode;
|
|
1641
|
-
//# sourceMappingURL=chunk-
|
|
1642
|
-
//# sourceMappingURL=chunk-
|
|
1694
|
+
//# sourceMappingURL=chunk-M4Q47KHF.cjs.map
|
|
1695
|
+
//# sourceMappingURL=chunk-M4Q47KHF.cjs.map
|