@openmrs/esm-expression-evaluator 5.8.2-pre.2533 → 6.0.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.
@@ -1,5 +1,5 @@
1
- asset openmrs-esm-expression-evaluator.js 32 KiB [emitted] [minimized] (name: main) 1 related asset
2
- orphan modules 89.4 KiB [orphan] 10 modules
1
+ asset openmrs-esm-expression-evaluator.js 32.1 KiB [emitted] [minimized] (name: main) 1 related asset
2
+ orphan modules 89.8 KiB [orphan] 10 modules
3
3
  runtime modules 670 bytes 3 modules
4
- ./src/index.ts + 10 modules 89.5 KiB [built] [code generated]
5
- webpack 5.88.0 compiled successfully in 7398 ms
4
+ ./src/index.ts + 10 modules 89.9 KiB [built] [code generated]
5
+ webpack 5.88.0 compiled successfully in 8159 ms
@@ -1,2 +1,2 @@
1
- System.register([],(function(e,t){return{execute:function(){e((()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compile:()=>U,evaluate:()=>S,evaluateAsBoolean:()=>I,evaluateAsBooleanAsync:()=>j,evaluateAsNumber:()=>N,evaluateAsNumberAsync:()=>M,evaluateAsType:()=>L,evaluateAsTypeAsync:()=>B,evaluateAsync:()=>R,extractVariableNames:()=>W,jsep:()=>i});class r{static get version(){return"1.3.9"}static toString(){return"JavaScript Expression Parser (JSEP) v"+r.version}static addUnaryOp(e){return r.max_unop_len=Math.max(e.length,r.max_unop_len),r.unary_ops[e]=1,r}static addBinaryOp(e,t,n){return r.max_binop_len=Math.max(e.length,r.max_binop_len),r.binary_ops[e]=t,n?r.right_associative.add(e):r.right_associative.delete(e),r}static addIdentifierChar(e){return r.additional_identifier_chars.add(e),r}static addLiteral(e,t){return r.literals[e]=t,r}static removeUnaryOp(e){return delete r.unary_ops[e],e.length===r.max_unop_len&&(r.max_unop_len=r.getMaxKeyLen(r.unary_ops)),r}static removeAllUnaryOps(){return r.unary_ops={},r.max_unop_len=0,r}static removeIdentifierChar(e){return r.additional_identifier_chars.delete(e),r}static removeBinaryOp(e){return delete r.binary_ops[e],e.length===r.max_binop_len&&(r.max_binop_len=r.getMaxKeyLen(r.binary_ops)),r.right_associative.delete(e),r}static removeAllBinaryOps(){return r.binary_ops={},r.max_binop_len=0,r}static removeLiteral(e){return delete r.literals[e],r}static removeAllLiterals(){return r.literals={},r}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new r(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map((e=>e.length)))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return r.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!r.binary_ops[String.fromCharCode(e)]||r.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return r.isIdentifierStart(e)||r.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(r.hooks[e]){const n={context:this,node:t};return r.hooks.run(e,n),n.node}return t}searchHook(e){if(r.hooks[e]){const t={context:this};return r.hooks[e].find((function(e){return e.call(t.context,t),t.node})),t.node}}gobbleSpaces(){let e=this.code;for(;e===r.SPACE_CODE||e===r.TAB_CODE||e===r.LF_CODE||e===r.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:r.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,n,i=[];for(;this.index<this.expr.length;)if(t=this.code,t===r.SEMCOL_CODE||t===r.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())i.push(n);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,r.max_binop_len),t=e.length;for(;t>0;){if(r.binary_ops.hasOwnProperty(e)&&(!r.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!r.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,i,o,s,a,c,l;if(s=this.gobbleToken(),!s)return s;if(t=this.gobbleBinaryOp(),!t)return s;for(o={value:t,prec:r.binaryPrecedence(t),right_a:r.right_associative.has(t)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+t),i=[s,o,a];t=this.gobbleBinaryOp();){if(n=r.binaryPrecedence(t),0===n){this.index-=t.length;break}o={value:t,prec:n,right_a:r.right_associative.has(t)},l=t;const c=e=>o.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;i.length>2&&c(i[i.length-2]);)a=i.pop(),t=i.pop().value,s=i.pop(),e={type:r.BINARY_EXP,operator:t,left:s,right:a},i.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),i.push(o,e)}for(c=i.length-1,e=i[c];c>1;)e={type:r.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:e},c-=2;return e}gobbleToken(){let e,t,n,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(e=this.code,r.isDecimalDigit(e)||e===r.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===r.SQUOTE_CODE||e===r.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===r.OBRACK_CODE)i=this.gobbleArray();else{for(t=this.expr.substr(this.index,r.max_unop_len),n=t.length;n>0;){if(r.unary_ops.hasOwnProperty(t)&&(!r.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!r.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:r.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}r.isIdentifierStart(e)?(i=this.gobbleIdentifier(),r.literals.hasOwnProperty(i.name)?i={type:r.LITERAL,value:r.literals[i.name],raw:i.name}:i.name===r.this_str&&(i={type:r.THIS_EXP})):e===r.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===r.PERIOD_CODE||t===r.OBRACK_CODE||t===r.OPAREN_CODE||t===r.QUMARK_CODE;){let n;if(t===r.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==r.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===r.OBRACK_CODE?((e={type:r.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==r.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===r.OPAREN_CODE?e={type:r.CALL_EXP,arguments:this.gobbleArguments(r.CPAREN_CODE),callee:e}:(t===r.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:r.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,n="";for(;r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===r.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(n+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(n+=this.expr.charAt(this.index++));r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);r.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return t=this.code,r.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(t===r.PERIOD_CODE||1===n.length&&n.charCodeAt(0)===r.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:r.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let e="";const t=this.index,n=this.expr.charAt(this.index++);let i=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){i=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return i||this.throwError('Unclosed quote after "'+e+'"'),{type:r.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(r.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,r.isIdentifierPart(e));)this.index++;return{type:r.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let n=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){n=!0,this.index++,e===r.CPAREN_CODE&&i&&i>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===r.COMMA_CODE){if(this.index++,i++,i!==t.length)if(e===r.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===r.CBRACK_CODE)for(let e=t.length;e<i;e++)t.push(null)}else if(t.length!==i&&0!==i)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==r.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(r.CPAREN_CODE);if(this.code===r.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:r.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:r.ARRAY_EXP,elements:this.gobbleArguments(r.CBRACK_CODE)}}}const n=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)}),this)}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}};Object.assign(r,{hooks:n,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach((e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)}))}}(r),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),r.max_unop_len=r.getMaxKeyLen(r.unary_ops),r.max_binop_len=r.getMaxKeyLen(r.binary_ops);const i=e=>new r(e).parse(),o=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(r).filter((e=>!o.includes(e)&&void 0===i[e])).forEach((e=>{i[e]=r[e]})),i.Jsep=r;var s={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}}))}};i.plugins.register(s);const a="ArrowFunctionExpression";var c={name:"arrow",init(e){function t(r){r&&(Object.values(r).forEach((e=>{e&&"object"==typeof e&&t(e)})),"=>"===r.operator&&(r.type=a,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",(function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){const r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;const e=this.gobbleBinaryOp();if("=>"===e){const r=this.gobbleBinaryExpression();return r||this.throwError("Expected expression after "+e),void(t.node={type:a,params:null,body:r})}}this.index=r}})),e.hooks.add("after-expression",(function(e){t(e.node)}))}},l={name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(t){const r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}}))}},u={name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function r(e){return"x"===e||"X"===e?16:"b"===e||"B"===e?2:8}function n(e,t){return 95===e||t.some((([t,r])=>e>=t&&e<=r))}function i(t){const r=this.index;let n="";const i=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};i(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),i());let o=this.char;"e"!==o&&"E"!==o||(n+=this.expr.charAt(this.index++),o=this.char,"+"!==o&&"-"!==o||(n+=this.expr.charAt(this.index++)),i(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));const s=this.code;if(e.isIdentifierStart(s))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(s===e.PERIOD_CODE)return n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:s,number:n},null,2)}`),void(this.index=r);t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",(function(o){if(48===this.code){const s=this.index,a=this.expr.charAt(this.index+1),c=t.call(this,a);if(!c)return;let l="";for(;n(this.code,c);)95===this.code?this.index++:l+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(a.charCodeAt(0)))return this.index=s+1,void i.call(this,o);this.throwError("unexpected char within number")}o.node={type:e.LITERAL,value:parseInt(l,r(a)),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&i.call(this,o)}))}},p={name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){const n=this.expr.slice(r,this.index);let i,o="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;o+=this.char}try{i=new RegExp(n,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:i,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}}))}},h={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}}))}},d={name:"jsepTemplateLiteral",init(e){function t(e,t=!0){if(96===this.code){const r={type:"TemplateLiteral",quasis:[],expressions:[]};let n="",i="",o=!1;const s=this.expr.length,a=()=>r.quasis.push({type:"TemplateElement",value:{raw:i,cooked:n},tail:o});for(;this.index<s;){let s=this.expr.charAt(++this.index);if("`"===s)return this.index+=1,o=!0,a(),e.node=r,t&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===s&&"{"===this.expr.charAt(this.index+1))this.index+=2,a(),i="",n="",r.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===s)switch(i+=s,s=this.expr.charAt(++this.index),i+=s,s){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=s}else n+=s,i+=s}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",(function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node}))}};function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b,y,x={Array,Boolean,Symbol,Infinity:1/0,NaN:NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},g=(b=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){f(e,t,r[t])}))}return e}({},x),y=null!=(y={Promise})?y:{},Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(y)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(y)).forEach((function(e){Object.defineProperty(b,e,Object.getOwnPropertyDescriptor(y,e))})),b);function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){m(o,n,i,s,a,"next",e)}function a(e){m(o,n,i,s,a,"throw",e)}s(void 0)}))}}function O(e,t,r){return O=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&A(i,r.prototype),i},O.apply(null,arguments)}function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){_(e,t,r[t])}))}return e}function A(e,t){return A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},A(e,t)}function D(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function S(e){return L(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},X)}function R(e){return k.apply(this,arguments)}function k(){return k=v((function(e){var t=arguments;return P(this,(function(r){return[2,B(e,t.length>1&&void 0!==t[1]?t[1]:{},X)]}))})),k.apply(this,arguments)}function I(e){return L(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},K)}function j(e){return B(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},K)}function N(e){return L(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},F)}function M(e){return B(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},F)}function L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!("string"==typeof e||"object"==typeof e&&e&&"type"in e))throw"Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string.");null==t&&(t={});var n=function(e){return Q(e,x)}(t),o=q("string"==typeof e?i(e):e,n);if(r(o))return o;throw{type:"Invalid result",message:"string"==typeof e?"The expression ".concat(e," did not produce a valid result"):"The expression did not produce a valid result"}}function B(e){return T.apply(this,arguments)}function T(){return T=v((function(e){var t,r,n,o=arguments;return P(this,(function(s){return t=o.length>1&&void 0!==o[1]?o[1]:{},r=o.length>2?o[2]:void 0,"string"==typeof e||"object"==typeof e&&e&&"type"in e?(null==t&&(t={}),n=function(e){return Q(e,g)}(t),[2,Promise.resolve(q("string"==typeof e?i(e):e,n)).then((function(t){if(r(t))return t;throw{type:"Invalid result",message:"string"==typeof e?"The expression ".concat(e," did not produce a valid result"):"The expression did not produce a valid result"}}))]):[2,Promise.reject("Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string."))]}))})),T.apply(this,arguments)}function U(e){return i(e)}function X(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||w(e,Date)}function K(e){return"boolean"==typeof e}function F(e){return"number"==typeof e}function q(e,t){switch(e.type){case"UnaryExpression":return function(e,t){var r=q(e.argument,t);switch(e.operator){case"+":return+r;case"-":return-r;case"~":return~r;case"!":return!r;default:throw"Expression evaluator does not support operator '".concat(e.operator,"''")}}(e,t);case"BinaryExpression":return function(e,t){var r=q(e.left,t),n=q(e.right,t);switch(e.operator){case"+":return r+n;case"-":return r-n;case"*":return r*n;case"/":return r/n;case"%":return r%n;case"**":return Math.pow(r,n);case"==":return r==n;case"===":return r===n;case"!=":return r!=n;case"!==":return r!==n;case">":return r>n;case">=":return r>=n;case"<":return r<n;case"<=":return r<=n;case"in":return r in n;case"&&":return r&&n;case"||":return r||n;case"??":return null!=r?r:n;default:throw"Expression evaluator does not support operator '".concat(e.operator,"' operator")}}(e,t);case"ConditionalExpression":return function(e,t){var r=q(e.test,t);return q(r?e.consequent:e.alternate,t)}(e,t);case"CallExpression":return function(e,t){var r,n=null===(r=e.arguments)||void 0===r?void 0:r.map(V(t)),i=q(e.callee,t);if(!i)throw"No function named ".concat(e.callee," is defined in this context");if("function"!=typeof i)throw"".concat(e.callee," is not a function");return i.apply(void 0,D(n))}(e,t);case"ArrowFunctionExpression":return function(e,t){var r,n,i,o=null!==(n=null===(r=e.params)||void 0===r?void 0:r.map((function(e){if("Identifier"===e.type)return e.name;throw"Cannot handle parameter of type ".concat(e.type)})))&&void 0!==n?n:[];return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];if(n.length<o.length)throw"Required argument(s) ".concat(o.slice(n.length,-1).join(", ")," were not provided");var s=Object.fromEntries(o.reduce((function(e,t,r){var i=n[r];return Y(i)&&e.push([t,i]),e}),[]));return q(e.body,t.addVariables(s))}.bind(null!==(i=t.thisObj)&&void 0!==i?i:null)}(e,t);case"MemberExpression":return function(e,t){var r=q(e.object,t);if(void 0===r)switch(e.object.type){case"Identifier":var n=H(e.object,t);throw ReferenceError("ReferenceError: ".concat(n," is not defined"));case"MemberExpression":var i=H(e.property,t);throw TypeError("TypeError: cannot read properties of undefined (reading '".concat(i,"')"));default:throw"VisitMemberExpression does not support operator '".concat(e.object.type,"' type")}var o,s=r;if("string"==typeof r)s=String.prototype;else if("number"==typeof r)s=Number.prototype;else if("function"==typeof r);else if("object"!=typeof r)throw"VisitMemberExpression does not support member access on type ".concat(void 0===r?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(r));switch(t.thisObj=s,e.property.type){case"Identifier":case"MemberExpression":o=q(e.property,t);break;default:var a=q(e.property,t);if(void 0===a)throw{type:"Illegal property access",message:"No property was supplied to the property access"};J(a),o=r[a]}return"function"==typeof o?o.bind(r):o}(e,t);case"ArrayExpression":return function(e,t){var r;return null===(r=e.elements)||void 0===r?void 0:r.map(V(t))}(e,t);case"SequenceExpression":return function(e,t){var r=e.expressions.map(V(t));return r[r.length-1]}(e,t);case"NewExpression":return function(e,t){if(!e.callee||"Identifier"!==e.callee.type)throw e.callee?"new must be called with either Date or RegExp":'Could not handle "new" without a specified class';var r,n=null===(r=e.arguments)||void 0===r?void 0:r.map(V(t));switch(e.callee.name){case"Date":return O(Date,D(n));case"RegExp":return O(RegExp,D(n));default:throw"Cannot instantiate object of type ".concat(e.callee.name)}}(e,t);case"Literal":return function(e,t){return J(e.value),e.value}(e);case"Identifier":return function(e,t){J(e.name);var r=t.thisObj;if(r&&("object"==typeof r||"function"==typeof r)&&e.name in r){var n=r[e.name];return J(n),n}if(t.variables&&e.name in t.variables){var i=t.variables[e.name];return J(i),i}return e.name in t.globals?t.globals[e.name]:void 0}(e,t);case"TemplateLiteral":return function(e,t){var r,n,i,o,s=null!==(i=null===(r=e.expressions)||void 0===r?void 0:r.map(V(t)))&&void 0!==i?i:[],a=null!==(o=null===(n=e.quasis)||void 0===n?void 0:n.map(V(t)))&&void 0!==o?o:[];return a.filter((function(e){return!e.tail})).map((function(e){return e.value})).join("")+s.join("")+a.filter((function(e){return e.tail})).map((function(e){return e.value})).join("")}(e,t);case"TemplateElement":return function(e,t){return{value:e.cooked,tail:e.tail}}(e);default:throw"Expression evaluator does not support expression of type '".concat(e.type,"'")}}function H(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return H(e.property,t);default:throw"VisitExpressionName does not support expression of type '".concat(e.type,"'")}}function Q(e,t){var r={thisObj:void 0,variables:C({},e),globals:C({},t),addVariables:function(e){return this.variables=C({},this.variables,e),this}};return r.addVariables.bind(r),r}function V(e){return function(t){return null===t?null:q(t,e)}}function J(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:"Cannot access the ".concat(e," property of objects")}}function Y(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||"function"==typeof e||null===e||w(e,RegExp))return!0;if("object"==typeof e){var t=!0,r=!1,n=void 0;try{for(var i,o=Object.keys(e)[Symbol.iterator]();!(t=(i=o.next()).done);t=!0)if(!Y(e[i.value]))return!1}catch(e){r=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw n}}return!0}if(Array.isArray(e)){var s=!0,a=!1,c=void 0;try{for(var l,u=e[Symbol.iterator]();!(s=(l=u.next()).done);s=!0)if(!Y(l.value))return!1}catch(e){a=!0,c=e}finally{try{s||null==u.return||u.return()}finally{if(a)throw c}}}return!1}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function G(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){G(e,t,r[t])}))}return e}function W(e){if(!("string"==typeof e||"object"==typeof e&&e&&"type"in e))throw"Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string.");var t,r={globals:z({},g),isLocalExpression:!1,variables:new Set};return Z("string"==typeof e?i(e):e,r),function(e){if(Array.isArray(e))return $(e)}(t=r.variables)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){switch(e.type){case"UnaryExpression":return function(e,t){return Z(e.argument,t)}(e,t);case"BinaryExpression":return function(e,t){return[Z(e.left,t),Z(e.right,t)].filter(Boolean)}(e,t);case"ConditionalExpression":return function(e,t){return[Z(e.consequent,t),Z(e.test,t),Z(e.alternate,t)].filter(Boolean)}(e,t);case"CallExpression":return function(e,t){var r,n=Z(e.callee,t);return null===(r=e.arguments)||void 0===r||r.map(ee(t)),n}(e,t);case"ArrowFunctionExpression":return function(e,t){var r,n,i=z({},t);i.isLocalExpression=!0;var o,s=null!==(n=null===(r=e.params)||void 0===r?void 0:r.map(ee(i)))&&void 0!==n?n:[],a=null!==(o=Z(e.body,i))&&void 0!==o?o:[];if(a&&Array.isArray(a)){var c=!0,l=!1,u=void 0;try{for(var p,h=a[Symbol.iterator]();!(c=(p=h.next()).done);c=!0){var d=p.value;s.includes(d)||t.variables.add(d)}}catch(e){l=!0,u=e}finally{try{c||null==h.return||h.return()}finally{if(l)throw u}}}}(e,t);case"MemberExpression":return function(e,t){Z(e.object,t);var r=z({},t);r.isLocalExpression=!0,Z(e.property,r)}(e,t);case"ArrayExpression":return function(e,t){var r;null===(r=e.elements)||void 0===r||r.map(ee(t))}(e,t);case"SequenceExpression":return function(e,t){var r;null===(r=e.expressions)||void 0===r||r.map(ee(t))}(e,t);case"NewExpression":return function(e,t){var r;null===(r=e.arguments)||void 0===r||r.map(ee(t))}(e,t);case"Literal":case"TemplateElement":return;case"Identifier":return function(e,t){if(!(e.name in t.globals)){if(t.isLocalExpression)return e.name;t.variables.add(e.name)}}(e,t);case"TemplateLiteral":return function(e,t){var r,n;null===(r=e.expressions)||void 0===r||r.map(ee(t)),null===(n=e.quasis)||void 0===n||n.map(ee(t))}(e,t);default:throw"Expression evaluator does not support expression of type '".concat(e.type,"'")}}function ee(e){return function(t){return null===t?null:Z(t,e)}}return i.plugins.register(c),i.plugins.register(l),i.plugins.register(u),i.plugins.register(p),i.plugins.register(h),i.plugins.register(d),i.addBinaryOp("in",7),i.addBinaryOp("??",1),t})())}}}));
1
+ System.register([],(function(e,t){return{execute:function(){e((()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compile:()=>U,evaluate:()=>S,evaluateAsBoolean:()=>I,evaluateAsBooleanAsync:()=>j,evaluateAsNumber:()=>M,evaluateAsNumberAsync:()=>N,evaluateAsType:()=>L,evaluateAsTypeAsync:()=>B,evaluateAsync:()=>R,extractVariableNames:()=>Z,jsep:()=>i});class r{static get version(){return"1.3.9"}static toString(){return"JavaScript Expression Parser (JSEP) v"+r.version}static addUnaryOp(e){return r.max_unop_len=Math.max(e.length,r.max_unop_len),r.unary_ops[e]=1,r}static addBinaryOp(e,t,n){return r.max_binop_len=Math.max(e.length,r.max_binop_len),r.binary_ops[e]=t,n?r.right_associative.add(e):r.right_associative.delete(e),r}static addIdentifierChar(e){return r.additional_identifier_chars.add(e),r}static addLiteral(e,t){return r.literals[e]=t,r}static removeUnaryOp(e){return delete r.unary_ops[e],e.length===r.max_unop_len&&(r.max_unop_len=r.getMaxKeyLen(r.unary_ops)),r}static removeAllUnaryOps(){return r.unary_ops={},r.max_unop_len=0,r}static removeIdentifierChar(e){return r.additional_identifier_chars.delete(e),r}static removeBinaryOp(e){return delete r.binary_ops[e],e.length===r.max_binop_len&&(r.max_binop_len=r.getMaxKeyLen(r.binary_ops)),r.right_associative.delete(e),r}static removeAllBinaryOps(){return r.binary_ops={},r.max_binop_len=0,r}static removeLiteral(e){return delete r.literals[e],r}static removeAllLiterals(){return r.literals={},r}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new r(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map((e=>e.length)))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return r.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!r.binary_ops[String.fromCharCode(e)]||r.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return r.isIdentifierStart(e)||r.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(r.hooks[e]){const n={context:this,node:t};return r.hooks.run(e,n),n.node}return t}searchHook(e){if(r.hooks[e]){const t={context:this};return r.hooks[e].find((function(e){return e.call(t.context,t),t.node})),t.node}}gobbleSpaces(){let e=this.code;for(;e===r.SPACE_CODE||e===r.TAB_CODE||e===r.LF_CODE||e===r.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:r.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,n,i=[];for(;this.index<this.expr.length;)if(t=this.code,t===r.SEMCOL_CODE||t===r.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())i.push(n);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,r.max_binop_len),t=e.length;for(;t>0;){if(r.binary_ops.hasOwnProperty(e)&&(!r.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!r.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,i,o,s,a,c,l;if(s=this.gobbleToken(),!s)return s;if(t=this.gobbleBinaryOp(),!t)return s;for(o={value:t,prec:r.binaryPrecedence(t),right_a:r.right_associative.has(t)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+t),i=[s,o,a];t=this.gobbleBinaryOp();){if(n=r.binaryPrecedence(t),0===n){this.index-=t.length;break}o={value:t,prec:n,right_a:r.right_associative.has(t)},l=t;const c=e=>o.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;i.length>2&&c(i[i.length-2]);)a=i.pop(),t=i.pop().value,s=i.pop(),e={type:r.BINARY_EXP,operator:t,left:s,right:a},i.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),i.push(o,e)}for(c=i.length-1,e=i[c];c>1;)e={type:r.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:e},c-=2;return e}gobbleToken(){let e,t,n,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(e=this.code,r.isDecimalDigit(e)||e===r.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===r.SQUOTE_CODE||e===r.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===r.OBRACK_CODE)i=this.gobbleArray();else{for(t=this.expr.substr(this.index,r.max_unop_len),n=t.length;n>0;){if(r.unary_ops.hasOwnProperty(t)&&(!r.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!r.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:r.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}r.isIdentifierStart(e)?(i=this.gobbleIdentifier(),r.literals.hasOwnProperty(i.name)?i={type:r.LITERAL,value:r.literals[i.name],raw:i.name}:i.name===r.this_str&&(i={type:r.THIS_EXP})):e===r.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===r.PERIOD_CODE||t===r.OBRACK_CODE||t===r.OPAREN_CODE||t===r.QUMARK_CODE;){let n;if(t===r.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==r.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===r.OBRACK_CODE?((e={type:r.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==r.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===r.OPAREN_CODE?e={type:r.CALL_EXP,arguments:this.gobbleArguments(r.CPAREN_CODE),callee:e}:(t===r.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:r.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,n="";for(;r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===r.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(n+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(n+=this.expr.charAt(this.index++));r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);r.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return t=this.code,r.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(t===r.PERIOD_CODE||1===n.length&&n.charCodeAt(0)===r.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:r.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let e="";const t=this.index,n=this.expr.charAt(this.index++);let i=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){i=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return i||this.throwError('Unclosed quote after "'+e+'"'),{type:r.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(r.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,r.isIdentifierPart(e));)this.index++;return{type:r.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let n=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){n=!0,this.index++,e===r.CPAREN_CODE&&i&&i>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===r.COMMA_CODE){if(this.index++,i++,i!==t.length)if(e===r.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===r.CBRACK_CODE)for(let e=t.length;e<i;e++)t.push(null)}else if(t.length!==i&&0!==i)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==r.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(r.CPAREN_CODE);if(this.code===r.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:r.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:r.ARRAY_EXP,elements:this.gobbleArguments(r.CBRACK_CODE)}}}const n=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)}),this)}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}};Object.assign(r,{hooks:n,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach((e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)}))}}(r),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),r.max_unop_len=r.getMaxKeyLen(r.unary_ops),r.max_binop_len=r.getMaxKeyLen(r.binary_ops);const i=e=>new r(e).parse(),o=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(r).filter((e=>!o.includes(e)&&void 0===i[e])).forEach((e=>{i[e]=r[e]})),i.Jsep=r;var s={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}}))}};i.plugins.register(s);const a="ArrowFunctionExpression";var c={name:"arrow",init(e){function t(r){r&&(Object.values(r).forEach((e=>{e&&"object"==typeof e&&t(e)})),"=>"===r.operator&&(r.type=a,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",(function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){const r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;const e=this.gobbleBinaryOp();if("=>"===e){const r=this.gobbleBinaryExpression();return r||this.throwError("Expected expression after "+e),void(t.node={type:a,params:null,body:r})}}this.index=r}})),e.hooks.add("after-expression",(function(e){t(e.node)}))}},l={name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(t){const r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}}))}},u={name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function r(e){return"x"===e||"X"===e?16:"b"===e||"B"===e?2:8}function n(e,t){return 95===e||t.some((([t,r])=>e>=t&&e<=r))}function i(t){const r=this.index;let n="";const i=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};i(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),i());let o=this.char;"e"!==o&&"E"!==o||(n+=this.expr.charAt(this.index++),o=this.char,"+"!==o&&"-"!==o||(n+=this.expr.charAt(this.index++)),i(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));const s=this.code;if(e.isIdentifierStart(s))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(s===e.PERIOD_CODE)return n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:s,number:n},null,2)}`),void(this.index=r);t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",(function(o){if(48===this.code){const s=this.index,a=this.expr.charAt(this.index+1),c=t.call(this,a);if(!c)return;let l="";for(;n(this.code,c);)95===this.code?this.index++:l+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(a.charCodeAt(0)))return this.index=s+1,void i.call(this,o);this.throwError("unexpected char within number")}o.node={type:e.LITERAL,value:parseInt(l,r(a)),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&i.call(this,o)}))}},p={name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){const n=this.expr.slice(r,this.index);let i,o="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;o+=this.char}try{i=new RegExp(n,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:i,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}}))}},h={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}}))}},d={name:"jsepTemplateLiteral",init(e){function t(e,t=!0){if(96===this.code){const r={type:"TemplateLiteral",quasis:[],expressions:[]};let n="",i="",o=!1;const s=this.expr.length,a=()=>r.quasis.push({type:"TemplateElement",value:{raw:i,cooked:n},tail:o});for(;this.index<s;){let s=this.expr.charAt(++this.index);if("`"===s)return this.index+=1,o=!0,a(),e.node=r,t&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===s&&"{"===this.expr.charAt(this.index+1))this.index+=2,a(),i="",n="",r.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===s)switch(i+=s,s=this.expr.charAt(++this.index),i+=s,s){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=s}else n+=s,i+=s}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",(function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node}))}};function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b,y,x={Array,Boolean,Symbol,Infinity:1/0,NaN:NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},g=(b=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){f(e,t,r[t])}))}return e}({},x),y=null!=(y={Promise})?y:{},Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(y)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(y)).forEach((function(e){Object.defineProperty(b,e,Object.getOwnPropertyDescriptor(y,e))})),b);function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){m(o,n,i,s,a,"next",e)}function a(e){m(o,n,i,s,a,"throw",e)}s(void 0)}))}}function O(e,t,r){return O=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&A(i,r.prototype),i},O.apply(null,arguments)}function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){_(e,t,r[t])}))}return e}function A(e,t){return A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},A(e,t)}function D(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function S(e){return L(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},X)}function R(e){return k.apply(this,arguments)}function k(){return k=v((function(e){var t=arguments;return P(this,(function(r){return[2,B(e,t.length>1&&void 0!==t[1]?t[1]:{},X)]}))})),k.apply(this,arguments)}function I(e){return L(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},K)}function j(e){return B(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},K)}function M(e){return L(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},F)}function N(e){return B(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},F)}function L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!("string"==typeof e||"object"==typeof e&&e&&"type"in e))throw"Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string.");null==t&&(t={});var n=function(e){return Q(e,x)}(t),o=q("string"==typeof e?i(e):e,n);if(r(o))return o;throw{type:"Invalid result",message:"string"==typeof e?"The expression ".concat(e," did not produce a valid result"):"The expression did not produce a valid result"}}function B(e){return T.apply(this,arguments)}function T(){return T=v((function(e){var t,r,n,o=arguments;return P(this,(function(s){return t=o.length>1&&void 0!==o[1]?o[1]:{},r=o.length>2?o[2]:void 0,"string"==typeof e||"object"==typeof e&&e&&"type"in e?(null==t&&(t={}),n=function(e){return Q(e,g)}(t),[2,Promise.resolve(q("string"==typeof e?i(e):e,n)).then((function(t){if(r(t))return t;throw{type:"Invalid result",message:"string"==typeof e?"The expression ".concat(e," did not produce a valid result"):"The expression did not produce a valid result"}}))]):[2,Promise.reject("Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string."))]}))})),T.apply(this,arguments)}function U(e){return i(e)}function X(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||w(e,Date)}function K(e){return"boolean"==typeof e}function F(e){return"number"==typeof e}function q(e,t){switch(e.type){case"UnaryExpression":return function(e,t){var r=q(e.argument,t);switch(e.operator){case"+":return+r;case"-":return-r;case"~":return~r;case"!":return!r;default:throw"Expression evaluator does not support operator '".concat(e.operator,"''")}}(e,t);case"BinaryExpression":return function(e,t){var r=q(e.left,t),n=q(e.right,t);switch(e.operator){case"+":return r+n;case"-":return r-n;case"*":return r*n;case"/":return r/n;case"%":return r%n;case"**":return Math.pow(r,n);case"==":return r==n;case"===":return r===n;case"!=":return r!=n;case"!==":return r!==n;case">":return r>n;case">=":return r>=n;case"<":return r<n;case"<=":return r<=n;case"in":return r in n;case"&&":return r&&n;case"||":return r||n;case"??":return null!=r?r:n;default:throw"Expression evaluator does not support operator '".concat(e.operator,"' operator")}}(e,t);case"ConditionalExpression":return function(e,t){var r=q(e.test,t);return q(r?e.consequent:e.alternate,t)}(e,t);case"CallExpression":return function(e,t){var r,n=null===(r=e.arguments)||void 0===r?void 0:r.map(V(t)),i=q(e.callee,t);if(!i)throw"No function named ".concat($(e.callee)," is defined in this context");if("function"!=typeof i)throw"".concat($(e.callee)," is not a function");return i.apply(void 0,D(n))}(e,t);case"ArrowFunctionExpression":return function(e,t){var r,n,i,o=null!==(n=null===(r=e.params)||void 0===r?void 0:r.map((function(e){if("Identifier"===e.type)return e.name;throw"Cannot handle parameter of type ".concat(e.type)})))&&void 0!==n?n:[];return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];if(n.length<o.length)throw"Required argument(s) ".concat(o.slice(n.length,-1).join(", ")," were not provided");var s=Object.fromEntries(o.reduce((function(e,t,r){var i=n[r];return Y(i)&&e.push([t,i]),e}),[]));return q(e.body,t.addVariables(s))}.bind(null!==(i=t.thisObj)&&void 0!==i?i:null)}(e,t);case"MemberExpression":return function(e,t){var r=q(e.object,t);if(void 0===r)switch(e.object.type){case"Identifier":var n=H(e.object,t);throw ReferenceError("ReferenceError: ".concat(n," is not defined"));case"MemberExpression":var i=H(e.property,t);throw TypeError("TypeError: cannot read properties of undefined (reading '".concat(i,"')"));default:throw"VisitMemberExpression does not support operator '".concat(e.object.type,"' type")}var o,s=r;if("string"==typeof r)s=String.prototype;else if("number"==typeof r)s=Number.prototype;else if("function"==typeof r);else if("object"!=typeof r)throw"VisitMemberExpression does not support member access on type ".concat(void 0===r?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(r));switch(t.thisObj=s,e.property.type){case"Identifier":case"MemberExpression":o=q(e.property,t);break;default:var a=q(e.property,t);if(void 0===a)throw{type:"Illegal property access",message:"No property was supplied to the property access"};J(a),o=r[a]}return"function"==typeof o?o.bind(r):o}(e,t);case"ArrayExpression":return function(e,t){var r;return null===(r=e.elements)||void 0===r?void 0:r.map(V(t))}(e,t);case"SequenceExpression":return function(e,t){var r=e.expressions.map(V(t));return r[r.length-1]}(e,t);case"NewExpression":return function(e,t){if(!e.callee||"Identifier"!==e.callee.type)throw e.callee?"new must be called with either Date or RegExp":'Could not handle "new" without a specified class';var r,n=null===(r=e.arguments)||void 0===r?void 0:r.map(V(t));switch(e.callee.name){case"Date":return O(Date,D(n));case"RegExp":return O(RegExp,D(n));default:throw"Cannot instantiate object of type ".concat(e.callee.name)}}(e,t);case"Literal":return function(e,t){return J(e.value),e.value}(e);case"Identifier":return function(e,t){J(e.name);var r=t.thisObj;if(r&&("object"==typeof r||"function"==typeof r)&&e.name in r){var n=r[e.name];return J(n),n}if(t.variables&&e.name in t.variables){var i=t.variables[e.name];return J(i),i}return e.name in t.globals?t.globals[e.name]:void 0}(e,t);case"TemplateLiteral":return function(e,t){var r,n,i,o,s=null!==(i=null===(r=e.expressions)||void 0===r?void 0:r.map(V(t)))&&void 0!==i?i:[],a=null!==(o=null===(n=e.quasis)||void 0===n?void 0:n.map(V(t)))&&void 0!==o?o:[];return a.filter((function(e){return!e.tail})).map((function(e){return e.value})).join("")+s.join("")+a.filter((function(e){return e.tail})).map((function(e){return e.value})).join("")}(e,t);case"TemplateElement":return function(e,t){return{value:e.cooked,tail:e.tail}}(e);default:throw"Expression evaluator does not support expression of type '".concat(e.type,"'")}}function H(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return H(e.property,t);default:throw"VisitExpressionName does not support expression of type '".concat(e.type,"'")}}function Q(e,t){var r={thisObj:void 0,variables:C({},e),globals:C({},t),addVariables:function(e){return this.variables=C({},this.variables,e),this}};return r.addVariables.bind(r),r}function V(e){return function(t){return null===t?null:q(t,e)}}function J(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:"Cannot access the ".concat(e," property of objects")}}function Y(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||"function"==typeof e||null===e||w(e,RegExp))return!0;if("object"==typeof e){var t=!0,r=!1,n=void 0;try{for(var i,o=Object.keys(e)[Symbol.iterator]();!(t=(i=o.next()).done);t=!0)if(!Y(e[i.value]))return!1}catch(e){r=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw n}}return!0}if(Array.isArray(e)){var s=!0,a=!1,c=void 0;try{for(var l,u=e[Symbol.iterator]();!(s=(l=u.next()).done);s=!0)if(!Y(l.value))return!1}catch(e){a=!0,c=e}finally{try{s||null==u.return||u.return()}finally{if(a)throw c}}}return!1}function $(e){return e?"MemberExpression"===e.type?null===(t=e.property)||void 0===t?void 0:t.name:e.name:null;var t}function G(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){z(e,t,r[t])}))}return e}function Z(e){if(!("string"==typeof e||"object"==typeof e&&e&&"type"in e))throw"Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string.");var t,r={globals:W({},g),isLocalExpression:!1,variables:new Set};return ee("string"==typeof e?i(e):e,r),function(e){if(Array.isArray(e))return G(e)}(t=r.variables)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return G(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?G(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(e,t){switch(e.type){case"UnaryExpression":return function(e,t){return ee(e.argument,t)}(e,t);case"BinaryExpression":return function(e,t){return[ee(e.left,t),ee(e.right,t)].filter(Boolean)}(e,t);case"ConditionalExpression":return function(e,t){return[ee(e.consequent,t),ee(e.test,t),ee(e.alternate,t)].filter(Boolean)}(e,t);case"CallExpression":return function(e,t){var r,n=ee(e.callee,t);return null===(r=e.arguments)||void 0===r||r.map(te(t)),n}(e,t);case"ArrowFunctionExpression":return function(e,t){var r,n,i=W({},t);i.isLocalExpression=!0;var o,s=null!==(n=null===(r=e.params)||void 0===r?void 0:r.map(te(i)))&&void 0!==n?n:[],a=null!==(o=ee(e.body,i))&&void 0!==o?o:[];if(a&&Array.isArray(a)){var c=!0,l=!1,u=void 0;try{for(var p,h=a[Symbol.iterator]();!(c=(p=h.next()).done);c=!0){var d=p.value;s.includes(d)||t.variables.add(d)}}catch(e){l=!0,u=e}finally{try{c||null==h.return||h.return()}finally{if(l)throw u}}}}(e,t);case"MemberExpression":return function(e,t){ee(e.object,t);var r=W({},t);r.isLocalExpression=!0,ee(e.property,r)}(e,t);case"ArrayExpression":return function(e,t){var r;null===(r=e.elements)||void 0===r||r.map(te(t))}(e,t);case"SequenceExpression":return function(e,t){var r;null===(r=e.expressions)||void 0===r||r.map(te(t))}(e,t);case"NewExpression":return function(e,t){var r;null===(r=e.arguments)||void 0===r||r.map(te(t))}(e,t);case"Literal":case"TemplateElement":return;case"Identifier":return function(e,t){if(!(e.name in t.globals)){if(t.isLocalExpression)return e.name;t.variables.add(e.name)}}(e,t);case"TemplateLiteral":return function(e,t){var r,n;null===(r=e.expressions)||void 0===r||r.map(te(t)),null===(n=e.quasis)||void 0===n||n.map(te(t))}(e,t);default:throw"Expression evaluator does not support expression of type '".concat(e.type,"'")}}function te(e){return function(t){return null===t?null:ee(t,e)}}return i.plugins.register(c),i.plugins.register(l),i.plugins.register(u),i.plugins.register(p),i.plugins.register(h),i.plugins.register(d),i.addBinaryOp("in",7),i.addBinaryOp("??",1),t})())}}}));
2
2
  //# sourceMappingURL=openmrs-esm-expression-evaluator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openmrs-esm-expression-evaluator.js","mappings":"iFACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,mQC2F9D,MAAMC,EAIMC,qBAEV,MAAO,OACR,CAKAC,kBACC,MAAO,wCAA0CF,EAAKC,OACvD,CAQAC,kBAAkBC,GAGjB,OAFAH,EAAKI,aAAeC,KAAKC,IAAIH,EAAQI,OAAQP,EAAKI,cAClDJ,EAAKQ,UAAUL,GAAW,EACnBH,CACR,CASAE,mBAAmBC,EAASM,EAAYC,GASvC,OARAV,EAAKW,cAAgBN,KAAKC,IAAIH,EAAQI,OAAQP,EAAKW,eACnDX,EAAKY,WAAWT,GAAWM,EACvBC,EACHV,EAAKa,kBAAkBC,IAAIX,GAG3B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SAASsI,GACtBxI,EAAKD,QAAQG,SAASuI,GACtBzI,EAAKD,QAAQG,SAASwI,GACtB1I,EAAKD,QAAQG,SAASyI,GAItB3I,EAAKuB,YAAY,KAAM,GACvBvB,EAAKuB,YAAY,KAAM,G","sources":["webpack://@openmrs/esm-expression-evaluator/webpack/bootstrap","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/define property getters","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/make namespace object","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/jsep/dist/jsep.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/arrow/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/new/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/numbers/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/regex/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/ternary/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/template/dist/index.js","webpack://@openmrs/esm-expression-evaluator/./src/globals.ts","webpack://@openmrs/esm-expression-evaluator/./src/evaluator.ts","webpack://@openmrs/esm-expression-evaluator/./src/extractor.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @implements {IHooks}\n */\nclass Hooks {\n\t/**\n\t * @callback HookCallback\n\t * @this {*|Jsep} this\n\t * @param {Jsep} env\n\t * @returns: void\n\t */\n\t/**\n\t * Adds the given callback to the list of callbacks for the given hook.\n\t *\n\t * The callback will be invoked when the hook it is registered for is run.\n\t *\n\t * One callback function can be registered to multiple hooks and the same hook multiple times.\n\t *\n\t * @param {string|object} name The name of the hook, or an object of callbacks keyed by name\n\t * @param {HookCallback|boolean} callback The callback function which is given environment variables.\n\t * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)\n\t * @public\n\t */\n\tadd(name, callback, first) {\n\t\tif (typeof arguments[0] != 'string') {\n\t\t\t// Multiple hook callbacks, keyed by name\n\t\t\tfor (let name in arguments[0]) {\n\t\t\t\tthis.add(name, arguments[0][name], arguments[1]);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t(Array.isArray(name) ? name : [name]).forEach(function (name) {\n\t\t\t\tthis[name] = this[name] || [];\n\n\t\t\t\tif (callback) {\n\t\t\t\t\tthis[name][first ? 'unshift' : 'push'](callback);\n\t\t\t\t}\n\t\t\t}, this);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a hook invoking all registered callbacks with the given environment variables.\n\t *\n\t * Callbacks will be invoked synchronously and in the order in which they were registered.\n\t *\n\t * @param {string} name The name of the hook.\n\t * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.\n\t * @public\n\t */\n\trun(name, env) {\n\t\tthis[name] = this[name] || [];\n\t\tthis[name].forEach(function (callback) {\n\t\t\tcallback.call(env && env.context ? env.context : env, env);\n\t\t});\n\t}\n}\n\n/**\n * @implements {IPlugins}\n */\nclass Plugins {\n\tconstructor(jsep) {\n\t\tthis.jsep = jsep;\n\t\tthis.registered = {};\n\t}\n\n\t/**\n\t * @callback PluginSetup\n\t * @this {Jsep} jsep\n\t * @returns: void\n\t */\n\t/**\n\t * Adds the given plugin(s) to the registry\n\t *\n\t * @param {object} plugins\n\t * @param {string} plugins.name The name of the plugin\n\t * @param {PluginSetup} plugins.init The init function\n\t * @public\n\t */\n\tregister(...plugins) {\n\t\tplugins.forEach((plugin) => {\n\t\t\tif (typeof plugin !== 'object' || !plugin.name || !plugin.init) {\n\t\t\t\tthrow new Error('Invalid JSEP plugin format');\n\t\t\t}\n\t\t\tif (this.registered[plugin.name]) {\n\t\t\t\t// already registered. Ignore.\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tplugin.init(this.jsep);\n\t\t\tthis.registered[plugin.name] = plugin;\n\t\t});\n\t}\n}\n\n// JavaScript Expression Parser (JSEP) 1.3.9\n\nclass Jsep {\n\t/**\n\t * @returns {string}\n\t */\n\tstatic get version() {\n\t\t// To be filled in by the template\n\t\treturn '1.3.9';\n\t}\n\n\t/**\n\t * @returns {string}\n\t */\n\tstatic toString() {\n\t\treturn 'JavaScript Expression Parser (JSEP) v' + Jsep.version;\n\t};\n\n\t// ==================== CONFIG ================================\n\t/**\n\t * @method addUnaryOp\n\t * @param {string} op_name The name of the unary op to add\n\t * @returns {Jsep}\n\t */\n\tstatic addUnaryOp(op_name) {\n\t\tJsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);\n\t\tJsep.unary_ops[op_name] = 1;\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method jsep.addBinaryOp\n\t * @param {string} op_name The name of the binary op to add\n\t * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence\n\t * @param {boolean} [isRightAssociative=false] whether operator is right-associative\n\t * @returns {Jsep}\n\t */\n\tstatic addBinaryOp(op_name, precedence, isRightAssociative) {\n\t\tJsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);\n\t\tJsep.binary_ops[op_name] = precedence;\n\t\tif (isRightAssociative) {\n\t\t\tJsep.right_associative.add(op_name);\n\t\t}\n\t\telse {\n\t\t\tJsep.right_associative.delete(op_name);\n\t\t}\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method addIdentifierChar\n\t * @param {string} char The additional character to treat as a valid part of an identifier\n\t * @returns {Jsep}\n\t */\n\tstatic addIdentifierChar(char) {\n\t\tJsep.additional_identifier_chars.add(char);\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method addLiteral\n\t * @param {string} literal_name The name of the literal to add\n\t * @param {*} literal_value The value of the literal\n\t * @returns {Jsep}\n\t */\n\tstatic addLiteral(literal_name, literal_value) {\n\t\tJsep.literals[literal_name] = literal_value;\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeUnaryOp\n\t * @param {string} op_name The name of the unary op to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeUnaryOp(op_name) {\n\t\tdelete Jsep.unary_ops[op_name];\n\t\tif (op_name.length === Jsep.max_unop_len) {\n\t\t\tJsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\n\t\t}\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllUnaryOps\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllUnaryOps() {\n\t\tJsep.unary_ops = {};\n\t\tJsep.max_unop_len = 0;\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeIdentifierChar\n\t * @param {string} char The additional character to stop treating as a valid part of an identifier\n\t * @returns {Jsep}\n\t */\n\tstatic removeIdentifierChar(char) {\n\t\tJsep.additional_identifier_chars.delete(char);\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeBinaryOp\n\t * @param {string} op_name The name of the binary op to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeBinaryOp(op_name) {\n\t\tdelete Jsep.binary_ops[op_name];\n\n\t\tif (op_name.length === Jsep.max_binop_len) {\n\t\t\tJsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n\t\t}\n\t\tJsep.right_associative.delete(op_name);\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllBinaryOps\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllBinaryOps() {\n\t\tJsep.binary_ops = {};\n\t\tJsep.max_binop_len = 0;\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeLiteral\n\t * @param {string} literal_name The name of the literal to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeLiteral(literal_name) {\n\t\tdelete Jsep.literals[literal_name];\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllLiterals\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllLiterals() {\n\t\tJsep.literals = {};\n\n\t\treturn Jsep;\n\t}\n\t// ==================== END CONFIG ============================\n\n\n\t/**\n\t * @returns {string}\n\t */\n\tget char() {\n\t\treturn this.expr.charAt(this.index);\n\t}\n\n\t/**\n\t * @returns {number}\n\t */\n\tget code() {\n\t\treturn this.expr.charCodeAt(this.index);\n\t};\n\n\n\t/**\n\t * @param {string} expr a string with the passed in express\n\t * @returns Jsep\n\t */\n\tconstructor(expr) {\n\t\t// `index` stores the character number we are currently at\n\t\t// All of the gobbles below will modify `index` as we move along\n\t\tthis.expr = expr;\n\t\tthis.index = 0;\n\t}\n\n\t/**\n\t * static top-level parser\n\t * @returns {jsep.Expression}\n\t */\n\tstatic parse(expr) {\n\t\treturn (new Jsep(expr)).parse();\n\t}\n\n\t/**\n\t * Get the longest key length of any object\n\t * @param {object} obj\n\t * @returns {number}\n\t */\n\tstatic getMaxKeyLen(obj) {\n\t\treturn Math.max(0, ...Object.keys(obj).map(k => k.length));\n\t}\n\n\t/**\n\t * `ch` is a character code in the next three functions\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isDecimalDigit(ch) {\n\t\treturn (ch >= 48 && ch <= 57); // 0...9\n\t}\n\n\t/**\n\t * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.\n\t * @param {string} op_val\n\t * @returns {number}\n\t */\n\tstatic binaryPrecedence(op_val) {\n\t\treturn Jsep.binary_ops[op_val] || 0;\n\t}\n\n\t/**\n\t * Looks for start of identifier\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isIdentifierStart(ch) {\n\t\treturn (ch >= 65 && ch <= 90) || // A...Z\n\t\t\t(ch >= 97 && ch <= 122) || // a...z\n\t\t\t(ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)]) || // any non-ASCII that is not an operator\n\t\t\t(Jsep.additional_identifier_chars.has(String.fromCharCode(ch))); // additional characters\n\t}\n\n\t/**\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isIdentifierPart(ch) {\n\t\treturn Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);\n\t}\n\n\t/**\n\t * throw error at index of the expression\n\t * @param {string} message\n\t * @throws\n\t */\n\tthrowError(message) {\n\t\tconst error = new Error(message + ' at character ' + this.index);\n\t\terror.index = this.index;\n\t\terror.description = message;\n\t\tthrow error;\n\t}\n\n\t/**\n\t * Run a given hook\n\t * @param {string} name\n\t * @param {jsep.Expression|false} [node]\n\t * @returns {?jsep.Expression}\n\t */\n\trunHook(name, node) {\n\t\tif (Jsep.hooks[name]) {\n\t\t\tconst env = { context: this, node };\n\t\t\tJsep.hooks.run(name, env);\n\t\t\treturn env.node;\n\t\t}\n\t\treturn node;\n\t}\n\n\t/**\n\t * Runs a given hook until one returns a node\n\t * @param {string} name\n\t * @returns {?jsep.Expression}\n\t */\n\tsearchHook(name) {\n\t\tif (Jsep.hooks[name]) {\n\t\t\tconst env = { context: this };\n\t\t\tJsep.hooks[name].find(function (callback) {\n\t\t\t\tcallback.call(env.context, env);\n\t\t\t\treturn env.node;\n\t\t\t});\n\t\t\treturn env.node;\n\t\t}\n\t}\n\n\t/**\n\t * Push `index` up to the next non-space character\n\t */\n\tgobbleSpaces() {\n\t\tlet ch = this.code;\n\t\t// Whitespace\n\t\twhile (ch === Jsep.SPACE_CODE\n\t\t|| ch === Jsep.TAB_CODE\n\t\t|| ch === Jsep.LF_CODE\n\t\t|| ch === Jsep.CR_CODE) {\n\t\t\tch = this.expr.charCodeAt(++this.index);\n\t\t}\n\t\tthis.runHook('gobble-spaces');\n\t}\n\n\t/**\n\t * Top-level method to parse all expressions and returns compound or single node\n\t * @returns {jsep.Expression}\n\t */\n\tparse() {\n\t\tthis.runHook('before-all');\n\t\tconst nodes = this.gobbleExpressions();\n\n\t\t// If there's only one expression just try returning the expression\n\t\tconst node = nodes.length === 1\n\t\t ? nodes[0]\n\t\t\t: {\n\t\t\t\ttype: Jsep.COMPOUND,\n\t\t\t\tbody: nodes\n\t\t\t};\n\t\treturn this.runHook('after-all', node);\n\t}\n\n\t/**\n\t * top-level parser (but can be reused within as well)\n\t * @param {number} [untilICode]\n\t * @returns {jsep.Expression[]}\n\t */\n\tgobbleExpressions(untilICode) {\n\t\tlet nodes = [], ch_i, node;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tch_i = this.code;\n\n\t\t\t// Expressions can be separated by semicolons, commas, or just inferred without any\n\t\t\t// separators\n\t\t\tif (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {\n\t\t\t\tthis.index++; // ignore separators\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Try to gobble each expression individually\n\t\t\t\tif (node = this.gobbleExpression()) {\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t\t// If we weren't able to find a binary expression and are out of room, then\n\t\t\t\t\t// the expression passed in probably has too much\n\t\t\t\t}\n\t\t\t\telse if (this.index < this.expr.length) {\n\t\t\t\t\tif (ch_i === untilICode) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tthis.throwError('Unexpected \"' + this.char + '\"');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nodes;\n\t}\n\n\t/**\n\t * The main parsing function.\n\t * @returns {?jsep.Expression}\n\t */\n\tgobbleExpression() {\n\t\tconst node = this.searchHook('gobble-expression') || this.gobbleBinaryExpression();\n\t\tthis.gobbleSpaces();\n\n\t\treturn this.runHook('after-expression', node);\n\t}\n\n\t/**\n\t * Search for the operation portion of the string (e.g. `+`, `===`)\n\t * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)\n\t * and move down from 3 to 2 to 1 character until a matching binary operation is found\n\t * then, return that binary operation\n\t * @returns {string|boolean}\n\t */\n\tgobbleBinaryOp() {\n\t\tthis.gobbleSpaces();\n\t\tlet to_check = this.expr.substr(this.index, Jsep.max_binop_len);\n\t\tlet tc_len = to_check.length;\n\n\t\twhile (tc_len > 0) {\n\t\t\t// Don't accept a binary op when it is an identifier.\n\t\t\t// Binary ops that start with a identifier-valid character must be followed\n\t\t\t// by a non identifier-part valid character\n\t\t\tif (Jsep.binary_ops.hasOwnProperty(to_check) && (\n\t\t\t\t!Jsep.isIdentifierStart(this.code) ||\n\t\t\t\t(this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))\n\t\t\t)) {\n\t\t\t\tthis.index += tc_len;\n\t\t\t\treturn to_check;\n\t\t\t}\n\t\t\tto_check = to_check.substr(0, --tc_len);\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This function is responsible for gobbling an individual expression,\n\t * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`\n\t * @returns {?jsep.BinaryExpression}\n\t */\n\tgobbleBinaryExpression() {\n\t\tlet node, biop, prec, stack, biop_info, left, right, i, cur_biop;\n\n\t\t// First, try to get the leftmost thing\n\t\t// Then, check to see if there's a binary operator operating on that leftmost thing\n\t\t// Don't gobbleBinaryOp without a left-hand-side\n\t\tleft = this.gobbleToken();\n\t\tif (!left) {\n\t\t\treturn left;\n\t\t}\n\t\tbiop = this.gobbleBinaryOp();\n\n\t\t// If there wasn't a binary operator, just return the leftmost node\n\t\tif (!biop) {\n\t\t\treturn left;\n\t\t}\n\n\t\t// Otherwise, we need to start a stack to properly place the binary operations in their\n\t\t// precedence structure\n\t\tbiop_info = { value: biop, prec: Jsep.binaryPrecedence(biop), right_a: Jsep.right_associative.has(biop) };\n\n\t\tright = this.gobbleToken();\n\n\t\tif (!right) {\n\t\t\tthis.throwError(\"Expected expression after \" + biop);\n\t\t}\n\n\t\tstack = [left, biop_info, right];\n\n\t\t// Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm)\n\t\twhile ((biop = this.gobbleBinaryOp())) {\n\t\t\tprec = Jsep.binaryPrecedence(biop);\n\n\t\t\tif (prec === 0) {\n\t\t\t\tthis.index -= biop.length;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tbiop_info = { value: biop, prec, right_a: Jsep.right_associative.has(biop) };\n\n\t\t\tcur_biop = biop;\n\n\t\t\t// Reduce: make a binary expression from the three topmost entries.\n\t\t\tconst comparePrev = prev => biop_info.right_a && prev.right_a\n\t\t\t\t? prec > prev.prec\n\t\t\t\t: prec <= prev.prec;\n\t\t\twhile ((stack.length > 2) && comparePrev(stack[stack.length - 2])) {\n\t\t\t\tright = stack.pop();\n\t\t\t\tbiop = stack.pop().value;\n\t\t\t\tleft = stack.pop();\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.BINARY_EXP,\n\t\t\t\t\toperator: biop,\n\t\t\t\t\tleft,\n\t\t\t\t\tright\n\t\t\t\t};\n\t\t\t\tstack.push(node);\n\t\t\t}\n\n\t\t\tnode = this.gobbleToken();\n\n\t\t\tif (!node) {\n\t\t\t\tthis.throwError(\"Expected expression after \" + cur_biop);\n\t\t\t}\n\n\t\t\tstack.push(biop_info, node);\n\t\t}\n\n\t\ti = stack.length - 1;\n\t\tnode = stack[i];\n\n\t\twhile (i > 1) {\n\t\t\tnode = {\n\t\t\t\ttype: Jsep.BINARY_EXP,\n\t\t\t\toperator: stack[i - 1].value,\n\t\t\t\tleft: stack[i - 2],\n\t\t\t\tright: node\n\t\t\t};\n\t\t\ti -= 2;\n\t\t}\n\n\t\treturn node;\n\t}\n\n\t/**\n\t * An individual part of a binary expression:\n\t * e.g. `foo.bar(baz)`, `1`, `\"abc\"`, `(a % 2)` (because it's in parenthesis)\n\t * @returns {boolean|jsep.Expression}\n\t */\n\tgobbleToken() {\n\t\tlet ch, to_check, tc_len, node;\n\n\t\tthis.gobbleSpaces();\n\t\tnode = this.searchHook('gobble-token');\n\t\tif (node) {\n\t\t\treturn this.runHook('after-token', node);\n\t\t}\n\n\t\tch = this.code;\n\n\t\tif (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {\n\t\t\t// Char code 46 is a dot `.` which can start off a numeric literal\n\t\t\treturn this.gobbleNumericLiteral();\n\t\t}\n\n\t\tif (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {\n\t\t\t// Single or double quotes\n\t\t\tnode = this.gobbleStringLiteral();\n\t\t}\n\t\telse if (ch === Jsep.OBRACK_CODE) {\n\t\t\tnode = this.gobbleArray();\n\t\t}\n\t\telse {\n\t\t\tto_check = this.expr.substr(this.index, Jsep.max_unop_len);\n\t\t\ttc_len = to_check.length;\n\n\t\t\twhile (tc_len > 0) {\n\t\t\t\t// Don't accept an unary op when it is an identifier.\n\t\t\t\t// Unary ops that start with a identifier-valid character must be followed\n\t\t\t\t// by a non identifier-part valid character\n\t\t\t\tif (Jsep.unary_ops.hasOwnProperty(to_check) && (\n\t\t\t\t\t!Jsep.isIdentifierStart(this.code) ||\n\t\t\t\t\t(this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))\n\t\t\t\t)) {\n\t\t\t\t\tthis.index += tc_len;\n\t\t\t\t\tconst argument = this.gobbleToken();\n\t\t\t\t\tif (!argument) {\n\t\t\t\t\t\tthis.throwError('missing unaryOp argument');\n\t\t\t\t\t}\n\t\t\t\t\treturn this.runHook('after-token', {\n\t\t\t\t\t\ttype: Jsep.UNARY_EXP,\n\t\t\t\t\t\toperator: to_check,\n\t\t\t\t\t\targument,\n\t\t\t\t\t\tprefix: true\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tto_check = to_check.substr(0, --tc_len);\n\t\t\t}\n\n\t\t\tif (Jsep.isIdentifierStart(ch)) {\n\t\t\t\tnode = this.gobbleIdentifier();\n\t\t\t\tif (Jsep.literals.hasOwnProperty(node.name)) {\n\t\t\t\t\tnode = {\n\t\t\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\t\t\tvalue: Jsep.literals[node.name],\n\t\t\t\t\t\traw: node.name,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse if (node.name === Jsep.this_str) {\n\t\t\t\t\tnode = { type: Jsep.THIS_EXP };\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (ch === Jsep.OPAREN_CODE) { // open parenthesis\n\t\t\t\tnode = this.gobbleGroup();\n\t\t\t}\n\t\t}\n\n\t\tif (!node) {\n\t\t\treturn this.runHook('after-token', false);\n\t\t}\n\n\t\tnode = this.gobbleTokenProperty(node);\n\t\treturn this.runHook('after-token', node);\n\t}\n\n\t/**\n\t * Gobble properties of of identifiers/strings/arrays/groups.\n\t * e.g. `foo`, `bar.baz`, `foo['bar'].baz`\n\t * It also gobbles function calls:\n\t * e.g. `Math.acos(obj.angle)`\n\t * @param {jsep.Expression} node\n\t * @returns {jsep.Expression}\n\t */\n\tgobbleTokenProperty(node) {\n\t\tthis.gobbleSpaces();\n\n\t\tlet ch = this.code;\n\t\twhile (ch === Jsep.PERIOD_CODE || ch === Jsep.OBRACK_CODE || ch === Jsep.OPAREN_CODE || ch === Jsep.QUMARK_CODE) {\n\t\t\tlet optional;\n\t\t\tif (ch === Jsep.QUMARK_CODE) {\n\t\t\t\tif (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toptional = true;\n\t\t\t\tthis.index += 2;\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tch = this.code;\n\t\t\t}\n\t\t\tthis.index++;\n\n\t\t\tif (ch === Jsep.OBRACK_CODE) {\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.MEMBER_EXP,\n\t\t\t\t\tcomputed: true,\n\t\t\t\t\tobject: node,\n\t\t\t\t\tproperty: this.gobbleExpression()\n\t\t\t\t};\n\t\t\t\tif (!node.property) {\n\t\t\t\t\tthis.throwError('Unexpected \"' + this.char + '\"');\n\t\t\t\t}\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tch = this.code;\n\t\t\t\tif (ch !== Jsep.CBRACK_CODE) {\n\t\t\t\t\tthis.throwError('Unclosed [');\n\t\t\t\t}\n\t\t\t\tthis.index++;\n\t\t\t}\n\t\t\telse if (ch === Jsep.OPAREN_CODE) {\n\t\t\t\t// A function call is being made; gobble all the arguments\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.CALL_EXP,\n\t\t\t\t\t'arguments': this.gobbleArguments(Jsep.CPAREN_CODE),\n\t\t\t\t\tcallee: node\n\t\t\t\t};\n\t\t\t}\n\t\t\telse if (ch === Jsep.PERIOD_CODE || optional) {\n\t\t\t\tif (optional) {\n\t\t\t\t\tthis.index--;\n\t\t\t\t}\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.MEMBER_EXP,\n\t\t\t\t\tcomputed: false,\n\t\t\t\t\tobject: node,\n\t\t\t\t\tproperty: this.gobbleIdentifier(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (optional) {\n\t\t\t\tnode.optional = true;\n\t\t\t} // else leave undefined for compatibility with esprima\n\n\t\t\tthis.gobbleSpaces();\n\t\t\tch = this.code;\n\t\t}\n\n\t\treturn node;\n\t}\n\n\t/**\n\t * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to\n\t * keep track of everything in the numeric literal and then calling `parseFloat` on that string\n\t * @returns {jsep.Literal}\n\t */\n\tgobbleNumericLiteral() {\n\t\tlet number = '', ch, chCode;\n\n\t\twhile (Jsep.isDecimalDigit(this.code)) {\n\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t}\n\n\t\tif (this.code === Jsep.PERIOD_CODE) { // can start with a decimal marker\n\t\t\tnumber += this.expr.charAt(this.index++);\n\n\t\t\twhile (Jsep.isDecimalDigit(this.code)) {\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\t\t}\n\n\t\tch = this.char;\n\n\t\tif (ch === 'e' || ch === 'E') { // exponent marker\n\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\tch = this.char;\n\n\t\t\tif (ch === '+' || ch === '-') { // exponent sign\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\n\t\t\twhile (Jsep.isDecimalDigit(this.code)) { // exponent itself\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\n\t\t\tif (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) ) {\n\t\t\t\tthis.throwError('Expected exponent (' + number + this.char + ')');\n\t\t\t}\n\t\t}\n\n\t\tchCode = this.code;\n\n\t\t// Check to make sure this isn't a variable name that start with a number (123abc)\n\t\tif (Jsep.isIdentifierStart(chCode)) {\n\t\t\tthis.throwError('Variable names cannot start with a number (' +\n\t\t\t\tnumber + this.char + ')');\n\t\t}\n\t\telse if (chCode === Jsep.PERIOD_CODE || (number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE)) {\n\t\t\tthis.throwError('Unexpected period');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: Jsep.LITERAL,\n\t\t\tvalue: parseFloat(number),\n\t\t\traw: number\n\t\t};\n\t}\n\n\t/**\n\t * Parses a string literal, staring with single or double quotes with basic support for escape codes\n\t * e.g. `\"hello world\"`, `'this is\\nJSEP'`\n\t * @returns {jsep.Literal}\n\t */\n\tgobbleStringLiteral() {\n\t\tlet str = '';\n\t\tconst startIndex = this.index;\n\t\tconst quote = this.expr.charAt(this.index++);\n\t\tlet closed = false;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tlet ch = this.expr.charAt(this.index++);\n\n\t\t\tif (ch === quote) {\n\t\t\t\tclosed = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (ch === '\\\\') {\n\t\t\t\t// Check for all of the common escape codes\n\t\t\t\tch = this.expr.charAt(this.index++);\n\n\t\t\t\tswitch (ch) {\n\t\t\t\t\tcase 'n': str += '\\n'; break;\n\t\t\t\t\tcase 'r': str += '\\r'; break;\n\t\t\t\t\tcase 't': str += '\\t'; break;\n\t\t\t\t\tcase 'b': str += '\\b'; break;\n\t\t\t\t\tcase 'f': str += '\\f'; break;\n\t\t\t\t\tcase 'v': str += '\\x0B'; break;\n\t\t\t\t\tdefault : str += ch;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tstr += ch;\n\t\t\t}\n\t\t}\n\n\t\tif (!closed) {\n\t\t\tthis.throwError('Unclosed quote after \"' + str + '\"');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: Jsep.LITERAL,\n\t\t\tvalue: str,\n\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t};\n\t}\n\n\t/**\n\t * Gobbles only identifiers\n\t * e.g.: `foo`, `_value`, `$x1`\n\t * Also, this function checks if that identifier is a literal:\n\t * (e.g. `true`, `false`, `null`) or `this`\n\t * @returns {jsep.Identifier}\n\t */\n\tgobbleIdentifier() {\n\t\tlet ch = this.code, start = this.index;\n\n\t\tif (Jsep.isIdentifierStart(ch)) {\n\t\t\tthis.index++;\n\t\t}\n\t\telse {\n\t\t\tthis.throwError('Unexpected ' + this.char);\n\t\t}\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tch = this.code;\n\n\t\t\tif (Jsep.isIdentifierPart(ch)) {\n\t\t\t\tthis.index++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\ttype: Jsep.IDENTIFIER,\n\t\t\tname: this.expr.slice(start, this.index),\n\t\t};\n\t}\n\n\t/**\n\t * Gobbles a list of arguments within the context of a function call\n\t * or array literal. This function also assumes that the opening character\n\t * `(` or `[` has already been gobbled, and gobbles expressions and commas\n\t * until the terminator character `)` or `]` is encountered.\n\t * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`\n\t * @param {number} termination\n\t * @returns {jsep.Expression[]}\n\t */\n\tgobbleArguments(termination) {\n\t\tconst args = [];\n\t\tlet closed = false;\n\t\tlet separator_count = 0;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tthis.gobbleSpaces();\n\t\t\tlet ch_i = this.code;\n\n\t\t\tif (ch_i === termination) { // done parsing\n\t\t\t\tclosed = true;\n\t\t\t\tthis.index++;\n\n\t\t\t\tif (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length){\n\t\t\t\t\tthis.throwError('Unexpected token ' + String.fromCharCode(termination));\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (ch_i === Jsep.COMMA_CODE) { // between expressions\n\t\t\t\tthis.index++;\n\t\t\t\tseparator_count++;\n\n\t\t\t\tif (separator_count !== args.length) { // missing argument\n\t\t\t\t\tif (termination === Jsep.CPAREN_CODE) {\n\t\t\t\t\t\tthis.throwError('Unexpected token ,');\n\t\t\t\t\t}\n\t\t\t\t\telse if (termination === Jsep.CBRACK_CODE) {\n\t\t\t\t\t\tfor (let arg = args.length; arg < separator_count; arg++) {\n\t\t\t\t\t\t\targs.push(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (args.length !== separator_count && separator_count !== 0) {\n\t\t\t\t// NOTE: `&& separator_count !== 0` allows for either all commas, or all spaces as arguments\n\t\t\t\tthis.throwError('Expected comma');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst node = this.gobbleExpression();\n\n\t\t\t\tif (!node || node.type === Jsep.COMPOUND) {\n\t\t\t\t\tthis.throwError('Expected comma');\n\t\t\t\t}\n\n\t\t\t\targs.push(node);\n\t\t\t}\n\t\t}\n\n\t\tif (!closed) {\n\t\t\tthis.throwError('Expected ' + String.fromCharCode(termination));\n\t\t}\n\n\t\treturn args;\n\t}\n\n\t/**\n\t * Responsible for parsing a group of things within parentheses `()`\n\t * that have no identifier in front (so not a function call)\n\t * This function assumes that it needs to gobble the opening parenthesis\n\t * and then tries to gobble everything within that parenthesis, assuming\n\t * that the next thing it should see is the close parenthesis. If not,\n\t * then the expression probably doesn't have a `)`\n\t * @returns {boolean|jsep.Expression}\n\t */\n\tgobbleGroup() {\n\t\tthis.index++;\n\t\tlet nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);\n\t\tif (this.code === Jsep.CPAREN_CODE) {\n\t\t\tthis.index++;\n\t\t\tif (nodes.length === 1) {\n\t\t\t\treturn nodes[0];\n\t\t\t}\n\t\t\telse if (!nodes.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn {\n\t\t\t\t\ttype: Jsep.SEQUENCE_EXP,\n\t\t\t\t\texpressions: nodes,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.throwError('Unclosed (');\n\t\t}\n\t}\n\n\t/**\n\t * Responsible for parsing Array literals `[1, 2, 3]`\n\t * This function assumes that it needs to gobble the opening bracket\n\t * and then tries to gobble the expressions as arguments.\n\t * @returns {jsep.ArrayExpression}\n\t */\n\tgobbleArray() {\n\t\tthis.index++;\n\n\t\treturn {\n\t\t\ttype: Jsep.ARRAY_EXP,\n\t\t\telements: this.gobbleArguments(Jsep.CBRACK_CODE)\n\t\t};\n\t}\n}\n\n// Static fields:\nconst hooks = new Hooks();\nObject.assign(Jsep, {\n\thooks,\n\tplugins: new Plugins(Jsep),\n\n\t// Node Types\n\t// ----------\n\t// This is the full set of types that any JSEP node can be.\n\t// Store them here to save space when minified\n\tCOMPOUND: 'Compound',\n\tSEQUENCE_EXP: 'SequenceExpression',\n\tIDENTIFIER: 'Identifier',\n\tMEMBER_EXP: 'MemberExpression',\n\tLITERAL: 'Literal',\n\tTHIS_EXP: 'ThisExpression',\n\tCALL_EXP: 'CallExpression',\n\tUNARY_EXP: 'UnaryExpression',\n\tBINARY_EXP: 'BinaryExpression',\n\tARRAY_EXP: 'ArrayExpression',\n\n\tTAB_CODE: 9,\n\tLF_CODE: 10,\n\tCR_CODE: 13,\n\tSPACE_CODE: 32,\n\tPERIOD_CODE: 46, // '.'\n\tCOMMA_CODE: 44, // ','\n\tSQUOTE_CODE: 39, // single quote\n\tDQUOTE_CODE: 34, // double quotes\n\tOPAREN_CODE: 40, // (\n\tCPAREN_CODE: 41, // )\n\tOBRACK_CODE: 91, // [\n\tCBRACK_CODE: 93, // ]\n\tQUMARK_CODE: 63, // ?\n\tSEMCOL_CODE: 59, // ;\n\tCOLON_CODE: 58, // :\n\n\n\t// Operations\n\t// ----------\n\t// Use a quickly-accessible map to store all of the unary operators\n\t// Values are set to `1` (it really doesn't matter)\n\tunary_ops: {\n\t\t'-': 1,\n\t\t'!': 1,\n\t\t'~': 1,\n\t\t'+': 1\n\t},\n\n\t// Also use a map for the binary operations but set their values to their\n\t// binary precedence for quick reference (higher number = higher precedence)\n\t// see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)\n\tbinary_ops: {\n\t\t'||': 1, '&&': 2, '|': 3, '^': 4, '&': 5,\n\t\t'==': 6, '!=': 6, '===': 6, '!==': 6,\n\t\t'<': 7, '>': 7, '<=': 7, '>=': 7,\n\t\t'<<': 8, '>>': 8, '>>>': 8,\n\t\t'+': 9, '-': 9,\n\t\t'*': 10, '/': 10, '%': 10\n\t},\n\n\t// sets specific binary_ops as right-associative\n\tright_associative: new Set(),\n\n\t// Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)\n\tadditional_identifier_chars: new Set(['$', '_']),\n\n\t// Literals\n\t// ----------\n\t// Store the values to return for the various literals we may encounter\n\tliterals: {\n\t\t'true': true,\n\t\t'false': false,\n\t\t'null': null\n\t},\n\n\t// Except for `this`, which is special. This could be changed to something like `'self'` as well\n\tthis_str: 'this',\n});\nJsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\nJsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n\n// Backward Compatibility:\nconst jsep = expr => (new Jsep(expr)).parse();\nconst stdClassProps = Object.getOwnPropertyNames(class Test{});\nObject.getOwnPropertyNames(Jsep)\n\t.filter(prop => !stdClassProps.includes(prop) && jsep[prop] === undefined)\n\t.forEach((m) => {\n\t\tjsep[m] = Jsep[m];\n\t});\njsep.Jsep = Jsep; // allows for const { Jsep } = require('jsep');\n\nconst CONDITIONAL_EXP = 'ConditionalExpression';\n\nvar ternary = {\n\tname: 'ternary',\n\n\tinit(jsep) {\n\t\t// Ternary expression: test ? consequent : alternate\n\t\tjsep.hooks.add('after-expression', function gobbleTernary(env) {\n\t\t\tif (env.node && this.code === jsep.QUMARK_CODE) {\n\t\t\t\tthis.index++;\n\t\t\t\tconst test = env.node;\n\t\t\t\tconst consequent = this.gobbleExpression();\n\n\t\t\t\tif (!consequent) {\n\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t}\n\n\t\t\t\tthis.gobbleSpaces();\n\n\t\t\t\tif (this.code === jsep.COLON_CODE) {\n\t\t\t\t\tthis.index++;\n\t\t\t\t\tconst alternate = this.gobbleExpression();\n\n\t\t\t\t\tif (!alternate) {\n\t\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t\t}\n\t\t\t\t\tenv.node = {\n\t\t\t\t\t\ttype: CONDITIONAL_EXP,\n\t\t\t\t\t\ttest,\n\t\t\t\t\t\tconsequent,\n\t\t\t\t\t\talternate,\n\t\t\t\t\t};\n\n\t\t\t\t\t// check for operators of higher priority than ternary (i.e. assignment)\n\t\t\t\t\t// jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n\t\t\t\t\tif (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n\t\t\t\t\t\tlet newTest = test;\n\t\t\t\t\t\twhile (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n\t\t\t\t\t\t\tnewTest = newTest.right;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node.test = newTest.right;\n\t\t\t\t\t\tnewTest.right = env.node;\n\t\t\t\t\t\tenv.node = test;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.throwError('Expected :');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n};\n\n// Add default plugins:\n\njsep.plugins.register(ternary);\n\nexport { Jsep, jsep as default };\n","const ARROW_EXP = 'ArrowFunctionExpression';\n\nvar index = {\n\tname: 'arrow',\n\n\tinit(jsep) {\n\t\t// arrow-function expressions: () => x, v => v, (a, b) => v\n\t\tjsep.addBinaryOp('=>', 0.1, true);\n\n\t\t// this hook searches for the special case () => ...\n\t\t// which would normally throw an error because of the invalid LHS to the bin op\n\t\tjsep.hooks.add('gobble-expression', function gobbleEmptyArrowArg(env) {\n\t\t\tthis.gobbleSpaces();\n\t\t\tif (this.code === jsep.OPAREN_CODE) {\n\t\t\t\tconst backupIndex = this.index;\n\t\t\t\tthis.index++;\n\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tif (this.code === jsep.CPAREN_CODE) {\n\t\t\t\t\tthis.index++;\n\n\t\t\t\t\tconst biop = this.gobbleBinaryOp();\n\t\t\t\t\tif (biop === '=>') {\n\t\t\t\t\t\t// () => ...\n\t\t\t\t\t\tconst body = this.gobbleBinaryExpression();\n\t\t\t\t\t\tif (!body) {\n\t\t\t\t\t\t\tthis.throwError(\"Expected expression after \" + biop);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node = {\n\t\t\t\t\t\t\ttype: ARROW_EXP,\n\t\t\t\t\t\t\tparams: null,\n\t\t\t\t\t\t\tbody,\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.index = backupIndex;\n\t\t\t}\n\t\t});\n\n\t\tjsep.hooks.add('after-expression', function fixBinaryArrow(env) {\n\t\t\tupdateBinariesToArrows(env.node);\n\t\t});\n\n\t\tfunction updateBinariesToArrows(node) {\n\t\t\tif (node) {\n\t\t\t\t// Traverse full tree, converting any sub-object nodes as needed\n\t\t\t\tObject.values(node).forEach((val) => {\n\t\t\t\t\tif (val && typeof val === 'object') {\n\t\t\t\t\t\tupdateBinariesToArrows(val);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (node.operator === '=>') {\n\t\t\t\t\tnode.type = ARROW_EXP;\n\t\t\t\t\tnode.params = node.left ? [node.left] : null;\n\t\t\t\t\tnode.body = node.right;\n\t\t\t\t\tif (node.params && node.params[0].type === jsep.SEQUENCE_EXP) {\n\t\t\t\t\t\tnode.params = node.params[0].expressions;\n\t\t\t\t\t}\n\t\t\t\t\tdelete node.left;\n\t\t\t\t\tdelete node.right;\n\t\t\t\t\tdelete node.operator;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport { index as default };\n","var index = {\n\tname: 'new',\n\n\tinit(jsep) {\n\t\tjsep.addUnaryOp('new');\n\n\t\tjsep.hooks.add('after-token', function gobbleNew(env) {\n\t\t\tconst node = env.node;\n\t\t\tif (node && node.operator === 'new') {\n\t\t\t\tif (!node.argument || ![jsep.CALL_EXP, jsep.MEMBER_EXP].includes(node.argument.type)) {\n\t\t\t\t\tthis.throwError('Expected new function()');\n\t\t\t\t}\n\t\t\t\tenv.node = node.argument;\n\n\t\t\t\t// Change CALL_EXP to NewExpression (could be a nested member, even within a call expr)\n\t\t\t\tlet callNode = env.node;\n\t\t\t\twhile (callNode.type === jsep.MEMBER_EXP || (\n\t\t\t\t\tcallNode.type === jsep.CALL_EXP && callNode.callee.type === jsep.MEMBER_EXP)) {\n\t\t\t\t\tcallNode = callNode.type === jsep.MEMBER_EXP\n\t\t\t\t\t\t? callNode.object\n\t\t\t\t\t\t: callNode.callee.object;\n\t\t\t\t}\n\t\t\t\tcallNode.type = 'NewExpression';\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport { index as default };\n","const NUM_0_CODE = 48;\nconst UNDERSCORE = 95;\n\nvar index = {\n\tname: 'numbers',\n\n\tinit(Jsep) {\n\t\tJsep.hooks.add('gobble-token', function gobbleNumber(env) {\n\t\t\tif (this.code === NUM_0_CODE) {\n\t\t\t\tconst startIndex = this.index;\n\t\t\t\tconst numType = this.expr.charAt(this.index + 1);\n\t\t\t\tconst ranges = getNumberCodeRanges.call(this, numType);\n\t\t\t\tif (!ranges) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet number = '';\n\t\t\t\twhile (isUnderscoreOrWithinRange(this.code, ranges)) {\n\t\t\t\t\tif (this.code === UNDERSCORE) {\n\t\t\t\t\t\tthis.index ++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// confirm valid syntax after building number string within ranges\n\t\t\t\tif (Jsep.isIdentifierPart(this.code)) {\n\t\t\t\t\tif (Jsep.isDecimalDigit(this.code) && Jsep.isDecimalDigit(numType.charCodeAt(0))) {\n\t\t\t\t\t\t// abort octal processing and reset to ignore the leading 0\n\t\t\t\t\t\tthis.index = startIndex + 1;\n\t\t\t\t\t\tgobbleBase10.call(this, env);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.throwError('unexpected char within number');\n\t\t\t\t}\n\n\t\t\t\tenv.node = {\n\t\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\t\tvalue: parseInt(number, getNumberBase(numType)),\n\t\t\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t\t\t};\n\t\t\t}\n\t\t\telse if (Jsep.isDecimalDigit(this.code) || this.code === Jsep.PERIOD_CODE) {\n\t\t\t\tgobbleBase10.call(this, env);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Gets the range of allowable number codes (decimal) and updates index\n\t\t * @param {string} numType\n\t\t * @returns {number[][]|null}\n\t\t */\n\t\tfunction getNumberCodeRanges(numType) {\n\t\t\tif (numType === 'x' || numType === 'X') {\n\t\t\t\tthis.index += 2;\n\t\t\t\treturn [\n\t\t\t\t\t[48, 57], // 0-9\n\t\t\t\t\t[65, 70], // A-F\n\t\t\t\t\t[97, 102], // a-f\n\t\t\t\t];\n\t\t\t}\n\t\t\telse if (numType === 'b' || numType === 'B') {\n\t\t\t\tthis.index += 2;\n\t\t\t\treturn [[48, 49]]; // 0-1\n\t\t\t}\n\t\t\telse if (numType === 'o' || numType === 'O' ||\n\t\t\t\t(numType >= '0' && numType <= '7')) { // 0-7 allows non-standard 0644 = 420\n\t\t\t\tthis.index += numType <= '7' ? 1 : 2;\n\t\t\t\treturn [[48, 55]]; // 0-7\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Supports Hex, Octal and Binary only\n\t\t * @param {string} numType\n\t\t * @returns {16|8|2}\n\t\t */\n\t\tfunction getNumberBase(numType) {\n\t\t\tif (numType === 'x' || numType === 'X') {\n\t\t\t\treturn 16;\n\t\t\t}\n\t\t\telse if (numType === 'b' || numType === 'B') {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// default (includes non-stand 044)\n\t\t\treturn 8;\n\t\t}\n\n\t\t/**\n\t\t * Verifies number code is within given ranges\n\t\t * @param {number} code\n\t\t * @param {number[][]} ranges\n\t\t */\n\t\tfunction isUnderscoreOrWithinRange(code, ranges) {\n\t\t\treturn code === UNDERSCORE ||\n\t\t\t\tranges.some(([min, max]) => code >= min && code <= max);\n\t\t}\n\n\t\t/**\n\t\t * Same as core gobbleNumericLiteral, but allows for _ char\n\t\t * @param {{ context?: typeof Jsep, node?: Expression }} env\n\t\t */\n\t\tfunction gobbleBase10(env) {\n\t\t\tconst startIndex = this.index;\n\t\t\tlet number = '';\n\n\t\t\tconst gobbleDigits = () => {\n\t\t\t\twhile (Jsep.isDecimalDigit(this.code) || this.code === UNDERSCORE) {\n\t\t\t\t\tif (this.code === UNDERSCORE) {\n\t\t\t\t\t\tthis.index++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tgobbleDigits();\n\t\t\tif (this.code === Jsep.PERIOD_CODE) { // can start with a decimal marker\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\n\t\t\t\tgobbleDigits();\n\t\t\t}\n\n\t\t\tlet ch = this.char;\n\t\t\tif (ch === 'e' || ch === 'E') { // exponent marker\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\tch = this.char;\n\n\t\t\t\tif (ch === '+' || ch === '-') { // exponent sign\n\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t}\n\n\t\t\t\tgobbleDigits(); // exponent itself\n\n\t\t\t\tif (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) ) {\n\t\t\t\t\tthis.throwError('Expected exponent (' + number + this.char + ')');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst chCode = this.code;\n\n\t\t\t// Check to make sure this isn't a variable name that start with a number (123abc)\n\t\t\tif (Jsep.isIdentifierStart(chCode)) {\n\t\t\t\tthis.throwError('Variable names cannot start with a number (' +\n\t\t\t\t\tnumber + this.char + ')');\n\t\t\t}\n\t\t\telse if (chCode === Jsep.PERIOD_CODE) {\n\t\t\t\tif (number.length > 1) {\n\t\t\t\t\tthis.throwError(`Unexpected period ${JSON.stringify({ chCode, number }, null, 2)}`);\n\t\t\t\t}\n\t\t\t\t// leave other error-handling to jsep core. Also allows spread operator.\n\t\t\t\tthis.index = startIndex;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tenv.node = {\n\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\tvalue: parseFloat(number),\n\t\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t\t};\n\t\t}\n\t}\n};\n\nexport { index as default };\n","const FSLASH_CODE = 47; // '/'\nconst BSLASH_CODE = 92; // '\\\\'\n\nvar index = {\n\tname: 'regex',\n\n\tinit(jsep) {\n\t\t// Regex literal: /abc123/ig\n\t\tjsep.hooks.add('gobble-token', function gobbleRegexLiteral(env) {\n\t\t\tif (this.code === FSLASH_CODE) {\n\t\t\t\tconst patternIndex = ++this.index;\n\n\t\t\t\tlet inCharSet = false;\n\t\t\t\twhile (this.index < this.expr.length) {\n\t\t\t\t\tif (this.code === FSLASH_CODE && !inCharSet) {\n\t\t\t\t\t\tconst pattern = this.expr.slice(patternIndex, this.index);\n\n\t\t\t\t\t\tlet flags = '';\n\t\t\t\t\t\twhile (++this.index < this.expr.length) {\n\t\t\t\t\t\t\tconst code = this.code;\n\t\t\t\t\t\t\tif ((code >= 97 && code <= 122) // a...z\n\t\t\t\t\t\t\t\t|| (code >= 65 && code <= 90) // A...Z\n\t\t\t\t\t\t\t\t|| (code >= 48 && code <= 57)) { // 0-9\n\t\t\t\t\t\t\t\tflags += this.char;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet value;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvalue = new RegExp(pattern, flags);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\tthis.throwError(e.message);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tenv.node = {\n\t\t\t\t\t\t\ttype: jsep.LITERAL,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\traw: this.expr.slice(patternIndex - 1, this.index),\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// allow . [] and () after regex: /regex/.test(a)\n\t\t\t\t\t\tenv.node = this.gobbleTokenProperty(env.node);\n\t\t\t\t\t\treturn env.node;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.code === jsep.OBRACK_CODE) {\n\t\t\t\t\t\tinCharSet = true;\n\t\t\t\t\t}\n\t\t\t\t\telse if (inCharSet && this.code === jsep.CBRACK_CODE) {\n\t\t\t\t\t\tinCharSet = false;\n\t\t\t\t\t}\n\t\t\t\t\tthis.index += this.code === BSLASH_CODE ? 2 : 1;\n\t\t\t\t}\n\t\t\t\tthis.throwError('Unclosed Regex');\n\t\t\t}\n\t\t});\n\t},\n};\n\nexport { index as default };\n","const CONDITIONAL_EXP = 'ConditionalExpression';\n\nvar index = {\n\tname: 'ternary',\n\n\tinit(jsep) {\n\t\t// Ternary expression: test ? consequent : alternate\n\t\tjsep.hooks.add('after-expression', function gobbleTernary(env) {\n\t\t\tif (env.node && this.code === jsep.QUMARK_CODE) {\n\t\t\t\tthis.index++;\n\t\t\t\tconst test = env.node;\n\t\t\t\tconst consequent = this.gobbleExpression();\n\n\t\t\t\tif (!consequent) {\n\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t}\n\n\t\t\t\tthis.gobbleSpaces();\n\n\t\t\t\tif (this.code === jsep.COLON_CODE) {\n\t\t\t\t\tthis.index++;\n\t\t\t\t\tconst alternate = this.gobbleExpression();\n\n\t\t\t\t\tif (!alternate) {\n\t\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t\t}\n\t\t\t\t\tenv.node = {\n\t\t\t\t\t\ttype: CONDITIONAL_EXP,\n\t\t\t\t\t\ttest,\n\t\t\t\t\t\tconsequent,\n\t\t\t\t\t\talternate,\n\t\t\t\t\t};\n\n\t\t\t\t\t// check for operators of higher priority than ternary (i.e. assignment)\n\t\t\t\t\t// jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n\t\t\t\t\tif (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n\t\t\t\t\t\tlet newTest = test;\n\t\t\t\t\t\twhile (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n\t\t\t\t\t\t\tnewTest = newTest.right;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node.test = newTest.right;\n\t\t\t\t\t\tnewTest.right = env.node;\n\t\t\t\t\t\tenv.node = test;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.throwError('Expected :');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n};\n\nexport { index as default };\n","const BTICK_CODE = 96; // `\nconst CCURLY_CODE = 125; // }\nconst TAGGED_TEMPLATE_EXPRESSION = 'TaggedTemplateExpression';\nconst TEMPLATE_LITERAL = 'TemplateLiteral';\nconst TEMPLATE_ELEMENT = 'TemplateElement';\n\nvar index = {\n\tname: 'jsepTemplateLiteral',\n\n\tinit(jsep) {\n\t\tfunction gobbleTemplateLiteral(env, gobbleMember = true) {\n\t\t\tif (this.code === BTICK_CODE) {\n\t\t\t\tconst node = {\n\t\t\t\t\ttype: TEMPLATE_LITERAL,\n\t\t\t\t\tquasis: [],\n\t\t\t\t\texpressions: [],\n\t\t\t\t};\n\t\t\t\tlet cooked = '';\n\t\t\t\tlet raw = '';\n\t\t\t\tlet closed = false;\n\t\t\t\tconst length = this.expr.length;\n\t\t\t\tconst pushQuasi = () => node.quasis.push({\n\t\t\t\t\ttype: TEMPLATE_ELEMENT,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\traw,\n\t\t\t\t\t\tcooked,\n\t\t\t\t\t},\n\t\t\t\t\ttail: closed,\n\t\t\t\t});\n\n\t\t\t\twhile (this.index < length) {\n\t\t\t\t\tlet ch = this.expr.charAt(++this.index);\n\n\t\t\t\t\tif (ch === '`') {\n\t\t\t\t\t\tthis.index += 1;\n\t\t\t\t\t\tclosed = true;\n\t\t\t\t\t\tpushQuasi();\n\n\t\t\t\t\t\tenv.node = node;\n\n\t\t\t\t\t\tif (gobbleMember) {\n\t\t\t\t\t\t // allow . [] and () after template: `foo`.length\n\t\t\t\t\t\t env.node = this.gobbleTokenProperty(env.node);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn env.node;\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch === '$' && this.expr.charAt(this.index + 1) === '{') {\n\t\t\t\t\t\tthis.index += 2;\n\t\t\t\t\t\tpushQuasi();\n\t\t\t\t\t\traw = '';\n\t\t\t\t\t\tcooked = '';\n\t\t\t\t\t\tnode.expressions.push(...this.gobbleExpressions(CCURLY_CODE));\n\t\t\t\t\t\tif (this.code !== CCURLY_CODE) {\n\t\t\t\t\t\t\tthis.throwError('unclosed ${');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch === '\\\\') {\n\t\t\t\t\t\t// Check for all of the common escape codes\n\t\t\t\t\t\traw += ch;\n\t\t\t\t\t\tch = this.expr.charAt(++this.index);\n\t\t\t\t\t\traw += ch;\n\n\t\t\t\t\t\tswitch (ch) {\n\t\t\t\t\t\t\tcase 'n': cooked += '\\n'; break;\n\t\t\t\t\t\t\tcase 'r': cooked += '\\r'; break;\n\t\t\t\t\t\t\tcase 't': cooked += '\\t'; break;\n\t\t\t\t\t\t\tcase 'b': cooked += '\\b'; break;\n\t\t\t\t\t\t\tcase 'f': cooked += '\\f'; break;\n\t\t\t\t\t\t\tcase 'v': cooked += '\\x0B'; break;\n\t\t\t\t\t\t\tdefault : cooked += ch;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcooked += ch;\n\t\t\t\t\t\traw += ch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.throwError('Unclosed `');\n\t\t\t}\n\t\t}\n\n\t\tjsep.hooks.add('gobble-token', gobbleTemplateLiteral);\n\n\t\tjsep.hooks.add('after-token', function gobbleTaggedTemplateIdentifier(env) {\n\t\t\tif ((env.node.type === jsep.IDENTIFIER || env.node.type === jsep.MEMBER_EXP) && this.code === BTICK_CODE) {\n\t\t\t\tenv.node = {\n\t\t\t\t\ttype: TAGGED_TEMPLATE_EXPRESSION,\n\t\t\t\t\ttag: env.node,\n\t\t\t\t\tquasi: gobbleTemplateLiteral.bind(this)(env, false),\n\t\t\t\t};\n\n\t\t\t\t// allow . [] and () after tagged template: bar`foo`.length\n\t\t\t\tenv.node = this.gobbleTokenProperty(env.node);\n\n\t\t\t\treturn env.node;\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport { index as default };\n","export const globals = {\n Array,\n Boolean,\n Symbol,\n Infinity,\n NaN,\n Math,\n Number,\n BigInt,\n String,\n RegExp,\n JSON,\n isFinite,\n isNaN,\n parseFloat,\n parseInt,\n decodeURI,\n encodeURI,\n encodeURIComponent,\n Object: {\n __proto__: undefined,\n assign: Object.assign.bind(null),\n fromEntries: Object.fromEntries.bind(null),\n hasOwn: Object.hasOwn.bind(null),\n keys: Object.keys.bind(null),\n is: Object.is.bind(null),\n values: Object.values.bind(null),\n },\n};\n\nexport const globalsAsync = {\n ...globals,\n Promise,\n};\n","/** @category Utility */\nimport jsep from 'jsep';\nimport jsepArrow, { type ArrowExpression } from '@jsep-plugin/arrow';\nimport jsepNew, { type NewExpression } from '@jsep-plugin/new';\nimport jsepNumbers from '@jsep-plugin/numbers';\nimport jsepRegex from '@jsep-plugin/regex';\nimport jsepTernary from '@jsep-plugin/ternary';\nimport jsepTemplate, { type TemplateElement, type TemplateLiteral } from '@jsep-plugin/template';\nimport { globals, globalsAsync } from './globals';\n\njsep.plugins.register(jsepArrow);\njsep.plugins.register(jsepNew);\njsep.plugins.register(jsepNumbers);\njsep.plugins.register(jsepRegex);\njsep.plugins.register(jsepTernary);\njsep.plugins.register(jsepTemplate);\n// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence\n// for the order defined here\n// 7 is jsep's internal for \"relational operators\"\njsep.addBinaryOp('in', 7);\njsep.addBinaryOp('??', 1);\n\nexport { jsep };\n\n/** An object containing the variable to use when evaluating this expression */\nexport type VariablesMap = {\n [key: string]: string | number | boolean | Function | RegExp | object | null | VariablesMap | Array<VariablesMap>;\n};\n\n/** The valid return types for `evaluate()` and `evaluateAsync()` */\nexport type DefaultEvaluateReturnType = string | number | boolean | Date | null | undefined;\n\n/**\n * `evaluate()` implements a relatively safe version of `eval()` that is limited to evaluating synchronous\n * Javascript expressions. This allows us to safely add features that depend on user-supplied code without\n * polluting the global namespace or needing to support `eval()` and the like.\n *\n * By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined.\n * Other values will result in an error.\n *\n * @example\n * ```ts\n * // shouldDisplayOptionalData will be false\n * const shouldDisplayOptionalData = evaluate('!isEmpty(array)', {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * })\n * ```\n *\n * Since this only implements the expression lanaguage part of Javascript, there is no support for assigning\n * values, creating functions, or creating objects, so the following will throw an error:\n *\n * @example\n * ```ts\n * evaluate('var a = 1; a');\n * ```\n *\n * In addition to string expressions, `evaluate()` can use an existing `jsep.Expression`, such as that returned\n * from the `compile()` function. The goal here is to support cases where the same expression will be evaluated\n * multiple times, possibly with different variables, e.g.,\n *\n * @example\n * ```ts\n * const expr = compile('isEmpty(array)');\n *\n * // then we use it like\n * evaluate(expr, {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n *\n * evaluate(expr, {\n * array: ['value'],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n * ```\n *\n * This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.\n *\n * The `variables` parameter should be used to supply any variables or functions that should be in-scope for\n * the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but\n * any non-global values will need to be passed as a variable. Note that expressions do not have any access to\n * the variables in the scope in which they were defined unless they are supplied here.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluate(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, defaultTypePredicate);\n}\n\n/**\n * `evaluateAsync()` implements a relatively safe version of `eval()` that can evaluate Javascript expressions\n * that use Promises. This allows us to safely add features that depend on user-supplied code without\n * polluting the global namespace or needing to support `eval()` and the like.\n *\n * By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined.\n * Other values will result in an error.\n *\n * @example\n * ```ts\n * // shouldDisplayOptionalData will be false\n * const shouldDisplayOptionalData = await evaluateAsync('Promise.resolve(!isEmpty(array))', {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * })\n * ```\n *\n * Since this only implements the expression lanaguage part of Javascript, there is no support for assigning\n * values, creating functions, or creating objects, so the following will throw an error:\n *\n * @example\n * ```ts\n * evaluateAsync('var a = 1; a');\n * ```\n *\n * In addition to string expressions, `evaluate()` can use an existing `jsep.Expression`, such as that returned\n * from the `compile()` function. The goal here is to support cases where the same expression will be evaluated\n * multiple times, possibly with different variables, e.g.,\n *\n * @example\n * ```ts\n * const expr = compile('Promise.resolve(isEmpty(array))');\n *\n * // then we use it like\n * evaluateAsync(expr, {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n *\n * evaluateAsync(expr, {\n * array: ['value'],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n * ```\n *\n * This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.\n *\n * The `variables` parameter should be used to supply any variables or functions that should be in-scope for\n * the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but\n * any non-global values will need to be passed as a variable. Note that expressions do not have any access to\n * the variables in the scope in which they were defined unless they are supplied here.\n *\n * **Note:** `evaluateAsync()` currently only supports Promise-based asynchronous flows and does not support\n * the `await` keyword.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport async function evaluateAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, defaultTypePredicate);\n}\n\n/**\n * `evaluateAsBoolean()` is a variant of {@link evaluate()} which only supports boolean results. Useful\n * if valid expression must return boolean values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsBoolean(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, booleanTypePredicate);\n}\n\n/**\n * `evaluateAsBooleanAsync()` is a variant of {@link evaluateAsync()} which only supports boolean results. Useful\n * if valid expression must return boolean values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsBooleanAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, booleanTypePredicate);\n}\n\n/**\n * `evaluateAsNumber()` is a variant of {@link evaluate()} which only supports number results. Useful\n * if valid expression must return numeric values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsNumber(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, numberTypePredicate);\n}\n\n/**\n * `evaluateAsNumberAsync()` is a variant of {@link evaluateAsync()} which only supports number results. Useful\n * if valid expression must return numeric values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsNumberAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, numberTypePredicate);\n}\n\n/**\n * `evaluateAsType()` is a type-safe version of {@link evaluate()} which returns a result if the result\n * passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on\n * context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard\n * to ensure that only number or boolean results are returned.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @param typePredicate A [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * which asserts that the result value matches one of the expected results.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsType<T>(\n expression: string | jsep.Expression,\n variables: VariablesMap = {},\n typePredicate: (result: unknown) => result is T,\n): T {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n throw `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`;\n }\n\n if (typeof variables === 'undefined' || variables === null) {\n variables = {};\n }\n\n const context = createSynchronousContext(variables);\n const result = visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context);\n\n if (typePredicate(result)) {\n return result;\n } else {\n throw {\n type: 'Invalid result',\n message:\n typeof expression === 'string'\n ? `The expression ${expression} did not produce a valid result`\n : 'The expression did not produce a valid result',\n };\n }\n}\n\n/**\n * `evaluateAsTypeAsync()` is a type-safe version of {@link evaluateAsync()} which returns a result if the result\n * passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on\n * context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard\n * to ensure that only number or boolean results are returned.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @param typePredicate A [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * which asserts that the result value matches one of the expected results.\n * @returns The result of evaluating the expression\n */\nexport async function evaluateAsTypeAsync<T>(\n expression: string | jsep.Expression,\n variables: VariablesMap = {},\n typePredicate: (result: unknown) => result is T,\n): Promise<T> {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n return Promise.reject(\n `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`,\n );\n }\n\n if (typeof variables === 'undefined' || variables === null) {\n variables = {};\n }\n\n const context = createAsynchronousContext(variables);\n return Promise.resolve(visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context)).then(\n (result) => {\n if (typePredicate(result)) {\n return result;\n } else {\n throw {\n type: 'Invalid result',\n message:\n typeof expression === 'string'\n ? `The expression ${expression} did not produce a valid result`\n : 'The expression did not produce a valid result',\n };\n }\n },\n );\n}\n\n/**\n * `compile()` is a companion function for use with {@link evaluate()} and the various `evaluateAs*()` functions.\n * It processes an expression string into the resulting AST that is executed by those functions. This is useful if\n * you have an expression that will need to be evaluated mulitple times, potentially with different values, as the\n * lexing and parsing steps can be skipped by using the AST object returned from this.\n *\n * The returned AST is intended to be opaque to client applications, but, of course, it is possible to manipulate\n * the AST before passing it back to {@link evaluate()}, if desired. This might be useful if, for example, certain\n * values are known to be constant.\n *\n * @param expression The expression to be parsed\n * @returns An executable AST representation of the expression\n */\nexport function compile(expression: string): jsep.Expression {\n return jsep(expression);\n}\n\n// Pre-defined type guards\nfunction defaultTypePredicate(result: unknown): result is DefaultEvaluateReturnType {\n return (\n typeof result === 'string' ||\n typeof result === 'number' ||\n typeof result === 'boolean' ||\n typeof result === 'undefined' ||\n result === null ||\n result instanceof Date\n );\n}\n\nfunction booleanTypePredicate(result: unknown): result is Boolean {\n return typeof result === 'boolean';\n}\n\nfunction numberTypePredicate(result: unknown): result is number {\n return typeof result === 'number';\n}\n\n// Implementation\n\n// This is the core of the implementation; it takes an expression, the variables and the current object\n// each expression is dispatched to an appropriate handler.\nfunction visitExpression(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'UnaryExpression':\n return visitUnaryExpression(expression as jsep.UnaryExpression, context);\n case 'BinaryExpression':\n return visitBinaryExpression(expression as jsep.BinaryExpression, context);\n case 'ConditionalExpression':\n return visitConditionalExpression(expression as jsep.ConditionalExpression, context);\n case 'CallExpression':\n return visitCallExpression(expression as jsep.CallExpression, context);\n case 'ArrowFunctionExpression':\n return visitArrowFunctionExpression(expression as ArrowExpression, context);\n case 'MemberExpression':\n return visitMemberExpression(expression as jsep.MemberExpression, context);\n case 'ArrayExpression':\n return visitArrayExpression(expression as jsep.ArrayExpression, context);\n case 'SequenceExpression':\n return visitSequenceExpression(expression as jsep.SequenceExpression, context);\n case 'NewExpression':\n return visitNewExpression(expression as NewExpression, context);\n case 'Literal':\n return visitLiteral(expression as jsep.Literal, context);\n case 'Identifier':\n return visitIdentifier(expression as jsep.Identifier, context);\n case 'TemplateLiteral':\n return visitTemplateLiteral(expression as TemplateLiteral, context);\n case 'TemplateElement':\n return visitTemplateElement(expression as TemplateElement, context);\n default:\n throw `Expression evaluator does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitExpressionName(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'Literal':\n return (expression as jsep.Literal).value as string;\n case 'Identifier':\n return (expression as jsep.Identifier).name;\n case 'MemberExpression':\n return visitExpressionName((expression as jsep.MemberExpression).property, context);\n default:\n throw `VisitExpressionName does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitUnaryExpression(expression: jsep.UnaryExpression, context: EvaluationContext) {\n const value = visitExpression(expression.argument, context);\n\n switch (expression.operator) {\n case '+':\n return +value;\n case '-':\n return -value;\n case '~':\n return ~value;\n case '!':\n return !value;\n default:\n throw `Expression evaluator does not support operator '${expression.operator}''`;\n }\n}\n\nfunction visitBinaryExpression(expression: jsep.BinaryExpression, context: EvaluationContext) {\n let left = visitExpression(expression.left, context);\n let right = visitExpression(expression.right, context);\n\n switch (expression.operator) {\n case '+':\n return left + right;\n case '-':\n return left - right;\n case '*':\n return left * right;\n case '/':\n return left / right;\n case '%':\n return left % right;\n case '**':\n return left ** right;\n case '==':\n return left == right;\n case '===':\n return left === right;\n case '!=':\n return left != right;\n case '!==':\n return left !== right;\n case '>':\n return left > right;\n case '>=':\n return left >= right;\n case '<':\n return left < right;\n case '<=':\n return left <= right;\n case 'in':\n return left in right;\n case '&&':\n return left && right;\n case '||':\n return left || right;\n case '??':\n return left ?? right;\n default:\n throw `Expression evaluator does not support operator '${expression.operator}' operator`;\n }\n}\n\nfunction visitConditionalExpression(expression: jsep.ConditionalExpression, context: EvaluationContext) {\n const test = visitExpression(expression.test, context);\n return test ? visitExpression(expression.consequent, context) : visitExpression(expression.alternate, context);\n}\n\nfunction visitCallExpression(expression: jsep.CallExpression, context: EvaluationContext) {\n let args = expression.arguments?.map(handleNullableExpression(context));\n let callee = visitExpression(expression.callee, context);\n\n if (!callee) {\n throw `No function named ${expression.callee} is defined in this context`;\n } else if (!(typeof callee === 'function')) {\n throw `${expression.callee} is not a function`;\n }\n\n return callee(...args);\n}\n\nfunction visitArrowFunctionExpression(expression: ArrowExpression, context: EvaluationContext) {\n const params =\n expression.params?.map((p) => {\n switch (p.type) {\n case 'Identifier':\n return (p as jsep.Identifier).name;\n default:\n throw `Cannot handle parameter of type ${p.type}`;\n }\n }) ?? [];\n\n return function (...rest: unknown[]) {\n if (rest.length < params.length) {\n throw `Required argument(s) ${params.slice(rest.length, -1).join(', ')} were not provided`;\n }\n\n const vars = Object.fromEntries(\n params.reduce((acc: Array<[string, VariablesMap['a']]>, p, idx) => {\n const val = rest[idx];\n if (isValidVariableType(val)) {\n acc.push([p, val]);\n }\n return acc;\n }, []),\n );\n\n return visitExpression(expression.body, context.addVariables(vars));\n }.bind(context.thisObj ?? null);\n}\n\nfunction visitMemberExpression(expression: jsep.MemberExpression, context: EvaluationContext) {\n let obj = visitExpression(expression.object, context);\n\n if (obj === undefined) {\n switch (expression.object.type) {\n case 'Identifier': {\n let objectName = visitExpressionName(expression.object, context);\n throw ReferenceError(`ReferenceError: ${objectName} is not defined`);\n }\n case 'MemberExpression': {\n let propertyName = visitExpressionName(expression.property, context);\n throw TypeError(`TypeError: cannot read properties of undefined (reading '${propertyName}')`);\n }\n default:\n throw `VisitMemberExpression does not support operator '${expression.object.type}' type`;\n }\n }\n\n let newObj = obj;\n if (typeof obj === 'string') {\n newObj = String.prototype;\n } else if (typeof obj === 'number') {\n newObj = Number.prototype;\n } else if (typeof obj === 'function') {\n // no-op\n } else if (typeof obj !== 'object') {\n throw `VisitMemberExpression does not support member access on type ${typeof obj}`;\n }\n\n context.thisObj = newObj;\n\n let result: unknown;\n switch (expression.property.type) {\n case 'Identifier':\n case 'MemberExpression':\n result = visitExpression(expression.property, context);\n break;\n default: {\n const property = visitExpression(expression.property, context);\n if (typeof property === 'undefined') {\n throw { type: 'Illegal property access', message: 'No property was supplied to the property access' };\n }\n validatePropertyName(property);\n result = obj[property];\n }\n }\n\n if (typeof result === 'function') {\n return result.bind(obj);\n }\n\n return result;\n}\n\nfunction visitArrayExpression(expression: jsep.ArrayExpression, context: EvaluationContext) {\n return expression.elements?.map(handleNullableExpression(context));\n}\n\nfunction visitSequenceExpression(expression: jsep.SequenceExpression, context: EvaluationContext) {\n const result = expression.expressions.map(handleNullableExpression(context));\n return result[result.length - 1];\n}\n\nfunction visitNewExpression(expression: NewExpression, context: EvaluationContext) {\n if (expression.callee && expression.callee.type === 'Identifier') {\n let args = expression.arguments?.map(handleNullableExpression(context)) as Array<any>;\n switch (expression.callee.name) {\n case 'Date': {\n /** @ts-ignore because we can use the spread operator here */\n return new Date(...args);\n }\n case 'RegExp':\n /** @ts-ignore because we can use the spread operator here */\n return new RegExp(...args);\n default:\n throw `Cannot instantiate object of type ${expression.callee.name}`;\n }\n } else {\n if (!expression.callee) {\n throw `Could not handle \"new\" without a specified class`;\n } else {\n throw 'new must be called with either Date or RegExp';\n }\n }\n}\n\nfunction visitTemplateLiteral(expression: TemplateLiteral, context: EvaluationContext) {\n const expressions: Array<unknown> = expression.expressions?.map(handleNullableExpression(context)) ?? [];\n const quasis: Array<{ tail: boolean; value: unknown }> =\n expression.quasis?.map(handleNullableExpression(context)) ?? [];\n return (\n quasis\n .filter((q) => !q.tail)\n .map((q) => q.value)\n .join('') +\n expressions.join('') +\n quasis\n .filter((q) => q.tail)\n .map((q) => q.value)\n .join('')\n );\n}\n\nfunction visitTemplateElement(expression: TemplateElement, context: EvaluationContext) {\n return { value: expression.cooked, tail: expression.tail };\n}\n\nfunction visitIdentifier(expression: jsep.Identifier, context: EvaluationContext) {\n validatePropertyName(expression.name);\n\n // we support both `object` and `function` in the same way as technically property access on functions\n // is possible; the use-case here is to support JS's \"static\" functions like `Number.isInteger()`, which\n // is technically reading a property on a function\n const thisObj = context.thisObj;\n if (thisObj && (typeof thisObj === 'object' || typeof thisObj === 'function') && expression.name in thisObj) {\n const result = thisObj[expression.name];\n validatePropertyName(result);\n return result;\n } else if (context.variables && expression.name in context.variables) {\n const result = context.variables[expression.name];\n validatePropertyName(result);\n return result;\n } else if (expression.name in context.globals) {\n return context.globals[expression.name];\n } else {\n return undefined;\n }\n}\n\nfunction visitLiteral(expression: jsep.Literal, context: EvaluationContext) {\n validatePropertyName(expression.value);\n return expression.value;\n}\n\n// Internal helpers and utilities\n\ninterface EvaluationContext {\n thisObj: object | undefined;\n variables: VariablesMap;\n globals: typeof globals | typeof globalsAsync;\n addVariables(vars: VariablesMap): EvaluationContext;\n}\n\nfunction createSynchronousContext(variables: VariablesMap): EvaluationContext {\n return createContextInternal(variables, globals);\n}\n\nfunction createAsynchronousContext(variables: VariablesMap): EvaluationContext {\n return createContextInternal(variables, globalsAsync);\n}\n\nfunction createContextInternal(variables: VariablesMap, globals_: typeof globals | typeof globalsAsync) {\n const context = {\n thisObj: undefined,\n variables: { ...variables },\n globals: { ...globals_ },\n addVariables(vars: VariablesMap) {\n this.variables = { ...this.variables, ...vars };\n return this;\n },\n };\n\n context.addVariables.bind(context);\n\n return context;\n}\n\n// helper useful for handling arrays of expressions, since `null` expressions should not be\n// dispatched to `visitExpression()`\nfunction handleNullableExpression(context: EvaluationContext) {\n return function handleNullableExpressionInner(expression: jsep.Expression | null) {\n if (expression === null) {\n return null;\n }\n\n return visitExpression(expression, context);\n };\n}\n\nfunction validatePropertyName(name: unknown) {\n if (name === '__proto__' || name === 'prototype' || name === 'constructor') {\n throw { type: 'Illegal property access', message: `Cannot access the ${name} property of objects` };\n }\n}\n\nfunction isValidVariableType(val: unknown): val is VariablesMap['a'] {\n if (\n typeof val === 'string' ||\n typeof val === 'number' ||\n typeof val === 'boolean' ||\n typeof val === 'function' ||\n val === null ||\n val instanceof RegExp\n ) {\n return true;\n }\n\n if (typeof val === 'object') {\n for (const key of Object.keys(val)) {\n if (!isValidVariableType(val[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n if (Array.isArray(val)) {\n for (const item of val) {\n if (!isValidVariableType(item)) {\n return false;\n }\n }\n }\n\n return false;\n}\n","/** @category Utility */\nimport { type ArrowExpression } from '@jsep-plugin/arrow';\nimport { type NewExpression } from '@jsep-plugin/new';\nimport { type TemplateElement, type TemplateLiteral } from '@jsep-plugin/template';\nimport { jsep } from './evaluator';\nimport { globalsAsync } from './globals';\n\n/**\n * `extractVariableNames()` is a companion function for `evaluate()` and `evaluateAsync()` which extracts the\n * names of all unbound identifiers used in the expression. The idea is to be able to extract all of the names\n * of variables that will need to be supplied in order to correctly process the expression.\n *\n * @example\n * ```ts\n * // variables will be ['isEmpty', 'array']\n * const variables = extractVariableNames('!isEmpty(array)')\n * ```\n *\n * An identifier is considered \"unbound\" if it is not a reference to the property of an object, is not defined\n * as a parameter to an inline arrow function, and is not a global value. E.g.,\n *\n * @example\n * ```ts\n * // variables will be ['obj']\n * const variables = extractVariableNames('obj.prop()')\n * ```\n *\n * @example\n * ```ts\n * // variables will be ['arr', 'needle']\n * const variables = extractVariableNames('arr.filter(v => v === needle)')\n * ```\n *\n @example\n * ```ts\n * // variables will be ['myVar']\n * const variables = extractVariableNames('new String(myVar)')\n * ```\n *\n * Note that because this expression evaluator uses a restricted definition of \"global\" there are some Javascript\n * globals that will be reported as a unbound expression. This is expected because the evaluator will still fail\n * on these expressions.\n */\nexport function extractVariableNames(expression: string | jsep.Expression) {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n throw `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`;\n }\n\n const context = createAsynchronousContext();\n visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context);\n\n return [...context.variables];\n}\n\nfunction visitExpression(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'UnaryExpression':\n return visitUnaryExpression(expression as jsep.UnaryExpression, context);\n case 'BinaryExpression':\n return visitBinaryExpression(expression as jsep.BinaryExpression, context);\n case 'ConditionalExpression':\n return visitConditionalExpression(expression as jsep.ConditionalExpression, context);\n case 'CallExpression':\n return visitCallExpression(expression as jsep.CallExpression, context);\n case 'ArrowFunctionExpression':\n return visitArrowFunctionExpression(expression as ArrowExpression, context);\n case 'MemberExpression':\n return visitMemberExpression(expression as jsep.MemberExpression, context);\n case 'ArrayExpression':\n return visitArrayExpression(expression as jsep.ArrayExpression, context);\n case 'SequenceExpression':\n return visitSequenceExpression(expression as jsep.SequenceExpression, context);\n case 'NewExpression':\n return visitNewExpression(expression as NewExpression, context);\n case 'Literal':\n return visitLiteral(expression as jsep.Literal, context);\n case 'Identifier':\n return visitIdentifier(expression as jsep.Identifier, context);\n case 'TemplateLiteral':\n return visitTemplateLiteral(expression as TemplateLiteral, context);\n case 'TemplateElement':\n return visitTemplateElement(expression as TemplateElement, context);\n default:\n throw `Expression evaluator does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitUnaryExpression(expression: jsep.UnaryExpression, context: EvaluationContext) {\n return visitExpression(expression.argument, context);\n}\n\nfunction visitBinaryExpression(expression: jsep.BinaryExpression, context: EvaluationContext) {\n const left = visitExpression(expression.left, context);\n const right = visitExpression(expression.right, context);\n return [left, right].filter(Boolean);\n}\n\nfunction visitConditionalExpression(expression: jsep.ConditionalExpression, context: EvaluationContext) {\n const consequent = visitExpression(expression.consequent, context);\n const test = visitExpression(expression.test, context);\n const alternate = visitExpression(expression.alternate, context);\n return [consequent, test, alternate].filter(Boolean);\n}\n\nfunction visitCallExpression(expression: jsep.CallExpression, context: EvaluationContext) {\n const fn = visitExpression(expression.callee, context);\n expression.arguments?.map(handleNullableExpression(context));\n return fn;\n}\n\nfunction visitArrowFunctionExpression(expression: ArrowExpression, context: EvaluationContext) {\n const newContext = { ...context };\n newContext.isLocalExpression = true;\n\n const params = expression.params?.map(handleNullableExpression(newContext)) ?? [];\n const bodyVariables = visitExpression(expression.body, newContext) ?? [];\n\n if (bodyVariables && Array.isArray(bodyVariables)) {\n for (const v of bodyVariables) {\n if (!params.includes(v)) {\n context.variables.add(v);\n }\n }\n }\n}\n\nfunction visitMemberExpression(expression: jsep.MemberExpression, context: EvaluationContext) {\n visitExpression(expression.object, context);\n const newContext = { ...context };\n newContext.isLocalExpression = true;\n visitExpression(expression.property, newContext);\n}\n\nfunction visitArrayExpression(expression: jsep.ArrayExpression, context: EvaluationContext) {\n expression.elements?.map(handleNullableExpression(context));\n}\n\nfunction visitSequenceExpression(expression: jsep.SequenceExpression, context: EvaluationContext) {\n expression.expressions?.map(handleNullableExpression(context));\n}\n\nfunction visitNewExpression(expression: NewExpression, context: EvaluationContext) {\n expression.arguments?.map(handleNullableExpression(context));\n}\n\nfunction visitTemplateLiteral(expression: TemplateLiteral, context: EvaluationContext) {\n expression.expressions?.map(handleNullableExpression(context));\n expression.quasis?.map(handleNullableExpression(context));\n}\n\nfunction visitTemplateElement(expression: TemplateElement, context: EvaluationContext) {}\n\nfunction visitIdentifier(expression: jsep.Identifier, context: EvaluationContext) {\n if (!(expression.name in context.globals)) {\n if (!context.isLocalExpression) {\n context.variables.add(expression.name);\n } else {\n return expression.name;\n }\n }\n}\n\nfunction visitLiteral(expression: jsep.Literal, context: EvaluationContext) {}\n\n// Internals\ninterface EvaluationContext {\n globals: typeof globalsAsync;\n isLocalExpression: boolean;\n variables: Set<string>;\n}\n\nfunction createAsynchronousContext(): EvaluationContext {\n return createContextInternal(globalsAsync);\n}\n\nfunction createContextInternal(globals_: typeof globalsAsync) {\n const context = {\n globals: { ...globals_ },\n isLocalExpression: false,\n variables: new Set<string>(),\n };\n\n return context;\n}\n\nfunction handleNullableExpression(context: EvaluationContext) {\n return function handleNullableExpressionInner(expression: jsep.Expression | null) {\n if (expression === null) {\n return null;\n }\n\n return visitExpression(expression, context);\n };\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Jsep","version","static","op_name","max_unop_len","Math","max","length","unary_ops","precedence","isRightAssociative","max_binop_len","binary_ops","right_associative","add","delete","char","additional_identifier_chars","literal_name","literal_value","literals","getMaxKeyLen","this","expr","charAt","index","code","charCodeAt","constructor","parse","keys","map","k","ch","op_val","String","fromCharCode","has","isIdentifierStart","isDecimalDigit","throwError","message","error","Error","description","runHook","name","node","hooks","env","context","run","searchHook","find","callback","gobbleSpaces","SPACE_CODE","TAB_CODE","LF_CODE","CR_CODE","nodes","gobbleExpressions","type","COMPOUND","body","untilICode","ch_i","SEMCOL_CODE","COMMA_CODE","gobbleExpression","push","gobbleBinaryExpression","gobbleBinaryOp","to_check","substr","tc_len","isIdentifierPart","biop","prec","stack","biop_info","left","right","i","cur_biop","gobbleToken","binaryPrecedence","right_a","comparePrev","prev","pop","BINARY_EXP","operator","PERIOD_CODE","gobbleNumericLiteral","SQUOTE_CODE","DQUOTE_CODE","gobbleStringLiteral","OBRACK_CODE","gobbleArray","argument","UNARY_EXP","prefix","gobbleIdentifier","LITERAL","raw","this_str","THIS_EXP","OPAREN_CODE","gobbleGroup","gobbleTokenProperty","QUMARK_CODE","optional","MEMBER_EXP","computed","object","property","CBRACK_CODE","CALL_EXP","gobbleArguments","CPAREN_CODE","callee","chCode","number","parseFloat","str","startIndex","quote","closed","substring","start","IDENTIFIER","slice","termination","args","separator_count","arg","SEQUENCE_EXP","expressions","ARRAY_EXP","elements","first","arguments","Array","isArray","forEach","assign","plugins","jsep","registered","register","plugin","init","COLON_CODE","Set","stdClassProps","getOwnPropertyNames","filter","includes","undefined","m","ternary","test","consequent","alternate","newTest","ARROW_EXP","updateBinariesToArrows","values","val","params","addBinaryOp","backupIndex","addUnaryOp","callNode","getNumberCodeRanges","numType","getNumberBase","isUnderscoreOrWithinRange","ranges","some","min","gobbleBase10","gobbleDigits","JSON","stringify","parseInt","patternIndex","inCharSet","pattern","flags","RegExp","e","gobbleTemplateLiteral","gobbleMember","quasis","cooked","pushQuasi","tail","tag","quasi","bind","globals","Boolean","Infinity","NaN","Number","BigInt","isFinite","isNaN","decodeURI","encodeURI","encodeURIComponent","__proto__","fromEntries","hasOwn","is","globalsAsync","Promise","evaluate","expression","evaluateAsType","variables","defaultTypePredicate","evaluateAsync","evaluateAsTypeAsync","evaluateAsBoolean","booleanTypePredicate","evaluateAsBooleanAsync","evaluateAsNumber","numberTypePredicate","evaluateAsNumberAsync","typePredicate","createContextInternal","createSynchronousContext","result","visitExpression","createAsynchronousContext","resolve","then","reject","compile","Date","visitUnaryExpression","visitBinaryExpression","visitConditionalExpression","handleNullableExpression","visitCallExpression","p","rest","join","vars","reduce","acc","idx","isValidVariableType","addVariables","thisObj","visitArrowFunctionExpression","objectName","visitExpressionName","ReferenceError","propertyName","TypeError","newObj","validatePropertyName","visitMemberExpression","visitArrayExpression","visitSequenceExpression","visitNewExpression","visitLiteral","visitIdentifier","q","visitTemplateLiteral","visitTemplateElement","globals_","extractVariableNames","isLocalExpression","fn","newContext","bodyVariables","v","jsepArrow","jsepNew","jsepNumbers","jsepRegex","jsepTernary","jsepTemplate"],"sourceRoot":""}
1
+ {"version":3,"file":"openmrs-esm-expression-evaluator.js","mappings":"iFACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eA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AU,CACzC,GAAKxJ,EAAQoO,kBAGX,OAAO1D,EAAW9K,KAFlBI,EAAQ4K,UAAUhN,IAAI8M,EAAW9K,KAIrC,CACF,CAnFakO,CAAgBpD,EAA+B1K,GACxD,IAAK,kBACH,OAkEN,SAA8B0K,EAA6B1K,G,IACzD0K,EACAA,EADsB,QAAtBA,EAAAA,EAAWlF,mBAAXkF,IAAAA,GAAAA,EAAwB7L,IAAIuN,GAAyBpM,IACpC,QAAjB0K,EAAAA,EAAWzB,cAAXyB,IAAAA,GAAAA,EAAmB7L,IAAIuN,GAAyBpM,GAClD,CArEagO,CAAqBtD,EAA+B1K,GAG7D,QACE,KAAM,6DAA6E,OAAhB0K,EAAW9J,KAAK,KAEzF,CAoGA,SAASwL,GAAyBpM,GAChC,OAAO,SAAuC0K,GAC5C,OAAmB,OAAfA,EACK,KAGFgB,GAAgBhB,EAAY1K,EACrC,CACF,C,ODvLAkG,EAAKD,QAAQG,SAASqI,GACtBvI,EAAKD,QAAQG,SAASsI,GACtBxI,EAAKD,QAAQG,SAASuI,GACtBzI,EAAKD,QAAQG,SAASwI,GACtB1I,EAAKD,QAAQG,SAASyI,GACtB3I,EAAKD,QAAQG,SAAS0I,GAItB5I,EAAKuB,YAAY,KAAM,GACvBvB,EAAKuB,YAAY,KAAM,G","sources":["webpack://@openmrs/esm-expression-evaluator/webpack/bootstrap","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/define property getters","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/make namespace object","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/jsep/dist/jsep.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/arrow/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/new/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/numbers/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/regex/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/ternary/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/template/dist/index.js","webpack://@openmrs/esm-expression-evaluator/./src/globals.ts","webpack://@openmrs/esm-expression-evaluator/./src/evaluator.ts","webpack://@openmrs/esm-expression-evaluator/./src/extractor.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @implements {IHooks}\n */\nclass Hooks {\n\t/**\n\t * @callback HookCallback\n\t * @this {*|Jsep} this\n\t * @param {Jsep} env\n\t * @returns: void\n\t */\n\t/**\n\t * Adds the given callback to the list of callbacks for the given hook.\n\t *\n\t * The callback will be invoked when the hook it is registered for is run.\n\t *\n\t * One callback function can be registered to multiple hooks and the same hook multiple times.\n\t *\n\t * @param {string|object} name The name of the hook, or an object of callbacks keyed by name\n\t * @param {HookCallback|boolean} callback The callback function which is given environment variables.\n\t * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)\n\t * @public\n\t */\n\tadd(name, callback, first) {\n\t\tif (typeof arguments[0] != 'string') {\n\t\t\t// Multiple hook callbacks, keyed by name\n\t\t\tfor (let name in arguments[0]) {\n\t\t\t\tthis.add(name, arguments[0][name], arguments[1]);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t(Array.isArray(name) ? name : [name]).forEach(function (name) {\n\t\t\t\tthis[name] = this[name] || [];\n\n\t\t\t\tif (callback) {\n\t\t\t\t\tthis[name][first ? 'unshift' : 'push'](callback);\n\t\t\t\t}\n\t\t\t}, this);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a hook invoking all registered callbacks with the given environment variables.\n\t *\n\t * Callbacks will be invoked synchronously and in the order in which they were registered.\n\t *\n\t * @param {string} name The name of the hook.\n\t * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.\n\t * @public\n\t */\n\trun(name, env) {\n\t\tthis[name] = this[name] || [];\n\t\tthis[name].forEach(function (callback) {\n\t\t\tcallback.call(env && env.context ? env.context : env, env);\n\t\t});\n\t}\n}\n\n/**\n * @implements {IPlugins}\n */\nclass Plugins {\n\tconstructor(jsep) {\n\t\tthis.jsep = jsep;\n\t\tthis.registered = {};\n\t}\n\n\t/**\n\t * @callback PluginSetup\n\t * @this {Jsep} jsep\n\t * @returns: void\n\t */\n\t/**\n\t * Adds the given plugin(s) to the registry\n\t *\n\t * @param {object} plugins\n\t * @param {string} plugins.name The name of the plugin\n\t * @param {PluginSetup} plugins.init The init function\n\t * @public\n\t */\n\tregister(...plugins) {\n\t\tplugins.forEach((plugin) => {\n\t\t\tif (typeof plugin !== 'object' || !plugin.name || !plugin.init) {\n\t\t\t\tthrow new Error('Invalid JSEP plugin format');\n\t\t\t}\n\t\t\tif (this.registered[plugin.name]) {\n\t\t\t\t// already registered. Ignore.\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tplugin.init(this.jsep);\n\t\t\tthis.registered[plugin.name] = plugin;\n\t\t});\n\t}\n}\n\n// JavaScript Expression Parser (JSEP) 1.3.9\n\nclass Jsep {\n\t/**\n\t * @returns {string}\n\t */\n\tstatic get version() {\n\t\t// To be filled in by the template\n\t\treturn '1.3.9';\n\t}\n\n\t/**\n\t * @returns {string}\n\t */\n\tstatic toString() {\n\t\treturn 'JavaScript Expression Parser (JSEP) v' + Jsep.version;\n\t};\n\n\t// ==================== CONFIG ================================\n\t/**\n\t * @method addUnaryOp\n\t * @param {string} op_name The name of the unary op to add\n\t * @returns {Jsep}\n\t */\n\tstatic addUnaryOp(op_name) {\n\t\tJsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);\n\t\tJsep.unary_ops[op_name] = 1;\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method jsep.addBinaryOp\n\t * @param {string} op_name The name of the binary op to add\n\t * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence\n\t * @param {boolean} [isRightAssociative=false] whether operator is right-associative\n\t * @returns {Jsep}\n\t */\n\tstatic addBinaryOp(op_name, precedence, isRightAssociative) {\n\t\tJsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);\n\t\tJsep.binary_ops[op_name] = precedence;\n\t\tif (isRightAssociative) {\n\t\t\tJsep.right_associative.add(op_name);\n\t\t}\n\t\telse {\n\t\t\tJsep.right_associative.delete(op_name);\n\t\t}\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method addIdentifierChar\n\t * @param {string} char The additional character to treat as a valid part of an identifier\n\t * @returns {Jsep}\n\t */\n\tstatic addIdentifierChar(char) {\n\t\tJsep.additional_identifier_chars.add(char);\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method addLiteral\n\t * @param {string} literal_name The name of the literal to add\n\t * @param {*} literal_value The value of the literal\n\t * @returns {Jsep}\n\t */\n\tstatic addLiteral(literal_name, literal_value) {\n\t\tJsep.literals[literal_name] = literal_value;\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeUnaryOp\n\t * @param {string} op_name The name of the unary op to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeUnaryOp(op_name) {\n\t\tdelete Jsep.unary_ops[op_name];\n\t\tif (op_name.length === Jsep.max_unop_len) {\n\t\t\tJsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\n\t\t}\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllUnaryOps\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllUnaryOps() {\n\t\tJsep.unary_ops = {};\n\t\tJsep.max_unop_len = 0;\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeIdentifierChar\n\t * @param {string} char The additional character to stop treating as a valid part of an identifier\n\t * @returns {Jsep}\n\t */\n\tstatic removeIdentifierChar(char) {\n\t\tJsep.additional_identifier_chars.delete(char);\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeBinaryOp\n\t * @param {string} op_name The name of the binary op to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeBinaryOp(op_name) {\n\t\tdelete Jsep.binary_ops[op_name];\n\n\t\tif (op_name.length === Jsep.max_binop_len) {\n\t\t\tJsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n\t\t}\n\t\tJsep.right_associative.delete(op_name);\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllBinaryOps\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllBinaryOps() {\n\t\tJsep.binary_ops = {};\n\t\tJsep.max_binop_len = 0;\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeLiteral\n\t * @param {string} literal_name The name of the literal to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeLiteral(literal_name) {\n\t\tdelete Jsep.literals[literal_name];\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllLiterals\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllLiterals() {\n\t\tJsep.literals = {};\n\n\t\treturn Jsep;\n\t}\n\t// ==================== END CONFIG ============================\n\n\n\t/**\n\t * @returns {string}\n\t */\n\tget char() {\n\t\treturn this.expr.charAt(this.index);\n\t}\n\n\t/**\n\t * @returns {number}\n\t */\n\tget code() {\n\t\treturn this.expr.charCodeAt(this.index);\n\t};\n\n\n\t/**\n\t * @param {string} expr a string with the passed in express\n\t * @returns Jsep\n\t */\n\tconstructor(expr) {\n\t\t// `index` stores the character number we are currently at\n\t\t// All of the gobbles below will modify `index` as we move along\n\t\tthis.expr = expr;\n\t\tthis.index = 0;\n\t}\n\n\t/**\n\t * static top-level parser\n\t * @returns {jsep.Expression}\n\t */\n\tstatic parse(expr) {\n\t\treturn (new Jsep(expr)).parse();\n\t}\n\n\t/**\n\t * Get the longest key length of any object\n\t * @param {object} obj\n\t * @returns {number}\n\t */\n\tstatic getMaxKeyLen(obj) {\n\t\treturn Math.max(0, ...Object.keys(obj).map(k => k.length));\n\t}\n\n\t/**\n\t * `ch` is a character code in the next three functions\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isDecimalDigit(ch) {\n\t\treturn (ch >= 48 && ch <= 57); // 0...9\n\t}\n\n\t/**\n\t * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.\n\t * @param {string} op_val\n\t * @returns {number}\n\t */\n\tstatic binaryPrecedence(op_val) {\n\t\treturn Jsep.binary_ops[op_val] || 0;\n\t}\n\n\t/**\n\t * Looks for start of identifier\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isIdentifierStart(ch) {\n\t\treturn (ch >= 65 && ch <= 90) || // A...Z\n\t\t\t(ch >= 97 && ch <= 122) || // a...z\n\t\t\t(ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)]) || // any non-ASCII that is not an operator\n\t\t\t(Jsep.additional_identifier_chars.has(String.fromCharCode(ch))); // additional characters\n\t}\n\n\t/**\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isIdentifierPart(ch) {\n\t\treturn Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);\n\t}\n\n\t/**\n\t * throw error at index of the expression\n\t * @param {string} message\n\t * @throws\n\t */\n\tthrowError(message) {\n\t\tconst error = new Error(message + ' at character ' + this.index);\n\t\terror.index = this.index;\n\t\terror.description = message;\n\t\tthrow error;\n\t}\n\n\t/**\n\t * Run a given hook\n\t * @param {string} name\n\t * @param {jsep.Expression|false} [node]\n\t * @returns {?jsep.Expression}\n\t */\n\trunHook(name, node) {\n\t\tif (Jsep.hooks[name]) {\n\t\t\tconst env = { context: this, node };\n\t\t\tJsep.hooks.run(name, env);\n\t\t\treturn env.node;\n\t\t}\n\t\treturn node;\n\t}\n\n\t/**\n\t * Runs a given hook until one returns a node\n\t * @param {string} name\n\t * @returns {?jsep.Expression}\n\t */\n\tsearchHook(name) {\n\t\tif (Jsep.hooks[name]) {\n\t\t\tconst env = { context: this };\n\t\t\tJsep.hooks[name].find(function (callback) {\n\t\t\t\tcallback.call(env.context, env);\n\t\t\t\treturn env.node;\n\t\t\t});\n\t\t\treturn env.node;\n\t\t}\n\t}\n\n\t/**\n\t * Push `index` up to the next non-space character\n\t */\n\tgobbleSpaces() {\n\t\tlet ch = this.code;\n\t\t// Whitespace\n\t\twhile (ch === Jsep.SPACE_CODE\n\t\t|| ch === Jsep.TAB_CODE\n\t\t|| ch === Jsep.LF_CODE\n\t\t|| ch === Jsep.CR_CODE) {\n\t\t\tch = this.expr.charCodeAt(++this.index);\n\t\t}\n\t\tthis.runHook('gobble-spaces');\n\t}\n\n\t/**\n\t * Top-level method to parse all expressions and returns compound or single node\n\t * @returns {jsep.Expression}\n\t */\n\tparse() {\n\t\tthis.runHook('before-all');\n\t\tconst nodes = this.gobbleExpressions();\n\n\t\t// If there's only one expression just try returning the expression\n\t\tconst node = nodes.length === 1\n\t\t ? nodes[0]\n\t\t\t: {\n\t\t\t\ttype: Jsep.COMPOUND,\n\t\t\t\tbody: nodes\n\t\t\t};\n\t\treturn this.runHook('after-all', node);\n\t}\n\n\t/**\n\t * top-level parser (but can be reused within as well)\n\t * @param {number} [untilICode]\n\t * @returns {jsep.Expression[]}\n\t */\n\tgobbleExpressions(untilICode) {\n\t\tlet nodes = [], ch_i, node;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tch_i = this.code;\n\n\t\t\t// Expressions can be separated by semicolons, commas, or just inferred without any\n\t\t\t// separators\n\t\t\tif (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {\n\t\t\t\tthis.index++; // ignore separators\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Try to gobble each expression individually\n\t\t\t\tif (node = this.gobbleExpression()) {\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t\t// If we weren't able to find a binary expression and are out of room, then\n\t\t\t\t\t// the expression passed in probably has too much\n\t\t\t\t}\n\t\t\t\telse if (this.index < this.expr.length) {\n\t\t\t\t\tif (ch_i === untilICode) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tthis.throwError('Unexpected \"' + this.char + '\"');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nodes;\n\t}\n\n\t/**\n\t * The main parsing function.\n\t * @returns {?jsep.Expression}\n\t */\n\tgobbleExpression() {\n\t\tconst node = this.searchHook('gobble-expression') || this.gobbleBinaryExpression();\n\t\tthis.gobbleSpaces();\n\n\t\treturn this.runHook('after-expression', node);\n\t}\n\n\t/**\n\t * Search for the operation portion of the string (e.g. `+`, `===`)\n\t * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)\n\t * and move down from 3 to 2 to 1 character until a matching binary operation is found\n\t * then, return that binary operation\n\t * @returns {string|boolean}\n\t */\n\tgobbleBinaryOp() {\n\t\tthis.gobbleSpaces();\n\t\tlet to_check = this.expr.substr(this.index, Jsep.max_binop_len);\n\t\tlet tc_len = to_check.length;\n\n\t\twhile (tc_len > 0) {\n\t\t\t// Don't accept a binary op when it is an identifier.\n\t\t\t// Binary ops that start with a identifier-valid character must be followed\n\t\t\t// by a non identifier-part valid character\n\t\t\tif (Jsep.binary_ops.hasOwnProperty(to_check) && (\n\t\t\t\t!Jsep.isIdentifierStart(this.code) ||\n\t\t\t\t(this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))\n\t\t\t)) {\n\t\t\t\tthis.index += tc_len;\n\t\t\t\treturn to_check;\n\t\t\t}\n\t\t\tto_check = to_check.substr(0, --tc_len);\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This function is responsible for gobbling an individual expression,\n\t * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`\n\t * @returns {?jsep.BinaryExpression}\n\t */\n\tgobbleBinaryExpression() {\n\t\tlet node, biop, prec, stack, biop_info, left, right, i, cur_biop;\n\n\t\t// First, try to get the leftmost thing\n\t\t// Then, check to see if there's a binary operator operating on that leftmost thing\n\t\t// Don't gobbleBinaryOp without a left-hand-side\n\t\tleft = this.gobbleToken();\n\t\tif (!left) {\n\t\t\treturn left;\n\t\t}\n\t\tbiop = this.gobbleBinaryOp();\n\n\t\t// If there wasn't a binary operator, just return the leftmost node\n\t\tif (!biop) {\n\t\t\treturn left;\n\t\t}\n\n\t\t// Otherwise, we need to start a stack to properly place the binary operations in their\n\t\t// precedence structure\n\t\tbiop_info = { value: biop, prec: Jsep.binaryPrecedence(biop), right_a: Jsep.right_associative.has(biop) };\n\n\t\tright = this.gobbleToken();\n\n\t\tif (!right) {\n\t\t\tthis.throwError(\"Expected expression after \" + biop);\n\t\t}\n\n\t\tstack = [left, biop_info, right];\n\n\t\t// Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm)\n\t\twhile ((biop = this.gobbleBinaryOp())) {\n\t\t\tprec = Jsep.binaryPrecedence(biop);\n\n\t\t\tif (prec === 0) {\n\t\t\t\tthis.index -= biop.length;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tbiop_info = { value: biop, prec, right_a: Jsep.right_associative.has(biop) };\n\n\t\t\tcur_biop = biop;\n\n\t\t\t// Reduce: make a binary expression from the three topmost entries.\n\t\t\tconst comparePrev = prev => biop_info.right_a && prev.right_a\n\t\t\t\t? prec > prev.prec\n\t\t\t\t: prec <= prev.prec;\n\t\t\twhile ((stack.length > 2) && comparePrev(stack[stack.length - 2])) {\n\t\t\t\tright = stack.pop();\n\t\t\t\tbiop = stack.pop().value;\n\t\t\t\tleft = stack.pop();\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.BINARY_EXP,\n\t\t\t\t\toperator: biop,\n\t\t\t\t\tleft,\n\t\t\t\t\tright\n\t\t\t\t};\n\t\t\t\tstack.push(node);\n\t\t\t}\n\n\t\t\tnode = this.gobbleToken();\n\n\t\t\tif (!node) {\n\t\t\t\tthis.throwError(\"Expected expression after \" + cur_biop);\n\t\t\t}\n\n\t\t\tstack.push(biop_info, node);\n\t\t}\n\n\t\ti = stack.length - 1;\n\t\tnode = stack[i];\n\n\t\twhile (i > 1) {\n\t\t\tnode = {\n\t\t\t\ttype: Jsep.BINARY_EXP,\n\t\t\t\toperator: stack[i - 1].value,\n\t\t\t\tleft: stack[i - 2],\n\t\t\t\tright: node\n\t\t\t};\n\t\t\ti -= 2;\n\t\t}\n\n\t\treturn node;\n\t}\n\n\t/**\n\t * An individual part of a binary expression:\n\t * e.g. `foo.bar(baz)`, `1`, `\"abc\"`, `(a % 2)` (because it's in parenthesis)\n\t * @returns {boolean|jsep.Expression}\n\t */\n\tgobbleToken() {\n\t\tlet ch, to_check, tc_len, node;\n\n\t\tthis.gobbleSpaces();\n\t\tnode = this.searchHook('gobble-token');\n\t\tif (node) {\n\t\t\treturn this.runHook('after-token', node);\n\t\t}\n\n\t\tch = this.code;\n\n\t\tif (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {\n\t\t\t// Char code 46 is a dot `.` which can start off a numeric literal\n\t\t\treturn this.gobbleNumericLiteral();\n\t\t}\n\n\t\tif (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {\n\t\t\t// Single or double quotes\n\t\t\tnode = this.gobbleStringLiteral();\n\t\t}\n\t\telse if (ch === Jsep.OBRACK_CODE) {\n\t\t\tnode = this.gobbleArray();\n\t\t}\n\t\telse {\n\t\t\tto_check = this.expr.substr(this.index, Jsep.max_unop_len);\n\t\t\ttc_len = to_check.length;\n\n\t\t\twhile (tc_len > 0) {\n\t\t\t\t// Don't accept an unary op when it is an identifier.\n\t\t\t\t// Unary ops that start with a identifier-valid character must be followed\n\t\t\t\t// by a non identifier-part valid character\n\t\t\t\tif (Jsep.unary_ops.hasOwnProperty(to_check) && (\n\t\t\t\t\t!Jsep.isIdentifierStart(this.code) ||\n\t\t\t\t\t(this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))\n\t\t\t\t)) {\n\t\t\t\t\tthis.index += tc_len;\n\t\t\t\t\tconst argument = this.gobbleToken();\n\t\t\t\t\tif (!argument) {\n\t\t\t\t\t\tthis.throwError('missing unaryOp argument');\n\t\t\t\t\t}\n\t\t\t\t\treturn this.runHook('after-token', {\n\t\t\t\t\t\ttype: Jsep.UNARY_EXP,\n\t\t\t\t\t\toperator: to_check,\n\t\t\t\t\t\targument,\n\t\t\t\t\t\tprefix: true\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tto_check = to_check.substr(0, --tc_len);\n\t\t\t}\n\n\t\t\tif (Jsep.isIdentifierStart(ch)) {\n\t\t\t\tnode = this.gobbleIdentifier();\n\t\t\t\tif (Jsep.literals.hasOwnProperty(node.name)) {\n\t\t\t\t\tnode = {\n\t\t\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\t\t\tvalue: Jsep.literals[node.name],\n\t\t\t\t\t\traw: node.name,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse if (node.name === Jsep.this_str) {\n\t\t\t\t\tnode = { type: Jsep.THIS_EXP };\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (ch === Jsep.OPAREN_CODE) { // open parenthesis\n\t\t\t\tnode = this.gobbleGroup();\n\t\t\t}\n\t\t}\n\n\t\tif (!node) {\n\t\t\treturn this.runHook('after-token', false);\n\t\t}\n\n\t\tnode = this.gobbleTokenProperty(node);\n\t\treturn this.runHook('after-token', node);\n\t}\n\n\t/**\n\t * Gobble properties of of identifiers/strings/arrays/groups.\n\t * e.g. `foo`, `bar.baz`, `foo['bar'].baz`\n\t * It also gobbles function calls:\n\t * e.g. `Math.acos(obj.angle)`\n\t * @param {jsep.Expression} node\n\t * @returns {jsep.Expression}\n\t */\n\tgobbleTokenProperty(node) {\n\t\tthis.gobbleSpaces();\n\n\t\tlet ch = this.code;\n\t\twhile (ch === Jsep.PERIOD_CODE || ch === Jsep.OBRACK_CODE || ch === Jsep.OPAREN_CODE || ch === Jsep.QUMARK_CODE) {\n\t\t\tlet optional;\n\t\t\tif (ch === Jsep.QUMARK_CODE) {\n\t\t\t\tif (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toptional = true;\n\t\t\t\tthis.index += 2;\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tch = this.code;\n\t\t\t}\n\t\t\tthis.index++;\n\n\t\t\tif (ch === Jsep.OBRACK_CODE) {\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.MEMBER_EXP,\n\t\t\t\t\tcomputed: true,\n\t\t\t\t\tobject: node,\n\t\t\t\t\tproperty: this.gobbleExpression()\n\t\t\t\t};\n\t\t\t\tif (!node.property) {\n\t\t\t\t\tthis.throwError('Unexpected \"' + this.char + '\"');\n\t\t\t\t}\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tch = this.code;\n\t\t\t\tif (ch !== Jsep.CBRACK_CODE) {\n\t\t\t\t\tthis.throwError('Unclosed [');\n\t\t\t\t}\n\t\t\t\tthis.index++;\n\t\t\t}\n\t\t\telse if (ch === Jsep.OPAREN_CODE) {\n\t\t\t\t// A function call is being made; gobble all the arguments\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.CALL_EXP,\n\t\t\t\t\t'arguments': this.gobbleArguments(Jsep.CPAREN_CODE),\n\t\t\t\t\tcallee: node\n\t\t\t\t};\n\t\t\t}\n\t\t\telse if (ch === Jsep.PERIOD_CODE || optional) {\n\t\t\t\tif (optional) {\n\t\t\t\t\tthis.index--;\n\t\t\t\t}\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.MEMBER_EXP,\n\t\t\t\t\tcomputed: false,\n\t\t\t\t\tobject: node,\n\t\t\t\t\tproperty: this.gobbleIdentifier(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (optional) {\n\t\t\t\tnode.optional = true;\n\t\t\t} // else leave undefined for compatibility with esprima\n\n\t\t\tthis.gobbleSpaces();\n\t\t\tch = this.code;\n\t\t}\n\n\t\treturn node;\n\t}\n\n\t/**\n\t * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to\n\t * keep track of everything in the numeric literal and then calling `parseFloat` on that string\n\t * @returns {jsep.Literal}\n\t */\n\tgobbleNumericLiteral() {\n\t\tlet number = '', ch, chCode;\n\n\t\twhile (Jsep.isDecimalDigit(this.code)) {\n\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t}\n\n\t\tif (this.code === Jsep.PERIOD_CODE) { // can start with a decimal marker\n\t\t\tnumber += this.expr.charAt(this.index++);\n\n\t\t\twhile (Jsep.isDecimalDigit(this.code)) {\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\t\t}\n\n\t\tch = this.char;\n\n\t\tif (ch === 'e' || ch === 'E') { // exponent marker\n\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\tch = this.char;\n\n\t\t\tif (ch === '+' || ch === '-') { // exponent sign\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\n\t\t\twhile (Jsep.isDecimalDigit(this.code)) { // exponent itself\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\n\t\t\tif (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) ) {\n\t\t\t\tthis.throwError('Expected exponent (' + number + this.char + ')');\n\t\t\t}\n\t\t}\n\n\t\tchCode = this.code;\n\n\t\t// Check to make sure this isn't a variable name that start with a number (123abc)\n\t\tif (Jsep.isIdentifierStart(chCode)) {\n\t\t\tthis.throwError('Variable names cannot start with a number (' +\n\t\t\t\tnumber + this.char + ')');\n\t\t}\n\t\telse if (chCode === Jsep.PERIOD_CODE || (number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE)) {\n\t\t\tthis.throwError('Unexpected period');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: Jsep.LITERAL,\n\t\t\tvalue: parseFloat(number),\n\t\t\traw: number\n\t\t};\n\t}\n\n\t/**\n\t * Parses a string literal, staring with single or double quotes with basic support for escape codes\n\t * e.g. `\"hello world\"`, `'this is\\nJSEP'`\n\t * @returns {jsep.Literal}\n\t */\n\tgobbleStringLiteral() {\n\t\tlet str = '';\n\t\tconst startIndex = this.index;\n\t\tconst quote = this.expr.charAt(this.index++);\n\t\tlet closed = false;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tlet ch = this.expr.charAt(this.index++);\n\n\t\t\tif (ch === quote) {\n\t\t\t\tclosed = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (ch === '\\\\') {\n\t\t\t\t// Check for all of the common escape codes\n\t\t\t\tch = this.expr.charAt(this.index++);\n\n\t\t\t\tswitch (ch) {\n\t\t\t\t\tcase 'n': str += '\\n'; break;\n\t\t\t\t\tcase 'r': str += '\\r'; break;\n\t\t\t\t\tcase 't': str += '\\t'; break;\n\t\t\t\t\tcase 'b': str += '\\b'; break;\n\t\t\t\t\tcase 'f': str += '\\f'; break;\n\t\t\t\t\tcase 'v': str += '\\x0B'; break;\n\t\t\t\t\tdefault : str += ch;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tstr += ch;\n\t\t\t}\n\t\t}\n\n\t\tif (!closed) {\n\t\t\tthis.throwError('Unclosed quote after \"' + str + '\"');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: Jsep.LITERAL,\n\t\t\tvalue: str,\n\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t};\n\t}\n\n\t/**\n\t * Gobbles only identifiers\n\t * e.g.: `foo`, `_value`, `$x1`\n\t * Also, this function checks if that identifier is a literal:\n\t * (e.g. `true`, `false`, `null`) or `this`\n\t * @returns {jsep.Identifier}\n\t */\n\tgobbleIdentifier() {\n\t\tlet ch = this.code, start = this.index;\n\n\t\tif (Jsep.isIdentifierStart(ch)) {\n\t\t\tthis.index++;\n\t\t}\n\t\telse {\n\t\t\tthis.throwError('Unexpected ' + this.char);\n\t\t}\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tch = this.code;\n\n\t\t\tif (Jsep.isIdentifierPart(ch)) {\n\t\t\t\tthis.index++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\ttype: Jsep.IDENTIFIER,\n\t\t\tname: this.expr.slice(start, this.index),\n\t\t};\n\t}\n\n\t/**\n\t * Gobbles a list of arguments within the context of a function call\n\t * or array literal. This function also assumes that the opening character\n\t * `(` or `[` has already been gobbled, and gobbles expressions and commas\n\t * until the terminator character `)` or `]` is encountered.\n\t * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`\n\t * @param {number} termination\n\t * @returns {jsep.Expression[]}\n\t */\n\tgobbleArguments(termination) {\n\t\tconst args = [];\n\t\tlet closed = false;\n\t\tlet separator_count = 0;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tthis.gobbleSpaces();\n\t\t\tlet ch_i = this.code;\n\n\t\t\tif (ch_i === termination) { // done parsing\n\t\t\t\tclosed = true;\n\t\t\t\tthis.index++;\n\n\t\t\t\tif (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length){\n\t\t\t\t\tthis.throwError('Unexpected token ' + String.fromCharCode(termination));\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (ch_i === Jsep.COMMA_CODE) { // between expressions\n\t\t\t\tthis.index++;\n\t\t\t\tseparator_count++;\n\n\t\t\t\tif (separator_count !== args.length) { // missing argument\n\t\t\t\t\tif (termination === Jsep.CPAREN_CODE) {\n\t\t\t\t\t\tthis.throwError('Unexpected token ,');\n\t\t\t\t\t}\n\t\t\t\t\telse if (termination === Jsep.CBRACK_CODE) {\n\t\t\t\t\t\tfor (let arg = args.length; arg < separator_count; arg++) {\n\t\t\t\t\t\t\targs.push(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (args.length !== separator_count && separator_count !== 0) {\n\t\t\t\t// NOTE: `&& separator_count !== 0` allows for either all commas, or all spaces as arguments\n\t\t\t\tthis.throwError('Expected comma');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst node = this.gobbleExpression();\n\n\t\t\t\tif (!node || node.type === Jsep.COMPOUND) {\n\t\t\t\t\tthis.throwError('Expected comma');\n\t\t\t\t}\n\n\t\t\t\targs.push(node);\n\t\t\t}\n\t\t}\n\n\t\tif (!closed) {\n\t\t\tthis.throwError('Expected ' + String.fromCharCode(termination));\n\t\t}\n\n\t\treturn args;\n\t}\n\n\t/**\n\t * Responsible for parsing a group of things within parentheses `()`\n\t * that have no identifier in front (so not a function call)\n\t * This function assumes that it needs to gobble the opening parenthesis\n\t * and then tries to gobble everything within that parenthesis, assuming\n\t * that the next thing it should see is the close parenthesis. If not,\n\t * then the expression probably doesn't have a `)`\n\t * @returns {boolean|jsep.Expression}\n\t */\n\tgobbleGroup() {\n\t\tthis.index++;\n\t\tlet nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);\n\t\tif (this.code === Jsep.CPAREN_CODE) {\n\t\t\tthis.index++;\n\t\t\tif (nodes.length === 1) {\n\t\t\t\treturn nodes[0];\n\t\t\t}\n\t\t\telse if (!nodes.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn {\n\t\t\t\t\ttype: Jsep.SEQUENCE_EXP,\n\t\t\t\t\texpressions: nodes,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.throwError('Unclosed (');\n\t\t}\n\t}\n\n\t/**\n\t * Responsible for parsing Array literals `[1, 2, 3]`\n\t * This function assumes that it needs to gobble the opening bracket\n\t * and then tries to gobble the expressions as arguments.\n\t * @returns {jsep.ArrayExpression}\n\t */\n\tgobbleArray() {\n\t\tthis.index++;\n\n\t\treturn {\n\t\t\ttype: Jsep.ARRAY_EXP,\n\t\t\telements: this.gobbleArguments(Jsep.CBRACK_CODE)\n\t\t};\n\t}\n}\n\n// Static fields:\nconst hooks = new Hooks();\nObject.assign(Jsep, {\n\thooks,\n\tplugins: new Plugins(Jsep),\n\n\t// Node Types\n\t// ----------\n\t// This is the full set of types that any JSEP node can be.\n\t// Store them here to save space when minified\n\tCOMPOUND: 'Compound',\n\tSEQUENCE_EXP: 'SequenceExpression',\n\tIDENTIFIER: 'Identifier',\n\tMEMBER_EXP: 'MemberExpression',\n\tLITERAL: 'Literal',\n\tTHIS_EXP: 'ThisExpression',\n\tCALL_EXP: 'CallExpression',\n\tUNARY_EXP: 'UnaryExpression',\n\tBINARY_EXP: 'BinaryExpression',\n\tARRAY_EXP: 'ArrayExpression',\n\n\tTAB_CODE: 9,\n\tLF_CODE: 10,\n\tCR_CODE: 13,\n\tSPACE_CODE: 32,\n\tPERIOD_CODE: 46, // '.'\n\tCOMMA_CODE: 44, // ','\n\tSQUOTE_CODE: 39, // single quote\n\tDQUOTE_CODE: 34, // double quotes\n\tOPAREN_CODE: 40, // (\n\tCPAREN_CODE: 41, // )\n\tOBRACK_CODE: 91, // [\n\tCBRACK_CODE: 93, // ]\n\tQUMARK_CODE: 63, // ?\n\tSEMCOL_CODE: 59, // ;\n\tCOLON_CODE: 58, // :\n\n\n\t// Operations\n\t// ----------\n\t// Use a quickly-accessible map to store all of the unary operators\n\t// Values are set to `1` (it really doesn't matter)\n\tunary_ops: {\n\t\t'-': 1,\n\t\t'!': 1,\n\t\t'~': 1,\n\t\t'+': 1\n\t},\n\n\t// Also use a map for the binary operations but set their values to their\n\t// binary precedence for quick reference (higher number = higher precedence)\n\t// see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)\n\tbinary_ops: {\n\t\t'||': 1, '&&': 2, '|': 3, '^': 4, '&': 5,\n\t\t'==': 6, '!=': 6, '===': 6, '!==': 6,\n\t\t'<': 7, '>': 7, '<=': 7, '>=': 7,\n\t\t'<<': 8, '>>': 8, '>>>': 8,\n\t\t'+': 9, '-': 9,\n\t\t'*': 10, '/': 10, '%': 10\n\t},\n\n\t// sets specific binary_ops as right-associative\n\tright_associative: new Set(),\n\n\t// Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)\n\tadditional_identifier_chars: new Set(['$', '_']),\n\n\t// Literals\n\t// ----------\n\t// Store the values to return for the various literals we may encounter\n\tliterals: {\n\t\t'true': true,\n\t\t'false': false,\n\t\t'null': null\n\t},\n\n\t// Except for `this`, which is special. This could be changed to something like `'self'` as well\n\tthis_str: 'this',\n});\nJsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\nJsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n\n// Backward Compatibility:\nconst jsep = expr => (new Jsep(expr)).parse();\nconst stdClassProps = Object.getOwnPropertyNames(class Test{});\nObject.getOwnPropertyNames(Jsep)\n\t.filter(prop => !stdClassProps.includes(prop) && jsep[prop] === undefined)\n\t.forEach((m) => {\n\t\tjsep[m] = Jsep[m];\n\t});\njsep.Jsep = Jsep; // allows for const { Jsep } = require('jsep');\n\nconst CONDITIONAL_EXP = 'ConditionalExpression';\n\nvar ternary = {\n\tname: 'ternary',\n\n\tinit(jsep) {\n\t\t// Ternary expression: test ? consequent : alternate\n\t\tjsep.hooks.add('after-expression', function gobbleTernary(env) {\n\t\t\tif (env.node && this.code === jsep.QUMARK_CODE) {\n\t\t\t\tthis.index++;\n\t\t\t\tconst test = env.node;\n\t\t\t\tconst consequent = this.gobbleExpression();\n\n\t\t\t\tif (!consequent) {\n\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t}\n\n\t\t\t\tthis.gobbleSpaces();\n\n\t\t\t\tif (this.code === jsep.COLON_CODE) {\n\t\t\t\t\tthis.index++;\n\t\t\t\t\tconst alternate = this.gobbleExpression();\n\n\t\t\t\t\tif (!alternate) {\n\t\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t\t}\n\t\t\t\t\tenv.node = {\n\t\t\t\t\t\ttype: CONDITIONAL_EXP,\n\t\t\t\t\t\ttest,\n\t\t\t\t\t\tconsequent,\n\t\t\t\t\t\talternate,\n\t\t\t\t\t};\n\n\t\t\t\t\t// check for operators of higher priority than ternary (i.e. assignment)\n\t\t\t\t\t// jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n\t\t\t\t\tif (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n\t\t\t\t\t\tlet newTest = test;\n\t\t\t\t\t\twhile (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n\t\t\t\t\t\t\tnewTest = newTest.right;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node.test = newTest.right;\n\t\t\t\t\t\tnewTest.right = env.node;\n\t\t\t\t\t\tenv.node = test;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.throwError('Expected :');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n};\n\n// Add default plugins:\n\njsep.plugins.register(ternary);\n\nexport { Jsep, jsep as default };\n","const ARROW_EXP = 'ArrowFunctionExpression';\n\nvar index = {\n\tname: 'arrow',\n\n\tinit(jsep) {\n\t\t// arrow-function expressions: () => x, v => v, (a, b) => v\n\t\tjsep.addBinaryOp('=>', 0.1, true);\n\n\t\t// this hook searches for the special case () => ...\n\t\t// which would normally throw an error because of the invalid LHS to the bin op\n\t\tjsep.hooks.add('gobble-expression', function gobbleEmptyArrowArg(env) {\n\t\t\tthis.gobbleSpaces();\n\t\t\tif (this.code === jsep.OPAREN_CODE) {\n\t\t\t\tconst backupIndex = this.index;\n\t\t\t\tthis.index++;\n\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tif (this.code === jsep.CPAREN_CODE) {\n\t\t\t\t\tthis.index++;\n\n\t\t\t\t\tconst biop = this.gobbleBinaryOp();\n\t\t\t\t\tif (biop === '=>') {\n\t\t\t\t\t\t// () => ...\n\t\t\t\t\t\tconst body = this.gobbleBinaryExpression();\n\t\t\t\t\t\tif (!body) {\n\t\t\t\t\t\t\tthis.throwError(\"Expected expression after \" + biop);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node = {\n\t\t\t\t\t\t\ttype: ARROW_EXP,\n\t\t\t\t\t\t\tparams: null,\n\t\t\t\t\t\t\tbody,\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.index = backupIndex;\n\t\t\t}\n\t\t});\n\n\t\tjsep.hooks.add('after-expression', function fixBinaryArrow(env) {\n\t\t\tupdateBinariesToArrows(env.node);\n\t\t});\n\n\t\tfunction updateBinariesToArrows(node) {\n\t\t\tif (node) {\n\t\t\t\t// Traverse full tree, converting any sub-object nodes as needed\n\t\t\t\tObject.values(node).forEach((val) => {\n\t\t\t\t\tif (val && typeof val === 'object') {\n\t\t\t\t\t\tupdateBinariesToArrows(val);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (node.operator === '=>') {\n\t\t\t\t\tnode.type = ARROW_EXP;\n\t\t\t\t\tnode.params = node.left ? [node.left] : null;\n\t\t\t\t\tnode.body = node.right;\n\t\t\t\t\tif (node.params && node.params[0].type === jsep.SEQUENCE_EXP) {\n\t\t\t\t\t\tnode.params = node.params[0].expressions;\n\t\t\t\t\t}\n\t\t\t\t\tdelete node.left;\n\t\t\t\t\tdelete node.right;\n\t\t\t\t\tdelete node.operator;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport { index as default };\n","var index = {\n\tname: 'new',\n\n\tinit(jsep) {\n\t\tjsep.addUnaryOp('new');\n\n\t\tjsep.hooks.add('after-token', function gobbleNew(env) {\n\t\t\tconst node = env.node;\n\t\t\tif (node && node.operator === 'new') {\n\t\t\t\tif (!node.argument || ![jsep.CALL_EXP, jsep.MEMBER_EXP].includes(node.argument.type)) {\n\t\t\t\t\tthis.throwError('Expected new function()');\n\t\t\t\t}\n\t\t\t\tenv.node = node.argument;\n\n\t\t\t\t// Change CALL_EXP to NewExpression (could be a nested member, even within a call expr)\n\t\t\t\tlet callNode = env.node;\n\t\t\t\twhile (callNode.type === jsep.MEMBER_EXP || (\n\t\t\t\t\tcallNode.type === jsep.CALL_EXP && callNode.callee.type === jsep.MEMBER_EXP)) {\n\t\t\t\t\tcallNode = callNode.type === jsep.MEMBER_EXP\n\t\t\t\t\t\t? callNode.object\n\t\t\t\t\t\t: callNode.callee.object;\n\t\t\t\t}\n\t\t\t\tcallNode.type = 'NewExpression';\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport { index as default };\n","const NUM_0_CODE = 48;\nconst UNDERSCORE = 95;\n\nvar index = {\n\tname: 'numbers',\n\n\tinit(Jsep) {\n\t\tJsep.hooks.add('gobble-token', function gobbleNumber(env) {\n\t\t\tif (this.code === NUM_0_CODE) {\n\t\t\t\tconst startIndex = this.index;\n\t\t\t\tconst numType = this.expr.charAt(this.index + 1);\n\t\t\t\tconst ranges = getNumberCodeRanges.call(this, numType);\n\t\t\t\tif (!ranges) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet number = '';\n\t\t\t\twhile (isUnderscoreOrWithinRange(this.code, ranges)) {\n\t\t\t\t\tif (this.code === UNDERSCORE) {\n\t\t\t\t\t\tthis.index ++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// confirm valid syntax after building number string within ranges\n\t\t\t\tif (Jsep.isIdentifierPart(this.code)) {\n\t\t\t\t\tif (Jsep.isDecimalDigit(this.code) && Jsep.isDecimalDigit(numType.charCodeAt(0))) {\n\t\t\t\t\t\t// abort octal processing and reset to ignore the leading 0\n\t\t\t\t\t\tthis.index = startIndex + 1;\n\t\t\t\t\t\tgobbleBase10.call(this, env);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.throwError('unexpected char within number');\n\t\t\t\t}\n\n\t\t\t\tenv.node = {\n\t\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\t\tvalue: parseInt(number, getNumberBase(numType)),\n\t\t\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t\t\t};\n\t\t\t}\n\t\t\telse if (Jsep.isDecimalDigit(this.code) || this.code === Jsep.PERIOD_CODE) {\n\t\t\t\tgobbleBase10.call(this, env);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Gets the range of allowable number codes (decimal) and updates index\n\t\t * @param {string} numType\n\t\t * @returns {number[][]|null}\n\t\t */\n\t\tfunction getNumberCodeRanges(numType) {\n\t\t\tif (numType === 'x' || numType === 'X') {\n\t\t\t\tthis.index += 2;\n\t\t\t\treturn [\n\t\t\t\t\t[48, 57], // 0-9\n\t\t\t\t\t[65, 70], // A-F\n\t\t\t\t\t[97, 102], // a-f\n\t\t\t\t];\n\t\t\t}\n\t\t\telse if (numType === 'b' || numType === 'B') {\n\t\t\t\tthis.index += 2;\n\t\t\t\treturn [[48, 49]]; // 0-1\n\t\t\t}\n\t\t\telse if (numType === 'o' || numType === 'O' ||\n\t\t\t\t(numType >= '0' && numType <= '7')) { // 0-7 allows non-standard 0644 = 420\n\t\t\t\tthis.index += numType <= '7' ? 1 : 2;\n\t\t\t\treturn [[48, 55]]; // 0-7\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Supports Hex, Octal and Binary only\n\t\t * @param {string} numType\n\t\t * @returns {16|8|2}\n\t\t */\n\t\tfunction getNumberBase(numType) {\n\t\t\tif (numType === 'x' || numType === 'X') {\n\t\t\t\treturn 16;\n\t\t\t}\n\t\t\telse if (numType === 'b' || numType === 'B') {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// default (includes non-stand 044)\n\t\t\treturn 8;\n\t\t}\n\n\t\t/**\n\t\t * Verifies number code is within given ranges\n\t\t * @param {number} code\n\t\t * @param {number[][]} ranges\n\t\t */\n\t\tfunction isUnderscoreOrWithinRange(code, ranges) {\n\t\t\treturn code === UNDERSCORE ||\n\t\t\t\tranges.some(([min, max]) => code >= min && code <= max);\n\t\t}\n\n\t\t/**\n\t\t * Same as core gobbleNumericLiteral, but allows for _ char\n\t\t * @param {{ context?: typeof Jsep, node?: Expression }} env\n\t\t */\n\t\tfunction gobbleBase10(env) {\n\t\t\tconst startIndex = this.index;\n\t\t\tlet number = '';\n\n\t\t\tconst gobbleDigits = () => {\n\t\t\t\twhile (Jsep.isDecimalDigit(this.code) || this.code === UNDERSCORE) {\n\t\t\t\t\tif (this.code === UNDERSCORE) {\n\t\t\t\t\t\tthis.index++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tgobbleDigits();\n\t\t\tif (this.code === Jsep.PERIOD_CODE) { // can start with a decimal marker\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\n\t\t\t\tgobbleDigits();\n\t\t\t}\n\n\t\t\tlet ch = this.char;\n\t\t\tif (ch === 'e' || ch === 'E') { // exponent marker\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\tch = this.char;\n\n\t\t\t\tif (ch === '+' || ch === '-') { // exponent sign\n\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t}\n\n\t\t\t\tgobbleDigits(); // exponent itself\n\n\t\t\t\tif (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) ) {\n\t\t\t\t\tthis.throwError('Expected exponent (' + number + this.char + ')');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst chCode = this.code;\n\n\t\t\t// Check to make sure this isn't a variable name that start with a number (123abc)\n\t\t\tif (Jsep.isIdentifierStart(chCode)) {\n\t\t\t\tthis.throwError('Variable names cannot start with a number (' +\n\t\t\t\t\tnumber + this.char + ')');\n\t\t\t}\n\t\t\telse if (chCode === Jsep.PERIOD_CODE) {\n\t\t\t\tif (number.length > 1) {\n\t\t\t\t\tthis.throwError(`Unexpected period ${JSON.stringify({ chCode, number }, null, 2)}`);\n\t\t\t\t}\n\t\t\t\t// leave other error-handling to jsep core. Also allows spread operator.\n\t\t\t\tthis.index = startIndex;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tenv.node = {\n\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\tvalue: parseFloat(number),\n\t\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t\t};\n\t\t}\n\t}\n};\n\nexport { index as default };\n","const FSLASH_CODE = 47; // '/'\nconst BSLASH_CODE = 92; // '\\\\'\n\nvar index = {\n\tname: 'regex',\n\n\tinit(jsep) {\n\t\t// Regex literal: /abc123/ig\n\t\tjsep.hooks.add('gobble-token', function gobbleRegexLiteral(env) {\n\t\t\tif (this.code === FSLASH_CODE) {\n\t\t\t\tconst patternIndex = ++this.index;\n\n\t\t\t\tlet inCharSet = false;\n\t\t\t\twhile (this.index < this.expr.length) {\n\t\t\t\t\tif (this.code === FSLASH_CODE && !inCharSet) {\n\t\t\t\t\t\tconst pattern = this.expr.slice(patternIndex, this.index);\n\n\t\t\t\t\t\tlet flags = '';\n\t\t\t\t\t\twhile (++this.index < this.expr.length) {\n\t\t\t\t\t\t\tconst code = this.code;\n\t\t\t\t\t\t\tif ((code >= 97 && code <= 122) // a...z\n\t\t\t\t\t\t\t\t|| (code >= 65 && code <= 90) // A...Z\n\t\t\t\t\t\t\t\t|| (code >= 48 && code <= 57)) { // 0-9\n\t\t\t\t\t\t\t\tflags += this.char;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet value;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvalue = new RegExp(pattern, flags);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\tthis.throwError(e.message);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tenv.node = {\n\t\t\t\t\t\t\ttype: jsep.LITERAL,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\traw: this.expr.slice(patternIndex - 1, this.index),\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// allow . [] and () after regex: /regex/.test(a)\n\t\t\t\t\t\tenv.node = this.gobbleTokenProperty(env.node);\n\t\t\t\t\t\treturn env.node;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.code === jsep.OBRACK_CODE) {\n\t\t\t\t\t\tinCharSet = true;\n\t\t\t\t\t}\n\t\t\t\t\telse if (inCharSet && this.code === jsep.CBRACK_CODE) {\n\t\t\t\t\t\tinCharSet = false;\n\t\t\t\t\t}\n\t\t\t\t\tthis.index += this.code === BSLASH_CODE ? 2 : 1;\n\t\t\t\t}\n\t\t\t\tthis.throwError('Unclosed Regex');\n\t\t\t}\n\t\t});\n\t},\n};\n\nexport { index as default };\n","const CONDITIONAL_EXP = 'ConditionalExpression';\n\nvar index = {\n\tname: 'ternary',\n\n\tinit(jsep) {\n\t\t// Ternary expression: test ? consequent : alternate\n\t\tjsep.hooks.add('after-expression', function gobbleTernary(env) {\n\t\t\tif (env.node && this.code === jsep.QUMARK_CODE) {\n\t\t\t\tthis.index++;\n\t\t\t\tconst test = env.node;\n\t\t\t\tconst consequent = this.gobbleExpression();\n\n\t\t\t\tif (!consequent) {\n\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t}\n\n\t\t\t\tthis.gobbleSpaces();\n\n\t\t\t\tif (this.code === jsep.COLON_CODE) {\n\t\t\t\t\tthis.index++;\n\t\t\t\t\tconst alternate = this.gobbleExpression();\n\n\t\t\t\t\tif (!alternate) {\n\t\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t\t}\n\t\t\t\t\tenv.node = {\n\t\t\t\t\t\ttype: CONDITIONAL_EXP,\n\t\t\t\t\t\ttest,\n\t\t\t\t\t\tconsequent,\n\t\t\t\t\t\talternate,\n\t\t\t\t\t};\n\n\t\t\t\t\t// check for operators of higher priority than ternary (i.e. assignment)\n\t\t\t\t\t// jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n\t\t\t\t\tif (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n\t\t\t\t\t\tlet newTest = test;\n\t\t\t\t\t\twhile (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n\t\t\t\t\t\t\tnewTest = newTest.right;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node.test = newTest.right;\n\t\t\t\t\t\tnewTest.right = env.node;\n\t\t\t\t\t\tenv.node = test;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.throwError('Expected :');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n};\n\nexport { index as default };\n","const BTICK_CODE = 96; // `\nconst CCURLY_CODE = 125; // }\nconst TAGGED_TEMPLATE_EXPRESSION = 'TaggedTemplateExpression';\nconst TEMPLATE_LITERAL = 'TemplateLiteral';\nconst TEMPLATE_ELEMENT = 'TemplateElement';\n\nvar index = {\n\tname: 'jsepTemplateLiteral',\n\n\tinit(jsep) {\n\t\tfunction gobbleTemplateLiteral(env, gobbleMember = true) {\n\t\t\tif (this.code === BTICK_CODE) {\n\t\t\t\tconst node = {\n\t\t\t\t\ttype: TEMPLATE_LITERAL,\n\t\t\t\t\tquasis: [],\n\t\t\t\t\texpressions: [],\n\t\t\t\t};\n\t\t\t\tlet cooked = '';\n\t\t\t\tlet raw = '';\n\t\t\t\tlet closed = false;\n\t\t\t\tconst length = this.expr.length;\n\t\t\t\tconst pushQuasi = () => node.quasis.push({\n\t\t\t\t\ttype: TEMPLATE_ELEMENT,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\traw,\n\t\t\t\t\t\tcooked,\n\t\t\t\t\t},\n\t\t\t\t\ttail: closed,\n\t\t\t\t});\n\n\t\t\t\twhile (this.index < length) {\n\t\t\t\t\tlet ch = this.expr.charAt(++this.index);\n\n\t\t\t\t\tif (ch === '`') {\n\t\t\t\t\t\tthis.index += 1;\n\t\t\t\t\t\tclosed = true;\n\t\t\t\t\t\tpushQuasi();\n\n\t\t\t\t\t\tenv.node = node;\n\n\t\t\t\t\t\tif (gobbleMember) {\n\t\t\t\t\t\t // allow . [] and () after template: `foo`.length\n\t\t\t\t\t\t env.node = this.gobbleTokenProperty(env.node);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn env.node;\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch === '$' && this.expr.charAt(this.index + 1) === '{') {\n\t\t\t\t\t\tthis.index += 2;\n\t\t\t\t\t\tpushQuasi();\n\t\t\t\t\t\traw = '';\n\t\t\t\t\t\tcooked = '';\n\t\t\t\t\t\tnode.expressions.push(...this.gobbleExpressions(CCURLY_CODE));\n\t\t\t\t\t\tif (this.code !== CCURLY_CODE) {\n\t\t\t\t\t\t\tthis.throwError('unclosed ${');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch === '\\\\') {\n\t\t\t\t\t\t// Check for all of the common escape codes\n\t\t\t\t\t\traw += ch;\n\t\t\t\t\t\tch = this.expr.charAt(++this.index);\n\t\t\t\t\t\traw += ch;\n\n\t\t\t\t\t\tswitch (ch) {\n\t\t\t\t\t\t\tcase 'n': cooked += '\\n'; break;\n\t\t\t\t\t\t\tcase 'r': cooked += '\\r'; break;\n\t\t\t\t\t\t\tcase 't': cooked += '\\t'; break;\n\t\t\t\t\t\t\tcase 'b': cooked += '\\b'; break;\n\t\t\t\t\t\t\tcase 'f': cooked += '\\f'; break;\n\t\t\t\t\t\t\tcase 'v': cooked += '\\x0B'; break;\n\t\t\t\t\t\t\tdefault : cooked += ch;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcooked += ch;\n\t\t\t\t\t\traw += ch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.throwError('Unclosed `');\n\t\t\t}\n\t\t}\n\n\t\tjsep.hooks.add('gobble-token', gobbleTemplateLiteral);\n\n\t\tjsep.hooks.add('after-token', function gobbleTaggedTemplateIdentifier(env) {\n\t\t\tif ((env.node.type === jsep.IDENTIFIER || env.node.type === jsep.MEMBER_EXP) && this.code === BTICK_CODE) {\n\t\t\t\tenv.node = {\n\t\t\t\t\ttype: TAGGED_TEMPLATE_EXPRESSION,\n\t\t\t\t\ttag: env.node,\n\t\t\t\t\tquasi: gobbleTemplateLiteral.bind(this)(env, false),\n\t\t\t\t};\n\n\t\t\t\t// allow . [] and () after tagged template: bar`foo`.length\n\t\t\t\tenv.node = this.gobbleTokenProperty(env.node);\n\n\t\t\t\treturn env.node;\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport { index as default };\n","export const globals = {\n Array,\n Boolean,\n Symbol,\n Infinity,\n NaN,\n Math,\n Number,\n BigInt,\n String,\n RegExp,\n JSON,\n isFinite,\n isNaN,\n parseFloat,\n parseInt,\n decodeURI,\n encodeURI,\n encodeURIComponent,\n Object: {\n __proto__: undefined,\n assign: Object.assign.bind(null),\n fromEntries: Object.fromEntries.bind(null),\n hasOwn: Object.hasOwn.bind(null),\n keys: Object.keys.bind(null),\n is: Object.is.bind(null),\n values: Object.values.bind(null),\n },\n};\n\nexport const globalsAsync = {\n ...globals,\n Promise,\n};\n","/** @category Utility */\nimport jsep, { type Expression, type MemberExpression } from 'jsep';\nimport jsepArrow, { type ArrowExpression } from '@jsep-plugin/arrow';\nimport jsepNew, { type NewExpression } from '@jsep-plugin/new';\nimport jsepNumbers from '@jsep-plugin/numbers';\nimport jsepRegex from '@jsep-plugin/regex';\nimport jsepTernary from '@jsep-plugin/ternary';\nimport jsepTemplate, { type TemplateElement, type TemplateLiteral } from '@jsep-plugin/template';\nimport { globals, globalsAsync } from './globals';\n\njsep.plugins.register(jsepArrow);\njsep.plugins.register(jsepNew);\njsep.plugins.register(jsepNumbers);\njsep.plugins.register(jsepRegex);\njsep.plugins.register(jsepTernary);\njsep.plugins.register(jsepTemplate);\n// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence\n// for the order defined here\n// 7 is jsep's internal for \"relational operators\"\njsep.addBinaryOp('in', 7);\njsep.addBinaryOp('??', 1);\n\nexport { jsep };\n\n/** An object containing the variable to use when evaluating this expression */\nexport type VariablesMap = {\n [key: string]: string | number | boolean | Function | RegExp | object | null | VariablesMap | Array<VariablesMap>;\n};\n\n/** The valid return types for `evaluate()` and `evaluateAsync()` */\nexport type DefaultEvaluateReturnType = string | number | boolean | Date | null | undefined;\n\n/**\n * `evaluate()` implements a relatively safe version of `eval()` that is limited to evaluating synchronous\n * Javascript expressions. This allows us to safely add features that depend on user-supplied code without\n * polluting the global namespace or needing to support `eval()` and the like.\n *\n * By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined.\n * Other values will result in an error.\n *\n * @example\n * ```ts\n * // shouldDisplayOptionalData will be false\n * const shouldDisplayOptionalData = evaluate('!isEmpty(array)', {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * })\n * ```\n *\n * Since this only implements the expression lanaguage part of Javascript, there is no support for assigning\n * values, creating functions, or creating objects, so the following will throw an error:\n *\n * @example\n * ```ts\n * evaluate('var a = 1; a');\n * ```\n *\n * In addition to string expressions, `evaluate()` can use an existing `jsep.Expression`, such as that returned\n * from the `compile()` function. The goal here is to support cases where the same expression will be evaluated\n * multiple times, possibly with different variables, e.g.,\n *\n * @example\n * ```ts\n * const expr = compile('isEmpty(array)');\n *\n * // then we use it like\n * evaluate(expr, {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n *\n * evaluate(expr, {\n * array: ['value'],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n * ```\n *\n * This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.\n *\n * The `variables` parameter should be used to supply any variables or functions that should be in-scope for\n * the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but\n * any non-global values will need to be passed as a variable. Note that expressions do not have any access to\n * the variables in the scope in which they were defined unless they are supplied here.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluate(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, defaultTypePredicate);\n}\n\n/**\n * `evaluateAsync()` implements a relatively safe version of `eval()` that can evaluate Javascript expressions\n * that use Promises. This allows us to safely add features that depend on user-supplied code without\n * polluting the global namespace or needing to support `eval()` and the like.\n *\n * By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined.\n * Other values will result in an error.\n *\n * @example\n * ```ts\n * // shouldDisplayOptionalData will be false\n * const shouldDisplayOptionalData = await evaluateAsync('Promise.resolve(!isEmpty(array))', {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * })\n * ```\n *\n * Since this only implements the expression lanaguage part of Javascript, there is no support for assigning\n * values, creating functions, or creating objects, so the following will throw an error:\n *\n * @example\n * ```ts\n * evaluateAsync('var a = 1; a');\n * ```\n *\n * In addition to string expressions, `evaluate()` can use an existing `jsep.Expression`, such as that returned\n * from the `compile()` function. The goal here is to support cases where the same expression will be evaluated\n * multiple times, possibly with different variables, e.g.,\n *\n * @example\n * ```ts\n * const expr = compile('Promise.resolve(isEmpty(array))');\n *\n * // then we use it like\n * evaluateAsync(expr, {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n *\n * evaluateAsync(expr, {\n * array: ['value'],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n * ```\n *\n * This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.\n *\n * The `variables` parameter should be used to supply any variables or functions that should be in-scope for\n * the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but\n * any non-global values will need to be passed as a variable. Note that expressions do not have any access to\n * the variables in the scope in which they were defined unless they are supplied here.\n *\n * **Note:** `evaluateAsync()` currently only supports Promise-based asynchronous flows and does not support\n * the `await` keyword.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport async function evaluateAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, defaultTypePredicate);\n}\n\n/**\n * `evaluateAsBoolean()` is a variant of {@link evaluate()} which only supports boolean results. Useful\n * if valid expression must return boolean values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsBoolean(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, booleanTypePredicate);\n}\n\n/**\n * `evaluateAsBooleanAsync()` is a variant of {@link evaluateAsync()} which only supports boolean results. Useful\n * if valid expression must return boolean values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsBooleanAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, booleanTypePredicate);\n}\n\n/**\n * `evaluateAsNumber()` is a variant of {@link evaluate()} which only supports number results. Useful\n * if valid expression must return numeric values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsNumber(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, numberTypePredicate);\n}\n\n/**\n * `evaluateAsNumberAsync()` is a variant of {@link evaluateAsync()} which only supports number results. Useful\n * if valid expression must return numeric values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsNumberAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, numberTypePredicate);\n}\n\n/**\n * `evaluateAsType()` is a type-safe version of {@link evaluate()} which returns a result if the result\n * passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on\n * context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard\n * to ensure that only number or boolean results are returned.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @param typePredicate A [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * which asserts that the result value matches one of the expected results.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsType<T>(\n expression: string | jsep.Expression,\n variables: VariablesMap = {},\n typePredicate: (result: unknown) => result is T,\n): T {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n throw `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`;\n }\n\n if (typeof variables === 'undefined' || variables === null) {\n variables = {};\n }\n\n const context = createSynchronousContext(variables);\n const result = visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context);\n\n if (typePredicate(result)) {\n return result;\n } else {\n throw {\n type: 'Invalid result',\n message:\n typeof expression === 'string'\n ? `The expression ${expression} did not produce a valid result`\n : 'The expression did not produce a valid result',\n };\n }\n}\n\n/**\n * `evaluateAsTypeAsync()` is a type-safe version of {@link evaluateAsync()} which returns a result if the result\n * passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on\n * context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard\n * to ensure that only number or boolean results are returned.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @param typePredicate A [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * which asserts that the result value matches one of the expected results.\n * @returns The result of evaluating the expression\n */\nexport async function evaluateAsTypeAsync<T>(\n expression: string | jsep.Expression,\n variables: VariablesMap = {},\n typePredicate: (result: unknown) => result is T,\n): Promise<T> {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n return Promise.reject(\n `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`,\n );\n }\n\n if (typeof variables === 'undefined' || variables === null) {\n variables = {};\n }\n\n const context = createAsynchronousContext(variables);\n return Promise.resolve(visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context)).then(\n (result) => {\n if (typePredicate(result)) {\n return result;\n } else {\n throw {\n type: 'Invalid result',\n message:\n typeof expression === 'string'\n ? `The expression ${expression} did not produce a valid result`\n : 'The expression did not produce a valid result',\n };\n }\n },\n );\n}\n\n/**\n * `compile()` is a companion function for use with {@link evaluate()} and the various `evaluateAs*()` functions.\n * It processes an expression string into the resulting AST that is executed by those functions. This is useful if\n * you have an expression that will need to be evaluated mulitple times, potentially with different values, as the\n * lexing and parsing steps can be skipped by using the AST object returned from this.\n *\n * The returned AST is intended to be opaque to client applications, but, of course, it is possible to manipulate\n * the AST before passing it back to {@link evaluate()}, if desired. This might be useful if, for example, certain\n * values are known to be constant.\n *\n * @param expression The expression to be parsed\n * @returns An executable AST representation of the expression\n */\nexport function compile(expression: string): jsep.Expression {\n return jsep(expression);\n}\n\n// Pre-defined type guards\nfunction defaultTypePredicate(result: unknown): result is DefaultEvaluateReturnType {\n return (\n typeof result === 'string' ||\n typeof result === 'number' ||\n typeof result === 'boolean' ||\n typeof result === 'undefined' ||\n result === null ||\n result instanceof Date\n );\n}\n\nfunction booleanTypePredicate(result: unknown): result is Boolean {\n return typeof result === 'boolean';\n}\n\nfunction numberTypePredicate(result: unknown): result is number {\n return typeof result === 'number';\n}\n\n// Implementation\n\n// This is the core of the implementation; it takes an expression, the variables and the current object\n// each expression is dispatched to an appropriate handler.\nfunction visitExpression(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'UnaryExpression':\n return visitUnaryExpression(expression as jsep.UnaryExpression, context);\n case 'BinaryExpression':\n return visitBinaryExpression(expression as jsep.BinaryExpression, context);\n case 'ConditionalExpression':\n return visitConditionalExpression(expression as jsep.ConditionalExpression, context);\n case 'CallExpression':\n return visitCallExpression(expression as jsep.CallExpression, context);\n case 'ArrowFunctionExpression':\n return visitArrowFunctionExpression(expression as ArrowExpression, context);\n case 'MemberExpression':\n return visitMemberExpression(expression as jsep.MemberExpression, context);\n case 'ArrayExpression':\n return visitArrayExpression(expression as jsep.ArrayExpression, context);\n case 'SequenceExpression':\n return visitSequenceExpression(expression as jsep.SequenceExpression, context);\n case 'NewExpression':\n return visitNewExpression(expression as NewExpression, context);\n case 'Literal':\n return visitLiteral(expression as jsep.Literal, context);\n case 'Identifier':\n return visitIdentifier(expression as jsep.Identifier, context);\n case 'TemplateLiteral':\n return visitTemplateLiteral(expression as TemplateLiteral, context);\n case 'TemplateElement':\n return visitTemplateElement(expression as TemplateElement, context);\n default:\n throw `Expression evaluator does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitExpressionName(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'Literal':\n return (expression as jsep.Literal).value as string;\n case 'Identifier':\n return (expression as jsep.Identifier).name;\n case 'MemberExpression':\n return visitExpressionName((expression as jsep.MemberExpression).property, context);\n default:\n throw `VisitExpressionName does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitUnaryExpression(expression: jsep.UnaryExpression, context: EvaluationContext) {\n const value = visitExpression(expression.argument, context);\n\n switch (expression.operator) {\n case '+':\n return +value;\n case '-':\n return -value;\n case '~':\n return ~value;\n case '!':\n return !value;\n default:\n throw `Expression evaluator does not support operator '${expression.operator}''`;\n }\n}\n\nfunction visitBinaryExpression(expression: jsep.BinaryExpression, context: EvaluationContext) {\n let left = visitExpression(expression.left, context);\n let right = visitExpression(expression.right, context);\n\n switch (expression.operator) {\n case '+':\n return left + right;\n case '-':\n return left - right;\n case '*':\n return left * right;\n case '/':\n return left / right;\n case '%':\n return left % right;\n case '**':\n return left ** right;\n case '==':\n return left == right;\n case '===':\n return left === right;\n case '!=':\n return left != right;\n case '!==':\n return left !== right;\n case '>':\n return left > right;\n case '>=':\n return left >= right;\n case '<':\n return left < right;\n case '<=':\n return left <= right;\n case 'in':\n return left in right;\n case '&&':\n return left && right;\n case '||':\n return left || right;\n case '??':\n return left ?? right;\n default:\n throw `Expression evaluator does not support operator '${expression.operator}' operator`;\n }\n}\n\nfunction visitConditionalExpression(expression: jsep.ConditionalExpression, context: EvaluationContext) {\n const test = visitExpression(expression.test, context);\n return test ? visitExpression(expression.consequent, context) : visitExpression(expression.alternate, context);\n}\n\nfunction visitCallExpression(expression: jsep.CallExpression, context: EvaluationContext) {\n let args = expression.arguments?.map(handleNullableExpression(context));\n let callee = visitExpression(expression.callee, context);\n\n if (!callee) {\n throw `No function named ${getCallTargetName(expression.callee)} is defined in this context`;\n } else if (!(typeof callee === 'function')) {\n throw `${getCallTargetName(expression.callee)} is not a function`;\n }\n\n return callee(...args);\n}\n\nfunction visitArrowFunctionExpression(expression: ArrowExpression, context: EvaluationContext) {\n const params =\n expression.params?.map((p) => {\n switch (p.type) {\n case 'Identifier':\n return (p as jsep.Identifier).name;\n default:\n throw `Cannot handle parameter of type ${p.type}`;\n }\n }) ?? [];\n\n return function (...rest: unknown[]) {\n if (rest.length < params.length) {\n throw `Required argument(s) ${params.slice(rest.length, -1).join(', ')} were not provided`;\n }\n\n const vars = Object.fromEntries(\n params.reduce((acc: Array<[string, VariablesMap['a']]>, p, idx) => {\n const val = rest[idx];\n if (isValidVariableType(val)) {\n acc.push([p, val]);\n }\n return acc;\n }, []),\n );\n\n return visitExpression(expression.body, context.addVariables(vars));\n }.bind(context.thisObj ?? null);\n}\n\nfunction visitMemberExpression(expression: jsep.MemberExpression, context: EvaluationContext) {\n let obj = visitExpression(expression.object, context);\n\n if (obj === undefined) {\n switch (expression.object.type) {\n case 'Identifier': {\n let objectName = visitExpressionName(expression.object, context);\n throw ReferenceError(`ReferenceError: ${objectName} is not defined`);\n }\n case 'MemberExpression': {\n let propertyName = visitExpressionName(expression.property, context);\n throw TypeError(`TypeError: cannot read properties of undefined (reading '${propertyName}')`);\n }\n default:\n throw `VisitMemberExpression does not support operator '${expression.object.type}' type`;\n }\n }\n\n let newObj = obj;\n if (typeof obj === 'string') {\n newObj = String.prototype;\n } else if (typeof obj === 'number') {\n newObj = Number.prototype;\n } else if (typeof obj === 'function') {\n // no-op\n } else if (typeof obj !== 'object') {\n throw `VisitMemberExpression does not support member access on type ${typeof obj}`;\n }\n\n context.thisObj = newObj;\n\n let result: unknown;\n switch (expression.property.type) {\n case 'Identifier':\n case 'MemberExpression':\n result = visitExpression(expression.property, context);\n break;\n default: {\n const property = visitExpression(expression.property, context);\n if (typeof property === 'undefined') {\n throw { type: 'Illegal property access', message: 'No property was supplied to the property access' };\n }\n validatePropertyName(property);\n result = obj[property];\n }\n }\n\n if (typeof result === 'function') {\n return result.bind(obj);\n }\n\n return result;\n}\n\nfunction visitArrayExpression(expression: jsep.ArrayExpression, context: EvaluationContext) {\n return expression.elements?.map(handleNullableExpression(context));\n}\n\nfunction visitSequenceExpression(expression: jsep.SequenceExpression, context: EvaluationContext) {\n const result = expression.expressions.map(handleNullableExpression(context));\n return result[result.length - 1];\n}\n\nfunction visitNewExpression(expression: NewExpression, context: EvaluationContext) {\n if (expression.callee && expression.callee.type === 'Identifier') {\n let args = expression.arguments?.map(handleNullableExpression(context)) as Array<any>;\n switch (expression.callee.name) {\n case 'Date': {\n /** @ts-ignore because we can use the spread operator here */\n return new Date(...args);\n }\n case 'RegExp':\n /** @ts-ignore because we can use the spread operator here */\n return new RegExp(...args);\n default:\n throw `Cannot instantiate object of type ${expression.callee.name}`;\n }\n } else {\n if (!expression.callee) {\n throw `Could not handle \"new\" without a specified class`;\n } else {\n throw 'new must be called with either Date or RegExp';\n }\n }\n}\n\nfunction visitTemplateLiteral(expression: TemplateLiteral, context: EvaluationContext) {\n const expressions: Array<unknown> = expression.expressions?.map(handleNullableExpression(context)) ?? [];\n const quasis: Array<{ tail: boolean; value: unknown }> =\n expression.quasis?.map(handleNullableExpression(context)) ?? [];\n return (\n quasis\n .filter((q) => !q.tail)\n .map((q) => q.value)\n .join('') +\n expressions.join('') +\n quasis\n .filter((q) => q.tail)\n .map((q) => q.value)\n .join('')\n );\n}\n\nfunction visitTemplateElement(expression: TemplateElement, context: EvaluationContext) {\n return { value: expression.cooked, tail: expression.tail };\n}\n\nfunction visitIdentifier(expression: jsep.Identifier, context: EvaluationContext) {\n validatePropertyName(expression.name);\n\n // we support both `object` and `function` in the same way as technically property access on functions\n // is possible; the use-case here is to support JS's \"static\" functions like `Number.isInteger()`, which\n // is technically reading a property on a function\n const thisObj = context.thisObj;\n if (thisObj && (typeof thisObj === 'object' || typeof thisObj === 'function') && expression.name in thisObj) {\n const result = thisObj[expression.name];\n validatePropertyName(result);\n return result;\n } else if (context.variables && expression.name in context.variables) {\n const result = context.variables[expression.name];\n validatePropertyName(result);\n return result;\n } else if (expression.name in context.globals) {\n return context.globals[expression.name];\n } else {\n return undefined;\n }\n}\n\nfunction visitLiteral(expression: jsep.Literal, context: EvaluationContext) {\n validatePropertyName(expression.value);\n return expression.value;\n}\n\n// Internal helpers and utilities\n\ninterface EvaluationContext {\n thisObj: object | undefined;\n variables: VariablesMap;\n globals: typeof globals | typeof globalsAsync;\n addVariables(vars: VariablesMap): EvaluationContext;\n}\n\nfunction createSynchronousContext(variables: VariablesMap): EvaluationContext {\n return createContextInternal(variables, globals);\n}\n\nfunction createAsynchronousContext(variables: VariablesMap): EvaluationContext {\n return createContextInternal(variables, globalsAsync);\n}\n\nfunction createContextInternal(variables: VariablesMap, globals_: typeof globals | typeof globalsAsync) {\n const context = {\n thisObj: undefined,\n variables: { ...variables },\n globals: { ...globals_ },\n addVariables(vars: VariablesMap) {\n this.variables = { ...this.variables, ...vars };\n return this;\n },\n };\n\n context.addVariables.bind(context);\n\n return context;\n}\n\n// helper useful for handling arrays of expressions, since `null` expressions should not be\n// dispatched to `visitExpression()`\nfunction handleNullableExpression(context: EvaluationContext) {\n return function handleNullableExpressionInner(expression: jsep.Expression | null) {\n if (expression === null) {\n return null;\n }\n\n return visitExpression(expression, context);\n };\n}\n\nfunction validatePropertyName(name: unknown) {\n if (name === '__proto__' || name === 'prototype' || name === 'constructor') {\n throw { type: 'Illegal property access', message: `Cannot access the ${name} property of objects` };\n }\n}\n\nfunction isValidVariableType(val: unknown): val is VariablesMap['a'] {\n if (\n typeof val === 'string' ||\n typeof val === 'number' ||\n typeof val === 'boolean' ||\n typeof val === 'function' ||\n val === null ||\n val instanceof RegExp\n ) {\n return true;\n }\n\n if (typeof val === 'object') {\n for (const key of Object.keys(val)) {\n if (!isValidVariableType(val[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n if (Array.isArray(val)) {\n for (const item of val) {\n if (!isValidVariableType(item)) {\n return false;\n }\n }\n }\n\n return false;\n}\n\nfunction getCallTargetName(expression: Expression) {\n if (!expression) {\n return null;\n }\n if (expression.type === 'MemberExpression') {\n return (expression.property as MemberExpression)?.name;\n }\n // identifier expression\n return expression.name;\n}\n","/** @category Utility */\nimport { type ArrowExpression } from '@jsep-plugin/arrow';\nimport { type NewExpression } from '@jsep-plugin/new';\nimport { type TemplateElement, type TemplateLiteral } from '@jsep-plugin/template';\nimport { jsep } from './evaluator';\nimport { globalsAsync } from './globals';\n\n/**\n * `extractVariableNames()` is a companion function for `evaluate()` and `evaluateAsync()` which extracts the\n * names of all unbound identifiers used in the expression. The idea is to be able to extract all of the names\n * of variables that will need to be supplied in order to correctly process the expression.\n *\n * @example\n * ```ts\n * // variables will be ['isEmpty', 'array']\n * const variables = extractVariableNames('!isEmpty(array)')\n * ```\n *\n * An identifier is considered \"unbound\" if it is not a reference to the property of an object, is not defined\n * as a parameter to an inline arrow function, and is not a global value. E.g.,\n *\n * @example\n * ```ts\n * // variables will be ['obj']\n * const variables = extractVariableNames('obj.prop()')\n * ```\n *\n * @example\n * ```ts\n * // variables will be ['arr', 'needle']\n * const variables = extractVariableNames('arr.filter(v => v === needle)')\n * ```\n *\n @example\n * ```ts\n * // variables will be ['myVar']\n * const variables = extractVariableNames('new String(myVar)')\n * ```\n *\n * Note that because this expression evaluator uses a restricted definition of \"global\" there are some Javascript\n * globals that will be reported as a unbound expression. This is expected because the evaluator will still fail\n * on these expressions.\n */\nexport function extractVariableNames(expression: string | jsep.Expression) {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n throw `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`;\n }\n\n const context = createAsynchronousContext();\n visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context);\n\n return [...context.variables];\n}\n\nfunction visitExpression(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'UnaryExpression':\n return visitUnaryExpression(expression as jsep.UnaryExpression, context);\n case 'BinaryExpression':\n return visitBinaryExpression(expression as jsep.BinaryExpression, context);\n case 'ConditionalExpression':\n return visitConditionalExpression(expression as jsep.ConditionalExpression, context);\n case 'CallExpression':\n return visitCallExpression(expression as jsep.CallExpression, context);\n case 'ArrowFunctionExpression':\n return visitArrowFunctionExpression(expression as ArrowExpression, context);\n case 'MemberExpression':\n return visitMemberExpression(expression as jsep.MemberExpression, context);\n case 'ArrayExpression':\n return visitArrayExpression(expression as jsep.ArrayExpression, context);\n case 'SequenceExpression':\n return visitSequenceExpression(expression as jsep.SequenceExpression, context);\n case 'NewExpression':\n return visitNewExpression(expression as NewExpression, context);\n case 'Literal':\n return visitLiteral(expression as jsep.Literal, context);\n case 'Identifier':\n return visitIdentifier(expression as jsep.Identifier, context);\n case 'TemplateLiteral':\n return visitTemplateLiteral(expression as TemplateLiteral, context);\n case 'TemplateElement':\n return visitTemplateElement(expression as TemplateElement, context);\n default:\n throw `Expression evaluator does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitUnaryExpression(expression: jsep.UnaryExpression, context: EvaluationContext) {\n return visitExpression(expression.argument, context);\n}\n\nfunction visitBinaryExpression(expression: jsep.BinaryExpression, context: EvaluationContext) {\n const left = visitExpression(expression.left, context);\n const right = visitExpression(expression.right, context);\n return [left, right].filter(Boolean);\n}\n\nfunction visitConditionalExpression(expression: jsep.ConditionalExpression, context: EvaluationContext) {\n const consequent = visitExpression(expression.consequent, context);\n const test = visitExpression(expression.test, context);\n const alternate = visitExpression(expression.alternate, context);\n return [consequent, test, alternate].filter(Boolean);\n}\n\nfunction visitCallExpression(expression: jsep.CallExpression, context: EvaluationContext) {\n const fn = visitExpression(expression.callee, context);\n expression.arguments?.map(handleNullableExpression(context));\n return fn;\n}\n\nfunction visitArrowFunctionExpression(expression: ArrowExpression, context: EvaluationContext) {\n const newContext = { ...context };\n newContext.isLocalExpression = true;\n\n const params = expression.params?.map(handleNullableExpression(newContext)) ?? [];\n const bodyVariables = visitExpression(expression.body, newContext) ?? [];\n\n if (bodyVariables && Array.isArray(bodyVariables)) {\n for (const v of bodyVariables) {\n if (!params.includes(v)) {\n context.variables.add(v);\n }\n }\n }\n}\n\nfunction visitMemberExpression(expression: jsep.MemberExpression, context: EvaluationContext) {\n visitExpression(expression.object, context);\n const newContext = { ...context };\n newContext.isLocalExpression = true;\n visitExpression(expression.property, newContext);\n}\n\nfunction visitArrayExpression(expression: jsep.ArrayExpression, context: EvaluationContext) {\n expression.elements?.map(handleNullableExpression(context));\n}\n\nfunction visitSequenceExpression(expression: jsep.SequenceExpression, context: EvaluationContext) {\n expression.expressions?.map(handleNullableExpression(context));\n}\n\nfunction visitNewExpression(expression: NewExpression, context: EvaluationContext) {\n expression.arguments?.map(handleNullableExpression(context));\n}\n\nfunction visitTemplateLiteral(expression: TemplateLiteral, context: EvaluationContext) {\n expression.expressions?.map(handleNullableExpression(context));\n expression.quasis?.map(handleNullableExpression(context));\n}\n\nfunction visitTemplateElement(expression: TemplateElement, context: EvaluationContext) {}\n\nfunction visitIdentifier(expression: jsep.Identifier, context: EvaluationContext) {\n if (!(expression.name in context.globals)) {\n if (!context.isLocalExpression) {\n context.variables.add(expression.name);\n } else {\n return expression.name;\n }\n }\n}\n\nfunction visitLiteral(expression: jsep.Literal, context: EvaluationContext) {}\n\n// Internals\ninterface EvaluationContext {\n globals: typeof globalsAsync;\n isLocalExpression: boolean;\n variables: Set<string>;\n}\n\nfunction createAsynchronousContext(): EvaluationContext {\n return createContextInternal(globalsAsync);\n}\n\nfunction createContextInternal(globals_: typeof globalsAsync) {\n const context = {\n globals: { ...globals_ },\n isLocalExpression: false,\n variables: new Set<string>(),\n };\n\n return context;\n}\n\nfunction handleNullableExpression(context: EvaluationContext) {\n return function handleNullableExpressionInner(expression: jsep.Expression | null) {\n if (expression === null) {\n return null;\n }\n\n return visitExpression(expression, context);\n };\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Jsep","version","static","op_name","max_unop_len","Math","max","length","unary_ops","precedence","isRightAssociative","max_binop_len","binary_ops","right_associative","add","delete","char","additional_identifier_chars","literal_name","literal_value","literals","getMaxKeyLen","this","expr","charAt","index","code","charCodeAt","constructor","parse","keys","map","k","ch","op_val","String","fromCharCode","has","isIdentifierStart","isDecimalDigit","throwError","message","error","Error","description","runHook","name","node","hooks","env","context","run","searchHook","find","callback","gobbleSpaces","SPACE_CODE","TAB_CODE","LF_CODE","CR_CODE","nodes","gobbleExpressions","type","COMPOUND","body","untilICode","ch_i","SEMCOL_CODE","COMMA_CODE","gobbleExpression","push","gobbleBinaryExpression","gobbleBinaryOp","to_check","substr","tc_len","isIdentifierPart","biop","prec","stack","biop_info","left","right","i","cur_biop","gobbleToken","binaryPrecedence","right_a","comparePrev","prev","pop","BINARY_EXP","operator","PERIOD_CODE","gobbleNumericLiteral","SQUOTE_CODE","DQUOTE_CODE","gobbleStringLiteral","OBRACK_CODE","gobbleArray","argument","UNARY_EXP","prefix","gobbleIdentifier","LITERAL","raw","this_str","THIS_EXP","OPAREN_CODE","gobbleGroup","gobbleTokenProperty","QUMARK_CODE","optional","MEMBER_EXP","computed","object","property","CBRACK_CODE","CALL_EXP","gobbleArguments","CPAREN_CODE","callee","chCode","number","parseFloat","str","startIndex","quote","closed","substring","start","IDENTIFIER","slice","termination","args","separator_count","arg","SEQUENCE_EXP","expressions","ARRAY_EXP","elements","first","arguments","Array","isArray","forEach","assign","plugins","jsep","registered","register","plugin","init","COLON_CODE","Set","stdClassProps","getOwnPropertyNames","filter","includes","undefined","m","ternary","test","consequent","alternate","newTest","ARROW_EXP","updateBinariesToArrows","values","val","params","addBinaryOp","backupIndex","addUnaryOp","callNode","getNumberCodeRanges","numType","getNumberBase","isUnderscoreOrWithinRange","ranges","some","min","gobbleBase10","gobbleDigits","JSON","stringify","parseInt","patternIndex","inCharSet","pattern","flags","RegExp","e","gobbleTemplateLiteral","gobbleMember","quasis","cooked","pushQuasi","tail","tag","quasi","bind","globals","Boolean","Infinity","NaN","Number","BigInt","isFinite","isNaN","decodeURI","encodeURI","encodeURIComponent","__proto__","fromEntries","hasOwn","is","globalsAsync","Promise","evaluate","expression","evaluateAsType","variables","defaultTypePredicate","evaluateAsync","evaluateAsTypeAsync","evaluateAsBoolean","booleanTypePredicate","evaluateAsBooleanAsync","evaluateAsNumber","numberTypePredicate","evaluateAsNumberAsync","typePredicate","createContextInternal","createSynchronousContext","result","visitExpression","createAsynchronousContext","resolve","then","reject","compile","Date","visitUnaryExpression","visitBinaryExpression","visitConditionalExpression","handleNullableExpression","getCallTargetName","visitCallExpression","p","rest","join","vars","reduce","acc","idx","isValidVariableType","addVariables","thisObj","visitArrowFunctionExpression","objectName","visitExpressionName","ReferenceError","propertyName","TypeError","newObj","validatePropertyName","visitMemberExpression","visitArrayExpression","visitSequenceExpression","visitNewExpression","visitLiteral","visitIdentifier","q","visitTemplateLiteral","visitTemplateElement","globals_","extractVariableNames","isLocalExpression","fn","newContext","bodyVariables","v","jsepArrow","jsepNew","jsepNumbers","jsepRegex","jsepTernary","jsepTemplate"],"sourceRoot":""}
package/jest.config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ clearMocks: true,
2
3
  transform: {
3
4
  '^.+\\.tsx?$': ['@swc/jest'],
4
5
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-expression-evaluator",
3
- "version": "5.8.2-pre.2533",
3
+ "version": "6.0.0",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Utilities for evaluating user-defined expressions",
6
6
  "browser": "dist/openmrs-esm-expression-evaluator.js",
@@ -51,6 +51,5 @@
51
51
  "cross-env": "^7.0.3",
52
52
  "jest": "^29.7.0",
53
53
  "jest-cli": "^29.7.0"
54
- },
55
- "stableVersion": "5.7.3"
54
+ }
56
55
  }
