diff --git a/.github/workflows/integration-workflow.yml b/.github/workflows/integration-workflow.yml index 30d716787e74..63246305ad35 100644 --- a/.github/workflows/integration-workflow.yml +++ b/.github/workflows/integration-workflow.yml @@ -61,6 +61,7 @@ jobs: - 8 - 10 - 12 + - 13 platform: - ubuntu-latest - windows-latest diff --git a/.pnp.js b/.pnp.js index 0a67e01c97ed..2d7fed171366 100755 --- a/.pnp.js +++ b/.pnp.js @@ -33329,7 +33329,7 @@ var external_module_default = /*#__PURE__*/__webpack_require__.n(external_module var external_string_decoder_ = __webpack_require__(7); var external_string_decoder_default = /*#__PURE__*/__webpack_require__.n(external_string_decoder_); -// EXTERNAL MODULE: /Users/mael.nison/berry/.yarn/cache/tmp-npm-0.0.33-bcbf65df2a-1.zip/node_modules/tmp/lib/tmp.js +// EXTERNAL MODULE: /Users/sander/prg/js/berry/.yarn/cache/tmp-npm-0.0.33-bcbf65df2a-1.zip/node_modules/tmp/lib/tmp.js var tmp = __webpack_require__(4); var tmp_default = /*#__PURE__*/__webpack_require__.n(tmp); @@ -33740,7 +33740,7 @@ function applyPatch(pnpapi, opts) { if (request === `pnpapi`) return false; if (!enableNativeHooks) return originalFindPath.call(external_module_default.a, request, paths, isMain); - for (const path of paths) { + for (const path of paths || []) { let resolution; try { diff --git a/packages/yarnpkg-builder/package.json b/packages/yarnpkg-builder/package.json index 1d921ab448c0..a9f59f513689 100644 --- a/packages/yarnpkg-builder/package.json +++ b/packages/yarnpkg-builder/package.json @@ -3,7 +3,7 @@ "version": "2.0.0-rc.8", "nextVersion": { "semver": "2.0.0-rc.9", - "nonce": "2115064498229597" + "nonce": "354015226970949" }, "bin": "./sources/boot-dev.js", "dependencies": { diff --git a/packages/yarnpkg-cli/package.json b/packages/yarnpkg-cli/package.json index 6f4150c81e12..0c255a0dad63 100644 --- a/packages/yarnpkg-cli/package.json +++ b/packages/yarnpkg-cli/package.json @@ -3,7 +3,7 @@ "version": "2.0.0-rc.10", "nextVersion": { "semver": "2.0.0-rc.11", - "nonce": "8031577827360037" + "nonce": "5622212548823179" }, "main": "./sources/index.ts", "dependencies": { diff --git a/packages/yarnpkg-core/package.json b/packages/yarnpkg-core/package.json index 4043351718b0..4fae18de86ba 100644 --- a/packages/yarnpkg-core/package.json +++ b/packages/yarnpkg-core/package.json @@ -2,7 +2,8 @@ "name": "@yarnpkg/core", "version": "2.0.0-rc.10", "nextVersion": { - "nonce": "279189156164743" + "semver": "2.0.0-rc.11", + "nonce": "5908698566706877" }, "main": "./sources/index.ts", "sideEffects": false, diff --git a/packages/yarnpkg-pnp/lib/hook.js b/packages/yarnpkg-pnp/lib/hook.js index 8c0a5a8dfeb2..d72e53e64767 100644 --- a/packages/yarnpkg-pnp/lib/hook.js +++ b/packages/yarnpkg-pnp/lib/hook.js @@ -1 +1 @@ -module.exports = "(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pnpHook\"] = factory();\n\telse\n\t\troot[\"pnpHook\"] = factory();\n})(global, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 15);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar frozenFs = Object.assign({}, __webpack_require__(2));\nvar Module=typeof Module!==\"undefined\"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module[\"arguments\"]=[];Module[\"thisProgram\"]=\"./this.program\";Module[\"quit\"]=function(status,toThrow){throw toThrow};Module[\"preRun\"]=[];Module[\"postRun\"]=[];var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=true;if(Module[\"ENVIRONMENT\"]){throw new Error(\"Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)\")}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){if(!(typeof process===\"object\"&&\"function\"===\"function\"))throw new Error(\"not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)\");scriptDirectory=__dirname+\"/\";var nodeFS;var nodePath;Module[\"read\"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=frozenFs;if(!nodePath)nodePath=__webpack_require__(3);filename=nodePath[\"normalize\"](filename);ret=nodeFS[\"readFileSync\"](filename)}return binary?ret:ret.toString()};Module[\"readBinary\"]=function readBinary(filename){var ret=Module[\"read\"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){Module[\"thisProgram\"]=process[\"argv\"][1].replace(/\\\\/g,\"/\")}Module[\"arguments\"]=process[\"argv\"].slice(2);if(true){module[\"exports\"]=Module}(function(){})(\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});(function(){})(\"unhandledRejection\",abort);Module[\"quit\"]=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else{throw new Error(\"environment detection error\")}var out=Module[\"print\"]||(typeof console!==\"undefined\"?console.log.bind(console):typeof print!==\"undefined\"?print:null);var err=Module[\"printErr\"]||(typeof printErr!==\"undefined\"?printErr:typeof console!==\"undefined\"&&console.warn.bind(console)||out);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;assert(typeof Module[\"memoryInitializerPrefixURL\"]===\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]===\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]===\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]===\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");stackSave=stackRestore=stackAlloc=function(){abort(\"cannot use the stack before compiled code is ready to run, and has provided stack access\")};function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;if(end<=_emscripten_get_heap_size()){HEAP32[DYNAMICTOP_PTR>>2]=end}else{var success=_emscripten_resize_heap(end);if(!success)return 0}return ret}function getNativeTypeSize(type){switch(type){case\"i1\":case\"i8\":return 1;case\"i16\":return 2;case\"i32\":return 4;case\"i64\":return 8;case\"float\":return 4;case\"double\":return 8;default:{if(type[type.length-1]===\"*\"){return 4}else if(type[0]===\"i\"){var bits=parseInt(type.substr(1));assert(bits%8===0,\"getNativeTypeSize invalid bits \"+bits+\", type \"+type);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}var asm2wasmImports={\"f64-rem\":function(x,y){return x%y},\"debugger\":function(){debugger}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};if(typeof WebAssembly!==\"object\"){abort(\"No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.\")}function getValue(ptr,type,noSafe){type=type||\"i8\";if(type.charAt(type.length-1)===\"*\")type=\"i32\";if(noSafe){switch(type){case\"i1\":return HEAP8[ptr>>0];case\"i8\":return HEAP8[ptr>>0];case\"i16\":return HEAP16[ptr>>1];case\"i32\":return HEAP32[ptr>>2];case\"i64\":return HEAP32[ptr>>2];case\"float\":return HEAPF32[ptr>>2];case\"double\":return HEAPF64[ptr>>3];default:abort(\"invalid type for getValue: \"+type)}}else{switch(type){case\"i1\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i8\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i16\":return SAFE_HEAP_LOAD(ptr|0,2,0)|0;case\"i32\":return SAFE_HEAP_LOAD(ptr|0,4,0)|0;case\"i64\":return SAFE_HEAP_LOAD(ptr|0,8,0)|0;case\"float\":return Math_fround(SAFE_HEAP_LOAD_D(ptr|0,4,0));case\"double\":return+SAFE_HEAP_LOAD_D(ptr|0,8,0);default:abort(\"invalid type for getValue: \"+type)}}return null}function getSafeHeapType(bytes,isFloat){switch(bytes){case 1:return\"i8\";case 2:return\"i16\";case 4:return isFloat?\"float\":\"i32\";case 8:return\"double\";default:assert(0)}}function SAFE_HEAP_STORE(dest,value,bytes,isFloat){if(dest<=0)abort(\"segmentation fault storing \"+bytes+\" bytes to address \"+dest);if(dest%bytes!==0)abort(\"alignment error storing to address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when storing \"+bytes+\" bytes to address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);setValue(dest,value,getSafeHeapType(bytes,isFloat),1)}function SAFE_HEAP_STORE_D(dest,value,bytes){SAFE_HEAP_STORE(dest,value,bytes,true)}function SAFE_HEAP_LOAD(dest,bytes,unsigned,isFloat){if(dest<=0)abort(\"segmentation fault loading \"+bytes+\" bytes from address \"+dest);if(dest%bytes!==0)abort(\"alignment error loading from address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when loading \"+bytes+\" bytes from address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);var type=getSafeHeapType(bytes,isFloat);var ret=getValue(dest,type,1);if(unsigned)ret=unSign(ret,parseInt(type.substr(1)),1);return ret}function SAFE_HEAP_LOAD_D(dest,bytes,unsigned){return SAFE_HEAP_LOAD(dest,bytes,unsigned,true)}function segfault(){abort(\"segmentation fault\")}function alignfault(){abort(\"alignment fault\")}var wasmMemory;var wasmTable;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!==\"array\",'Return type should not be \"array\".');if(args){for(var i=0;i>0]=value;break;case\"i8\":HEAP8[ptr>>0]=value;break;case\"i16\":HEAP16[ptr>>1]=value;break;case\"i32\":HEAP32[ptr>>2]=value;break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case\"float\":HEAPF32[ptr>>2]=value;break;case\"double\":HEAPF64[ptr>>3]=value;break;default:abort(\"invalid type for setValue: \"+type)}}else{switch(type){case\"i1\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i8\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i16\":SAFE_HEAP_STORE(ptr|0,value|0,2);break;case\"i32\":SAFE_HEAP_STORE(ptr|0,value|0,4);break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],SAFE_HEAP_STORE(ptr|0,tempI64[0]|0,4),SAFE_HEAP_STORE(ptr+4|0,tempI64[1]|0,4);break;case\"float\":SAFE_HEAP_STORE_D(ptr|0,Math_fround(value),4);break;case\"double\":SAFE_HEAP_STORE_D(ptr|0,+value,8);break;default:abort(\"invalid type for setValue: \"+type)}}}var ALLOC_NORMAL=0;var ALLOC_NONE=3;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab===\"number\"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types===\"string\"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,stackAlloc,dynamicAlloc][allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType===\"i8\"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>=2097152)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF).\");outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!==\"undefined\"?new TextDecoder(\"utf-16le\"):undefined;function writeArrayToMemory(array,buffer){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module[\"HEAP8\"]=HEAP8=new Int8Array(buffer);Module[\"HEAP16\"]=HEAP16=new Int16Array(buffer);Module[\"HEAP32\"]=HEAP32=new Int32Array(buffer);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buffer);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buffer);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buffer);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buffer);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buffer)}var STACK_BASE=22720,STACK_MAX=5265600,DYNAMIC_BASE=5265600,DYNAMICTOP_PTR=22464;assert(STACK_BASE%16===0,\"stack must start aligned\");assert(DYNAMIC_BASE%16===0,\"heap must start aligned\");var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_TOTAL_MEMORY=Module[\"TOTAL_MEMORY\"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x\"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+\" \"+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw\"Runtime error: The application has corrupted its heap memory area (address zero)!\"}function abortStackOverflow(allocSize){abort(\"Stack overflow! Attempted to allocate \"+allocSize+\" bytes on the stack, but stack has only \"+(STACK_MAX-stackSave()+allocSize)+\" bytes available!\")}HEAP32[0]=1668509029;HEAP16[1]=25459;if(HEAPU8[2]!==115||HEAPU8[3]!==99)throw\"Runtime error: expected the system to be little-endian!\";function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback();continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){Module[\"dynCall_v\"](func)}else{Module[\"dynCall_vi\"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=0){err(\"Memory size incompatibility issues may be due to changing TOTAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set TOTAL_MEMORY at runtime to something smaller than it was at compile time).\")}return false}receiveInstance(instance,module);return Module[\"asm\"]}Module[\"asm\"]=function(global,env,providedBuffer){env[\"memory\"]=wasmMemory;env[\"table\"]=wasmTable=new WebAssembly.Table({\"initial\":55,\"maximum\":55,\"element\":\"anyfunc\"});env[\"__memory_base\"]=1024;env[\"__table_base\"]=0;var exports=createWasm(env);assert(exports,\"binaryen setup failed (no wasm support?)\");return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var tempDoublePtr=22704;assert(tempDoublePtr%8==0);var ENV={};function ___buildEnvironment(environ){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV[\"USER\"]=ENV[\"LOGNAME\"]=\"web_user\";ENV[\"PATH\"]=\"/\";ENV[\"PWD\"]=\"/\";ENV[\"HOME\"]=\"/home/web_user\";ENV[\"LANG\"]=\"C.UTF-8\";ENV[\"_\"]=Module[\"thisProgram\"];poolPtr=getMemory(TOTAL_ENV_SIZE);envPtr=getMemory(MAX_ENV_VALUES*4);SAFE_HEAP_STORE(envPtr|0,poolPtr|0,4);SAFE_HEAP_STORE(environ|0,envPtr|0,4)}else{envPtr=SAFE_HEAP_LOAD(environ|0,4,0)|0;poolPtr=SAFE_HEAP_LOAD(envPtr|0,4,0)|0}var strings=[];var totalSize=0;for(var key in ENV){if(typeof ENV[key]===\"string\"){var line=key+\"=\"+ENV[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error(\"Environment size exceeded TOTAL_ENV_SIZE!\")}var ptrSize=4;for(var i=0;i=0;i--){var last=parts[i];if(last===\".\"){parts.splice(i,1)}else if(last===\"..\"){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift(\"..\")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)===\"/\",trailingSlash=path.substr(-1)===\"/\";path=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),!isAbsolute).join(\"/\");if(!path&&!isAbsolute){path=\".\"}if(path&&trailingSlash){path+=\"/\"}return(isAbsolute?\"/\":\"\")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return\".\"}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path===\"/\")return\"/\";var lastSlash=path.lastIndexOf(\"/\");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join(\"/\"))},join2:function(l,r){return PATH.normalize(l+\"/\"+r)},resolve:function(){var resolvedPath=\"\",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!==\"string\"){throw new TypeError(\"Arguments to path.resolve must be strings\")}else if(!path){return\"\"}resolvedPath=path+\"/\"+resolvedPath;resolvedAbsolute=path.charAt(0)===\"/\"}resolvedPath=PATH.normalizeArray(resolvedPath.split(\"/\").filter(function(p){return!!p}),!resolvedAbsolute).join(\"/\");return(resolvedAbsolute?\"/\":\"\")+resolvedPath||\".\"},relative:function(from,to){from=PATH.resolve(from).substr(1);to=PATH.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!==\"\")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split(\"/\"));var toParts=trim(to.split(\"/\"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString(\"utf-8\")}else{result=null}}else if(typeof window!=\"undefined\"&&typeof window.prompt==\"function\"){result=window.prompt(\"Input: \");if(result!==null){result+=\"\\n\"}}else if(typeof readline==\"function\"){result=readline();if(result!==null){result+=\"\\n\"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,\"/\",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node},getFileDataAsRegularArray:function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;i=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;return}if(!node.contents||node.contents.subarray){var oldContents=node.contents;node.contents=new Uint8Array(new ArrayBuffer(newSize));if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize;return}if(!node.contents)node.contents=[];if(node.contents.length>newSize)node.contents.length=newSize;else while(node.contents.length=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return stat.mode},realPath:function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},flagsForNode:function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;var newFlags=0;for(var k in NODEFS.flagsForNodeMap){if(flags&k){newFlags|=NODEFS.flagsForNodeMap[k];flags^=k}}if(!flags){return newFlags}else{throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}},node_ops:{getattr:function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)},mknod:function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,\"\",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node},rename:function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsForNode(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(stream,buffer,offset,length,position){if(length===0)return 0;try{return fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},write:function(stream,buffer,offset,length,position){try{return fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position}}};var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var NODERAWFS={lookupPath:function(path){return{path:path,node:{mode:NODEFS.getMode(path)}}},createStandardStreams:function(){FS.streams[0]={fd:0,nfd:0,position:0,path:\"\",flags:0,tty:true,seekable:false};for(var i=1;i<3;i++){FS.streams[i]={fd:i,nfd:i,position:0,path:\"\",flags:577,tty:true,seekable:false}}},cwd:function(){return process.cwd()},chdir:function(){process.chdir.apply(void 0,arguments)},mknod:function(path,mode){if(FS.isDir(path)){fs.mkdirSync(path,mode)}else{fs.writeFileSync(path,\"\",{mode:mode})}},mkdir:function(){fs.mkdirSync.apply(void 0,arguments)},symlink:function(){fs.symlinkSync.apply(void 0,arguments)},rename:function(){fs.renameSync.apply(void 0,arguments)},rmdir:function(){fs.rmdirSync.apply(void 0,arguments)},readdir:function(){fs.readdirSync.apply(void 0,arguments)},unlink:function(){fs.unlinkSync.apply(void 0,arguments)},readlink:function(){return fs.readlinkSync.apply(void 0,arguments)},stat:function(){return fs.statSync.apply(void 0,arguments)},lstat:function(){return fs.lstatSync.apply(void 0,arguments)},chmod:function(){fs.chmodSync.apply(void 0,arguments)},fchmod:function(){fs.fchmodSync.apply(void 0,arguments)},chown:function(){fs.chownSync.apply(void 0,arguments)},fchown:function(){fs.fchownSync.apply(void 0,arguments)},truncate:function(){fs.truncateSync.apply(void 0,arguments)},ftruncate:function(){fs.ftruncateSync.apply(void 0,arguments)},utime:function(){fs.utimesSync.apply(void 0,arguments)},open:function(path,flags,mode,suggestFD){if(typeof flags===\"string\"){flags=VFS.modeStringToFlags(flags)}var nfd=fs.openSync(path,NODEFS.flagsForNode(flags),mode);var fd=suggestFD!=null?suggestFD:FS.nextfd(nfd);var stream={fd:fd,nfd:nfd,position:0,path:path,flags:flags,seekable:true};FS.streams[fd]=stream;return stream},close:function(stream){if(!stream.stream_ops){fs.closeSync(stream.nfd)}FS.closeStream(stream.fd)},llseek:function(stream,offset,whence){if(stream.stream_ops){return VFS.llseek(stream,offset,whence)}var position=offset;if(whence===1){position+=stream.position}else if(whence===2){position+=fs.fstatSync(stream.nfd).size}else if(whence!==0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.position=position;return position},read:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.read(stream,buffer,offset,length,position)}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesRead=fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.write(stream,buffer,offset,length,position)}if(stream.flags&+\"1024\"){FS.llseek(stream,0,+\"2\")}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesWritten=fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:function(){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)},mmap:function(){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)},msync:function(){return 0},munmap:function(){return 0},ioctl:function(){throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)}};var ERRNO_MESSAGES={0:\"Success\",1:\"Not super-user\",2:\"No such file or directory\",3:\"No such process\",4:\"Interrupted system call\",5:\"I/O error\",6:\"No such device or address\",7:\"Arg list too long\",8:\"Exec format error\",9:\"Bad file number\",10:\"No children\",11:\"No more processes\",12:\"Not enough core\",13:\"Permission denied\",14:\"Bad address\",15:\"Block device required\",16:\"Mount device busy\",17:\"File exists\",18:\"Cross-device link\",19:\"No such device\",20:\"Not a directory\",21:\"Is a directory\",22:\"Invalid argument\",23:\"Too many open files in system\",24:\"Too many open files\",25:\"Not a typewriter\",26:\"Text file busy\",27:\"File too large\",28:\"No space left on device\",29:\"Illegal seek\",30:\"Read only file system\",31:\"Too many links\",32:\"Broken pipe\",33:\"Math arg out of domain of func\",34:\"Math result not representable\",35:\"File locking deadlock error\",36:\"File or path name too long\",37:\"No record locks available\",38:\"Function not implemented\",39:\"Directory not empty\",40:\"Too many symbolic links\",42:\"No message of desired type\",43:\"Identifier removed\",44:\"Channel number out of range\",45:\"Level 2 not synchronized\",46:\"Level 3 halted\",47:\"Level 3 reset\",48:\"Link number out of range\",49:\"Protocol driver not attached\",50:\"No CSI structure available\",51:\"Level 2 halted\",52:\"Invalid exchange\",53:\"Invalid request descriptor\",54:\"Exchange full\",55:\"No anode\",56:\"Invalid request code\",57:\"Invalid slot\",59:\"Bad font file fmt\",60:\"Device not a stream\",61:\"No data (for no delay io)\",62:\"Timer expired\",63:\"Out of streams resources\",64:\"Machine is not on the network\",65:\"Package not installed\",66:\"The object is remote\",67:\"The link has been severed\",68:\"Advertise error\",69:\"Srmount error\",70:\"Communication error on send\",71:\"Protocol error\",72:\"Multihop attempted\",73:\"Cross mount point (not really error)\",74:\"Trying to read unreadable message\",75:\"Value too large for defined data type\",76:\"Given log. name not unique\",77:\"f.d. invalid for this operation\",78:\"Remote address changed\",79:\"Can access a needed shared lib\",80:\"Accessing a corrupted shared lib\",81:\".lib section in a.out corrupted\",82:\"Attempting to link in too many libs\",83:\"Attempting to exec a shared library\",84:\"Illegal byte sequence\",86:\"Streams pipe error\",87:\"Too many users\",88:\"Socket operation on non-socket\",89:\"Destination address required\",90:\"Message too long\",91:\"Protocol wrong type for socket\",92:\"Protocol not available\",93:\"Unknown protocol\",94:\"Socket type not supported\",95:\"Not supported\",96:\"Protocol family not supported\",97:\"Address family not supported by protocol family\",98:\"Address already in use\",99:\"Address not available\",100:\"Network interface is not configured\",101:\"Network is unreachable\",102:\"Connection reset by network\",103:\"Connection aborted\",104:\"Connection reset by peer\",105:\"No buffer space available\",106:\"Socket is already connected\",107:\"Socket is not connected\",108:\"Can't send after socket shutdown\",109:\"Too many references\",110:\"Connection timed out\",111:\"Connection refused\",112:\"Host is down\",113:\"Host is unreachable\",114:\"Socket already connected\",115:\"Connection already in progress\",116:\"Stale file handle\",122:\"Quota exceeded\",123:\"No medium (in tape drive)\",125:\"Operation canceled\",130:\"Previous owner died\",131:\"State not recoverable\"};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:\"/\",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+\" : \"+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(path,opts){path=PATH.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:\"\",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(40)}var parts=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),false);var current=FS.root;var current_path=\"/\";for(var i=0;i40){throw new FS.ErrnoError(40)}}}}return{path:current_path,node:current}},getPath:function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!==\"/\"?mount+\"/\"+path:mount+path}path=path?node.name+\"/\"+path:node.name;node=node.parent}},hashName:function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:function(node){FS.hashRemoveNode(node)},isRoot:function(node){return node===node.parent},isMountpoint:function(node){return!!node.mounted},isFile:function(mode){return(mode&61440)===32768},isDir:function(mode){return(mode&61440)===16384},isLink:function(mode){return(mode&61440)===40960},isChrdev:function(mode){return(mode&61440)===8192},isBlkdev:function(mode){return(mode&61440)===24576},isFIFO:function(mode){return(mode&61440)===4096},isSocket:function(mode){return(mode&49152)===49152},flagModes:{\"r\":0,\"rs\":1052672,\"r+\":2,\"w\":577,\"wx\":705,\"xw\":705,\"w+\":578,\"wx+\":706,\"xw+\":706,\"a\":1089,\"ax\":1217,\"xa\":1217,\"a+\":1090,\"ax+\":1218,\"xa+\":1218},modeStringToFlags:function(str){var flags=FS.flagModes[str];if(typeof flags===\"undefined\"){throw new Error(\"Unknown file open mode: \"+str)}return flags},flagsToPermissionString:function(flag){var perms=[\"r\",\"w\",\"rw\"][flag&3];if(flag&512){perms+=\"w\"}return perms},nodePermissions:function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf(\"r\")!==-1&&!(node.mode&292)){return 13}else if(perms.indexOf(\"w\")!==-1&&!(node.mode&146)){return 13}else if(perms.indexOf(\"x\")!==-1&&!(node.mode&73)){return 13}return 0},mayLookup:function(dir){var err=FS.nodePermissions(dir,\"x\");if(err)return err;if(!dir.node_ops.lookup)return 13;return 0},mayCreate:function(dir,name){try{var node=FS.lookupNode(dir,name);return 17}catch(e){}return FS.nodePermissions(dir,\"wx\")},mayDelete:function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,\"wx\");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return 20}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 16}}else{if(FS.isDir(node.mode)){return 21}}return 0},mayOpen:function(node,flags){if(!node){return 2}if(FS.isLink(node.mode)){return 40}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!==\"r\"||flags&512){return 21}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(24)},getStream:function(fd){return FS.streams[fd]},createStream:function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=function(){};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:function(fd){FS.streams[fd]=null},chrdev_stream_ops:{open:function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:function(){throw new FS.ErrnoError(29)}},major:function(dev){return dev>>8},minor:function(dev){return dev&255},makedev:function(ma,mi){return ma<<8|mi},registerDevice:function(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:function(dev){return FS.devices[dev]},getMounts:function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:function(populate,callback){if(typeof populate===\"function\"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log(\"warning: \"+FS.syncFSRequests+\" FS.syncfs operations in flight at once, probably just doing extra work\")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(err){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:function(type,opts,mountpoint){var root=mountpoint===\"/\";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(16)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(16)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(20)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(22)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup:function(parent,name){return parent.node_ops.lookup(parent,name)},mknod:function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name===\".\"||name===\"..\"){throw new FS.ErrnoError(22)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(1)}return parent.node_ops.mknod(parent,name,mode,dev)},create:function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:function(path,mode){var dirs=path.split(\"/\");var d=\"\";for(var i=0;i\"})},staticInit:function(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},\"/\");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={\"MEMFS\":MEMFS,\"NODEFS\":NODEFS}},init:function(input,output,error){assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");FS.init.initialized=true;FS.ensureErrnoError();Module[\"stdin\"]=input||Module[\"stdin\"];Module[\"stdout\"]=output||Module[\"stdout\"];Module[\"stderr\"]=error||Module[\"stderr\"];FS.createStandardStreams()},quit:function(){FS.init.initialized=false;var fflush=Module[\"_fflush\"];if(fflush)fflush(0);for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open(\"HEAD\",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);var datalength=Number(xhr.getResponseHeader(\"Content-length\"));var header;var hasByteServing=(header=xhr.getResponseHeader(\"Accept-Ranges\"))&&header===\"bytes\";var usesGzip=(header=xhr.getResponseHeader(\"Content-Encoding\"))&&header===\"gzip\";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function(from,to){if(from>to)throw new Error(\"invalid range (\"+from+\", \"+to+\") or no bytes requested!\");if(to>datalength-1)throw new Error(\"only \"+datalength+\" bytes available! programmer error!\");var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);if(datalength!==chunkSize)xhr.setRequestHeader(\"Range\",\"bytes=\"+from+\"-\"+to);if(typeof Uint8Array!=\"undefined\")xhr.responseType=\"arraybuffer\";if(xhr.overrideMimeType){xhr.overrideMimeType(\"text/plain; charset=x-user-defined\")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||\"\",true)}};var lazyArray=this;lazyArray.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]===\"undefined\"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]===\"undefined\")throw new Error(\"doXHR failed!\");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;console.log(\"LazyFiles on gzip forces download of the whole file when length is accessed\")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!==\"undefined\"){if(!ENVIRONMENT_IS_WORKER)throw\"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc\";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}return fn.apply(null,arguments)}});stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall10(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.unlink(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);SAFE_HEAP_STORE(result|0,stream.position|0,4);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doWritev(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall15(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),mode=SYSCALLS.get();FS.chmod(path,mode);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall195(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall197(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-ERRNO_CODES.EINVAL}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 12:{var arg=SYSCALLS.get();var offset=0;SAFE_HEAP_STORE(arg+offset|0,2|0,2);return 0}case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall38(which,varargs){SYSCALLS.varargs=varargs;try{var old_path=SYSCALLS.getStr(),new_path=SYSCALLS.getStr();FS.rename(old_path,new_path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall40(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.rmdir(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21509:case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();SAFE_HEAP_STORE(argp|0,0|0,4);return 0}case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21524:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}default:abort(\"bad ioctl syscall \"+op)}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall60(which,varargs){SYSCALLS.varargs=varargs;try{var mask=SYSCALLS.get();var old=SYSCALLS.umask;SYSCALLS.umask=mask;return old}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort(\"Cannot enlarge memory arrays to size \"+requestedSize+\" bytes (OOM). Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value \"+HEAP8.length+\", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 \")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var oldSize=buffer.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0)){return buffer=wasmMemory.buffer}else{return null}}catch(e){console.error(\"emscripten_realloc_buffer: Attempted to grow from \"+oldSize+\" bytes to \"+size+\" bytes, but got error: \"+e);return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();assert(requestedSize>oldSize);var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+LIMIT+\" bytes!\");return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}SAFE_HEAP_STORE(tmPtr+24|0,date.getDay()|0,4);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;SAFE_HEAP_STORE(tmPtr+28|0,yday|0,4);return date.getTime()/1e3|0}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){SAFE_HEAP_STORE(ptr|0,ret|0,4)}return ret}if(ENVIRONMENT_IS_NODE){_emscripten_get_now=function _emscripten_get_now_actual(){var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(typeof dateNow!==\"undefined\"){_emscripten_get_now=dateNow}else if(typeof performance===\"object\"&&performance&&typeof performance[\"now\"]===\"function\"){_emscripten_get_now=function(){return performance[\"now\"]()}}else{_emscripten_get_now=Date.now}FS.staticInit();if(ENVIRONMENT_IS_NODE){var fs=frozenFs;var NODEJS_PATH=__webpack_require__(3);NODEFS.staticInit()}if(ENVIRONMENT_IS_NODE){var _wrapNodeError=function(func){return function(){try{return func.apply(this,arguments)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}};var VFS=Object.assign({},FS);for(var _key in NODERAWFS)FS[_key]=_wrapNodeError(NODERAWFS[_key])}else{throw new Error(\"NODERAWFS is currently only supported on Node.js environment.\")}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var decodeBase64=typeof atob===\"function\"?atob:function(input){var keyStr=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";var output=\"\";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}writeStackCookie();preRun();if(runDependencies>0)return;if(Module[\"calledRun\"])return;function doRun(){if(Module[\"calledRun\"])return;Module[\"calledRun\"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;var abortDecorators=[];function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else{what=\"\"}ABORT=true;EXITSTATUS=1;var extra=\"\";var output=\"abort(\"+what+\") at \"+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}Module[\"abort\"]=abort;if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}Module[\"noExitRuntime\"]=true;run();\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"module\");\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"fs\");\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"path\");\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/*!\n * Tmp\n *\n * Copyright (c) 2011-2017 KARASZI Istvan \n *\n * MIT Licensed\n */\n\n/*\n * Module dependencies.\n */\nconst fs = __webpack_require__(2);\nconst path = __webpack_require__(3);\nconst crypto = __webpack_require__(6);\nconst osTmpDir = __webpack_require__(14);\nconst _c = process.binding('constants');\n\n/*\n * The working inner variables.\n */\nconst\n /**\n * The temporary directory.\n * @type {string}\n */\n tmpDir = osTmpDir(),\n\n // the random characters to choose from\n RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n\n TEMPLATE_PATTERN = /XXXXXX/,\n\n DEFAULT_TRIES = 3,\n\n CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),\n\n EBADF = _c.EBADF || _c.os.errno.EBADF,\n ENOENT = _c.ENOENT || _c.os.errno.ENOENT,\n\n DIR_MODE = 448 /* 0o700 */,\n FILE_MODE = 384 /* 0o600 */,\n\n // this will hold the objects need to be removed on exit\n _removeObjects = [];\n\nvar\n _gracefulCleanup = false,\n _uncaughtException = false;\n\n/**\n * Random name generator based on crypto.\n * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript\n *\n * @param {number} howMany\n * @returns {string} the generated random name\n * @private\n */\nfunction _randomChars(howMany) {\n var\n value = [],\n rnd = null;\n\n // make sure that we do not fail because we ran out of entropy\n try {\n rnd = crypto.randomBytes(howMany);\n } catch (e) {\n rnd = crypto.pseudoRandomBytes(howMany);\n }\n\n for (var i = 0; i < howMany; i++) {\n value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);\n }\n\n return value.join('');\n}\n\n/**\n * Checks whether the `obj` parameter is defined or not.\n *\n * @param {Object} obj\n * @returns {boolean} true if the object is undefined\n * @private\n */\nfunction _isUndefined(obj) {\n return typeof obj === 'undefined';\n}\n\n/**\n * Parses the function arguments.\n *\n * This function helps to have optional arguments.\n *\n * @param {(Options|Function)} options\n * @param {Function} callback\n * @returns {Array} parsed arguments\n * @private\n */\nfunction _parseArguments(options, callback) {\n if (typeof options == 'function') {\n return [callback || {}, options];\n }\n\n if (_isUndefined(options)) {\n return [{}, callback];\n }\n\n return [options, callback];\n}\n\n/**\n * Generates a new temporary name.\n *\n * @param {Object} opts\n * @returns {string} the new random name according to opts\n * @private\n */\nfunction _generateTmpName(opts) {\n if (opts.name) {\n return path.join(opts.dir || tmpDir, opts.name);\n }\n\n // mkstemps like template\n if (opts.template) {\n return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));\n }\n\n // prefix and postfix\n const name = [\n opts.prefix || 'tmp-',\n process.pid,\n _randomChars(12),\n opts.postfix || ''\n ].join('');\n\n return path.join(opts.dir || tmpDir, name);\n}\n\n/**\n * Gets a temporary file name.\n *\n * @param {(Options|tmpNameCallback)} options options or callback\n * @param {?tmpNameCallback} callback the callback function\n */\nfunction tmpName(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n return cb(new Error('Invalid tries'));\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n return cb(new Error('Invalid template provided'));\n\n (function _getUniqueName() {\n const name = _generateTmpName(opts);\n\n // check whether the path exists then retry if needed\n fs.stat(name, function (err) {\n if (!err) {\n if (tries-- > 0) return _getUniqueName();\n\n return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));\n }\n\n cb(null, name);\n });\n }());\n}\n\n/**\n * Synchronous version of tmpName.\n *\n * @param {Object} options\n * @returns {string} the generated random name\n * @throws {Error} if the options are invalid or could not generate a filename\n */\nfunction tmpNameSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n throw new Error('Invalid tries');\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n throw new Error('Invalid template provided');\n\n do {\n const name = _generateTmpName(opts);\n try {\n fs.statSync(name);\n } catch (e) {\n return name;\n }\n } while (tries-- > 0);\n\n throw new Error('Could not get a unique tmp filename, max tries reached');\n}\n\n/**\n * Creates and opens a temporary file.\n *\n * @param {(Options|fileCallback)} options the config options or the callback function\n * @param {?fileCallback} callback\n */\nfunction file(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create and open the file\n fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {\n if (err) return cb(err);\n\n if (opts.discardDescriptor) {\n return fs.close(fd, function _discardCallback(err) {\n if (err) {\n // Low probability, and the file exists, so this could be\n // ignored. If it isn't we certainly need to unlink the\n // file, and if that fails too its error is more\n // important.\n try {\n fs.unlinkSync(name);\n } catch (e) {\n if (!isENOENT(e)) {\n err = e;\n }\n }\n return cb(err);\n }\n cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));\n });\n }\n if (opts.detachDescriptor) {\n return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));\n }\n cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));\n });\n });\n}\n\n/**\n * Synchronous version of file.\n *\n * @param {Options} options\n * @returns {FileSyncObject} object consists of name, fd and removeCallback\n * @throws {Error} if cannot create a file\n */\nfunction fileSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n opts.postfix = opts.postfix || '.tmp';\n\n const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;\n const name = tmpNameSync(opts);\n var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);\n if (opts.discardDescriptor) {\n fs.closeSync(fd); \n fd = undefined;\n }\n\n return {\n name: name,\n fd: fd,\n removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)\n };\n}\n\n/**\n * Removes files and folders in a directory recursively.\n *\n * @param {string} root\n * @private\n */\nfunction _rmdirRecursiveSync(root) {\n const dirs = [root];\n\n do {\n var\n dir = dirs.pop(),\n deferred = false,\n files = fs.readdirSync(dir);\n\n for (var i = 0, length = files.length; i < length; i++) {\n var\n file = path.join(dir, files[i]),\n stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories\n\n if (stat.isDirectory()) {\n if (!deferred) {\n deferred = true;\n dirs.push(dir);\n }\n dirs.push(file);\n } else {\n fs.unlinkSync(file);\n }\n }\n\n if (!deferred) {\n fs.rmdirSync(dir);\n }\n } while (dirs.length !== 0);\n}\n\n/**\n * Creates a temporary directory.\n *\n * @param {(Options|dirCallback)} options the options or the callback function\n * @param {?dirCallback} callback\n */\nfunction dir(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create the directory\n fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {\n if (err) return cb(err);\n\n cb(null, name, _prepareTmpDirRemoveCallback(name, opts));\n });\n });\n}\n\n/**\n * Synchronous version of dir.\n *\n * @param {Options} options\n * @returns {DirSyncObject} object consists of name and removeCallback\n * @throws {Error} if it cannot create a directory\n */\nfunction dirSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n const name = tmpNameSync(opts);\n fs.mkdirSync(name, opts.mode || DIR_MODE);\n\n return {\n name: name,\n removeCallback: _prepareTmpDirRemoveCallback(name, opts)\n };\n}\n\n/**\n * Prepares the callback for removal of the temporary file.\n *\n * @param {string} name the path of the file\n * @param {number} fd file descriptor\n * @param {Object} opts\n * @returns {fileCallback}\n * @private\n */\nfunction _prepareTmpFileRemoveCallback(name, fd, opts) {\n const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {\n try {\n if (0 <= fdPath[0]) {\n fs.closeSync(fdPath[0]);\n }\n }\n catch (e) {\n // under some node/windows related circumstances, a temporary file\n // may have not be created as expected or the file was already closed\n // by the user, in which case we will simply ignore the error\n if (!isEBADF(e) && !isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n try {\n fs.unlinkSync(fdPath[1]);\n }\n catch (e) {\n if (!isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n }, [fd, name]);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Prepares the callback for removal of the temporary directory.\n *\n * @param {string} name\n * @param {Object} opts\n * @returns {Function} the callback\n * @private\n */\nfunction _prepareTmpDirRemoveCallback(name, opts) {\n const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);\n const removeCallback = _prepareRemoveCallback(removeFunction, name);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Creates a guarded function wrapping the removeFunction call.\n *\n * @param {Function} removeFunction\n * @param {Object} arg\n * @returns {Function}\n * @private\n */\nfunction _prepareRemoveCallback(removeFunction, arg) {\n var called = false;\n\n return function _cleanupCallback(next) {\n if (!called) {\n const index = _removeObjects.indexOf(_cleanupCallback);\n if (index >= 0) {\n _removeObjects.splice(index, 1);\n }\n\n called = true;\n removeFunction(arg);\n }\n\n if (next) next(null);\n };\n}\n\n/**\n * The garbage collector.\n *\n * @private\n */\nfunction _garbageCollector() {\n if (_uncaughtException && !_gracefulCleanup) {\n return;\n }\n\n // the function being called removes itself from _removeObjects,\n // loop until _removeObjects is empty\n while (_removeObjects.length) {\n try {\n _removeObjects[0].call(null);\n } catch (e) {\n // already removed?\n }\n }\n}\n\n/**\n * Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.\n */\nfunction isEBADF(error) {\n return isExpectedError(error, -EBADF, 'EBADF');\n}\n\n/**\n * Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.\n */\nfunction isENOENT(error) {\n return isExpectedError(error, -ENOENT, 'ENOENT');\n}\n\n/**\n * Helper to determine whether the expected error code matches the actual code and errno,\n * which will differ between the supported node versions.\n *\n * - Node >= 7.0:\n * error.code {String}\n * error.errno {String|Number} any numerical value will be negated\n *\n * - Node >= 6.0 < 7.0:\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 4.0 < 6.0: introduces SystemError\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 0.10 < 4.0:\n * error.code {Number} negated\n * error.errno n/a\n */\nfunction isExpectedError(error, code, errno) {\n return error.code == code || error.code == errno;\n}\n\n/**\n * Sets the graceful cleanup.\n *\n * Also removes the created files and directories when an uncaught exception occurs.\n */\nfunction setGracefulCleanup() {\n _gracefulCleanup = true;\n}\n\nconst version = process.versions.node.split('.').map(function (value) {\n return parseInt(value, 10);\n});\n\nif (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {\n process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {\n _uncaughtException = true;\n _garbageCollector();\n\n throw err;\n });\n}\n\nprocess.addListener('exit', function _exit(code) {\n if (code) _uncaughtException = true;\n _garbageCollector();\n});\n\n/**\n * Configuration options.\n *\n * @typedef {Object} Options\n * @property {?number} tries the number of tries before give up the name generation\n * @property {?string} template the \"mkstemp\" like filename template\n * @property {?string} name fix name\n * @property {?string} dir the tmp directory to use\n * @property {?string} prefix prefix for the generated name\n * @property {?string} postfix postfix for the generated name\n */\n\n/**\n * @typedef {Object} FileSyncObject\n * @property {string} name the name of the file\n * @property {string} fd the file descriptor\n * @property {fileCallback} removeCallback the callback function to remove the file\n */\n\n/**\n * @typedef {Object} DirSyncObject\n * @property {string} name the name of the directory\n * @property {fileCallback} removeCallback the callback function to remove the directory\n */\n\n/**\n * @callback tmpNameCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n */\n\n/**\n * @callback fileCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {number} fd the file descriptor\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * @callback dirCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * Removes the temporary created file or directory.\n *\n * @callback cleanupCallback\n * @param {simpleCallback} [next] function to call after entry was removed\n */\n\n/**\n * Callback function for function composition.\n * @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57}\n *\n * @callback simpleCallback\n */\n\n// exporting all the needed methods\nmodule.exports.tmpdir = tmpDir;\n\nmodule.exports.dir = dir;\nmodule.exports.dirSync = dirSync;\n\nmodule.exports.file = file;\nmodule.exports.fileSync = fileSync;\n\nmodule.exports.tmpName = tmpName;\nmodule.exports.tmpNameSync = tmpNameSync;\n\nmodule.exports.setGracefulCleanup = setGracefulCleanup;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"stream\");\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"crypto\");\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"string_decoder\");\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"util\");\n\n/***/ }),\n/* 9 */,\n/* 10 */,\n/* 11 */,\n/* 12 */,\n/* 13 */,\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar isWindows = process.platform === 'win32';\nvar trailingSlashRe = isWindows ? /[^:]\\\\$/ : /.\\/$/;\n\n// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43\nmodule.exports = function () {\n\tvar path;\n\n\tif (isWindows) {\n\t\tpath = process.env.TEMP ||\n\t\t\tprocess.env.TMP ||\n\t\t\t(process.env.SystemRoot || process.env.windir) + '\\\\temp';\n\t} else {\n\t\tpath = process.env.TMPDIR ||\n\t\t\tprocess.env.TMP ||\n\t\t\tprocess.env.TEMP ||\n\t\t\t'/tmp';\n\t}\n\n\tif (trailingSlashRe.test(path)) {\n\t\tpath = path.slice(0, -1);\n\t}\n\n\treturn path;\n};\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: external \"fs\"\nvar external_fs_ = __webpack_require__(2);\nvar external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);\n\n// EXTERNAL MODULE: external \"path\"\nvar external_path_ = __webpack_require__(3);\nvar external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);\n\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/path.ts\n\nconst PortablePath = {\n root: `/`,\n dot: `.`\n};\nconst npath = Object.create(external_path_default.a);\nconst ppath = Object.create(external_path_default.a.posix);\n\nconst contains = function (pathUtils, from, to) {\n from = pathUtils.normalize(from);\n to = pathUtils.normalize(to);\n if (from === to) return `.`;\n if (!from.endsWith(pathUtils.sep)) from = from + pathUtils.sep;\n\n if (to.startsWith(from)) {\n return to.slice(from.length);\n } else {\n return null;\n }\n};\n\nnpath.fromPortablePath = fromPortablePath;\nnpath.toPortablePath = toPortablePath;\n\nnpath.contains = (from, to) => contains(npath, from, to);\n\nppath.contains = (from, to) => contains(ppath, from, to);\n\nconst WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/;\nconst PORTABLE_PATH_REGEXP = /^\\/[a-zA-Z]:.*$/; // Path should look like \"/N:/berry/scripts/plugin-pack.js\"\n// And transform to \"N:\\berry\\scripts\\plugin-pack.js\"\n\nfunction fromPortablePath(p) {\n if (process.platform !== 'win32') return p;\n return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\\//g, `\\\\`) : p;\n} // Path should look like \"N:/berry/scripts/plugin-pack.js\"\n// And transform to \"/N:/berry/scripts/plugin-pack.js\"\n\n\nfunction toPortablePath(p) {\n if (process.platform !== 'win32') return p;\n return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\\\/g, `/`);\n}\n\nfunction convertPath(targetPathUtils, sourcePath) {\n return targetPathUtils === npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath);\n}\nfunction toFilename(filename) {\n if (npath.parse(filename).dir !== '' || ppath.parse(filename).dir !== '') throw new Error(`Invalid filename: \"${filename}\"`);\n return filename;\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/FakeFS.ts\n\n\nclass FakeFS_FakeFS {\n constructor(pathUtils) {\n this.pathUtils = pathUtils;\n }\n\n async removePromise(p) {\n let stat;\n\n try {\n stat = await this.lstatPromise(p);\n } catch (error) {\n if (error.code === `ENOENT`) {\n return;\n } else {\n throw error;\n }\n }\n\n if (stat.isDirectory()) {\n for (const entry of await this.readdirPromise(p)) await this.removePromise(this.pathUtils.resolve(p, entry)); // 5 gives 1s worth of retries at worst\n\n\n for (let t = 0; t < 5; ++t) {\n try {\n await this.rmdirPromise(p);\n break;\n } catch (error) {\n if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) {\n await new Promise(resolve => setTimeout(resolve, t * 100));\n continue;\n } else {\n throw error;\n }\n }\n }\n } else {\n await this.unlinkPromise(p);\n }\n }\n\n removeSync(p) {\n let stat;\n\n try {\n stat = this.lstatSync(p);\n } catch (error) {\n if (error.code === `ENOENT`) {\n return;\n } else {\n throw error;\n }\n }\n\n if (stat.isDirectory()) {\n for (const entry of this.readdirSync(p)) this.removeSync(this.pathUtils.resolve(p, entry));\n\n this.rmdirSync(p);\n } else {\n this.unlinkSync(p);\n }\n }\n\n async mkdirpPromise(p, {\n chmod,\n utimes\n } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p)) return;\n const parts = p.split(this.pathUtils.sep);\n\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n\n if (!this.existsSync(subPath)) {\n try {\n await this.mkdirPromise(subPath);\n } catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n } else {\n throw error;\n }\n }\n\n if (chmod != null) await this.chmodPromise(subPath, chmod);\n\n if (utimes != null) {\n await this.utimesPromise(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n\n mkdirpSync(p, {\n chmod,\n utimes\n } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p)) return;\n const parts = p.split(this.pathUtils.sep);\n\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n\n if (!this.existsSync(subPath)) {\n try {\n this.mkdirSync(subPath);\n } catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n } else {\n throw error;\n }\n }\n\n if (chmod != null) this.chmodSync(subPath, chmod);\n\n if (utimes != null) {\n this.utimesSync(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n\n async copyPromise(destination, source, {\n baseFs = this,\n overwrite = true\n } = {}) {\n const stat = await baseFs.lstatPromise(source);\n const exists = await this.existsSync(destination);\n\n if (stat.isDirectory()) {\n await this.mkdirpPromise(destination);\n const directoryListing = await baseFs.readdirPromise(source);\n await Promise.all(directoryListing.map(entry => {\n return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), {\n baseFs,\n overwrite\n });\n }));\n } else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists) await this.removePromise(destination);\n const content = await baseFs.readFilePromise(source);\n await this.writeFilePromise(destination, content);\n }\n } else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists) await this.removePromise(destination);\n const target = await baseFs.readlinkPromise(source);\n await this.symlinkPromise(convertPath(this.pathUtils, target), destination);\n }\n } else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n\n const mode = stat.mode & 0o777;\n await this.chmodPromise(destination, mode);\n }\n\n copySync(destination, source, {\n baseFs = this,\n overwrite = true\n } = {}) {\n const stat = baseFs.lstatSync(source);\n const exists = this.existsSync(destination);\n\n if (stat.isDirectory()) {\n this.mkdirpSync(destination);\n const directoryListing = baseFs.readdirSync(source);\n\n for (const entry of directoryListing) {\n this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), {\n baseFs,\n overwrite\n });\n }\n } else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists) this.removeSync(destination);\n const content = baseFs.readFileSync(source);\n this.writeFileSync(destination, content);\n }\n } else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists) this.removeSync(destination);\n const target = baseFs.readlinkSync(source);\n this.symlinkSync(convertPath(this.pathUtils, target), destination);\n }\n } else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n\n const mode = stat.mode & 0o777;\n this.chmodSync(destination, mode);\n }\n\n async changeFilePromise(p, content) {\n try {\n const current = await this.readFilePromise(p, `utf8`);\n\n if (current === content) {\n return;\n }\n } catch (error) {// ignore errors, no big deal\n }\n\n await this.writeFilePromise(p, content);\n }\n\n changeFileSync(p, content) {\n try {\n const current = this.readFileSync(p, `utf8`);\n\n if (current === content) {\n return;\n }\n } catch (error) {// ignore errors, no big deal\n }\n\n this.writeFileSync(p, content);\n }\n\n async movePromise(fromP, toP) {\n try {\n await this.renamePromise(fromP, toP);\n } catch (error) {\n if (error.code === `EXDEV`) {\n await this.copyPromise(toP, fromP);\n await this.removePromise(fromP);\n } else {\n throw error;\n }\n }\n }\n\n moveSync(fromP, toP) {\n try {\n this.renameSync(fromP, toP);\n } catch (error) {\n if (error.code === `EXDEV`) {\n this.copySync(toP, fromP);\n this.removeSync(fromP);\n } else {\n throw error;\n }\n }\n }\n\n async lockPromise(affectedPath, callback) {\n const lockPath = `${affectedPath}.flock`;\n const interval = 1000 / 60;\n const startTime = Date.now();\n let fd = null; // Even when we detect that a lock file exists, we still look inside to see\n // whether the pid that created it is still alive. It's not foolproof\n // (there are false positive), but there are no false negative and that's\n // all that matters in 99% of the cases.\n\n const isAlive = async () => {\n let pid;\n\n try {\n [pid] = await this.readJsonPromise(lockPath);\n } catch (error) {\n // If we can't read the file repeatedly, we assume the process was\n // aborted before even writing finishing writing the payload.\n return Date.now() - startTime < 500;\n }\n\n try {\n // \"As a special case, a signal of 0 can be used to test for the\n // existence of a process\" - so we check whether it's alive.\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return false;\n }\n };\n\n while (fd === null) {\n try {\n fd = await this.openPromise(lockPath, `wx`);\n } catch (error) {\n if (error.code === `EEXIST`) {\n if (!(await isAlive())) {\n try {\n await this.unlinkPromise(lockPath);\n continue;\n } catch (error) {// No big deal if we can't remove it. Just fallback to wait for\n // it to be eventually released by its owner.\n }\n }\n\n if (Date.now() - startTime < 60 * 1000) {\n await new Promise(resolve => setTimeout(resolve, interval));\n } else {\n throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`);\n }\n } else {\n throw error;\n }\n }\n }\n\n await this.writePromise(fd, JSON.stringify([process.pid]));\n\n try {\n return await callback();\n } finally {\n await this.closePromise(fd);\n await this.unlinkPromise(lockPath);\n }\n }\n\n async readJsonPromise(p) {\n const content = await this.readFilePromise(p, `utf8`);\n\n try {\n return JSON.parse(content);\n } catch (error) {\n error.message += ` (in ${p})`;\n throw error;\n }\n }\n\n async readJsonSync(p) {\n const content = this.readFileSync(p, `utf8`);\n\n try {\n return JSON.parse(content);\n } catch (error) {\n error.message += ` (in ${p})`;\n throw error;\n }\n }\n\n async writeJsonPromise(p, data) {\n return await this.writeFilePromise(p, `${JSON.stringify(data, null, 2)}\\n`);\n }\n\n writeJsonSync(p, data) {\n return this.writeFileSync(p, `${JSON.stringify(data, null, 2)}\\n`);\n }\n\n}\n;\nclass FakeFS_BasePortableFakeFS extends FakeFS_FakeFS {\n constructor() {\n super(ppath);\n }\n\n resolve(p) {\n return this.pathUtils.resolve(PortablePath.root, p);\n }\n\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/NodeFS.ts\n\n\n\nclass NodeFS_NodeFS extends FakeFS_BasePortableFakeFS {\n constructor(realFs = external_fs_default.a) {\n super();\n this.realFs = realFs;\n }\n\n getRealPath() {\n return PortablePath.root;\n }\n\n async openPromise(p, flags, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.open(npath.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject));\n });\n }\n\n openSync(p, flags, mode) {\n return this.realFs.openSync(npath.fromPortablePath(p), flags, mode);\n }\n\n async readPromise(fd, buffer, offset = 0, length = 0, position = -1) {\n return await new Promise((resolve, reject) => {\n this.realFs.read(fd, buffer, offset, length, position, (error, bytesRead) => {\n if (error) {\n reject(error);\n } else {\n resolve(bytesRead);\n }\n });\n });\n }\n\n readSync(fd, buffer, offset, length, position) {\n return this.realFs.readSync(fd, buffer, offset, length, position);\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n return await new Promise((resolve, reject) => {\n if (typeof buffer === `string`) {\n return this.realFs.write(fd, buffer, offset, this.makeCallback(resolve, reject));\n } else {\n return this.realFs.write(fd, buffer, offset, length, position, this.makeCallback(resolve, reject));\n }\n });\n }\n\n writeSync(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.realFs.writeSync(fd, buffer, offset);\n } else {\n return this.realFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n async closePromise(fd) {\n await new Promise((resolve, reject) => {\n this.realFs.close(fd, this.makeCallback(resolve, reject));\n });\n }\n\n closeSync(fd) {\n this.realFs.closeSync(fd);\n }\n\n createReadStream(p, opts) {\n const realPath = p !== null ? npath.fromPortablePath(p) : p;\n return this.realFs.createReadStream(realPath, opts);\n }\n\n createWriteStream(p, opts) {\n const realPath = p !== null ? npath.fromPortablePath(p) : p;\n return this.realFs.createWriteStream(realPath, opts);\n }\n\n async realpathPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.realpath(npath.fromPortablePath(p), {}, this.makeCallback(resolve, reject));\n }).then(path => {\n return npath.toPortablePath(path);\n });\n }\n\n realpathSync(p) {\n return npath.toPortablePath(this.realFs.realpathSync(npath.fromPortablePath(p), {}));\n }\n\n async existsPromise(p) {\n return await new Promise(resolve => {\n this.realFs.exists(npath.fromPortablePath(p), resolve);\n });\n }\n\n accessSync(p, mode) {\n return this.realFs.accessSync(npath.fromPortablePath(p), mode);\n }\n\n async accessPromise(p, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.access(npath.fromPortablePath(p), mode, this.makeCallback(resolve, reject));\n });\n }\n\n existsSync(p) {\n return this.realFs.existsSync(npath.fromPortablePath(p));\n }\n\n async statPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.stat(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n statSync(p) {\n return this.realFs.statSync(npath.fromPortablePath(p));\n }\n\n async lstatPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.lstat(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n lstatSync(p) {\n return this.realFs.lstatSync(npath.fromPortablePath(p));\n }\n\n async chmodPromise(p, mask) {\n return await new Promise((resolve, reject) => {\n this.realFs.chmod(npath.fromPortablePath(p), mask, this.makeCallback(resolve, reject));\n });\n }\n\n chmodSync(p, mask) {\n return this.realFs.chmodSync(npath.fromPortablePath(p), mask);\n }\n\n async renamePromise(oldP, newP) {\n return await new Promise((resolve, reject) => {\n this.realFs.rename(npath.fromPortablePath(oldP), npath.fromPortablePath(newP), this.makeCallback(resolve, reject));\n });\n }\n\n renameSync(oldP, newP) {\n return this.realFs.renameSync(npath.fromPortablePath(oldP), npath.fromPortablePath(newP));\n }\n\n async copyFilePromise(sourceP, destP, flags = 0) {\n return await new Promise((resolve, reject) => {\n this.realFs.copyFile(npath.fromPortablePath(sourceP), npath.fromPortablePath(destP), flags, this.makeCallback(resolve, reject));\n });\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n return this.realFs.copyFileSync(npath.fromPortablePath(sourceP), npath.fromPortablePath(destP), flags);\n }\n\n async appendFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.appendFile(fsNativePath, content, opts, this.makeCallback(resolve, reject));\n } else {\n this.realFs.appendFile(fsNativePath, content, this.makeCallback(resolve, reject));\n }\n });\n }\n\n appendFileSync(p, content, opts) {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.appendFileSync(fsNativePath, content, opts);\n } else {\n this.realFs.appendFileSync(fsNativePath, content);\n }\n }\n\n async writeFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.writeFile(fsNativePath, content, opts, this.makeCallback(resolve, reject));\n } else {\n this.realFs.writeFile(fsNativePath, content, this.makeCallback(resolve, reject));\n }\n });\n }\n\n writeFileSync(p, content, opts) {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.writeFileSync(fsNativePath, content, opts);\n } else {\n this.realFs.writeFileSync(fsNativePath, content);\n }\n }\n\n async unlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.unlink(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n unlinkSync(p) {\n return this.realFs.unlinkSync(npath.fromPortablePath(p));\n }\n\n async utimesPromise(p, atime, mtime) {\n return await new Promise((resolve, reject) => {\n this.realFs.utimes(npath.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject));\n });\n }\n\n utimesSync(p, atime, mtime) {\n this.realFs.utimesSync(npath.fromPortablePath(p), atime, mtime);\n }\n\n async mkdirPromise(p, opts) {\n return await new Promise((resolve, reject) => {\n this.realFs.mkdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject));\n });\n }\n\n mkdirSync(p, opts) {\n return this.realFs.mkdirSync(npath.fromPortablePath(p), opts);\n }\n\n async rmdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.rmdir(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n rmdirSync(p) {\n return this.realFs.rmdirSync(npath.fromPortablePath(p));\n }\n\n async symlinkPromise(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return await new Promise((resolve, reject) => {\n this.realFs.symlink(npath.fromPortablePath(target.replace(/\\/+$/, ``)), npath.fromPortablePath(p), type, this.makeCallback(resolve, reject));\n });\n }\n\n symlinkSync(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return this.realFs.symlinkSync(npath.fromPortablePath(target.replace(/\\/+$/, ``)), npath.fromPortablePath(p), type);\n }\n\n async readFilePromise(p, encoding) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n this.realFs.readFile(fsNativePath, encoding, this.makeCallback(resolve, reject));\n });\n }\n\n readFileSync(p, encoding) {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n return this.realFs.readFileSync(fsNativePath, encoding);\n }\n\n async readdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n readdirSync(p) {\n return this.realFs.readdirSync(npath.fromPortablePath(p));\n }\n\n async readlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readlink(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n }).then(path => {\n return npath.toPortablePath(path);\n });\n }\n\n readlinkSync(p) {\n return npath.toPortablePath(this.realFs.readlinkSync(npath.fromPortablePath(p)));\n }\n\n watch(p, a, b) {\n return this.realFs.watch(npath.fromPortablePath(p), // @ts-ignore\n a, b);\n }\n\n makeCallback(resolve, reject) {\n return (err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result);\n }\n };\n }\n\n}\n// EXTERNAL MODULE: ../yarnpkg-libzip/sources/libzip.js\nvar libzip = __webpack_require__(0);\nvar libzip_default = /*#__PURE__*/__webpack_require__.n(libzip);\n\n// CONCATENATED MODULE: ../yarnpkg-libzip/sources/index.ts\n\nconst number64 = [`number`, `number`]; // eslint-disable-next-line arca/no-default-export\n\n/* harmony default export */ var sources = ({\n // Those are getters because they can change after memory growth\n get HEAP8() {\n return libzip_default.a.HEAP8;\n },\n\n get HEAPU8() {\n return libzip_default.a.HEAPU8;\n },\n\n ZIP_CHECKCONS: 4,\n ZIP_CREATE: 1,\n ZIP_EXCL: 2,\n ZIP_TRUNCATE: 8,\n ZIP_RDONLY: 16,\n ZIP_FL_OVERWRITE: 8192,\n ZIP_OPSYS_DOS: 0x00,\n ZIP_OPSYS_AMIGA: 0x01,\n ZIP_OPSYS_OPENVMS: 0x02,\n ZIP_OPSYS_UNIX: 0x03,\n ZIP_OPSYS_VM_CMS: 0x04,\n ZIP_OPSYS_ATARI_ST: 0x05,\n ZIP_OPSYS_OS_2: 0x06,\n ZIP_OPSYS_MACINTOSH: 0x07,\n ZIP_OPSYS_Z_SYSTEM: 0x08,\n ZIP_OPSYS_CPM: 0x09,\n ZIP_OPSYS_WINDOWS_NTFS: 0x0a,\n ZIP_OPSYS_MVS: 0x0b,\n ZIP_OPSYS_VSE: 0x0c,\n ZIP_OPSYS_ACORN_RISC: 0x0d,\n ZIP_OPSYS_VFAT: 0x0e,\n ZIP_OPSYS_ALTERNATE_MVS: 0x0f,\n ZIP_OPSYS_BEOS: 0x10,\n ZIP_OPSYS_TANDEM: 0x11,\n ZIP_OPSYS_OS_400: 0x12,\n ZIP_OPSYS_OS_X: 0x13,\n uint08S: libzip_default.a._malloc(1),\n uint16S: libzip_default.a._malloc(2),\n uint32S: libzip_default.a._malloc(4),\n uint64S: libzip_default.a._malloc(8),\n malloc: libzip_default.a._malloc,\n free: libzip_default.a._free,\n getValue: libzip_default.a.getValue,\n open: libzip_default.a.cwrap(`zip_open`, `number`, [`string`, `number`, `number`]),\n openFromSource: libzip_default.a.cwrap(`zip_open_from_source`, `number`, [`number`, `number`, `number`]),\n close: libzip_default.a.cwrap(`zip_close`, `number`, [`number`]),\n discard: libzip_default.a.cwrap(`zip_discard`, null, [`number`]),\n getError: libzip_default.a.cwrap(`zip_get_error`, `number`, [`number`]),\n getName: libzip_default.a.cwrap(`zip_get_name`, `string`, [`number`, `number`, `number`]),\n getNumEntries: libzip_default.a.cwrap(`zip_get_num_entries`, `number`, [`number`, `number`]),\n stat: libzip_default.a.cwrap(`zip_stat`, `number`, [`number`, `string`, `number`, `number`]),\n statIndex: libzip_default.a.cwrap(`zip_stat_index`, `number`, [`number`, ...number64, `number`, `number`]),\n fopen: libzip_default.a.cwrap(`zip_fopen`, `number`, [`number`, `string`, `number`]),\n fopenIndex: libzip_default.a.cwrap(`zip_fopen_index`, `number`, [`number`, ...number64, `number`]),\n fread: libzip_default.a.cwrap(`zip_fread`, `number`, [`number`, `number`, `number`, `number`]),\n fclose: libzip_default.a.cwrap(`zip_fclose`, `number`, [`number`]),\n dir: {\n add: libzip_default.a.cwrap(`zip_dir_add`, `number`, [`number`, `string`])\n },\n file: {\n add: libzip_default.a.cwrap(`zip_file_add`, `number`, [`number`, `string`, `number`, `number`]),\n getError: libzip_default.a.cwrap(`zip_file_get_error`, `number`, [`number`]),\n getExternalAttributes: libzip_default.a.cwrap(`zip_file_get_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setExternalAttributes: libzip_default.a.cwrap(`zip_file_set_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setMtime: libzip_default.a.cwrap(`zip_file_set_mtime`, `number`, [`number`, ...number64, `number`, `number`])\n },\n error: {\n initWithCode: libzip_default.a.cwrap(`zip_error_init_with_code`, null, [`number`, `number`]),\n strerror: libzip_default.a.cwrap(`zip_error_strerror`, `string`, [`number`])\n },\n name: {\n locate: libzip_default.a.cwrap(`zip_name_locate`, `number`, [`number`, `string`, `number`])\n },\n source: {\n fromUnattachedBuffer: libzip_default.a.cwrap(`zip_source_buffer_create`, `number`, [`number`, `number`, `number`, `number`]),\n fromBuffer: libzip_default.a.cwrap(`zip_source_buffer`, `number`, [`number`, `number`, ...number64, `number`]),\n free: libzip_default.a.cwrap(`zip_source_free`, null, [`number`])\n },\n struct: {\n stat: libzip_default.a.cwrap(`zipstruct_stat`, `number`, []),\n statS: libzip_default.a.cwrap(`zipstruct_statS`, `number`, []),\n statName: libzip_default.a.cwrap(`zipstruct_stat_name`, `string`, [`number`]),\n statIndex: libzip_default.a.cwrap(`zipstruct_stat_index`, `number`, [`number`]),\n statSize: libzip_default.a.cwrap(`zipstruct_stat_size`, `number`, [`number`]),\n statMtime: libzip_default.a.cwrap(`zipstruct_stat_mtime`, `number`, [`number`]),\n error: libzip_default.a.cwrap(`zipstruct_error`, `number`, []),\n errorS: libzip_default.a.cwrap(`zipstruct_errorS`, `number`, [])\n }\n});\n// EXTERNAL MODULE: external \"stream\"\nvar external_stream_ = __webpack_require__(5);\n\n// EXTERNAL MODULE: external \"util\"\nvar external_util_ = __webpack_require__(8);\n\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/errors.ts\nfunction makeError(code, message) {\n return Object.assign(new Error(`${code}: ${message}`), {\n code\n });\n}\n\nfunction EBUSY(message) {\n return makeError(`EBUSY`, message);\n}\nfunction ENOSYS(message, reason) {\n return makeError(`ENOSYS`, `${message}, ${reason}`);\n}\nfunction EINVAL(reason) {\n return makeError(`EINVAL`, `invalid argument, ${reason}`);\n}\nfunction EBADF(reason) {\n return makeError(`EBADF`, `bad file descriptor, ${reason}`);\n}\nfunction ENOENT(reason) {\n return makeError(`ENOENT`, `no such file or directory, ${reason}`);\n}\nfunction ENOTDIR(reason) {\n return makeError(`ENOTDIR`, `not a directory, ${reason}`);\n}\nfunction EISDIR(reason) {\n return makeError(`EISDIR`, `illegal operation on a directory, ${reason}`);\n}\nfunction EEXIST(reason) {\n return makeError(`EEXIST`, `file already exists, ${reason}`);\n}\nfunction EROFS(reason) {\n return makeError(`EROFS`, `read-only filesystem, ${reason}`);\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/ZipFS.ts\n\n\n\n\n\n\n\n\nconst S_IFMT = 0o170000;\nconst S_IFDIR = 0o040000;\nconst S_IFREG = 0o100000;\nconst S_IFLNK = 0o120000;\n\nclass StatEntry {\n constructor() {\n this.dev = 0;\n this.ino = 0;\n this.mode = 0;\n this.nlink = 1;\n this.rdev = 0;\n this.blocks = 1;\n }\n\n isBlockDevice() {\n return false;\n }\n\n isCharacterDevice() {\n return false;\n }\n\n isDirectory() {\n return (this.mode & S_IFMT) === S_IFDIR;\n }\n\n isFIFO() {\n return false;\n }\n\n isFile() {\n return (this.mode & S_IFMT) === S_IFREG;\n }\n\n isSocket() {\n return false;\n }\n\n isSymbolicLink() {\n return (this.mode & S_IFMT) === S_IFLNK;\n }\n\n}\n\nfunction makeDefaultStats() {\n return Object.assign(new StatEntry(), {\n uid: 0,\n gid: 0,\n size: 0,\n blksize: 0,\n atimeMs: 0,\n mtimeMs: 0,\n ctimeMs: 0,\n birthtimeMs: 0,\n atime: new Date(0),\n mtime: new Date(0),\n ctime: new Date(0),\n birthtime: new Date(0),\n mode: S_IFREG | 0o644\n });\n}\n\nfunction toUnixTimestamp(time) {\n if (typeof time === 'string' && String(+time) === time) return +time; // @ts-ignore\n\n if (Number.isFinite(time)) {\n if (time < 0) {\n return Date.now() / 1000;\n } else {\n return time;\n }\n } // convert to 123.456 UNIX timestamp\n\n\n if (Object(external_util_[\"isDate\"])(time)) return time.getTime() / 1000;\n throw new Error(`Invalid time`);\n}\n\nclass ZipFS_ZipFS extends FakeFS_BasePortableFakeFS {\n constructor(source, opts = {}) {\n super();\n this.listings = new Map();\n this.entries = new Map();\n this.fds = new Map();\n this.nextFd = 0;\n this.ready = false;\n this.readOnly = false;\n const pathOptions = opts;\n\n if (typeof source === `string`) {\n const {\n baseFs = new NodeFS_NodeFS()\n } = pathOptions;\n this.baseFs = baseFs;\n this.path = source;\n } else {\n this.path = null;\n this.baseFs = null;\n }\n\n if (opts.stats) {\n this.stats = opts.stats;\n } else {\n if (typeof source === `string`) {\n try {\n this.stats = this.baseFs.statSync(source);\n } catch (error) {\n if (error.code === `ENOENT` && pathOptions.create) {\n this.stats = makeDefaultStats();\n } else {\n throw error;\n }\n }\n } else {\n this.stats = makeDefaultStats();\n }\n }\n\n const errPtr = sources.malloc(4);\n\n try {\n let flags = 0;\n if (typeof source === `string` && pathOptions.create) flags |= sources.ZIP_CREATE | sources.ZIP_TRUNCATE;\n\n if (opts.readOnly) {\n flags |= sources.ZIP_RDONLY;\n this.readOnly = true;\n }\n\n if (typeof source === `string`) {\n this.zip = sources.open(npath.fromPortablePath(source), flags, errPtr);\n } else {\n const lzSource = this.allocateUnattachedSource(source);\n\n try {\n this.zip = sources.openFromSource(lzSource, flags, errPtr);\n } catch (error) {\n sources.source.free(lzSource);\n throw error;\n }\n }\n\n if (this.zip === 0) {\n const error = sources.struct.errorS();\n sources.error.initWithCode(error, sources.getValue(errPtr, `i32`));\n throw new Error(sources.error.strerror(error));\n }\n } finally {\n sources.free(errPtr);\n }\n\n this.listings.set(PortablePath.root, new Set());\n const entryCount = sources.getNumEntries(this.zip, 0);\n\n for (let t = 0; t < entryCount; ++t) {\n const raw = sources.getName(this.zip, t, 0);\n if (ppath.isAbsolute(raw)) continue;\n const p = ppath.resolve(PortablePath.root, raw);\n this.registerEntry(p, t); // If the raw path is a directory, register it\n // to prevent empty folder being skipped\n\n if (raw.endsWith('/')) {\n this.registerListing(p);\n }\n }\n\n this.ready = true;\n }\n\n getAllFiles() {\n return Array.from(this.entries.keys());\n }\n\n getRealPath() {\n if (!this.path) throw new Error(`ZipFS don't have real paths when loaded from a buffer`);\n return this.path;\n }\n\n saveAndClose() {\n if (!this.path || !this.baseFs) throw new Error(`ZipFS cannot be saved and must be discarded when loaded from a buffer`);\n if (!this.ready) throw EBUSY(`archive closed, close`);\n if (this.readOnly) return this.discardAndClose();\n const previousMod = this.baseFs.existsSync(this.path) ? this.baseFs.statSync(this.path).mode & 0o777 : null;\n const rc = sources.close(this.zip);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip))); // Libzip overrides the chmod when writing the archive, which is a weird\n // behavior I don't totally understand (plus the umask seems bogus in some\n // weird cases - maybe related to emscripten?)\n //\n // See also https://github.com/nih-at/libzip/issues/77\n\n if (previousMod !== null && previousMod !== (this.baseFs.statSync(this.path).mode & 0o777)) this.baseFs.chmodSync(this.path, previousMod);\n this.ready = false;\n }\n\n discardAndClose() {\n if (!this.ready) throw EBUSY(`archive closed, close`);\n sources.discard(this.zip);\n this.ready = false;\n }\n\n async openPromise(p, flags, mode) {\n return this.openSync(p, flags, mode);\n }\n\n openSync(p, flags, mode) {\n const fd = this.nextFd++;\n this.fds.set(fd, {\n cursor: 0,\n p\n });\n return fd;\n }\n\n async readPromise(fd, buffer, offset, length, position) {\n return this.readSync(fd, buffer, offset, length, position);\n }\n\n readSync(fd, buffer, offset = 0, length = 0, position = -1) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`) throw EBADF(`read`);\n let realPosition;\n if (position === -1 || position === null) realPosition = entry.cursor;else realPosition = position;\n const source = this.readFileSync(entry.p);\n source.copy(buffer, offset, realPosition, realPosition + length);\n const bytesRead = Math.max(0, Math.min(source.length - realPosition, length));\n if (position === -1) entry.cursor += bytesRead;\n return bytesRead;\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.writeSync(fd, buffer, position);\n } else {\n return this.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n writeSync(fd, buffer, offset, length, position) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`) throw EBADF(`read`);\n throw new Error(`Unimplemented`);\n }\n\n async closePromise(fd) {\n return this.closeSync(fd);\n }\n\n closeSync(fd) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`) throw EBADF(`read`);\n this.fds.delete(fd);\n }\n\n createReadStream(p, {\n encoding\n } = {}) {\n if (p === null) throw new Error(`Unimplemented`);\n const stream = Object.assign(new external_stream_[\"PassThrough\"](), {\n bytesRead: 0,\n path: p,\n close: () => {\n clearImmediate(immediate);\n }\n });\n const immediate = setImmediate(() => {\n try {\n const data = this.readFileSync(p, encoding);\n stream.bytesRead = data.length;\n stream.write(data);\n stream.end();\n } catch (error) {\n stream.emit(`error`, error);\n stream.end();\n }\n });\n return stream;\n }\n\n createWriteStream(p, {\n encoding\n } = {}) {\n if (this.readOnly) throw EROFS(`open '${p}'`);\n if (p === null) throw new Error(`Unimplemented`);\n const stream = Object.assign(new external_stream_[\"PassThrough\"](), {\n bytesWritten: 0,\n path: p,\n close: () => {\n stream.end();\n }\n });\n const chunks = [];\n stream.on(`data`, chunk => {\n const chunkBuffer = Buffer.from(chunk);\n stream.bytesWritten += chunkBuffer.length;\n chunks.push(chunkBuffer);\n });\n stream.on(`end`, () => {\n this.writeFileSync(p, Buffer.concat(chunks), encoding);\n });\n return stream;\n }\n\n async realpathPromise(p) {\n return this.realpathSync(p);\n }\n\n realpathSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`lstat '${p}'`);\n return resolvedP;\n }\n\n async existsPromise(p) {\n return this.existsSync(p);\n }\n\n existsSync(p) {\n let resolvedP;\n\n try {\n resolvedP = this.resolveFilename(`stat '${p}'`, p);\n } catch (error) {\n return false;\n }\n\n return this.entries.has(resolvedP) || this.listings.has(resolvedP);\n }\n\n async accessPromise(p, mode) {\n return this.accessSync(p, mode);\n }\n\n accessSync(p, mode) {\n const resolvedP = this.resolveFilename(`access '${p}'`, p);\n\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) {\n throw ENOENT(`access '${p}'`);\n }\n }\n\n async statPromise(p) {\n return this.statSync(p);\n }\n\n statSync(p) {\n const resolvedP = this.resolveFilename(`stat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`stat '${p}'`);\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`stat '${p}'`);\n return this.statImpl(`stat '${p}'`, resolvedP);\n }\n\n async lstatPromise(p) {\n return this.lstatSync(p);\n }\n\n lstatSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`lstat '${p}'`);\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`lstat '${p}'`);\n return this.statImpl(`lstat '${p}'`, resolvedP);\n }\n\n statImpl(reason, p) {\n if (this.listings.has(p)) {\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = 0;\n const blksize = 512;\n const blocks = 0;\n const atimeMs = this.stats.mtimeMs;\n const birthtimeMs = this.stats.mtimeMs;\n const ctimeMs = this.stats.mtimeMs;\n const mtimeMs = this.stats.mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = S_IFDIR | 0o755;\n return Object.assign(new StatEntry(), {\n uid,\n gid,\n size,\n blksize,\n blocks,\n atime,\n birthtime,\n ctime,\n mtime,\n atimeMs,\n birthtimeMs,\n ctimeMs,\n mtimeMs,\n mode\n });\n }\n\n const entry = this.entries.get(p);\n\n if (entry !== undefined) {\n const stat = sources.struct.statS();\n const rc = sources.statIndex(this.zip, entry, 0, 0, stat);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = sources.struct.statSize(stat) >>> 0;\n const blksize = 512;\n const blocks = Math.ceil(size / blksize);\n const mtimeMs = (sources.struct.statMtime(stat) >>> 0) * 1000;\n const atimeMs = mtimeMs;\n const birthtimeMs = mtimeMs;\n const ctimeMs = mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = this.getUnixMode(entry, S_IFREG | 0o644);\n return Object.assign(new StatEntry(), {\n uid,\n gid,\n size,\n blksize,\n blocks,\n atime,\n birthtime,\n ctime,\n mtime,\n atimeMs,\n birthtimeMs,\n ctimeMs,\n mtimeMs,\n mode\n });\n }\n\n throw new Error(`Unreachable`);\n }\n\n getUnixMode(index, defaultMode) {\n const rc = sources.file.getExternalAttributes(this.zip, index, 0, 0, sources.uint08S, sources.uint32S);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const opsys = sources.getValue(sources.uint08S, `i8`) >>> 0;\n if (opsys !== sources.ZIP_OPSYS_UNIX) return defaultMode;\n return sources.getValue(sources.uint32S, `i32`) >>> 16;\n }\n\n registerListing(p) {\n let listing = this.listings.get(p);\n if (listing) return listing;\n const parentListing = this.registerListing(ppath.dirname(p));\n listing = new Set();\n parentListing.add(ppath.basename(p));\n this.listings.set(p, listing);\n return listing;\n }\n\n registerEntry(p, index) {\n const parentListing = this.registerListing(ppath.dirname(p));\n parentListing.add(ppath.basename(p));\n this.entries.set(p, index);\n }\n\n resolveFilename(reason, p, resolveLastComponent = true) {\n if (!this.ready) throw EBUSY(`archive closed, ${reason}`);\n let resolvedP = ppath.resolve(PortablePath.root, p);\n if (resolvedP === `/`) return PortablePath.root;\n\n while (true) {\n const parentP = this.resolveFilename(reason, ppath.dirname(resolvedP), true);\n const isDir = this.listings.has(parentP);\n const doesExist = this.entries.has(parentP);\n if (!isDir && !doesExist) throw ENOENT(reason);\n if (!isDir) throw ENOTDIR(reason);\n resolvedP = ppath.resolve(parentP, ppath.basename(resolvedP));\n if (!resolveLastComponent) break;\n const index = sources.name.locate(this.zip, resolvedP);\n if (index === -1) break;\n\n if (this.isSymbolicLink(index)) {\n const target = this.getFileSource(index).toString();\n resolvedP = ppath.resolve(ppath.dirname(resolvedP), target);\n } else {\n break;\n }\n }\n\n return resolvedP;\n }\n\n allocateBuffer(content) {\n if (!Buffer.isBuffer(content)) content = Buffer.from(content);\n const buffer = sources.malloc(content.byteLength);\n if (!buffer) throw new Error(`Couldn't allocate enough memory`); // Copy the file into the Emscripten heap\n\n const heap = new Uint8Array(sources.HEAPU8.buffer, buffer, content.byteLength);\n heap.set(content);\n return {\n buffer,\n byteLength: content.byteLength\n };\n }\n\n allocateUnattachedSource(content) {\n const error = sources.struct.errorS();\n const {\n buffer,\n byteLength\n } = this.allocateBuffer(content);\n const source = sources.source.fromUnattachedBuffer(buffer, byteLength, 0, true, error);\n\n if (source === 0) {\n sources.free(error);\n throw new Error(sources.error.strerror(error));\n }\n\n return source;\n }\n\n allocateSource(content) {\n const {\n buffer,\n byteLength\n } = this.allocateBuffer(content);\n const source = sources.source.fromBuffer(this.zip, buffer, byteLength, 0, true);\n\n if (source === 0) {\n sources.free(buffer);\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n\n return source;\n }\n\n setFileSource(p, content) {\n const target = ppath.relative(PortablePath.root, p);\n const lzSource = this.allocateSource(content);\n\n try {\n return sources.file.add(this.zip, target, lzSource, sources.ZIP_FL_OVERWRITE);\n } catch (error) {\n sources.source.free(lzSource);\n throw error;\n }\n }\n\n isSymbolicLink(index) {\n const attrs = sources.file.getExternalAttributes(this.zip, index, 0, 0, sources.uint08S, sources.uint32S);\n if (attrs === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const opsys = sources.getValue(sources.uint08S, `i8`) >>> 0;\n if (opsys !== sources.ZIP_OPSYS_UNIX) return false;\n const attributes = sources.getValue(sources.uint32S, `i32`) >>> 16;\n return (attributes & S_IFMT) === S_IFLNK;\n }\n\n getFileSource(index) {\n const stat = sources.struct.statS();\n const rc = sources.statIndex(this.zip, index, 0, 0, stat);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const size = sources.struct.statSize(stat);\n const buffer = sources.malloc(size);\n\n try {\n const file = sources.fopenIndex(this.zip, index, 0, 0);\n if (file === 0) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n\n try {\n const rc = sources.fread(file, buffer, size, 0);\n if (rc === -1) throw new Error(sources.error.strerror(sources.file.getError(file)));else if (rc < size) throw new Error(`Incomplete read`);else if (rc > size) throw new Error(`Overread`);\n const memory = sources.HEAPU8.subarray(buffer, buffer + size);\n const data = Buffer.from(memory);\n return data;\n } finally {\n sources.fclose(file);\n }\n } finally {\n sources.free(buffer);\n }\n }\n\n async chmodPromise(p, mask) {\n return this.chmodSync(p, mask);\n }\n\n chmodSync(p, mask) {\n if (this.readOnly) throw EROFS(`chmod '${p}'`);\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false); // We silently ignore chmod requests for directories\n\n if (this.listings.has(resolvedP)) return;\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const oldMod = this.getUnixMode(entry, S_IFREG | 0o000);\n const newMod = oldMod & ~0o777 | mask;\n const rc = sources.file.setExternalAttributes(this.zip, entry, 0, 0, sources.ZIP_OPSYS_UNIX, newMod << 16);\n\n if (rc === -1) {\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n }\n\n async renamePromise(oldP, newP) {\n return this.renameSync(oldP, newP);\n }\n\n renameSync(oldP, newP) {\n throw new Error(`Unimplemented`);\n }\n\n async copyFilePromise(sourceP, destP, flags) {\n return this.copyFileSync(sourceP, destP, flags);\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n if (this.readOnly) throw EROFS(`copyfile '${sourceP} -> '${destP}'`);\n if ((flags & external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE) !== 0) throw ENOSYS(`unsupported clone operation`, `copyfile '${sourceP}' -> ${destP}'`);\n const resolvedSourceP = this.resolveFilename(`copyfile '${sourceP} -> ${destP}'`, sourceP);\n const indexSource = this.entries.get(resolvedSourceP);\n if (typeof indexSource === `undefined`) throw EINVAL(`copyfile '${sourceP}' -> '${destP}'`);\n const resolvedDestP = this.resolveFilename(`copyfile '${sourceP}' -> ${destP}'`, destP);\n const indexDest = this.entries.get(resolvedDestP);\n if ((flags & (external_fs_[\"constants\"].COPYFILE_EXCL | external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE)) !== 0 && typeof indexDest !== `undefined`) throw EEXIST(`copyfile '${sourceP}' -> '${destP}'`);\n const source = this.getFileSource(indexSource);\n const newIndex = this.setFileSource(resolvedDestP, source);\n\n if (newIndex !== indexDest) {\n this.registerEntry(resolvedDestP, newIndex);\n }\n }\n\n async appendFilePromise(p, content, opts) {\n return this.appendFileSync(p, content, opts);\n }\n\n appendFileSync(p, content, opts = {}) {\n if (this.readOnly) throw EROFS(`open '${p}'`);\n if (typeof opts === `undefined`) opts = {\n flag: `a`\n };else if (typeof opts === `string`) opts = {\n flag: `a`,\n encoding: opts\n };else if (typeof opts.flag === `undefined`) opts = Object.assign({\n flag: `a`\n }, opts);\n return this.writeFileSync(p, content, opts);\n }\n\n async writeFilePromise(p, content, opts) {\n return this.writeFileSync(p, content, opts);\n }\n\n writeFileSync(p, content, opts) {\n if (typeof p !== `string`) throw EBADF(`read`);\n if (this.readOnly) throw EROFS(`open '${p}'`);\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (this.listings.has(resolvedP)) throw EISDIR(`open '${p}'`);\n const index = this.entries.get(resolvedP);\n if (index !== undefined && typeof opts === `object` && opts.flag && opts.flag.includes(`a`)) content = Buffer.concat([this.getFileSource(index), Buffer.from(content)]);\n let encoding = null;\n if (typeof opts === `string`) encoding = opts;else if (typeof opts === `object` && opts.encoding) encoding = opts.encoding;\n if (encoding !== null) content = content.toString(encoding);\n const newIndex = this.setFileSource(resolvedP, content);\n\n if (newIndex !== index) {\n this.registerEntry(resolvedP, newIndex);\n }\n }\n\n async unlinkPromise(p) {\n return this.unlinkSync(p);\n }\n\n unlinkSync(p) {\n throw new Error(`Unimplemented`);\n }\n\n async utimesPromise(p, atime, mtime) {\n return this.utimesSync(p, atime, mtime);\n }\n\n utimesSync(p, atime, mtime) {\n if (this.readOnly) throw EROFS(`utimes '${p}'`);\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p);\n return this.utimesImpl(resolvedP, mtime);\n }\n\n async lutimesPromise(p, atime, mtime) {\n return this.lutimesSync(p, atime, mtime);\n }\n\n lutimesSync(p, atime, mtime) {\n if (this.readOnly) throw EROFS(`lutimes '${p}'`);\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n return this.utimesImpl(resolvedP, mtime);\n }\n\n utimesImpl(resolvedP, mtime) {\n if (this.listings.has(resolvedP)) if (!this.entries.has(resolvedP)) this.hydrateDirectory(resolvedP);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const rc = sources.file.setMtime(this.zip, entry, 0, toUnixTimestamp(mtime), 0);\n\n if (rc === -1) {\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n }\n\n async mkdirPromise(p, opts) {\n return this.mkdirSync(p, opts);\n }\n\n mkdirSync(p, opts) {\n if (opts && opts.recursive) return this.mkdirpSync(p, {\n chmod: opts.mode\n });\n if (this.readOnly) throw EROFS(`mkdir '${p}'`);\n const resolvedP = this.resolveFilename(`mkdir '${p}'`, p);\n if (this.entries.has(resolvedP) || this.listings.has(resolvedP)) throw EEXIST(`mkdir '${p}'`);\n this.hydrateDirectory(resolvedP);\n }\n\n async rmdirPromise(p) {\n return this.rmdirSync(p);\n }\n\n rmdirSync(p) {\n throw new Error(`Unimplemented`);\n }\n\n hydrateDirectory(resolvedP) {\n const index = sources.dir.add(this.zip, ppath.relative(PortablePath.root, resolvedP));\n if (index === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n this.registerListing(resolvedP);\n this.registerEntry(resolvedP, index);\n return index;\n }\n\n async symlinkPromise(target, p) {\n return this.symlinkSync(target, p);\n }\n\n symlinkSync(target, p) {\n if (this.readOnly) throw EROFS(`symlink '${target}' -> '${p}'`);\n const resolvedP = this.resolveFilename(`symlink '${target}' -> '${p}'`, p);\n if (this.listings.has(resolvedP)) throw EISDIR(`symlink '${target}' -> '${p}'`);\n if (this.entries.has(resolvedP)) throw EEXIST(`symlink '${target}' -> '${p}'`);\n const index = this.setFileSource(resolvedP, target);\n this.registerEntry(resolvedP, index);\n const rc = sources.file.setExternalAttributes(this.zip, index, 0, 0, sources.ZIP_OPSYS_UNIX, (0o120000 | 0o777) << 16);\n\n if (rc === -1) {\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n }\n\n async readFilePromise(p, encoding) {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.readFileSync(p, encoding);\n\n default:\n return this.readFileSync(p, encoding);\n }\n }\n\n readFileSync(p, encoding) {\n if (typeof p !== `string`) throw EBADF(`read`); // This is messed up regarding the TS signatures\n\n if (typeof encoding === `object`) // @ts-ignore\n encoding = encoding ? encoding.encoding : undefined;\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`open '${p}'`); // Ensures that the last component is a directory, if the user said so (even if it is we'll throw right after with EISDIR anyway)\n\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`open '${p}'`);\n if (this.listings.has(resolvedP)) throw EISDIR(`read`);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const data = this.getFileSource(entry);\n return encoding ? data.toString(encoding) : data;\n }\n\n async readdirPromise(p) {\n return this.readdirSync(p);\n }\n\n readdirSync(p) {\n const resolvedP = this.resolveFilename(`scandir '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`scandir '${p}'`);\n const directoryListing = this.listings.get(resolvedP);\n if (!directoryListing) throw ENOTDIR(`scandir '${p}'`);\n return Array.from(directoryListing);\n }\n\n async readlinkPromise(p) {\n return this.readlinkSync(p);\n }\n\n readlinkSync(p) {\n const resolvedP = this.resolveFilename(`readlink '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`readlink '${p}'`); // Ensure that the last component is a directory (if it is we'll throw right after with EISDIR anyway)\n\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`open '${p}'`);\n if (this.listings.has(resolvedP)) throw EINVAL(`readlink '${p}'`);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const rc = sources.file.getExternalAttributes(this.zip, entry, 0, 0, sources.uint08S, sources.uint32S);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const opsys = sources.getValue(sources.uint08S, `i8`) >>> 0;\n if (opsys !== sources.ZIP_OPSYS_UNIX) throw EINVAL(`readlink '${p}'`);\n const attributes = sources.getValue(sources.uint32S, `i32`) >>> 16;\n if ((attributes & 0o170000) !== 0o120000) throw EINVAL(`readlink '${p}'`);\n return this.getFileSource(entry).toString();\n }\n\n watch(p, a, b) {\n let persistent;\n\n switch (typeof a) {\n case `function`:\n case `string`:\n case `undefined`:\n {\n persistent = true;\n }\n break;\n\n default:\n {\n // @ts-ignore\n ({\n persistent = true\n } = a);\n }\n break;\n }\n\n if (!persistent) return {\n on: () => {},\n close: () => {}\n };\n const interval = setInterval(() => {}, 24 * 60 * 60 * 1000);\n return {\n on: () => {},\n close: () => {\n clearInterval(interval);\n }\n };\n }\n\n}\n;\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/ZipOpenFS.ts\n\n\n\n\n\nconst ZIP_FD = 0x80000000;\nclass ZipOpenFS_ZipOpenFS extends FakeFS_BasePortableFakeFS {\n constructor({\n baseFs = new NodeFS_NodeFS(),\n filter = null,\n readOnlyArchives = false,\n useCache = true\n } = {}) {\n super();\n this.fdMap = new Map();\n this.nextFd = 3;\n this.isZip = new Set();\n this.notZip = new Set();\n this.baseFs = baseFs;\n this.zipInstances = useCache ? new Map() : null;\n this.filter = filter;\n this.readOnlyArchives = readOnlyArchives;\n this.isZip = new Set();\n this.notZip = new Set();\n }\n\n static open(fn) {\n const zipOpenFs = new ZipOpenFS_ZipOpenFS();\n\n try {\n return fn(zipOpenFs);\n } finally {\n zipOpenFs.saveAndClose();\n }\n }\n\n static async openPromise(fn) {\n const zipOpenFs = new ZipOpenFS_ZipOpenFS();\n\n try {\n return await fn(zipOpenFs);\n } finally {\n zipOpenFs.saveAndClose();\n }\n }\n\n getRealPath() {\n return this.baseFs.getRealPath();\n }\n\n saveAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.saveAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n\n discardAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.discardAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n\n remapFd(zipFs, fd) {\n const remappedFd = this.nextFd++ | ZIP_FD;\n this.fdMap.set(remappedFd, [zipFs, fd]);\n return remappedFd;\n }\n\n async openPromise(p, flags, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.openPromise(p, flags, mode);\n }, async (zipFs, {\n subPath\n }) => {\n return this.remapFd(zipFs, (await zipFs.openPromise(subPath, flags, mode)));\n });\n }\n\n openSync(p, flags, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.openSync(p, flags, mode);\n }, (zipFs, {\n subPath\n }) => {\n return this.remapFd(zipFs, zipFs.openSync(subPath, flags, mode));\n });\n }\n\n async readPromise(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) return await this.baseFs.readPromise(fd, buffer, offset, length, position);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n return await zipFs.readPromise(realFd, buffer, offset, length, position);\n }\n\n readSync(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) return this.baseFs.readSync(fd, buffer, offset, length, position);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n return zipFs.readSync(realFd, buffer, offset, length, position);\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) {\n if (typeof buffer === `string`) {\n return await this.baseFs.writePromise(fd, buffer, offset);\n } else {\n return await this.baseFs.writePromise(fd, buffer, offset, length, position);\n }\n }\n\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, write`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n\n if (typeof buffer === `string`) {\n return await zipFs.writePromise(realFd, buffer, offset);\n } else {\n return await zipFs.writePromise(realFd, buffer, offset, length, position);\n }\n }\n\n writeSync(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) {\n if (typeof buffer === `string`) {\n return this.baseFs.writeSync(fd, buffer, offset);\n } else {\n return this.baseFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, write`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n\n if (typeof buffer === `string`) {\n return zipFs.writeSync(realFd, buffer, offset);\n } else {\n return zipFs.writeSync(realFd, buffer, offset, length, position);\n }\n }\n\n async closePromise(fd) {\n if ((fd & ZIP_FD) === 0) return await this.baseFs.closePromise(fd);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, close`), {\n code: `EBADF`\n });\n this.fdMap.delete(fd);\n const [zipFs, realFd] = entry;\n return await zipFs.closePromise(realFd);\n }\n\n closeSync(fd) {\n if ((fd & ZIP_FD) === 0) return this.baseFs.closeSync(fd);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, close`), {\n code: `EBADF`\n });\n this.fdMap.delete(fd);\n const [zipFs, realFd] = entry;\n return zipFs.closeSync(realFd);\n }\n\n createReadStream(p, opts) {\n if (p === null) return this.baseFs.createReadStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createReadStream(p, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.createReadStream(subPath, opts);\n });\n }\n\n createWriteStream(p, opts) {\n if (p === null) return this.baseFs.createWriteStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createWriteStream(p, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.createWriteStream(subPath, opts);\n });\n }\n\n async realpathPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.realpathPromise(p);\n }, async (zipFs, {\n archivePath,\n subPath\n }) => {\n return this.pathUtils.resolve((await this.baseFs.realpathPromise(archivePath)), this.pathUtils.relative(PortablePath.root, (await zipFs.realpathPromise(subPath))));\n });\n }\n\n realpathSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.realpathSync(p);\n }, (zipFs, {\n archivePath,\n subPath\n }) => {\n return this.pathUtils.resolve(this.baseFs.realpathSync(archivePath), this.pathUtils.relative(PortablePath.root, zipFs.realpathSync(subPath)));\n });\n }\n\n async existsPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.existsPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.existsPromise(subPath);\n });\n }\n\n existsSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.existsSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.existsSync(subPath);\n });\n }\n\n async accessPromise(p, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.accessPromise(p, mode);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.accessPromise(subPath, mode);\n });\n }\n\n accessSync(p, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.accessSync(p, mode);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.accessSync(subPath, mode);\n });\n }\n\n async statPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.statPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.statPromise(subPath);\n });\n }\n\n statSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.statSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.statSync(subPath);\n });\n }\n\n async lstatPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.lstatPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.lstatPromise(subPath);\n });\n }\n\n lstatSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.lstatSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.lstatSync(subPath);\n });\n }\n\n async chmodPromise(p, mask) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.chmodPromise(p, mask);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.chmodPromise(subPath, mask);\n });\n }\n\n chmodSync(p, mask) {\n return this.makeCallSync(p, () => {\n return this.baseFs.chmodSync(p, mask);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.chmodSync(subPath, mask);\n });\n }\n\n async renamePromise(oldP, newP) {\n return await this.makeCallPromise(oldP, async () => {\n return await this.makeCallPromise(newP, async () => {\n return await this.baseFs.renamePromise(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n });\n }, async (zipFsO, {\n subPath: subPathO\n }) => {\n return await this.makeCallPromise(newP, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n }, async (zipFsN, {\n subPath: subPathN\n }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n } else {\n return await zipFsO.renamePromise(subPathO, subPathN);\n }\n });\n });\n }\n\n renameSync(oldP, newP) {\n return this.makeCallSync(oldP, () => {\n return this.makeCallSync(newP, () => {\n return this.baseFs.renameSync(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n });\n }, (zipFsO, {\n subPath: subPathO\n }) => {\n return this.makeCallSync(newP, () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n }, (zipFsN, {\n subPath: subPathN\n }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n } else {\n return zipFsO.renameSync(subPathO, subPathN);\n }\n });\n });\n }\n\n async copyFilePromise(sourceP, destP, flags = 0) {\n const fallback = async (sourceFs, sourceP, destFs, destP) => {\n if ((flags & external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE) !== 0) throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), {\n code: `EXDEV`\n });\n if (flags & external_fs_[\"constants\"].COPYFILE_EXCL && (await this.existsPromise(sourceP))) throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EEXIST`\n });\n let content;\n\n try {\n content = await sourceFs.readFilePromise(sourceP);\n } catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EINVAL`\n });\n }\n\n await destFs.writeFilePromise(destP, content);\n };\n\n return await this.makeCallPromise(sourceP, async () => {\n return await this.makeCallPromise(destP, async () => {\n return await this.baseFs.copyFilePromise(sourceP, destP, flags);\n }, async (zipFsD, {\n subPath: subPathD\n }) => {\n return await fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, async (zipFsS, {\n subPath: subPathS\n }) => {\n return await this.makeCallPromise(destP, async () => {\n return await fallback(zipFsS, subPathS, this.baseFs, destP);\n }, async (zipFsD, {\n subPath: subPathD\n }) => {\n if (zipFsS !== zipFsD) {\n return await fallback(zipFsS, subPathS, zipFsD, subPathD);\n } else {\n return await zipFsS.copyFilePromise(subPathS, subPathD, flags);\n }\n });\n });\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n const fallback = (sourceFs, sourceP, destFs, destP) => {\n if ((flags & external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE) !== 0) throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), {\n code: `EXDEV`\n });\n if (flags & external_fs_[\"constants\"].COPYFILE_EXCL && this.existsSync(sourceP)) throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EEXIST`\n });\n let content;\n\n try {\n content = sourceFs.readFileSync(sourceP);\n } catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EINVAL`\n });\n }\n\n destFs.writeFileSync(destP, content);\n };\n\n return this.makeCallSync(sourceP, () => {\n return this.makeCallSync(destP, () => {\n return this.baseFs.copyFileSync(sourceP, destP, flags);\n }, (zipFsD, {\n subPath: subPathD\n }) => {\n return fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, (zipFsS, {\n subPath: subPathS\n }) => {\n return this.makeCallSync(destP, () => {\n return fallback(zipFsS, subPathS, this.baseFs, destP);\n }, (zipFsD, {\n subPath: subPathD\n }) => {\n if (zipFsS !== zipFsD) {\n return fallback(zipFsS, subPathS, zipFsD, subPathD);\n } else {\n return zipFsS.copyFileSync(subPathS, subPathD, flags);\n }\n });\n });\n }\n\n async appendFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.appendFilePromise(p, content, opts);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.appendFilePromise(subPath, content, opts);\n });\n }\n\n appendFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.appendFileSync(p, content, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.appendFileSync(subPath, content, opts);\n });\n }\n\n async writeFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.writeFilePromise(p, content, opts);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.writeFilePromise(subPath, content, opts);\n });\n }\n\n writeFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.writeFileSync(p, content, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.writeFileSync(subPath, content, opts);\n });\n }\n\n async unlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.unlinkPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.unlinkPromise(subPath);\n });\n }\n\n unlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.unlinkSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.unlinkSync(subPath);\n });\n }\n\n async utimesPromise(p, atime, mtime) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.utimesPromise(p, atime, mtime);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.utimesPromise(subPath, atime, mtime);\n });\n }\n\n utimesSync(p, atime, mtime) {\n return this.makeCallSync(p, () => {\n return this.baseFs.utimesSync(p, atime, mtime);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.utimesSync(subPath, atime, mtime);\n });\n }\n\n async mkdirPromise(p, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.mkdirPromise(p, opts);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.mkdirPromise(subPath, opts);\n });\n }\n\n mkdirSync(p, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.mkdirSync(p, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.mkdirSync(subPath, opts);\n });\n }\n\n async rmdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.rmdirPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.rmdirPromise(subPath);\n });\n }\n\n rmdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.rmdirSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.rmdirSync(subPath);\n });\n }\n\n async symlinkPromise(target, p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.symlinkPromise(target, p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.symlinkPromise(target, subPath);\n });\n }\n\n symlinkSync(target, p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.symlinkSync(target, p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.symlinkSync(target, subPath);\n });\n }\n\n async readFilePromise(p, encoding) {\n return this.makeCallPromise(p, async () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return await this.baseFs.readFilePromise(p, encoding);\n\n default:\n return await this.baseFs.readFilePromise(p, encoding);\n }\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.readFilePromise(subPath, encoding);\n });\n }\n\n readFileSync(p, encoding) {\n return this.makeCallSync(p, () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.baseFs.readFileSync(p, encoding);\n\n default:\n return this.baseFs.readFileSync(p, encoding);\n }\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.readFileSync(subPath, encoding);\n });\n }\n\n async readdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readdirPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.readdirPromise(subPath);\n }, {\n requireSubpath: false\n });\n }\n\n readdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readdirSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.readdirSync(subPath);\n }, {\n requireSubpath: false\n });\n }\n\n async readlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readlinkPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.readlinkPromise(subPath);\n });\n }\n\n readlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readlinkSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.readlinkSync(subPath);\n });\n }\n\n watch(p, a, b) {\n return this.makeCallSync(p, () => {\n return this.baseFs.watch(p, // @ts-ignore\n a, b);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.watch(subPath, // @ts-ignore\n a, b);\n });\n }\n\n async makeCallPromise(p, discard, accept, {\n requireSubpath = true\n } = {}) {\n if (typeof p !== `string`) return await discard();\n const normalizedP = this.pathUtils.normalize(this.pathUtils.resolve(PortablePath.root, p));\n const zipInfo = this.findZip(normalizedP);\n if (!zipInfo) return await discard();\n if (requireSubpath && zipInfo.subPath === `/`) return await discard();\n return await this.getZipPromise(zipInfo.archivePath, async zipFs => await accept(zipFs, zipInfo));\n }\n\n makeCallSync(p, discard, accept, {\n requireSubpath = true\n } = {}) {\n if (typeof p !== `string`) return discard();\n const normalizedP = this.pathUtils.normalize(this.pathUtils.resolve(PortablePath.root, p));\n const zipInfo = this.findZip(normalizedP);\n if (!zipInfo) return discard();\n if (requireSubpath && zipInfo.subPath === `/`) return discard();\n return this.getZipSync(zipInfo.archivePath, zipFs => accept(zipFs, zipInfo));\n }\n\n findZip(p) {\n if (this.filter && !this.filter.test(p)) return null;\n const parts = p.split(/\\//g);\n\n for (let t = 2; t <= parts.length; ++t) {\n const archivePath = parts.slice(0, t).join(`/`);\n if (this.notZip.has(archivePath)) continue;\n if (this.isZip.has(archivePath)) return {\n archivePath,\n subPath: this.pathUtils.resolve(PortablePath.root, parts.slice(t).join(`/`))\n };\n let realArchivePath = archivePath;\n let stat;\n\n while (true) {\n try {\n stat = this.baseFs.lstatSync(realArchivePath);\n } catch (error) {\n return null;\n }\n\n if (stat.isSymbolicLink()) {\n realArchivePath = this.pathUtils.resolve(this.pathUtils.dirname(realArchivePath), this.baseFs.readlinkSync(realArchivePath));\n } else {\n break;\n }\n }\n\n const isZip = stat.isFile() && this.pathUtils.extname(realArchivePath) === `.zip`;\n\n if (isZip) {\n this.isZip.add(archivePath);\n return {\n archivePath,\n subPath: this.pathUtils.resolve(PortablePath.root, parts.slice(t).join(`/`))\n };\n } else {\n this.notZip.add(archivePath);\n\n if (stat.isFile()) {\n return null;\n }\n }\n }\n\n return null;\n }\n\n async getZipPromise(p, accept) {\n const getZipOptions = async () => ({\n baseFs: this.baseFs,\n readOnly: this.readOnlyArchives,\n stats: await this.baseFs.statPromise(p)\n });\n\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs) this.zipInstances.set(p, zipFs = new ZipFS_ZipFS(p, (await getZipOptions())));\n return await accept(zipFs);\n } else {\n const zipFs = new ZipFS_ZipFS(p, (await getZipOptions()));\n\n try {\n return await accept(zipFs);\n } finally {\n zipFs.saveAndClose();\n }\n }\n }\n\n getZipSync(p, accept) {\n const getZipOptions = () => ({\n baseFs: this.baseFs,\n readOnly: this.readOnlyArchives,\n stats: this.baseFs.statSync(p)\n });\n\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs) this.zipInstances.set(p, zipFs = new ZipFS_ZipFS(p, getZipOptions()));\n return accept(zipFs);\n } else {\n const zipFs = new ZipFS_ZipFS(p, getZipOptions());\n\n try {\n return accept(zipFs);\n } finally {\n zipFs.saveAndClose();\n }\n }\n }\n\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/ProxiedFS.ts\n\nclass ProxiedFS_ProxiedFS extends FakeFS_FakeFS {\n resolve(path) {\n return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));\n }\n\n getRealPath() {\n return this.mapFromBase(this.baseFs.getRealPath());\n }\n\n openPromise(p, flags, mode) {\n return this.baseFs.openPromise(this.mapToBase(p), flags, mode);\n }\n\n openSync(p, flags, mode) {\n return this.baseFs.openSync(this.mapToBase(p), flags, mode);\n }\n\n async readPromise(fd, buffer, offset, length, position) {\n return await this.baseFs.readPromise(fd, buffer, offset, length, position);\n }\n\n readSync(fd, buffer, offset, length, position) {\n return this.baseFs.readSync(fd, buffer, offset, length, position);\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return await this.baseFs.writePromise(fd, buffer, offset);\n } else {\n return await this.baseFs.writePromise(fd, buffer, offset, length, position);\n }\n }\n\n writeSync(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.baseFs.writeSync(fd, buffer, offset);\n } else {\n return this.baseFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n closePromise(fd) {\n return this.baseFs.closePromise(fd);\n }\n\n closeSync(fd) {\n this.baseFs.closeSync(fd);\n }\n\n createReadStream(p, opts) {\n return this.baseFs.createReadStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n\n createWriteStream(p, opts) {\n return this.baseFs.createWriteStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n\n async realpathPromise(p) {\n return this.mapFromBase((await this.baseFs.realpathPromise(this.mapToBase(p))));\n }\n\n realpathSync(p) {\n return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(p)));\n }\n\n existsPromise(p) {\n return this.baseFs.existsPromise(this.mapToBase(p));\n }\n\n existsSync(p) {\n return this.baseFs.existsSync(this.mapToBase(p));\n }\n\n accessSync(p, mode) {\n return this.baseFs.accessSync(this.mapToBase(p), mode);\n }\n\n accessPromise(p, mode) {\n return this.baseFs.accessPromise(this.mapToBase(p), mode);\n }\n\n statPromise(p) {\n return this.baseFs.statPromise(this.mapToBase(p));\n }\n\n statSync(p) {\n return this.baseFs.statSync(this.mapToBase(p));\n }\n\n lstatPromise(p) {\n return this.baseFs.lstatPromise(this.mapToBase(p));\n }\n\n lstatSync(p) {\n return this.baseFs.lstatSync(this.mapToBase(p));\n }\n\n chmodPromise(p, mask) {\n return this.baseFs.chmodPromise(this.mapToBase(p), mask);\n }\n\n chmodSync(p, mask) {\n return this.baseFs.chmodSync(this.mapToBase(p), mask);\n }\n\n renamePromise(oldP, newP) {\n return this.baseFs.renamePromise(this.mapToBase(oldP), this.mapToBase(newP));\n }\n\n renameSync(oldP, newP) {\n return this.baseFs.renameSync(this.mapToBase(oldP), this.mapToBase(newP));\n }\n\n copyFilePromise(sourceP, destP, flags = 0) {\n return this.baseFs.copyFilePromise(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n return this.baseFs.copyFileSync(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n\n appendFilePromise(p, content, opts) {\n return this.baseFs.appendFilePromise(this.fsMapToBase(p), content, opts);\n }\n\n appendFileSync(p, content, opts) {\n return this.baseFs.appendFileSync(this.fsMapToBase(p), content, opts);\n }\n\n writeFilePromise(p, content, opts) {\n return this.baseFs.writeFilePromise(this.fsMapToBase(p), content, opts);\n }\n\n writeFileSync(p, content, opts) {\n return this.baseFs.writeFileSync(this.fsMapToBase(p), content, opts);\n }\n\n unlinkPromise(p) {\n return this.baseFs.unlinkPromise(this.mapToBase(p));\n }\n\n unlinkSync(p) {\n return this.baseFs.unlinkSync(this.mapToBase(p));\n }\n\n utimesPromise(p, atime, mtime) {\n return this.baseFs.utimesPromise(this.mapToBase(p), atime, mtime);\n }\n\n utimesSync(p, atime, mtime) {\n return this.baseFs.utimesSync(this.mapToBase(p), atime, mtime);\n }\n\n mkdirPromise(p, opts) {\n return this.baseFs.mkdirPromise(this.mapToBase(p), opts);\n }\n\n mkdirSync(p, opts) {\n return this.baseFs.mkdirSync(this.mapToBase(p), opts);\n }\n\n rmdirPromise(p) {\n return this.baseFs.rmdirPromise(this.mapToBase(p));\n }\n\n rmdirSync(p) {\n return this.baseFs.rmdirSync(this.mapToBase(p));\n }\n\n symlinkPromise(target, p) {\n return this.baseFs.symlinkPromise(this.mapToBase(target), this.mapToBase(p));\n }\n\n symlinkSync(target, p) {\n return this.baseFs.symlinkSync(this.mapToBase(target), this.mapToBase(p));\n }\n\n readFilePromise(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding);\n } else {\n return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding);\n }\n }\n\n readFileSync(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFileSync(this.fsMapToBase(p), encoding);\n } else {\n return this.baseFs.readFileSync(this.fsMapToBase(p), encoding);\n }\n }\n\n readdirPromise(p) {\n return this.baseFs.readdirPromise(this.mapToBase(p));\n }\n\n readdirSync(p) {\n return this.baseFs.readdirSync(this.mapToBase(p));\n }\n\n async readlinkPromise(p) {\n return this.mapFromBase((await this.baseFs.readlinkPromise(this.mapToBase(p))));\n }\n\n readlinkSync(p) {\n return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(p)));\n }\n\n watch(p, a, b) {\n return this.baseFs.watch(this.mapToBase(p), // @ts-ignore\n a, b);\n }\n\n fsMapToBase(p) {\n if (typeof p === `number`) {\n return p;\n } else {\n return this.mapToBase(p);\n }\n }\n\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/VirtualFS.ts\n\n\n // https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js\n\nconst escapeRegexp = s => s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n\nclass VirtualFS_VirtualFS extends ProxiedFS_ProxiedFS {\n constructor(virtual, {\n baseFs = new NodeFS_NodeFS()\n } = {}) {\n super(ppath);\n this.baseFs = baseFs;\n this.target = ppath.dirname(virtual);\n this.virtual = virtual;\n this.mapToBaseRegExp = new RegExp(`^(${escapeRegexp(this.virtual)})((?:/([^\\/]+)(?:/([^/]+))?)?((?:/.*)?))$`);\n }\n\n static makeVirtualPath(base, component, to) {\n // Obtains the relative distance between the virtual path and its actual target\n const target = ppath.relative(ppath.dirname(base), to);\n const segments = target.split(`/`); // Counts how many levels we need to go back to start applying the rest of the path\n\n let depth = 0;\n\n while (depth < segments.length && segments[depth] === `..`) depth += 1;\n\n const finalSegments = segments.slice(depth);\n const fullVirtualPath = ppath.join(base, component, String(depth), ...finalSegments);\n return fullVirtualPath;\n }\n\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n\n realpathSync(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match) return this.baseFs.realpathSync(p);\n if (!match[5]) return p;\n const realpath = this.baseFs.realpathSync(this.mapToBase(p));\n return VirtualFS_VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n\n async realpathPromise(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match) return await this.baseFs.realpathPromise(p);\n if (!match[5]) return p;\n const realpath = await this.baseFs.realpathPromise(this.mapToBase(p));\n return VirtualFS_VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n\n mapToBase(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match) return p;\n if (match[3]) return this.mapToBase(ppath.join(this.target, `../`.repeat(Number(match[4])), match[5]));\n return this.target;\n }\n\n mapFromBase(p) {\n return p;\n }\n\n}\n// EXTERNAL MODULE: external \"module\"\nvar external_module_ = __webpack_require__(1);\nvar external_module_default = /*#__PURE__*/__webpack_require__.n(external_module_);\n\n// EXTERNAL MODULE: external \"string_decoder\"\nvar external_string_decoder_ = __webpack_require__(7);\nvar external_string_decoder_default = /*#__PURE__*/__webpack_require__.n(external_string_decoder_);\n\n// EXTERNAL MODULE: /Users/mael.nison/berry/.yarn/cache/tmp-npm-0.0.33-bcbf65df2a-1.zip/node_modules/tmp/lib/tmp.js\nvar tmp = __webpack_require__(4);\nvar tmp_default = /*#__PURE__*/__webpack_require__.n(tmp);\n\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/index.ts\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction patchFs(patchedFs, fakeFs) {\n const SYNC_IMPLEMENTATIONS = new Set([`accessSync`, `appendFileSync`, `createReadStream`, `chmodSync`, `closeSync`, `copyFileSync`, `lstatSync`, `mkdirSync`, `openSync`, `readSync`, `readlinkSync`, `readFileSync`, `readdirSync`, `readlinkSync`, `realpathSync`, `renameSync`, `rmdirSync`, `statSync`, `symlinkSync`, `unlinkSync`, `utimesSync`, `watch`, `writeFileSync`, `writeSync`]);\n const ASYNC_IMPLEMENTATIONS = new Set([`accessPromise`, `appendFilePromise`, `chmodPromise`, `closePromise`, `copyFilePromise`, `lstatPromise`, `mkdirPromise`, `openPromise`, `readdirPromise`, `realpathPromise`, `readFilePromise`, `readdirPromise`, `readlinkPromise`, `renamePromise`, `rmdirPromise`, `statPromise`, `symlinkPromise`, `unlinkPromise`, `utimesPromise`, `writeFilePromise`, `writeSync`]);\n\n patchedFs.existsSync = p => {\n try {\n return fakeFs.existsSync(p);\n } catch (error) {\n return false;\n }\n };\n\n patchedFs.exists = (p, ...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => {};\n process.nextTick(() => {\n fakeFs.existsPromise(p).then(exists => {\n callback(exists);\n }, () => {\n callback(false);\n });\n });\n };\n\n patchedFs.read = (p, buffer, ...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => {};\n process.nextTick(() => {\n fakeFs.readPromise(p, buffer, ...args).then(bytesRead => {\n callback(undefined, bytesRead, buffer);\n }, error => {\n callback(error);\n });\n });\n };\n\n for (const fnName of ASYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName.replace(/Promise$/, ``);\n\n patchedFs[origName] = (...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => {};\n process.nextTick(() => {\n fakeImpl(...args).then(result => {\n callback(undefined, result);\n }, error => {\n callback(error);\n });\n });\n };\n }\n\n for (const fnName of SYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName;\n patchedFs[origName] = fakeImpl;\n }\n\n patchedFs.realpathSync.native = patchedFs.realpathSync;\n patchedFs.realpath.native = patchedFs.realpath;\n}\nfunction extendFs(realFs, fakeFs) {\n const patchedFs = Object.create(realFs);\n patchFs(patchedFs, fakeFs);\n return patchedFs;\n}\nconst xfs = Object.assign(new NodeFS_NodeFS(), {\n mktempSync(cb) {\n const {\n name,\n removeCallback\n } = tmp_default.a.dirSync({\n unsafeCleanup: true\n });\n\n if (typeof cb === `undefined`) {\n return npath.toPortablePath(name);\n } else {\n try {\n return cb(npath.toPortablePath(name));\n } finally {\n removeCallback();\n }\n }\n },\n\n mktempPromise(cb) {\n if (typeof cb === `undefined`) {\n return new Promise((resolve, reject) => {\n tmp_default.a.dir({\n unsafeCleanup: true\n }, (err, path) => {\n if (err) {\n reject(err);\n } else {\n resolve(npath.toPortablePath(path));\n }\n });\n });\n } else {\n return new Promise((resolve, reject) => {\n tmp_default.a.dir({\n unsafeCleanup: true\n }, (err, path, cleanup) => {\n if (err) {\n reject(err);\n } else {\n Promise.resolve(npath.toPortablePath(path)).then(cb).then(result => {\n cleanup();\n resolve(result);\n }, error => {\n cleanup();\n reject(error);\n });\n }\n });\n });\n }\n }\n\n});\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/PosixFS.ts\n\n\nclass PosixFS_PosixFS extends ProxiedFS_ProxiedFS {\n constructor(baseFs) {\n super(npath);\n this.baseFs = baseFs;\n }\n\n mapFromBase(path) {\n return npath.fromPortablePath(path);\n }\n\n mapToBase(path) {\n return npath.toPortablePath(path);\n }\n\n}\n// CONCATENATED MODULE: ./sources/loader/internalTools.ts\nvar ErrorCode;\n\n(function (ErrorCode) {\n ErrorCode[\"API_ERROR\"] = \"API_ERROR\";\n ErrorCode[\"BLACKLISTED\"] = \"BLACKLISTED\";\n ErrorCode[\"BUILTIN_NODE_RESOLUTION_FAILED\"] = \"BUILTIN_NODE_RESOLUTION_FAILED\";\n ErrorCode[\"MISSING_DEPENDENCY\"] = \"MISSING_DEPENDENCY\";\n ErrorCode[\"MISSING_PEER_DEPENDENCY\"] = \"MISSING_PEER_DEPENDENCY\";\n ErrorCode[\"QUALIFIED_PATH_RESOLUTION_FAILED\"] = \"QUALIFIED_PATH_RESOLUTION_FAILED\";\n ErrorCode[\"INTERNAL\"] = \"INTERNAL\";\n ErrorCode[\"UNDECLARED_DEPENDENCY\"] = \"UNDECLARED_DEPENDENCY\";\n ErrorCode[\"UNSUPPORTED\"] = \"UNSUPPORTED\";\n})(ErrorCode || (ErrorCode = {}));\n\n; // Some errors are exposed as MODULE_NOT_FOUND for compatibility with packages\n// that expect this umbrella error when the resolution fails\n\nconst MODULE_NOT_FOUND_ERRORS = new Set([ErrorCode.BLACKLISTED, ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, ErrorCode.MISSING_DEPENDENCY, ErrorCode.MISSING_PEER_DEPENDENCY, ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, ErrorCode.UNDECLARED_DEPENDENCY]);\n/**\n * Simple helper function that assign an error code to an error, so that it can more easily be caught and used\n * by third-parties.\n */\n\nfunction internalTools_makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode) ? `MODULE_NOT_FOUND` : pnpCode;\n return Object.assign(new Error(message), {\n code,\n pnpCode,\n data\n });\n}\n/**\n * Returns the module that should be used to resolve require calls. It's usually the direct parent, except if we're\n * inside an eval expression.\n */\n\nfunction getIssuerModule(parent) {\n let issuer = parent;\n\n while (issuer && (issuer.id === '[eval]' || issuer.id === '' || !issuer.filename)) issuer = issuer.parent;\n\n return issuer;\n}\n// CONCATENATED MODULE: ./sources/loader/applyPatch.ts\nvar __rest = undefined && undefined.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\nfunction applyPatch(pnpapi, opts) {\n // @ts-ignore\n const builtinModules = new Set(external_module_default.a.builtinModules || Object.keys(process.binding('natives'))); // The callback function gets called to wrap the return value of the module names matching the regexp\n\n const patchedModules = [];\n\n if (opts.compatibilityMode !== false) {\n // Modern versions of `resolve` support a specific entry point that custom resolvers can use\n // to inject a specific resolution logic without having to patch the whole package.\n //\n // Cf: https://github.com/browserify/resolve/pull/174\n patchedModules.push([/^\\.\\/normalize-options\\.js$/, (issuer, normalizeOptions) => {\n if (!issuer || issuer.name !== 'resolve') return normalizeOptions;\n return (request, opts) => {\n opts = opts || {};\n if (opts.forceNodeResolution) return opts;\n opts.preserveSymlinks = true;\n\n opts.paths = function (request, basedir, getNodeModulesDir, opts) {\n // Extract the name of the package being requested (1=full name, 2=scope name, 3=local name)\n const parts = request.match(/^((?:(@[^\\/]+)\\/)?([^\\/]+))/);\n if (!parts) throw new Error(`Assertion failed: Expected the \"resolve\" package to call the \"paths\" callback with package names only (got \"${request}\")`); // make sure that basedir ends with a slash\n\n if (basedir.charAt(basedir.length - 1) !== '/') basedir = external_path_default.a.join(basedir, '/'); // TODO Handle portable paths\n // This is guaranteed to return the path to the \"package.json\" file from the given package\n\n const manifestPath = pnpapi.resolveToUnqualified(`${parts[1]}/package.json`, basedir, {\n considerBuiltins: false\n });\n if (manifestPath === null) throw new Error(`Assertion failed: The resolution thinks that \"${parts[1]}\" is a Node builtin`); // The first dirname strips the package.json, the second strips the local named folder\n\n let nodeModules = external_path_default.a.dirname(external_path_default.a.dirname(manifestPath)); // Strips the scope named folder if needed\n\n if (parts[2]) nodeModules = external_path_default.a.dirname(nodeModules);\n return [nodeModules];\n };\n\n return opts;\n };\n }]);\n }\n /**\n * Used to disable the resolution hooks (for when we want to fallback to the previous resolution - we then need\n * a way to \"reset\" the environment temporarily)\n */\n\n\n let enableNativeHooks = true; // @ts-ignore\n\n process.versions.pnp = String(pnpapi.VERSIONS.std); // A small note: we don't replace the cache here (and instead use the native one). This is an effort to not\n // break code similar to \"delete require.cache[require.resolve(FOO)]\", where FOO is a package located outside\n // of the Yarn dependency tree. In this case, we defer the load to the native loader. If we were to replace the\n // cache by our own, the native loader would populate its own cache, which wouldn't be exposed anymore, so the\n // delete call would be broken.\n\n const originalModuleLoad = external_module_default.a._load;\n\n external_module_default.a._load = function (request, parent, isMain) {\n if (!enableNativeHooks) return originalModuleLoad.call(external_module_default.a, request, parent, isMain); // Builtins are managed by the regular Node loader\n\n if (builtinModules.has(request)) {\n try {\n enableNativeHooks = false;\n return originalModuleLoad.call(external_module_default.a, request, parent, isMain);\n } finally {\n enableNativeHooks = true;\n }\n } // The 'pnpapi' name is reserved to return the PnP api currently in use by the program\n\n\n if (request === `pnpapi`) return pnpapi; // Request `Module._resolveFilename` (ie. `resolveRequest`) to tell us which file we should load\n\n const modulePath = external_module_default.a._resolveFilename(request, parent, isMain); // Check if the module has already been created for the given file\n\n\n const cacheEntry = external_module_default.a._cache[modulePath];\n if (cacheEntry) return cacheEntry.exports; // Create a new module and store it into the cache\n // @ts-ignore\n\n const module = new external_module_default.a(modulePath, parent);\n external_module_default.a._cache[modulePath] = module; // The main module is exposed as global variable\n\n if (isMain) {\n // @ts-ignore\n process.mainModule = module;\n module.id = '.';\n } // Try to load the module, and remove it from the cache if it fails\n\n\n let hasThrown = true;\n\n try {\n module.load(modulePath);\n hasThrown = false;\n } finally {\n if (hasThrown) {\n delete external_module_default.a._cache[modulePath];\n }\n } // Some modules might have to be patched for compatibility purposes\n\n\n for (const [filter, patchFn] of patchedModules) {\n if (filter.test(request)) {\n const issuer = parent && parent.filename ? pnpapi.findPackageLocator(parent.filename) : null;\n module.exports = patchFn(issuer, module.exports);\n }\n }\n\n return module.exports;\n };\n\n const originalModuleResolveFilename = external_module_default.a._resolveFilename;\n\n external_module_default.a._resolveFilename = function (request, parent, isMain, options) {\n if (request === `pnpapi`) return pnpapi.resolveToUnqualified(`pnpapi`, null);\n if (!enableNativeHooks) return originalModuleResolveFilename.call(external_module_default.a, request, parent, isMain, options);\n\n if (options && options.plugnplay === false) {\n const {\n plugnplay\n } = options,\n rest = __rest(options, [\"plugnplay\"]); // Workaround a bug present in some version of Node (now fixed)\n // https://github.com/nodejs/node/pull/28078\n\n\n const forwardedOptions = Object.keys(rest).length > 0 ? rest : undefined;\n\n try {\n enableNativeHooks = false;\n return originalModuleResolveFilename.call(external_module_default.a, request, parent, isMain, forwardedOptions);\n } finally {\n enableNativeHooks = true;\n }\n }\n\n let issuers;\n\n if (options) {\n const optionNames = new Set(Object.keys(options));\n optionNames.delete(`paths`);\n optionNames.delete(`plugnplay`);\n\n if (optionNames.size > 0) {\n throw internalTools_makeError(ErrorCode.UNSUPPORTED, `Some options passed to require() aren't supported by PnP yet (${Array.from(optionNames).join(', ')})`);\n }\n\n if (options.paths) {\n issuers = options.paths.map(entry => {\n return `${external_path_default.a.normalize(entry)}/`;\n });\n }\n }\n\n if (!issuers) {\n const issuerModule = getIssuerModule(parent);\n const issuer = issuerModule ? issuerModule.filename : `${npath.toPortablePath(process.cwd())}/`;\n issuers = [issuer];\n } // When Node is called, it tries to require the main script but can't\n // because PnP already patched 'Module'\n // We test it for an absolute Windows path and convert it to a portable path.\n // We should probably always call toPortablePath and check for this directly\n\n\n if (/^[A-Z]:.*/.test(request)) request = npath.toPortablePath(request);\n let firstError;\n\n for (const issuer of issuers) {\n let resolution;\n\n try {\n resolution = pnpapi.resolveRequest(request, issuer);\n } catch (error) {\n firstError = firstError || error;\n continue;\n }\n\n return resolution !== null ? resolution : request;\n }\n\n throw firstError;\n };\n\n const originalFindPath = external_module_default.a._findPath;\n\n external_module_default.a._findPath = function (request, paths, isMain) {\n if (request === `pnpapi`) return false;\n if (!enableNativeHooks) return originalFindPath.call(external_module_default.a, request, paths, isMain);\n\n for (const path of paths) {\n let resolution;\n\n try {\n // TODO Convert path to portable path?\n resolution = pnpapi.resolveRequest(request, path);\n } catch (error) {\n continue;\n }\n\n if (resolution) {\n return resolution;\n }\n }\n\n return false;\n };\n\n patchFs(external_fs_default.a, new PosixFS_PosixFS(opts.fakeFs));\n}\n;\n// CONCATENATED MODULE: ./sources/loader/hydrateRuntimeState.ts\n\nfunction hydrateRuntimeState(data, {\n basePath\n}) {\n const portablePath = npath.toPortablePath(basePath);\n const ignorePattern = data.ignorePatternData !== null ? new RegExp(data.ignorePatternData) : null;\n const packageRegistry = new Map(data.packageRegistryData.map(([packageName, packageStoreData]) => {\n return [packageName, new Map(packageStoreData.map(([packageReference, packageInformationData]) => {\n return [packageReference, {\n packageLocation: ppath.resolve(portablePath, packageInformationData.packageLocation),\n packageDependencies: new Map(packageInformationData.packageDependencies),\n linkType: packageInformationData.linkType\n }];\n }))];\n }));\n const packageLocatorsByLocations = new Map();\n\n for (const [packageName, storeData] of data.packageRegistryData) {\n for (const [packageReference, packageInformationData] of storeData) {\n if (packageName === null !== (packageReference === null)) throw new Error(`Assertion failed: The name and reference should be null, or neither should`); // @ts-ignore: TypeScript isn't smart enough to understand the type assertion\n\n const packageLocator = {\n name: packageName,\n reference: packageReference\n };\n packageLocatorsByLocations.set(packageInformationData.packageLocation, packageLocator);\n }\n }\n\n for (const location of data.locationBlacklistData) packageLocatorsByLocations.set(location, null);\n\n const fallbackExclusionList = new Map(data.fallbackExclusionList.map(([packageName, packageReferences]) => {\n return [packageName, new Set(packageReferences)];\n }));\n const virtualRoots = data.virtualRoots.map(virtualRoot => {\n return ppath.resolve(portablePath, virtualRoot);\n });\n const dependencyTreeRoots = data.dependencyTreeRoots;\n const enableTopLevelFallback = data.enableTopLevelFallback;\n const packageLocationLengths = data.locationLengthData;\n return {\n basePath: portablePath,\n dependencyTreeRoots,\n enableTopLevelFallback,\n fallbackExclusionList,\n ignorePattern,\n packageLocationLengths,\n packageLocatorsByLocations,\n packageRegistry,\n virtualRoots\n };\n}\n// CONCATENATED MODULE: ./sources/loader/makeApi.ts\n/// \n\n\n\n\nfunction makeApi(runtimeState, opts) {\n // @ts-ignore\n const builtinModules = new Set(external_module_default.a.builtinModules || Object.keys(process.binding('natives'))); // Splits a require request into its components, or return null if the request is a file path\n\n const pathRegExp = /^(?![a-zA-Z]:[\\\\\\/]|\\\\\\\\|\\.{0,2}(?:\\/|$))((?:@[^\\/]+\\/)?[^\\/]+)\\/?(.*|)$/; // Matches if the path starts with a valid path qualifier (./, ../, /)\n // eslint-disable-next-line no-unused-vars\n\n const isStrictRegExp = /^\\.{0,2}\\//; // Matches if the path must point to a directory (ie ends with /)\n\n const isDirRegExp = /\\/$/; // We only instantiate one of those so that we can use strict-equal comparisons\n\n const topLevelLocator = {\n name: null,\n reference: null\n }; // Used for compatibility purposes - cf setupCompatibilityLayer\n\n const fallbackLocators = [];\n if (runtimeState.enableTopLevelFallback === true) fallbackLocators.push(topLevelLocator);\n\n if (opts.compatibilityMode !== false) {\n // ESLint currently doesn't have any portable way for shared configs to\n // specify their own plugins that should be used (cf issue #10125). This\n // will likely get fixed at some point but it'll take time, so in the\n // meantime we'll just add additional fallback entries for common shared\n // configs.\n // Similarly, Gatsby generates files within the `public` folder located\n // within the project, but doesn't pre-resolve the `require` calls to use\n // its own dependencies. Meaning that when PnP see a file from the `public`\n // folder making a require, it thinks that your project forgot to list one\n // of your dependencies.\n for (const name of [`react-scripts`, `gatsby`]) {\n const packageStore = runtimeState.packageRegistry.get(name);\n\n if (packageStore) {\n for (const reference of packageStore.keys()) {\n if (reference === null) {\n throw new Error(`Assertion failed: This reference shouldn't be null`);\n } else {\n fallbackLocators.push({\n name,\n reference\n });\n }\n }\n }\n }\n }\n /**\n * The setup code will be injected here. The tables listed below are guaranteed to be filled after the call to\n * the $$DYNAMICALLY_GENERATED_CODE function.\n */\n\n\n const {\n ignorePattern,\n packageRegistry,\n packageLocatorsByLocations,\n packageLocationLengths\n } = runtimeState;\n /**\n * Allows to print useful logs just be setting a value in the environment\n */\n\n function makeLogEntry(name, args) {\n return {\n fn: name,\n args: args,\n error: null,\n result: null\n };\n }\n\n function maybeLog(name, fn) {\n if (opts.allowDebug === false) return fn;\n const level = Number(process.env.PNP_DEBUG_LEVEL);\n\n if (Number.isFinite(level)) {\n if (level >= 2) {\n return (...args) => {\n const logEntry = makeLogEntry(name, args);\n\n try {\n return logEntry.result = fn(...args);\n } catch (error) {\n throw logEntry.error = error;\n } finally {\n console.error(logEntry);\n }\n };\n } else if (level >= 1) {\n return (...args) => {\n try {\n return fn(...args);\n } catch (error) {\n const logEntry = makeLogEntry(name, args);\n logEntry.error = error;\n console.error(logEntry);\n throw error;\n }\n };\n }\n }\n\n return fn;\n }\n /**\n * Returns information about a package in a safe way (will throw if they cannot be retrieved)\n */\n\n\n function getPackageInformationSafe(packageLocator) {\n const packageInformation = getPackageInformation(packageLocator);\n\n if (!packageInformation) {\n throw internalTools_makeError(ErrorCode.INTERNAL, `Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)`);\n }\n\n return packageInformation;\n }\n /**\n * Returns whether the specified locator is a dependency tree root (in which case it's part of the project) or not\n */\n\n\n function isDependencyTreeRoot(packageLocator) {\n if (packageLocator.name === null) return true;\n\n for (const dependencyTreeRoot of runtimeState.dependencyTreeRoots) if (dependencyTreeRoot.name === packageLocator.name && dependencyTreeRoot.reference === packageLocator.reference) return true;\n\n return false;\n }\n /**\n * Implements the node resolution for folder access and extension selection\n */\n\n\n function applyNodeExtensionResolution(unqualifiedPath, candidates, {\n extensions\n }) {\n // We use this \"infinite while\" so that we can restart the process as long as we hit package folders\n while (true) {\n let stat;\n\n try {\n candidates.push(unqualifiedPath);\n stat = opts.fakeFs.statSync(unqualifiedPath);\n } catch (error) {} // If the file exists and is a file, we can stop right there\n\n\n if (stat && !stat.isDirectory()) return opts.fakeFs.realpathSync(unqualifiedPath); // If the file is a directory, we must check if it contains a package.json with a \"main\" entry\n\n if (stat && stat.isDirectory()) {\n let pkgJson;\n\n try {\n pkgJson = JSON.parse(opts.fakeFs.readFileSync(ppath.join(unqualifiedPath, toFilename(`package.json`)), `utf8`));\n } catch (error) {}\n\n let nextUnqualifiedPath;\n if (pkgJson && pkgJson.main) nextUnqualifiedPath = ppath.resolve(unqualifiedPath, pkgJson.main); // If the \"main\" field changed the path, we start again from this new location\n\n if (nextUnqualifiedPath && nextUnqualifiedPath !== unqualifiedPath) {\n const resolution = applyNodeExtensionResolution(nextUnqualifiedPath, candidates, {\n extensions\n });\n\n if (resolution !== null) {\n return resolution;\n }\n }\n } // Otherwise we check if we find a file that match one of the supported extensions\n\n\n const qualifiedPath = extensions.map(extension => {\n return `${unqualifiedPath}${extension}`;\n }).find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (qualifiedPath) return qualifiedPath; // Otherwise, we check if the path is a folder - in such a case, we try to use its index\n\n if (stat && stat.isDirectory()) {\n const indexPath = extensions.map(extension => {\n return ppath.format({\n dir: unqualifiedPath,\n name: toFilename(`index`),\n ext: extension\n });\n }).find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n\n if (indexPath) {\n return indexPath;\n }\n } // Otherwise there's nothing else we can do :(\n\n\n return null;\n }\n }\n /**\n * This function creates fake modules that can be used with the _resolveFilename function.\n * Ideally it would be nice to be able to avoid this, since it causes useless allocations\n * and cannot be cached efficiently (we recompute the nodeModulePaths every time).\n *\n * Fortunately, this should only affect the fallback, and there hopefully shouldn't have a\n * lot of them.\n */\n\n\n function makeFakeModule(path) {\n // @ts-ignore\n const fakeModule = new external_module_default.a(path, null);\n fakeModule.filename = path;\n fakeModule.paths = external_module_default.a._nodeModulePaths(path);\n return fakeModule;\n }\n /**\n * Normalize path to posix format.\n */\n\n\n function normalizePath(p) {\n return npath.toPortablePath(p);\n }\n /**\n * Forward the resolution to the next resolver (usually the native one)\n */\n\n\n function callNativeResolution(request, issuer) {\n if (issuer.endsWith(`/`)) issuer = ppath.join(issuer, toFilename(`internal.js`)); // Since we would need to create a fake module anyway (to call _resolveLookupPath that\n // would give us the paths to give to _resolveFilename), we can as well not use\n // the {paths} option at all, since it internally makes _resolveFilename create another\n // fake module anyway.\n\n return external_module_default.a._resolveFilename(request, makeFakeModule(npath.fromPortablePath(issuer)), false, {\n plugnplay: false\n });\n }\n /**\n * This key indicates which version of the standard is implemented by this resolver. The `std` key is the\n * Plug'n'Play standard, and any other key are third-party extensions. Third-party extensions are not allowed\n * to override the standard, and can only offer new methods.\n *\n * If an new version of the Plug'n'Play standard is released and some extensions conflict with newly added\n * functions, they'll just have to fix the conflicts and bump their own version number.\n */\n\n\n const VERSIONS = {\n std: 3\n };\n /**\n * We export a special symbol for easy access to the top level locator.\n */\n\n const topLevel = topLevelLocator;\n /**\n * Gets the package information for a given locator. Returns null if they cannot be retrieved.\n */\n\n function getPackageInformation({\n name,\n reference\n }) {\n const packageInformationStore = packageRegistry.get(name);\n if (!packageInformationStore) return null;\n const packageInformation = packageInformationStore.get(reference);\n if (!packageInformation) return null;\n return packageInformation;\n }\n /**\n * Finds the package locator that owns the specified path. If none is found, returns null instead.\n */\n\n\n function findPackageLocator(location) {\n let relativeLocation = normalizePath(ppath.relative(runtimeState.basePath, location));\n if (!relativeLocation.match(isStrictRegExp)) relativeLocation = `./${relativeLocation}`;\n if (location.match(isDirRegExp) && !relativeLocation.endsWith(`/`)) relativeLocation = `${relativeLocation}/`;\n let from = 0; // If someone wants to use a binary search to go from O(n) to O(log n), be my guest\n\n while (from < packageLocationLengths.length && packageLocationLengths[from] > relativeLocation.length) from += 1;\n\n for (let t = from; t < packageLocationLengths.length; ++t) {\n const locator = packageLocatorsByLocations.get(relativeLocation.substr(0, packageLocationLengths[t]));\n if (typeof locator === `undefined`) continue; // Ensures that the returned locator isn't a blacklisted one.\n //\n // Blacklisted packages are packages that cannot be used because their dependencies cannot be deduced. This only\n // happens with peer dependencies, which effectively have different sets of dependencies depending on their\n // parents.\n //\n // In order to deambiguate those different sets of dependencies, the Yarn implementation of PnP will generate a\n // symlink for each combination of // it will find, and will\n // blacklist the target of those symlinks. By doing this, we ensure that files loaded through a specific path\n // will always have the same set of dependencies, provided the symlinks are correctly preserved.\n //\n // Unfortunately, some tools do not preserve them, and when it happens PnP isn't able anymore to deduce the set of\n // dependencies based on the path of the file that makes the require calls. But since we've blacklisted those\n // paths, we're able to print a more helpful error message that points out that a third-party package is doing\n // something incompatible!\n\n if (locator === null) {\n throw internalTools_makeError(ErrorCode.BLACKLISTED, `A forbidden path has been used in the package resolution process - this is usually caused by one of your tools calling 'fs.realpath' on the return value of 'require.resolve'. Since we need to use symlinks to simultaneously provide valid filesystem paths and disambiguate peer dependencies, they must be passed untransformed to 'require'.\\n\\nForbidden path: ${location}`, {\n location\n });\n }\n\n return locator;\n }\n\n return null;\n }\n /**\n * Transforms a request (what's typically passed as argument to the require function) into an unqualified path.\n * This path is called \"unqualified\" because it only changes the package name to the package location on the disk,\n * which means that the end result still cannot be directly accessed (for example, it doesn't try to resolve the\n * file extension, or to resolve directories to their \"index.js\" content). Use the \"resolveUnqualified\" function\n * to convert them to fully-qualified paths, or just use \"resolveRequest\" that do both operations in one go.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n\n\n function resolveToUnqualified(request, issuer, {\n considerBuiltins = true\n } = {}) {\n // The 'pnpapi' request is reserved and will always return the path to the PnP file, from everywhere\n if (request === `pnpapi`) return npath.toPortablePath(opts.pnpapiResolution); // Bailout if the request is a native module\n\n if (considerBuiltins && builtinModules.has(request)) return null; // We allow disabling the pnp resolution for some subpaths. This is because some projects, often legacy,\n // contain multiple levels of dependencies (ie. a yarn.lock inside a subfolder of a yarn.lock). This is\n // typically solved using workspaces, but not all of them have been converted already.\n\n if (ignorePattern && issuer && ignorePattern.test(normalizePath(issuer))) {\n const result = callNativeResolution(request, issuer);\n\n if (result === false) {\n throw internalTools_makeError(ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp)\\n\\nRequire request: \"${request}\"\\nRequired by: ${issuer}\\n`, {\n request,\n issuer\n });\n }\n\n return npath.toPortablePath(result);\n }\n\n let unqualifiedPath; // If the request is a relative or absolute path, we just return it normalized\n\n const dependencyNameMatch = request.match(pathRegExp);\n\n if (!dependencyNameMatch) {\n if (ppath.isAbsolute(request)) {\n unqualifiedPath = ppath.normalize(request);\n } else {\n if (!issuer) {\n throw internalTools_makeError(ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, {\n request,\n issuer\n });\n }\n\n if (issuer.match(isDirRegExp)) {\n unqualifiedPath = ppath.normalize(ppath.resolve(issuer, request));\n } else {\n unqualifiedPath = ppath.normalize(ppath.resolve(ppath.dirname(issuer), request));\n }\n } // No need to use the return value; we just want to check the blacklist status\n\n\n findPackageLocator(unqualifiedPath);\n } // Things are more hairy if it's a package require - we then need to figure out which package is needed, and in\n // particular the exact version for the given location on the dependency tree\n else {\n if (!issuer) {\n throw internalTools_makeError(ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, {\n request,\n issuer\n });\n }\n\n const [, dependencyName, subPath] = dependencyNameMatch;\n const issuerLocator = findPackageLocator(issuer); // If the issuer file doesn't seem to be owned by a package managed through pnp, then we resort to using the next\n // resolution algorithm in the chain, usually the native Node resolution one\n\n if (!issuerLocator) {\n const result = callNativeResolution(request, issuer);\n\n if (result === false) {\n throw internalTools_makeError(ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree)\\n\\nRequire path: \"${request}\"\\nRequired by: ${issuer}\\n`, {\n request,\n issuer\n });\n }\n\n return npath.toPortablePath(result);\n }\n\n const issuerInformation = getPackageInformationSafe(issuerLocator); // We obtain the dependency reference in regard to the package that request it\n\n let dependencyReference = issuerInformation.packageDependencies.get(dependencyName); // If we can't find it, we check if we can potentially load it from the packages that have been defined as potential fallbacks.\n // It's a bit of a hack, but it improves compatibility with the existing Node ecosystem. Hopefully we should eventually be able\n // to kill this logic and become stricter once pnp gets enough traction and the affected packages fix themselves.\n\n if (issuerLocator.name !== null) {\n // To allow programs to become gradually stricter, starting from the v2 we enforce that workspaces cannot depend on fallbacks.\n // This works by having a list containing all their locators, and checking when a fallback is required whether it's one of them.\n const exclusionEntry = runtimeState.fallbackExclusionList.get(issuerLocator.name);\n const canUseFallbacks = !exclusionEntry || !exclusionEntry.has(issuerLocator.reference);\n\n if (canUseFallbacks) {\n for (let t = 0, T = fallbackLocators.length; dependencyReference === undefined && t < T; ++t) {\n const fallbackInformation = getPackageInformationSafe(fallbackLocators[t]);\n const fallbackReference = fallbackInformation.packageDependencies.get(dependencyName);\n\n if (fallbackReference !== null) {\n dependencyReference = fallbackReference;\n }\n }\n }\n } // If we can't find the path, and if the package making the request is the top-level, we can offer nicer error messages\n\n\n if (dependencyReference === null) {\n if (isDependencyTreeRoot(issuerLocator)) {\n throw internalTools_makeError(ErrorCode.MISSING_PEER_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a peer dependency; this isn't allowed as the peer dependency cannot be provided by any parent package\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, {\n request,\n issuer,\n dependencyName\n });\n } else {\n throw internalTools_makeError(ErrorCode.MISSING_PEER_DEPENDENCY, `A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, {\n request,\n issuer,\n issuerLocator: Object.assign({}, issuerLocator),\n dependencyName\n });\n }\n } else if (dependencyReference === undefined) {\n if (isDependencyTreeRoot(issuerLocator)) {\n throw internalTools_makeError(ErrorCode.UNDECLARED_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, {\n request,\n issuer,\n dependencyName\n });\n } else {\n const candidates = Array.from(issuerInformation.packageDependencies.keys());\n throw internalTools_makeError(ErrorCode.UNDECLARED_DEPENDENCY, `A package is trying to access another package without the second one being listed as a dependency of the first one\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, {\n request,\n issuer,\n issuerLocator: Object.assign({}, issuerLocator),\n dependencyName,\n candidates\n });\n }\n } // We need to check that the package exists on the filesystem, because it might not have been installed\n\n\n const dependencyLocator = Array.isArray(dependencyReference) ? {\n name: dependencyReference[0],\n reference: dependencyReference[1]\n } : {\n name: dependencyName,\n reference: dependencyReference\n };\n const dependencyInformation = getPackageInformationSafe(dependencyLocator);\n\n if (!dependencyInformation.packageLocation) {\n throw internalTools_makeError(ErrorCode.MISSING_DEPENDENCY, `A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.\\n\\nRequired package: ${dependencyLocator.name}@${dependencyLocator.reference} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, {\n request,\n issuer,\n dependencyLocator: Object.assign({}, dependencyLocator)\n });\n } // Now that we know which package we should resolve to, we only have to find out the file location\n\n\n const dependencyLocation = ppath.resolve(runtimeState.basePath, dependencyInformation.packageLocation);\n\n if (subPath) {\n unqualifiedPath = ppath.resolve(dependencyLocation, subPath);\n } else {\n unqualifiedPath = dependencyLocation;\n }\n }\n\n return ppath.normalize(unqualifiedPath);\n }\n\n ;\n /**\n * Transforms an unqualified path into a qualified path by using the Node resolution algorithm (which automatically\n * appends \".js\" / \".json\", and transforms directory accesses into \"index.js\").\n */\n\n function resolveUnqualified(unqualifiedPath, {\n extensions = Object.keys(external_module_default.a._extensions)\n } = {}) {\n const candidates = [];\n const qualifiedPath = applyNodeExtensionResolution(unqualifiedPath, candidates, {\n extensions\n });\n\n if (qualifiedPath) {\n return ppath.normalize(qualifiedPath);\n } else {\n throw internalTools_makeError(ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, `Couldn't find a suitable Node resolution for the specified unqualified path\\n\\nSource path: ${unqualifiedPath}\\n${candidates.map(candidate => `Rejected resolution: ${candidate}\\n`).join(``)}`, {\n unqualifiedPath\n });\n }\n }\n\n ;\n /**\n * Transforms a request into a fully qualified path.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n\n function resolveRequest(request, issuer, {\n considerBuiltins,\n extensions\n } = {}) {\n let unqualifiedPath = resolveToUnqualified(request, issuer, {\n considerBuiltins\n });\n if (unqualifiedPath === null) return null;\n\n try {\n return resolveUnqualified(unqualifiedPath, {\n extensions\n });\n } catch (resolutionError) {\n if (resolutionError.pnpCode === 'QUALIFIED_PATH_RESOLUTION_FAILED') Object.assign(resolutionError.data, {\n request,\n issuer\n });\n throw resolutionError;\n }\n }\n\n ;\n return {\n VERSIONS,\n topLevel,\n getDependencyTreeRoots: () => {\n return [...runtimeState.dependencyTreeRoots];\n },\n getPackageInformation: locator => {\n const info = getPackageInformation(locator);\n if (info === null) return null;\n const packageLocation = npath.fromPortablePath(info.packageLocation);\n const nativeInfo = Object.assign(Object.assign({}, info), {\n packageLocation\n });\n return nativeInfo;\n },\n findPackageLocator: path => {\n return findPackageLocator(npath.toPortablePath(path));\n },\n resolveToUnqualified: maybeLog(`resolveToUnqualified`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? npath.toPortablePath(issuer) : null;\n const resolution = resolveToUnqualified(npath.toPortablePath(request), portableIssuer, opts);\n if (resolution === null) return null;\n return npath.fromPortablePath(resolution);\n }),\n resolveUnqualified: maybeLog(`resolveUnqualified`, (unqualifiedPath, opts) => {\n return npath.fromPortablePath(resolveUnqualified(npath.toPortablePath(unqualifiedPath), opts));\n }),\n resolveRequest: maybeLog(`resolveRequest`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? npath.toPortablePath(issuer) : null;\n const resolution = resolveRequest(npath.toPortablePath(request), portableIssuer, opts);\n if (resolution === null) return null;\n return npath.fromPortablePath(resolution);\n })\n };\n}\n// CONCATENATED MODULE: ./sources/loader/_entryPoint.ts\nvar _entryPoint_rest = undefined && undefined.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n // We must copy the fs into a local, because otherwise\n// 1. we would make the NodeFS instance use the function that we patched (infinite loop)\n// 2. Object.create(fs) isn't enough, since it won't prevent the proto from being modified\n\nconst localFs = Object.assign({}, external_fs_default.a);\nconst nodeFs = new NodeFS_NodeFS(localFs);\nconst defaultRuntimeState = $$SETUP_STATE(hydrateRuntimeState);\nconst defaultPnpapiResolution = external_path_default.a.resolve(__dirname, __filename);\nlet defaultFsLayer = new ZipOpenFS_ZipOpenFS({\n baseFs: nodeFs,\n readOnlyArchives: true\n});\n\nfor (const virtualRoot of defaultRuntimeState.virtualRoots) defaultFsLayer = new VirtualFS_VirtualFS(virtualRoot, {\n baseFs: defaultFsLayer\n});\n\nconst defaultApi = Object.assign(makeApi(defaultRuntimeState, {\n fakeFs: defaultFsLayer,\n pnpapiResolution: defaultPnpapiResolution\n}), {\n /**\n * Can be used to generate a different API than the default one (for example\n * to map it on `/` rather than the local directory path, or to use a\n * different FS layer than the default one).\n */\n makeApi: _a => {\n var {\n basePath = undefined,\n fakeFs = defaultFsLayer,\n pnpapiResolution = defaultPnpapiResolution\n } = _a,\n rest = _entryPoint_rest(_a, [\"basePath\", \"fakeFs\", \"pnpapiResolution\"]);\n\n const apiRuntimeState = typeof basePath !== `undefined` ? $$SETUP_STATE(hydrateRuntimeState, basePath) : defaultRuntimeState;\n return makeApi(apiRuntimeState, Object.assign({\n fakeFs,\n pnpapiResolution\n }, rest));\n },\n\n /**\n * Will inject the specified API into the environment, monkey-patching FS. Is\n * automatically called when the hook is loaded through `--require`.\n */\n setup: api => {\n applyPatch(api || defaultApi, {\n fakeFs: defaultFsLayer\n });\n }\n}); // eslint-disable-next-line arca/no-default-export\n\n/* harmony default export */ var _entryPoint = __webpack_exports__[\"default\"] = (defaultApi);\n\nif (__non_webpack_module__.parent && __non_webpack_module__.parent.id === 'internal/preload') {\n defaultApi.setup();\n\n if (__non_webpack_module__.filename) {\n // We delete it from the cache in order to support the case where the CLI resolver is invoked from \"yarn run\"\n // It's annoying because it might cause some issues when the file is multiple times in NODE_OPTIONS, but it shouldn't happen anyway.\n // @ts-ignore\n delete external_module_default.a._cache[__non_webpack_module__.filename];\n }\n} // @ts-ignore\n\n\nif (process.mainModule === __non_webpack_module__) {\n const reportError = (code, message, data) => {\n process.stdout.write(`${JSON.stringify([{\n code,\n message,\n data\n }, null])}\\n`);\n };\n\n const reportSuccess = resolution => {\n process.stdout.write(`${JSON.stringify([null, resolution])}\\n`);\n };\n\n const processResolution = (request, issuer) => {\n try {\n reportSuccess(defaultApi.resolveRequest(request, issuer));\n } catch (error) {\n reportError(error.code, error.message, error.data);\n }\n };\n\n const processRequest = data => {\n try {\n const [request, issuer] = JSON.parse(data);\n processResolution(request, issuer);\n } catch (error) {\n reportError(`INVALID_JSON`, error.message, error.data);\n }\n };\n\n if (process.argv.length > 2) {\n if (process.argv.length !== 4) {\n process.stderr.write(`Usage: ${process.argv[0]} ${process.argv[1]} \\n`);\n process.exitCode = 64;\n /* EX_USAGE */\n } else {\n processResolution(process.argv[2], process.argv[3]);\n }\n } else {\n let buffer = '';\n const decoder = new external_string_decoder_default.a.StringDecoder();\n process.stdin.on('data', chunk => {\n buffer += decoder.write(chunk);\n\n do {\n const index = buffer.indexOf('\\n');\n if (index === -1) break;\n const line = buffer.slice(0, index);\n buffer = buffer.slice(index + 1);\n processRequest(line);\n } while (true);\n });\n }\n}\n\n/***/ })\n/******/ ])[\"default\"];\n});"; +module.exports = "(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pnpHook\"] = factory();\n\telse\n\t\troot[\"pnpHook\"] = factory();\n})(global, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 15);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar frozenFs = Object.assign({}, __webpack_require__(2));\nvar Module=typeof Module!==\"undefined\"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module[\"arguments\"]=[];Module[\"thisProgram\"]=\"./this.program\";Module[\"quit\"]=function(status,toThrow){throw toThrow};Module[\"preRun\"]=[];Module[\"postRun\"]=[];var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=true;if(Module[\"ENVIRONMENT\"]){throw new Error(\"Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)\")}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){if(!(typeof process===\"object\"&&\"function\"===\"function\"))throw new Error(\"not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)\");scriptDirectory=__dirname+\"/\";var nodeFS;var nodePath;Module[\"read\"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=frozenFs;if(!nodePath)nodePath=__webpack_require__(3);filename=nodePath[\"normalize\"](filename);ret=nodeFS[\"readFileSync\"](filename)}return binary?ret:ret.toString()};Module[\"readBinary\"]=function readBinary(filename){var ret=Module[\"read\"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){Module[\"thisProgram\"]=process[\"argv\"][1].replace(/\\\\/g,\"/\")}Module[\"arguments\"]=process[\"argv\"].slice(2);if(true){module[\"exports\"]=Module}(function(){})(\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});(function(){})(\"unhandledRejection\",abort);Module[\"quit\"]=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else{throw new Error(\"environment detection error\")}var out=Module[\"print\"]||(typeof console!==\"undefined\"?console.log.bind(console):typeof print!==\"undefined\"?print:null);var err=Module[\"printErr\"]||(typeof printErr!==\"undefined\"?printErr:typeof console!==\"undefined\"&&console.warn.bind(console)||out);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;assert(typeof Module[\"memoryInitializerPrefixURL\"]===\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]===\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]===\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]===\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");stackSave=stackRestore=stackAlloc=function(){abort(\"cannot use the stack before compiled code is ready to run, and has provided stack access\")};function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;if(end<=_emscripten_get_heap_size()){HEAP32[DYNAMICTOP_PTR>>2]=end}else{var success=_emscripten_resize_heap(end);if(!success)return 0}return ret}function getNativeTypeSize(type){switch(type){case\"i1\":case\"i8\":return 1;case\"i16\":return 2;case\"i32\":return 4;case\"i64\":return 8;case\"float\":return 4;case\"double\":return 8;default:{if(type[type.length-1]===\"*\"){return 4}else if(type[0]===\"i\"){var bits=parseInt(type.substr(1));assert(bits%8===0,\"getNativeTypeSize invalid bits \"+bits+\", type \"+type);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}var asm2wasmImports={\"f64-rem\":function(x,y){return x%y},\"debugger\":function(){debugger}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};if(typeof WebAssembly!==\"object\"){abort(\"No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.\")}function getValue(ptr,type,noSafe){type=type||\"i8\";if(type.charAt(type.length-1)===\"*\")type=\"i32\";if(noSafe){switch(type){case\"i1\":return HEAP8[ptr>>0];case\"i8\":return HEAP8[ptr>>0];case\"i16\":return HEAP16[ptr>>1];case\"i32\":return HEAP32[ptr>>2];case\"i64\":return HEAP32[ptr>>2];case\"float\":return HEAPF32[ptr>>2];case\"double\":return HEAPF64[ptr>>3];default:abort(\"invalid type for getValue: \"+type)}}else{switch(type){case\"i1\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i8\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i16\":return SAFE_HEAP_LOAD(ptr|0,2,0)|0;case\"i32\":return SAFE_HEAP_LOAD(ptr|0,4,0)|0;case\"i64\":return SAFE_HEAP_LOAD(ptr|0,8,0)|0;case\"float\":return Math_fround(SAFE_HEAP_LOAD_D(ptr|0,4,0));case\"double\":return+SAFE_HEAP_LOAD_D(ptr|0,8,0);default:abort(\"invalid type for getValue: \"+type)}}return null}function getSafeHeapType(bytes,isFloat){switch(bytes){case 1:return\"i8\";case 2:return\"i16\";case 4:return isFloat?\"float\":\"i32\";case 8:return\"double\";default:assert(0)}}function SAFE_HEAP_STORE(dest,value,bytes,isFloat){if(dest<=0)abort(\"segmentation fault storing \"+bytes+\" bytes to address \"+dest);if(dest%bytes!==0)abort(\"alignment error storing to address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when storing \"+bytes+\" bytes to address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);setValue(dest,value,getSafeHeapType(bytes,isFloat),1)}function SAFE_HEAP_STORE_D(dest,value,bytes){SAFE_HEAP_STORE(dest,value,bytes,true)}function SAFE_HEAP_LOAD(dest,bytes,unsigned,isFloat){if(dest<=0)abort(\"segmentation fault loading \"+bytes+\" bytes from address \"+dest);if(dest%bytes!==0)abort(\"alignment error loading from address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when loading \"+bytes+\" bytes from address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);var type=getSafeHeapType(bytes,isFloat);var ret=getValue(dest,type,1);if(unsigned)ret=unSign(ret,parseInt(type.substr(1)),1);return ret}function SAFE_HEAP_LOAD_D(dest,bytes,unsigned){return SAFE_HEAP_LOAD(dest,bytes,unsigned,true)}function segfault(){abort(\"segmentation fault\")}function alignfault(){abort(\"alignment fault\")}var wasmMemory;var wasmTable;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!==\"array\",'Return type should not be \"array\".');if(args){for(var i=0;i>0]=value;break;case\"i8\":HEAP8[ptr>>0]=value;break;case\"i16\":HEAP16[ptr>>1]=value;break;case\"i32\":HEAP32[ptr>>2]=value;break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case\"float\":HEAPF32[ptr>>2]=value;break;case\"double\":HEAPF64[ptr>>3]=value;break;default:abort(\"invalid type for setValue: \"+type)}}else{switch(type){case\"i1\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i8\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i16\":SAFE_HEAP_STORE(ptr|0,value|0,2);break;case\"i32\":SAFE_HEAP_STORE(ptr|0,value|0,4);break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],SAFE_HEAP_STORE(ptr|0,tempI64[0]|0,4),SAFE_HEAP_STORE(ptr+4|0,tempI64[1]|0,4);break;case\"float\":SAFE_HEAP_STORE_D(ptr|0,Math_fround(value),4);break;case\"double\":SAFE_HEAP_STORE_D(ptr|0,+value,8);break;default:abort(\"invalid type for setValue: \"+type)}}}var ALLOC_NORMAL=0;var ALLOC_NONE=3;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab===\"number\"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types===\"string\"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,stackAlloc,dynamicAlloc][allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType===\"i8\"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>=2097152)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF).\");outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!==\"undefined\"?new TextDecoder(\"utf-16le\"):undefined;function writeArrayToMemory(array,buffer){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module[\"HEAP8\"]=HEAP8=new Int8Array(buffer);Module[\"HEAP16\"]=HEAP16=new Int16Array(buffer);Module[\"HEAP32\"]=HEAP32=new Int32Array(buffer);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buffer);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buffer);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buffer);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buffer);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buffer)}var STACK_BASE=22720,STACK_MAX=5265600,DYNAMIC_BASE=5265600,DYNAMICTOP_PTR=22464;assert(STACK_BASE%16===0,\"stack must start aligned\");assert(DYNAMIC_BASE%16===0,\"heap must start aligned\");var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_TOTAL_MEMORY=Module[\"TOTAL_MEMORY\"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x\"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+\" \"+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw\"Runtime error: The application has corrupted its heap memory area (address zero)!\"}function abortStackOverflow(allocSize){abort(\"Stack overflow! Attempted to allocate \"+allocSize+\" bytes on the stack, but stack has only \"+(STACK_MAX-stackSave()+allocSize)+\" bytes available!\")}HEAP32[0]=1668509029;HEAP16[1]=25459;if(HEAPU8[2]!==115||HEAPU8[3]!==99)throw\"Runtime error: expected the system to be little-endian!\";function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback();continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){Module[\"dynCall_v\"](func)}else{Module[\"dynCall_vi\"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=0){err(\"Memory size incompatibility issues may be due to changing TOTAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set TOTAL_MEMORY at runtime to something smaller than it was at compile time).\")}return false}receiveInstance(instance,module);return Module[\"asm\"]}Module[\"asm\"]=function(global,env,providedBuffer){env[\"memory\"]=wasmMemory;env[\"table\"]=wasmTable=new WebAssembly.Table({\"initial\":55,\"maximum\":55,\"element\":\"anyfunc\"});env[\"__memory_base\"]=1024;env[\"__table_base\"]=0;var exports=createWasm(env);assert(exports,\"binaryen setup failed (no wasm support?)\");return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var tempDoublePtr=22704;assert(tempDoublePtr%8==0);var ENV={};function ___buildEnvironment(environ){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV[\"USER\"]=ENV[\"LOGNAME\"]=\"web_user\";ENV[\"PATH\"]=\"/\";ENV[\"PWD\"]=\"/\";ENV[\"HOME\"]=\"/home/web_user\";ENV[\"LANG\"]=\"C.UTF-8\";ENV[\"_\"]=Module[\"thisProgram\"];poolPtr=getMemory(TOTAL_ENV_SIZE);envPtr=getMemory(MAX_ENV_VALUES*4);SAFE_HEAP_STORE(envPtr|0,poolPtr|0,4);SAFE_HEAP_STORE(environ|0,envPtr|0,4)}else{envPtr=SAFE_HEAP_LOAD(environ|0,4,0)|0;poolPtr=SAFE_HEAP_LOAD(envPtr|0,4,0)|0}var strings=[];var totalSize=0;for(var key in ENV){if(typeof ENV[key]===\"string\"){var line=key+\"=\"+ENV[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error(\"Environment size exceeded TOTAL_ENV_SIZE!\")}var ptrSize=4;for(var i=0;i=0;i--){var last=parts[i];if(last===\".\"){parts.splice(i,1)}else if(last===\"..\"){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift(\"..\")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)===\"/\",trailingSlash=path.substr(-1)===\"/\";path=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),!isAbsolute).join(\"/\");if(!path&&!isAbsolute){path=\".\"}if(path&&trailingSlash){path+=\"/\"}return(isAbsolute?\"/\":\"\")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return\".\"}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path===\"/\")return\"/\";var lastSlash=path.lastIndexOf(\"/\");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join(\"/\"))},join2:function(l,r){return PATH.normalize(l+\"/\"+r)},resolve:function(){var resolvedPath=\"\",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!==\"string\"){throw new TypeError(\"Arguments to path.resolve must be strings\")}else if(!path){return\"\"}resolvedPath=path+\"/\"+resolvedPath;resolvedAbsolute=path.charAt(0)===\"/\"}resolvedPath=PATH.normalizeArray(resolvedPath.split(\"/\").filter(function(p){return!!p}),!resolvedAbsolute).join(\"/\");return(resolvedAbsolute?\"/\":\"\")+resolvedPath||\".\"},relative:function(from,to){from=PATH.resolve(from).substr(1);to=PATH.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!==\"\")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split(\"/\"));var toParts=trim(to.split(\"/\"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString(\"utf-8\")}else{result=null}}else if(typeof window!=\"undefined\"&&typeof window.prompt==\"function\"){result=window.prompt(\"Input: \");if(result!==null){result+=\"\\n\"}}else if(typeof readline==\"function\"){result=readline();if(result!==null){result+=\"\\n\"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,\"/\",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node},getFileDataAsRegularArray:function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;i=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;return}if(!node.contents||node.contents.subarray){var oldContents=node.contents;node.contents=new Uint8Array(new ArrayBuffer(newSize));if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize;return}if(!node.contents)node.contents=[];if(node.contents.length>newSize)node.contents.length=newSize;else while(node.contents.length=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return stat.mode},realPath:function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},flagsForNode:function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;var newFlags=0;for(var k in NODEFS.flagsForNodeMap){if(flags&k){newFlags|=NODEFS.flagsForNodeMap[k];flags^=k}}if(!flags){return newFlags}else{throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}},node_ops:{getattr:function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)},mknod:function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,\"\",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node},rename:function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsForNode(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(stream,buffer,offset,length,position){if(length===0)return 0;try{return fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},write:function(stream,buffer,offset,length,position){try{return fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position}}};var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var NODERAWFS={lookupPath:function(path){return{path:path,node:{mode:NODEFS.getMode(path)}}},createStandardStreams:function(){FS.streams[0]={fd:0,nfd:0,position:0,path:\"\",flags:0,tty:true,seekable:false};for(var i=1;i<3;i++){FS.streams[i]={fd:i,nfd:i,position:0,path:\"\",flags:577,tty:true,seekable:false}}},cwd:function(){return process.cwd()},chdir:function(){process.chdir.apply(void 0,arguments)},mknod:function(path,mode){if(FS.isDir(path)){fs.mkdirSync(path,mode)}else{fs.writeFileSync(path,\"\",{mode:mode})}},mkdir:function(){fs.mkdirSync.apply(void 0,arguments)},symlink:function(){fs.symlinkSync.apply(void 0,arguments)},rename:function(){fs.renameSync.apply(void 0,arguments)},rmdir:function(){fs.rmdirSync.apply(void 0,arguments)},readdir:function(){fs.readdirSync.apply(void 0,arguments)},unlink:function(){fs.unlinkSync.apply(void 0,arguments)},readlink:function(){return fs.readlinkSync.apply(void 0,arguments)},stat:function(){return fs.statSync.apply(void 0,arguments)},lstat:function(){return fs.lstatSync.apply(void 0,arguments)},chmod:function(){fs.chmodSync.apply(void 0,arguments)},fchmod:function(){fs.fchmodSync.apply(void 0,arguments)},chown:function(){fs.chownSync.apply(void 0,arguments)},fchown:function(){fs.fchownSync.apply(void 0,arguments)},truncate:function(){fs.truncateSync.apply(void 0,arguments)},ftruncate:function(){fs.ftruncateSync.apply(void 0,arguments)},utime:function(){fs.utimesSync.apply(void 0,arguments)},open:function(path,flags,mode,suggestFD){if(typeof flags===\"string\"){flags=VFS.modeStringToFlags(flags)}var nfd=fs.openSync(path,NODEFS.flagsForNode(flags),mode);var fd=suggestFD!=null?suggestFD:FS.nextfd(nfd);var stream={fd:fd,nfd:nfd,position:0,path:path,flags:flags,seekable:true};FS.streams[fd]=stream;return stream},close:function(stream){if(!stream.stream_ops){fs.closeSync(stream.nfd)}FS.closeStream(stream.fd)},llseek:function(stream,offset,whence){if(stream.stream_ops){return VFS.llseek(stream,offset,whence)}var position=offset;if(whence===1){position+=stream.position}else if(whence===2){position+=fs.fstatSync(stream.nfd).size}else if(whence!==0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.position=position;return position},read:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.read(stream,buffer,offset,length,position)}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesRead=fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.write(stream,buffer,offset,length,position)}if(stream.flags&+\"1024\"){FS.llseek(stream,0,+\"2\")}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesWritten=fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:function(){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)},mmap:function(){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)},msync:function(){return 0},munmap:function(){return 0},ioctl:function(){throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)}};var ERRNO_MESSAGES={0:\"Success\",1:\"Not super-user\",2:\"No such file or directory\",3:\"No such process\",4:\"Interrupted system call\",5:\"I/O error\",6:\"No such device or address\",7:\"Arg list too long\",8:\"Exec format error\",9:\"Bad file number\",10:\"No children\",11:\"No more processes\",12:\"Not enough core\",13:\"Permission denied\",14:\"Bad address\",15:\"Block device required\",16:\"Mount device busy\",17:\"File exists\",18:\"Cross-device link\",19:\"No such device\",20:\"Not a directory\",21:\"Is a directory\",22:\"Invalid argument\",23:\"Too many open files in system\",24:\"Too many open files\",25:\"Not a typewriter\",26:\"Text file busy\",27:\"File too large\",28:\"No space left on device\",29:\"Illegal seek\",30:\"Read only file system\",31:\"Too many links\",32:\"Broken pipe\",33:\"Math arg out of domain of func\",34:\"Math result not representable\",35:\"File locking deadlock error\",36:\"File or path name too long\",37:\"No record locks available\",38:\"Function not implemented\",39:\"Directory not empty\",40:\"Too many symbolic links\",42:\"No message of desired type\",43:\"Identifier removed\",44:\"Channel number out of range\",45:\"Level 2 not synchronized\",46:\"Level 3 halted\",47:\"Level 3 reset\",48:\"Link number out of range\",49:\"Protocol driver not attached\",50:\"No CSI structure available\",51:\"Level 2 halted\",52:\"Invalid exchange\",53:\"Invalid request descriptor\",54:\"Exchange full\",55:\"No anode\",56:\"Invalid request code\",57:\"Invalid slot\",59:\"Bad font file fmt\",60:\"Device not a stream\",61:\"No data (for no delay io)\",62:\"Timer expired\",63:\"Out of streams resources\",64:\"Machine is not on the network\",65:\"Package not installed\",66:\"The object is remote\",67:\"The link has been severed\",68:\"Advertise error\",69:\"Srmount error\",70:\"Communication error on send\",71:\"Protocol error\",72:\"Multihop attempted\",73:\"Cross mount point (not really error)\",74:\"Trying to read unreadable message\",75:\"Value too large for defined data type\",76:\"Given log. name not unique\",77:\"f.d. invalid for this operation\",78:\"Remote address changed\",79:\"Can access a needed shared lib\",80:\"Accessing a corrupted shared lib\",81:\".lib section in a.out corrupted\",82:\"Attempting to link in too many libs\",83:\"Attempting to exec a shared library\",84:\"Illegal byte sequence\",86:\"Streams pipe error\",87:\"Too many users\",88:\"Socket operation on non-socket\",89:\"Destination address required\",90:\"Message too long\",91:\"Protocol wrong type for socket\",92:\"Protocol not available\",93:\"Unknown protocol\",94:\"Socket type not supported\",95:\"Not supported\",96:\"Protocol family not supported\",97:\"Address family not supported by protocol family\",98:\"Address already in use\",99:\"Address not available\",100:\"Network interface is not configured\",101:\"Network is unreachable\",102:\"Connection reset by network\",103:\"Connection aborted\",104:\"Connection reset by peer\",105:\"No buffer space available\",106:\"Socket is already connected\",107:\"Socket is not connected\",108:\"Can't send after socket shutdown\",109:\"Too many references\",110:\"Connection timed out\",111:\"Connection refused\",112:\"Host is down\",113:\"Host is unreachable\",114:\"Socket already connected\",115:\"Connection already in progress\",116:\"Stale file handle\",122:\"Quota exceeded\",123:\"No medium (in tape drive)\",125:\"Operation canceled\",130:\"Previous owner died\",131:\"State not recoverable\"};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:\"/\",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+\" : \"+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(path,opts){path=PATH.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:\"\",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(40)}var parts=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),false);var current=FS.root;var current_path=\"/\";for(var i=0;i40){throw new FS.ErrnoError(40)}}}}return{path:current_path,node:current}},getPath:function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!==\"/\"?mount+\"/\"+path:mount+path}path=path?node.name+\"/\"+path:node.name;node=node.parent}},hashName:function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:function(node){FS.hashRemoveNode(node)},isRoot:function(node){return node===node.parent},isMountpoint:function(node){return!!node.mounted},isFile:function(mode){return(mode&61440)===32768},isDir:function(mode){return(mode&61440)===16384},isLink:function(mode){return(mode&61440)===40960},isChrdev:function(mode){return(mode&61440)===8192},isBlkdev:function(mode){return(mode&61440)===24576},isFIFO:function(mode){return(mode&61440)===4096},isSocket:function(mode){return(mode&49152)===49152},flagModes:{\"r\":0,\"rs\":1052672,\"r+\":2,\"w\":577,\"wx\":705,\"xw\":705,\"w+\":578,\"wx+\":706,\"xw+\":706,\"a\":1089,\"ax\":1217,\"xa\":1217,\"a+\":1090,\"ax+\":1218,\"xa+\":1218},modeStringToFlags:function(str){var flags=FS.flagModes[str];if(typeof flags===\"undefined\"){throw new Error(\"Unknown file open mode: \"+str)}return flags},flagsToPermissionString:function(flag){var perms=[\"r\",\"w\",\"rw\"][flag&3];if(flag&512){perms+=\"w\"}return perms},nodePermissions:function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf(\"r\")!==-1&&!(node.mode&292)){return 13}else if(perms.indexOf(\"w\")!==-1&&!(node.mode&146)){return 13}else if(perms.indexOf(\"x\")!==-1&&!(node.mode&73)){return 13}return 0},mayLookup:function(dir){var err=FS.nodePermissions(dir,\"x\");if(err)return err;if(!dir.node_ops.lookup)return 13;return 0},mayCreate:function(dir,name){try{var node=FS.lookupNode(dir,name);return 17}catch(e){}return FS.nodePermissions(dir,\"wx\")},mayDelete:function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,\"wx\");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return 20}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 16}}else{if(FS.isDir(node.mode)){return 21}}return 0},mayOpen:function(node,flags){if(!node){return 2}if(FS.isLink(node.mode)){return 40}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!==\"r\"||flags&512){return 21}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(24)},getStream:function(fd){return FS.streams[fd]},createStream:function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=function(){};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:function(fd){FS.streams[fd]=null},chrdev_stream_ops:{open:function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:function(){throw new FS.ErrnoError(29)}},major:function(dev){return dev>>8},minor:function(dev){return dev&255},makedev:function(ma,mi){return ma<<8|mi},registerDevice:function(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:function(dev){return FS.devices[dev]},getMounts:function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:function(populate,callback){if(typeof populate===\"function\"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log(\"warning: \"+FS.syncFSRequests+\" FS.syncfs operations in flight at once, probably just doing extra work\")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(err){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:function(type,opts,mountpoint){var root=mountpoint===\"/\";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(16)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(16)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(20)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(22)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup:function(parent,name){return parent.node_ops.lookup(parent,name)},mknod:function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name===\".\"||name===\"..\"){throw new FS.ErrnoError(22)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(1)}return parent.node_ops.mknod(parent,name,mode,dev)},create:function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:function(path,mode){var dirs=path.split(\"/\");var d=\"\";for(var i=0;i\"})},staticInit:function(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},\"/\");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={\"MEMFS\":MEMFS,\"NODEFS\":NODEFS}},init:function(input,output,error){assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");FS.init.initialized=true;FS.ensureErrnoError();Module[\"stdin\"]=input||Module[\"stdin\"];Module[\"stdout\"]=output||Module[\"stdout\"];Module[\"stderr\"]=error||Module[\"stderr\"];FS.createStandardStreams()},quit:function(){FS.init.initialized=false;var fflush=Module[\"_fflush\"];if(fflush)fflush(0);for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open(\"HEAD\",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);var datalength=Number(xhr.getResponseHeader(\"Content-length\"));var header;var hasByteServing=(header=xhr.getResponseHeader(\"Accept-Ranges\"))&&header===\"bytes\";var usesGzip=(header=xhr.getResponseHeader(\"Content-Encoding\"))&&header===\"gzip\";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function(from,to){if(from>to)throw new Error(\"invalid range (\"+from+\", \"+to+\") or no bytes requested!\");if(to>datalength-1)throw new Error(\"only \"+datalength+\" bytes available! programmer error!\");var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);if(datalength!==chunkSize)xhr.setRequestHeader(\"Range\",\"bytes=\"+from+\"-\"+to);if(typeof Uint8Array!=\"undefined\")xhr.responseType=\"arraybuffer\";if(xhr.overrideMimeType){xhr.overrideMimeType(\"text/plain; charset=x-user-defined\")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||\"\",true)}};var lazyArray=this;lazyArray.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]===\"undefined\"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]===\"undefined\")throw new Error(\"doXHR failed!\");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;console.log(\"LazyFiles on gzip forces download of the whole file when length is accessed\")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!==\"undefined\"){if(!ENVIRONMENT_IS_WORKER)throw\"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc\";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}return fn.apply(null,arguments)}});stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall10(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.unlink(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);SAFE_HEAP_STORE(result|0,stream.position|0,4);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doWritev(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall15(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),mode=SYSCALLS.get();FS.chmod(path,mode);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall195(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall197(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-ERRNO_CODES.EINVAL}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 12:{var arg=SYSCALLS.get();var offset=0;SAFE_HEAP_STORE(arg+offset|0,2|0,2);return 0}case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall38(which,varargs){SYSCALLS.varargs=varargs;try{var old_path=SYSCALLS.getStr(),new_path=SYSCALLS.getStr();FS.rename(old_path,new_path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall40(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.rmdir(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21509:case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();SAFE_HEAP_STORE(argp|0,0|0,4);return 0}case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21524:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}default:abort(\"bad ioctl syscall \"+op)}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall60(which,varargs){SYSCALLS.varargs=varargs;try{var mask=SYSCALLS.get();var old=SYSCALLS.umask;SYSCALLS.umask=mask;return old}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort(\"Cannot enlarge memory arrays to size \"+requestedSize+\" bytes (OOM). Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value \"+HEAP8.length+\", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 \")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var oldSize=buffer.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0)){return buffer=wasmMemory.buffer}else{return null}}catch(e){console.error(\"emscripten_realloc_buffer: Attempted to grow from \"+oldSize+\" bytes to \"+size+\" bytes, but got error: \"+e);return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();assert(requestedSize>oldSize);var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+LIMIT+\" bytes!\");return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}SAFE_HEAP_STORE(tmPtr+24|0,date.getDay()|0,4);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;SAFE_HEAP_STORE(tmPtr+28|0,yday|0,4);return date.getTime()/1e3|0}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){SAFE_HEAP_STORE(ptr|0,ret|0,4)}return ret}if(ENVIRONMENT_IS_NODE){_emscripten_get_now=function _emscripten_get_now_actual(){var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(typeof dateNow!==\"undefined\"){_emscripten_get_now=dateNow}else if(typeof performance===\"object\"&&performance&&typeof performance[\"now\"]===\"function\"){_emscripten_get_now=function(){return performance[\"now\"]()}}else{_emscripten_get_now=Date.now}FS.staticInit();if(ENVIRONMENT_IS_NODE){var fs=frozenFs;var NODEJS_PATH=__webpack_require__(3);NODEFS.staticInit()}if(ENVIRONMENT_IS_NODE){var _wrapNodeError=function(func){return function(){try{return func.apply(this,arguments)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}};var VFS=Object.assign({},FS);for(var _key in NODERAWFS)FS[_key]=_wrapNodeError(NODERAWFS[_key])}else{throw new Error(\"NODERAWFS is currently only supported on Node.js environment.\")}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var decodeBase64=typeof atob===\"function\"?atob:function(input){var keyStr=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";var output=\"\";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}writeStackCookie();preRun();if(runDependencies>0)return;if(Module[\"calledRun\"])return;function doRun(){if(Module[\"calledRun\"])return;Module[\"calledRun\"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;var abortDecorators=[];function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else{what=\"\"}ABORT=true;EXITSTATUS=1;var extra=\"\";var output=\"abort(\"+what+\") at \"+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}Module[\"abort\"]=abort;if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}Module[\"noExitRuntime\"]=true;run();\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"module\");\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"fs\");\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"path\");\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/*!\n * Tmp\n *\n * Copyright (c) 2011-2017 KARASZI Istvan \n *\n * MIT Licensed\n */\n\n/*\n * Module dependencies.\n */\nconst fs = __webpack_require__(2);\nconst path = __webpack_require__(3);\nconst crypto = __webpack_require__(6);\nconst osTmpDir = __webpack_require__(14);\nconst _c = process.binding('constants');\n\n/*\n * The working inner variables.\n */\nconst\n /**\n * The temporary directory.\n * @type {string}\n */\n tmpDir = osTmpDir(),\n\n // the random characters to choose from\n RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n\n TEMPLATE_PATTERN = /XXXXXX/,\n\n DEFAULT_TRIES = 3,\n\n CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),\n\n EBADF = _c.EBADF || _c.os.errno.EBADF,\n ENOENT = _c.ENOENT || _c.os.errno.ENOENT,\n\n DIR_MODE = 448 /* 0o700 */,\n FILE_MODE = 384 /* 0o600 */,\n\n // this will hold the objects need to be removed on exit\n _removeObjects = [];\n\nvar\n _gracefulCleanup = false,\n _uncaughtException = false;\n\n/**\n * Random name generator based on crypto.\n * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript\n *\n * @param {number} howMany\n * @returns {string} the generated random name\n * @private\n */\nfunction _randomChars(howMany) {\n var\n value = [],\n rnd = null;\n\n // make sure that we do not fail because we ran out of entropy\n try {\n rnd = crypto.randomBytes(howMany);\n } catch (e) {\n rnd = crypto.pseudoRandomBytes(howMany);\n }\n\n for (var i = 0; i < howMany; i++) {\n value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);\n }\n\n return value.join('');\n}\n\n/**\n * Checks whether the `obj` parameter is defined or not.\n *\n * @param {Object} obj\n * @returns {boolean} true if the object is undefined\n * @private\n */\nfunction _isUndefined(obj) {\n return typeof obj === 'undefined';\n}\n\n/**\n * Parses the function arguments.\n *\n * This function helps to have optional arguments.\n *\n * @param {(Options|Function)} options\n * @param {Function} callback\n * @returns {Array} parsed arguments\n * @private\n */\nfunction _parseArguments(options, callback) {\n if (typeof options == 'function') {\n return [callback || {}, options];\n }\n\n if (_isUndefined(options)) {\n return [{}, callback];\n }\n\n return [options, callback];\n}\n\n/**\n * Generates a new temporary name.\n *\n * @param {Object} opts\n * @returns {string} the new random name according to opts\n * @private\n */\nfunction _generateTmpName(opts) {\n if (opts.name) {\n return path.join(opts.dir || tmpDir, opts.name);\n }\n\n // mkstemps like template\n if (opts.template) {\n return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));\n }\n\n // prefix and postfix\n const name = [\n opts.prefix || 'tmp-',\n process.pid,\n _randomChars(12),\n opts.postfix || ''\n ].join('');\n\n return path.join(opts.dir || tmpDir, name);\n}\n\n/**\n * Gets a temporary file name.\n *\n * @param {(Options|tmpNameCallback)} options options or callback\n * @param {?tmpNameCallback} callback the callback function\n */\nfunction tmpName(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n return cb(new Error('Invalid tries'));\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n return cb(new Error('Invalid template provided'));\n\n (function _getUniqueName() {\n const name = _generateTmpName(opts);\n\n // check whether the path exists then retry if needed\n fs.stat(name, function (err) {\n if (!err) {\n if (tries-- > 0) return _getUniqueName();\n\n return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));\n }\n\n cb(null, name);\n });\n }());\n}\n\n/**\n * Synchronous version of tmpName.\n *\n * @param {Object} options\n * @returns {string} the generated random name\n * @throws {Error} if the options are invalid or could not generate a filename\n */\nfunction tmpNameSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n throw new Error('Invalid tries');\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n throw new Error('Invalid template provided');\n\n do {\n const name = _generateTmpName(opts);\n try {\n fs.statSync(name);\n } catch (e) {\n return name;\n }\n } while (tries-- > 0);\n\n throw new Error('Could not get a unique tmp filename, max tries reached');\n}\n\n/**\n * Creates and opens a temporary file.\n *\n * @param {(Options|fileCallback)} options the config options or the callback function\n * @param {?fileCallback} callback\n */\nfunction file(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create and open the file\n fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {\n if (err) return cb(err);\n\n if (opts.discardDescriptor) {\n return fs.close(fd, function _discardCallback(err) {\n if (err) {\n // Low probability, and the file exists, so this could be\n // ignored. If it isn't we certainly need to unlink the\n // file, and if that fails too its error is more\n // important.\n try {\n fs.unlinkSync(name);\n } catch (e) {\n if (!isENOENT(e)) {\n err = e;\n }\n }\n return cb(err);\n }\n cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));\n });\n }\n if (opts.detachDescriptor) {\n return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));\n }\n cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));\n });\n });\n}\n\n/**\n * Synchronous version of file.\n *\n * @param {Options} options\n * @returns {FileSyncObject} object consists of name, fd and removeCallback\n * @throws {Error} if cannot create a file\n */\nfunction fileSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n opts.postfix = opts.postfix || '.tmp';\n\n const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;\n const name = tmpNameSync(opts);\n var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);\n if (opts.discardDescriptor) {\n fs.closeSync(fd); \n fd = undefined;\n }\n\n return {\n name: name,\n fd: fd,\n removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)\n };\n}\n\n/**\n * Removes files and folders in a directory recursively.\n *\n * @param {string} root\n * @private\n */\nfunction _rmdirRecursiveSync(root) {\n const dirs = [root];\n\n do {\n var\n dir = dirs.pop(),\n deferred = false,\n files = fs.readdirSync(dir);\n\n for (var i = 0, length = files.length; i < length; i++) {\n var\n file = path.join(dir, files[i]),\n stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories\n\n if (stat.isDirectory()) {\n if (!deferred) {\n deferred = true;\n dirs.push(dir);\n }\n dirs.push(file);\n } else {\n fs.unlinkSync(file);\n }\n }\n\n if (!deferred) {\n fs.rmdirSync(dir);\n }\n } while (dirs.length !== 0);\n}\n\n/**\n * Creates a temporary directory.\n *\n * @param {(Options|dirCallback)} options the options or the callback function\n * @param {?dirCallback} callback\n */\nfunction dir(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create the directory\n fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {\n if (err) return cb(err);\n\n cb(null, name, _prepareTmpDirRemoveCallback(name, opts));\n });\n });\n}\n\n/**\n * Synchronous version of dir.\n *\n * @param {Options} options\n * @returns {DirSyncObject} object consists of name and removeCallback\n * @throws {Error} if it cannot create a directory\n */\nfunction dirSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n const name = tmpNameSync(opts);\n fs.mkdirSync(name, opts.mode || DIR_MODE);\n\n return {\n name: name,\n removeCallback: _prepareTmpDirRemoveCallback(name, opts)\n };\n}\n\n/**\n * Prepares the callback for removal of the temporary file.\n *\n * @param {string} name the path of the file\n * @param {number} fd file descriptor\n * @param {Object} opts\n * @returns {fileCallback}\n * @private\n */\nfunction _prepareTmpFileRemoveCallback(name, fd, opts) {\n const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {\n try {\n if (0 <= fdPath[0]) {\n fs.closeSync(fdPath[0]);\n }\n }\n catch (e) {\n // under some node/windows related circumstances, a temporary file\n // may have not be created as expected or the file was already closed\n // by the user, in which case we will simply ignore the error\n if (!isEBADF(e) && !isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n try {\n fs.unlinkSync(fdPath[1]);\n }\n catch (e) {\n if (!isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n }, [fd, name]);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Prepares the callback for removal of the temporary directory.\n *\n * @param {string} name\n * @param {Object} opts\n * @returns {Function} the callback\n * @private\n */\nfunction _prepareTmpDirRemoveCallback(name, opts) {\n const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);\n const removeCallback = _prepareRemoveCallback(removeFunction, name);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Creates a guarded function wrapping the removeFunction call.\n *\n * @param {Function} removeFunction\n * @param {Object} arg\n * @returns {Function}\n * @private\n */\nfunction _prepareRemoveCallback(removeFunction, arg) {\n var called = false;\n\n return function _cleanupCallback(next) {\n if (!called) {\n const index = _removeObjects.indexOf(_cleanupCallback);\n if (index >= 0) {\n _removeObjects.splice(index, 1);\n }\n\n called = true;\n removeFunction(arg);\n }\n\n if (next) next(null);\n };\n}\n\n/**\n * The garbage collector.\n *\n * @private\n */\nfunction _garbageCollector() {\n if (_uncaughtException && !_gracefulCleanup) {\n return;\n }\n\n // the function being called removes itself from _removeObjects,\n // loop until _removeObjects is empty\n while (_removeObjects.length) {\n try {\n _removeObjects[0].call(null);\n } catch (e) {\n // already removed?\n }\n }\n}\n\n/**\n * Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.\n */\nfunction isEBADF(error) {\n return isExpectedError(error, -EBADF, 'EBADF');\n}\n\n/**\n * Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.\n */\nfunction isENOENT(error) {\n return isExpectedError(error, -ENOENT, 'ENOENT');\n}\n\n/**\n * Helper to determine whether the expected error code matches the actual code and errno,\n * which will differ between the supported node versions.\n *\n * - Node >= 7.0:\n * error.code {String}\n * error.errno {String|Number} any numerical value will be negated\n *\n * - Node >= 6.0 < 7.0:\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 4.0 < 6.0: introduces SystemError\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 0.10 < 4.0:\n * error.code {Number} negated\n * error.errno n/a\n */\nfunction isExpectedError(error, code, errno) {\n return error.code == code || error.code == errno;\n}\n\n/**\n * Sets the graceful cleanup.\n *\n * Also removes the created files and directories when an uncaught exception occurs.\n */\nfunction setGracefulCleanup() {\n _gracefulCleanup = true;\n}\n\nconst version = process.versions.node.split('.').map(function (value) {\n return parseInt(value, 10);\n});\n\nif (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {\n process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {\n _uncaughtException = true;\n _garbageCollector();\n\n throw err;\n });\n}\n\nprocess.addListener('exit', function _exit(code) {\n if (code) _uncaughtException = true;\n _garbageCollector();\n});\n\n/**\n * Configuration options.\n *\n * @typedef {Object} Options\n * @property {?number} tries the number of tries before give up the name generation\n * @property {?string} template the \"mkstemp\" like filename template\n * @property {?string} name fix name\n * @property {?string} dir the tmp directory to use\n * @property {?string} prefix prefix for the generated name\n * @property {?string} postfix postfix for the generated name\n */\n\n/**\n * @typedef {Object} FileSyncObject\n * @property {string} name the name of the file\n * @property {string} fd the file descriptor\n * @property {fileCallback} removeCallback the callback function to remove the file\n */\n\n/**\n * @typedef {Object} DirSyncObject\n * @property {string} name the name of the directory\n * @property {fileCallback} removeCallback the callback function to remove the directory\n */\n\n/**\n * @callback tmpNameCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n */\n\n/**\n * @callback fileCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {number} fd the file descriptor\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * @callback dirCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * Removes the temporary created file or directory.\n *\n * @callback cleanupCallback\n * @param {simpleCallback} [next] function to call after entry was removed\n */\n\n/**\n * Callback function for function composition.\n * @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57}\n *\n * @callback simpleCallback\n */\n\n// exporting all the needed methods\nmodule.exports.tmpdir = tmpDir;\n\nmodule.exports.dir = dir;\nmodule.exports.dirSync = dirSync;\n\nmodule.exports.file = file;\nmodule.exports.fileSync = fileSync;\n\nmodule.exports.tmpName = tmpName;\nmodule.exports.tmpNameSync = tmpNameSync;\n\nmodule.exports.setGracefulCleanup = setGracefulCleanup;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"stream\");\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"crypto\");\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"string_decoder\");\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"util\");\n\n/***/ }),\n/* 9 */,\n/* 10 */,\n/* 11 */,\n/* 12 */,\n/* 13 */,\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar isWindows = process.platform === 'win32';\nvar trailingSlashRe = isWindows ? /[^:]\\\\$/ : /.\\/$/;\n\n// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43\nmodule.exports = function () {\n\tvar path;\n\n\tif (isWindows) {\n\t\tpath = process.env.TEMP ||\n\t\t\tprocess.env.TMP ||\n\t\t\t(process.env.SystemRoot || process.env.windir) + '\\\\temp';\n\t} else {\n\t\tpath = process.env.TMPDIR ||\n\t\t\tprocess.env.TMP ||\n\t\t\tprocess.env.TEMP ||\n\t\t\t'/tmp';\n\t}\n\n\tif (trailingSlashRe.test(path)) {\n\t\tpath = path.slice(0, -1);\n\t}\n\n\treturn path;\n};\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: external \"fs\"\nvar external_fs_ = __webpack_require__(2);\nvar external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);\n\n// EXTERNAL MODULE: external \"path\"\nvar external_path_ = __webpack_require__(3);\nvar external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);\n\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/path.ts\n\nconst PortablePath = {\n root: `/`,\n dot: `.`\n};\nconst npath = Object.create(external_path_default.a);\nconst ppath = Object.create(external_path_default.a.posix);\n\nconst contains = function (pathUtils, from, to) {\n from = pathUtils.normalize(from);\n to = pathUtils.normalize(to);\n if (from === to) return `.`;\n if (!from.endsWith(pathUtils.sep)) from = from + pathUtils.sep;\n\n if (to.startsWith(from)) {\n return to.slice(from.length);\n } else {\n return null;\n }\n};\n\nnpath.fromPortablePath = fromPortablePath;\nnpath.toPortablePath = toPortablePath;\n\nnpath.contains = (from, to) => contains(npath, from, to);\n\nppath.contains = (from, to) => contains(ppath, from, to);\n\nconst WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/;\nconst PORTABLE_PATH_REGEXP = /^\\/[a-zA-Z]:.*$/; // Path should look like \"/N:/berry/scripts/plugin-pack.js\"\n// And transform to \"N:\\berry\\scripts\\plugin-pack.js\"\n\nfunction fromPortablePath(p) {\n if (process.platform !== 'win32') return p;\n return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\\//g, `\\\\`) : p;\n} // Path should look like \"N:/berry/scripts/plugin-pack.js\"\n// And transform to \"/N:/berry/scripts/plugin-pack.js\"\n\n\nfunction toPortablePath(p) {\n if (process.platform !== 'win32') return p;\n return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\\\/g, `/`);\n}\n\nfunction convertPath(targetPathUtils, sourcePath) {\n return targetPathUtils === npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath);\n}\nfunction toFilename(filename) {\n if (npath.parse(filename).dir !== '' || ppath.parse(filename).dir !== '') throw new Error(`Invalid filename: \"${filename}\"`);\n return filename;\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/FakeFS.ts\n\n\nclass FakeFS_FakeFS {\n constructor(pathUtils) {\n this.pathUtils = pathUtils;\n }\n\n async removePromise(p) {\n let stat;\n\n try {\n stat = await this.lstatPromise(p);\n } catch (error) {\n if (error.code === `ENOENT`) {\n return;\n } else {\n throw error;\n }\n }\n\n if (stat.isDirectory()) {\n for (const entry of await this.readdirPromise(p)) await this.removePromise(this.pathUtils.resolve(p, entry)); // 5 gives 1s worth of retries at worst\n\n\n for (let t = 0; t < 5; ++t) {\n try {\n await this.rmdirPromise(p);\n break;\n } catch (error) {\n if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) {\n await new Promise(resolve => setTimeout(resolve, t * 100));\n continue;\n } else {\n throw error;\n }\n }\n }\n } else {\n await this.unlinkPromise(p);\n }\n }\n\n removeSync(p) {\n let stat;\n\n try {\n stat = this.lstatSync(p);\n } catch (error) {\n if (error.code === `ENOENT`) {\n return;\n } else {\n throw error;\n }\n }\n\n if (stat.isDirectory()) {\n for (const entry of this.readdirSync(p)) this.removeSync(this.pathUtils.resolve(p, entry));\n\n this.rmdirSync(p);\n } else {\n this.unlinkSync(p);\n }\n }\n\n async mkdirpPromise(p, {\n chmod,\n utimes\n } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p)) return;\n const parts = p.split(this.pathUtils.sep);\n\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n\n if (!this.existsSync(subPath)) {\n try {\n await this.mkdirPromise(subPath);\n } catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n } else {\n throw error;\n }\n }\n\n if (chmod != null) await this.chmodPromise(subPath, chmod);\n\n if (utimes != null) {\n await this.utimesPromise(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n\n mkdirpSync(p, {\n chmod,\n utimes\n } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p)) return;\n const parts = p.split(this.pathUtils.sep);\n\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n\n if (!this.existsSync(subPath)) {\n try {\n this.mkdirSync(subPath);\n } catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n } else {\n throw error;\n }\n }\n\n if (chmod != null) this.chmodSync(subPath, chmod);\n\n if (utimes != null) {\n this.utimesSync(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n\n async copyPromise(destination, source, {\n baseFs = this,\n overwrite = true\n } = {}) {\n const stat = await baseFs.lstatPromise(source);\n const exists = await this.existsSync(destination);\n\n if (stat.isDirectory()) {\n await this.mkdirpPromise(destination);\n const directoryListing = await baseFs.readdirPromise(source);\n await Promise.all(directoryListing.map(entry => {\n return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), {\n baseFs,\n overwrite\n });\n }));\n } else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists) await this.removePromise(destination);\n const content = await baseFs.readFilePromise(source);\n await this.writeFilePromise(destination, content);\n }\n } else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists) await this.removePromise(destination);\n const target = await baseFs.readlinkPromise(source);\n await this.symlinkPromise(convertPath(this.pathUtils, target), destination);\n }\n } else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n\n const mode = stat.mode & 0o777;\n await this.chmodPromise(destination, mode);\n }\n\n copySync(destination, source, {\n baseFs = this,\n overwrite = true\n } = {}) {\n const stat = baseFs.lstatSync(source);\n const exists = this.existsSync(destination);\n\n if (stat.isDirectory()) {\n this.mkdirpSync(destination);\n const directoryListing = baseFs.readdirSync(source);\n\n for (const entry of directoryListing) {\n this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), {\n baseFs,\n overwrite\n });\n }\n } else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists) this.removeSync(destination);\n const content = baseFs.readFileSync(source);\n this.writeFileSync(destination, content);\n }\n } else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists) this.removeSync(destination);\n const target = baseFs.readlinkSync(source);\n this.symlinkSync(convertPath(this.pathUtils, target), destination);\n }\n } else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n\n const mode = stat.mode & 0o777;\n this.chmodSync(destination, mode);\n }\n\n async changeFilePromise(p, content) {\n try {\n const current = await this.readFilePromise(p, `utf8`);\n\n if (current === content) {\n return;\n }\n } catch (error) {// ignore errors, no big deal\n }\n\n await this.writeFilePromise(p, content);\n }\n\n changeFileSync(p, content) {\n try {\n const current = this.readFileSync(p, `utf8`);\n\n if (current === content) {\n return;\n }\n } catch (error) {// ignore errors, no big deal\n }\n\n this.writeFileSync(p, content);\n }\n\n async movePromise(fromP, toP) {\n try {\n await this.renamePromise(fromP, toP);\n } catch (error) {\n if (error.code === `EXDEV`) {\n await this.copyPromise(toP, fromP);\n await this.removePromise(fromP);\n } else {\n throw error;\n }\n }\n }\n\n moveSync(fromP, toP) {\n try {\n this.renameSync(fromP, toP);\n } catch (error) {\n if (error.code === `EXDEV`) {\n this.copySync(toP, fromP);\n this.removeSync(fromP);\n } else {\n throw error;\n }\n }\n }\n\n async lockPromise(affectedPath, callback) {\n const lockPath = `${affectedPath}.flock`;\n const interval = 1000 / 60;\n const startTime = Date.now();\n let fd = null; // Even when we detect that a lock file exists, we still look inside to see\n // whether the pid that created it is still alive. It's not foolproof\n // (there are false positive), but there are no false negative and that's\n // all that matters in 99% of the cases.\n\n const isAlive = async () => {\n let pid;\n\n try {\n [pid] = await this.readJsonPromise(lockPath);\n } catch (error) {\n // If we can't read the file repeatedly, we assume the process was\n // aborted before even writing finishing writing the payload.\n return Date.now() - startTime < 500;\n }\n\n try {\n // \"As a special case, a signal of 0 can be used to test for the\n // existence of a process\" - so we check whether it's alive.\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return false;\n }\n };\n\n while (fd === null) {\n try {\n fd = await this.openPromise(lockPath, `wx`);\n } catch (error) {\n if (error.code === `EEXIST`) {\n if (!(await isAlive())) {\n try {\n await this.unlinkPromise(lockPath);\n continue;\n } catch (error) {// No big deal if we can't remove it. Just fallback to wait for\n // it to be eventually released by its owner.\n }\n }\n\n if (Date.now() - startTime < 60 * 1000) {\n await new Promise(resolve => setTimeout(resolve, interval));\n } else {\n throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`);\n }\n } else {\n throw error;\n }\n }\n }\n\n await this.writePromise(fd, JSON.stringify([process.pid]));\n\n try {\n return await callback();\n } finally {\n await this.closePromise(fd);\n await this.unlinkPromise(lockPath);\n }\n }\n\n async readJsonPromise(p) {\n const content = await this.readFilePromise(p, `utf8`);\n\n try {\n return JSON.parse(content);\n } catch (error) {\n error.message += ` (in ${p})`;\n throw error;\n }\n }\n\n async readJsonSync(p) {\n const content = this.readFileSync(p, `utf8`);\n\n try {\n return JSON.parse(content);\n } catch (error) {\n error.message += ` (in ${p})`;\n throw error;\n }\n }\n\n async writeJsonPromise(p, data) {\n return await this.writeFilePromise(p, `${JSON.stringify(data, null, 2)}\\n`);\n }\n\n writeJsonSync(p, data) {\n return this.writeFileSync(p, `${JSON.stringify(data, null, 2)}\\n`);\n }\n\n}\n;\nclass FakeFS_BasePortableFakeFS extends FakeFS_FakeFS {\n constructor() {\n super(ppath);\n }\n\n resolve(p) {\n return this.pathUtils.resolve(PortablePath.root, p);\n }\n\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/NodeFS.ts\n\n\n\nclass NodeFS_NodeFS extends FakeFS_BasePortableFakeFS {\n constructor(realFs = external_fs_default.a) {\n super();\n this.realFs = realFs;\n }\n\n getRealPath() {\n return PortablePath.root;\n }\n\n async openPromise(p, flags, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.open(npath.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject));\n });\n }\n\n openSync(p, flags, mode) {\n return this.realFs.openSync(npath.fromPortablePath(p), flags, mode);\n }\n\n async readPromise(fd, buffer, offset = 0, length = 0, position = -1) {\n return await new Promise((resolve, reject) => {\n this.realFs.read(fd, buffer, offset, length, position, (error, bytesRead) => {\n if (error) {\n reject(error);\n } else {\n resolve(bytesRead);\n }\n });\n });\n }\n\n readSync(fd, buffer, offset, length, position) {\n return this.realFs.readSync(fd, buffer, offset, length, position);\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n return await new Promise((resolve, reject) => {\n if (typeof buffer === `string`) {\n return this.realFs.write(fd, buffer, offset, this.makeCallback(resolve, reject));\n } else {\n return this.realFs.write(fd, buffer, offset, length, position, this.makeCallback(resolve, reject));\n }\n });\n }\n\n writeSync(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.realFs.writeSync(fd, buffer, offset);\n } else {\n return this.realFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n async closePromise(fd) {\n await new Promise((resolve, reject) => {\n this.realFs.close(fd, this.makeCallback(resolve, reject));\n });\n }\n\n closeSync(fd) {\n this.realFs.closeSync(fd);\n }\n\n createReadStream(p, opts) {\n const realPath = p !== null ? npath.fromPortablePath(p) : p;\n return this.realFs.createReadStream(realPath, opts);\n }\n\n createWriteStream(p, opts) {\n const realPath = p !== null ? npath.fromPortablePath(p) : p;\n return this.realFs.createWriteStream(realPath, opts);\n }\n\n async realpathPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.realpath(npath.fromPortablePath(p), {}, this.makeCallback(resolve, reject));\n }).then(path => {\n return npath.toPortablePath(path);\n });\n }\n\n realpathSync(p) {\n return npath.toPortablePath(this.realFs.realpathSync(npath.fromPortablePath(p), {}));\n }\n\n async existsPromise(p) {\n return await new Promise(resolve => {\n this.realFs.exists(npath.fromPortablePath(p), resolve);\n });\n }\n\n accessSync(p, mode) {\n return this.realFs.accessSync(npath.fromPortablePath(p), mode);\n }\n\n async accessPromise(p, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.access(npath.fromPortablePath(p), mode, this.makeCallback(resolve, reject));\n });\n }\n\n existsSync(p) {\n return this.realFs.existsSync(npath.fromPortablePath(p));\n }\n\n async statPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.stat(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n statSync(p) {\n return this.realFs.statSync(npath.fromPortablePath(p));\n }\n\n async lstatPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.lstat(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n lstatSync(p) {\n return this.realFs.lstatSync(npath.fromPortablePath(p));\n }\n\n async chmodPromise(p, mask) {\n return await new Promise((resolve, reject) => {\n this.realFs.chmod(npath.fromPortablePath(p), mask, this.makeCallback(resolve, reject));\n });\n }\n\n chmodSync(p, mask) {\n return this.realFs.chmodSync(npath.fromPortablePath(p), mask);\n }\n\n async renamePromise(oldP, newP) {\n return await new Promise((resolve, reject) => {\n this.realFs.rename(npath.fromPortablePath(oldP), npath.fromPortablePath(newP), this.makeCallback(resolve, reject));\n });\n }\n\n renameSync(oldP, newP) {\n return this.realFs.renameSync(npath.fromPortablePath(oldP), npath.fromPortablePath(newP));\n }\n\n async copyFilePromise(sourceP, destP, flags = 0) {\n return await new Promise((resolve, reject) => {\n this.realFs.copyFile(npath.fromPortablePath(sourceP), npath.fromPortablePath(destP), flags, this.makeCallback(resolve, reject));\n });\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n return this.realFs.copyFileSync(npath.fromPortablePath(sourceP), npath.fromPortablePath(destP), flags);\n }\n\n async appendFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.appendFile(fsNativePath, content, opts, this.makeCallback(resolve, reject));\n } else {\n this.realFs.appendFile(fsNativePath, content, this.makeCallback(resolve, reject));\n }\n });\n }\n\n appendFileSync(p, content, opts) {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.appendFileSync(fsNativePath, content, opts);\n } else {\n this.realFs.appendFileSync(fsNativePath, content);\n }\n }\n\n async writeFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.writeFile(fsNativePath, content, opts, this.makeCallback(resolve, reject));\n } else {\n this.realFs.writeFile(fsNativePath, content, this.makeCallback(resolve, reject));\n }\n });\n }\n\n writeFileSync(p, content, opts) {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n\n if (opts) {\n this.realFs.writeFileSync(fsNativePath, content, opts);\n } else {\n this.realFs.writeFileSync(fsNativePath, content);\n }\n }\n\n async unlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.unlink(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n unlinkSync(p) {\n return this.realFs.unlinkSync(npath.fromPortablePath(p));\n }\n\n async utimesPromise(p, atime, mtime) {\n return await new Promise((resolve, reject) => {\n this.realFs.utimes(npath.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject));\n });\n }\n\n utimesSync(p, atime, mtime) {\n this.realFs.utimesSync(npath.fromPortablePath(p), atime, mtime);\n }\n\n async mkdirPromise(p, opts) {\n return await new Promise((resolve, reject) => {\n this.realFs.mkdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject));\n });\n }\n\n mkdirSync(p, opts) {\n return this.realFs.mkdirSync(npath.fromPortablePath(p), opts);\n }\n\n async rmdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.rmdir(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n rmdirSync(p) {\n return this.realFs.rmdirSync(npath.fromPortablePath(p));\n }\n\n async symlinkPromise(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return await new Promise((resolve, reject) => {\n this.realFs.symlink(npath.fromPortablePath(target.replace(/\\/+$/, ``)), npath.fromPortablePath(p), type, this.makeCallback(resolve, reject));\n });\n }\n\n symlinkSync(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return this.realFs.symlinkSync(npath.fromPortablePath(target.replace(/\\/+$/, ``)), npath.fromPortablePath(p), type);\n }\n\n async readFilePromise(p, encoding) {\n return await new Promise((resolve, reject) => {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n this.realFs.readFile(fsNativePath, encoding, this.makeCallback(resolve, reject));\n });\n }\n\n readFileSync(p, encoding) {\n const fsNativePath = typeof p === `string` ? npath.fromPortablePath(p) : p;\n return this.realFs.readFileSync(fsNativePath, encoding);\n }\n\n async readdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n\n readdirSync(p) {\n return this.realFs.readdirSync(npath.fromPortablePath(p));\n }\n\n async readlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readlink(npath.fromPortablePath(p), this.makeCallback(resolve, reject));\n }).then(path => {\n return npath.toPortablePath(path);\n });\n }\n\n readlinkSync(p) {\n return npath.toPortablePath(this.realFs.readlinkSync(npath.fromPortablePath(p)));\n }\n\n watch(p, a, b) {\n return this.realFs.watch(npath.fromPortablePath(p), // @ts-ignore\n a, b);\n }\n\n makeCallback(resolve, reject) {\n return (err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result);\n }\n };\n }\n\n}\n// EXTERNAL MODULE: ../yarnpkg-libzip/sources/libzip.js\nvar libzip = __webpack_require__(0);\nvar libzip_default = /*#__PURE__*/__webpack_require__.n(libzip);\n\n// CONCATENATED MODULE: ../yarnpkg-libzip/sources/index.ts\n\nconst number64 = [`number`, `number`]; // eslint-disable-next-line arca/no-default-export\n\n/* harmony default export */ var sources = ({\n // Those are getters because they can change after memory growth\n get HEAP8() {\n return libzip_default.a.HEAP8;\n },\n\n get HEAPU8() {\n return libzip_default.a.HEAPU8;\n },\n\n ZIP_CHECKCONS: 4,\n ZIP_CREATE: 1,\n ZIP_EXCL: 2,\n ZIP_TRUNCATE: 8,\n ZIP_RDONLY: 16,\n ZIP_FL_OVERWRITE: 8192,\n ZIP_OPSYS_DOS: 0x00,\n ZIP_OPSYS_AMIGA: 0x01,\n ZIP_OPSYS_OPENVMS: 0x02,\n ZIP_OPSYS_UNIX: 0x03,\n ZIP_OPSYS_VM_CMS: 0x04,\n ZIP_OPSYS_ATARI_ST: 0x05,\n ZIP_OPSYS_OS_2: 0x06,\n ZIP_OPSYS_MACINTOSH: 0x07,\n ZIP_OPSYS_Z_SYSTEM: 0x08,\n ZIP_OPSYS_CPM: 0x09,\n ZIP_OPSYS_WINDOWS_NTFS: 0x0a,\n ZIP_OPSYS_MVS: 0x0b,\n ZIP_OPSYS_VSE: 0x0c,\n ZIP_OPSYS_ACORN_RISC: 0x0d,\n ZIP_OPSYS_VFAT: 0x0e,\n ZIP_OPSYS_ALTERNATE_MVS: 0x0f,\n ZIP_OPSYS_BEOS: 0x10,\n ZIP_OPSYS_TANDEM: 0x11,\n ZIP_OPSYS_OS_400: 0x12,\n ZIP_OPSYS_OS_X: 0x13,\n uint08S: libzip_default.a._malloc(1),\n uint16S: libzip_default.a._malloc(2),\n uint32S: libzip_default.a._malloc(4),\n uint64S: libzip_default.a._malloc(8),\n malloc: libzip_default.a._malloc,\n free: libzip_default.a._free,\n getValue: libzip_default.a.getValue,\n open: libzip_default.a.cwrap(`zip_open`, `number`, [`string`, `number`, `number`]),\n openFromSource: libzip_default.a.cwrap(`zip_open_from_source`, `number`, [`number`, `number`, `number`]),\n close: libzip_default.a.cwrap(`zip_close`, `number`, [`number`]),\n discard: libzip_default.a.cwrap(`zip_discard`, null, [`number`]),\n getError: libzip_default.a.cwrap(`zip_get_error`, `number`, [`number`]),\n getName: libzip_default.a.cwrap(`zip_get_name`, `string`, [`number`, `number`, `number`]),\n getNumEntries: libzip_default.a.cwrap(`zip_get_num_entries`, `number`, [`number`, `number`]),\n stat: libzip_default.a.cwrap(`zip_stat`, `number`, [`number`, `string`, `number`, `number`]),\n statIndex: libzip_default.a.cwrap(`zip_stat_index`, `number`, [`number`, ...number64, `number`, `number`]),\n fopen: libzip_default.a.cwrap(`zip_fopen`, `number`, [`number`, `string`, `number`]),\n fopenIndex: libzip_default.a.cwrap(`zip_fopen_index`, `number`, [`number`, ...number64, `number`]),\n fread: libzip_default.a.cwrap(`zip_fread`, `number`, [`number`, `number`, `number`, `number`]),\n fclose: libzip_default.a.cwrap(`zip_fclose`, `number`, [`number`]),\n dir: {\n add: libzip_default.a.cwrap(`zip_dir_add`, `number`, [`number`, `string`])\n },\n file: {\n add: libzip_default.a.cwrap(`zip_file_add`, `number`, [`number`, `string`, `number`, `number`]),\n getError: libzip_default.a.cwrap(`zip_file_get_error`, `number`, [`number`]),\n getExternalAttributes: libzip_default.a.cwrap(`zip_file_get_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setExternalAttributes: libzip_default.a.cwrap(`zip_file_set_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setMtime: libzip_default.a.cwrap(`zip_file_set_mtime`, `number`, [`number`, ...number64, `number`, `number`])\n },\n error: {\n initWithCode: libzip_default.a.cwrap(`zip_error_init_with_code`, null, [`number`, `number`]),\n strerror: libzip_default.a.cwrap(`zip_error_strerror`, `string`, [`number`])\n },\n name: {\n locate: libzip_default.a.cwrap(`zip_name_locate`, `number`, [`number`, `string`, `number`])\n },\n source: {\n fromUnattachedBuffer: libzip_default.a.cwrap(`zip_source_buffer_create`, `number`, [`number`, `number`, `number`, `number`]),\n fromBuffer: libzip_default.a.cwrap(`zip_source_buffer`, `number`, [`number`, `number`, ...number64, `number`]),\n free: libzip_default.a.cwrap(`zip_source_free`, null, [`number`])\n },\n struct: {\n stat: libzip_default.a.cwrap(`zipstruct_stat`, `number`, []),\n statS: libzip_default.a.cwrap(`zipstruct_statS`, `number`, []),\n statName: libzip_default.a.cwrap(`zipstruct_stat_name`, `string`, [`number`]),\n statIndex: libzip_default.a.cwrap(`zipstruct_stat_index`, `number`, [`number`]),\n statSize: libzip_default.a.cwrap(`zipstruct_stat_size`, `number`, [`number`]),\n statMtime: libzip_default.a.cwrap(`zipstruct_stat_mtime`, `number`, [`number`]),\n error: libzip_default.a.cwrap(`zipstruct_error`, `number`, []),\n errorS: libzip_default.a.cwrap(`zipstruct_errorS`, `number`, [])\n }\n});\n// EXTERNAL MODULE: external \"stream\"\nvar external_stream_ = __webpack_require__(5);\n\n// EXTERNAL MODULE: external \"util\"\nvar external_util_ = __webpack_require__(8);\n\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/errors.ts\nfunction makeError(code, message) {\n return Object.assign(new Error(`${code}: ${message}`), {\n code\n });\n}\n\nfunction EBUSY(message) {\n return makeError(`EBUSY`, message);\n}\nfunction ENOSYS(message, reason) {\n return makeError(`ENOSYS`, `${message}, ${reason}`);\n}\nfunction EINVAL(reason) {\n return makeError(`EINVAL`, `invalid argument, ${reason}`);\n}\nfunction EBADF(reason) {\n return makeError(`EBADF`, `bad file descriptor, ${reason}`);\n}\nfunction ENOENT(reason) {\n return makeError(`ENOENT`, `no such file or directory, ${reason}`);\n}\nfunction ENOTDIR(reason) {\n return makeError(`ENOTDIR`, `not a directory, ${reason}`);\n}\nfunction EISDIR(reason) {\n return makeError(`EISDIR`, `illegal operation on a directory, ${reason}`);\n}\nfunction EEXIST(reason) {\n return makeError(`EEXIST`, `file already exists, ${reason}`);\n}\nfunction EROFS(reason) {\n return makeError(`EROFS`, `read-only filesystem, ${reason}`);\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/ZipFS.ts\n\n\n\n\n\n\n\n\nconst S_IFMT = 0o170000;\nconst S_IFDIR = 0o040000;\nconst S_IFREG = 0o100000;\nconst S_IFLNK = 0o120000;\n\nclass StatEntry {\n constructor() {\n this.dev = 0;\n this.ino = 0;\n this.mode = 0;\n this.nlink = 1;\n this.rdev = 0;\n this.blocks = 1;\n }\n\n isBlockDevice() {\n return false;\n }\n\n isCharacterDevice() {\n return false;\n }\n\n isDirectory() {\n return (this.mode & S_IFMT) === S_IFDIR;\n }\n\n isFIFO() {\n return false;\n }\n\n isFile() {\n return (this.mode & S_IFMT) === S_IFREG;\n }\n\n isSocket() {\n return false;\n }\n\n isSymbolicLink() {\n return (this.mode & S_IFMT) === S_IFLNK;\n }\n\n}\n\nfunction makeDefaultStats() {\n return Object.assign(new StatEntry(), {\n uid: 0,\n gid: 0,\n size: 0,\n blksize: 0,\n atimeMs: 0,\n mtimeMs: 0,\n ctimeMs: 0,\n birthtimeMs: 0,\n atime: new Date(0),\n mtime: new Date(0),\n ctime: new Date(0),\n birthtime: new Date(0),\n mode: S_IFREG | 0o644\n });\n}\n\nfunction toUnixTimestamp(time) {\n if (typeof time === 'string' && String(+time) === time) return +time; // @ts-ignore\n\n if (Number.isFinite(time)) {\n if (time < 0) {\n return Date.now() / 1000;\n } else {\n return time;\n }\n } // convert to 123.456 UNIX timestamp\n\n\n if (Object(external_util_[\"isDate\"])(time)) return time.getTime() / 1000;\n throw new Error(`Invalid time`);\n}\n\nclass ZipFS_ZipFS extends FakeFS_BasePortableFakeFS {\n constructor(source, opts = {}) {\n super();\n this.listings = new Map();\n this.entries = new Map();\n this.fds = new Map();\n this.nextFd = 0;\n this.ready = false;\n this.readOnly = false;\n const pathOptions = opts;\n\n if (typeof source === `string`) {\n const {\n baseFs = new NodeFS_NodeFS()\n } = pathOptions;\n this.baseFs = baseFs;\n this.path = source;\n } else {\n this.path = null;\n this.baseFs = null;\n }\n\n if (opts.stats) {\n this.stats = opts.stats;\n } else {\n if (typeof source === `string`) {\n try {\n this.stats = this.baseFs.statSync(source);\n } catch (error) {\n if (error.code === `ENOENT` && pathOptions.create) {\n this.stats = makeDefaultStats();\n } else {\n throw error;\n }\n }\n } else {\n this.stats = makeDefaultStats();\n }\n }\n\n const errPtr = sources.malloc(4);\n\n try {\n let flags = 0;\n if (typeof source === `string` && pathOptions.create) flags |= sources.ZIP_CREATE | sources.ZIP_TRUNCATE;\n\n if (opts.readOnly) {\n flags |= sources.ZIP_RDONLY;\n this.readOnly = true;\n }\n\n if (typeof source === `string`) {\n this.zip = sources.open(npath.fromPortablePath(source), flags, errPtr);\n } else {\n const lzSource = this.allocateUnattachedSource(source);\n\n try {\n this.zip = sources.openFromSource(lzSource, flags, errPtr);\n } catch (error) {\n sources.source.free(lzSource);\n throw error;\n }\n }\n\n if (this.zip === 0) {\n const error = sources.struct.errorS();\n sources.error.initWithCode(error, sources.getValue(errPtr, `i32`));\n throw new Error(sources.error.strerror(error));\n }\n } finally {\n sources.free(errPtr);\n }\n\n this.listings.set(PortablePath.root, new Set());\n const entryCount = sources.getNumEntries(this.zip, 0);\n\n for (let t = 0; t < entryCount; ++t) {\n const raw = sources.getName(this.zip, t, 0);\n if (ppath.isAbsolute(raw)) continue;\n const p = ppath.resolve(PortablePath.root, raw);\n this.registerEntry(p, t); // If the raw path is a directory, register it\n // to prevent empty folder being skipped\n\n if (raw.endsWith('/')) {\n this.registerListing(p);\n }\n }\n\n this.ready = true;\n }\n\n getAllFiles() {\n return Array.from(this.entries.keys());\n }\n\n getRealPath() {\n if (!this.path) throw new Error(`ZipFS don't have real paths when loaded from a buffer`);\n return this.path;\n }\n\n saveAndClose() {\n if (!this.path || !this.baseFs) throw new Error(`ZipFS cannot be saved and must be discarded when loaded from a buffer`);\n if (!this.ready) throw EBUSY(`archive closed, close`);\n if (this.readOnly) return this.discardAndClose();\n const previousMod = this.baseFs.existsSync(this.path) ? this.baseFs.statSync(this.path).mode & 0o777 : null;\n const rc = sources.close(this.zip);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip))); // Libzip overrides the chmod when writing the archive, which is a weird\n // behavior I don't totally understand (plus the umask seems bogus in some\n // weird cases - maybe related to emscripten?)\n //\n // See also https://github.com/nih-at/libzip/issues/77\n\n if (previousMod !== null && previousMod !== (this.baseFs.statSync(this.path).mode & 0o777)) this.baseFs.chmodSync(this.path, previousMod);\n this.ready = false;\n }\n\n discardAndClose() {\n if (!this.ready) throw EBUSY(`archive closed, close`);\n sources.discard(this.zip);\n this.ready = false;\n }\n\n async openPromise(p, flags, mode) {\n return this.openSync(p, flags, mode);\n }\n\n openSync(p, flags, mode) {\n const fd = this.nextFd++;\n this.fds.set(fd, {\n cursor: 0,\n p\n });\n return fd;\n }\n\n async readPromise(fd, buffer, offset, length, position) {\n return this.readSync(fd, buffer, offset, length, position);\n }\n\n readSync(fd, buffer, offset = 0, length = 0, position = -1) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`) throw EBADF(`read`);\n let realPosition;\n if (position === -1 || position === null) realPosition = entry.cursor;else realPosition = position;\n const source = this.readFileSync(entry.p);\n source.copy(buffer, offset, realPosition, realPosition + length);\n const bytesRead = Math.max(0, Math.min(source.length - realPosition, length));\n if (position === -1) entry.cursor += bytesRead;\n return bytesRead;\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.writeSync(fd, buffer, position);\n } else {\n return this.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n writeSync(fd, buffer, offset, length, position) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`) throw EBADF(`read`);\n throw new Error(`Unimplemented`);\n }\n\n async closePromise(fd) {\n return this.closeSync(fd);\n }\n\n closeSync(fd) {\n const entry = this.fds.get(fd);\n if (typeof entry === `undefined`) throw EBADF(`read`);\n this.fds.delete(fd);\n }\n\n createReadStream(p, {\n encoding\n } = {}) {\n if (p === null) throw new Error(`Unimplemented`);\n const stream = Object.assign(new external_stream_[\"PassThrough\"](), {\n bytesRead: 0,\n path: p,\n close: () => {\n clearImmediate(immediate);\n }\n });\n const immediate = setImmediate(() => {\n try {\n const data = this.readFileSync(p, encoding);\n stream.bytesRead = data.length;\n stream.write(data);\n stream.end();\n } catch (error) {\n stream.emit(`error`, error);\n stream.end();\n }\n });\n return stream;\n }\n\n createWriteStream(p, {\n encoding\n } = {}) {\n if (this.readOnly) throw EROFS(`open '${p}'`);\n if (p === null) throw new Error(`Unimplemented`);\n const stream = Object.assign(new external_stream_[\"PassThrough\"](), {\n bytesWritten: 0,\n path: p,\n close: () => {\n stream.end();\n }\n });\n const chunks = [];\n stream.on(`data`, chunk => {\n const chunkBuffer = Buffer.from(chunk);\n stream.bytesWritten += chunkBuffer.length;\n chunks.push(chunkBuffer);\n });\n stream.on(`end`, () => {\n this.writeFileSync(p, Buffer.concat(chunks), encoding);\n });\n return stream;\n }\n\n async realpathPromise(p) {\n return this.realpathSync(p);\n }\n\n realpathSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`lstat '${p}'`);\n return resolvedP;\n }\n\n async existsPromise(p) {\n return this.existsSync(p);\n }\n\n existsSync(p) {\n let resolvedP;\n\n try {\n resolvedP = this.resolveFilename(`stat '${p}'`, p);\n } catch (error) {\n return false;\n }\n\n return this.entries.has(resolvedP) || this.listings.has(resolvedP);\n }\n\n async accessPromise(p, mode) {\n return this.accessSync(p, mode);\n }\n\n accessSync(p, mode) {\n const resolvedP = this.resolveFilename(`access '${p}'`, p);\n\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) {\n throw ENOENT(`access '${p}'`);\n }\n }\n\n async statPromise(p) {\n return this.statSync(p);\n }\n\n statSync(p) {\n const resolvedP = this.resolveFilename(`stat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`stat '${p}'`);\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`stat '${p}'`);\n return this.statImpl(`stat '${p}'`, resolvedP);\n }\n\n async lstatPromise(p) {\n return this.lstatSync(p);\n }\n\n lstatSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`lstat '${p}'`);\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`lstat '${p}'`);\n return this.statImpl(`lstat '${p}'`, resolvedP);\n }\n\n statImpl(reason, p) {\n if (this.listings.has(p)) {\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = 0;\n const blksize = 512;\n const blocks = 0;\n const atimeMs = this.stats.mtimeMs;\n const birthtimeMs = this.stats.mtimeMs;\n const ctimeMs = this.stats.mtimeMs;\n const mtimeMs = this.stats.mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = S_IFDIR | 0o755;\n return Object.assign(new StatEntry(), {\n uid,\n gid,\n size,\n blksize,\n blocks,\n atime,\n birthtime,\n ctime,\n mtime,\n atimeMs,\n birthtimeMs,\n ctimeMs,\n mtimeMs,\n mode\n });\n }\n\n const entry = this.entries.get(p);\n\n if (entry !== undefined) {\n const stat = sources.struct.statS();\n const rc = sources.statIndex(this.zip, entry, 0, 0, stat);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = sources.struct.statSize(stat) >>> 0;\n const blksize = 512;\n const blocks = Math.ceil(size / blksize);\n const mtimeMs = (sources.struct.statMtime(stat) >>> 0) * 1000;\n const atimeMs = mtimeMs;\n const birthtimeMs = mtimeMs;\n const ctimeMs = mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = this.getUnixMode(entry, S_IFREG | 0o644);\n return Object.assign(new StatEntry(), {\n uid,\n gid,\n size,\n blksize,\n blocks,\n atime,\n birthtime,\n ctime,\n mtime,\n atimeMs,\n birthtimeMs,\n ctimeMs,\n mtimeMs,\n mode\n });\n }\n\n throw new Error(`Unreachable`);\n }\n\n getUnixMode(index, defaultMode) {\n const rc = sources.file.getExternalAttributes(this.zip, index, 0, 0, sources.uint08S, sources.uint32S);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const opsys = sources.getValue(sources.uint08S, `i8`) >>> 0;\n if (opsys !== sources.ZIP_OPSYS_UNIX) return defaultMode;\n return sources.getValue(sources.uint32S, `i32`) >>> 16;\n }\n\n registerListing(p) {\n let listing = this.listings.get(p);\n if (listing) return listing;\n const parentListing = this.registerListing(ppath.dirname(p));\n listing = new Set();\n parentListing.add(ppath.basename(p));\n this.listings.set(p, listing);\n return listing;\n }\n\n registerEntry(p, index) {\n const parentListing = this.registerListing(ppath.dirname(p));\n parentListing.add(ppath.basename(p));\n this.entries.set(p, index);\n }\n\n resolveFilename(reason, p, resolveLastComponent = true) {\n if (!this.ready) throw EBUSY(`archive closed, ${reason}`);\n let resolvedP = ppath.resolve(PortablePath.root, p);\n if (resolvedP === `/`) return PortablePath.root;\n\n while (true) {\n const parentP = this.resolveFilename(reason, ppath.dirname(resolvedP), true);\n const isDir = this.listings.has(parentP);\n const doesExist = this.entries.has(parentP);\n if (!isDir && !doesExist) throw ENOENT(reason);\n if (!isDir) throw ENOTDIR(reason);\n resolvedP = ppath.resolve(parentP, ppath.basename(resolvedP));\n if (!resolveLastComponent) break;\n const index = sources.name.locate(this.zip, resolvedP);\n if (index === -1) break;\n\n if (this.isSymbolicLink(index)) {\n const target = this.getFileSource(index).toString();\n resolvedP = ppath.resolve(ppath.dirname(resolvedP), target);\n } else {\n break;\n }\n }\n\n return resolvedP;\n }\n\n allocateBuffer(content) {\n if (!Buffer.isBuffer(content)) content = Buffer.from(content);\n const buffer = sources.malloc(content.byteLength);\n if (!buffer) throw new Error(`Couldn't allocate enough memory`); // Copy the file into the Emscripten heap\n\n const heap = new Uint8Array(sources.HEAPU8.buffer, buffer, content.byteLength);\n heap.set(content);\n return {\n buffer,\n byteLength: content.byteLength\n };\n }\n\n allocateUnattachedSource(content) {\n const error = sources.struct.errorS();\n const {\n buffer,\n byteLength\n } = this.allocateBuffer(content);\n const source = sources.source.fromUnattachedBuffer(buffer, byteLength, 0, true, error);\n\n if (source === 0) {\n sources.free(error);\n throw new Error(sources.error.strerror(error));\n }\n\n return source;\n }\n\n allocateSource(content) {\n const {\n buffer,\n byteLength\n } = this.allocateBuffer(content);\n const source = sources.source.fromBuffer(this.zip, buffer, byteLength, 0, true);\n\n if (source === 0) {\n sources.free(buffer);\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n\n return source;\n }\n\n setFileSource(p, content) {\n const target = ppath.relative(PortablePath.root, p);\n const lzSource = this.allocateSource(content);\n\n try {\n return sources.file.add(this.zip, target, lzSource, sources.ZIP_FL_OVERWRITE);\n } catch (error) {\n sources.source.free(lzSource);\n throw error;\n }\n }\n\n isSymbolicLink(index) {\n const attrs = sources.file.getExternalAttributes(this.zip, index, 0, 0, sources.uint08S, sources.uint32S);\n if (attrs === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const opsys = sources.getValue(sources.uint08S, `i8`) >>> 0;\n if (opsys !== sources.ZIP_OPSYS_UNIX) return false;\n const attributes = sources.getValue(sources.uint32S, `i32`) >>> 16;\n return (attributes & S_IFMT) === S_IFLNK;\n }\n\n getFileSource(index) {\n const stat = sources.struct.statS();\n const rc = sources.statIndex(this.zip, index, 0, 0, stat);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const size = sources.struct.statSize(stat);\n const buffer = sources.malloc(size);\n\n try {\n const file = sources.fopenIndex(this.zip, index, 0, 0);\n if (file === 0) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n\n try {\n const rc = sources.fread(file, buffer, size, 0);\n if (rc === -1) throw new Error(sources.error.strerror(sources.file.getError(file)));else if (rc < size) throw new Error(`Incomplete read`);else if (rc > size) throw new Error(`Overread`);\n const memory = sources.HEAPU8.subarray(buffer, buffer + size);\n const data = Buffer.from(memory);\n return data;\n } finally {\n sources.fclose(file);\n }\n } finally {\n sources.free(buffer);\n }\n }\n\n async chmodPromise(p, mask) {\n return this.chmodSync(p, mask);\n }\n\n chmodSync(p, mask) {\n if (this.readOnly) throw EROFS(`chmod '${p}'`);\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false); // We silently ignore chmod requests for directories\n\n if (this.listings.has(resolvedP)) return;\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const oldMod = this.getUnixMode(entry, S_IFREG | 0o000);\n const newMod = oldMod & ~0o777 | mask;\n const rc = sources.file.setExternalAttributes(this.zip, entry, 0, 0, sources.ZIP_OPSYS_UNIX, newMod << 16);\n\n if (rc === -1) {\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n }\n\n async renamePromise(oldP, newP) {\n return this.renameSync(oldP, newP);\n }\n\n renameSync(oldP, newP) {\n throw new Error(`Unimplemented`);\n }\n\n async copyFilePromise(sourceP, destP, flags) {\n return this.copyFileSync(sourceP, destP, flags);\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n if (this.readOnly) throw EROFS(`copyfile '${sourceP} -> '${destP}'`);\n if ((flags & external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE) !== 0) throw ENOSYS(`unsupported clone operation`, `copyfile '${sourceP}' -> ${destP}'`);\n const resolvedSourceP = this.resolveFilename(`copyfile '${sourceP} -> ${destP}'`, sourceP);\n const indexSource = this.entries.get(resolvedSourceP);\n if (typeof indexSource === `undefined`) throw EINVAL(`copyfile '${sourceP}' -> '${destP}'`);\n const resolvedDestP = this.resolveFilename(`copyfile '${sourceP}' -> ${destP}'`, destP);\n const indexDest = this.entries.get(resolvedDestP);\n if ((flags & (external_fs_[\"constants\"].COPYFILE_EXCL | external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE)) !== 0 && typeof indexDest !== `undefined`) throw EEXIST(`copyfile '${sourceP}' -> '${destP}'`);\n const source = this.getFileSource(indexSource);\n const newIndex = this.setFileSource(resolvedDestP, source);\n\n if (newIndex !== indexDest) {\n this.registerEntry(resolvedDestP, newIndex);\n }\n }\n\n async appendFilePromise(p, content, opts) {\n return this.appendFileSync(p, content, opts);\n }\n\n appendFileSync(p, content, opts = {}) {\n if (this.readOnly) throw EROFS(`open '${p}'`);\n if (typeof opts === `undefined`) opts = {\n flag: `a`\n };else if (typeof opts === `string`) opts = {\n flag: `a`,\n encoding: opts\n };else if (typeof opts.flag === `undefined`) opts = Object.assign({\n flag: `a`\n }, opts);\n return this.writeFileSync(p, content, opts);\n }\n\n async writeFilePromise(p, content, opts) {\n return this.writeFileSync(p, content, opts);\n }\n\n writeFileSync(p, content, opts) {\n if (typeof p !== `string`) throw EBADF(`read`);\n if (this.readOnly) throw EROFS(`open '${p}'`);\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (this.listings.has(resolvedP)) throw EISDIR(`open '${p}'`);\n const index = this.entries.get(resolvedP);\n if (index !== undefined && typeof opts === `object` && opts.flag && opts.flag.includes(`a`)) content = Buffer.concat([this.getFileSource(index), Buffer.from(content)]);\n let encoding = null;\n if (typeof opts === `string`) encoding = opts;else if (typeof opts === `object` && opts.encoding) encoding = opts.encoding;\n if (encoding !== null) content = content.toString(encoding);\n const newIndex = this.setFileSource(resolvedP, content);\n\n if (newIndex !== index) {\n this.registerEntry(resolvedP, newIndex);\n }\n }\n\n async unlinkPromise(p) {\n return this.unlinkSync(p);\n }\n\n unlinkSync(p) {\n throw new Error(`Unimplemented`);\n }\n\n async utimesPromise(p, atime, mtime) {\n return this.utimesSync(p, atime, mtime);\n }\n\n utimesSync(p, atime, mtime) {\n if (this.readOnly) throw EROFS(`utimes '${p}'`);\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p);\n return this.utimesImpl(resolvedP, mtime);\n }\n\n async lutimesPromise(p, atime, mtime) {\n return this.lutimesSync(p, atime, mtime);\n }\n\n lutimesSync(p, atime, mtime) {\n if (this.readOnly) throw EROFS(`lutimes '${p}'`);\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n return this.utimesImpl(resolvedP, mtime);\n }\n\n utimesImpl(resolvedP, mtime) {\n if (this.listings.has(resolvedP)) if (!this.entries.has(resolvedP)) this.hydrateDirectory(resolvedP);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const rc = sources.file.setMtime(this.zip, entry, 0, toUnixTimestamp(mtime), 0);\n\n if (rc === -1) {\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n }\n\n async mkdirPromise(p, opts) {\n return this.mkdirSync(p, opts);\n }\n\n mkdirSync(p, opts) {\n if (opts && opts.recursive) return this.mkdirpSync(p, {\n chmod: opts.mode\n });\n if (this.readOnly) throw EROFS(`mkdir '${p}'`);\n const resolvedP = this.resolveFilename(`mkdir '${p}'`, p);\n if (this.entries.has(resolvedP) || this.listings.has(resolvedP)) throw EEXIST(`mkdir '${p}'`);\n this.hydrateDirectory(resolvedP);\n }\n\n async rmdirPromise(p) {\n return this.rmdirSync(p);\n }\n\n rmdirSync(p) {\n throw new Error(`Unimplemented`);\n }\n\n hydrateDirectory(resolvedP) {\n const index = sources.dir.add(this.zip, ppath.relative(PortablePath.root, resolvedP));\n if (index === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n this.registerListing(resolvedP);\n this.registerEntry(resolvedP, index);\n return index;\n }\n\n async symlinkPromise(target, p) {\n return this.symlinkSync(target, p);\n }\n\n symlinkSync(target, p) {\n if (this.readOnly) throw EROFS(`symlink '${target}' -> '${p}'`);\n const resolvedP = this.resolveFilename(`symlink '${target}' -> '${p}'`, p);\n if (this.listings.has(resolvedP)) throw EISDIR(`symlink '${target}' -> '${p}'`);\n if (this.entries.has(resolvedP)) throw EEXIST(`symlink '${target}' -> '${p}'`);\n const index = this.setFileSource(resolvedP, target);\n this.registerEntry(resolvedP, index);\n const rc = sources.file.setExternalAttributes(this.zip, index, 0, 0, sources.ZIP_OPSYS_UNIX, (0o120000 | 0o777) << 16);\n\n if (rc === -1) {\n throw new Error(sources.error.strerror(sources.getError(this.zip)));\n }\n }\n\n async readFilePromise(p, encoding) {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.readFileSync(p, encoding);\n\n default:\n return this.readFileSync(p, encoding);\n }\n }\n\n readFileSync(p, encoding) {\n if (typeof p !== `string`) throw EBADF(`read`); // This is messed up regarding the TS signatures\n\n if (typeof encoding === `object`) // @ts-ignore\n encoding = encoding ? encoding.encoding : undefined;\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`open '${p}'`); // Ensures that the last component is a directory, if the user said so (even if it is we'll throw right after with EISDIR anyway)\n\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`open '${p}'`);\n if (this.listings.has(resolvedP)) throw EISDIR(`read`);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const data = this.getFileSource(entry);\n return encoding ? data.toString(encoding) : data;\n }\n\n async readdirPromise(p) {\n return this.readdirSync(p);\n }\n\n readdirSync(p) {\n const resolvedP = this.resolveFilename(`scandir '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`scandir '${p}'`);\n const directoryListing = this.listings.get(resolvedP);\n if (!directoryListing) throw ENOTDIR(`scandir '${p}'`);\n return Array.from(directoryListing);\n }\n\n async readlinkPromise(p) {\n return this.readlinkSync(p);\n }\n\n readlinkSync(p) {\n const resolvedP = this.resolveFilename(`readlink '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) throw ENOENT(`readlink '${p}'`); // Ensure that the last component is a directory (if it is we'll throw right after with EISDIR anyway)\n\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP)) throw ENOTDIR(`open '${p}'`);\n if (this.listings.has(resolvedP)) throw EINVAL(`readlink '${p}'`);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined) throw new Error(`Unreachable`);\n const rc = sources.file.getExternalAttributes(this.zip, entry, 0, 0, sources.uint08S, sources.uint32S);\n if (rc === -1) throw new Error(sources.error.strerror(sources.getError(this.zip)));\n const opsys = sources.getValue(sources.uint08S, `i8`) >>> 0;\n if (opsys !== sources.ZIP_OPSYS_UNIX) throw EINVAL(`readlink '${p}'`);\n const attributes = sources.getValue(sources.uint32S, `i32`) >>> 16;\n if ((attributes & 0o170000) !== 0o120000) throw EINVAL(`readlink '${p}'`);\n return this.getFileSource(entry).toString();\n }\n\n watch(p, a, b) {\n let persistent;\n\n switch (typeof a) {\n case `function`:\n case `string`:\n case `undefined`:\n {\n persistent = true;\n }\n break;\n\n default:\n {\n // @ts-ignore\n ({\n persistent = true\n } = a);\n }\n break;\n }\n\n if (!persistent) return {\n on: () => {},\n close: () => {}\n };\n const interval = setInterval(() => {}, 24 * 60 * 60 * 1000);\n return {\n on: () => {},\n close: () => {\n clearInterval(interval);\n }\n };\n }\n\n}\n;\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/ZipOpenFS.ts\n\n\n\n\n\nconst ZIP_FD = 0x80000000;\nclass ZipOpenFS_ZipOpenFS extends FakeFS_BasePortableFakeFS {\n constructor({\n baseFs = new NodeFS_NodeFS(),\n filter = null,\n readOnlyArchives = false,\n useCache = true\n } = {}) {\n super();\n this.fdMap = new Map();\n this.nextFd = 3;\n this.isZip = new Set();\n this.notZip = new Set();\n this.baseFs = baseFs;\n this.zipInstances = useCache ? new Map() : null;\n this.filter = filter;\n this.readOnlyArchives = readOnlyArchives;\n this.isZip = new Set();\n this.notZip = new Set();\n }\n\n static open(fn) {\n const zipOpenFs = new ZipOpenFS_ZipOpenFS();\n\n try {\n return fn(zipOpenFs);\n } finally {\n zipOpenFs.saveAndClose();\n }\n }\n\n static async openPromise(fn) {\n const zipOpenFs = new ZipOpenFS_ZipOpenFS();\n\n try {\n return await fn(zipOpenFs);\n } finally {\n zipOpenFs.saveAndClose();\n }\n }\n\n getRealPath() {\n return this.baseFs.getRealPath();\n }\n\n saveAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.saveAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n\n discardAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.discardAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n\n remapFd(zipFs, fd) {\n const remappedFd = this.nextFd++ | ZIP_FD;\n this.fdMap.set(remappedFd, [zipFs, fd]);\n return remappedFd;\n }\n\n async openPromise(p, flags, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.openPromise(p, flags, mode);\n }, async (zipFs, {\n subPath\n }) => {\n return this.remapFd(zipFs, (await zipFs.openPromise(subPath, flags, mode)));\n });\n }\n\n openSync(p, flags, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.openSync(p, flags, mode);\n }, (zipFs, {\n subPath\n }) => {\n return this.remapFd(zipFs, zipFs.openSync(subPath, flags, mode));\n });\n }\n\n async readPromise(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) return await this.baseFs.readPromise(fd, buffer, offset, length, position);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n return await zipFs.readPromise(realFd, buffer, offset, length, position);\n }\n\n readSync(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) return this.baseFs.readSync(fd, buffer, offset, length, position);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, read`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n return zipFs.readSync(realFd, buffer, offset, length, position);\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) {\n if (typeof buffer === `string`) {\n return await this.baseFs.writePromise(fd, buffer, offset);\n } else {\n return await this.baseFs.writePromise(fd, buffer, offset, length, position);\n }\n }\n\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, write`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n\n if (typeof buffer === `string`) {\n return await zipFs.writePromise(realFd, buffer, offset);\n } else {\n return await zipFs.writePromise(realFd, buffer, offset, length, position);\n }\n }\n\n writeSync(fd, buffer, offset, length, position) {\n if ((fd & ZIP_FD) === 0) {\n if (typeof buffer === `string`) {\n return this.baseFs.writeSync(fd, buffer, offset);\n } else {\n return this.baseFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, write`), {\n code: `EBADF`\n });\n const [zipFs, realFd] = entry;\n\n if (typeof buffer === `string`) {\n return zipFs.writeSync(realFd, buffer, offset);\n } else {\n return zipFs.writeSync(realFd, buffer, offset, length, position);\n }\n }\n\n async closePromise(fd) {\n if ((fd & ZIP_FD) === 0) return await this.baseFs.closePromise(fd);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, close`), {\n code: `EBADF`\n });\n this.fdMap.delete(fd);\n const [zipFs, realFd] = entry;\n return await zipFs.closePromise(realFd);\n }\n\n closeSync(fd) {\n if ((fd & ZIP_FD) === 0) return this.baseFs.closeSync(fd);\n const entry = this.fdMap.get(fd);\n if (typeof entry === `undefined`) throw Object.assign(new Error(`EBADF: bad file descriptor, close`), {\n code: `EBADF`\n });\n this.fdMap.delete(fd);\n const [zipFs, realFd] = entry;\n return zipFs.closeSync(realFd);\n }\n\n createReadStream(p, opts) {\n if (p === null) return this.baseFs.createReadStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createReadStream(p, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.createReadStream(subPath, opts);\n });\n }\n\n createWriteStream(p, opts) {\n if (p === null) return this.baseFs.createWriteStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createWriteStream(p, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.createWriteStream(subPath, opts);\n });\n }\n\n async realpathPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.realpathPromise(p);\n }, async (zipFs, {\n archivePath,\n subPath\n }) => {\n return this.pathUtils.resolve((await this.baseFs.realpathPromise(archivePath)), this.pathUtils.relative(PortablePath.root, (await zipFs.realpathPromise(subPath))));\n });\n }\n\n realpathSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.realpathSync(p);\n }, (zipFs, {\n archivePath,\n subPath\n }) => {\n return this.pathUtils.resolve(this.baseFs.realpathSync(archivePath), this.pathUtils.relative(PortablePath.root, zipFs.realpathSync(subPath)));\n });\n }\n\n async existsPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.existsPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.existsPromise(subPath);\n });\n }\n\n existsSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.existsSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.existsSync(subPath);\n });\n }\n\n async accessPromise(p, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.accessPromise(p, mode);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.accessPromise(subPath, mode);\n });\n }\n\n accessSync(p, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.accessSync(p, mode);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.accessSync(subPath, mode);\n });\n }\n\n async statPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.statPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.statPromise(subPath);\n });\n }\n\n statSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.statSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.statSync(subPath);\n });\n }\n\n async lstatPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.lstatPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.lstatPromise(subPath);\n });\n }\n\n lstatSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.lstatSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.lstatSync(subPath);\n });\n }\n\n async chmodPromise(p, mask) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.chmodPromise(p, mask);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.chmodPromise(subPath, mask);\n });\n }\n\n chmodSync(p, mask) {\n return this.makeCallSync(p, () => {\n return this.baseFs.chmodSync(p, mask);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.chmodSync(subPath, mask);\n });\n }\n\n async renamePromise(oldP, newP) {\n return await this.makeCallPromise(oldP, async () => {\n return await this.makeCallPromise(newP, async () => {\n return await this.baseFs.renamePromise(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n });\n }, async (zipFsO, {\n subPath: subPathO\n }) => {\n return await this.makeCallPromise(newP, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n }, async (zipFsN, {\n subPath: subPathN\n }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n } else {\n return await zipFsO.renamePromise(subPathO, subPathN);\n }\n });\n });\n }\n\n renameSync(oldP, newP) {\n return this.makeCallSync(oldP, () => {\n return this.makeCallSync(newP, () => {\n return this.baseFs.renameSync(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n });\n }, (zipFsO, {\n subPath: subPathO\n }) => {\n return this.makeCallSync(newP, () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n }, (zipFsN, {\n subPath: subPathN\n }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), {\n code: `EEXDEV`\n });\n } else {\n return zipFsO.renameSync(subPathO, subPathN);\n }\n });\n });\n }\n\n async copyFilePromise(sourceP, destP, flags = 0) {\n const fallback = async (sourceFs, sourceP, destFs, destP) => {\n if ((flags & external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE) !== 0) throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), {\n code: `EXDEV`\n });\n if (flags & external_fs_[\"constants\"].COPYFILE_EXCL && (await this.existsPromise(sourceP))) throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EEXIST`\n });\n let content;\n\n try {\n content = await sourceFs.readFilePromise(sourceP);\n } catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EINVAL`\n });\n }\n\n await destFs.writeFilePromise(destP, content);\n };\n\n return await this.makeCallPromise(sourceP, async () => {\n return await this.makeCallPromise(destP, async () => {\n return await this.baseFs.copyFilePromise(sourceP, destP, flags);\n }, async (zipFsD, {\n subPath: subPathD\n }) => {\n return await fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, async (zipFsS, {\n subPath: subPathS\n }) => {\n return await this.makeCallPromise(destP, async () => {\n return await fallback(zipFsS, subPathS, this.baseFs, destP);\n }, async (zipFsD, {\n subPath: subPathD\n }) => {\n if (zipFsS !== zipFsD) {\n return await fallback(zipFsS, subPathS, zipFsD, subPathD);\n } else {\n return await zipFsS.copyFilePromise(subPathS, subPathD, flags);\n }\n });\n });\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n const fallback = (sourceFs, sourceP, destFs, destP) => {\n if ((flags & external_fs_[\"constants\"].COPYFILE_FICLONE_FORCE) !== 0) throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), {\n code: `EXDEV`\n });\n if (flags & external_fs_[\"constants\"].COPYFILE_EXCL && this.existsSync(sourceP)) throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EEXIST`\n });\n let content;\n\n try {\n content = sourceFs.readFileSync(sourceP);\n } catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), {\n code: `EINVAL`\n });\n }\n\n destFs.writeFileSync(destP, content);\n };\n\n return this.makeCallSync(sourceP, () => {\n return this.makeCallSync(destP, () => {\n return this.baseFs.copyFileSync(sourceP, destP, flags);\n }, (zipFsD, {\n subPath: subPathD\n }) => {\n return fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, (zipFsS, {\n subPath: subPathS\n }) => {\n return this.makeCallSync(destP, () => {\n return fallback(zipFsS, subPathS, this.baseFs, destP);\n }, (zipFsD, {\n subPath: subPathD\n }) => {\n if (zipFsS !== zipFsD) {\n return fallback(zipFsS, subPathS, zipFsD, subPathD);\n } else {\n return zipFsS.copyFileSync(subPathS, subPathD, flags);\n }\n });\n });\n }\n\n async appendFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.appendFilePromise(p, content, opts);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.appendFilePromise(subPath, content, opts);\n });\n }\n\n appendFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.appendFileSync(p, content, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.appendFileSync(subPath, content, opts);\n });\n }\n\n async writeFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.writeFilePromise(p, content, opts);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.writeFilePromise(subPath, content, opts);\n });\n }\n\n writeFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.writeFileSync(p, content, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.writeFileSync(subPath, content, opts);\n });\n }\n\n async unlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.unlinkPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.unlinkPromise(subPath);\n });\n }\n\n unlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.unlinkSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.unlinkSync(subPath);\n });\n }\n\n async utimesPromise(p, atime, mtime) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.utimesPromise(p, atime, mtime);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.utimesPromise(subPath, atime, mtime);\n });\n }\n\n utimesSync(p, atime, mtime) {\n return this.makeCallSync(p, () => {\n return this.baseFs.utimesSync(p, atime, mtime);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.utimesSync(subPath, atime, mtime);\n });\n }\n\n async mkdirPromise(p, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.mkdirPromise(p, opts);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.mkdirPromise(subPath, opts);\n });\n }\n\n mkdirSync(p, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.mkdirSync(p, opts);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.mkdirSync(subPath, opts);\n });\n }\n\n async rmdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.rmdirPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.rmdirPromise(subPath);\n });\n }\n\n rmdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.rmdirSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.rmdirSync(subPath);\n });\n }\n\n async symlinkPromise(target, p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.symlinkPromise(target, p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.symlinkPromise(target, subPath);\n });\n }\n\n symlinkSync(target, p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.symlinkSync(target, p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.symlinkSync(target, subPath);\n });\n }\n\n async readFilePromise(p, encoding) {\n return this.makeCallPromise(p, async () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return await this.baseFs.readFilePromise(p, encoding);\n\n default:\n return await this.baseFs.readFilePromise(p, encoding);\n }\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.readFilePromise(subPath, encoding);\n });\n }\n\n readFileSync(p, encoding) {\n return this.makeCallSync(p, () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.baseFs.readFileSync(p, encoding);\n\n default:\n return this.baseFs.readFileSync(p, encoding);\n }\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.readFileSync(subPath, encoding);\n });\n }\n\n async readdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readdirPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.readdirPromise(subPath);\n }, {\n requireSubpath: false\n });\n }\n\n readdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readdirSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.readdirSync(subPath);\n }, {\n requireSubpath: false\n });\n }\n\n async readlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readlinkPromise(p);\n }, async (zipFs, {\n subPath\n }) => {\n return await zipFs.readlinkPromise(subPath);\n });\n }\n\n readlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readlinkSync(p);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.readlinkSync(subPath);\n });\n }\n\n watch(p, a, b) {\n return this.makeCallSync(p, () => {\n return this.baseFs.watch(p, // @ts-ignore\n a, b);\n }, (zipFs, {\n subPath\n }) => {\n return zipFs.watch(subPath, // @ts-ignore\n a, b);\n });\n }\n\n async makeCallPromise(p, discard, accept, {\n requireSubpath = true\n } = {}) {\n if (typeof p !== `string`) return await discard();\n const normalizedP = this.pathUtils.normalize(this.pathUtils.resolve(PortablePath.root, p));\n const zipInfo = this.findZip(normalizedP);\n if (!zipInfo) return await discard();\n if (requireSubpath && zipInfo.subPath === `/`) return await discard();\n return await this.getZipPromise(zipInfo.archivePath, async zipFs => await accept(zipFs, zipInfo));\n }\n\n makeCallSync(p, discard, accept, {\n requireSubpath = true\n } = {}) {\n if (typeof p !== `string`) return discard();\n const normalizedP = this.pathUtils.normalize(this.pathUtils.resolve(PortablePath.root, p));\n const zipInfo = this.findZip(normalizedP);\n if (!zipInfo) return discard();\n if (requireSubpath && zipInfo.subPath === `/`) return discard();\n return this.getZipSync(zipInfo.archivePath, zipFs => accept(zipFs, zipInfo));\n }\n\n findZip(p) {\n if (this.filter && !this.filter.test(p)) return null;\n const parts = p.split(/\\//g);\n\n for (let t = 2; t <= parts.length; ++t) {\n const archivePath = parts.slice(0, t).join(`/`);\n if (this.notZip.has(archivePath)) continue;\n if (this.isZip.has(archivePath)) return {\n archivePath,\n subPath: this.pathUtils.resolve(PortablePath.root, parts.slice(t).join(`/`))\n };\n let realArchivePath = archivePath;\n let stat;\n\n while (true) {\n try {\n stat = this.baseFs.lstatSync(realArchivePath);\n } catch (error) {\n return null;\n }\n\n if (stat.isSymbolicLink()) {\n realArchivePath = this.pathUtils.resolve(this.pathUtils.dirname(realArchivePath), this.baseFs.readlinkSync(realArchivePath));\n } else {\n break;\n }\n }\n\n const isZip = stat.isFile() && this.pathUtils.extname(realArchivePath) === `.zip`;\n\n if (isZip) {\n this.isZip.add(archivePath);\n return {\n archivePath,\n subPath: this.pathUtils.resolve(PortablePath.root, parts.slice(t).join(`/`))\n };\n } else {\n this.notZip.add(archivePath);\n\n if (stat.isFile()) {\n return null;\n }\n }\n }\n\n return null;\n }\n\n async getZipPromise(p, accept) {\n const getZipOptions = async () => ({\n baseFs: this.baseFs,\n readOnly: this.readOnlyArchives,\n stats: await this.baseFs.statPromise(p)\n });\n\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs) this.zipInstances.set(p, zipFs = new ZipFS_ZipFS(p, (await getZipOptions())));\n return await accept(zipFs);\n } else {\n const zipFs = new ZipFS_ZipFS(p, (await getZipOptions()));\n\n try {\n return await accept(zipFs);\n } finally {\n zipFs.saveAndClose();\n }\n }\n }\n\n getZipSync(p, accept) {\n const getZipOptions = () => ({\n baseFs: this.baseFs,\n readOnly: this.readOnlyArchives,\n stats: this.baseFs.statSync(p)\n });\n\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs) this.zipInstances.set(p, zipFs = new ZipFS_ZipFS(p, getZipOptions()));\n return accept(zipFs);\n } else {\n const zipFs = new ZipFS_ZipFS(p, getZipOptions());\n\n try {\n return accept(zipFs);\n } finally {\n zipFs.saveAndClose();\n }\n }\n }\n\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/ProxiedFS.ts\n\nclass ProxiedFS_ProxiedFS extends FakeFS_FakeFS {\n resolve(path) {\n return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));\n }\n\n getRealPath() {\n return this.mapFromBase(this.baseFs.getRealPath());\n }\n\n openPromise(p, flags, mode) {\n return this.baseFs.openPromise(this.mapToBase(p), flags, mode);\n }\n\n openSync(p, flags, mode) {\n return this.baseFs.openSync(this.mapToBase(p), flags, mode);\n }\n\n async readPromise(fd, buffer, offset, length, position) {\n return await this.baseFs.readPromise(fd, buffer, offset, length, position);\n }\n\n readSync(fd, buffer, offset, length, position) {\n return this.baseFs.readSync(fd, buffer, offset, length, position);\n }\n\n async writePromise(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return await this.baseFs.writePromise(fd, buffer, offset);\n } else {\n return await this.baseFs.writePromise(fd, buffer, offset, length, position);\n }\n }\n\n writeSync(fd, buffer, offset, length, position) {\n if (typeof buffer === `string`) {\n return this.baseFs.writeSync(fd, buffer, offset);\n } else {\n return this.baseFs.writeSync(fd, buffer, offset, length, position);\n }\n }\n\n closePromise(fd) {\n return this.baseFs.closePromise(fd);\n }\n\n closeSync(fd) {\n this.baseFs.closeSync(fd);\n }\n\n createReadStream(p, opts) {\n return this.baseFs.createReadStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n\n createWriteStream(p, opts) {\n return this.baseFs.createWriteStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n\n async realpathPromise(p) {\n return this.mapFromBase((await this.baseFs.realpathPromise(this.mapToBase(p))));\n }\n\n realpathSync(p) {\n return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(p)));\n }\n\n existsPromise(p) {\n return this.baseFs.existsPromise(this.mapToBase(p));\n }\n\n existsSync(p) {\n return this.baseFs.existsSync(this.mapToBase(p));\n }\n\n accessSync(p, mode) {\n return this.baseFs.accessSync(this.mapToBase(p), mode);\n }\n\n accessPromise(p, mode) {\n return this.baseFs.accessPromise(this.mapToBase(p), mode);\n }\n\n statPromise(p) {\n return this.baseFs.statPromise(this.mapToBase(p));\n }\n\n statSync(p) {\n return this.baseFs.statSync(this.mapToBase(p));\n }\n\n lstatPromise(p) {\n return this.baseFs.lstatPromise(this.mapToBase(p));\n }\n\n lstatSync(p) {\n return this.baseFs.lstatSync(this.mapToBase(p));\n }\n\n chmodPromise(p, mask) {\n return this.baseFs.chmodPromise(this.mapToBase(p), mask);\n }\n\n chmodSync(p, mask) {\n return this.baseFs.chmodSync(this.mapToBase(p), mask);\n }\n\n renamePromise(oldP, newP) {\n return this.baseFs.renamePromise(this.mapToBase(oldP), this.mapToBase(newP));\n }\n\n renameSync(oldP, newP) {\n return this.baseFs.renameSync(this.mapToBase(oldP), this.mapToBase(newP));\n }\n\n copyFilePromise(sourceP, destP, flags = 0) {\n return this.baseFs.copyFilePromise(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n\n copyFileSync(sourceP, destP, flags = 0) {\n return this.baseFs.copyFileSync(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n\n appendFilePromise(p, content, opts) {\n return this.baseFs.appendFilePromise(this.fsMapToBase(p), content, opts);\n }\n\n appendFileSync(p, content, opts) {\n return this.baseFs.appendFileSync(this.fsMapToBase(p), content, opts);\n }\n\n writeFilePromise(p, content, opts) {\n return this.baseFs.writeFilePromise(this.fsMapToBase(p), content, opts);\n }\n\n writeFileSync(p, content, opts) {\n return this.baseFs.writeFileSync(this.fsMapToBase(p), content, opts);\n }\n\n unlinkPromise(p) {\n return this.baseFs.unlinkPromise(this.mapToBase(p));\n }\n\n unlinkSync(p) {\n return this.baseFs.unlinkSync(this.mapToBase(p));\n }\n\n utimesPromise(p, atime, mtime) {\n return this.baseFs.utimesPromise(this.mapToBase(p), atime, mtime);\n }\n\n utimesSync(p, atime, mtime) {\n return this.baseFs.utimesSync(this.mapToBase(p), atime, mtime);\n }\n\n mkdirPromise(p, opts) {\n return this.baseFs.mkdirPromise(this.mapToBase(p), opts);\n }\n\n mkdirSync(p, opts) {\n return this.baseFs.mkdirSync(this.mapToBase(p), opts);\n }\n\n rmdirPromise(p) {\n return this.baseFs.rmdirPromise(this.mapToBase(p));\n }\n\n rmdirSync(p) {\n return this.baseFs.rmdirSync(this.mapToBase(p));\n }\n\n symlinkPromise(target, p) {\n return this.baseFs.symlinkPromise(this.mapToBase(target), this.mapToBase(p));\n }\n\n symlinkSync(target, p) {\n return this.baseFs.symlinkSync(this.mapToBase(target), this.mapToBase(p));\n }\n\n readFilePromise(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding);\n } else {\n return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding);\n }\n }\n\n readFileSync(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFileSync(this.fsMapToBase(p), encoding);\n } else {\n return this.baseFs.readFileSync(this.fsMapToBase(p), encoding);\n }\n }\n\n readdirPromise(p) {\n return this.baseFs.readdirPromise(this.mapToBase(p));\n }\n\n readdirSync(p) {\n return this.baseFs.readdirSync(this.mapToBase(p));\n }\n\n async readlinkPromise(p) {\n return this.mapFromBase((await this.baseFs.readlinkPromise(this.mapToBase(p))));\n }\n\n readlinkSync(p) {\n return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(p)));\n }\n\n watch(p, a, b) {\n return this.baseFs.watch(this.mapToBase(p), // @ts-ignore\n a, b);\n }\n\n fsMapToBase(p) {\n if (typeof p === `number`) {\n return p;\n } else {\n return this.mapToBase(p);\n }\n }\n\n}\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/VirtualFS.ts\n\n\n // https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js\n\nconst escapeRegexp = s => s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n\nclass VirtualFS_VirtualFS extends ProxiedFS_ProxiedFS {\n constructor(virtual, {\n baseFs = new NodeFS_NodeFS()\n } = {}) {\n super(ppath);\n this.baseFs = baseFs;\n this.target = ppath.dirname(virtual);\n this.virtual = virtual;\n this.mapToBaseRegExp = new RegExp(`^(${escapeRegexp(this.virtual)})((?:/([^\\/]+)(?:/([^/]+))?)?((?:/.*)?))$`);\n }\n\n static makeVirtualPath(base, component, to) {\n // Obtains the relative distance between the virtual path and its actual target\n const target = ppath.relative(ppath.dirname(base), to);\n const segments = target.split(`/`); // Counts how many levels we need to go back to start applying the rest of the path\n\n let depth = 0;\n\n while (depth < segments.length && segments[depth] === `..`) depth += 1;\n\n const finalSegments = segments.slice(depth);\n const fullVirtualPath = ppath.join(base, component, String(depth), ...finalSegments);\n return fullVirtualPath;\n }\n\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n\n realpathSync(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match) return this.baseFs.realpathSync(p);\n if (!match[5]) return p;\n const realpath = this.baseFs.realpathSync(this.mapToBase(p));\n return VirtualFS_VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n\n async realpathPromise(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match) return await this.baseFs.realpathPromise(p);\n if (!match[5]) return p;\n const realpath = await this.baseFs.realpathPromise(this.mapToBase(p));\n return VirtualFS_VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n\n mapToBase(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match) return p;\n if (match[3]) return this.mapToBase(ppath.join(this.target, `../`.repeat(Number(match[4])), match[5]));\n return this.target;\n }\n\n mapFromBase(p) {\n return p;\n }\n\n}\n// EXTERNAL MODULE: external \"module\"\nvar external_module_ = __webpack_require__(1);\nvar external_module_default = /*#__PURE__*/__webpack_require__.n(external_module_);\n\n// EXTERNAL MODULE: external \"string_decoder\"\nvar external_string_decoder_ = __webpack_require__(7);\nvar external_string_decoder_default = /*#__PURE__*/__webpack_require__.n(external_string_decoder_);\n\n// EXTERNAL MODULE: /Users/sander/prg/js/berry/.yarn/cache/tmp-npm-0.0.33-bcbf65df2a-1.zip/node_modules/tmp/lib/tmp.js\nvar tmp = __webpack_require__(4);\nvar tmp_default = /*#__PURE__*/__webpack_require__.n(tmp);\n\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/index.ts\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction patchFs(patchedFs, fakeFs) {\n const SYNC_IMPLEMENTATIONS = new Set([`accessSync`, `appendFileSync`, `createReadStream`, `chmodSync`, `closeSync`, `copyFileSync`, `lstatSync`, `mkdirSync`, `openSync`, `readSync`, `readlinkSync`, `readFileSync`, `readdirSync`, `readlinkSync`, `realpathSync`, `renameSync`, `rmdirSync`, `statSync`, `symlinkSync`, `unlinkSync`, `utimesSync`, `watch`, `writeFileSync`, `writeSync`]);\n const ASYNC_IMPLEMENTATIONS = new Set([`accessPromise`, `appendFilePromise`, `chmodPromise`, `closePromise`, `copyFilePromise`, `lstatPromise`, `mkdirPromise`, `openPromise`, `readdirPromise`, `realpathPromise`, `readFilePromise`, `readdirPromise`, `readlinkPromise`, `renamePromise`, `rmdirPromise`, `statPromise`, `symlinkPromise`, `unlinkPromise`, `utimesPromise`, `writeFilePromise`, `writeSync`]);\n\n patchedFs.existsSync = p => {\n try {\n return fakeFs.existsSync(p);\n } catch (error) {\n return false;\n }\n };\n\n patchedFs.exists = (p, ...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => {};\n process.nextTick(() => {\n fakeFs.existsPromise(p).then(exists => {\n callback(exists);\n }, () => {\n callback(false);\n });\n });\n };\n\n patchedFs.read = (p, buffer, ...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => {};\n process.nextTick(() => {\n fakeFs.readPromise(p, buffer, ...args).then(bytesRead => {\n callback(undefined, bytesRead, buffer);\n }, error => {\n callback(error);\n });\n });\n };\n\n for (const fnName of ASYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName.replace(/Promise$/, ``);\n\n patchedFs[origName] = (...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => {};\n process.nextTick(() => {\n fakeImpl(...args).then(result => {\n callback(undefined, result);\n }, error => {\n callback(error);\n });\n });\n };\n }\n\n for (const fnName of SYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName;\n patchedFs[origName] = fakeImpl;\n }\n\n patchedFs.realpathSync.native = patchedFs.realpathSync;\n patchedFs.realpath.native = patchedFs.realpath;\n}\nfunction extendFs(realFs, fakeFs) {\n const patchedFs = Object.create(realFs);\n patchFs(patchedFs, fakeFs);\n return patchedFs;\n}\nconst xfs = Object.assign(new NodeFS_NodeFS(), {\n mktempSync(cb) {\n const {\n name,\n removeCallback\n } = tmp_default.a.dirSync({\n unsafeCleanup: true\n });\n\n if (typeof cb === `undefined`) {\n return npath.toPortablePath(name);\n } else {\n try {\n return cb(npath.toPortablePath(name));\n } finally {\n removeCallback();\n }\n }\n },\n\n mktempPromise(cb) {\n if (typeof cb === `undefined`) {\n return new Promise((resolve, reject) => {\n tmp_default.a.dir({\n unsafeCleanup: true\n }, (err, path) => {\n if (err) {\n reject(err);\n } else {\n resolve(npath.toPortablePath(path));\n }\n });\n });\n } else {\n return new Promise((resolve, reject) => {\n tmp_default.a.dir({\n unsafeCleanup: true\n }, (err, path, cleanup) => {\n if (err) {\n reject(err);\n } else {\n Promise.resolve(npath.toPortablePath(path)).then(cb).then(result => {\n cleanup();\n resolve(result);\n }, error => {\n cleanup();\n reject(error);\n });\n }\n });\n });\n }\n }\n\n});\n// CONCATENATED MODULE: ../yarnpkg-fslib/sources/PosixFS.ts\n\n\nclass PosixFS_PosixFS extends ProxiedFS_ProxiedFS {\n constructor(baseFs) {\n super(npath);\n this.baseFs = baseFs;\n }\n\n mapFromBase(path) {\n return npath.fromPortablePath(path);\n }\n\n mapToBase(path) {\n return npath.toPortablePath(path);\n }\n\n}\n// CONCATENATED MODULE: ./sources/loader/internalTools.ts\nvar ErrorCode;\n\n(function (ErrorCode) {\n ErrorCode[\"API_ERROR\"] = \"API_ERROR\";\n ErrorCode[\"BLACKLISTED\"] = \"BLACKLISTED\";\n ErrorCode[\"BUILTIN_NODE_RESOLUTION_FAILED\"] = \"BUILTIN_NODE_RESOLUTION_FAILED\";\n ErrorCode[\"MISSING_DEPENDENCY\"] = \"MISSING_DEPENDENCY\";\n ErrorCode[\"MISSING_PEER_DEPENDENCY\"] = \"MISSING_PEER_DEPENDENCY\";\n ErrorCode[\"QUALIFIED_PATH_RESOLUTION_FAILED\"] = \"QUALIFIED_PATH_RESOLUTION_FAILED\";\n ErrorCode[\"INTERNAL\"] = \"INTERNAL\";\n ErrorCode[\"UNDECLARED_DEPENDENCY\"] = \"UNDECLARED_DEPENDENCY\";\n ErrorCode[\"UNSUPPORTED\"] = \"UNSUPPORTED\";\n})(ErrorCode || (ErrorCode = {}));\n\n; // Some errors are exposed as MODULE_NOT_FOUND for compatibility with packages\n// that expect this umbrella error when the resolution fails\n\nconst MODULE_NOT_FOUND_ERRORS = new Set([ErrorCode.BLACKLISTED, ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, ErrorCode.MISSING_DEPENDENCY, ErrorCode.MISSING_PEER_DEPENDENCY, ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, ErrorCode.UNDECLARED_DEPENDENCY]);\n/**\n * Simple helper function that assign an error code to an error, so that it can more easily be caught and used\n * by third-parties.\n */\n\nfunction internalTools_makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode) ? `MODULE_NOT_FOUND` : pnpCode;\n return Object.assign(new Error(message), {\n code,\n pnpCode,\n data\n });\n}\n/**\n * Returns the module that should be used to resolve require calls. It's usually the direct parent, except if we're\n * inside an eval expression.\n */\n\nfunction getIssuerModule(parent) {\n let issuer = parent;\n\n while (issuer && (issuer.id === '[eval]' || issuer.id === '' || !issuer.filename)) issuer = issuer.parent;\n\n return issuer;\n}\n// CONCATENATED MODULE: ./sources/loader/applyPatch.ts\nvar __rest = undefined && undefined.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\nfunction applyPatch(pnpapi, opts) {\n // @ts-ignore\n const builtinModules = new Set(external_module_default.a.builtinModules || Object.keys(process.binding('natives'))); // The callback function gets called to wrap the return value of the module names matching the regexp\n\n const patchedModules = [];\n\n if (opts.compatibilityMode !== false) {\n // Modern versions of `resolve` support a specific entry point that custom resolvers can use\n // to inject a specific resolution logic without having to patch the whole package.\n //\n // Cf: https://github.com/browserify/resolve/pull/174\n patchedModules.push([/^\\.\\/normalize-options\\.js$/, (issuer, normalizeOptions) => {\n if (!issuer || issuer.name !== 'resolve') return normalizeOptions;\n return (request, opts) => {\n opts = opts || {};\n if (opts.forceNodeResolution) return opts;\n opts.preserveSymlinks = true;\n\n opts.paths = function (request, basedir, getNodeModulesDir, opts) {\n // Extract the name of the package being requested (1=full name, 2=scope name, 3=local name)\n const parts = request.match(/^((?:(@[^\\/]+)\\/)?([^\\/]+))/);\n if (!parts) throw new Error(`Assertion failed: Expected the \"resolve\" package to call the \"paths\" callback with package names only (got \"${request}\")`); // make sure that basedir ends with a slash\n\n if (basedir.charAt(basedir.length - 1) !== '/') basedir = external_path_default.a.join(basedir, '/'); // TODO Handle portable paths\n // This is guaranteed to return the path to the \"package.json\" file from the given package\n\n const manifestPath = pnpapi.resolveToUnqualified(`${parts[1]}/package.json`, basedir, {\n considerBuiltins: false\n });\n if (manifestPath === null) throw new Error(`Assertion failed: The resolution thinks that \"${parts[1]}\" is a Node builtin`); // The first dirname strips the package.json, the second strips the local named folder\n\n let nodeModules = external_path_default.a.dirname(external_path_default.a.dirname(manifestPath)); // Strips the scope named folder if needed\n\n if (parts[2]) nodeModules = external_path_default.a.dirname(nodeModules);\n return [nodeModules];\n };\n\n return opts;\n };\n }]);\n }\n /**\n * Used to disable the resolution hooks (for when we want to fallback to the previous resolution - we then need\n * a way to \"reset\" the environment temporarily)\n */\n\n\n let enableNativeHooks = true; // @ts-ignore\n\n process.versions.pnp = String(pnpapi.VERSIONS.std); // A small note: we don't replace the cache here (and instead use the native one). This is an effort to not\n // break code similar to \"delete require.cache[require.resolve(FOO)]\", where FOO is a package located outside\n // of the Yarn dependency tree. In this case, we defer the load to the native loader. If we were to replace the\n // cache by our own, the native loader would populate its own cache, which wouldn't be exposed anymore, so the\n // delete call would be broken.\n\n const originalModuleLoad = external_module_default.a._load;\n\n external_module_default.a._load = function (request, parent, isMain) {\n if (!enableNativeHooks) return originalModuleLoad.call(external_module_default.a, request, parent, isMain); // Builtins are managed by the regular Node loader\n\n if (builtinModules.has(request)) {\n try {\n enableNativeHooks = false;\n return originalModuleLoad.call(external_module_default.a, request, parent, isMain);\n } finally {\n enableNativeHooks = true;\n }\n } // The 'pnpapi' name is reserved to return the PnP api currently in use by the program\n\n\n if (request === `pnpapi`) return pnpapi; // Request `Module._resolveFilename` (ie. `resolveRequest`) to tell us which file we should load\n\n const modulePath = external_module_default.a._resolveFilename(request, parent, isMain); // Check if the module has already been created for the given file\n\n\n const cacheEntry = external_module_default.a._cache[modulePath];\n if (cacheEntry) return cacheEntry.exports; // Create a new module and store it into the cache\n // @ts-ignore\n\n const module = new external_module_default.a(modulePath, parent);\n external_module_default.a._cache[modulePath] = module; // The main module is exposed as global variable\n\n if (isMain) {\n // @ts-ignore\n process.mainModule = module;\n module.id = '.';\n } // Try to load the module, and remove it from the cache if it fails\n\n\n let hasThrown = true;\n\n try {\n module.load(modulePath);\n hasThrown = false;\n } finally {\n if (hasThrown) {\n delete external_module_default.a._cache[modulePath];\n }\n } // Some modules might have to be patched for compatibility purposes\n\n\n for (const [filter, patchFn] of patchedModules) {\n if (filter.test(request)) {\n const issuer = parent && parent.filename ? pnpapi.findPackageLocator(parent.filename) : null;\n module.exports = patchFn(issuer, module.exports);\n }\n }\n\n return module.exports;\n };\n\n const originalModuleResolveFilename = external_module_default.a._resolveFilename;\n\n external_module_default.a._resolveFilename = function (request, parent, isMain, options) {\n if (request === `pnpapi`) return pnpapi.resolveToUnqualified(`pnpapi`, null);\n if (!enableNativeHooks) return originalModuleResolveFilename.call(external_module_default.a, request, parent, isMain, options);\n\n if (options && options.plugnplay === false) {\n const {\n plugnplay\n } = options,\n rest = __rest(options, [\"plugnplay\"]); // Workaround a bug present in some version of Node (now fixed)\n // https://github.com/nodejs/node/pull/28078\n\n\n const forwardedOptions = Object.keys(rest).length > 0 ? rest : undefined;\n\n try {\n enableNativeHooks = false;\n return originalModuleResolveFilename.call(external_module_default.a, request, parent, isMain, forwardedOptions);\n } finally {\n enableNativeHooks = true;\n }\n }\n\n let issuers;\n\n if (options) {\n const optionNames = new Set(Object.keys(options));\n optionNames.delete(`paths`);\n optionNames.delete(`plugnplay`);\n\n if (optionNames.size > 0) {\n throw internalTools_makeError(ErrorCode.UNSUPPORTED, `Some options passed to require() aren't supported by PnP yet (${Array.from(optionNames).join(', ')})`);\n }\n\n if (options.paths) {\n issuers = options.paths.map(entry => {\n return `${external_path_default.a.normalize(entry)}/`;\n });\n }\n }\n\n if (!issuers) {\n const issuerModule = getIssuerModule(parent);\n const issuer = issuerModule ? issuerModule.filename : `${npath.toPortablePath(process.cwd())}/`;\n issuers = [issuer];\n } // When Node is called, it tries to require the main script but can't\n // because PnP already patched 'Module'\n // We test it for an absolute Windows path and convert it to a portable path.\n // We should probably always call toPortablePath and check for this directly\n\n\n if (/^[A-Z]:.*/.test(request)) request = npath.toPortablePath(request);\n let firstError;\n\n for (const issuer of issuers) {\n let resolution;\n\n try {\n resolution = pnpapi.resolveRequest(request, issuer);\n } catch (error) {\n firstError = firstError || error;\n continue;\n }\n\n return resolution !== null ? resolution : request;\n }\n\n throw firstError;\n };\n\n const originalFindPath = external_module_default.a._findPath;\n\n external_module_default.a._findPath = function (request, paths, isMain) {\n if (request === `pnpapi`) return false;\n if (!enableNativeHooks) return originalFindPath.call(external_module_default.a, request, paths, isMain);\n\n for (const path of paths || []) {\n let resolution;\n\n try {\n // TODO Convert path to portable path?\n resolution = pnpapi.resolveRequest(request, path);\n } catch (error) {\n continue;\n }\n\n if (resolution) {\n return resolution;\n }\n }\n\n return false;\n };\n\n patchFs(external_fs_default.a, new PosixFS_PosixFS(opts.fakeFs));\n}\n;\n// CONCATENATED MODULE: ./sources/loader/hydrateRuntimeState.ts\n\nfunction hydrateRuntimeState(data, {\n basePath\n}) {\n const portablePath = npath.toPortablePath(basePath);\n const ignorePattern = data.ignorePatternData !== null ? new RegExp(data.ignorePatternData) : null;\n const packageRegistry = new Map(data.packageRegistryData.map(([packageName, packageStoreData]) => {\n return [packageName, new Map(packageStoreData.map(([packageReference, packageInformationData]) => {\n return [packageReference, {\n packageLocation: ppath.resolve(portablePath, packageInformationData.packageLocation),\n packageDependencies: new Map(packageInformationData.packageDependencies),\n linkType: packageInformationData.linkType\n }];\n }))];\n }));\n const packageLocatorsByLocations = new Map();\n\n for (const [packageName, storeData] of data.packageRegistryData) {\n for (const [packageReference, packageInformationData] of storeData) {\n if (packageName === null !== (packageReference === null)) throw new Error(`Assertion failed: The name and reference should be null, or neither should`); // @ts-ignore: TypeScript isn't smart enough to understand the type assertion\n\n const packageLocator = {\n name: packageName,\n reference: packageReference\n };\n packageLocatorsByLocations.set(packageInformationData.packageLocation, packageLocator);\n }\n }\n\n for (const location of data.locationBlacklistData) packageLocatorsByLocations.set(location, null);\n\n const fallbackExclusionList = new Map(data.fallbackExclusionList.map(([packageName, packageReferences]) => {\n return [packageName, new Set(packageReferences)];\n }));\n const virtualRoots = data.virtualRoots.map(virtualRoot => {\n return ppath.resolve(portablePath, virtualRoot);\n });\n const dependencyTreeRoots = data.dependencyTreeRoots;\n const enableTopLevelFallback = data.enableTopLevelFallback;\n const packageLocationLengths = data.locationLengthData;\n return {\n basePath: portablePath,\n dependencyTreeRoots,\n enableTopLevelFallback,\n fallbackExclusionList,\n ignorePattern,\n packageLocationLengths,\n packageLocatorsByLocations,\n packageRegistry,\n virtualRoots\n };\n}\n// CONCATENATED MODULE: ./sources/loader/makeApi.ts\n/// \n\n\n\n\nfunction makeApi(runtimeState, opts) {\n // @ts-ignore\n const builtinModules = new Set(external_module_default.a.builtinModules || Object.keys(process.binding('natives'))); // Splits a require request into its components, or return null if the request is a file path\n\n const pathRegExp = /^(?![a-zA-Z]:[\\\\\\/]|\\\\\\\\|\\.{0,2}(?:\\/|$))((?:@[^\\/]+\\/)?[^\\/]+)\\/?(.*|)$/; // Matches if the path starts with a valid path qualifier (./, ../, /)\n // eslint-disable-next-line no-unused-vars\n\n const isStrictRegExp = /^\\.{0,2}\\//; // Matches if the path must point to a directory (ie ends with /)\n\n const isDirRegExp = /\\/$/; // We only instantiate one of those so that we can use strict-equal comparisons\n\n const topLevelLocator = {\n name: null,\n reference: null\n }; // Used for compatibility purposes - cf setupCompatibilityLayer\n\n const fallbackLocators = [];\n if (runtimeState.enableTopLevelFallback === true) fallbackLocators.push(topLevelLocator);\n\n if (opts.compatibilityMode !== false) {\n // ESLint currently doesn't have any portable way for shared configs to\n // specify their own plugins that should be used (cf issue #10125). This\n // will likely get fixed at some point but it'll take time, so in the\n // meantime we'll just add additional fallback entries for common shared\n // configs.\n // Similarly, Gatsby generates files within the `public` folder located\n // within the project, but doesn't pre-resolve the `require` calls to use\n // its own dependencies. Meaning that when PnP see a file from the `public`\n // folder making a require, it thinks that your project forgot to list one\n // of your dependencies.\n for (const name of [`react-scripts`, `gatsby`]) {\n const packageStore = runtimeState.packageRegistry.get(name);\n\n if (packageStore) {\n for (const reference of packageStore.keys()) {\n if (reference === null) {\n throw new Error(`Assertion failed: This reference shouldn't be null`);\n } else {\n fallbackLocators.push({\n name,\n reference\n });\n }\n }\n }\n }\n }\n /**\n * The setup code will be injected here. The tables listed below are guaranteed to be filled after the call to\n * the $$DYNAMICALLY_GENERATED_CODE function.\n */\n\n\n const {\n ignorePattern,\n packageRegistry,\n packageLocatorsByLocations,\n packageLocationLengths\n } = runtimeState;\n /**\n * Allows to print useful logs just be setting a value in the environment\n */\n\n function makeLogEntry(name, args) {\n return {\n fn: name,\n args: args,\n error: null,\n result: null\n };\n }\n\n function maybeLog(name, fn) {\n if (opts.allowDebug === false) return fn;\n const level = Number(process.env.PNP_DEBUG_LEVEL);\n\n if (Number.isFinite(level)) {\n if (level >= 2) {\n return (...args) => {\n const logEntry = makeLogEntry(name, args);\n\n try {\n return logEntry.result = fn(...args);\n } catch (error) {\n throw logEntry.error = error;\n } finally {\n console.error(logEntry);\n }\n };\n } else if (level >= 1) {\n return (...args) => {\n try {\n return fn(...args);\n } catch (error) {\n const logEntry = makeLogEntry(name, args);\n logEntry.error = error;\n console.error(logEntry);\n throw error;\n }\n };\n }\n }\n\n return fn;\n }\n /**\n * Returns information about a package in a safe way (will throw if they cannot be retrieved)\n */\n\n\n function getPackageInformationSafe(packageLocator) {\n const packageInformation = getPackageInformation(packageLocator);\n\n if (!packageInformation) {\n throw internalTools_makeError(ErrorCode.INTERNAL, `Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)`);\n }\n\n return packageInformation;\n }\n /**\n * Returns whether the specified locator is a dependency tree root (in which case it's part of the project) or not\n */\n\n\n function isDependencyTreeRoot(packageLocator) {\n if (packageLocator.name === null) return true;\n\n for (const dependencyTreeRoot of runtimeState.dependencyTreeRoots) if (dependencyTreeRoot.name === packageLocator.name && dependencyTreeRoot.reference === packageLocator.reference) return true;\n\n return false;\n }\n /**\n * Implements the node resolution for folder access and extension selection\n */\n\n\n function applyNodeExtensionResolution(unqualifiedPath, candidates, {\n extensions\n }) {\n // We use this \"infinite while\" so that we can restart the process as long as we hit package folders\n while (true) {\n let stat;\n\n try {\n candidates.push(unqualifiedPath);\n stat = opts.fakeFs.statSync(unqualifiedPath);\n } catch (error) {} // If the file exists and is a file, we can stop right there\n\n\n if (stat && !stat.isDirectory()) return opts.fakeFs.realpathSync(unqualifiedPath); // If the file is a directory, we must check if it contains a package.json with a \"main\" entry\n\n if (stat && stat.isDirectory()) {\n let pkgJson;\n\n try {\n pkgJson = JSON.parse(opts.fakeFs.readFileSync(ppath.join(unqualifiedPath, toFilename(`package.json`)), `utf8`));\n } catch (error) {}\n\n let nextUnqualifiedPath;\n if (pkgJson && pkgJson.main) nextUnqualifiedPath = ppath.resolve(unqualifiedPath, pkgJson.main); // If the \"main\" field changed the path, we start again from this new location\n\n if (nextUnqualifiedPath && nextUnqualifiedPath !== unqualifiedPath) {\n const resolution = applyNodeExtensionResolution(nextUnqualifiedPath, candidates, {\n extensions\n });\n\n if (resolution !== null) {\n return resolution;\n }\n }\n } // Otherwise we check if we find a file that match one of the supported extensions\n\n\n const qualifiedPath = extensions.map(extension => {\n return `${unqualifiedPath}${extension}`;\n }).find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (qualifiedPath) return qualifiedPath; // Otherwise, we check if the path is a folder - in such a case, we try to use its index\n\n if (stat && stat.isDirectory()) {\n const indexPath = extensions.map(extension => {\n return ppath.format({\n dir: unqualifiedPath,\n name: toFilename(`index`),\n ext: extension\n });\n }).find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n\n if (indexPath) {\n return indexPath;\n }\n } // Otherwise there's nothing else we can do :(\n\n\n return null;\n }\n }\n /**\n * This function creates fake modules that can be used with the _resolveFilename function.\n * Ideally it would be nice to be able to avoid this, since it causes useless allocations\n * and cannot be cached efficiently (we recompute the nodeModulePaths every time).\n *\n * Fortunately, this should only affect the fallback, and there hopefully shouldn't have a\n * lot of them.\n */\n\n\n function makeFakeModule(path) {\n // @ts-ignore\n const fakeModule = new external_module_default.a(path, null);\n fakeModule.filename = path;\n fakeModule.paths = external_module_default.a._nodeModulePaths(path);\n return fakeModule;\n }\n /**\n * Normalize path to posix format.\n */\n\n\n function normalizePath(p) {\n return npath.toPortablePath(p);\n }\n /**\n * Forward the resolution to the next resolver (usually the native one)\n */\n\n\n function callNativeResolution(request, issuer) {\n if (issuer.endsWith(`/`)) issuer = ppath.join(issuer, toFilename(`internal.js`)); // Since we would need to create a fake module anyway (to call _resolveLookupPath that\n // would give us the paths to give to _resolveFilename), we can as well not use\n // the {paths} option at all, since it internally makes _resolveFilename create another\n // fake module anyway.\n\n return external_module_default.a._resolveFilename(request, makeFakeModule(npath.fromPortablePath(issuer)), false, {\n plugnplay: false\n });\n }\n /**\n * This key indicates which version of the standard is implemented by this resolver. The `std` key is the\n * Plug'n'Play standard, and any other key are third-party extensions. Third-party extensions are not allowed\n * to override the standard, and can only offer new methods.\n *\n * If an new version of the Plug'n'Play standard is released and some extensions conflict with newly added\n * functions, they'll just have to fix the conflicts and bump their own version number.\n */\n\n\n const VERSIONS = {\n std: 3\n };\n /**\n * We export a special symbol for easy access to the top level locator.\n */\n\n const topLevel = topLevelLocator;\n /**\n * Gets the package information for a given locator. Returns null if they cannot be retrieved.\n */\n\n function getPackageInformation({\n name,\n reference\n }) {\n const packageInformationStore = packageRegistry.get(name);\n if (!packageInformationStore) return null;\n const packageInformation = packageInformationStore.get(reference);\n if (!packageInformation) return null;\n return packageInformation;\n }\n /**\n * Finds the package locator that owns the specified path. If none is found, returns null instead.\n */\n\n\n function findPackageLocator(location) {\n let relativeLocation = normalizePath(ppath.relative(runtimeState.basePath, location));\n if (!relativeLocation.match(isStrictRegExp)) relativeLocation = `./${relativeLocation}`;\n if (location.match(isDirRegExp) && !relativeLocation.endsWith(`/`)) relativeLocation = `${relativeLocation}/`;\n let from = 0; // If someone wants to use a binary search to go from O(n) to O(log n), be my guest\n\n while (from < packageLocationLengths.length && packageLocationLengths[from] > relativeLocation.length) from += 1;\n\n for (let t = from; t < packageLocationLengths.length; ++t) {\n const locator = packageLocatorsByLocations.get(relativeLocation.substr(0, packageLocationLengths[t]));\n if (typeof locator === `undefined`) continue; // Ensures that the returned locator isn't a blacklisted one.\n //\n // Blacklisted packages are packages that cannot be used because their dependencies cannot be deduced. This only\n // happens with peer dependencies, which effectively have different sets of dependencies depending on their\n // parents.\n //\n // In order to deambiguate those different sets of dependencies, the Yarn implementation of PnP will generate a\n // symlink for each combination of // it will find, and will\n // blacklist the target of those symlinks. By doing this, we ensure that files loaded through a specific path\n // will always have the same set of dependencies, provided the symlinks are correctly preserved.\n //\n // Unfortunately, some tools do not preserve them, and when it happens PnP isn't able anymore to deduce the set of\n // dependencies based on the path of the file that makes the require calls. But since we've blacklisted those\n // paths, we're able to print a more helpful error message that points out that a third-party package is doing\n // something incompatible!\n\n if (locator === null) {\n throw internalTools_makeError(ErrorCode.BLACKLISTED, `A forbidden path has been used in the package resolution process - this is usually caused by one of your tools calling 'fs.realpath' on the return value of 'require.resolve'. Since we need to use symlinks to simultaneously provide valid filesystem paths and disambiguate peer dependencies, they must be passed untransformed to 'require'.\\n\\nForbidden path: ${location}`, {\n location\n });\n }\n\n return locator;\n }\n\n return null;\n }\n /**\n * Transforms a request (what's typically passed as argument to the require function) into an unqualified path.\n * This path is called \"unqualified\" because it only changes the package name to the package location on the disk,\n * which means that the end result still cannot be directly accessed (for example, it doesn't try to resolve the\n * file extension, or to resolve directories to their \"index.js\" content). Use the \"resolveUnqualified\" function\n * to convert them to fully-qualified paths, or just use \"resolveRequest\" that do both operations in one go.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n\n\n function resolveToUnqualified(request, issuer, {\n considerBuiltins = true\n } = {}) {\n // The 'pnpapi' request is reserved and will always return the path to the PnP file, from everywhere\n if (request === `pnpapi`) return npath.toPortablePath(opts.pnpapiResolution); // Bailout if the request is a native module\n\n if (considerBuiltins && builtinModules.has(request)) return null; // We allow disabling the pnp resolution for some subpaths. This is because some projects, often legacy,\n // contain multiple levels of dependencies (ie. a yarn.lock inside a subfolder of a yarn.lock). This is\n // typically solved using workspaces, but not all of them have been converted already.\n\n if (ignorePattern && issuer && ignorePattern.test(normalizePath(issuer))) {\n const result = callNativeResolution(request, issuer);\n\n if (result === false) {\n throw internalTools_makeError(ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp)\\n\\nRequire request: \"${request}\"\\nRequired by: ${issuer}\\n`, {\n request,\n issuer\n });\n }\n\n return npath.toPortablePath(result);\n }\n\n let unqualifiedPath; // If the request is a relative or absolute path, we just return it normalized\n\n const dependencyNameMatch = request.match(pathRegExp);\n\n if (!dependencyNameMatch) {\n if (ppath.isAbsolute(request)) {\n unqualifiedPath = ppath.normalize(request);\n } else {\n if (!issuer) {\n throw internalTools_makeError(ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, {\n request,\n issuer\n });\n }\n\n if (issuer.match(isDirRegExp)) {\n unqualifiedPath = ppath.normalize(ppath.resolve(issuer, request));\n } else {\n unqualifiedPath = ppath.normalize(ppath.resolve(ppath.dirname(issuer), request));\n }\n } // No need to use the return value; we just want to check the blacklist status\n\n\n findPackageLocator(unqualifiedPath);\n } // Things are more hairy if it's a package require - we then need to figure out which package is needed, and in\n // particular the exact version for the given location on the dependency tree\n else {\n if (!issuer) {\n throw internalTools_makeError(ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, {\n request,\n issuer\n });\n }\n\n const [, dependencyName, subPath] = dependencyNameMatch;\n const issuerLocator = findPackageLocator(issuer); // If the issuer file doesn't seem to be owned by a package managed through pnp, then we resort to using the next\n // resolution algorithm in the chain, usually the native Node resolution one\n\n if (!issuerLocator) {\n const result = callNativeResolution(request, issuer);\n\n if (result === false) {\n throw internalTools_makeError(ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree)\\n\\nRequire path: \"${request}\"\\nRequired by: ${issuer}\\n`, {\n request,\n issuer\n });\n }\n\n return npath.toPortablePath(result);\n }\n\n const issuerInformation = getPackageInformationSafe(issuerLocator); // We obtain the dependency reference in regard to the package that request it\n\n let dependencyReference = issuerInformation.packageDependencies.get(dependencyName); // If we can't find it, we check if we can potentially load it from the packages that have been defined as potential fallbacks.\n // It's a bit of a hack, but it improves compatibility with the existing Node ecosystem. Hopefully we should eventually be able\n // to kill this logic and become stricter once pnp gets enough traction and the affected packages fix themselves.\n\n if (issuerLocator.name !== null) {\n // To allow programs to become gradually stricter, starting from the v2 we enforce that workspaces cannot depend on fallbacks.\n // This works by having a list containing all their locators, and checking when a fallback is required whether it's one of them.\n const exclusionEntry = runtimeState.fallbackExclusionList.get(issuerLocator.name);\n const canUseFallbacks = !exclusionEntry || !exclusionEntry.has(issuerLocator.reference);\n\n if (canUseFallbacks) {\n for (let t = 0, T = fallbackLocators.length; dependencyReference === undefined && t < T; ++t) {\n const fallbackInformation = getPackageInformationSafe(fallbackLocators[t]);\n const fallbackReference = fallbackInformation.packageDependencies.get(dependencyName);\n\n if (fallbackReference !== null) {\n dependencyReference = fallbackReference;\n }\n }\n }\n } // If we can't find the path, and if the package making the request is the top-level, we can offer nicer error messages\n\n\n if (dependencyReference === null) {\n if (isDependencyTreeRoot(issuerLocator)) {\n throw internalTools_makeError(ErrorCode.MISSING_PEER_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a peer dependency; this isn't allowed as the peer dependency cannot be provided by any parent package\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, {\n request,\n issuer,\n dependencyName\n });\n } else {\n throw internalTools_makeError(ErrorCode.MISSING_PEER_DEPENDENCY, `A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, {\n request,\n issuer,\n issuerLocator: Object.assign({}, issuerLocator),\n dependencyName\n });\n }\n } else if (dependencyReference === undefined) {\n if (isDependencyTreeRoot(issuerLocator)) {\n throw internalTools_makeError(ErrorCode.UNDECLARED_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, {\n request,\n issuer,\n dependencyName\n });\n } else {\n const candidates = Array.from(issuerInformation.packageDependencies.keys());\n throw internalTools_makeError(ErrorCode.UNDECLARED_DEPENDENCY, `A package is trying to access another package without the second one being listed as a dependency of the first one\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, {\n request,\n issuer,\n issuerLocator: Object.assign({}, issuerLocator),\n dependencyName,\n candidates\n });\n }\n } // We need to check that the package exists on the filesystem, because it might not have been installed\n\n\n const dependencyLocator = Array.isArray(dependencyReference) ? {\n name: dependencyReference[0],\n reference: dependencyReference[1]\n } : {\n name: dependencyName,\n reference: dependencyReference\n };\n const dependencyInformation = getPackageInformationSafe(dependencyLocator);\n\n if (!dependencyInformation.packageLocation) {\n throw internalTools_makeError(ErrorCode.MISSING_DEPENDENCY, `A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.\\n\\nRequired package: ${dependencyLocator.name}@${dependencyLocator.reference} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, {\n request,\n issuer,\n dependencyLocator: Object.assign({}, dependencyLocator)\n });\n } // Now that we know which package we should resolve to, we only have to find out the file location\n\n\n const dependencyLocation = ppath.resolve(runtimeState.basePath, dependencyInformation.packageLocation);\n\n if (subPath) {\n unqualifiedPath = ppath.resolve(dependencyLocation, subPath);\n } else {\n unqualifiedPath = dependencyLocation;\n }\n }\n\n return ppath.normalize(unqualifiedPath);\n }\n\n ;\n /**\n * Transforms an unqualified path into a qualified path by using the Node resolution algorithm (which automatically\n * appends \".js\" / \".json\", and transforms directory accesses into \"index.js\").\n */\n\n function resolveUnqualified(unqualifiedPath, {\n extensions = Object.keys(external_module_default.a._extensions)\n } = {}) {\n const candidates = [];\n const qualifiedPath = applyNodeExtensionResolution(unqualifiedPath, candidates, {\n extensions\n });\n\n if (qualifiedPath) {\n return ppath.normalize(qualifiedPath);\n } else {\n throw internalTools_makeError(ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, `Couldn't find a suitable Node resolution for the specified unqualified path\\n\\nSource path: ${unqualifiedPath}\\n${candidates.map(candidate => `Rejected resolution: ${candidate}\\n`).join(``)}`, {\n unqualifiedPath\n });\n }\n }\n\n ;\n /**\n * Transforms a request into a fully qualified path.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n\n function resolveRequest(request, issuer, {\n considerBuiltins,\n extensions\n } = {}) {\n let unqualifiedPath = resolveToUnqualified(request, issuer, {\n considerBuiltins\n });\n if (unqualifiedPath === null) return null;\n\n try {\n return resolveUnqualified(unqualifiedPath, {\n extensions\n });\n } catch (resolutionError) {\n if (resolutionError.pnpCode === 'QUALIFIED_PATH_RESOLUTION_FAILED') Object.assign(resolutionError.data, {\n request,\n issuer\n });\n throw resolutionError;\n }\n }\n\n ;\n return {\n VERSIONS,\n topLevel,\n getDependencyTreeRoots: () => {\n return [...runtimeState.dependencyTreeRoots];\n },\n getPackageInformation: locator => {\n const info = getPackageInformation(locator);\n if (info === null) return null;\n const packageLocation = npath.fromPortablePath(info.packageLocation);\n const nativeInfo = Object.assign(Object.assign({}, info), {\n packageLocation\n });\n return nativeInfo;\n },\n findPackageLocator: path => {\n return findPackageLocator(npath.toPortablePath(path));\n },\n resolveToUnqualified: maybeLog(`resolveToUnqualified`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? npath.toPortablePath(issuer) : null;\n const resolution = resolveToUnqualified(npath.toPortablePath(request), portableIssuer, opts);\n if (resolution === null) return null;\n return npath.fromPortablePath(resolution);\n }),\n resolveUnqualified: maybeLog(`resolveUnqualified`, (unqualifiedPath, opts) => {\n return npath.fromPortablePath(resolveUnqualified(npath.toPortablePath(unqualifiedPath), opts));\n }),\n resolveRequest: maybeLog(`resolveRequest`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? npath.toPortablePath(issuer) : null;\n const resolution = resolveRequest(npath.toPortablePath(request), portableIssuer, opts);\n if (resolution === null) return null;\n return npath.fromPortablePath(resolution);\n })\n };\n}\n// CONCATENATED MODULE: ./sources/loader/_entryPoint.ts\nvar _entryPoint_rest = undefined && undefined.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n // We must copy the fs into a local, because otherwise\n// 1. we would make the NodeFS instance use the function that we patched (infinite loop)\n// 2. Object.create(fs) isn't enough, since it won't prevent the proto from being modified\n\nconst localFs = Object.assign({}, external_fs_default.a);\nconst nodeFs = new NodeFS_NodeFS(localFs);\nconst defaultRuntimeState = $$SETUP_STATE(hydrateRuntimeState);\nconst defaultPnpapiResolution = external_path_default.a.resolve(__dirname, __filename);\nlet defaultFsLayer = new ZipOpenFS_ZipOpenFS({\n baseFs: nodeFs,\n readOnlyArchives: true\n});\n\nfor (const virtualRoot of defaultRuntimeState.virtualRoots) defaultFsLayer = new VirtualFS_VirtualFS(virtualRoot, {\n baseFs: defaultFsLayer\n});\n\nconst defaultApi = Object.assign(makeApi(defaultRuntimeState, {\n fakeFs: defaultFsLayer,\n pnpapiResolution: defaultPnpapiResolution\n}), {\n /**\n * Can be used to generate a different API than the default one (for example\n * to map it on `/` rather than the local directory path, or to use a\n * different FS layer than the default one).\n */\n makeApi: _a => {\n var {\n basePath = undefined,\n fakeFs = defaultFsLayer,\n pnpapiResolution = defaultPnpapiResolution\n } = _a,\n rest = _entryPoint_rest(_a, [\"basePath\", \"fakeFs\", \"pnpapiResolution\"]);\n\n const apiRuntimeState = typeof basePath !== `undefined` ? $$SETUP_STATE(hydrateRuntimeState, basePath) : defaultRuntimeState;\n return makeApi(apiRuntimeState, Object.assign({\n fakeFs,\n pnpapiResolution\n }, rest));\n },\n\n /**\n * Will inject the specified API into the environment, monkey-patching FS. Is\n * automatically called when the hook is loaded through `--require`.\n */\n setup: api => {\n applyPatch(api || defaultApi, {\n fakeFs: defaultFsLayer\n });\n }\n}); // eslint-disable-next-line arca/no-default-export\n\n/* harmony default export */ var _entryPoint = __webpack_exports__[\"default\"] = (defaultApi);\n\nif (__non_webpack_module__.parent && __non_webpack_module__.parent.id === 'internal/preload') {\n defaultApi.setup();\n\n if (__non_webpack_module__.filename) {\n // We delete it from the cache in order to support the case where the CLI resolver is invoked from \"yarn run\"\n // It's annoying because it might cause some issues when the file is multiple times in NODE_OPTIONS, but it shouldn't happen anyway.\n // @ts-ignore\n delete external_module_default.a._cache[__non_webpack_module__.filename];\n }\n} // @ts-ignore\n\n\nif (process.mainModule === __non_webpack_module__) {\n const reportError = (code, message, data) => {\n process.stdout.write(`${JSON.stringify([{\n code,\n message,\n data\n }, null])}\\n`);\n };\n\n const reportSuccess = resolution => {\n process.stdout.write(`${JSON.stringify([null, resolution])}\\n`);\n };\n\n const processResolution = (request, issuer) => {\n try {\n reportSuccess(defaultApi.resolveRequest(request, issuer));\n } catch (error) {\n reportError(error.code, error.message, error.data);\n }\n };\n\n const processRequest = data => {\n try {\n const [request, issuer] = JSON.parse(data);\n processResolution(request, issuer);\n } catch (error) {\n reportError(`INVALID_JSON`, error.message, error.data);\n }\n };\n\n if (process.argv.length > 2) {\n if (process.argv.length !== 4) {\n process.stderr.write(`Usage: ${process.argv[0]} ${process.argv[1]} \\n`);\n process.exitCode = 64;\n /* EX_USAGE */\n } else {\n processResolution(process.argv[2], process.argv[3]);\n }\n } else {\n let buffer = '';\n const decoder = new external_string_decoder_default.a.StringDecoder();\n process.stdin.on('data', chunk => {\n buffer += decoder.write(chunk);\n\n do {\n const index = buffer.indexOf('\\n');\n if (index === -1) break;\n const line = buffer.slice(0, index);\n buffer = buffer.slice(index + 1);\n processRequest(line);\n } while (true);\n });\n }\n}\n\n/***/ })\n/******/ ])[\"default\"];\n});"; diff --git a/packages/yarnpkg-pnp/package.json b/packages/yarnpkg-pnp/package.json index 9778a6a3643d..a36590b43bd7 100644 --- a/packages/yarnpkg-pnp/package.json +++ b/packages/yarnpkg-pnp/package.json @@ -3,7 +3,7 @@ "version": "2.0.0-rc.6", "nextVersion": { "semver": "2.0.0-rc.7", - "nonce": "7116580554445175" + "nonce": "3543853331189143" }, "main": "./sources/index.ts", "dependencies": { diff --git a/packages/yarnpkg-pnp/sources/loader/applyPatch.ts b/packages/yarnpkg-pnp/sources/loader/applyPatch.ts index cdd1795075ac..b3a2b8fabf95 100644 --- a/packages/yarnpkg-pnp/sources/loader/applyPatch.ts +++ b/packages/yarnpkg-pnp/sources/loader/applyPatch.ts @@ -242,14 +242,14 @@ export function applyPatch(pnpapi: PnpApi, opts: ApplyPatchOptions) { const originalFindPath = Module._findPath; - Module._findPath = function(request: string, paths: Array, isMain: boolean) { + Module._findPath = function(request: string, paths: Array|null, isMain: boolean) { if (request === `pnpapi`) return false; if (!enableNativeHooks) return originalFindPath.call(Module, request, paths, isMain); - for (const path of paths) { + for (const path of paths || []) { let resolution; try { diff --git a/packages/yarnpkg-pnp/types/module/index.d.ts b/packages/yarnpkg-pnp/types/module/index.d.ts index 5c92a3bde2e4..e9c64b772544 100644 --- a/packages/yarnpkg-pnp/types/module/index.d.ts +++ b/packages/yarnpkg-pnp/types/module/index.d.ts @@ -3,7 +3,7 @@ declare namespace NodeJS { const _cache: {[p: string]: NodeModule}; const _extensions: {[ext: string]: any}; - function _findPath(request: string, paths: Array, isMain: boolean): string | false; + function _findPath(request: string, paths: Array|null, isMain: boolean): string | false; function _nodeModulePaths(from: string): Array; function _resolveFilename(request: string, parent: NodeModule | null, isMain: boolean, options?: {[key: string]: any}): string; function _load(request: string, parent: NodeModule | null, isMain: boolean): any; diff --git a/packages/yarnpkg-pnpify/package.json b/packages/yarnpkg-pnpify/package.json index ac996390fc71..53ed1c7472ba 100644 --- a/packages/yarnpkg-pnpify/package.json +++ b/packages/yarnpkg-pnpify/package.json @@ -3,7 +3,7 @@ "version": "2.0.0-rc.7", "nextVersion": { "semver": "2.0.0-rc.8", - "nonce": "8206665822561467" + "nonce": "8532980954301309" }, "main": "./sources/boot-dev.js", "bin": "./sources/boot-cli-dev.js",