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,EAAG,IAAI,gFAElB,EAAE,WAAa,OACpB,CAEA,OAAO,QAAU","file":"/npm/modman@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/modman@1.0.0/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","const isBuiltinModule = require('is-builtin-module');\r\n\r\nfunction modman(s) {\r\n    var ot = [];\r\n    var otc = [];\r\n    var otce = {};\r\n    var ota = {};\r\n\tif (!s.permissions) {\r\n\t\tthrow new Error(\"Permissions are not specified!\");\r\n\t}\r\n\tif (!s) {\r\n\t\tthrow new Error(\"Settings not set!\")\r\n\t}\r\n    for (var thing in s.permissions) {\r\n        var module = thing.split('.')[0];\r\n        var func = thing.split('.')[1];\r\n        if (!ota[module]) {\r\n            ota[module] = {};\r\n        }\r\n        if (isBuiltinModule(module)) {\r\n            ot.push(module);\r\n        } else {\r\n            otc.push(module);\r\n        }\r\n        if (s.permissions[thing] == false) {\r\n            ota[module][func] = function() {\r\n                console.log('\\x1b[31m%s\\x1b[0m', new Error('Function not allowed in this context.'))\r\n                return Buffer.from(JSON.stringify({\r\n                    error: true,\r\n                    message: \"Function not allowed in context\"\r\n                }))\r\n            }\r\n        } else {\r\n            ota[module][func] = function() {\r\n                return require(module)[func](...arguments);\r\n            }\r\n        }\r\n    }\r\n\r\n    if (s.modules) {\r\n        s.modules.forEach(function(m) {\r\n            if (isBuiltinModule(m)) {\r\n                ot.push(m);\r\n            } else {\r\n                otc.push(m);\r\n                otce[m] = require(m);\r\n            }\r\n        })\r\n    }\r\n\r\n    otce['mockingbird_require'] = function(m) {\r\n        if (otce[m]) {\r\n            return otce[m];\r\n        } else {\r\n            vm.run('(()=>{throw new Error(\"Module ' + m + ' not found.\")})()')\r\n            otce['process'].exit(1);\r\n        }\r\n    }\r\n    otce['mckbdrqur694202yftcbsufgje4hrs'] = function(r, m) {\r\n        var org_rr = r;\r\n        if (isBuiltinModule(m)) {\r\n            return org_rr(m);\r\n        } else {\r\n            return otce['mockingbird_require'](m);\r\n        }\r\n    };\r\n    const {\r\n        NodeVM\r\n    } = require('vm2');\r\n    const vm = new NodeVM({\r\n        console: 'inherit',\r\n        sandbox: otce,\r\n        require: {\r\n            external: {\r\n                modules: otc\r\n            },\r\n            imports: otc,\r\n            builtin: ot,\r\n            root: './',\r\n            mock: ota\r\n        },\r\n    });\r\n    return c => vm.run(`var ori = require;\r\nrequire = m => mckbdrqur694202yftcbsufgje4hrs(ori, m);\r\n(` + c.toString() + ')();')\r\n}\r\n\r\nmodule.exports = modman;"]}