// @bun
var{defineProperty:y,getOwnPropertyNames:C,getOwnPropertyDescriptor:D}=Object,E=Object.prototype.hasOwnProperty;function G(j){return this[j]}var S=(j)=>{var k=(z??=new WeakMap).get(j),q;if(k)return k;if(k=y({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var u of C(j))if(!E.call(k,u))y(k,u,{get:G.bind(j,u),enumerable:!(q=D(j,u))||q.enumerable})}return z.set(j,k),k},z;var H=(j)=>j;function J(j,k){this[j]=H.bind(null,k)}var T=(j,k)=>{for(var q in k)y(j,q,{get:k[q],enumerable:!0,configurable:!0,set:J.bind(k,q)})};var K=(j,k)=>()=>(j&&(k=j(j=0)),k);var U=import.meta.require;import B from"net";async function L(j){return new Promise((k)=>{let q=B.createServer();q.once("error",()=>k(!1)),q.once("listening",()=>{q.close(()=>k(!0))}),q.listen(j,"0.0.0.0")})}async function M(j){return new Promise((k)=>{let q=B.createServer();q.once("error",()=>k(!1)),q.once("listening",()=>{q.close(()=>k(!0))}),q.listen(j,"::")})}async function N(j){if(!await L(j))return!1;return await M(j)}async function O(j,k=20){j=Number(j);for(let q=0;q<k;q++){let u=j+q;if(await N(u))return u}throw Error(`Could not find an available port between ${j} and ${j+k-1}`)}async function Y(j){let k=j.end-j.start+1;return O(j.start,k)}var X=3000;var Q=()=>{};Q();export{N as isPortAvailable,Y as findAvailablePortInRange,O as findAvailablePort,X as DEFAULT_PORT};
