// @bun
import{MG as M,PG as T}from"./chunk-xyhgvt88.js";var F=M((H)=>{var X=(k,z)=>()=>(z||k((z={exports:{}}).exports,z),z.exports),c=X((k)=>{Object.defineProperty(k,"__esModule",{value:!0}),k.sync=k.isexe=void 0;var z=T("fs"),J=T("fs/promises"),K=async(Z,Q={})=>{let{ignoreErrors:Y=!1}=Q;try{return q(await(0,J.stat)(Z),Q)}catch($){let A=$;if(Y||A.code==="EACCES")return!1;throw A}};k.isexe=K;var V=(Z,Q={})=>{let{ignoreErrors:Y=!1}=Q;try{return q((0,z.statSync)(Z),Q)}catch($){let A=$;if(Y||A.code==="EACCES")return!1;throw A}};k.sync=V;var q=(Z,Q)=>Z.isFile()&&B(Z,Q),B=(Z,Q)=>{let Y=Q.uid??process.getuid?.(),$=Q.groups??process.getgroups?.()??[],A=Q.gid??process.getgid?.()??$[0];if(Y===void 0||A===void 0)throw Error("cannot get uid or gid");let C=new Set([A,...$]),G=Z.mode,U=Z.uid,u=Z.gid,_=parseInt("100",8),L=parseInt("010",8),w=parseInt("001",8),E=_|L;return!!(G&w||G&L&&C.has(u)||G&_&&U===Y||G&E&&Y===0)}}),m=X((k)=>{Object.defineProperty(k,"__esModule",{value:!0}),k.sync=k.isexe=void 0;var z=T("fs"),J=T("fs/promises"),K=T("path"),V=async(Q,Y={})=>{let{ignoreErrors:$=!1}=Y;try{return Z(await(0,J.stat)(Q),Q,Y)}catch(A){let C=A;if($||C.code==="EACCES")return!1;throw C}};k.isexe=V;var q=(Q,Y={})=>{let{ignoreErrors:$=!1}=Y;try{return Z((0,z.statSync)(Q),Q,Y)}catch(A){let C=A;if($||C.code==="EACCES")return!1;throw C}};k.sync=q;var B=(Q,Y)=>{let{pathExt:$=process.env.PATHEXT||""}=Y,A=$.split(K.delimiter);if(A.indexOf("")!==-1)return!0;for(let C of A){let G=C.toLowerCase(),U=Q.substring(Q.length-G.length).toLowerCase();if(G&&U===G)return!0}return!1},Z=(Q,Y,$)=>Q.isFile()&&B(Y,$)}),h=X((k)=>{Object.defineProperty(k,"__esModule",{value:!0})}),N=H&&H.__createBinding||(Object.create?function(k,z,J,K){K===void 0&&(K=J);var V=Object.getOwnPropertyDescriptor(z,J);(!V||("get"in V?!z.__esModule:V.writable||V.configurable))&&(V={enumerable:!0,get:function(){return z[J]}}),Object.defineProperty(k,K,V)}:function(k,z,J,K){K===void 0&&(K=J),k[K]=z[J]}),d=H&&H.__setModuleDefault||(Object.create?function(k,z){Object.defineProperty(k,"default",{enumerable:!0,value:z})}:function(k,z){k.default=z}),O=H&&H.__importStar||function(){var k=function(z){return k=Object.getOwnPropertyNames||function(J){var K=[];for(var V in J)Object.prototype.hasOwnProperty.call(J,V)&&(K[K.length]=V);return K},k(z)};return function(z){if(z&&z.__esModule)return z;var J={};if(z!=null)for(var K=k(z),V=0;V<K.length;V++)K[V]!=="default"&&N(J,z,K[V]);return d(J,z),J}}(),x=H&&H.__exportStar||function(k,z){for(var J in k)J!=="default"&&!Object.prototype.hasOwnProperty.call(z,J)&&N(z,k,J)};Object.defineProperty(H,"__esModule",{value:!0});H.sync=H.isexe=H.posix=H.win32=void 0;var R=O(c());H.posix=R;var W=O(m());H.win32=W;x(h(),H);var a=process.env._ISEXE_TEST_PLATFORM_||process.platform,b=a==="win32"?W:R;H.isexe=b.isexe;H.sync=b.sync});var zk=M((Zk,P)=>{var{isexe:p,sync:o}=F(),{join:r,delimiter:e,sep:I,posix:y}=T("path"),S=process.platform==="win32",D=new RegExp(`[${y.sep}${I===y.sep?"":I}]`.replace(/(\\)/g,"\\$1")),t=new RegExp(`^\\.${D.source}`),g=(k)=>Object.assign(Error(`not found: ${k}`),{code:"ENOENT"}),v=(k,{path:z=process.env.PATH,pathExt:J=process.env.PATHEXT,delimiter:K=e})=>{let V=k.match(D)?[""]:[...S?[process.cwd()]:[],...(z||"").split(K)];if(S){let q=J||[".EXE",".CMD",".BAT",".COM"].join(K),B=q.split(K).flatMap((Z)=>[Z,Z.toLowerCase()]);if(k.includes(".")&&B[0]!=="")B.unshift("");return{pathEnv:V,pathExt:B,pathExtExe:q}}return{pathEnv:V,pathExt:[""]}},f=(k,z)=>{let J=/^".*"$/.test(k)?k.slice(1,-1):k;return(!J&&t.test(z)?z.slice(0,2):"")+r(J,z)},l=async(k,z={})=>{let{pathEnv:J,pathExt:K,pathExtExe:V}=v(k,z),q=[];for(let B of J){let Z=f(B,k);for(let Q of K){let Y=Z+Q;if(await p(Y,{pathExt:V,ignoreErrors:!0})){if(!z.all)return Y;q.push(Y)}}}if(z.all&&q.length)return q;if(z.nothrow)return null;throw g(k)},kk=(k,z={})=>{let{pathEnv:J,pathExt:K,pathExtExe:V}=v(k,z),q=[];for(let B of J){let Z=f(B,k);for(let Q of K){let Y=Z+Q;if(o(Y,{pathExt:V,ignoreErrors:!0})){if(!z.all)return Y;q.push(Y)}}}if(z.all&&q.length)return q;if(z.nothrow)return null;throw g(k)};P.exports=l;l.sync=kk});
export{zk as jw};
