solve-engine 1.0.0-beta.4 → 1.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{chunk-X2BWAZAU.cjs → chunk-73GSBGUU.cjs} +27 -27
  2. package/dist/{chunk-X2BWAZAU.cjs.map → chunk-73GSBGUU.cjs.map} +1 -1
  3. package/dist/{chunk-EAAHVJ4P.cjs → chunk-AZUA3F4I.cjs} +3 -3
  4. package/dist/{chunk-EAAHVJ4P.cjs.map → chunk-AZUA3F4I.cjs.map} +1 -1
  5. package/dist/{chunk-3MNKQZ77.js → chunk-BAMZT3GL.js} +3 -3
  6. package/dist/{chunk-3MNKQZ77.js.map → chunk-BAMZT3GL.js.map} +1 -1
  7. package/dist/{chunk-2NPS5DQ3.cjs → chunk-BXKJLM5R.cjs} +13 -5
  8. package/dist/chunk-BXKJLM5R.cjs.map +1 -0
  9. package/dist/{chunk-43G3JT2E.cjs → chunk-CSG5XVNJ.cjs} +35 -35
  10. package/dist/chunk-CSG5XVNJ.cjs.map +1 -0
  11. package/dist/{chunk-FIFQPKBA.js → chunk-GVWHCL2N.js} +3 -3
  12. package/dist/chunk-GVWHCL2N.js.map +1 -0
  13. package/dist/{chunk-KHJUSHFU.js → chunk-MVBEL57Q.js} +13 -5
  14. package/dist/chunk-MVBEL57Q.js.map +1 -0
  15. package/dist/{chunk-M4Q47KHF.cjs → chunk-QDMPOAI7.cjs} +22 -22
  16. package/dist/{chunk-M4Q47KHF.cjs.map → chunk-QDMPOAI7.cjs.map} +1 -1
  17. package/dist/{chunk-DDQVZGLO.js → chunk-TZLCIJWP.js} +6 -6
  18. package/dist/{chunk-DDQVZGLO.js.map → chunk-TZLCIJWP.js.map} +1 -1
  19. package/dist/{chunk-OWRHDUJD.js → chunk-VZH3NOLP.js} +3 -3
  20. package/dist/{chunk-OWRHDUJD.js.map → chunk-VZH3NOLP.js.map} +1 -1
  21. package/dist/constants.cjs +4 -4
  22. package/dist/constants.js +1 -1
  23. package/dist/engine.cjs +15 -15
  24. package/dist/engine.js +5 -5
  25. package/dist/index.cjs +11 -11
  26. package/dist/index.js +6 -6
  27. package/dist/packages.cjs +25 -25
  28. package/dist/packages.d.cts +42 -0
  29. package/dist/packages.d.ts +42 -0
  30. package/dist/packages.js +2 -2
  31. package/dist/vm.cjs +13 -13
  32. package/dist/vm.js +2 -2
  33. package/package.json +1 -1
  34. package/dist/chunk-2NPS5DQ3.cjs.map +0 -1
  35. package/dist/chunk-43G3JT2E.cjs.map +0 -1
  36. package/dist/chunk-FIFQPKBA.js.map +0 -1
  37. package/dist/chunk-KHJUSHFU.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk47LRVGOT_cjs = require('./chunk-47LRVGOT.cjs');
4
- var chunk2NPS5DQ3_cjs = require('./chunk-2NPS5DQ3.cjs');
4
+ var chunkBXKJLM5R_cjs = require('./chunk-BXKJLM5R.cjs');
5
5
  var chunk2MV4HBKC_cjs = require('./chunk-2MV4HBKC.cjs');
6
6
  var chunkMZOVP3WI_cjs = require('./chunk-MZOVP3WI.cjs');
7
7
  var chunk4CVLFLOB_cjs = require('./chunk-4CVLFLOB.cjs');