@@ -2,26 +2,26 @@ import { describe, it, expect } from '@jest/globals';
2
2
  import { compile, evaluate, evaluateAsBoolean, evaluateAsNumber, evaluateAsType, evaluateAsync } from './evaluator';
3
3
 
4
4
  describe('OpenMRS Expression Evaluator', () => {
5
- it('Should evaluate a simple expression', () => {
5
+ it('should evaluate a simple expression', () => {
6
6
  expect(evaluate('1 + 1')).toBe(2);
7
7
  });
8
8
 
9
- it('Should support mulitplication', () => {
9
+ it('should support multiplication', () => {
10
10
  expect(evaluate('1 * 2')).toBe(2);
11
11
  });
12
12
 
13
- it('Should support the not operator', () => {
13
+ it('should support the not operator', () => {
14
14
  expect(evaluate('!1')).toBe(false);
15
15
  expect(evaluate('!0')).toBe(true);
16
16
  expect(evaluate('!true')).toBe(false);
17
17
  expect(evaluate('!false')).toBe(true);
18
18
  });
19
19
 
20
- it('Should support expressions in parentheses', () => {
20
+ it('should support expressions in parentheses', () => {
21
21
  expect(evaluate('(1, 2, 3)')).toBe(3);
22
22
  });
23
23
 
24
- it('Should support order of operations', () => {
24
+ it('should support order of operations', () => {
25
25
  expect(evaluate('(1 + 2) * 3')).toBe(9);
26
26
  expect(evaluate('1 + 2 * 3')).toBe(7);
27
27
  });
@@ -34,26 +34,26 @@ describe('OpenMRS Expression Evaluator', () => {
34
34
  expect(evaluate('1 in [1, 2, 3]')).toBe(true);
35
35
  });
36
36
 
37
- it('Should support basic variables', () => {
37
+ it('should support basic variables', () => {
38
38
  expect(evaluate('1 + a', { a: 3 })).toBe(4);
39
39
  });
40
40
 
41
- it('Should support nullish coalescing', () => {
41
+ it('should support nullish coalescing', () => {
42
42
  expect(evaluate('a ?? b', { a: null, b: 3 })).toBe(3);
43
43
  expect(evaluate('a ?? b', { a: 3, b: null })).toBe(3);
44
44
  });
45
45
 
46
- it('Should support functions', () => {
46
+ it('should support functions', () => {
47
47
  expect(evaluate('a(1)', { a: (i: number) => i + 1 })).toBe(2);
48
48
  });
49
49
 
50
- it('Should support built-in functions', () => {
50
+ it('should support built-in functions', () => {
51
51
  expect(evaluate('a.includes("v")', { a: 'value' })).toBe(true);
52
52
  expect(evaluate('"value".includes("v")')).toBe(true);
53
53
  expect(evaluate('(3.14159).toPrecision(3)')).toBe('3.14');
54
54
  });
55
55
 
56
- it('Should give a useful error message for properties on missing objects', () => {
56
+ it('should give a useful error message for properties on missing objects', () => {
57
57
  expect(() => evaluate('a.b')).toThrow('ReferenceError: a is not defined');
58
58
  expect(() => evaluate('a["b"]')).toThrow('ReferenceError: a is not defined');
59
59
  expect(() => evaluate('a.b.c', { a: {} })).toThrow("TypeError: cannot read properties of undefined (reading 'c')");
@@ -65,17 +65,17 @@ describe('OpenMRS Expression Evaluator', () => {
65
65
  );
66
66
  });
67
67
 
68
- it('Should not support this', () => {
68
+ it('should not support this', () => {
69
69
  expect(() => evaluate('this')).toThrow(
70
70
  /Expression evaluator does not support expression of type 'ThisExpression'.*/i,
71
71
  );
72
72
  });
73
73
 
74
- it('Should support property references', () => {
74
+ it('should support property references', () => {
75
75
  expect(evaluate('a.b.c', { a: { b: { c: 3 } } })).toBe(3);
76
76
  });
77
77
 
78
- it('Should not support prototype references', () => {
78
+ it('should not support prototype references', () => {
79
79
  expect(() => evaluate('a.__proto__', { a: {} })).toThrow(/Cannot access the __proto__ property .*/i);
80
80
  expect(() => evaluate('a["__proto__"]', { a: {} })).toThrow(/Cannot access the __proto__ property .*/i);
81
81
  expect(() => evaluate('a[b]', { a: {}, b: '__proto__' })).toThrow(/Cannot access the __proto__ property .*/i);
@@ -88,36 +88,36 @@ describe('OpenMRS Expression Evaluator', () => {
88
88
  expect(() => evaluate('a[b]', { a: {}, b: 'prototype' })).toThrow(/Cannot access the prototype property .*/i);
89
89
  });
90
90
 
91
- it('Should support ternaries', () => {
91
+ it('should support ternaries', () => {
92
92
  expect(evaluate('a ? 1 : 2', { a: true })).toBe(1);
93
93
  expect(evaluate('a ? 1 : 2', { a: false })).toBe(2);
94
94
  });
95
95
 
96
- it('Should support hexdecimal', () => {
96
+ it('should support hexadecimal', () => {
97
97
  expect(evaluate('0xff')).toBe(255);
98
98
  });
99
99
 
100
- it('Should support string templates', () => {
100
+ it('should support string templates', () => {
101
101
  expect(evaluate('`${a.b}`', { a: { b: 'string' } })).toBe('string');
102
102
  });
103
103
 
104
- it('Should support new Date()', () => {
104
+ it('should support new Date()', () => {
105
105
  expect(evaluate('new Date().getTime()')).toBeLessThanOrEqual(new Date().getTime());
106
106
  });
107
107
 
108
- it('Should support RegExp', () => {
108
+ it('should support RegExp', () => {
109
109
  expect(evaluate('/.*/.test(a)', { a: 'a' })).toBe(true);
110
110
  });
111
111
 
112
- it('Should support RegExp objects', () => {
112
+ it('should support RegExp objects', () => {
113
113
  expect(evaluate('new RegExp(".*").test(a)', { a: 'a' })).toBe(true);
114
114
  });
115
115
 
116
- it('Should support arrow functions inside expressions', () => {
116
+ it('should support arrow functions inside expressions', () => {
117
117
  expect(evaluate('[1, 2, 3].find(v => v === 3)')).toBe(3);
118
118
  });
119
119
 
120
- it('Should support globals', () => {
120
+ it('should support globals', () => {
121
121
  expect(evaluate('NaN')).toBeNaN();
122
122
  expect(evaluate('Infinity')).toBe(Infinity);
123
123
  expect(evaluate('Boolean(true)')).toBe(true);
@@ -127,7 +127,7 @@ describe('OpenMRS Expression Evaluator', () => {
127
127
  expect(evaluate('Number.isInteger(42)')).toBe(true);
128
128
  });
129
129
 
130
- it('Should not support creating arbitrary objects', () => {
130
+ it('should not support creating arbitrary objects', () => {
131
131
  expect(() => evaluate('new object()')).toThrow(/Cannot instantiate object .*/i);
132
132
  class Fn {
133
133
  constructor() {}
@@ -135,12 +135,12 @@ describe('OpenMRS Expression Evaluator', () => {
135
135
  expect(() => evaluate('new Fn()', { Fn })).toThrow(/Cannot instantiate object .*/i);
136
136
  });
137
137
 
138
- it('Should not support invalid property references on supported objects', () => {
138
+ it('should not support invalid property references on supported objects', () => {
139
139
  expect(() => evaluate('new Date().__proto__')).toThrow(/Cannot access the __proto__ property .*/i);
140
140
  expect(() => evaluate('new Date().prototype')).toThrow(/Cannot access the prototype property .*/i);
141
141
  });
142
142
 
143
- it('Should not return invalid types', () => {
143
+ it('should not return invalid types', () => {
144
144
  expect(() => evaluate('a', { a: {} })).toThrow(/.* did not produce a valid result/i);
145
145
  expect(() => evaluateAsBoolean('a', { a: 'value' })).toThrow(/.* did not produce a valid result/i);
146
146
  expect(() => evaluateAsNumber('a', { a: true })).toThrow(/.* did not produce a valid result/i);
@@ -149,16 +149,16 @@ describe('OpenMRS Expression Evaluator', () => {
149
149
  );
150
150
  });
151
151
 
152
- it('Should support a compilation phase', () => {
152
+ it('should support a compilation phase', () => {
153
153
  const exp = compile('1 + 1');
154
154
  expect(evaluate(exp)).toBe(2);
155
155
  });
156
156
 
157
- it('Should not support variable assignement', () => {
157
+ it('should not support variable assignment', () => {
158
158
  expect(() => evaluate('var a = 1; a')).toThrow();
159
159
  });
160
160
 
161
- it('Should support asynchronous evaluation', async () => {
161
+ it('should support asynchronous evaluation', async () => {
162
162
  await expect(evaluateAsync('1 + 1')).resolves.toBe(2);
163
163
  let a = new Promise((resolve) => {
164
164
  setTimeout(() => resolve(1), 10);
@@ -172,13 +172,13 @@ describe('OpenMRS Expression Evaluator', () => {
172
172
  ).resolves.toBe(2);
173
173
  });
174
174
 
175
- it('Should support mock functions', () => {
175
+ it('should support mock functions', () => {
176
176
  expect(evaluate('api.getValue()', { api: { getValue: jest.fn().mockImplementation(() => 'value') } })).toBe(
177
177
  'value',
178
178
  );
179
179
  });
180
180
 
181
- it('Should support real-world use-cases', () => {
181
+ it('should support real-world use-cases', () => {
182
182
  expect(
183
183
  evaluate('!isEmpty(array)', {
184
184
  array: [],
@@ -198,4 +198,31 @@ describe('OpenMRS Expression Evaluator', () => {
198
198
  ),
199
199
  ).toBe(true);
200
200
  });
201
+
202
+ it('should throw an error with correct message for non-existent function', () => {
203
+ expect(() => {
204
+ evaluate('api.nonExistingFunction()', { api: {} });
205
+ }).toThrow('No function named nonExistingFunction is defined in this context');
206
+
207
+ // nested ref
208
+ expect(() => {
209
+ evaluate('objectWrapper.path.deepNested()', {
210
+ objectWrapper: {
211
+ path: {
212
+ deepNested: undefined,
213
+ },
214
+ },
215
+ });
216
+ }).toThrow('No function named deepNested is defined in this context');
217
+ });
218
+
219
+ it('should throw an error with correct message for non-callable targets', () => {
220
+ expect(() => {
221
+ evaluate('objectWrapper.path()', {
222
+ objectWrapper: {
223
+ path: {},
224
+ },
225
+ });
226
+ }).toThrow('path is not a function');
227
+ });
201
228
  });
package/src/evaluator.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** @category Utility */
2
- import jsep from 'jsep';
2
+ import jsep, { type Expression, type MemberExpression } from 'jsep';
3
3
  import jsepArrow, { type ArrowExpression } from '@jsep-plugin/arrow';
4
4
  import jsepNew, { type NewExpression } from '@jsep-plugin/new';
5
5
  import jsepNumbers from '@jsep-plugin/numbers';
@@ -467,9 +467,9 @@ function visitCallExpression(expression: jsep.CallExpression, context: Evaluatio
467
467
  let callee = visitExpression(expression.callee, context);
468
468
 
469
469
  if (!callee) {
470
- throw `No function named ${expression.callee} is defined in this context`;
470
+ throw `No function named ${getCallTargetName(expression.callee)} is defined in this context`;
471
471
  } else if (!(typeof callee === 'function')) {
472
- throw `${expression.callee} is not a function`;
472
+ throw `${getCallTargetName(expression.callee)} is not a function`;
473
473
  }
474
474
 
475
475
  return callee(...args);
@@ -722,3 +722,14 @@ function isValidVariableType(val: unknown): val is VariablesMap['a'] {
722
722
 
723
723
  return false;
724
724
  }
725
+
726
+ function getCallTargetName(expression: Expression) {
727
+ if (!expression) {
728
+ return null;
729
+ }
730
+ if (expression.type === 'MemberExpression') {
731
+ return (expression.property as MemberExpression)?.name;
732
+ }
733
+ // identifier expression
734
+ return expression.name;
735
+ }
@@ -2,46 +2,46 @@ import { describe, it, expect } from '@jest/globals';
2
2
  import { extractVariableNames } from './extractor';
3
3
 
4
4
  describe('OpenMRS Expression Extractor', () => {
5
- it('Should return empty list for expression lacking variables', () => {
5
+ it('returns an empty list for expression lacking variables', () => {
6
6
  expect(extractVariableNames('1 + 1')).toEqual([]);
7
7
  });
8
8
 
9
- it('Should support basic variables', () => {
9
+ it('supports basic variables', () => {
10
10
  expect(extractVariableNames('1 + a')).toEqual(['a']);
11
11
  });
12
12
 
13
- it('Should extracting both variables from binary operators', () => {
13
+ it('extracts both variables from binary operators', () => {
14
14
  expect(extractVariableNames('a ?? b')).toEqual(['a', 'b']);
15
15
  });
16
16
 
17
- it('Should support functions', () => {
17
+ it('supports functions', () => {
18
18
  expect(extractVariableNames('a(b)')).toEqual(['a', 'b']);
19
19
  });
20
20
 
21
- it('Should support built-in functions', () => {
21
+ it('supports built-in functions', () => {
22
22
  expect(extractVariableNames('a.includes("v")')).toEqual(['a']);
23
23
  expect(extractVariableNames('"value".includes(a)')).toEqual(['a']);
24
24
  expect(extractVariableNames('(3.14159).toPrecision(a)')).toEqual(['a']);
25
25
  });
26
26
 
27
- it('Should support string templates', () => {
27
+ it('supports string templates', () => {
28
28
  expect(extractVariableNames('`${a.b}`')).toEqual(['a']);
29
29
  });
30
30
 
31
- it('Should support RegExp', () => {
31
+ it('supports RegExp', () => {
32
32
  expect(extractVariableNames('/.*/.test(a)')).toEqual(['a']);
33
33
  });
34
34
 
35
- it('Should support global objects', () => {
35
+ it('supports global objects', () => {
36
36
  expect(extractVariableNames('Math.min(a, b, c)')).toEqual(['a', 'b', 'c']);
37
37
  expect(extractVariableNames('isNaN(a)')).toEqual(['a']);
38
38
  });
39
39
 
40
- it('Should support arrow functions inside expressions', () => {
40
+ it('supports arrow functions inside expressions', () => {
41
41
  expect(extractVariableNames('[1, 2, 3].find(v => v === a)')).toEqual(['a']);
42
42
  });
43
43
 
44
- it('Should support real-world use-cases', () => {
44
+ it('supports real-world use-cases', () => {
45
45
  expect(extractVariableNames('!isEmpty(array)')).toEqual(['isEmpty', 'array']);
46
46
 
47
47
  expect(