1 |
- {"ast":null,"code":"// @ts-nocheck\n// Inlined because of ESM import issues\n/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2022 Joachim Wester\n * MIT licensed\n */\nconst _hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function hasOwnProperty(obj, key) {\n return _hasOwnProperty.call(obj, key);\n}\nexport function _objectKeys(obj) {\n if (Array.isArray(obj)) {\n const keys = new Array(obj.length);\n for (let k = 0; k < keys.length; k++) {\n keys[k] = \"\" + k;\n }\n return keys;\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n let keys = [];\n for (let i in obj) {\n if (hasOwnProperty(obj, i)) {\n keys.push(i);\n }\n }\n return keys;\n}\n/**\n * Deeply clone the object.\n * https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)\n * @param {any} obj value to clone\n * @return {any} cloned obj\n */\nexport function _deepClone(obj) {\n switch (typeof obj) {\n case \"object\":\n return JSON.parse(JSON.stringify(obj));\n //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case \"undefined\":\n return null;\n //this is how JSON.stringify behaves for array items\n default:\n return obj;\n //no need to clone primitives\n }\n}\n//3x faster than cached /^\\d+$/.test(str)\nexport function isInteger(str) {\n let i = 0;\n const len = str.length;\n let charCode;\n while (i < len) {\n charCode = str.charCodeAt(i);\n if (charCode >= 48 && charCode <= 57) {\n i++;\n continue;\n }\n return false;\n }\n return true;\n}\n/**\n * Escapes a json pointer path\n * @param path The raw pointer\n * @return the Escaped path\n */\nexport function escapePathComponent(path) {\n if (path.indexOf(\"/\") === -1 && path.indexOf(\"~\") === -1) return path;\n return path.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\n/**\n * Unescapes a json pointer path\n * @param path The escaped pointer\n * @return The unescaped path\n */\nexport function unescapePathComponent(path) {\n return path.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\nexport function _getPathRecursive(root, obj) {\n let found;\n for (let key in root) {\n if (hasOwnProperty(root, key)) {\n if (root[key] === obj) {\n return escapePathComponent(key) + \"/\";\n } else if (typeof root[key] === \"object\") {\n found = _getPathRecursive(root[key], obj);\n if (found != \"\") {\n return escapePathComponent(key) + \"/\" + found;\n }\n }\n }\n }\n return \"\";\n}\nexport function getPath(root, obj) {\n if (root === obj) {\n return \"/\";\n }\n const path = _getPathRecursive(root, obj);\n if (path === \"\") {\n throw new Error(\"Object not found in root\");\n }\n return `/${path}`;\n}\n/**\n * Recursively checks whether an object has any undefined values inside.\n */\nexport function hasUndefined(obj) {\n if (obj === undefined) {\n return true;\n }\n if (obj) {\n if (Array.isArray(obj)) {\n for (let i = 0, len = obj.length; i < len; i++) {\n if (hasUndefined(obj[i])) {\n return true;\n }\n }\n } else if (typeof obj === \"object\") {\n const objKeys = _objectKeys(obj);\n const objKeysLength = objKeys.length;\n for (var i = 0; i < objKeysLength; i++) {\n if (hasUndefined(obj[objKeys[i]])) {\n return true;\n }\n }\n }\n }\n return false;\n}\nfunction patchErrorMessageFormatter(message, args) {\n const messageParts = [message];\n for (const key in args) {\n const value = typeof args[key] === \"object\" ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print\n if (typeof value !== \"undefined\") {\n messageParts.push(`${key}: ${value}`);\n }\n }\n return messageParts.join(\"\\n\");\n}\nexport class PatchError extends Error {\n constructor(message, name, index, operation, tree) {\n super(patchErrorMessageFormatter(message, {\n name,\n index,\n operation,\n tree\n }));\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: name\n });\n Object.defineProperty(this, \"index\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: index\n });\n Object.defineProperty(this, \"operation\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: operation\n });\n Object.defineProperty(this, \"tree\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: tree\n });\n Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359\n this.message = patchErrorMessageFormatter(message, {\n name,\n index,\n operation,\n tree\n });\n }\n}","map":{"version":3,"names":["_hasOwnProperty","Object","prototype","hasOwnProperty","obj","key","call","_objectKeys","Array","isArray","keys","length","k","i","push","_deepClone","JSON","parse","stringify","isInteger","str","len","charCode","charCodeAt","escapePathComponent","path","indexOf","replace","unescapePathComponent","_getPathRecursive","root","found","getPath","Error","hasUndefined","undefined","objKeys","objKeysLength","patchErrorMessageFormatter","message","args","messageParts","value","join","PatchError","constructor","name","index","operation","tree","defineProperty","enumerable","configurable","writable","setPrototypeOf","new","target"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@langchain/core/dist/utils/fast-json-patch/src/helpers.js"],"sourcesContent":["// @ts-nocheck\n// Inlined because of ESM import issues\n/*!\n * https://github.com/Starcounter-Jack/JSON-Patch\n * (c) 2017-2022 Joachim Wester\n * MIT licensed\n */\nconst _hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function hasOwnProperty(obj, key) {\n return _hasOwnProperty.call(obj, key);\n}\nexport function _objectKeys(obj) {\n if (Array.isArray(obj)) {\n const keys = new Array(obj.length);\n for (let k = 0; k < keys.length; k++) {\n keys[k] = \"\" + k;\n }\n return keys;\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n let keys = [];\n for (let i in obj) {\n if (hasOwnProperty(obj, i)) {\n keys.push(i);\n }\n }\n return keys;\n}\n/**\n * Deeply clone the object.\n * https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)\n * @param {any} obj value to clone\n * @return {any} cloned obj\n */\nexport function _deepClone(obj) {\n switch (typeof obj) {\n case \"object\":\n return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case \"undefined\":\n return null; //this is how JSON.stringify behaves for array items\n default:\n return obj; //no need to clone primitives\n }\n}\n//3x faster than cached /^\\d+$/.test(str)\nexport function isInteger(str) {\n let i = 0;\n const len = str.length;\n let charCode;\n while (i < len) {\n charCode = str.charCodeAt(i);\n if (charCode >= 48 && charCode <= 57) {\n i++;\n continue;\n }\n return false;\n }\n return true;\n}\n/**\n * Escapes a json pointer path\n * @param path The raw pointer\n * @return the Escaped path\n */\nexport function escapePathComponent(path) {\n if (path.indexOf(\"/\") === -1 && path.indexOf(\"~\") === -1)\n return path;\n return path.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\n/**\n * Unescapes a json pointer path\n * @param path The escaped pointer\n * @return The unescaped path\n */\nexport function unescapePathComponent(path) {\n return path.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\nexport function _getPathRecursive(root, obj) {\n let found;\n for (let key in root) {\n if (hasOwnProperty(root, key)) {\n if (root[key] === obj) {\n return escapePathComponent(key) + \"/\";\n }\n else if (typeof root[key] === \"object\") {\n found = _getPathRecursive(root[key], obj);\n if (found != \"\") {\n return escapePathComponent(key) + \"/\" + found;\n }\n }\n }\n }\n return \"\";\n}\nexport function getPath(root, obj) {\n if (root === obj) {\n return \"/\";\n }\n const path = _getPathRecursive(root, obj);\n if (path === \"\") {\n throw new Error(\"Object not found in root\");\n }\n return `/${path}`;\n}\n/**\n * Recursively checks whether an object has any undefined values inside.\n */\nexport function hasUndefined(obj) {\n if (obj === undefined) {\n return true;\n }\n if (obj) {\n if (Array.isArray(obj)) {\n for (let i = 0, len = obj.length; i < len; i++) {\n if (hasUndefined(obj[i])) {\n return true;\n }\n }\n }\n else if (typeof obj === \"object\") {\n const objKeys = _objectKeys(obj);\n const objKeysLength = objKeys.length;\n for (var i = 0; i < objKeysLength; i++) {\n if (hasUndefined(obj[objKeys[i]])) {\n return true;\n }\n }\n }\n }\n return false;\n}\nfunction patchErrorMessageFormatter(message, args) {\n const messageParts = [message];\n for (const key in args) {\n const value = typeof args[key] === \"object\"\n ? JSON.stringify(args[key], null, 2)\n : args[key]; // pretty print\n if (typeof value !== \"undefined\") {\n messageParts.push(`${key}: ${value}`);\n }\n }\n return messageParts.join(\"\\n\");\n}\nexport class PatchError extends Error {\n constructor(message, name, index, operation, tree) {\n super(patchErrorMessageFormatter(message, { name, index, operation, tree }));\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: name\n });\n Object.defineProperty(this, \"index\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: index\n });\n Object.defineProperty(this, \"operation\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: operation\n });\n Object.defineProperty(this, \"tree\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: tree\n });\n Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359\n this.message = patchErrorMessageFormatter(message, {\n name,\n index,\n operation,\n tree,\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,eAAe,GAAGC,MAAM,CAACC,SAAS,CAACC,cAAc;AACvD,OAAO,SAASA,cAAcA,CAACC,GAAG,EAAEC,GAAG,EAAE;EACrC,OAAOL,eAAe,CAACM,IAAI,CAACF,GAAG,EAAEC,GAAG,CAAC;AACzC;AACA,OAAO,SAASE,WAAWA,CAACH,GAAG,EAAE;EAC7B,IAAII,KAAK,CAACC,OAAO,CAACL,GAAG,CAAC,EAAE;IACpB,MAAMM,IAAI,GAAG,IAAIF,KAAK,CAACJ,GAAG,CAACO,MAAM,CAAC;IAClC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACC,MAAM,EAAEC,CAAC,EAAE,EAAE;MAClCF,IAAI,CAACE,CAAC,CAAC,GAAG,EAAE,GAAGA,CAAC;IACpB;IACA,OAAOF,IAAI;EACf;EACA,IAAIT,MAAM,CAACS,IAAI,EAAE;IACb,OAAOT,MAAM,CAACS,IAAI,CAACN,GAAG,CAAC;EAC3B;EACA,IAAIM,IAAI,GAAG,EAAE;EACb,KAAK,IAAIG,CAAC,IAAIT,GAAG,EAAE;IACf,IAAID,cAAc,CAACC,GAAG,EAAES,CAAC,CAAC,EAAE;MACxBH,IAAI,CAACI,IAAI,CAACD,CAAC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