@@ -333,7 +333,7 @@ var ScopeManager = class {
333
333
  };
334
334
 
335
335
  // src/vm/VM.ts
336
- function createVM(registry, maxStackDepth = 200, maxInstructions = 5e4, maxFunctionRecursionDepth = 50, context = chunk2NPS5DQ3_cjs.defaultEngineContext) {
336
+ function createVM(registry, maxStackDepth = 200, maxInstructions = 5e4, maxFunctionRecursionDepth = 50, context = chunkBXKJLM5R_cjs.defaultEngineContext) {
337
337
  const stack = [];
338
338
  const variables = /* @__PURE__ */ new Map();
339
339
  let instructionCount = 0;
@@ -735,7 +735,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
735
735
  } else if (l.type === 6 /* Uom */ && chunkOC6LTXYS_cjs.isTimecodeUnit(l.unit)) {
736
736
  stack.push(combineTimecode(l, r, 1));
737
737
  } else {
738
- stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a + b, (a, b) => a + b, "add"));
738
+ stack.push(chunkBXKJLM5R_cjs.binaryOp(l, r, (a, b) => a + b, (a, b) => a + b, "add"));
739
739
  }
740
740
  break;
741
741
  }
@@ -760,7 +760,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
760
760
  } else if (l.type === 6 /* Uom */ && chunkOC6LTXYS_cjs.isTimecodeUnit(l.unit)) {
761
761
  stack.push(combineTimecode(l, r, -1));
762
762
  } else {
763
- stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a - b, (a, b) => a - b, "sub"));
763
+ stack.push(chunkBXKJLM5R_cjs.binaryOp(l, r, (a, b) => a - b, (a, b) => a - b, "sub"));
764
764
  }
765
765
  break;
766
766
  }
@@ -777,14 +777,14 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
777
777
  } else if (moneyTimesQuantity(l, r) !== null) {
778
778
  stack.push(moneyTimesQuantity(l, r));
779
779
  } else {
780
- stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a * b, (a, b) => a * b, "mul"));
780
+ stack.push(chunkBXKJLM5R_cjs.binaryOp(l, r, (a, b) => a * b, (a, b) => a * b, "mul"));
781
781
  }
782
782
  break;
783
783
  }
784
784
  case 23 /* DIV */: {
785
785
  const r = safePop(stack), l = safePop(stack);
786
786
  if (l.type === 6 /* Uom */ && r.type === 6 /* Uom */) {
787
- const { lv, rv, sameMeasure } = chunk2NPS5DQ3_cjs.unifyUom(l, r);
787
+ const { lv, rv, sameMeasure } = chunkBXKJLM5R_cjs.unifyUom(l, r);
788
788
  if (sameMeasure) {
789
789
  stack.push(chunkOC6LTXYS_cjs.numberValue(lv / rv));
790
790
  } else if (chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(l.unit) && chunk2MV4HBKC_cjs.sharedCurrencyExchange.isCurrency(r.unit)) {
@@ -793,13 +793,13 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
793
793
  stack.push(chunkOC6LTXYS_cjs.rateValue(lv / rv, l.unit, r.unit));
794
794
  }
795
795
  } else {
796
- stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a / b, (a, b) => a / b, "div"));
796
+ stack.push(chunkBXKJLM5R_cjs.binaryOp(l, r, (a, b) => a / b, (a, b) => a / b, "div"));
797
797
  }
798
798
  break;
799
799
  }
800
800
  case 24 /* MOD */: {
801
801
  const r = safePop(stack), l = safePop(stack);
802
- stack.push(chunk2NPS5DQ3_cjs.binaryOp(l, r, (a, b) => a % b, (a, b) => a % b));
802
+ stack.push(chunkBXKJLM5R_cjs.binaryOp(l, r, (a, b) => a % b, (a, b) => a % b));
803
803
  break;
804
804
  }
805
805
  case 25 /* EXP */: {
@@ -825,7 +825,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
825
825
  break;
826
826
  }
