summaryrefslogtreecommitdiff
path: root/node_modules/math-expression-evaluator/dist/browser
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:58:02 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:58:02 +0800
commitfee47f6414cc3ae9a88f3ee0ed20f1d6f2d9f556 (patch)
tree2b99dd57fc676a3819ef3cc46ac43df0043c2bb3 /node_modules/math-expression-evaluator/dist/browser
parent0379526e20e1ff212df23e6326741aa9c06df204 (diff)
added plugin from postcss: postcss-fixes rucksack-css
Diffstat (limited to 'node_modules/math-expression-evaluator/dist/browser')
-rw-r--r--node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js909
-rw-r--r--node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js1
2 files changed, 910 insertions, 0 deletions
diff --git a/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js
new file mode 100644
index 00000000..bdcf6d4c
--- /dev/null
+++ b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.js
@@ -0,0 +1,909 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory();
+ else if(typeof define === 'function' && define.amd)
+ define([], factory);
+ else if(typeof exports === 'object')
+ exports["Mexp"] = factory();
+ else
+ root["Mexp"] = factory();
+})(self, function() {
+return /******/ (() => { // webpackBootstrap
+/******/ var __webpack_modules__ = ({
+
+/***/ 28:
+/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
+
+var Mexp=__webpack_require__(733);
+Mexp.prototype.formulaEval = function () {
+ "use strict";
+ var stack=[],pop1,pop2,pop3;
+ var disp=[];
+ var temp='';
+ var arr=this.value;
+ for(var i=0;i<arr.length;i++){
+ if(arr[i].type===1||arr[i].type===3){
+ disp.push({value:arr[i].type===3?arr[i].show:arr[i].value,type:1});
+ }
+ else if(arr[i].type===13){
+ disp.push({value:arr[i].show,type:1});
+ }
+ else if(arr[i].type===0){
+ disp[disp.length-1]={value:arr[i].show+(arr[i].show!="-"?"(":"")+disp[disp.length-1].value+(arr[i].show!="-"?")":""),type:0};
+ }
+ else if(arr[i].type===7){
+ disp[disp.length-1]={value:(disp[disp.length-1].type!=1?"(":"")+disp[disp.length-1].value+(disp[disp.length-1].type!=1?")":"")+arr[i].show,type:7};
+ }
+ else if(arr[i].type===10){
+ pop1=disp.pop();
+ pop2=disp.pop();
+ if(arr[i].show==='P'||arr[i].show==='C')disp.push({value:"<sup>"+pop2.value+"</sup>"+arr[i].show+"<sub>"+pop1.value+"</sub>",type:10});
+ else disp.push({value:(pop2.type!=1?"(":"")+pop2.value+(pop2.type!=1?")":"")+"<sup>"+pop1.value+"</sup>",type:1});
+ }
+ else if(arr[i].type===2||arr[i].type===9){
+ pop1=disp.pop();
+ pop2=disp.pop();
+ disp.push({value:(pop2.type!=1?"(":"")+pop2.value+(pop2.type!=1?")":"")+arr[i].show+(pop1.type!=1?"(":"")+pop1.value+(pop1.type!=1?")":""),type:arr[i].type});
+ }
+ else if(arr[i].type===12){
+ pop1=disp.pop();
+ pop2=disp.pop();
+ pop3=disp.pop();
+ disp.push({value:arr[i].show+"("+pop3.value+","+pop2.value+","+pop1.value+")",type:12});
+ }
+ }
+ return disp[0].value;
+};
+module.exports=Mexp;
+
+/***/ }),
+
+/***/ 618:
+/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
+
+"use strict";
+
+var Mexp = __webpack_require__(178)
+function inc(arr, val) {
+ for (var i = 0; i < arr.length; i++) {
+ arr[i] += val
+ }
+ return arr
+}
+var tokens = [
+ { token: 'sin', show: 'sin', type: 0, value: Mexp.math.sin },
+ { token: 'cos', show: 'cos', type: 0, value: Mexp.math.cos },
+ { token: 'tan', show: 'tan', type: 0, value: Mexp.math.tan },
+ { token: 'pi', show: '&pi;', type: 3, value: 'PI' },
+ { token: '(', show: '(', type: 4, value: '(' },
+ { token: ')', show: ')', type: 5, value: ')' },
+ { token: 'P', show: 'P', type: 10, value: Mexp.math.P },
+ { token: 'C', show: 'C', type: 10, value: Mexp.math.C },
+ { token: ' ', show: ' ', type: 14, value: ' '.anchor },
+ { token: 'asin', show: 'asin', type: 0, value: Mexp.math.asin },
+ { token: 'acos', show: 'acos', type: 0, value: Mexp.math.acos },
+ { token: 'atan', show: 'atan', type: 0, value: Mexp.math.atan },
+ { token: '7', show: '7', type: 1, value: '7' },
+ { token: '8', show: '8', type: 1, value: '8' },
+ { token: '9', show: '9', type: 1, value: '9' },
+ { token: 'int', show: 'Int', type: 0, value: Math.floor },
+ { token: 'cosh', show: 'cosh', type: 0, value: Mexp.math.cosh },
+ { token: 'acosh', show: 'acosh', type: 0, value: Mexp.math.acosh },
+ { token: 'ln', show: ' ln', type: 0, value: Math.log },
+ { token: '^', show: '^', type: 10, value: Math.pow },
+ { token: 'root', show: 'root', type: 0, value: Math.sqrt },
+ { token: '4', show: '4', type: 1, value: '4' },
+ { token: '5', show: '5', type: 1, value: '5' },
+ { token: '6', show: '6', type: 1, value: '6' },
+ { token: '/', show: '&divide;', type: 2, value: Mexp.math.div },
+ { token: '!', show: '!', type: 7, value: Mexp.math.fact },
+ { token: 'tanh', show: 'tanh', type: 0, value: Mexp.math.tanh },
+ { token: 'atanh', show: 'atanh', type: 0, value: Mexp.math.atanh },
+ { token: 'Mod', show: ' Mod ', type: 2, value: Mexp.math.mod },
+ { token: '1', show: '1', type: 1, value: '1' },
+ { token: '2', show: '2', type: 1, value: '2' },
+ { token: '3', show: '3', type: 1, value: '3' },
+ { token: '*', show: '&times;', type: 2, value: Mexp.math.mul },
+ { token: 'sinh', show: 'sinh', type: 0, value: Mexp.math.sinh },
+ { token: 'asinh', show: 'asinh', type: 0, value: Mexp.math.asinh },
+ { token: 'e', show: 'e', type: 3, value: 'E' },
+ { token: 'log', show: ' log', type: 0, value: Mexp.math.log },
+ { token: '0', show: '0', type: 1, value: '0' },
+ { token: '.', show: '.', type: 6, value: '.' },
+ { token: '+', show: '+', type: 9, value: Mexp.math.add },
+ { token: '-', show: '-', type: 9, value: Mexp.math.sub },
+ { token: ',', show: ',', type: 11, value: ',' },
+ { token: 'Sigma', show: '&Sigma;', type: 12, value: Mexp.math.sigma },
+ { token: 'n', show: 'n', type: 13, value: 'n' },
+ { token: 'Pi', show: '&Pi;', type: 12, value: Mexp.math.Pi },
+ { token: 'pow', show: 'pow', type: 8, value: Math.pow, numberOfArguments: 2 },
+ { token: '&', show: '&', type: 9, value: Mexp.math.and },
+]
+var preced = {
+ 0: 11,
+ 1: 0,
+ 2: 3,
+ 3: 0,
+ 4: 0,
+ 5: 0,
+ 6: 0,
+ 7: 11,
+ 8: 11,
+ 9: 1,
+ 10: 10,
+ 11: 0,
+ 12: 11,
+ 13: 0,
+ 14: -1,
+ 15: 11, // will be filtered after lexer
+} // stores precedence by types
+for (var i = 0; i < tokens.length; i++) {
+ tokens[i].precedence = preced[tokens[i].type]
+}
+var type0 = {
+ 0: true,
+ 1: true,
+ 3: true,
+ 4: true,
+ 6: true,
+ 8: true,
+ 9: true,
+ 12: true,
+ 13: true,
+ 14: true,
+ 15: true,
+} // type2:true,type4:true,type9:true,type11:true,type21:true,type22
+var type1 = {
+ 0: true,
+ 1: true,
+ 2: true,
+ 3: true,
+ 4: true,
+ 5: true,
+ 6: true,
+ 7: true,
+ 8: true,
+ 9: true,
+ 10: true,
+ 11: true,
+ 12: true,
+ 13: true,
+ 15: true,
+} // type3:true,type5:true,type7:true,type23
+var type1Asterick = {
+ 0: true,
+ 3: true,
+ 4: true,
+ 8: true,
+ 12: true,
+ 13: true,
+ 15: true,
+}
+var empty = {}
+var type3Asterick = {
+ 0: true,
+ 1: true,
+ 3: true,
+ 4: true,
+ 6: true,
+ 8: true,
+ 12: true,
+ 13: true,
+ 15: true,
+} // type_5:true,type_7:true,type_23
+var type6 = {
+ 1: true,
+}
+var newAr = [
+ [],
+ [
+ '1',
+ '2',
+ '3',
+ '7',
+ '8',
+ '9',
+ '4',
+ '5',
+ '6',
+ '+',
+ '-',
+ '*',
+ '/',
+ '(',
+ ')',
+ '^',
+ '!',
+ 'P',
+ 'C',
+ 'e',
+ '0',
+ '.',
+ ',',
+ 'n',
+ ' ',
+ '&',
+ ],
+ ['pi', 'ln', 'Pi'],
+ ['sin', 'cos', 'tan', 'Del', 'int', 'Mod', 'log', 'pow'],
+ ['asin', 'acos', 'atan', 'cosh', 'root', 'tanh', 'sinh'],
+ ['acosh', 'atanh', 'asinh', 'Sigma'],
+]
+
+function match(str1, str2, i, x) {
+ for (var f = 0; f < x; f++) {
+ if (str1[i + f] !== str2[f]) {
+ return false
+ }
+ }
+ return true
+}
+Mexp.tokenTypes = {
+ FUNCTION_WITH_ONE_ARG: 0,
+ NUMBER: 1,
+ BINARY_OPERATOR_HIGH_PRECENDENCE: 2,
+ CONSTANT: 3,
+ OPENING_PARENTHESIS: 4,
+ CLOSING_PARENTHESIS: 5,
+ DECIMAL: 6,
+ POSTFIX_FUNCTION_WITH_ONE_ARG: 7,
+ FUNCTION_WITH_N_ARGS: 8,
+ BINARY_OPERATOR_LOW_PRECENDENCE: 9,
+ BINARY_OPERATOR_PERMUTATION: 10,
+ COMMA: 11,
+ EVALUATED_FUNCTION: 12,
+ EVALUATED_FUNCTION_PARAMETER: 13,
+ SPACE: 14,
+}
+/**
+
+ 0 : function with syntax function_name(Maths_exp)
+ 1 : numbers
+ 2 : binary operators like * / Mod left associate and same precedence
+ 3 : Math constant values like e,pi,Cruncher ans
+ 4 : opening bracket
+ 5 : closing bracket
+ 6 : decimal
+ 7 : function with syntax (Math_exp)function_name
+ 8: function with syntax function_name(Math_exp1,Math_exp2)
+ 9 : binary operator like +,-
+ 10: binary operator like P C or ^
+ 11: ,
+ 12: function with , seperated three parameters and third parameter is a string that will be mexp string
+ 13: variable of Sigma function
+ */
+Mexp.addToken = function (newTokens) {
+ for (var i = 0; i < newTokens.length; i++) {
+ var x = newTokens[i].token.length
+ var temp = -1
+ if (newTokens[i].type === Mexp.tokenTypes.FUNCTION_WITH_N_ARGS && newTokens[i].numberOfArguments === undefined) {
+ newTokens[i].numberOfArguments = 2
+ }
+
+ // newAr is a specially designed data structure index of 1d array = length of tokens
+ newAr[x] = newAr[x] || []
+ for (var y = 0; y < newAr[x].length; y++) {
+ if (newTokens[i].token === newAr[x][y]) {
+ temp = indexOfToken(newAr[x][y], tokens)
+ break
+ }
+ }
+ if (temp === -1) {
+ tokens.push(newTokens[i])
+ newTokens[i].precedence = preced[newTokens[i].type]
+ if (newAr.length <= newTokens[i].token.length) {
+ newAr[newTokens[i].token.length] = []
+ }
+ newAr[newTokens[i].token.length].push(newTokens[i].token)
+ } else {
+ // overwrite
+ tokens[temp] = newTokens[i]
+ newTokens[i].precedence = preced[newTokens[i].type]
+ }
+ }
+}
+
+function indexOfToken(key, tokens) {
+ for (var search = 0; search < tokens.length; search++) {
+ if (tokens[search].token === key) return search
+ }
+ return -1
+}
+function tokenize(string) {
+ var nodes = []
+ var length = string.length
+ var key, x, y
+ for (var i = 0; i < length; i++) {
+ if (i < length - 1 && string[i] === ' ' && string[i + 1] === ' ') {
+ continue
+ }
+ key = ''
+ for (x = string.length - i > newAr.length - 2 ? newAr.length - 1 : string.length - i; x > 0; x--) {
+ if (newAr[x] === undefined) continue
+ for (y = 0; y < newAr[x].length; y++) {
+ if (match(string, newAr[x][y], i, x)) {
+ key = newAr[x][y]
+ y = newAr[x].length
+ x = 0
+ }
+ }
+ }
+ i += key.length - 1
+ if (key === '') {
+ throw new Mexp.Exception("Can't understand after " + string.slice(i))
+ }
+ nodes.push(tokens[indexOfToken(key, tokens)])
+ }
+ return nodes
+}
+
+var changeSignObj = {
+ value: Mexp.math.changeSign,
+ type: 0,
+ pre: 21,
+ show: '-',
+}
+var closingParObj = {
+ value: ')',
+ show: ')',
+ type: 5,
+ pre: 0,
+}
+var openingParObj = {
+ value: '(',
+ type: 4,
+ pre: 0,
+ show: '(',
+}
+Mexp.lex = function (inp, tokens) {
+ 'use strict'
+
+ var str = [openingParObj]
+
+ var ptc = [] // Parenthesis to close at the beginning is after one token
+ var inpStr = inp
+ var allowed = type0
+ var bracToClose = 0
+ var asterick = empty
+ var prevKey = ''
+ var i
+ if (typeof tokens !== 'undefined') {
+ Mexp.addToken(tokens)
+ }
+ var obj = {}
+ var nodes = tokenize(inpStr)
+ for (i = 0; i < nodes.length; i++) {
+ var node = nodes[i]
+ if (node.type === 14) {
+ if (
+ i > 0 &&
+ i < nodes.length - 1 &&
+ nodes[i + 1].type === 1 &&
+ (nodes[i - 1].type === 1 || nodes[i - 1].type === 6)
+ ) {
+ throw new Mexp.Exception('Unexpected Space')
+ }
+ continue
+ }
+ var cToken = node.token
+ var cType = node.type
+ var cEv = node.value
+ var cPre = node.precedence
+ var cShow = node.show
+ var pre = str[str.length - 1]
+ var j
+ for (j = ptc.length; j--; ) {
+ // loop over ptc
+ if (ptc[j] === 0) {
+ if ([0, 2, 3, 4, 5, 9, 11, 12, 13].indexOf(cType) !== -1) {
+ if (allowed[cType] !== true) {
+ throw new Mexp.Exception(cToken + ' is not allowed after ' + prevKey)
+ }
+ str.push(closingParObj)
+ allowed = type1
+ asterick = type3Asterick
+ ptc.pop()
+ }
+ } else break
+ }
+ if (allowed[cType] !== true) {
+ throw new Mexp.Exception(cToken + ' is not allowed after ' + prevKey)
+ }
+ if (asterick[cType] === true) {
+ cType = 2
+ cEv = Mexp.math.mul
+ cShow = '&times;'
+ cPre = 3
+ i = i - 1
+ }
+ obj = {
+ value: cEv,
+ type: cType,
+ pre: cPre,
+ show: cShow,
+ numberOfArguments: node.numberOfArguments,
+ }
+ if (cType === 0) {
+ allowed = type0
+ asterick = empty
+ inc(ptc, 2)
+ str.push(obj)
+ if (nodes[i + 1].type !== 4) {
+ str.push(openingParObj)
+ ptc.push(2)
+ }
+ // bracToClose++
+ } else if (cType === 1) {
+ if (pre.type === 1) {
+ pre.value += cEv
+ inc(ptc, 1)
+ } else {
+ str.push(obj)
+ }
+ allowed = type1
+ asterick = type1Asterick
+ } else if (cType === 2) {
+ allowed = type0
+ asterick = empty
+ inc(ptc, 2)
+ str.push(obj)
+ } else if (cType === 3) {
+ // constant
+ str.push(obj)
+ allowed = type1
+ asterick = type3Asterick
+ } else if (cType === 4) {
+ inc(ptc, 1)
+ bracToClose++
+ allowed = type0
+ asterick = empty
+ str.push(obj)
+ } else if (cType === 5) {
+ if (!bracToClose) {
+ throw new Mexp.Exception('Closing parenthesis are more than opening one, wait What!!!')
+ }
+ bracToClose--
+ allowed = type1
+ asterick = type3Asterick
+ str.push(obj)
+ inc(ptc, 1)
+ } else if (cType === 6) {
+ if (pre.hasDec) {
+ throw new Mexp.Exception('Two decimals are not allowed in one number')
+ }
+ if (pre.type !== 1) {
+ pre = {
+ value: 0,
+ type: 1,
+ pre: 0,
+ } // pre needs to be changed as it will the last value now to be safe in later code
+ str.push(pre)
+ // inc(ptc, 1)
+ }
+ allowed = type6
+ inc(ptc, 1)
+ asterick = empty
+ pre.value += cEv
+ pre.hasDec = true
+ } else if (cType === 7) {
+ allowed = type1
+ asterick = type3Asterick
+ inc(ptc, 1)
+ str.push(obj)
+ }
+ if (cType === 8) {
+ allowed = type0
+ asterick = empty
+ inc(ptc, node.numberOfArguments + 2)
+ str.push(obj)
+ // str.push(openingParObj)
+ if (nodes[i + 1].type !== 4) {
+ str.push(openingParObj)
+ ptc.push(node.numberOfArguments + 2)
+ }
+ } else if (cType === 9) {
+ if (pre.type === 9) {
+ if (pre.value === Mexp.math.add) {
+ pre.value = cEv
+ pre.show = cShow
+ inc(ptc, 1)
+ } else if (pre.value === Mexp.math.sub && cShow === '-') {
+ pre.value = Mexp.math.add
+ pre.show = '+'
+ inc(ptc, 1)
+ }
+ } else if (pre.type !== 5 && pre.type !== 7 && pre.type !== 1 && pre.type !== 3 && pre.type !== 13) {
+ // changesign only when negative is found
+ if (cToken === '-') {
+ // do nothing for + token
+ // don't add with the above if statement as that will run the else statement of parent if on Ctoken +
+ allowed = type0
+ asterick = empty
+ inc(ptc, 2).push(2)
+ str.push(changeSignObj)
+ str.push(openingParObj)
+ }
+ } else {
+ str.push(obj)
+ inc(ptc, 2)
+ }
+ allowed = type0
+ asterick = empty
+ } else if (cType === 10) {
+ allowed = type0
+ asterick = empty
+ inc(ptc, 2)
+ str.push(obj)
+ } else if (cType === 11) {
+ allowed = type0
+ asterick = empty
+ str.push(obj)
+ } else if (cType === 12) {
+ allowed = type0
+ asterick = empty
+ inc(ptc, 6)
+ str.push(obj)
+ if (nodes[i + 1].type !== 4) {
+ str.push(openingParObj)
+ ptc.push(6)
+ }
+ } else if (cType === 13) {
+ allowed = type1
+ asterick = type3Asterick
+ str.push(obj)
+ }
+
+ inc(ptc, -1)
+ prevKey = cToken
+ }
+ for (j = ptc.length; j--; ) {
+ // loop over ptc
+ str.push(closingParObj)
+ }
+ if (allowed[5] !== true) {
+ throw new Mexp.Exception('complete the expression')
+ }
+ while (bracToClose--) {
+ str.push(closingParObj)
+ }
+
+ str.push(closingParObj)
+ // console.log(str);
+ return new Mexp(str)
+}
+module.exports = Mexp
+
+
+/***/ }),
+
+/***/ 178:
+/***/ ((module) => {
+
+"use strict";
+
+var Mexp = function (parsed) {
+ this.value = parsed
+}
+
+Mexp.math = {
+ isDegree: true, // mode of calculator
+ acos: function (x) {
+ return (Mexp.math.isDegree ? 180 / Math.PI * Math.acos(x) : Math.acos(x))
+ },
+ add: function (a, b) {
+ return a + b
+ },
+ asin: function (x) {
+ return (Mexp.math.isDegree ? 180 / Math.PI * Math.asin(x) : Math.asin(x))
+ },
+ atan: function (x) {
+ return (Mexp.math.isDegree ? 180 / Math.PI * Math.atan(x) : Math.atan(x))
+ },
+ acosh: function (x) {
+ return Math.log(x + Math.sqrt(x * x - 1))
+ },
+ asinh: function (x) {
+ return Math.log(x + Math.sqrt(x * x + 1))
+ },
+ atanh: function (x) {
+ return Math.log((1 + x) / (1 - x))
+ },
+ C: function (n, r) {
+ var pro = 1
+ var other = n - r
+ var choice = r
+ if (choice < other) {
+ choice = other
+ other = r
+ }
+ for (var i = choice + 1; i <= n; i++) {
+ pro *= i
+ }
+ return pro / Mexp.math.fact(other)
+ },
+ changeSign: function (x) {
+ return -x
+ },
+ cos: function (x) {
+ if (Mexp.math.isDegree) x = Mexp.math.toRadian(x)
+ return Math.cos(x)
+ },
+ cosh: function (x) {
+ return (Math.pow(Math.E, x) + Math.pow(Math.E, -1 * x)) / 2
+ },
+ div: function (a, b) {
+ return a / b
+ },
+ fact: function (n) {
+ if (n % 1 !== 0) return 'NaN'
+ var pro = 1
+ for (var i = 2; i <= n; i++) {
+ pro *= i
+ }
+ return pro
+ },
+ inverse: function (x) {
+ return 1 / x
+ },
+ log: function (i) {
+ return Math.log(i) / Math.log(10)
+ },
+ mod: function (a, b) {
+ return a % b
+ },
+ mul: function (a, b) {
+ return a * b
+ },
+ P: function (n, r) {
+ var pro = 1
+ for (var i = Math.floor(n) - Math.floor(r) + 1; i <= Math.floor(n); i++) {
+ pro *= i
+ }
+ return pro
+ },
+ Pi: function (low, high, ex) {
+ var pro = 1
+ for (var i = low; i <= high; i++) {
+ pro *= Number(ex.postfixEval({
+ n: i
+ }))
+ }
+ return pro
+ },
+ pow10x: function (e) {
+ var x = 1
+ while (e--) {
+ x *= 10
+ }
+ return x
+ },
+ sigma: function (low, high, ex) {
+ var sum = 0
+ for (var i = low; i <= high; i++) {
+ sum += Number(ex.postfixEval({
+ n: i
+ }))
+ }
+ return sum
+ },
+ sin: function (x) {
+ if (Mexp.math.isDegree) x = Mexp.math.toRadian(x)
+ return Math.sin(x)
+ },
+ sinh: function (x) {
+ return (Math.pow(Math.E, x) - Math.pow(Math.E, -1 * x)) / 2
+ },
+ sub: function (a, b) {
+ return a - b
+ },
+ tan: function (x) {
+ if (Mexp.math.isDegree) x = Mexp.math.toRadian(x)
+ return Math.tan(x)
+ },
+ tanh: function (x) {
+ return Mexp.sinha(x) / Mexp.cosha(x)
+ },
+ toRadian: function (x) {
+ return x * Math.PI / 180
+ },
+ and: function (a, b) {
+ return a & b
+ }
+}
+Mexp.Exception = function (message) {
+ this.message = message
+}
+module.exports = Mexp
+
+
+/***/ }),
+
+/***/ 477:
+/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
+
+
+var Mexp = __webpack_require__(618);
+
+Mexp.prototype.toPostfix = function () {
+ 'use strict';
+ var post = [], elem, popped, prep, pre, ele;
+ var stack = [{ value: "(", type: 4, pre: 0 }];
+ var arr = this.value;
+ for (var i = 1; i < arr.length; i++) {
+ if (arr[i].type === 1 || arr[i].type === 3 || arr[i].type === 13) { //if token is number,constant,or n(which is also a special constant in our case)
+ if (arr[i].type === 1)
+ arr[i].value = Number(arr[i].value);
+ post.push(arr[i]);
+ }
+ else if (arr[i].type === 4) {
+ stack.push(arr[i]);
+ }
+ else if (arr[i].type === 5) {
+ while ((popped = stack.pop()).type !== 4) {
+ post.push(popped);
+ }
+ }
+ else if (arr[i].type === 11) {
+ while ((popped = stack.pop()).type !== 4) {
+ post.push(popped);
+ }
+ stack.push(popped);
+ }
+ else {
+ elem = arr[i];
+ pre = elem.pre;
+ ele = stack[stack.length - 1];
+ prep = ele.pre;
+ var flag = ele.value == 'Math.pow' && elem.value == 'Math.pow';
+ if (pre > prep) stack.push(elem);
+ else {
+ while (prep >= pre && !flag || flag && pre < prep) {
+ popped = stack.pop();
+ ele = stack[stack.length - 1];
+ post.push(popped);
+ prep = ele.pre;
+ flag = elem.value == 'Math.pow' && ele.value == 'Math.pow';
+ }
+ stack.push(elem);
+ }
+ }
+ }
+ return new Mexp(post);
+};
+module.exports = Mexp;
+
+/***/ }),
+
+/***/ 733:
+/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
+
+var Mexp = __webpack_require__(477)
+Mexp.prototype.postfixEval = function (UserDefined) {
+ 'use strict'
+ UserDefined = UserDefined || {}
+ UserDefined.PI = Math.PI
+ UserDefined.E = Math.E
+ var stack = [],
+ pop1,
+ pop2,
+ pop3
+ var disp = []
+ var temp = ''
+ var arr = this.value
+ var bool = typeof UserDefined.n !== 'undefined'
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i].type === 1) {
+ stack.push({ value: arr[i].value, type: 1 })
+ } else if (arr[i].type === 3) {
+ stack.push({ value: UserDefined[arr[i].value], type: 1 })
+ } else if (arr[i].type === 0) {
+ if (typeof stack[stack.length - 1].type === 'undefined') {
+ stack[stack.length - 1].value.push(arr[i])
+ } else stack[stack.length - 1].value = arr[i].value(stack[stack.length - 1].value)
+ } else if (arr[i].type === 7) {
+ if (typeof stack[stack.length - 1].type === 'undefined') {
+ stack[stack.length - 1].value.push(arr[i])
+ } else stack[stack.length - 1].value = arr[i].value(stack[stack.length - 1].value)
+ } else if (arr[i].type === 8) {
+ var popped = []
+ for (var x = 0; x < arr[i].numberOfArguments; x++) {
+ popped.push(stack.pop().value)
+ }
+ stack.push({ type: 1, value: arr[i].value.apply(arr[i], popped.reverse()) })
+ } else if (arr[i].type === 10) {
+ pop1 = stack.pop()
+ pop2 = stack.pop()
+ if (typeof pop2.type === 'undefined') {
+ pop2.value = pop2.concat(pop1)
+ pop2.value.push(arr[i])
+ stack.push(pop2)
+ } else if (typeof pop1.type === 'undefined') {
+ pop1.unshift(pop2)
+ pop1.push(arr[i])
+ stack.push(pop1)
+ } else {
+ stack.push({ type: 1, value: arr[i].value(pop2.value, pop1.value) })
+ }
+ } else if (arr[i].type === 2 || arr[i].type === 9) {
+ pop1 = stack.pop()
+ pop2 = stack.pop()
+ if (typeof pop2.type === 'undefined') {
+ pop2 = pop2.concat(pop1)
+ pop2.push(arr[i])
+ stack.push(pop2)
+ } else if (typeof pop1.type === 'undefined') {
+ pop1.unshift(pop2)
+ pop1.push(arr[i])
+ stack.push(pop1)
+ } else {
+ stack.push({ type: 1, value: arr[i].value(pop2.value, pop1.value) })
+ }
+ } else if (arr[i].type === 12) {
+ pop1 = stack.pop()
+ if (typeof pop1.type !== 'undefined') {
+ pop1 = [pop1]
+ }
+ pop2 = stack.pop()
+ pop3 = stack.pop()
+ stack.push({ type: 1, value: arr[i].value(pop3.value, pop2.value, new Mexp(pop1)) })
+ } else if (arr[i].type === 13) {
+ if (bool) {
+ stack.push({ value: UserDefined[arr[i].value], type: 3 })
+ } else stack.push([arr[i]])
+ }
+ }
+ if (stack.length > 1) {
+ throw new Mexp.Exception('Uncaught Syntax error')
+ }
+ return stack[0].value > 1000000000000000 ? 'Infinity' : parseFloat(stack[0].value.toFixed(15))
+}
+Mexp.eval = function (str, tokens, obj) {
+ if (typeof tokens === 'undefined') {
+ return this.lex(str).toPostfix().postfixEval()
+ } else if (typeof obj === 'undefined') {
+ if (typeof tokens.length !== 'undefined') return this.lex(str, tokens).toPostfix().postfixEval()
+ else return this.lex(str).toPostfix().postfixEval(tokens)
+ } else return this.lex(str, tokens).toPostfix().postfixEval(obj)
+}
+module.exports = Mexp
+
+
+/***/ })
+
+/******/ });
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module is referenced by other modules so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(28);
+/******/
+/******/ return __webpack_exports__;
+/******/ })()
+;
+}); \ No newline at end of file
diff --git a/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js
new file mode 100644
index 00000000..1b0ae5ff
--- /dev/null
+++ b/node_modules/math-expression-evaluator/dist/browser/math-expression-evaluator.min.js
@@ -0,0 +1 @@
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Mexp=t():e.Mexp=t()}(self,(function(){return e={28:(e,t,o)=>{var n=o(733);n.prototype.formulaEval=function(){"use strict";for(var e,t,o,n=[],a=this.value,p=0;p<a.length;p++)1===a[p].type||3===a[p].type?n.push({value:3===a[p].type?a[p].show:a[p].value,type:1}):13===a[p].type?n.push({value:a[p].show,type:1}):0===a[p].type?n[n.length-1]={value:a[p].show+("-"!=a[p].show?"(":"")+n[n.length-1].value+("-"!=a[p].show?")":""),type:0}:7===a[p].type?n[n.length-1]={value:(1!=n[n.length-1].type?"(":"")+n[n.length-1].value+(1!=n[n.length-1].type?")":"")+a[p].show,type:7}:10===a[p].type?(e=n.pop(),t=n.pop(),"P"===a[p].show||"C"===a[p].show?n.push({value:"<sup>"+t.value+"</sup>"+a[p].show+"<sub>"+e.value+"</sub>",type:10}):n.push({value:(1!=t.type?"(":"")+t.value+(1!=t.type?")":"")+"<sup>"+e.value+"</sup>",type:1})):2===a[p].type||9===a[p].type?(e=n.pop(),t=n.pop(),n.push({value:(1!=t.type?"(":"")+t.value+(1!=t.type?")":"")+a[p].show+(1!=e.type?"(":"")+e.value+(1!=e.type?")":""),type:a[p].type})):12===a[p].type&&(e=n.pop(),t=n.pop(),o=n.pop(),n.push({value:a[p].show+"("+o.value+","+t.value+","+e.value+")",type:12}));return n[0].value},e.exports=n},618:(e,t,o)=>{"use strict";var n=o(178);function a(e,t){for(var o=0;o<e.length;o++)e[o]+=t;return e}for(var p=[{token:"sin",show:"sin",type:0,value:n.math.sin},{token:"cos",show:"cos",type:0,value:n.math.cos},{token:"tan",show:"tan",type:0,value:n.math.tan},{token:"pi",show:"&pi;",type:3,value:"PI"},{token:"(",show:"(",type:4,value:"("},{token:")",show:")",type:5,value:")"},{token:"P",show:"P",type:10,value:n.math.P},{token:"C",show:"C",type:10,value:n.math.C},{token:" ",show:" ",type:14,value:" ".anchor},{token:"asin",show:"asin",type:0,value:n.math.asin},{token:"acos",show:"acos",type:0,value:n.math.acos},{token:"atan",show:"atan",type:0,value:n.math.atan},{token:"7",show:"7",type:1,value:"7"},{token:"8",show:"8",type:1,value:"8"},{token:"9",show:"9",type:1,value:"9"},{token:"int",show:"Int",type:0,value:Math.floor},{token:"cosh",show:"cosh",type:0,value:n.math.cosh},{token:"acosh",show:"acosh",type:0,value:n.math.acosh},{token:"ln",show:" ln",type:0,value:Math.log},{token:"^",show:"^",type:10,value:Math.pow},{token:"root",show:"root",type:0,value:Math.sqrt},{token:"4",show:"4",type:1,value:"4"},{token:"5",show:"5",type:1,value:"5"},{token:"6",show:"6",type:1,value:"6"},{token:"/",show:"&divide;",type:2,value:n.math.div},{token:"!",show:"!",type:7,value:n.math.fact},{token:"tanh",show:"tanh",type:0,value:n.math.tanh},{token:"atanh",show:"atanh",type:0,value:n.math.atanh},{token:"Mod",show:" Mod ",type:2,value:n.math.mod},{token:"1",show:"1",type:1,value:"1"},{token:"2",show:"2",type:1,value:"2"},{token:"3",show:"3",type:1,value:"3"},{token:"*",show:"&times;",type:2,value:n.math.mul},{token:"sinh",show:"sinh",type:0,value:n.math.sinh},{token:"asinh",show:"asinh",type:0,value:n.math.asinh},{token:"e",show:"e",type:3,value:"E"},{token:"log",show:" log",type:0,value:n.math.log},{token:"0",show:"0",type:1,value:"0"},{token:".",show:".",type:6,value:"."},{token:"+",show:"+",type:9,value:n.math.add},{token:"-",show:"-",type:9,value:n.math.sub},{token:",",show:",",type:11,value:","},{token:"Sigma",show:"&Sigma;",type:12,value:n.math.sigma},{token:"n",show:"n",type:13,value:"n"},{token:"Pi",show:"&Pi;",type:12,value:n.math.Pi},{token:"pow",show:"pow",type:8,value:Math.pow,numberOfArguments:2},{token:"&",show:"&",type:9,value:n.math.and}],u={0:11,1:0,2:3,3:0,4:0,5:0,6:0,7:11,8:11,9:1,10:10,11:0,12:11,13:0,14:-1,15:11},h=0;h<p.length;h++)p[h].precedence=u[p[h].type];var s={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,9:!0,12:!0,13:!0,14:!0,15:!0},r={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0,10:!0,11:!0,12:!0,13:!0,15:!0},l={0:!0,3:!0,4:!0,8:!0,12:!0,13:!0,15:!0},i={},v={0:!0,1:!0,3:!0,4:!0,6:!0,8:!0,12:!0,13:!0,15:!0},f={1:!0},y=[[],["1","2","3","7","8","9","4","5","6","+","-","*","/","(",")","^","!","P","C","e","0",".",",","n"," ","&"],["pi","ln","Pi"],["sin","cos","tan","Del","int","Mod","log","pow"],["asin","acos","atan","cosh","root","tanh","sinh"],["acosh","atanh","asinh","Sigma"]];function c(e,t,o,n){for(var a=0;a<n;a++)if(e[o+a]!==t[a])return!1;return!0}function w(e,t){for(var o=0;o<t.length;o++)if(t[o].token===e)return o;return-1}function g(e){for(var t,o,a,u=[],h=e.length,s=0;s<h;s++)if(!(s<h-1&&" "===e[s]&&" "===e[s+1])){for(t="",o=e.length-s>y.length-2?y.length-1:e.length-s;o>0;o--)if(void 0!==y[o])for(a=0;a<y[o].length;a++)c(e,y[o][a],s,o)&&(t=y[o][a],a=y[o].length,o=0);if(s+=t.length-1,""===t)throw new n.Exception("Can't understand after "+e.slice(s));u.push(p[w(t,p)])}return u}n.tokenTypes={FUNCTION_WITH_ONE_ARG:0,NUMBER:1,BINARY_OPERATOR_HIGH_PRECENDENCE:2,CONSTANT:3,OPENING_PARENTHESIS:4,CLOSING_PARENTHESIS:5,DECIMAL:6,POSTFIX_FUNCTION_WITH_ONE_ARG:7,FUNCTION_WITH_N_ARGS:8,BINARY_OPERATOR_LOW_PRECENDENCE:9,BINARY_OPERATOR_PERMUTATION:10,COMMA:11,EVALUATED_FUNCTION:12,EVALUATED_FUNCTION_PARAMETER:13,SPACE:14},n.addToken=function(e){for(var t=0;t<e.length;t++){var o=e[t].token.length,a=-1;e[t].type===n.tokenTypes.FUNCTION_WITH_N_ARGS&&void 0===e[t].numberOfArguments&&(e[t].numberOfArguments=2),y[o]=y[o]||[];for(var h=0;h<y[o].length;h++)if(e[t].token===y[o][h]){a=w(y[o][h],p);break}-1===a?(p.push(e[t]),e[t].precedence=u[e[t].type],y.length<=e[t].token.length&&(y[e[t].token.length]=[]),y[e[t].token.length].push(e[t].token)):(p[a]=e[t],e[t].precedence=u[e[t].type])}};var m={value:n.math.changeSign,type:0,pre:21,show:"-"},d={value:")",show:")",type:5,pre:0},k={value:"(",type:4,pre:0,show:"("};n.lex=function(e,t){var o,p=[k],u=[],h=e,y=s,c=0,w=i,M="";void 0!==t&&n.addToken(t);var E={},x=g(h);for(o=0;o<x.length;o++){var N=x[o];if(14!==N.type){var P,A=N.token,I=N.type,O=N.value,T=N.precedence,_=N.show,R=p[p.length-1];for(P=u.length;P--&&0===u[P];)if(-1!==[0,2,3,4,5,9,11,12,13].indexOf(I)){if(!0!==y[I])throw new n.Exception(A+" is not allowed after "+M);p.push(d),y=r,w=v,u.pop()}if(!0!==y[I])throw new n.Exception(A+" is not allowed after "+M);if(!0===w[I]&&(I=2,O=n.math.mul,_="&times;",T=3,o-=1),E={value:O,type:I,pre:T,show:_,numberOfArguments:N.numberOfArguments},0===I)y=s,w=i,a(u,2),p.push(E),4!==x[o+1].type&&(p.push(k),u.push(2));else if(1===I)1===R.type?(R.value+=O,a(u,1)):p.push(E),y=r,w=l;else if(2===I)y=s,w=i,a(u,2),p.push(E);else if(3===I)p.push(E),y=r,w=v;else if(4===I)a(u,1),c++,y=s,w=i,p.push(E);else if(5===I){if(!c)throw new n.Exception("Closing parenthesis are more than opening one, wait What!!!");c--,y=r,w=v,p.push(E),a(u,1)}else if(6===I){if(R.hasDec)throw new n.Exception("Two decimals are not allowed in one number");1!==R.type&&(R={value:0,type:1,pre:0},p.push(R)),y=f,a(u,1),w=i,R.value+=O,R.hasDec=!0}else 7===I&&(y=r,w=v,a(u,1),p.push(E));8===I?(y=s,w=i,a(u,N.numberOfArguments+2),p.push(E),4!==x[o+1].type&&(p.push(k),u.push(N.numberOfArguments+2))):9===I?(9===R.type?R.value===n.math.add?(R.value=O,R.show=_,a(u,1)):R.value===n.math.sub&&"-"===_&&(R.value=n.math.add,R.show="+",a(u,1)):5!==R.type&&7!==R.type&&1!==R.type&&3!==R.type&&13!==R.type?"-"===A&&(y=s,w=i,a(u,2).push(2),p.push(m),p.push(k)):(p.push(E),a(u,2)),y=s,w=i):10===I?(y=s,w=i,a(u,2),p.push(E)):11===I?(y=s,w=i,p.push(E)):12===I?(y=s,w=i,a(u,6),p.push(E),4!==x[o+1].type&&(p.push(k),u.push(6))):13===I&&(y=r,w=v,p.push(E)),a(u,-1),M=A}else if(o>0&&o<x.length-1&&1===x[o+1].type&&(1===x[o-1].type||6===x[o-1].type))throw new n.Exception("Unexpected Space")}for(P=u.length;P--;)p.push(d);if(!0!==y[5])throw new n.Exception("complete the expression");for(;c--;)p.push(d);return p.push(d),new n(p)},e.exports=n},178:e=>{"use strict";var t=function(e){this.value=e};t.math={isDegree:!0,acos:function(e){return t.math.isDegree?180/Math.PI*Math.acos(e):Math.acos(e)},add:function(e,t){return e+t},asin:function(e){return t.math.isDegree?180/Math.PI*Math.asin(e):Math.asin(e)},atan:function(e){return t.math.isDegree?180/Math.PI*Math.atan(e):Math.atan(e)},acosh:function(e){return Math.log(e+Math.sqrt(e*e-1))},asinh:function(e){return Math.log(e+Math.sqrt(e*e+1))},atanh:function(e){return Math.log((1+e)/(1-e))},C:function(e,o){var n=1,a=e-o,p=o;p<a&&(p=a,a=o);for(var u=p+1;u<=e;u++)n*=u;return n/t.math.fact(a)},changeSign:function(e){return-e},cos:function(e){return t.math.isDegree&&(e=t.math.toRadian(e)),Math.cos(e)},cosh:function(e){return(Math.pow(Math.E,e)+Math.pow(Math.E,-1*e))/2},div:function(e,t){return e/t},fact:function(e){if(e%1!=0)return"NaN";for(var t=1,o=2;o<=e;o++)t*=o;return t},inverse:function(e){return 1/e},log:function(e){return Math.log(e)/Math.log(10)},mod:function(e,t){return e%t},mul:function(e,t){return e*t},P:function(e,t){for(var o=1,n=Math.floor(e)-Math.floor(t)+1;n<=Math.floor(e);n++)o*=n;return o},Pi:function(e,t,o){for(var n=1,a=e;a<=t;a++)n*=Number(o.postfixEval({n:a}));return n},pow10x:function(e){for(var t=1;e--;)t*=10;return t},sigma:function(e,t,o){for(var n=0,a=e;a<=t;a++)n+=Number(o.postfixEval({n:a}));return n},sin:function(e){return t.math.isDegree&&(e=t.math.toRadian(e)),Math.sin(e)},sinh:function(e){return(Math.pow(Math.E,e)-Math.pow(Math.E,-1*e))/2},sub:function(e,t){return e-t},tan:function(e){return t.math.isDegree&&(e=t.math.toRadian(e)),Math.tan(e)},tanh:function(e){return t.sinha(e)/t.cosha(e)},toRadian:function(e){return e*Math.PI/180},and:function(e,t){return e&t}},t.Exception=function(e){this.message=e},e.exports=t},477:(e,t,o)=>{var n=o(618);n.prototype.toPostfix=function(){"use strict";for(var e,t,o,a,p,u=[],h=[{value:"(",type:4,pre:0}],s=this.value,r=1;r<s.length;r++)if(1===s[r].type||3===s[r].type||13===s[r].type)1===s[r].type&&(s[r].value=Number(s[r].value)),u.push(s[r]);else if(4===s[r].type)h.push(s[r]);else if(5===s[r].type)for(;4!==(t=h.pop()).type;)u.push(t);else if(11===s[r].type){for(;4!==(t=h.pop()).type;)u.push(t);h.push(t)}else{a=(e=s[r]).pre,o=(p=h[h.length-1]).pre;var l="Math.pow"==p.value&&"Math.pow"==e.value;if(a>o)h.push(e);else{for(;o>=a&&!l||l&&a<o;)t=h.pop(),p=h[h.length-1],u.push(t),o=p.pre,l="Math.pow"==e.value&&"Math.pow"==p.value;h.push(e)}}return new n(u)},e.exports=n},733:(e,t,o)=>{var n=o(477);n.prototype.postfixEval=function(e){"use strict";(e=e||{}).PI=Math.PI,e.E=Math.E;for(var t,o,a,p=[],u=this.value,h=void 0!==e.n,s=0;s<u.length;s++)if(1===u[s].type)p.push({value:u[s].value,type:1});else if(3===u[s].type)p.push({value:e[u[s].value],type:1});else if(0===u[s].type)void 0===p[p.length-1].type?p[p.length-1].value.push(u[s]):p[p.length-1].value=u[s].value(p[p.length-1].value);else if(7===u[s].type)void 0===p[p.length-1].type?p[p.length-1].value.push(u[s]):p[p.length-1].value=u[s].value(p[p.length-1].value);else if(8===u[s].type){for(var r=[],l=0;l<u[s].numberOfArguments;l++)r.push(p.pop().value);p.push({type:1,value:u[s].value.apply(u[s],r.reverse())})}else 10===u[s].type?(t=p.pop(),void 0===(o=p.pop()).type?(o.value=o.concat(t),o.value.push(u[s]),p.push(o)):void 0===t.type?(t.unshift(o),t.push(u[s]),p.push(t)):p.push({type:1,value:u[s].value(o.value,t.value)})):2===u[s].type||9===u[s].type?(t=p.pop(),void 0===(o=p.pop()).type?((o=o.concat(t)).push(u[s]),p.push(o)):void 0===t.type?(t.unshift(o),t.push(u[s]),p.push(t)):p.push({type:1,value:u[s].value(o.value,t.value)})):12===u[s].type?(void 0!==(t=p.pop()).type&&(t=[t]),o=p.pop(),a=p.pop(),p.push({type:1,value:u[s].value(a.value,o.value,new n(t))})):13===u[s].type&&(h?p.push({value:e[u[s].value],type:3}):p.push([u[s]]));if(p.length>1)throw new n.Exception("Uncaught Syntax error");return p[0].value>1e15?"Infinity":parseFloat(p[0].value.toFixed(15))},n.eval=function(e,t,o){return void 0===t?this.lex(e).toPostfix().postfixEval():void 0===o?void 0!==t.length?this.lex(e,t).toPostfix().postfixEval():this.lex(e).toPostfix().postfixEval(t):this.lex(e,t).toPostfix().postfixEval(o)},e.exports=n}},t={},o=function o(n){var a=t[n];if(void 0!==a)return a.exports;var p=t[n]={exports:{}};return e[n](p,p.exports,o),p.exports}(28),o;var e,t,o})); \ No newline at end of file