{"version":3,"file":"index-browser-umd.min.cjs","sources":["../src/jsonpath.js","../src/jsonpath-browser.js"],"sourcesContent":["const {hasOwnProperty: hasOwnProp} = Object.prototype;\n\n/**\n * @typedef {null|boolean|number|string|PlainObject|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(\n 'JSONPath should not be called with \"new\" (it prevents return ' +\n 'of (unwrapped) scalar values)'\n );\n this.avoidNew = true;\n this.value = value;\n this.name = 'NewError';\n }\n}\n\n/**\n* @typedef {PlainObject} ReturnObject\n* @property {string} path\n* @property {JSONObject} value\n* @property {PlainObject|GenericArray} parent\n* @property {string} parentProperty\n*/\n\n/**\n* @callback JSONPathCallback\n* @param {string|PlainObject} 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 {PlainObject|GenericArray} parent\n* @param {string} parentPropName\n* @returns {boolean}\n*/\n\n/* eslint-disable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */\n/**\n * @typedef {PlainObject} JSONPathOptions\n * @property {JSON} json\n * @property {string|string[]} path\n * @property {\"value\"|\"path\"|\"pointer\"|\"parent\"|\"parentProperty\"|\"all\"} [resultType=\"value\"]\n * @property {boolean} [flatten=false]\n * @property {boolean} [wrap=true]\n * @property {PlainObject} [sandbox={}]\n * @property {boolean} [preventEval=false]\n * @property {PlainObject|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/* eslint-enable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */\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\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\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 = hasOwnProp.call(opts, 'wrap') ? opts.wrap : true;\n this.sandbox = opts.sandbox || {};\n this.preventEval = opts.preventEval || false;\n this.parent = opts.parent || null;\n this.parentProperty = opts.parentProperty || null;\n this.callback = opts.callback || callback || null;\n this.otherTypeCallback = opts.otherTypeCallback ||\n otherTypeCallback ||\n function () {\n throw new TypeError(\n 'You must supply an otherTypeCallback callback option ' +\n 'with the @other() operator.'\n );\n };\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 (\n expr, json, callback, otherTypeCallback\n) {\n let currParent = this.parent,\n currParentProperty = this.parentProperty;\n let {flatten, wrap} = this;\n\n this.currResultType = this.resultType;\n this.currPreventEval = this.preventEval;\n this.currSandbox = this.sandbox;\n callback = callback || this.callback;\n this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;\n\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(\n 'You must supply a \"path\" property when providing an object ' +\n 'argument to JSONPath.evaluate().'\n );\n }\n if (!(hasOwnProp.call(expr, 'json'))) {\n throw new TypeError(\n 'You must supply a \"json\" property when providing an object ' +\n 'argument to JSONPath.evaluate().'\n );\n }\n ({json} = expr);\n flatten = hasOwnProp.call(expr, 'flatten') ? expr.flatten : flatten;\n this.currResultType = hasOwnProp.call(expr, 'resultType')\n ? expr.resultType\n : this.currResultType;\n this.currSandbox = hasOwnProp.call(expr, 'sandbox')\n ? expr.sandbox\n : this.currSandbox;\n wrap = hasOwnProp.call(expr, 'wrap') ? expr.wrap : wrap;\n this.currPreventEval = hasOwnProp.call(expr, 'preventEval')\n ? expr.preventEval\n : this.currPreventEval;\n callback = hasOwnProp.call(expr, 'callback') ? expr.callback : callback;\n this.currOtherTypeCallback = hasOwnProp.call(expr, 'otherTypeCallback')\n ? expr.otherTypeCallback\n : this.currOtherTypeCallback;\n currParent = hasOwnProp.call(expr, 'parent') ? expr.parent : currParent;\n currParentProperty = hasOwnProp.call(expr, 'parentProperty')\n ? expr.parentProperty\n : currParentProperty;\n expr = expr.path;\n }\n currParent = currParent || null;\n currParentProperty = currParentProperty || null;\n\n if (Array.isArray(expr)) {\n expr = JSONPath.toPathString(expr);\n }\n if ((!expr && expr !== '') || !json) {\n return undefined;\n }\n\n const exprList = JSONPath.toPathArray(expr);\n if (exprList[0] === '$' && exprList.length > 1) { exprList.shift(); }\n this._hasParentSelector = null;\n const result = this\n ._trace(\n exprList, json, ['$'], currParent, currParentProperty, callback\n )\n .filter(function (ea) { return ea && !ea.isParentSelector; });\n\n if (!result.length) { return wrap ? [] : undefined; }\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 const path = Array.isArray(ea.path)\n ? ea.path\n : JSONPath.toPathArray(ea.path);\n ea.pointer = JSONPath.toPointer(path);\n ea.path = typeof ea.path === 'string'\n ? ea.path\n : JSONPath.toPathString(ea.path);\n return ea;\n } case 'value': case 'parent': 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};\n\nJSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {\n if (callback) {\n const preferredOutput = this._getPreferredOutput(fullRetObj);\n fullRetObj.path = typeof fullRetObj.path === 'string'\n ? fullRetObj.path\n : JSONPath.toPathString(fullRetObj.path);\n // eslint-disable-next-line n/callback-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 {PlainObject|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 (\n expr, val, path, parent, parentPropName, callback, hasArrExpr,\n literalPriority\n) {\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\n const loc = expr[0], 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 &&\n hasOwnProp.call(val, loc)\n ) { // simple case--directly follow property\n addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback,\n hasArrExpr));\n // eslint-disable-next-line unicorn/prefer-switch -- Part of larger `if`\n } else if (loc === '*') { // all child properties\n this._walk(val, (m) => {\n addRet(this._trace(\n x, val[m], push(path, m), val, m, callback, true, true\n ));\n });\n } else if (loc === '..') { // all descendent parent properties\n // Check remaining expression with val's immediate children\n addRet(\n this._trace(x, val, path, parent, parentPropName, callback,\n hasArrExpr)\n );\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(\n expr.slice(), val[m], push(path, m), val, m, callback, true\n ));\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 === '~') { // 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 === '$') { // root only\n addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));\n } else if ((/^(-?\\d*):(-?\\d*):?(\\d*)$/u).test(loc)) { // [start:end:step] Python slice syntax\n addRet(\n this._slice(loc, x, val, path, parent, parentPropName, callback)\n );\n } else if (loc.indexOf('?(') === 0) { // [?(expr)] (filtering)\n if (this.currPreventEval) {\n throw new Error('Eval [?(expr)] prevented in JSONPath expression.');\n }\n const safeLoc = loc.replace(/^\\?\\((.*?)\\)$/u, '$1');\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,\n true));\n }\n });\n } else if (loc[0] === '(') { // [(expr)] (dynamic property/index)\n if (this.currPreventEval) {\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(\n this._eval(\n loc, val, path[path.length - 1],\n path.slice(0, -1), parent, parentPropName\n ),\n x\n ), val, path, parent, parentPropName, callback, hasArrExpr));\n } else if (loc[0] === '@') { // 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': case 'string': case 'undefined': case 'function':\n // eslint-disable-next-line valid-typeof\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 // eslint-disable-next-line valid-typeof\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(\n val, path, parent, parentPropName\n );\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 = {path, value: val, parent, parentProperty: parentPropName};\n this._handleCallback(retObj, callback, 'value');\n return retObj;\n }\n // `-escaped property\n } else if (loc[0] === '`' && val && hasOwnProp.call(val, loc.slice(1))) {\n const locProp = loc.slice(1);\n addRet(this._trace(\n x, val[locProp], push(path, locProp), val, locProp, callback,\n hasArrExpr, true\n ));\n } else if (loc.includes(',')) { // [name1,name2,...]\n const parts = loc.split(',');\n for (const part of parts) {\n addRet(this._trace(\n unshift(part, x), val, path, parent, parentPropName, callback,\n true\n ));\n }\n // simple case--directly follow property\n } else if (\n !literalPriority && val && hasOwnProp.call(val, loc)\n ) {\n addRet(\n this._trace(x, val[loc], push(path, loc), val, loc, callback,\n hasArrExpr, true)\n );\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(\n rett.expr, val, rett.path, parent, parentPropName, callback,\n hasArrExpr\n );\n if (Array.isArray(tmp)) {\n ret[t] = tmp[0];\n const tl = tmp.length;\n for (let tt = 1; tt < tl; tt++) {\n t++;\n ret.splice(t, 0, tmp[tt]);\n }\n } else {\n ret[t] = tmp;\n }\n }\n }\n }\n return ret;\n};\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};\n\nJSONPath.prototype._slice = function (\n loc, expr, val, path, parent, parentPropName, callback\n) {\n if (!Array.isArray(val)) { return undefined; }\n const len = val.length, 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(\n unshift(i, expr), val, path, parent, parentPropName, callback, true\n );\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};\n\nJSONPath.prototype._eval = function (\n code, _v, _vname, path, parent, parentPropName\n) {\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\n const containsPath = code.includes('@path');\n if (containsPath) {\n this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));\n }\n\n const scriptCacheKey = 'script:' + code;\n if (!JSONPath.cache[scriptCacheKey]) {\n let script = code\n .replace(/@parentProperty/gu, '_$_parentProperty')\n .replace(/@parent/gu, '_$_parent')\n .replace(/@property/gu, '_$_property')\n .replace(/@root/gu, '_$_root')\n .replace(/@([.\\s)[])/gu, '_$_v$1');\n if (containsPath) {\n script = script.replace(/@path/gu, '_$_path');\n }\n\n JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);\n }\n\n try {\n return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);\n } catch (e) {\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 = 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 = x.length;\n let p = '';\n for (let i = 1; i < n; i++) {\n if (!(/^(~|\\^|@.*?\\(\\))$/u).test(x[i])) {\n p += '/' + x[i].toString()\n .replace(/~/gu, '~0')\n .replace(/\\//gu, '~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 {cache} = JSONPath;\n if (cache[expr]) { return cache[expr].concat(); }\n const subx = [];\n const normalized = expr\n // Properties\n .replace(\n /@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\\(\\)/gu,\n ';$&;'\n )\n // Parenthetical evaluations (filtering and otherwise), directly\n // within brackets or single quotes\n .replace(/[['](\\??\\(.*?\\))[\\]']/gu, function ($0, $1) {\n return '[#' + (subx.push($1) - 1) + ']';\n })\n // Escape periods and tildes within properties\n .replace(/\\[['\"]([^'\\]]*)['\"]\\]/gu, function ($0, prop) {\n return \"['\" + prop\n .replace(/\\./gu, '%@%')\n .replace(/~/gu, '%%@@%%') +\n \"']\";\n })\n // Properties operator\n .replace(/~/gu, ';~;')\n // Split by property boundaries\n .replace(/['\"]?\\.['\"]?(?![^[]*\\])|\\[['\"]?/gu, ';')\n // Reinsert periods within properties\n .replace(/%@%/gu, '.')\n // Reinsert tildes within properties\n .replace(/%%@@%%/gu, '~')\n // Parent\n .replace(/(?:;)?(\\^+)(?:;)?/gu, function ($0, ups) {\n return ';' + ups.split('').join(';') + ';';\n })\n // Descendents\n .replace(/;;;|;;/gu, ';..;')\n // Remove trailing\n .replace(/;$|'?\\]|'$/gu, '');\n\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};\n\nexport {JSONPath};\n","import {JSONPath} from './jsonpath.js';\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 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 {PlainObject} 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, i) => {\n return context[vr];\n });\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\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) &&\n !keys.includes('arguments')\n ) {\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\n ? expr.slice(0, lastStatementEnd + 1) +\n ' return ' + expr.slice(lastStatementEnd + 1)\n : ' return ' + expr);\n\n // eslint-disable-next-line no-new-func\n return (new Function(...keys, code))(...values);\n }\n}\n\nJSONPath.prototype.vm = {\n Script\n};\n\nexport {JSONPath};\n"],"names":["hasOwnProp","Object","prototype","hasOwnProperty","push","arr","item","slice","unshift","NewError","value","_this","_classCallCheck","this","_super","call","avoidNew","name","Error","JSONPath","opts","expr","obj","callback","otherTypeCallback","e","optObj","_typeof","json","path","resultType","flatten","wrap","sandbox","preventEval","parent","parentProperty","TypeError","autostart","args","ret","evaluate","_this2","currParent","currParentProperty","currResultType","currPreventEval","currSandbox","currOtherTypeCallback","Array","isArray","toPathString","exprList","toPathArray","length","shift","_hasParentSelector","result","_trace","filter","ea","isParentSelector","hasArrExpr","reduce","rslt","valOrPath","_getPreferredOutput","concat","undefined","pointer","toPointer","_handleCallback","fullRetObj","type","preferredOutput","val","parentPropName","literalPriority","retObj","_this3","loc","x","addRet","elems","forEach","t","_walk","m","test","_slice","indexOf","safeLoc","replace","_eval","addType","valueType","includes","Number","isFinite","locProp","_step","_iterator","_createForOfIteratorHelper","split","s","n","done","part","err","f","rett","tmp","tl","tt","splice","i","keys","len","parts","step","parseInt","start","end","Math","max","min","code","_v","_vname","_$_parentProperty","_$_parent","_$_property","_$_root","_$_v","containsPath","_$_path","scriptCacheKey","cache","script","vm","Script","runInNewContext","message","pathArr","p","toString","subx","$0","$1","prop","ups","join","map","exp","match","context","funcs","source","target","conditionCb","il","moveToAnotherArray","key","values","vr","funcString","func","fString","lastStatementEnd","lastIndexOf","_construct","Function","apply","_toConsum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