827
827
  if (l.type === 9 /* Symbolic */ || r.type === 9 /* Symbolic */) {
828
- stack.push(chunk2NPS5DQ3_cjs.symbolicPow(l, r));
828
+ stack.push(chunkBXKJLM5R_cjs.symbolicPow(l, r));
829
829
  break;
830
830
  }
831
831
  stack.push(chunkOC6LTXYS_cjs.numberValue(Math.pow(l.toNumber(), r.toNumber())));
@@ -835,7 +835,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
835
835
  const v = safePop(stack);
836
836
  if (v.type === 2 /* BigInt */) stack.push(chunkOC6LTXYS_cjs.bigIntValue(-v.value));
837
837
  else if (v.type === 6 /* Uom */) stack.push(chunkOC6LTXYS_cjs.uomValue(-v.toNumber(), v.unit));
838
- else if (v.type === 9 /* Symbolic */) stack.push(chunk2NPS5DQ3_cjs.symbolicNeg(v));
838
+ else if (v.type === 9 /* Symbolic */) stack.push(chunkBXKJLM5R_cjs.symbolicNeg(v));
839
839
  else stack.push(chunkOC6LTXYS_cjs.numberValue(-v.toNumber()));
840
840
  break;
841
841
  }
@@ -914,7 +914,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
914
914
  if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
915
915
  stack.push(chunkOC6LTXYS_cjs.boolValue(l.value === r.value));
916
916
  } else if (l.type === 6 /* Uom */ && r.type === 6 /* Uom */) {
917
- const { lv, rv, sameMeasure } = chunk2NPS5DQ3_cjs.unifyUom(l, r);
917
+ const { lv, rv, sameMeasure } = chunkBXKJLM5R_cjs.unifyUom(l, r);
918
918
  stack.push(chunkOC6LTXYS_cjs.boolValue(sameMeasure && lv === rv));
919
919
  } else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
920
920
  stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a === b));
@@ -928,7 +928,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
928
928
  if (l.type === 0 /* Number */ && r.type === 0 /* Number */) {
929
929
  stack.push(chunkOC6LTXYS_cjs.boolValue(l.value !== r.value));
930
930
  } else if (l.type === 6 /* Uom */ && r.type === 6 /* Uom */) {
931
- const { lv, rv, sameMeasure } = chunk2NPS5DQ3_cjs.unifyUom(l, r);
931
+ const { lv, rv, sameMeasure } = chunkBXKJLM5R_cjs.unifyUom(l, r);
932
932
  stack.push(chunkOC6LTXYS_cjs.boolValue(!sameMeasure || lv !== rv));
933
933
  } else if (l.type === 7 /* Matrix */ && r.type === 7 /* Matrix */) {
934
934
  stack.push(chunk4CVLFLOB_cjs.matrixCompare(l.value, r.value, (a, b) => a !== b));
@@ -1035,11 +1035,11 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
1035
1035
  if (arg.type === 9 /* Symbolic */) sawSymbolic = true;
1036
1036
  args.push(arg);
1037
1037
  }
1038
- const fn = chunk2NPS5DQ3_cjs.builtinFunctions[fnIdx];
1038
+ const fn = chunkBXKJLM5R_cjs.builtinFunctions[fnIdx];
1039
1039
  if (fn) {
1040
1040
  const ordered = args.reverse();
1041
- const routeSymbolically = sawSymbolic && !chunk2NPS5DQ3_cjs.SYMBOLIC_NATIVE_BUILTINS.has(fnIdx);
1042
- stack.push(routeSymbolically ? chunk2NPS5DQ3_cjs.symbolicBuiltin(fnIdx, ordered) : fn(ordered));
1041
+ const routeSymbolically = sawSymbolic && !chunkBXKJLM5R_cjs.SYMBOLIC_NATIVE_BUILTINS.has(fnIdx);
1042
+ stack.push(routeSymbolically ? chunkBXKJLM5R_cjs.symbolicBuiltin(fnIdx, ordered) : fn(ordered));
1043
1043
  }
