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AAc,QAAQ,KAE9D,OAAmC,IAA5B,EAAiB,OAAc,EAAiB,GAAK,CAChE,CAEA,SAAS,gBAIL,MACI,EAHU,MAAM,UAAU,MAAM,MAAM,WAEjB,KAAI,GAAO,KAAK,KAAK,8BAA+B,KACnD,KAAI,GAAQ,QAAQ,KAE9C,OAA6B,IAAtB,EAAW,OAAc,EAAW,GAAK,CACpD,CA/EA,SAAS,kBAAoB,KAAK,KAAK,SAAS,QAAS,gBAEzD,OAAO,QAAU,CACb,QAAA,CAAS,GAML,OAJA,EAAQ,OAAS,cACjB,EAAQ,MAAQ,aAChB,EAAQ,QAAU,YAEX,IACX,EACA,SAAU","file":"/npm/require-npm@1.4.1/require.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/require-npm@1.4.1/require.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 path = require('path'),\n    fs = require('fs'),\n    processGenerator = require('child_process');\n\nconst Settings = {\n    Library: path.join(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], 'local-node-modules'),\n    LibraryModulePath: \"\",\n    ProjectModulePath: path.join(process.cwd(), 'node_modules')\n};\n\nSettings.LibraryModulePath = path.join(Settings.Library, 'node_modules');\n\nmodule.exports = {\n    decorate(require){\n\n        require.global = GlobalRequire;\n        require.local = LocalRequire;\n        require.modules = ReadModules;\n\n        return this;\n    },\n    settings: Settings\n};\n\nfunction ReadModules(){\n\n    const modulePath = Settings.LibraryModulePath;\n    return fs.readdirSync(modulePath).filter(fileName => fs.lstatSync(path.join(modulePath, fileName)).isDirectory());\n}\nfunction LocalRequire(){\n\n    if(arguments.length === 0) return;\n\n    var moduleList = Array.prototype.slice.apply(arguments);\n\n    const importPathList = moduleList.\n        map(moduleName => path.join(Settings.LibraryModulePath, moduleName));\n\n    if(fs.existsSync(Settings.Library) === false)\n        fs.mkdirSync(Settings.Library);\n\n    if(fs.existsSync(Settings.ProjectModulePath) === false)\n        fs.mkdirSync(Settings.ProjectModulePath);\n\n    const json = path.join(Settings.Library, 'package.json'),\n        exists = fs.existsSync(json);\n\n    if(exists === false)\n        processGenerator.execSync(`npm init --yes`, {cwd: Settings.Library});\n\n    const installationList = importPathList.\n        reduce(function(state, value, index){\n\n            const importExists = fs.existsSync(value);\n\n            if(importExists)\n                return state;\n            else\n                return [...state, moduleList[index]];\n\n        }, []);\n\n    const installations = installationList\n        .map(moduleName => {\n            console.log(`..installing [${moduleName}]`);\n            processGenerator.execSync(`npm install ${moduleName} --save-dev`, {cwd: Settings.Library});\n            console.log('Finished.');\n        });\n\n    importPathList.forEach((importPath, index) => {\n\n        const projectReference = path.join(Settings.ProjectModulePath, moduleList[index]);\n        if(!fs.existsSync(projectReference))\n        processGenerator.execSync(`ln -s ${importPath}`, {cwd: Settings.ProjectModulePath});\n    });\n\n    const importResultList = moduleList.map(moduleName => require(moduleName));\n\n    return importResultList.length === 1? importResultList[0] : importResultList;\n}\n\nfunction GlobalRequire(){\n\n    var argList = Array.prototype.slice.apply(arguments);\n\n    const pathList = argList.map(arg => path.join('/usr/local/lib/node_modules', arg)),\n        resultList = pathList.map(path => require(path));\n\n    return resultList.length === 1? resultList[0] : resultList;\n}\n"]}