"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Z=require("../../../../../../_virtual/___vite-browser-external.js"),ve=require("./homedir.js"),pe=require("./caller.js"),ge=require("./node-modules-paths.js"),me=require("./normalize-options.js"),_e=require("../../../../is-core-module@2.9.0/node_modules/is-core-module/index.js");var S,Q;function he(){if(Q)return S;Q=1;var y=Z,W=ve.__require(),s=Z,X=pe.__require(),Y=ge.__require(),b=me.__require(),x=_e.__require(),ee=process.platform!=="win32"&&y.realpath&&typeof y.realpath.native=="function"?y.realpath.native:y.realpath,z=W(),ne=function(){return[s.join(z,".node_modules"),s.join(z,".node_libraries")]},ie=function(a,c){y.stat(a,function(l,i){return l?l.code==="ENOENT"||l.code==="ENOTDIR"?c(null,!1):c(l):c(null,i.isFile()||i.isFIFO())})},re=function(a,c){y.stat(a,function(l,i){return l?l.code==="ENOENT"||l.code==="ENOTDIR"?c(null,!1):c(l):c(null,i.isDirectory())})},ae=function(a,c){ee(a,function(l,i){l&&l.code!=="ENOENT"?c(l):c(null,l?a:i)})},q=function(a,c,l,i){l&&l.preserveSymlinks===!1?a(c,i):i(null,c)},te=function(a,c,l){a(c,function(i,e){if(i)l(i);else try{var C=JSON.parse(e);l(null,C)}catch{l(null)}})},le=function(a,c,l){for(var i=Y(c,l,a),e=0;e<i.length;e++)i[e]=s.join(i[e],a);return i};return S=function(a,c,l){var i=l,e=c;if(typeof c=="function"&&(i=e,e={}),typeof a!="string"){var C=new TypeError("Path must be a string.");return process.nextTick(function(){i(C)})}e=b(a,e);var A=e.isFile||ie,oe=e.isDirectory||re,U=e.readFile||y.readFile,D=e.realpath||ae,L=e.readPackage||te;if(e.readFile&&e.readPackage){var ue=new TypeError("`readFile` and `readPackage` are mutually exclusive.");return process.nextTick(function(){i(ue)})}var B=e.packageIterator,G=e.extensions||[".js"],fe=e.includeCoreModules!==!1,H=e.basedir||s.dirname(X()),J=e.filename||H;e.paths=e.paths||ne();var se=s.resolve(H);q(D,se,e,function(n,t){n?i(n):ce(t)});var O;function ce(n){if(/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(a))O=s.resolve(n,a),(a==="."||a===".."||a.slice(-1)==="/")&&(O+="/"),/\/$/.test(a)&&O===n?E(O,e.package,K):F(O,e.package,K);else{if(fe&&x(a))return i(null,a);de(a,n,function(t,d,r){if(t)i(t);else{if(d)return q(D,d,e,function(g,f){g?i(g):i(null,f,r)});var o=new Error("Cannot find module '"+a+"' from '"+J+"'");o.code="MODULE_NOT_FOUND",i(o)}})}}function K(n,t,d){n?i(n):t?i(null,t,d):E(O,function(r,o,g){if(r)i(r);else if(o)q(D,o,e,function(u,p){u?i(u):i(null,p,g)});else{var f=new Error("Cannot find module '"+a+"' from '"+J+"'");f.code="MODULE_NOT_FOUND",i(f)}})}function F(n,t,d){var r=t,o=d;typeof r=="function"&&(o=r,r=void 0);var g=[""].concat(G);f(g,n,r);function f(u,p,_){if(u.length===0)return o(null,void 0,_);var j=p+u[0],m=_;m?v(null,m):R(s.dirname(j),v);function v(k,P,h){if(m=P,k)return o(k);if(h&&m&&e.pathFilter){var M=s.relative(h,j),w=M.slice(0,M.length-u[0].length),T=e.pathFilter(m,p,w);if(T)return f([""].concat(G.slice()),s.resolve(h,T),m)}A(j,I)}function I(k,P){if(k)return o(k);if(P)return o(null,j,m);f(u.slice(1),p,m)}}}function R(n,t){if(n===""||n==="/"||process.platform==="win32"&&/^\w:[/\\]*$/.test(n)||/[/\\]node_modules[/\\]*$/.test(n))return t(null);q(D,n,e,function(d,r){if(d)return R(s.dirname(n),t);var o=s.join(r,"package.json");A(o,function(g,f){if(!f)return R(s.dirname(n),t);L(U,o,function(u,p){u&&t(u);var _=p;_&&e.packageFilter&&(_=e.packageFilter(_,o)),t(null,_,n)})})})}function E(n,t,d){var r=d,o=t;typeof o=="function"&&(r=o,o=e.package),q(D,n,e,function(g,f){if(g)return r(g);var u=s.join(f,"package.json");A(u,function(p,_){if(p)return r(p);if(!_)return F(s.join(n,"index"),o,r);L(U,u,function(j,m){if(j)return r(j);var v=m;if(v&&e.packageFilter&&(v=e.packageFilter(v,u)),v&&v.main){if(typeof v.main!="string"){var I=new TypeError("package \u201C"+v.name+"\u201D `main` must be a string");return I.code="INVALID_PACKAGE_MAIN",r(I)}(v.main==="."||v.main==="./")&&(v.main="index"),F(s.resolve(n,v.main),v,function(k,P,h){if(k)return r(k);if(P)return r(null,P,h);if(!h)return F(s.join(n,"index"),h,r);var M=s.resolve(n,h.main);E(M,h,function(w,T,V){if(w)return r(w);if(T)return r(null,T,V);F(s.join(n,"index"),V,r)})});return}F(s.join(n,"/index"),v,r)})})})}function $(n,t){if(t.length===0)return n(null,void 0);var d=t[0];oe(s.dirname(d),r);function r(f,u){if(f)return n(f);if(!u)return $(n,t.slice(1));F(d,e.package,o)}function o(f,u,p){if(f)return n(f);if(u)return n(null,u,p);E(d,e.package,g)}function g(f,u,p){if(f)return n(f);if(u)return n(null,u,p);$(n,t.slice(1))}}function de(n,t,d){var r=function(){return le(n,t,e)};$(d,B?B(n,t,r,e):r())}},S}exports.__require=he;
//# sourceMappingURL=async.js.map