1044
1044
  break;
1045
1045
  }
@@ -1124,7 +1124,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
1124
1124
  }
1125
1125
  case 62 /* LOAD_GLOBAL_VAR */: {
1126
1126
  const varName = strings[opcodes[ip++]];
1127
- const globalValue = chunk2NPS5DQ3_cjs.sharedGlobalVariableStore.get(varName);
1127
+ const globalValue = chunkBXKJLM5R_cjs.sharedGlobalVariableStore.get(varName);
1128
1128
  if (globalValue === void 0) {
1129
1129
  throw chunkM4N5GA5Z_cjs.ErrorFactory.internal({
1130
1130
  code: "GLOBAL_VARIABLE_NOT_RESOLVED",
@@ -1140,7 +1140,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
1140
1140
  case 63 /* STORE_GLOBAL_VAR */: {
1141
1141
  const val = safePop(stack);
1142
1142
  const varName = strings[opcodes[ip++]];
1143
- chunk2NPS5DQ3_cjs.sharedGlobalVariableStore.set(varName, hasArena ? chunkOC6LTXYS_cjs.persistentValue(val) : val);
1143
+ chunkBXKJLM5R_cjs.sharedGlobalVariableStore.set(varName, hasArena ? chunkOC6LTXYS_cjs.persistentValue(val) : val);
1144
1144
  stack.push(val);
1145
1145
  break;
1146
1146
  }
@@ -1192,7 +1192,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
1192
1192
  case 145 /* CALL_AS_CONVERTER */: {
1193
1193
  const name = safePop(stack).value.toLowerCase();
1194
1194
  const value = safePop(stack);
1195
- const converter = chunk2NPS5DQ3_cjs.asConverterRegistry.get(name);
1195
+ const converter = chunkBXKJLM5R_cjs.asConverterRegistry.get(name);
1196
1196
  if (!converter) {
1197
1197
  stack.push(chunkOC6LTXYS_cjs.errorValue("UNKNOWN_AS_CONVERTER", `Unknown converter "as ${name}"`));
1198
1198
  } else {
@@ -1589,7 +1589,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
1589
1589
  for (let i = 0; i < collectionLength; i++) {
1590
1590
  const args = new Array(collectionCount);
1591
1591
  for (let j = 0; j < collectionCount; j++) args[j] = cellArrays[j][i];
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);
1592
+ const resultVal = kind === 1 ? chunkBXKJLM5R_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);
1593
1593
  if (resultVal.type === 13 /* Error */) {
1594
1594
  mapError = resultVal;
1595
1595
  break;
@@ -1664,7 +1664,7 @@ function executeBytecode(bytecode, vm, pipeline, expression, context, symbolicTo
1664
1664
  let reduceError;
1665
1665
  for (let i = startIdx; i < cells.length; i++) {
1666
1666
  const args = [acc, cells[i]];
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);
1667
+ const resultVal = kind === 1 ? chunkBXKJLM5R_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);
1668
1668
  if (resultVal.type === 13 /* Error */) {
1669
1669
  reduceError = resultVal;
1670
1670
  break;
@@ -1691,5 +1691,5 @@ exports.DependencyGraph = DependencyGraph;
1691
1691
  exports.ScopeManager = ScopeManager;
1692
1692
  exports.createVM = createVM;
1693
1693
  exports.executeBytecode = executeBytecode;
1694
- //# sourceMappingURL=chunk-M4Q47KHF.cjs.map
1695
- //# sourceMappingURL=chunk-M4Q47KHF.cjs.map
1694
+ //# sourceMappingURL=chunk-QDMPOAI7.cjs.map
1695
+ //# sourceMappingURL=chunk-QDMPOAI7.cjs.map