{"version":3,"sources":["jsdelivr-header.js","/npm/error-to-json@2.0.1/dist/cjs/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aACA,IAAI,gBAAmB,MAAQ,KAAK,iBAAoB,SAAU,GAC9D,OAAQ,GAAO,EAAI,WAAc,EAAM,CAAE,QAAW,EACxD,EACA,OAAO,eAAe,QAAS,aAAc,CAAE,OAAO,IACtD,QAAQ,WAAQ,EAChB,MAAM,sBAAwB,gBAAgB,QAAQ,wBACtD,QAAQ,QAAU,UAClB,MAAM,yBAA2B,CAAC,OAAQ,QAAS,WACnD,SAAS,UAAU,GACf,IAAI,EAEJ,GAA0B,mBAAf,EAAI,OAEX,EAAO,EAAI,aAEV,CAED,IAAI,EAAU,WAAY,MAAM,UAEhC,MAAM,EAAY,MAAM,UAAU,OAE5B,EAAS,WACX,MAAM,EAAO,OAAO,OAAO,OAAO,OAAO,CAAC,EAAG,MAAO,CAEhD,KAAM,KAAK,KAAM,QAAS,KAAK,QAAS,MAAO,KAAK,QAMxD,OALA,yBAAyB,SAAS,IAE1B,KAAO,OACP,EAAK,GAAO,KAAK,GAAI,IAEtB,KAAK,MAAM,sBAAsB,QAAQ,GACpD,EACA,IAEI,MAAM,UAAU,OAAS,CAC7B,CACA,MAAO,GACH,GAAU,CACd,CAGI,GAAiC,mBAAf,EAAI,OAEtB,EAAO,EAAI,UAGX,GAAU,EACV,EAAO,EAAO,KAAK,IAInB,IACA,MAAM,UAAU,OAAS,EACjC,CAEA,OAAO,CACX,CACA,SAAS,MAAM,GACX,MAAM,EAAM,IAAI,MAAM,EAAK,SACrB,EAAQ,EAAI,OAAS,GAM3B,OALA,OAAO,OAAO,EAAK,GACf,EAAI,QAAU,IAEd,EAAI,MAAQ,EAAM,MAAM,EAAG,EAAM,QAAQ,QAEtC,CACX,CACA,QAAQ,MAAQ","file":"/npm/error-to-json@2.0.1/dist/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/error-to-json@2.0.1/dist/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parse = void 0;\nconst fast_safe_stringify_1 = __importDefault(require(\"fast-safe-stringify\"));\nexports.default = errToJSON;\nconst nonEnumerablePropsToCopy = ['code', 'errno', 'syscall'];\nfunction errToJSON(err) {\n    let json;\n    // @ts-ignore\n    if (typeof err.toJSON === 'function') {\n        // @ts-ignore\n        json = err.toJSON();\n    }\n    else {\n        // stub error tojson\n        let stubbed = 'toJSON' in Error.prototype;\n        // @ts-ignore\n        const errToJSON = Error.prototype.toJSON;\n        // @ts-ignore\n        const toJSON = function () {\n            const json = Object.assign(Object.assign({}, this), { \n                // normal props\n                name: this.name, message: this.message, stack: this.stack });\n            nonEnumerablePropsToCopy.forEach((key) => {\n                // @ts-ignore\n                if (key in this)\n                    json[key] = this[key];\n            });\n            return JSON.parse(fast_safe_stringify_1.default(json));\n        };\n        try {\n            // @ts-ignore\n            Error.prototype.toJSON = toJSON;\n        }\n        catch (e) {\n            stubbed = false;\n        }\n        // get error json\n        // @ts-ignore\n        if (stubbed && typeof err.toJSON === 'function') {\n            // @ts-ignore\n            json = err.toJSON();\n        }\n        else {\n            stubbed = false;\n            json = toJSON.call(err);\n        }\n        // unstub error tojson\n        // @ts-ignore\n        if (stubbed)\n            Error.prototype.toJSON = errToJSON;\n    }\n    // return error json\n    return json;\n}\nfunction parse(json) {\n    const err = new Error(json.message);\n    const stack = err.stack || '';\n    Object.assign(err, json);\n    if (err.stack === stack) {\n        // remove stacktrace generated by error constructor above\n        err.stack = stack.slice(0, stack.indexOf('\\n'));\n    }\n    return err;\n}\nexports.parse = parse;\n"]}