"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var $=require("vm"),b=require("path"),h=require("module");function p(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var m=p($),a=p(b),j=p(h),C=require;const E=/^[./]/,q=e=>!E.test(e),F=/^(?:node:)?((?:@[\da-z][\w.-]+\/)?[\da-z][\w.-]+)(\/.+)?$/,g=e=>{var r;return(r=e.match(F))==null?void 0:r.slice(1,3)},O=C;function B(e,r,t){var n;const[o,i]=(n=g(r))!=null?n:[];if(o==="fs"){const{fs:c}=t!=null?t:{};if(c!==!0){const s=c||e;if(!i)return s;if(i==="/promises"&&"promises"in s)return s.promises;throw new Error(`Cannot find module '${r}'`)}}return O(r)}const S=[".js",".json"],D=new RegExp(`(${S.map(e=>e.replace(/\./g,"\\$&")).join("|")})$`),I=(e,r)=>e.lstatSync(r).isDirectory();function x(e,r,t){var n,o;if(!a.default.isAbsolute(r)&&t&&(r=a.default.resolve(a.default.dirname(t.filename),r)),e.existsSync(r))return I(e,r)?x(e,a.default.join(r,"index.js"),t)||x(e,a.default.join(r,"index.json"),t):{extension:(o=(n=r.match(D))==null?void 0:n[0])!=null?o:"",filePath:r};for(const i of S){const c=r+i;if(e.existsSync(c))return{extension:i,filePath:c}}return null}function y(e,r,t){const n=x(e,r,t);if(!n)throw new Error(`Cannot find module '${r}'`);return n}const d={"":void 0,".js":void 0,".json":void 0};d[""]=function(e,r,t,n,o){const i=j.default.wrap(r);m.default.runInThisContext(i,{filename:`fs-require://${o}${n}`,lineOffset:0,displayErrors:!0})(e.exports,t(e),e,a.default.basename(n),a.default.dirname(n))},d[".js"]=d[""],d[".json"]=function(e,r){e.exports=JSON.parse(r)};let R=0;const L=(e,r)=>{R+=1;const t=R,n=Object.create(null);function o(i){const c=u=>q(u)?u:y(e,u,i).filePath,s=u=>{var v;if(q(u))return B(e,u,r);const _=y(e,u,i),{filePath:f}=_;let l=n[f];if(!l){l=new j.default(f,i||void 0),l.filename=f;const w=e.readFileSync(f).toString();(v=d[_.extension])==null||v.call(d,l,w,o,f,t),n[f]=l}return l.exports};return s.id=t,s.resolve=c,s.cache=n,s}return o(typeof module>"u"?void 0:module.parent)};exports.createFsRequire=L;