import{__exports as r}from"../../../../../_virtual/async6.mjs";import{__require as t}from"../../../fs.stat/out/index.mjs";import{__require as e}from"../../../../run-parallel/index.mjs";import{__require as n}from"../constants.mjs";import{__require as i}from"../utils/index.mjs";import{__require as o}from"./common.mjs";var a;function s(){if(a)return r;a=1,Object.defineProperty(r,"__esModule",{value:!0}),r.readdir=r.readdirWithFileTypes=r.read=void 0;const s=t(),u=e(),l=n(),m=i(),d=o();function f(r,t,e){t.fs.readdir(r,{withFileTypes:!0},(n,i)=>{if(null!==n)return void c(e,n);const o=i.map(e=>({dirent:e,name:e.name,path:d.joinPathSegments(r,e.name,t.pathSegmentSeparator)}));if(!t.followSymbolicLinks)return void _(e,o);const a=o.map(r=>function(r,t){return e=>{r.dirent.isSymbolicLink()?t.fs.stat(r.path,(n,i)=>{if(null!==n)return t.throwErrorOnBrokenSymbolicLink?void e(n):void e(null,r);r.dirent=m.fs.createDirentFromStats(r.name,i),e(null,r)}):e(null,r)}}(r,t));u(a,(r,t)=>{null===r?_(e,t):c(e,r)})})}function p(r,t,e){t.fs.readdir(r,(n,i)=>{if(null!==n)return void c(e,n);const o=i.map(e=>{const n=d.joinPathSegments(r,e,t.pathSegmentSeparator);return r=>{s.stat(n,t.fsStatSettings,(i,o)=>{if(null!==i)return void r(i);const a={name:e,path:n,dirent:m.fs.createDirentFromStats(e,o)};t.stats&&(a.stats=o),r(null,a)})}});u(o,(r,t)=>{null===r?_(e,t):c(e,r)})})}function c(r,t){r(t)}function _(r,t){r(null,t)}return r.read=function(r,t,e){t.stats||!l.IS_SUPPORT_READDIR_WITH_FILE_TYPES?p(r,t,e):f(r,t,e)},r.readdirWithFileTypes=f,r.readdir=p,r}export{s as __require};