{ "version": 3, "sources": ["jsonpath-plus.mjs"], "sourcesContent": ["/**\n * @implements {IHooks}\n */\nclass Hooks {\n /**\n * @callback HookCallback\n * @this {*|Jsep} this\n * @param {Jsep} env\n * @returns: void\n */\n /**\n * Adds the given callback to the list of callbacks for the given hook.\n *\n * The callback will be invoked when the hook it is registered for is run.\n *\n * One callback function can be registered to multiple hooks and the same hook multiple times.\n *\n * @param {string|object} name The name of the hook, or an object of callbacks keyed by name\n * @param {HookCallback|boolean} callback The callback function which is given environment variables.\n * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)\n * @public\n */\n add(name, callback, first) {\n if (typeof arguments[0] != 'string') {\n // Multiple hook callbacks, keyed by name\n for (let name in arguments[0]) {\n this.add(name, arguments[0][name], arguments[1]);\n }\n } else {\n (Array.isArray(name) ? name : [name]).forEach(function (name) {\n this[name] = this[name] || [];\n if (callback) {\n this[name][first ? 'unshift' : 'push'](callback);\n }\n }, this);\n }\n }\n\n /**\n * Runs a hook invoking all registered callbacks with the given environment variables.\n *\n * Callbacks will be invoked synchronously and in the order in which they were registered.\n *\n * @param {string} name The name of the hook.\n * @param {Object} env The environment variables of the hook passed to all callbacks registered.\n * @public\n */\n run(name, env) {\n this[name] = this[name] || [];\n this[name].forEach(function (callback) {\n callback.call(env && env.context ? env.context : env, env);\n });\n }\n}\n\n/**\n * @implements {IPlugins}\n */\nclass Plugins {\n constructor(jsep) {\n this.jsep = jsep;\n this.registered = {};\n }\n\n /**\n * @callback PluginSetup\n * @this {Jsep} jsep\n * @returns: void\n */\n /**\n * Adds the given plugin(s) to the registry\n *\n * @param {object} plugins\n * @param {string} plugins.name The name of the plugin\n * @param {PluginSetup} plugins.init The init function\n * @public\n */\n register() {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n plugins.forEach(plugin => {\n if (typeof plugin !== 'object' || !plugin.name || !plugin.init) {\n throw new Error('Invalid JSEP plugin format');\n }\n if (this.registered[plugin.name]) {\n // already registered. Ignore.\n return;\n }\n plugin.init(this.jsep);\n this.registered[plugin.name] = plugin;\n });\n }\n}\n\n// JavaScript Expression Parser (JSEP) 1.4.0\n\nclass Jsep {\n /**\n * @returns {string}\n */\n static get version() {\n // To be filled in by the template\n return '1.4.0';\n }\n\n /**\n * @returns {string}\n */\n static toString() {\n return 'JavaScript Expression Parser (JSEP) v' + Jsep.version;\n }\n // ==================== CONFIG ================================\n /**\n * @method addUnaryOp\n * @param {string} op_name The name of the unary op to add\n * @returns {Jsep}\n */\n static addUnaryOp(op_name) {\n Jsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);\n Jsep.unary_ops[op_name] = 1;\n return Jsep;\n }\n\n /**\n * @method jsep.addBinaryOp\n * @param {string} op_name The name of the binary op to add\n * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence\n * @param {boolean} [isRightAssociative=false] whether operator is right-associative\n * @returns {Jsep}\n */\n static addBinaryOp(op_name, precedence, isRightAssociative) {\n Jsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);\n Jsep.binary_ops[op_name] = precedence;\n if (isRightAssociative) {\n Jsep.right_associative.add(op_name);\n } else {\n Jsep.right_associative.delete(op_name);\n }\n return Jsep;\n }\n\n /**\n * @method addIdentifierChar\n * @param {string} char The additional character to treat as a valid part of an identifier\n * @returns {Jsep}\n */\n static addIdentifierChar(char) {\n Jsep.additional_identifier_chars.add(char);\n return Jsep;\n }\n\n /**\n * @method addLiteral\n * @param {string} literal_name The name of the literal to add\n * @param {*} literal_value The value of the literal\n * @returns {Jsep}\n */\n static addLiteral(literal_name, literal_value) {\n Jsep.literals[literal_name] = literal_value;\n return Jsep;\n }\n\n /**\n * @method removeUnaryOp\n * @param {string} op_name The name of the unary op to remove\n * @returns {Jsep}\n */\n static removeUnaryOp(op_name) {\n delete Jsep.unary_ops[op_name];\n if (op_name.length === Jsep.max_unop_len) {\n Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\n }\n return Jsep;\n }\n\n /**\n * @method removeAllUnaryOps\n * @returns {Jsep}\n */\n static removeAllUnaryOps() {\n Jsep.unary_ops = {};\n Jsep.max_unop_len = 0;\n return Jsep;\n }\n\n /**\n * @method removeIdentifierChar\n * @param {string} char The additional character to stop treating as a valid part of an identifier\n * @returns {Jsep}\n */\n static removeIdentifierChar(char) {\n Jsep.additional_identifier_chars.delete(char);\n return Jsep;\n }\n\n /**\n * @method removeBinaryOp\n * @param {string} op_name The name of the binary op to remove\n * @returns {Jsep}\n */\n static removeBinaryOp(op_name) {\n delete Jsep.binary_ops[op_name];\n if (op_name.length === Jsep.max_binop_len) {\n Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n }\n Jsep.right_associative.delete(op_name);\n return Jsep;\n }\n\n /**\n * @method removeAllBinaryOps\n * @returns {Jsep}\n */\n static removeAllBinaryOps() {\n Jsep.binary_ops = {};\n Jsep.max_binop_len = 0;\n return Jsep;\n }\n\n /**\n * @method removeLiteral\n * @param {string} literal_name The name of the literal to remove\n * @returns {Jsep}\n */\n static removeLiteral(literal_name) {\n delete Jsep.literals[literal_name];\n return Jsep;\n }\n\n /**\n * @method removeAllLiterals\n * @returns {Jsep}\n */\n static removeAllLiterals() {\n Jsep.literals = {};\n return Jsep;\n }\n // ==================== END CONFIG ============================\n\n /**\n * @returns {string}\n */\n get char() {\n return this.expr.charAt(this.index);\n }\n\n /**\n * @returns {number}\n */\n get code() {\n return this.expr.charCodeAt(this.index);\n }\n /**\n * @param {string} expr a string with the passed in express\n * @returns Jsep\n */\n constructor(expr) {\n // `index` stores the character number we are currently at\n // All of the gobbles below will modify `index` as we move along\n this.expr = expr;\n this.index = 0;\n }\n\n /**\n * static top-level parser\n * @returns {jsep.Expression}\n */\n static parse(expr) {\n return new Jsep(expr).parse();\n }\n\n /**\n * Get the longest key length of any object\n * @param {object} obj\n * @returns {number}\n */\n static getMaxKeyLen(obj) {\n return Math.max(0, ...Object.keys(obj).map(k => k.length));\n }\n\n /**\n * `ch` is a character code in the next three functions\n * @param {number} ch\n * @returns {boolean}\n */\n static isDecimalDigit(ch) {\n return ch >= 48 && ch <= 57; // 0...9\n }\n\n /**\n * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.\n * @param {string} op_val\n * @returns {number}\n */\n static binaryPrecedence(op_val) {\n return Jsep.binary_ops[op_val] || 0;\n }\n\n /**\n * Looks for start of identifier\n * @param {number} ch\n * @returns {boolean}\n */\n static isIdentifierStart(ch) {\n return ch >= 65 && ch <= 90 ||\n // A...Z\n ch >= 97 && ch <= 122 ||\n // a...z\n ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)] ||\n // any non-ASCII that is not an operator\n Jsep.additional_identifier_chars.has(String.fromCharCode(ch)); // additional characters\n }\n\n /**\n * @param {number} ch\n * @returns {boolean}\n */\n static isIdentifierPart(ch) {\n return Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);\n }\n\n /**\n * throw error at index of the expression\n * @param {string} message\n * @throws\n */\n throwError(message) {\n const error = new Error(message + ' at character ' + this.index);\n error.index = this.index;\n error.description = message;\n throw error;\n }\n\n /**\n * Run a given hook\n * @param {string} name\n * @param {jsep.Expression|false} [node]\n * @returns {?jsep.Expression}\n */\n runHook(name, node) {\n if (Jsep.hooks[name]) {\n const env = {\n context: this,\n node\n };\n Jsep.hooks.run(name, env);\n return env.node;\n }\n return node;\n }\n\n /**\n * Runs a given hook until one returns a node\n * @param {string} name\n * @returns {?jsep.Expression}\n */\n searchHook(name) {\n if (Jsep.hooks[name]) {\n const env = {\n context: this\n };\n Jsep.hooks[name].find(function (callback) {\n callback.call(env.context, env);\n return env.node;\n });\n return env.node;\n }\n }\n\n /**\n * Push `index` up to the next non-space character\n */\n gobbleSpaces() {\n let ch = this.code;\n // Whitespace\n while (ch === Jsep.SPACE_CODE || ch === Jsep.TAB_CODE || ch === Jsep.LF_CODE || ch === Jsep.CR_CODE) {\n ch = this.expr.charCodeAt(++this.index);\n }\n this.runHook('gobble-spaces');\n }\n\n /**\n * Top-level method to parse all expressions and returns compound or single node\n * @returns {jsep.Expression}\n */\n parse() {\n this.runHook('before-all');\n const nodes = this.gobbleExpressions();\n\n // If there's only one expression just try returning the expression\n const node = nodes.length === 1 ? nodes[0] : {\n type: Jsep.COMPOUND,\n body: nodes\n };\n return this.runHook('after-all', node);\n }\n\n /**\n * top-level parser (but can be reused within as well)\n * @param {number} [untilICode]\n * @returns {jsep.Expression[]}\n */\n gobbleExpressions(untilICode) {\n let nodes = [],\n ch_i,\n node;\n while (this.index < this.expr.length) {\n ch_i = this.code;\n\n // Expressions can be separated by semicolons, commas, or just inferred without any\n // separators\n if (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {\n this.index++; // ignore separators\n } else {\n // Try to gobble each expression individually\n if (node = this.gobbleExpression()) {\n nodes.push(node);\n // If we weren't able to find a binary expression and are out of room, then\n // the expression passed in probably has too much\n } else if (this.index < this.expr.length) {\n if (ch_i === untilICode) {\n break;\n }\n this.throwError('Unexpected \"' + this.char + '\"');\n }\n }\n }\n return nodes;\n }\n\n /**\n * The main parsing function.\n * @returns {?jsep.Expression}\n */\n gobbleExpression() {\n const node = this.searchHook('gobble-expression') || this.gobbleBinaryExpression();\n this.gobbleSpaces();\n return this.runHook('after-expression', node);\n }\n\n /**\n * Search for the operation portion of the string (e.g. `+`, `===`)\n * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)\n * and move down from 3 to 2 to 1 character until a matching binary operation is found\n * then, return that binary operation\n * @returns {string|boolean}\n */\n gobbleBinaryOp() {\n this.gobbleSpaces();\n let to_check = this.expr.substr(this.index, Jsep.max_binop_len);\n let tc_len = to_check.length;\n while (tc_len > 0) {\n // Don't accept a binary op when it is an identifier.\n // Binary ops that start with a identifier-valid character must be followed\n // by a non identifier-part valid character\n if (Jsep.binary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {\n this.index += tc_len;\n return to_check;\n }\n to_check = to_check.substr(0, --tc_len);\n }\n return false;\n }\n\n /**\n * This function is responsible for gobbling an individual expression,\n * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`\n * @returns {?jsep.BinaryExpression}\n */\n gobbleBinaryExpression() {\n let node, biop, prec, stack, biop_info, left, right, i, cur_biop;\n\n // First, try to get the leftmost thing\n // Then, check to see if there's a binary operator operating on that leftmost thing\n // Don't gobbleBinaryOp without a left-hand-side\n left = this.gobbleToken();\n if (!left) {\n return left;\n }\n biop = this.gobbleBinaryOp();\n\n // If there wasn't a binary operator, just return the leftmost node\n if (!biop) {\n return left;\n }\n\n // Otherwise, we need to start a stack to properly place the binary operations in their\n // precedence structure\n biop_info = {\n value: biop,\n prec: Jsep.binaryPrecedence(biop),\n right_a: Jsep.right_associative.has(biop)\n };\n right = this.gobbleToken();\n if (!right) {\n this.throwError(\"Expected expression after \" + biop);\n }\n stack = [left, biop_info, right];\n\n // Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm)\n while (biop = this.gobbleBinaryOp()) {\n prec = Jsep.binaryPrecedence(biop);\n if (prec === 0) {\n this.index -= biop.length;\n break;\n }\n biop_info = {\n value: biop,\n prec,\n right_a: Jsep.right_associative.has(biop)\n };\n cur_biop = biop;\n\n // Reduce: make a binary expression from the three topmost entries.\n const comparePrev = prev => biop_info.right_a && prev.right_a ? prec > prev.prec : prec <= prev.prec;\n while (stack.length > 2 && comparePrev(stack[stack.length - 2])) {\n right = stack.pop();\n biop = stack.pop().value;\n left = stack.pop();\n node = {\n type: Jsep.BINARY_EXP,\n operator: biop,\n left,\n right\n };\n stack.push(node);\n }\n node = this.gobbleToken();\n if (!node) {\n this.throwError(\"Expected expression after \" + cur_biop);\n }\n stack.push(biop_info, node);\n }\n i = stack.length - 1;\n node = stack[i];\n while (i > 1) {\n node = {\n type: Jsep.BINARY_EXP,\n operator: stack[i - 1].value,\n left: stack[i - 2],\n right: node\n };\n i -= 2;\n }\n return node;\n }\n\n /**\n * An individual part of a binary expression:\n * e.g. `foo.bar(baz)`, `1`, `\"abc\"`, `(a % 2)` (because it's in parenthesis)\n * @returns {boolean|jsep.Expression}\n */\n gobbleToken() {\n let ch, to_check, tc_len, node;\n this.gobbleSpaces();\n node = this.searchHook('gobble-token');\n if (node) {\n return this.runHook('after-token', node);\n }\n ch = this.code;\n if (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {\n // Char code 46 is a dot `.` which can start off a numeric literal\n return this.gobbleNumericLiteral();\n }\n if (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {\n // Single or double quotes\n node = this.gobbleStringLiteral();\n } else if (ch === Jsep.OBRACK_CODE) {\n node = this.gobbleArray();\n } else {\n to_check = this.expr.substr(this.index, Jsep.max_unop_len);\n tc_len = to_check.length;\n while (tc_len > 0) {\n // Don't accept an unary op when it is an identifier.\n // Unary ops that start with a identifier-valid character must be followed\n // by a non identifier-part valid character\n if (Jsep.unary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {\n this.index += tc_len;\n const argument = this.gobbleToken();\n if (!argument) {\n this.throwError('missing unaryOp argument');\n }\n return this.runHook('after-token', {\n type: Jsep.UNARY_EXP,\n operator: to_check,\n argument,\n prefix: true\n });\n }\n to_check = to_check.substr(0, --tc_len);\n }\n if (Jsep.isIdentifierStart(ch)) {\n node = this.gobbleIdentifier();\n if (Jsep.literals.hasOwnProperty(node.name)) {\n node = {\n type: Jsep.LITERAL,\n value: Jsep.literals[node.name],\n raw: node.name\n };\n } else if (node.name === Jsep.this_str) {\n node = {\n type: Jsep.THIS_EXP\n };\n }\n } else if (ch === Jsep.OPAREN_CODE) {\n // open parenthesis\n node = this.gobbleGroup();\n }\n }\n if (!node) {\n return this.runHook('after-token', false);\n }\n node = this.gobbleTokenProperty(node);\n return this.runHook('after-token', node);\n }\n\n /**\n * Gobble properties of of identifiers/strings/arrays/groups.\n * e.g. `foo`, `bar.baz`, `foo['bar'].baz`\n * It also gobbles function calls:\n * e.g. `Math.acos(obj.angle)`\n * @param {jsep.Expression} node\n * @returns {jsep.Expression}\n */\n gobbleTokenProperty(node) {\n this.gobbleSpaces();\n let ch = this.code;\n while (ch === Jsep.PERIOD_CODE || ch === Jsep.OBRACK_CODE || ch === Jsep.OPAREN_CODE || ch === Jsep.QUMARK_CODE) {\n let optional;\n if (ch === Jsep.QUMARK_CODE) {\n if (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {\n break;\n }\n optional = true;\n this.index += 2;\n this.gobbleSpaces();\n ch = this.code;\n }\n this.index++;\n if (ch === Jsep.OBRACK_CODE) {\n node = {\n type: Jsep.MEMBER_EXP,\n computed: true,\n object: node,\n property: this.gobbleExpression()\n };\n if (!node.property) {\n this.throwError('Unexpected \"' + this.char + '\"');\n }\n this.gobbleSpaces();\n ch = this.code;\n if (ch !== Jsep.CBRACK_CODE) {\n this.throwError('Unclosed [');\n }\n this.index++;\n } else if (ch === Jsep.OPAREN_CODE) {\n // A function call is being made; gobble all the arguments\n node = {\n type: Jsep.CALL_EXP,\n 'arguments': this.gobbleArguments(Jsep.CPAREN_CODE),\n callee: node\n };\n } else if (ch === Jsep.PERIOD_CODE || optional) {\n if (optional) {\n this.index--;\n }\n this.gobbleSpaces();\n node = {\n type: Jsep.MEMBER_EXP,\n computed: false,\n object: node,\n property: this.gobbleIdentifier()\n };\n }\n if (optional) {\n node.optional = true;\n } // else leave undefined for compatibility with esprima\n\n this.gobbleSpaces();\n ch = this.code;\n }\n return node;\n }\n\n /**\n * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to\n * keep track of everything in the numeric literal and then calling `parseFloat` on that string\n * @returns {jsep.Literal}\n */\n gobbleNumericLiteral() {\n let number = '',\n ch,\n chCode;\n while (Jsep.isDecimalDigit(this.code)) {\n number += this.expr.charAt(this.index++);\n }\n if (this.code === Jsep.PERIOD_CODE) {\n // can start with a decimal marker\n number += this.expr.charAt(this.index++);\n while (Jsep.isDecimalDigit(this.code)) {\n number += this.expr.charAt(this.index++);\n }\n }\n ch = this.char;\n if (ch === 'e' || ch === 'E') {\n // exponent marker\n number += this.expr.charAt(this.index++);\n ch = this.char;\n if (ch === '+' || ch === '-') {\n // exponent sign\n number += this.expr.charAt(this.index++);\n }\n while (Jsep.isDecimalDigit(this.code)) {\n // exponent itself\n number += this.expr.charAt(this.index++);\n }\n if (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1))) {\n this.throwError('Expected exponent (' + number + this.char + ')');\n }\n }\n chCode = this.code;\n\n // Check to make sure this isn't a variable name that start with a number (123abc)\n if (Jsep.isIdentifierStart(chCode)) {\n this.throwError('Variable names cannot start with a number (' + number + this.char + ')');\n } else if (chCode === Jsep.PERIOD_CODE || number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE) {\n this.throwError('Unexpected period');\n }\n return {\n type: Jsep.LITERAL,\n value: parseFloat(number),\n raw: number\n };\n }\n\n /**\n * Parses a string literal, staring with single or double quotes with basic support for escape codes\n * e.g. `\"hello world\"`, `'this is\\nJSEP'`\n * @returns {jsep.Literal}\n */\n gobbleStringLiteral() {\n let str = '';\n const startIndex = this.index;\n const quote = this.expr.charAt(this.index++);\n let closed = false;\n while (this.index < this.expr.length) {\n let ch = this.expr.charAt(this.index++);\n if (ch === quote) {\n closed = true;\n break;\n } else if (ch === '\\\\') {\n // Check for all of the common escape codes\n ch = this.expr.charAt(this.index++);\n switch (ch) {\n case 'n':\n str += '\\n';\n break;\n case 'r':\n str += '\\r';\n break;\n case 't':\n str += '\\t';\n break;\n case 'b':\n str += '\\b';\n break;\n case 'f':\n str += '\\f';\n break;\n case 'v':\n str += '\\x0B';\n break;\n default:\n str += ch;\n }\n } else {\n str += ch;\n }\n }\n if (!closed) {\n this.throwError('Unclosed quote after \"' + str + '\"');\n }\n return {\n type: Jsep.LITERAL,\n value: str,\n raw: this.expr.substring(startIndex, this.index)\n };\n }\n\n /**\n * Gobbles only identifiers\n * e.g.: `foo`, `_value`, `$x1`\n * Also, this function checks if that identifier is a literal:\n * (e.g. `true`, `false`, `null`) or `this`\n * @returns {jsep.Identifier}\n */\n gobbleIdentifier() {\n let ch = this.code,\n start = this.index;\n if (Jsep.isIdentifierStart(ch)) {\n this.index++;\n } else {\n this.throwError('Unexpected ' + this.char);\n }\n while (this.index < this.expr.length) {\n ch = this.code;\n if (Jsep.isIdentifierPart(ch)) {\n this.index++;\n } else {\n break;\n }\n }\n return {\n type: Jsep.IDENTIFIER,\n name: this.expr.slice(start, this.index)\n };\n }\n\n /**\n * Gobbles a list of arguments within the context of a function call\n * or array literal. This function also assumes that the opening character\n * `(` or `[` has already been gobbled, and gobbles expressions and commas\n * until the terminator character `)` or `]` is encountered.\n * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`\n * @param {number} termination\n * @returns {jsep.Expression[]}\n */\n gobbleArguments(termination) {\n const args = [];\n let closed = false;\n let separator_count = 0;\n while (this.index < this.expr.length) {\n this.gobbleSpaces();\n let ch_i = this.code;\n if (ch_i === termination) {\n // done parsing\n closed = true;\n this.index++;\n if (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length) {\n this.throwError('Unexpected token ' + String.fromCharCode(termination));\n }\n break;\n } else if (ch_i === Jsep.COMMA_CODE) {\n // between expressions\n this.index++;\n separator_count++;\n if (separator_count !== args.length) {\n // missing argument\n if (termination === Jsep.CPAREN_CODE) {\n this.throwError('Unexpected token ,');\n } else if (termination === Jsep.CBRACK_CODE) {\n for (let arg = args.length; arg < separator_count; arg++) {\n args.push(null);\n }\n }\n }\n } else if (args.length !== separator_count && separator_count !== 0) {\n // NOTE: `&& separator_count !== 0` allows for either all commas, or all spaces as arguments\n this.throwError('Expected comma');\n } else {\n const node = this.gobbleExpression();\n if (!node || node.type === Jsep.COMPOUND) {\n this.throwError('Expected comma');\n }\n args.push(node);\n }\n }\n if (!closed) {\n this.throwError('Expected ' + String.fromCharCode(termination));\n }\n return args;\n }\n\n /**\n * Responsible for parsing a group of things within parentheses `()`\n * that have no identifier in front (so not a function call)\n * This function assumes that it needs to gobble the opening parenthesis\n * and then tries to gobble everything within that parenthesis, assuming\n * that the next thing it should see is the close parenthesis. If not,\n * then the expression probably doesn't have a `)`\n * @returns {boolean|jsep.Expression}\n */\n gobbleGroup() {\n this.index++;\n let nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);\n if (this.code === Jsep.CPAREN_CODE) {\n this.index++;\n if (nodes.length === 1) {\n return nodes[0];\n } else if (!nodes.length) {\n return false;\n } else {\n return {\n type: Jsep.SEQUENCE_EXP,\n expressions: nodes\n };\n }\n } else {\n this.throwError('Unclosed (');\n }\n }\n\n /**\n * Responsible for parsing Array literals `[1, 2, 3]`\n * This function assumes that it needs to gobble the opening bracket\n * and then tries to gobble the expressions as arguments.\n * @returns {jsep.ArrayExpression}\n */\n gobbleArray() {\n this.index++;\n return {\n type: Jsep.ARRAY_EXP,\n elements: this.gobbleArguments(Jsep.CBRACK_CODE)\n };\n }\n}\n\n// Static fields:\nconst hooks = new Hooks();\nObject.assign(Jsep, {\n hooks,\n plugins: new Plugins(Jsep),\n // Node Types\n // ----------\n // This is the full set of types that any JSEP node can be.\n // Store them here to save space when minified\n COMPOUND: 'Compound',\n SEQUENCE_EXP: 'SequenceExpression',\n IDENTIFIER: 'Identifier',\n MEMBER_EXP: 'MemberExpression',\n LITERAL: 'Literal',\n THIS_EXP: 'ThisExpression',\n CALL_EXP: 'CallExpression',\n UNARY_EXP: 'UnaryExpression',\n BINARY_EXP: 'BinaryExpression',\n ARRAY_EXP: 'ArrayExpression',\n TAB_CODE: 9,\n LF_CODE: 10,\n CR_CODE: 13,\n SPACE_CODE: 32,\n PERIOD_CODE: 46,\n // '.'\n COMMA_CODE: 44,\n // ','\n SQUOTE_CODE: 39,\n // single quote\n DQUOTE_CODE: 34,\n // double quotes\n OPAREN_CODE: 40,\n // (\n CPAREN_CODE: 41,\n // )\n OBRACK_CODE: 91,\n // [\n CBRACK_CODE: 93,\n // ]\n QUMARK_CODE: 63,\n // ?\n SEMCOL_CODE: 59,\n // ;\n COLON_CODE: 58,\n // :\n\n // Operations\n // ----------\n // Use a quickly-accessible map to store all of the unary operators\n // Values are set to `1` (it really doesn't matter)\n unary_ops: {\n '-': 1,\n '!': 1,\n '~': 1,\n '+': 1\n },\n // Also use a map for the binary operations but set their values to their\n // binary precedence for quick reference (higher number = higher precedence)\n // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)\n binary_ops: {\n '||': 1,\n '??': 1,\n '&&': 2,\n '|': 3,\n '^': 4,\n '&': 5,\n '==': 6,\n '!=': 6,\n '===': 6,\n '!==': 6,\n '<': 7,\n '>': 7,\n '<=': 7,\n '>=': 7,\n '<<': 8,\n '>>': 8,\n '>>>': 8,\n '+': 9,\n '-': 9,\n '*': 10,\n '/': 10,\n '%': 10,\n '**': 11\n },\n // sets specific binary_ops as right-associative\n right_associative: new Set(['**']),\n // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)\n additional_identifier_chars: new Set(['$', '_']),\n // Literals\n // ----------\n // Store the values to return for the various literals we may encounter\n literals: {\n 'true': true,\n 'false': false,\n 'null': null\n },\n // Except for `this`, which is special. This could be changed to something like `'self'` as well\n this_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).filter(prop => !stdClassProps.includes(prop) && jsep[prop] === undefined).forEach(m => {\n jsep[m] = Jsep[m];\n});\njsep.Jsep = Jsep; // allows for const { Jsep } = require('jsep');\n\nconst CONDITIONAL_EXP = 'ConditionalExpression';\nvar ternary = {\n name: 'ternary',\n init(jsep) {\n // Ternary expression: test ? consequent : alternate\n jsep.hooks.add('after-expression', function gobbleTernary(env) {\n if (env.node && this.code === jsep.QUMARK_CODE) {\n this.index++;\n const test = env.node;\n const consequent = this.gobbleExpression();\n if (!consequent) {\n this.throwError('Expected expression');\n }\n this.gobbleSpaces();\n if (this.code === jsep.COLON_CODE) {\n this.index++;\n const alternate = this.gobbleExpression();\n if (!alternate) {\n this.throwError('Expected expression');\n }\n env.node = {\n type: CONDITIONAL_EXP,\n test,\n consequent,\n alternate\n };\n\n // check for operators of higher priority than ternary (i.e. assignment)\n // jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n if (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n let newTest = test;\n while (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n newTest = newTest.right;\n }\n env.node.test = newTest.right;\n newTest.right = env.node;\n env.node = test;\n }\n } else {\n this.throwError('Expected :');\n }\n }\n });\n }\n};\n\n// Add default plugins:\n\njsep.plugins.register(ternary);\n\nconst FSLASH_CODE = 47; // '/'\nconst BSLASH_CODE = 92; // '\\\\'\n\nvar index = {\n name: 'regex',\n init(jsep) {\n // Regex literal: /abc123/ig\n jsep.hooks.add('gobble-token', function gobbleRegexLiteral(env) {\n if (this.code === FSLASH_CODE) {\n const patternIndex = ++this.index;\n let inCharSet = false;\n while (this.index < this.expr.length) {\n if (this.code === FSLASH_CODE && !inCharSet) {\n const pattern = this.expr.slice(patternIndex, this.index);\n let flags = '';\n while (++this.index < this.expr.length) {\n const code = this.code;\n if (code >= 97 && code <= 122 // a...z\n || code >= 65 && code <= 90 // A...Z\n || code >= 48 && code <= 57) {\n // 0-9\n flags += this.char;\n } else {\n break;\n }\n }\n let value;\n try {\n value = new RegExp(pattern, flags);\n } catch (e) {\n this.throwError(e.message);\n }\n env.node = {\n type: jsep.LITERAL,\n value,\n raw: this.expr.slice(patternIndex - 1, this.index)\n };\n\n // allow . [] and () after regex: /regex/.test(a)\n env.node = this.gobbleTokenProperty(env.node);\n return env.node;\n }\n if (this.code === jsep.OBRACK_CODE) {\n inCharSet = true;\n } else if (inCharSet && this.code === jsep.CBRACK_CODE) {\n inCharSet = false;\n }\n this.index += this.code === BSLASH_CODE ? 2 : 1;\n }\n this.throwError('Unclosed Regex');\n }\n });\n }\n};\n\nconst PLUS_CODE = 43; // +\nconst MINUS_CODE = 45; // -\n\nconst plugin = {\n name: 'assignment',\n assignmentOperators: new Set(['=', '*=', '**=', '/=', '%=', '+=', '-=', '<<=', '>>=', '>>>=', '&=', '^=', '|=', '||=', '&&=', '??=']),\n updateOperators: [PLUS_CODE, MINUS_CODE],\n assignmentPrecedence: 0.9,\n init(jsep) {\n const updateNodeTypes = [jsep.IDENTIFIER, jsep.MEMBER_EXP];\n plugin.assignmentOperators.forEach(op => jsep.addBinaryOp(op, plugin.assignmentPrecedence, true));\n jsep.hooks.add('gobble-token', function gobbleUpdatePrefix(env) {\n const code = this.code;\n if (plugin.updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) {\n this.index += 2;\n env.node = {\n type: 'UpdateExpression',\n operator: code === PLUS_CODE ? '++' : '--',\n argument: this.gobbleTokenProperty(this.gobbleIdentifier()),\n prefix: true\n };\n if (!env.node.argument || !updateNodeTypes.includes(env.node.argument.type)) {\n this.throwError(`Unexpected ${env.node.operator}`);\n }\n }\n });\n jsep.hooks.add('after-token', function gobbleUpdatePostfix(env) {\n if (env.node) {\n const code = this.code;\n if (plugin.updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) {\n if (!updateNodeTypes.includes(env.node.type)) {\n this.throwError(`Unexpected ${env.node.operator}`);\n }\n this.index += 2;\n env.node = {\n type: 'UpdateExpression',\n operator: code === PLUS_CODE ? '++' : '--',\n argument: env.node,\n prefix: false\n };\n }\n }\n });\n jsep.hooks.add('after-expression', function gobbleAssignment(env) {\n if (env.node) {\n // Note: Binaries can be chained in a single expression to respect\n // operator precedence (i.e. a = b = 1 + 2 + 3)\n // Update all binary assignment nodes in the tree\n updateBinariesToAssignments(env.node);\n }\n });\n function updateBinariesToAssignments(node) {\n if (plugin.assignmentOperators.has(node.operator)) {\n node.type = 'AssignmentExpression';\n updateBinariesToAssignments(node.left);\n updateBinariesToAssignments(node.right);\n } else if (!node.operator) {\n Object.values(node).forEach(val => {\n if (val && typeof val === 'object') {\n updateBinariesToAssignments(val);\n }\n });\n }\n }\n }\n};\n\n/* eslint-disable no-bitwise -- Convenient */\n\n// register plugins\njsep.plugins.register(index, plugin);\njsep.addUnaryOp('typeof');\njsep.addUnaryOp('void');\njsep.addLiteral('null', null);\njsep.addLiteral('undefined', undefined);\nconst BLOCKED_PROTO_PROPERTIES = new Set(['constructor', '__proto__', '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__']);\nconst SafeEval = {\n /**\n * @param {jsep.Expression} ast\n * @param {Record} subs\n */\n evalAst(ast, subs) {\n switch (ast.type) {\n case 'BinaryExpression':\n case 'LogicalExpression':\n return SafeEval.evalBinaryExpression(ast, subs);\n case 'Compound':\n return SafeEval.evalCompound(ast, subs);\n case 'ConditionalExpression':\n return SafeEval.evalConditionalExpression(ast, subs);\n case 'Identifier':\n return SafeEval.evalIdentifier(ast, subs);\n case 'Literal':\n return SafeEval.evalLiteral(ast, subs);\n case 'MemberExpression':\n return SafeEval.evalMemberExpression(ast, subs);\n case 'UnaryExpression':\n return SafeEval.evalUnaryExpression(ast, subs);\n case 'ArrayExpression':\n return SafeEval.evalArrayExpression(ast, subs);\n case 'CallExpression':\n return SafeEval.evalCallExpression(ast, subs);\n case 'AssignmentExpression':\n return SafeEval.evalAssignmentExpression(ast, subs);\n default:\n throw SyntaxError('Unexpected expression', ast);\n }\n },\n evalBinaryExpression(ast, subs) {\n const result = {\n '||': (a, b) => a || b(),\n '&&': (a, b) => a && b(),\n '|': (a, b) => a | b(),\n '^': (a, b) => a ^ b(),\n '&': (a, b) => a & b(),\n // eslint-disable-next-line eqeqeq -- API\n '==': (a, b) => a == b(),\n // eslint-disable-next-line eqeqeq -- API\n '!=': (a, b) => a != b(),\n '===': (a, b) => a === b(),\n '!==': (a, b) => a !== b(),\n '<': (a, b) => a < b(),\n '>': (a, b) => a > b(),\n '<=': (a, b) => a <= b(),\n '>=': (a, b) => a >= b(),\n '<<': (a, b) => a << b(),\n '>>': (a, b) => a >> b(),\n '>>>': (a, b) => a >>> b(),\n '+': (a, b) => a + b(),\n '-': (a, b) => a - b(),\n '*': (a, b) => a * b(),\n '/': (a, b) => a / b(),\n '%': (a, b) => a % b()\n }[ast.operator](SafeEval.evalAst(ast.left, subs), () => SafeEval.evalAst(ast.right, subs));\n return result;\n },\n evalCompound(ast, subs) {\n let last;\n for (let i = 0; i < ast.body.length; i++) {\n if (ast.body[i].type === 'Identifier' && ['var', 'let', 'const'].includes(ast.body[i].name) && ast.body[i + 1] && ast.body[i + 1].type === 'AssignmentExpression') {\n // var x=2; is detected as\n // [{Identifier var}, {AssignmentExpression x=2}]\n // eslint-disable-next-line @stylistic/max-len -- Long\n // eslint-disable-next-line sonarjs/updated-loop-counter -- Convenient\n i += 1;\n }\n const expr = ast.body[i];\n last = SafeEval.evalAst(expr, subs);\n }\n return last;\n },\n evalConditionalExpression(ast, subs) {\n if (SafeEval.evalAst(ast.test, subs)) {\n return SafeEval.evalAst(ast.consequent, subs);\n }\n return SafeEval.evalAst(ast.alternate, subs);\n },\n evalIdentifier(ast, subs) {\n if (Object.hasOwn(subs, ast.name)) {\n return subs[ast.name];\n }\n throw ReferenceError(`${ast.name} is not defined`);\n },\n evalLiteral(ast) {\n return ast.value;\n },\n evalMemberExpression(ast, subs) {\n const prop = String(\n // NOTE: `String(value)` throws error when\n // value has overwritten the toString method to return non-string\n // i.e. `value = {toString: () => []}`\n ast.computed ? SafeEval.evalAst(ast.property) // `object[property]`\n : ast.property.name // `object.property` property is Identifier\n );\n const obj = SafeEval.evalAst(ast.object, subs);\n if (obj === undefined || obj === null) {\n throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);\n }\n if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {\n throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);\n }\n const result = obj[prop];\n if (typeof result === 'function') {\n return result.bind(obj); // arrow functions aren't affected by bind.\n }\n return result;\n },\n evalUnaryExpression(ast, subs) {\n const result = {\n '-': a => -SafeEval.evalAst(a, subs),\n '!': a => !SafeEval.evalAst(a, subs),\n '~': a => ~SafeEval.evalAst(a, subs),\n // eslint-disable-next-line no-implicit-coercion -- API\n '+': a => +SafeEval.evalAst(a, subs),\n typeof: a => typeof SafeEval.evalAst(a, subs),\n // eslint-disable-next-line no-void, sonarjs/void-use -- feature\n void: a => void SafeEval.evalAst(a, subs)\n }[ast.operator](ast.argument);\n return result;\n },\n evalArrayExpression(ast, subs) {\n return ast.elements.map(el => SafeEval.evalAst(el, subs));\n },\n evalCallExpression(ast, subs) {\n const args = ast.arguments.map(arg => SafeEval.evalAst(arg, subs));\n const func = SafeEval.evalAst(ast.callee, subs);\n /* c8 ignore start */\n if (func === Function) {\n // unreachable since BLOCKED_PROTO_PROPERTIES includes 'constructor'\n throw new Error('Function constructor is disabled');\n }\n /* c8 ignore end */\n return func(...args);\n },\n evalAssignmentExpression(ast, subs) {\n if (ast.left.type !== 'Identifier') {\n throw SyntaxError('Invalid left-hand side in assignment');\n }\n const id = ast.left.name;\n const value = SafeEval.evalAst(ast.right, subs);\n subs[id] = value;\n return subs[id];\n }\n};\n\n/**\n * A replacement for NodeJS' VM.Script which is also {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP | Content Security Policy} friendly.\n */\nclass SafeScript {\n /**\n * @param {string} expr Expression to evaluate\n */\n constructor(expr) {\n this.code = expr;\n this.ast = jsep(this.code);\n }\n\n /**\n * @param {object} context Object whose items will be added\n * to evaluation\n * @returns {EvaluatedResult} Result of evaluated code\n */\n runInNewContext(context) {\n // `Object.create(null)` creates a prototypeless object\n const keyMap = Object.assign(Object.create(null), context);\n return SafeEval.evalAst(this.ast, keyMap);\n }\n}\n\n/* eslint-disable camelcase -- Convenient for escaping */\n\n\n/**\n * @typedef {null|boolean|number|string|object|GenericArray} JSONObject\n */\n\n/**\n * @typedef {any} AnyItem\n */\n\n/**\n * @typedef {any} AnyResult\n */\n\n/**\n * Copies array and then pushes item into it.\n * @param {GenericArray} arr Array to copy and into which to push\n * @param {AnyItem} item Array item to add (to end)\n * @returns {GenericArray} Copy of the original array\n */\nfunction push(arr, item) {\n arr = arr.slice();\n arr.push(item);\n return arr;\n}\n/**\n * Copies array and then unshifts item into it.\n * @param {AnyItem} item Array item to add (to beginning)\n * @param {GenericArray} arr Array to copy and into which to unshift\n * @returns {GenericArray} Copy of the original array\n */\nfunction unshift(item, arr) {\n arr = arr.slice();\n arr.unshift(item);\n return arr;\n}\n\n/**\n * Caught when JSONPath is used without `new` but rethrown if with `new`\n * @extends Error\n */\nclass NewError extends Error {\n /**\n * @param {AnyResult} value The evaluated scalar value\n */\n constructor(value) {\n super('JSONPath should not be called with \"new\" (it prevents return ' + 'of (unwrapped) scalar values)');\n this.avoidNew = true;\n this.value = value;\n this.name = 'NewError';\n }\n}\n\n/**\n* @typedef {object} ReturnObject\n* @property {string} path\n* @property {JSONObject} value\n* @property {object|GenericArray} parent\n* @property {string} parentProperty\n*/\n\n/**\n* @callback JSONPathCallback\n* @param {string|object} preferredOutput\n* @param {\"value\"|\"property\"} type\n* @param {ReturnObject} fullRetObj\n* @returns {void}\n*/\n\n/**\n* @callback OtherTypeCallback\n* @param {JSONObject} val\n* @param {string} path\n* @param {object|GenericArray} parent\n* @param {string} parentPropName\n* @returns {boolean}\n*/\n\n/**\n * @typedef {any} ContextItem\n */\n\n/**\n * @typedef {any} EvaluatedResult\n */\n\n/**\n* @callback EvalCallback\n* @param {string} code\n* @param {ContextItem} context\n* @returns {EvaluatedResult}\n*/\n\n/**\n * @typedef {typeof SafeScript} EvalClass\n */\n\n/**\n * @typedef {object} JSONPathOptions\n * @property {JSON} json\n * @property {string|string[]} path\n * @property {\"value\"|\"path\"|\"pointer\"|\"parent\"|\"parentProperty\"|\n * \"all\"} [resultType=\"value\"]\n * @property {boolean} [flatten=false]\n * @property {boolean} [wrap=true]\n * @property {object} [sandbox={}]\n * @property {EvalCallback|EvalClass|'safe'|'native'|\n * boolean} [eval = 'safe']\n * @property {object|GenericArray|null} [parent=null]\n * @property {string|null} [parentProperty=null]\n * @property {JSONPathCallback} [callback]\n * @property {OtherTypeCallback} [otherTypeCallback] Defaults to\n * function which throws on encountering `@other`\n * @property {boolean} [autostart=true]\n */\n\n/**\n * @param {string|JSONPathOptions} opts If a string, will be treated as `expr`\n * @param {string} [expr] JSON path to evaluate\n * @param {JSON} [obj] JSON object to evaluate against\n * @param {JSONPathCallback} [callback] Passed 3 arguments: 1) desired payload\n * per `resultType`, 2) `\"value\"|\"property\"`, 3) Full returned object with\n * all payloads\n * @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the end\n * of one's query, this will be invoked with the value of the item, its\n * path, its parent, and its parent's property name, and it should return\n * a boolean indicating whether the supplied value belongs to the \"other\"\n * type or not (or it may handle transformations and return `false`).\n * @returns {JSONPath}\n * @class\n */\nfunction JSONPath(opts, expr, obj, callback, otherTypeCallback) {\n // eslint-disable-next-line no-restricted-syntax -- Allow for pseudo-class\n if (!(this instanceof JSONPath)) {\n try {\n return new JSONPath(opts, expr, obj, callback, otherTypeCallback);\n } catch (e) {\n if (!e.avoidNew) {\n throw e;\n }\n return e.value;\n }\n }\n if (typeof opts === 'string') {\n otherTypeCallback = callback;\n callback = obj;\n obj = expr;\n expr = opts;\n opts = null;\n }\n const optObj = opts && typeof opts === 'object';\n opts = opts || {};\n this.json = opts.json || obj;\n this.path = opts.path || expr;\n this.resultType = opts.resultType || 'value';\n this.flatten = opts.flatten || false;\n this.wrap = Object.hasOwn(opts, 'wrap') ? opts.wrap : true;\n this.sandbox = opts.sandbox || {};\n this.eval = opts.eval === undefined ? 'safe' : opts.eval;\n this.ignoreEvalErrors = typeof opts.ignoreEvalErrors === 'undefined' ? false : opts.ignoreEvalErrors;\n this.parent = opts.parent || null;\n this.parentProperty = opts.parentProperty || null;\n this.callback = opts.callback || callback || null;\n this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function () {\n throw new TypeError('You must supply an otherTypeCallback callback option ' + 'with the @other() operator.');\n };\n if (opts.autostart !== false) {\n const args = {\n path: optObj ? opts.path : expr\n };\n if (!optObj) {\n args.json = obj;\n } else if ('json' in opts) {\n args.json = opts.json;\n }\n const ret = this.evaluate(args);\n if (!ret || typeof ret !== 'object') {\n throw new NewError(ret);\n }\n return ret;\n }\n}\n\n// PUBLIC METHODS\nJSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {\n let currParent = this.parent,\n currParentProperty = this.parentProperty;\n let {\n flatten,\n wrap\n } = this;\n this.currResultType = this.resultType;\n this.currEval = this.eval;\n this.currSandbox = this.sandbox;\n callback = callback || this.callback;\n this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;\n json = json || this.json;\n expr = expr || this.path;\n if (expr && typeof expr === 'object' && !Array.isArray(expr)) {\n if (!expr.path && expr.path !== '') {\n throw new TypeError('You must supply a \"path\" property when providing an object ' + 'argument to JSONPath.evaluate().');\n }\n if (!Object.hasOwn(expr, 'json')) {\n throw new TypeError('You must supply a \"json\" property when providing an object ' + 'argument to JSONPath.evaluate().');\n }\n ({\n json\n } = expr);\n flatten = Object.hasOwn(expr, 'flatten') ? expr.flatten : flatten;\n this.currResultType = Object.hasOwn(expr, 'resultType') ? expr.resultType : this.currResultType;\n this.currSandbox = Object.hasOwn(expr, 'sandbox') ? expr.sandbox : this.currSandbox;\n wrap = Object.hasOwn(expr, 'wrap') ? expr.wrap : wrap;\n this.currEval = Object.hasOwn(expr, 'eval') ? expr.eval : this.currEval;\n callback = Object.hasOwn(expr, 'callback') ? expr.callback : callback;\n this.currOtherTypeCallback = Object.hasOwn(expr, 'otherTypeCallback') ? expr.otherTypeCallback : this.currOtherTypeCallback;\n currParent = Object.hasOwn(expr, 'parent') ? expr.parent : currParent;\n currParentProperty = Object.hasOwn(expr, 'parentProperty') ? expr.parentProperty : currParentProperty;\n expr = expr.path;\n }\n currParent = currParent || null;\n currParentProperty = currParentProperty || null;\n if (Array.isArray(expr)) {\n expr = JSONPath.toPathString(expr);\n }\n if (!expr && expr !== '' || !json) {\n return undefined;\n }\n const exprList = JSONPath.toPathArray(expr);\n if (exprList[0] === '$' && exprList.length > 1) {\n exprList.shift();\n }\n this._hasParentSelector = null;\n const result = this._trace(exprList, json, ['$'], currParent, currParentProperty, callback).filter(function (ea) {\n return ea && !ea.isParentSelector;\n });\n if (!result.length) {\n return wrap ? [] : undefined;\n }\n if (!wrap && result.length === 1 && !result[0].hasArrExpr) {\n return this._getPreferredOutput(result[0]);\n }\n return result.reduce((rslt, ea) => {\n const valOrPath = this._getPreferredOutput(ea);\n if (flatten && Array.isArray(valOrPath)) {\n rslt = rslt.concat(valOrPath);\n } else {\n rslt.push(valOrPath);\n }\n return rslt;\n }, []);\n};\n\n// PRIVATE METHODS\n\nJSONPath.prototype._getPreferredOutput = function (ea) {\n const resultType = this.currResultType;\n switch (resultType) {\n case 'all':\n {\n const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);\n ea.pointer = JSONPath.toPointer(path);\n ea.path = typeof ea.path === 'string' ? ea.path : JSONPath.toPathString(ea.path);\n return ea;\n }\n case 'value':\n case 'parent':\n case 'parentProperty':\n return ea[resultType];\n case 'path':\n return JSONPath.toPathString(ea[resultType]);\n case 'pointer':\n return JSONPath.toPointer(ea.path);\n default:\n throw new TypeError('Unknown result type');\n }\n};\nJSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {\n if (callback) {\n const preferredOutput = this._getPreferredOutput(fullRetObj);\n fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path);\n // eslint-disable-next-line n/callback-return -- No need to return\n callback(preferredOutput, type, fullRetObj);\n }\n};\n\n/**\n *\n * @param {string} expr\n * @param {JSONObject} val\n * @param {string} path\n * @param {object|GenericArray} parent\n * @param {string} parentPropName\n * @param {JSONPathCallback} callback\n * @param {boolean} hasArrExpr\n * @param {boolean} literalPriority\n * @returns {ReturnObject|ReturnObject[]}\n */\nJSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {\n // No expr to follow? return path and value as the result of\n // this trace branch\n let retObj;\n if (!expr.length) {\n retObj = {\n path,\n value: val,\n parent,\n parentProperty: parentPropName,\n hasArrExpr\n };\n this._handleCallback(retObj, callback, 'value');\n return retObj;\n }\n const loc = expr[0],\n x = expr.slice(1);\n\n // We need to gather the return value of recursive trace calls in order to\n // do the parent sel computation.\n const ret = [];\n /**\n *\n * @param {ReturnObject|ReturnObject[]} elems\n * @returns {void}\n */\n function addRet(elems) {\n if (Array.isArray(elems)) {\n // This was causing excessive stack size in Node (with or\n // without Babel) against our performance test:\n // `ret.push(...elems);`\n elems.forEach(t => {\n ret.push(t);\n });\n } else {\n ret.push(elems);\n }\n }\n if ((typeof loc !== 'string' || literalPriority) && val && Object.hasOwn(val, loc)) {\n // simple case--directly follow property\n addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr));\n // eslint-disable-next-line unicorn/prefer-switch -- Part of larger `if`\n } else if (loc === '*') {\n // all child properties\n this._walk(val, m => {\n addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));\n });\n } else if (loc === '..') {\n // all descendent parent properties\n // Check remaining expression with val's immediate children\n addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));\n this._walk(val, m => {\n // We don't join m and x here because we only want parents,\n // not scalar values\n if (typeof val[m] === 'object') {\n // Keep going with recursive descent on val's\n // object children\n addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));\n }\n });\n // The parent sel computation is handled in the frame above using the\n // ancestor object of val\n } else if (loc === '^') {\n // This is not a final endpoint, so we do not invoke the callback here\n this._hasParentSelector = true;\n return {\n path: path.slice(0, -1),\n expr: x,\n isParentSelector: true\n };\n } else if (loc === '~') {\n // property name\n retObj = {\n path: push(path, loc),\n value: parentPropName,\n parent,\n parentProperty: null\n };\n this._handleCallback(retObj, callback, 'property');\n return retObj;\n } else if (loc === '$') {\n // root only\n addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));\n } else if (/^(-?\\d*):(-?\\d*):?(\\d*)$/u.test(loc)) {\n // [start:end:step] Python slice syntax\n addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));\n } else if (loc.indexOf('?(') === 0) {\n // [?(expr)] (filtering)\n if (this.currEval === false) {\n throw new Error('Eval [?(expr)] prevented in JSONPath expression.');\n }\n const safeLoc = loc.replace(/^\\?\\((.*?)\\)$/u, '$1');\n // check for a nested filter expression\n const nested = /@.?([^?]*)[['](\\??\\(.*?\\))(?!.\\)\\])[\\]']/gu.exec(safeLoc);\n if (nested) {\n // find if there are matches in the nested expression\n // add them to the result set if there is at least one match\n this._walk(val, m => {\n const npath = [nested[2]];\n const nvalue = nested[1] ? val[m][nested[1]] : val[m];\n const filterResults = this._trace(npath, nvalue, path, parent, parentPropName, callback, true);\n if (filterResults.length > 0) {\n addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));\n }\n });\n } else {\n this._walk(val, m => {\n if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) {\n addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));\n }\n });\n }\n } else if (loc[0] === '(') {\n // [(expr)] (dynamic property/index)\n if (this.currEval === false) {\n throw new Error('Eval [(expr)] prevented in JSONPath expression.');\n }\n // As this will resolve to a property name (but we don't know it\n // yet), property and parent information is relative to the\n // parent of the property to which this expression will resolve\n addRet(this._trace(unshift(this._eval(loc, val, path.at(-1), path.slice(0, -1), parent, parentPropName), x), val, path, parent, parentPropName, callback, hasArrExpr));\n } else if (loc[0] === '@') {\n // value type: @boolean(), etc.\n let addType = false;\n const valueType = loc.slice(1, -2);\n switch (valueType) {\n case 'scalar':\n if (!val || !['object', 'function'].includes(typeof val)) {\n addType = true;\n }\n break;\n case 'boolean':\n case 'string':\n case 'undefined':\n case 'function':\n if (typeof val === valueType) {\n addType = true;\n }\n break;\n case 'integer':\n if (Number.isFinite(val) && !(val % 1)) {\n addType = true;\n }\n break;\n case 'number':\n if (Number.isFinite(val)) {\n addType = true;\n }\n break;\n case 'nonFinite':\n if (typeof val === 'number' && !Number.isFinite(val)) {\n addType = true;\n }\n break;\n case 'object':\n if (val && typeof val === valueType) {\n addType = true;\n }\n break;\n case 'array':\n if (Array.isArray(val)) {\n addType = true;\n }\n break;\n case 'other':\n addType = this.currOtherTypeCallback(val, path, parent, parentPropName);\n break;\n case 'null':\n if (val === null) {\n addType = true;\n }\n break;\n /* c8 ignore next 2 */\n default:\n throw new TypeError('Unknown value type ' + valueType);\n }\n if (addType) {\n retObj = {\n path,\n value: val,\n parent,\n parentProperty: parentPropName\n };\n this._handleCallback(retObj, callback, 'value');\n return retObj;\n }\n // `-escaped property\n } else if (loc[0] === '`' && val && Object.hasOwn(val, loc.slice(1))) {\n const locProp = loc.slice(1);\n addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));\n } else if (loc.includes(',')) {\n // [name1,name2,...]\n const parts = loc.split(',');\n for (const part of parts) {\n addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));\n }\n // simple case--directly follow property\n } else if (!literalPriority && val && Object.hasOwn(val, loc)) {\n addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));\n }\n\n // We check the resulting values for parent selections. For parent\n // selections we discard the value object and continue the trace with the\n // current val object\n if (this._hasParentSelector) {\n for (let t = 0; t < ret.length; t++) {\n const rett = ret[t];\n if (rett && rett.isParentSelector) {\n const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);\n if (Array.isArray(tmp)) {\n ret[t] = tmp[0];\n const tl = tmp.length;\n for (let tt = 1; tt < tl; tt++) {\n // eslint-disable-next-line @stylistic/max-len -- Long\n // eslint-disable-next-line sonarjs/updated-loop-counter -- Convenient\n t++;\n ret.splice(t, 0, tmp[tt]);\n }\n } else {\n ret[t] = tmp;\n }\n }\n }\n }\n return ret;\n};\nJSONPath.prototype._walk = function (val, f) {\n if (Array.isArray(val)) {\n const n = val.length;\n for (let i = 0; i < n; i++) {\n f(i);\n }\n } else if (val && typeof val === 'object') {\n Object.keys(val).forEach(m => {\n f(m);\n });\n }\n};\nJSONPath.prototype._slice = function (loc, expr, val, path, parent, parentPropName, callback) {\n if (!Array.isArray(val)) {\n return undefined;\n }\n const len = val.length,\n parts = loc.split(':'),\n step = parts[2] && Number.parseInt(parts[2]) || 1;\n let start = parts[0] && Number.parseInt(parts[0]) || 0,\n end = parts[1] && Number.parseInt(parts[1]) || len;\n start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);\n end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);\n const ret = [];\n for (let i = start; i < end; i += step) {\n const tmp = this._trace(unshift(i, expr), val, path, parent, parentPropName, callback, true);\n // Should only be possible to be an array here since first part of\n // ``unshift(i, expr)` passed in above would not be empty, nor `~`,\n // nor begin with `@` (as could return objects)\n // This was causing excessive stack size in Node (with or\n // without Babel) against our performance test: `ret.push(...tmp);`\n tmp.forEach(t => {\n ret.push(t);\n });\n }\n return ret;\n};\nJSONPath.prototype._eval = function (code, _v, _vname, path, parent, parentPropName) {\n this.currSandbox._$_parentProperty = parentPropName;\n this.currSandbox._$_parent = parent;\n this.currSandbox._$_property = _vname;\n this.currSandbox._$_root = this.json;\n this.currSandbox._$_v = _v;\n const containsPath = code.includes('@path');\n if (containsPath) {\n this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));\n }\n const scriptCacheKey = this.currEval + 'Script:' + code;\n if (!JSONPath.cache[scriptCacheKey]) {\n let script = code.replaceAll('@parentProperty', '_$_parentProperty').replaceAll('@parent', '_$_parent').replaceAll('@property', '_$_property').replaceAll('@root', '_$_root').replaceAll(/@([.\\s)[])/gu, '_$_v$1');\n if (containsPath) {\n script = script.replaceAll('@path', '_$_path');\n }\n if (this.currEval === 'safe' || this.currEval === true || this.currEval === undefined) {\n JSONPath.cache[scriptCacheKey] = new this.safeVm.Script(script);\n } else if (this.currEval === 'native') {\n JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);\n } else if (typeof this.currEval === 'function' && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, 'runInNewContext')) {\n const CurrEval = this.currEval;\n JSONPath.cache[scriptCacheKey] = new CurrEval(script);\n } else if (typeof this.currEval === 'function') {\n JSONPath.cache[scriptCacheKey] = {\n runInNewContext: context => this.currEval(script, context)\n };\n } else {\n throw new TypeError(`Unknown \"eval\" property \"${this.currEval}\"`);\n }\n }\n try {\n return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);\n } catch (e) {\n if (this.ignoreEvalErrors) {\n return false;\n }\n throw new Error('jsonPath: ' + e.message + ': ' + code);\n }\n};\n\n// PUBLIC CLASS PROPERTIES AND METHODS\n\n// Could store the cache object itself\nJSONPath.cache = {};\n\n/**\n * @param {string[]} pathArr Array to convert\n * @returns {string} The path string\n */\nJSONPath.toPathString = function (pathArr) {\n const x = pathArr,\n n = x.length;\n let p = '$';\n for (let i = 1; i < n; i++) {\n if (!/^(~|\\^|@.*?\\(\\))$/u.test(x[i])) {\n p += /^[0-9*]+$/u.test(x[i]) ? '[' + x[i] + ']' : \"['\" + x[i] + \"']\";\n }\n }\n return p;\n};\n\n/**\n * @param {string} pointer JSON Path\n * @returns {string} JSON Pointer\n */\nJSONPath.toPointer = function (pointer) {\n const x = pointer,\n n = x.length;\n let p = '';\n for (let i = 1; i < n; i++) {\n if (!/^(~|\\^|@.*?\\(\\))$/u.test(x[i])) {\n p += '/' + x[i].toString().replaceAll('~', '~0').replaceAll('/', '~1');\n }\n }\n return p;\n};\n\n/**\n * @param {string} expr Expression to convert\n * @returns {string[]}\n */\nJSONPath.toPathArray = function (expr) {\n const {\n cache\n } = JSONPath;\n if (cache[expr]) {\n return cache[expr].concat();\n }\n const subx = [];\n const normalized = expr\n // Properties\n .replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\\(\\)/gu, ';$&;')\n // Parenthetical evaluations (filtering and otherwise), directly\n // within brackets or single quotes\n .replaceAll(/[['](\\??\\(.*?\\))[\\]'](?!.\\])/gu, function ($0, $1) {\n return '[#' + (subx.push($1) - 1) + ']';\n })\n // Escape periods and tildes within properties\n .replaceAll(/\\[['\"]([^'\\]]*)['\"]\\]/gu, function ($0, prop) {\n return \"['\" + prop.replaceAll('.', '%@%').replaceAll('~', '%%@@%%') + \"']\";\n })\n // Properties operator\n .replaceAll('~', ';~;')\n // Split by property boundaries\n .replaceAll(/['\"]?\\.['\"]?(?![^[]*\\])|\\[['\"]?/gu, ';')\n // Reinsert periods within properties\n .replaceAll('%@%', '.')\n // Reinsert tildes within properties\n .replaceAll('%%@@%%', '~')\n // Parent\n .replaceAll(/(?:;)?(\\^+)(?:;)?/gu, function ($0, ups) {\n return ';' + ups.split('').join(';') + ';';\n })\n // Descendents\n .replaceAll(/;;;|;;/gu, ';..;')\n // Remove trailing\n .replaceAll(/;$|'?\\]|'$/gu, '');\n const exprList = normalized.split(';').map(function (exp) {\n const match = exp.match(/#(\\d+)/u);\n return !match || !match[1] ? exp : subx[match[1]];\n });\n cache[expr] = exprList;\n return cache[expr].concat();\n};\nJSONPath.prototype.safeVm = {\n Script: SafeScript\n};\n\n/**\n * @typedef {any} ContextItem\n */\n\n/**\n * @typedef {any} EvaluatedResult\n */\n\n/**\n * @callback ConditionCallback\n * @param {ContextItem} item\n * @returns {boolean}\n */\n\n/**\n * Copy items out of one array into another.\n * @param {GenericArray} source Array with items to copy\n * @param {GenericArray} target Array to which to copy\n * @param {ConditionCallback} conditionCb Callback passed the current item;\n * will move item if evaluates to `true`\n * @returns {void}\n */\nconst moveToAnotherArray = function (source, target, conditionCb) {\n const il = source.length;\n for (let i = 0; i < il; i++) {\n const item = source[i];\n if (conditionCb(item)) {\n // eslint-disable-next-line @stylistic/max-len -- Long\n // eslint-disable-next-line sonarjs/updated-loop-counter -- Convenient\n target.push(source.splice(i--, 1)[0]);\n }\n }\n};\n\n/**\n * In-browser replacement for NodeJS' VM.Script.\n */\nclass Script {\n /**\n * @param {string} expr Expression to evaluate\n */\n constructor(expr) {\n this.code = expr;\n }\n\n /**\n * @param {object} context Object whose items will be added\n * to evaluation\n * @returns {EvaluatedResult} Result of evaluated code\n */\n runInNewContext(context) {\n let expr = this.code;\n const keys = Object.keys(context);\n const funcs = [];\n moveToAnotherArray(keys, funcs, key => {\n return typeof context[key] === 'function';\n });\n const values = keys.map(vr => {\n return context[vr];\n });\n const funcString = funcs.reduce((s, func) => {\n let fString = context[func].toString();\n if (!/function/u.test(fString)) {\n fString = 'function ' + fString;\n }\n return 'var ' + func + '=' + fString + ';' + s;\n }, '');\n expr = funcString + expr;\n\n // Mitigate http://perfectionkills.com/global-eval-what-are-the-options/#new_function\n if (!/(['\"])use strict\\1/u.test(expr) && !keys.includes('arguments')) {\n expr = 'var arguments = undefined;' + expr;\n }\n\n // Remove last semi so `return` will be inserted before\n // the previous one instead, allowing for the return\n // of a bare ending expression\n expr = expr.replace(/;\\s*$/u, '');\n\n // Insert `return`\n const lastStatementEnd = expr.lastIndexOf(';');\n const code = lastStatementEnd !== -1 ? expr.slice(0, lastStatementEnd + 1) + ' return ' + expr.slice(lastStatementEnd + 1) : ' return ' + expr;\n\n // eslint-disable-next-line no-new-func -- User's choice\n return new Function(...keys, code)(...values);\n }\n}\nJSONPath.prototype.vm = {\n Script\n};\n\nexport { JSONPath };\n"], "mappings": "AAGA,MAAMA,CAAM,CAmBV,IAAIC,EAAMC,EAAUC,EAAO,CACzB,GAAI,OAAO,UAAU,CAAC,GAAK,SAEzB,QAASF,KAAQ,UAAU,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wJ,EAAM,OAAO,CAACI,EAAGpF,IAAS,CAC3C,IAAIqF,EAAUlF,EAAQH,CAAI,EAAE,SAAS,EACrC,MAAK,YAAY,KAAKqF,CAAO,IAC3BA,EAAU,YAAcA,GAEnB,OAASrF,EAAO,IAAMqF,EAAU,IAAMD,CAC/C,EAAG,EAAE,EACe5J,EAGhB,CAAC,sBAAsB,KAAKA,CAAI,GAAK,CAACuJ,EAAK,SAAS,WAAW,IACjEvJ,EAAO,6BAA+BA,GAMxCA,EAAOA,EAAK,QAAQ,SAAU,EAAE,EAGhC,MAAM8J,EAAmB9J,EAAK,YAAY,GAAG,EACvCqD,EAAOyG,IAAqB,GAAK9J,EAAK,MAAM,EAAG8J,EAAmB,CAAC,EAAI,WAAa9J,EAAK,MAAM8J,EAAmB,CAAC,EAAI,WAAa9J,EAG1I,OAAO,IAAI,SAAS,GAAGuJ,EAAMlG,CAAI,EAAE,GAAGqG,CAAM,CAC9C,CACF,CACAxE,EAAS,UAAU,GAAK,CACtB,OAAAoE,CACF", "names": ["Hooks", "name", "callback", "first", "env", "Plugins", "jsep", "_len", "plugins", "_key", "plugin", "Jsep", "op_name", "precedence", "isRightAssociative", "char", "literal_name", "literal_value", "expr", "obj", "k", "ch", "op_val", "message", "error", "node", "nodes", "untilICode", "ch_i", "to_check", "tc_len", "biop", "prec", "stack", "biop_info", "left", "right", "i", "cur_biop", "comparePrev", "prev", "argument", "optional", "number", "chCode", "str", "startIndex", "quote", "closed", "start", "termination", "args", "separator_count", "arg", "hooks", "stdClassProps", "prop", "m", "CONDITIONAL_EXP", "ternary", "test", "consequent", "alternate", "newTest", "FSLASH_CODE", "BSLASH_CODE", "index", "patternIndex", "inCharSet", "pattern", "flags", "code", "value", "e", "PLUS_CODE", "MINUS_CODE", "updateNodeTypes", "op", "c", "updateBinariesToAssignments", "val", "BLOCKED_PROTO_PROPERTIES", "SafeEval", "ast", "subs", "a", "b", "last", "result", "el", "func", "id", "SafeScript", "context", "keyMap", "push", "arr", "item", "unshift", "NewError", "JSONPath", "opts", "otherTypeCallback", "optObj", "ret", "json", "currParent", "currParentProperty", "flatten", "wrap", "exprList", "ea", "rslt", "valOrPath", "resultType", "path", "fullRetObj", "type", "preferredOutput", "parent", "parentPropName", "hasArrExpr", "literalPriority", "retObj", "loc", "x", "addRet", "elems", "t", "safeLoc", "nested", "npath", "nvalue", "addType", "valueType", "locProp", "parts", "part", "rett", "tmp", "tl", "tt", "f", "n", "len", "step", "end", "_v", "_vname", "containsPath", "scriptCacheKey", "script", "CurrEval", "pathArr", "p", "pointer", "cache", "subx", "$0", "$1", "ups", "exp", "match", "moveToAnotherArray", "source", "target", "conditionCb", "il", "Script", "keys", "funcs", "key", "values", "vr", "s", "fString", "lastStatementEnd"] }